authscape 1.0.634 → 1.0.638

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
@@ -407,10 +407,16 @@ function AuthScapeApp(_ref) {
407
407
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
408
408
  name: "viewport",
409
409
  content: "width=device-width, initial-scale=0.86, maximum-scale=5.0, minimum-scale=0.86"
410
- }), pageProps != null && pageProps.oemCompanyId != null && /*#__PURE__*/_react["default"].createElement("link", {
410
+ }), pageProps != null && pageProps.oemCompanyId != null ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("link", {
411
411
  href: process.env.apiUri + "/api/PrivateLabel/GetDataFromRecord?oemCompanyId=" + pageProps.oemCompanyId,
412
412
  rel: "stylesheet"
413
- })), /*#__PURE__*/_react["default"].createElement(_styles.ThemeProvider, {
413
+ }), /*#__PURE__*/_react["default"].createElement("link", {
414
+ rel: "icon",
415
+ href: "/favicon.ico"
416
+ })) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("link", {
417
+ rel: "icon",
418
+ href: "/favicon.ico"
419
+ }))), /*#__PURE__*/_react["default"].createElement(_styles.ThemeProvider, {
414
420
  theme: muiTheme
415
421
  }, frontEndLoadedState != null && frontEndLoadedState && pathname != "/signin-oidc" && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, layout != null && layout({
416
422
  children: /*#__PURE__*/_react["default"].createElement(Component, _extends({}, pageProps, {
@@ -1504,7 +1510,6 @@ Object.defineProperty(exports, "__esModule", {
1504
1510
  value: true
1505
1511
  });
1506
1512
  exports.Dropzone = void 0;
1507
- var _AspectRatio = _interopRequireDefault(require("@mui/icons-material/AspectRatio"));
1508
1513
  var _Box = _interopRequireDefault(require("@mui/material/Box"));
1509
1514
  var _react = _interopRequireWildcard(require("react"));
1510
1515
  var _reactDropzone = require("react-dropzone");
@@ -2577,9 +2582,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2577
2582
  Object.defineProperty(exports, "__esModule", {
2578
2583
  value: true
2579
2584
  });
2580
- exports.NextImage = void 0;
2585
+ exports.AssignMapping = AssignMapping;
2581
2586
  var _react = _interopRequireWildcard(require("react"));
2582
- var _image = _interopRequireDefault(require("next/image"));
2587
+ var _system = require("@mui/system");
2588
+ var _Container = _interopRequireDefault(require("@mui/material/Container"));
2589
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
2590
+ var _material = require("@mui/material");
2591
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
2592
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
2593
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
2594
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
2595
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
2596
+ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
2597
+ var _ArrowRightAltRounded = _interopRequireDefault(require("@mui/icons-material/ArrowRightAltRounded"));
2583
2598
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
2584
2599
  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); }
2585
2600
  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; }
@@ -2591,430 +2606,3775 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
2591
2606
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
2592
2607
  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; }
2593
2608
  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; } }
2594
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2595
- var NextImage = function NextImage(_ref) {
2596
- var src = _ref.src,
2597
- alt = _ref.alt,
2598
- _ref$width = _ref.width,
2599
- width = _ref$width === void 0 ? 200 : _ref$width,
2600
- _ref$height = _ref.height,
2601
- height = _ref$height === void 0 ? 200 : _ref$height,
2602
- _ref$objectFit = _ref.objectFit,
2603
- objectFit = _ref$objectFit === void 0 ? "contain" : _ref$objectFit,
2604
- _ref$enableAuth = _ref.enableAuth,
2605
- enableAuth = _ref$enableAuth === void 0 ? false : _ref$enableAuth;
2606
- var _useState = (0, _react.useState)(false),
2609
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { apiService } from 'authscape';
2610
+ // import MappedColumn from './MappedColumn';
2611
+ // import ConditionBasedTool from './conditionBasedTool';
2612
+ // import SpreadsheetViewer from '../spreadsheetViewer';
2613
+ function AssignMapping(_ref) {
2614
+ var currentUser = _ref.currentUser,
2615
+ documentComponentId = _ref.documentComponentId,
2616
+ _ref$setIsLoading = _ref.setIsLoading,
2617
+ setIsLoading = _ref$setIsLoading === void 0 ? null : _ref$setIsLoading,
2618
+ _ref$onCancel = _ref.onCancel,
2619
+ onCancel = _ref$onCancel === void 0 ? null : _ref$onCancel,
2620
+ _ref$onPublished = _ref.onPublished,
2621
+ onPublished = _ref$onPublished === void 0 ? null : _ref$onPublished;
2622
+ var _useState = (0, _react.useState)(documentComponentId),
2607
2623
  _useState2 = _slicedToArray(_useState, 2),
2608
- imageError = _useState2[0],
2609
- setImageError = _useState2[1];
2624
+ documentId = _useState2[0],
2625
+ setDocumentId = _useState2[1];
2610
2626
  var _useState3 = (0, _react.useState)(null),
2611
2627
  _useState4 = _slicedToArray(_useState3, 2),
2612
- imageSrc = _useState4[0],
2613
- setImageSrc = _useState4[1];
2628
+ fromColumnOptions = _useState4[0],
2629
+ setFromColumnOptions = _useState4[1];
2630
+ var _useState5 = (0, _react.useState)(null),
2631
+ _useState6 = _slicedToArray(_useState5, 2),
2632
+ toColumnOptions = _useState6[0],
2633
+ setToColumnOptions = _useState6[1];
2634
+ var _useState7 = (0, _react.useState)(null),
2635
+ _useState8 = _slicedToArray(_useState7, 2),
2636
+ documentType = _useState8[0],
2637
+ setDocumentType = _useState8[1];
2638
+ var _useState9 = (0, _react.useState)(null),
2639
+ _useState10 = _slicedToArray(_useState9, 2),
2640
+ documentName = _useState10[0],
2641
+ setDocumentName = _useState10[1];
2642
+ var _useState11 = (0, _react.useState)(1),
2643
+ _useState12 = _slicedToArray(_useState11, 2),
2644
+ urlTick = _useState12[0],
2645
+ setURLTick = _useState12[1];
2646
+ var _useState13 = (0, _react.useState)(null),
2647
+ _useState14 = _slicedToArray(_useState13, 2),
2648
+ spreadSheetAddress = _useState14[0],
2649
+ setSpreadSheetAddress = _useState14[1];
2650
+ var _useState15 = (0, _react.useState)(false),
2651
+ _useState16 = _slicedToArray(_useState15, 2),
2652
+ showPreviewDialog = _useState16[0],
2653
+ setShowPreviewDialog = _useState16[1];
2654
+ var _useState17 = (0, _react.useState)(null),
2655
+ _useState18 = _slicedToArray(_useState17, 2),
2656
+ advanceQuery = _useState18[0],
2657
+ setAdvanceQuery = _useState18[1];
2658
+ var spreadSheetRef = (0, _react.useRef)(null);
2659
+ var fetchMappingTo = /*#__PURE__*/function () {
2660
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2661
+ var response;
2662
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2663
+ while (1) switch (_context.prev = _context.next) {
2664
+ case 0:
2665
+ _context.next = 2;
2666
+ return apiService().get("/DocumentMapping/GetMappedDynamicFieldsForCompany?companyId=" + currentUser.companyId + "&documentId=" + documentComponentId);
2667
+ case 2:
2668
+ response = _context.sent;
2669
+ if (response != null) {
2670
+ setToColumnOptions(response.data);
2671
+ }
2672
+ case 4:
2673
+ case "end":
2674
+ return _context.stop();
2675
+ }
2676
+ }, _callee);
2677
+ }));
2678
+ return function fetchMappingTo() {
2679
+ return _ref2.apply(this, arguments);
2680
+ };
2681
+ }();
2682
+ var fetchMappingFrom = /*#__PURE__*/function () {
2683
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
2684
+ var response;
2685
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2686
+ while (1) switch (_context2.prev = _context2.next) {
2687
+ case 0:
2688
+ _context2.next = 2;
2689
+ return apiService().post("/DocumentMapping/GetMapping", {
2690
+ documentComponentId: documentComponentId,
2691
+ companyId: currentUser.companyId
2692
+ });
2693
+ case 2:
2694
+ response = _context2.sent;
2695
+ if (response != null) {
2696
+ setFromColumnOptions(response.data.documentMappings);
2697
+ setDocumentName(response.data.name);
2698
+ setDocumentType(response.data.documentType);
2699
+ }
2700
+ case 4:
2701
+ case "end":
2702
+ return _context2.stop();
2703
+ }
2704
+ }, _callee2);
2705
+ }));
2706
+ return function fetchMappingFrom() {
2707
+ return _ref3.apply(this, arguments);
2708
+ };
2709
+ }();
2614
2710
  (0, _react.useEffect)(function () {
2615
- if (enableAuth) {
2711
+ if (documentComponentId != null) {
2712
+ if (setIsLoading != null) {
2713
+ setIsLoading(true);
2714
+ }
2715
+ setSpreadSheetAddress("/DocumentMappingPreview/PreviewMappedData?companyId=" + currentUser.companyId + "&documentComponentId=" + documentComponentId);
2616
2716
  var fetchData = /*#__PURE__*/function () {
2617
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2618
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2619
- while (1) switch (_context.prev = _context.next) {
2717
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
2718
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2719
+ while (1) switch (_context3.prev = _context3.next) {
2620
2720
  case 0:
2621
- _context.next = 2;
2622
- return apiService().DownloadFile(src, "", function (data) {
2623
- setImageSrc(data);
2624
- }, true);
2721
+ _context3.next = 2;
2722
+ return fetchMappingFrom();
2625
2723
  case 2:
2724
+ _context3.next = 4;
2725
+ return fetchMappingTo();
2726
+ case 4:
2727
+ if (setIsLoading != null) {
2728
+ setIsLoading(false);
2729
+ }
2730
+ case 5:
2626
2731
  case "end":
2627
- return _context.stop();
2732
+ return _context3.stop();
2628
2733
  }
2629
- }, _callee);
2734
+ }, _callee3);
2630
2735
  }));
2631
2736
  return function fetchData() {
2632
- return _ref2.apply(this, arguments);
2737
+ return _ref4.apply(this, arguments);
2633
2738
  };
2634
2739
  }();
2635
2740
  fetchData();
2636
2741
  }
2637
- }, [enableAuth]);
2638
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, enableAuth && imageSrc != null && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_image["default"], {
2639
- src: imageError ? process.env.fallbackImageSrc : imageSrc,
2640
- alt: alt,
2641
- width: width,
2642
- height: height,
2643
- style: {
2644
- objectFit: objectFit
2742
+ }, [documentComponentId]);
2743
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_Container["default"], {
2744
+ maxWidth: "xl",
2745
+ sx: {
2746
+ marginTop: 2
2747
+ }
2748
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
2749
+ container: true,
2750
+ spacing: 2
2751
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
2752
+ item: true,
2753
+ xs: 6
2754
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
2755
+ sx: {
2756
+ position: "sticky",
2757
+ top: 20
2758
+ }
2759
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
2760
+ variant: "h4",
2761
+ gutterBottom: true,
2762
+ sx: {
2763
+ paddingBottom: 2
2764
+ }
2765
+ }, "File Uploaded: ", /*#__PURE__*/_react["default"].createElement("br", null), " ", documentName), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
2766
+ variant: "subtitle1",
2767
+ gutterBottom: true,
2768
+ sx: {
2769
+ paddingBottom: 2
2770
+ }
2771
+ }, "You have ", fromColumnOptions != null && fromColumnOptions.length, " columns that can be created or mapped"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
2772
+ variant: "outlined",
2773
+ sx: {
2774
+ marginRight: 2
2645
2775
  },
2646
- onError: function onError() {
2647
- return setImageError(true);
2776
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
2777
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2778
+ while (1) switch (_context4.prev = _context4.next) {
2779
+ case 0:
2780
+ if (onCancel != null) {
2781
+ onCancel();
2782
+ }
2783
+ case 1:
2784
+ case "end":
2785
+ return _context4.stop();
2786
+ }
2787
+ }, _callee4);
2788
+ }))
2789
+ }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
2790
+ variant: "contained",
2791
+ endIcon: /*#__PURE__*/_react["default"].createElement(_ArrowRightAltRounded["default"], null),
2792
+ sx: {
2793
+ marginRight: 2
2794
+ },
2795
+ onClick: function onClick() {
2796
+ setShowPreviewDialog(true);
2648
2797
  }
2649
- })), !enableAuth && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_image["default"], {
2650
- src: imageError ? process.env.fallbackImageSrc : src,
2651
- alt: alt,
2652
- width: width,
2653
- height: height,
2654
- style: {
2655
- objectFit: objectFit
2798
+ }, "Next, Preview your mapping"))), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
2799
+ item: true,
2800
+ xs: 5
2801
+ }, fromColumnOptions != null && fromColumnOptions.map(function (column) {
2802
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(MappedColumn, {
2803
+ companyId: currentUser.companyId,
2804
+ documentId: documentId,
2805
+ documentType: documentType,
2806
+ documentMappingId: column.id,
2807
+ name: column.name,
2808
+ toName: column.toName,
2809
+ isMapped: column.toName == null || column.toName == "" ? true : false,
2810
+ toOptions: toColumnOptions,
2811
+ onResponse: function onResponse() {
2812
+ fetchMappingFrom();
2813
+ fetchMappingTo();
2814
+ }
2815
+ }));
2816
+ })))), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
2817
+ open: showPreviewDialog,
2818
+ onClose: function onClose() {
2819
+ setShowPreviewDialog(false);
2656
2820
  },
2657
- onError: function onError() {
2658
- return setImageError(true);
2821
+ fullWidth: true,
2822
+ maxWidth: "xl",
2823
+ "aria-labelledby": "alert-dialog-title",
2824
+ "aria-describedby": "alert-dialog-description"
2825
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
2826
+ id: "alert-dialog-title",
2827
+ sx: {
2828
+ fontSize: "25px",
2829
+ paddingTop: 4
2659
2830
  }
2660
- })));
2661
- };
2662
- exports.NextImage = NextImage;
2831
+ }, "Preview your mapping"), /*#__PURE__*/_react["default"].createElement(_system.Box, {
2832
+ sx: {
2833
+ paddingLeft: 3
2834
+ }
2835
+ }, "Ensure that the data uploaded is accurately mapped and all (Required) fields are completed."), /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
2836
+ "aria-label": "close",
2837
+ onClick: function onClick() {
2838
+ setShowPreviewDialog(false);
2839
+ },
2840
+ sx: {
2841
+ position: 'absolute',
2842
+ right: 8,
2843
+ top: 8,
2844
+ color: function color(theme) {
2845
+ return theme.palette.grey[500];
2846
+ }
2847
+ }
2848
+ }, /*#__PURE__*/_react["default"].createElement(_Close["default"], null)), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_system.Box, {
2849
+ sx: {
2850
+ paddingBottom: 1
2851
+ }
2852
+ }, /*#__PURE__*/_react["default"].createElement(ConditionBasedTool, {
2853
+ toColumnOptions: toColumnOptions,
2854
+ documentId: documentId,
2855
+ onConditionApplied: function onConditionApplied(currentQuery) {
2856
+ var incrementNum = urlTick + 1;
2857
+ setURLTick(incrementNum);
2858
+ setAdvanceQuery(currentQuery);
2859
+
2860
+ // setSpreadSheetAddress("/DocumentMappingPreview/PreviewMappedData?companyId=" + currentUser.companyId + "&documentComponentId=" + documentComponentId + "&tick=" + incrementNum);
2861
+ }
2862
+ })), spreadSheetAddress != null && /*#__PURE__*/_react["default"].createElement(SpreadsheetViewer, {
2863
+ ref: spreadSheetRef,
2864
+ url: spreadSheetAddress,
2865
+ advanceQuery: advanceQuery,
2866
+ currentUser: currentUser,
2867
+ hideToolbar: true,
2868
+ loadedUser: true
2869
+ })), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
2870
+ onClick: function onClick() {
2871
+ setShowPreviewDialog(false);
2872
+ }
2873
+ }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
2874
+ variant: "contained",
2875
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
2876
+ var publishedRows, response;
2877
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2878
+ while (1) switch (_context5.prev = _context5.next) {
2879
+ case 0:
2880
+ if (setIsLoading != null) {
2881
+ setIsLoading(true);
2882
+ }
2883
+ publishedRows = spreadSheetRef.current.getRows();
2884
+ _context5.next = 4;
2885
+ return apiService().post("/DocumentMapping/Publish", {
2886
+ companyId: currentUser.companyId,
2887
+ documentId: documentId,
2888
+ publishedRows: publishedRows
2889
+ });
2890
+ case 4:
2891
+ response = _context5.sent;
2892
+ if (response != null && response.status == 200) {
2893
+ setShowPreviewDialog(false);
2894
+ if (onPublished != null) {
2895
+ onPublished();
2896
+ }
2897
+ } else {
2898
+ alert(JSON.stringify(response.data));
2899
+ }
2900
+ if (setIsLoading != null) {
2901
+ setIsLoading(false);
2902
+ }
2903
+ case 7:
2904
+ case "end":
2905
+ return _context5.stop();
2906
+ }
2907
+ }, _callee5);
2908
+ }))
2909
+ }, "Publish"))));
2910
+ }
2663
2911
  "use strict";
2664
2912
 
2665
2913
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2666
2914
  Object.defineProperty(exports, "__esModule", {
2667
2915
  value: true
2668
2916
  });
2669
- exports.PageToPDF = void 0;
2917
+ exports.ConditionBasedTool = ConditionBasedTool;
2670
2918
  var _react = _interopRequireWildcard(require("react"));
2671
- var _Box = _interopRequireDefault(require("@mui/material/Box"));
2672
- var _html2canvas = _interopRequireDefault(require("html2canvas"));
2673
- var _jspdf = require("jspdf");
2674
2919
  var _Button = _interopRequireDefault(require("@mui/material/Button"));
2675
- var _DownloadRounded = _interopRequireDefault(require("@mui/icons-material/DownloadRounded"));
2920
+ var _system = require("@mui/system");
2921
+ var _Accordion = _interopRequireDefault(require("@mui/material/Accordion"));
2922
+ var _AccordionSummary = _interopRequireDefault(require("@mui/material/AccordionSummary"));
2923
+ var _AccordionDetails = _interopRequireDefault(require("@mui/material/AccordionDetails"));
2924
+ var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
2925
+ var _reactQuerybuilder = require("react-querybuilder");
2676
2926
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
2677
2927
  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); }
2678
2928
  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; }
2679
- var PageToPDF = function PageToPDF(_ref) {
2680
- var _ref$buttonText = _ref.buttonText,
2681
- buttonText = _ref$buttonText === void 0 ? "Download" : _ref$buttonText,
2682
- _ref$startIcon = _ref.startIcon,
2683
- startIcon = _ref$startIcon === void 0 ? /*#__PURE__*/_react["default"].createElement(_DownloadRounded["default"], null) : _ref$startIcon,
2684
- _ref$variant = _ref.variant,
2685
- variant = _ref$variant === void 0 ? "contained" : _ref$variant,
2686
- elementById = _ref.elementById,
2687
- _ref$scale = _ref.scale,
2688
- scale = _ref$scale === void 0 ? 2 : _ref$scale,
2689
- _ref$showHideClassEle = _ref.showHideClassElements,
2690
- showHideClassElements = _ref$showHideClassEle === void 0 ? [] : _ref$showHideClassEle,
2691
- _ref$fileName = _ref.fileName,
2692
- fileName = _ref$fileName === void 0 ? "download" : _ref$fileName;
2693
- var onHideElements = function onHideElements() {
2694
- for (var index = 0; index < showHideClassElements.length; index++) {
2695
- var element = showHideClassElements[index];
2696
- var elements = document.getElementsByClassName(element);
2697
- for (var i = 0; i < elements.length; i++) {
2698
- elements[i].style.display = "none";
2699
- }
2700
- }
2701
- };
2702
- var onShowElements = function onShowElements() {
2703
- for (var index = 0; index < showHideClassElements.length; index++) {
2704
- var element = showHideClassElements[index];
2705
- var elements = document.getElementsByClassName(element);
2706
- for (var i = 0; i < elements.length; i++) {
2707
- elements[i].style.display = "block";
2708
- }
2709
- }
2710
- };
2711
- var printElement = function printElement() {
2712
- onHideElements();
2713
- var input = document.getElementById(elementById);
2714
- (0, _html2canvas["default"])(input, {
2715
- backgroundColor: null,
2716
- scale: scale
2717
- }).then(function (canvas) {
2718
- var imgData = canvas.toDataURL("image/png", 1.0);
2719
- var pdf = new _jspdf.jsPDF();
2720
- var pdfWidth = pdf.internal.pageSize.getWidth();
2721
- var pdfHeight = pdf.internal.pageSize.getHeight();
2722
- var imgWidth = canvas.width;
2723
- var imgHeight = canvas.height;
2724
- var scaleFactor = Math.min(pdfWidth / imgWidth, pdfHeight / imgHeight);
2725
- var scaledWidth = imgWidth * scaleFactor;
2726
- var scaledHeight = imgHeight * scaleFactor;
2727
- var x = (pdfWidth - scaledWidth) / 2;
2728
- var y = 0; // Set y coordinate to 0 to align to the top
2729
- pdf.addImage(imgData, "PNG", x, y, scaledWidth, scaledHeight);
2730
- pdf.save(fileName + ".pdf");
2731
- });
2732
- onShowElements();
2733
- };
2734
- return /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
2735
- startIcon: startIcon,
2736
- variant: variant,
2737
- onClick: function onClick() {
2738
- printElement();
2929
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
2930
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2931
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
2932
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2933
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2934
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
2935
+ 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; }
2936
+ 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; } }
2937
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { apiService, FileUploader} from 'authscape';
2938
+ function ConditionBasedTool(_ref) {
2939
+ var toColumnOptions = _ref.toColumnOptions,
2940
+ documentId = _ref.documentId,
2941
+ onConditionApplied = _ref.onConditionApplied;
2942
+ var _useState = (0, _react.useState)(null),
2943
+ _useState2 = _slicedToArray(_useState, 2),
2944
+ currentQuery = _useState2[0],
2945
+ setCurrentQuery = _useState2[1];
2946
+
2947
+ // const fields = [
2948
+ // { name: 'firstName', label: 'First Name' },
2949
+ // { name: 'lastName', label: 'Last Name' }
2950
+ // ];
2951
+
2952
+ (0, _react.useEffect)(function () {
2953
+ if (documentId != null) {
2954
+ var fetchData = /*#__PURE__*/function () {
2955
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2956
+ var response;
2957
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2958
+ while (1) switch (_context.prev = _context.next) {
2959
+ case 0:
2960
+ _context.next = 2;
2961
+ return apiService().get("/DocumentMapping/GetRules?documentComponentId=" + documentId);
2962
+ case 2:
2963
+ response = _context.sent;
2964
+ if (response != null && response.status == 200) {
2965
+ if (response.data != null && response.data != "") {
2966
+ setCurrentQuery(response.data);
2967
+ } else {
2968
+ setCurrentQuery(null);
2969
+ }
2970
+ }
2971
+ case 4:
2972
+ case "end":
2973
+ return _context.stop();
2974
+ }
2975
+ }, _callee);
2976
+ }));
2977
+ return function fetchData() {
2978
+ return _ref2.apply(this, arguments);
2979
+ };
2980
+ }();
2981
+ fetchData();
2739
2982
  }
2740
- }, buttonText));
2741
- };
2742
- exports.PageToPDF = PageToPDF;
2983
+ }, [documentId]);
2984
+ var getFields = function getFields() {
2985
+ var fields = [];
2986
+ for (var index = 0; index < toColumnOptions.length; index++) {
2987
+ var toColumn = toColumnOptions[index];
2988
+ if (toColumn.isMapped)
2989
+ // only show filters that are mapped
2990
+ {
2991
+ fields.push({
2992
+ name: toColumn.name,
2993
+ label: toColumn.visibleName
2994
+ });
2995
+ }
2996
+ }
2997
+ return fields;
2998
+ };
2999
+ var customOperators = [{
3000
+ name: 'contains',
3001
+ label: 'Contains'
3002
+ }, {
3003
+ name: 'notContains',
3004
+ label: 'Does not contain'
3005
+ }];
3006
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_Accordion["default"], null, /*#__PURE__*/_react["default"].createElement(_AccordionSummary["default"], {
3007
+ expandIcon: /*#__PURE__*/_react["default"].createElement(_ExpandMore["default"], null),
3008
+ "aria-controls": "panel1-content",
3009
+ id: "panel1-header"
3010
+ }, "Advance filtering"), /*#__PURE__*/_react["default"].createElement(_AccordionDetails["default"], null, /*#__PURE__*/_react["default"].createElement(_reactQuerybuilder.QueryBuilder, {
3011
+ fields: getFields(),
3012
+ operators: customOperators,
3013
+ query: currentQuery,
3014
+ onQueryChange: setCurrentQuery
3015
+ }), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3016
+ variant: "contained",
3017
+ sx: {
3018
+ marginTop: 1
3019
+ },
3020
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3021
+ var response;
3022
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3023
+ while (1) switch (_context2.prev = _context2.next) {
3024
+ case 0:
3025
+ _context2.next = 2;
3026
+ return apiService().put("/DocumentMapping/ApplyFilterForViewer", {
3027
+ documentComponentId: documentId,
3028
+ rules: JSON.stringify(currentQuery)
3029
+ });
3030
+ case 2:
3031
+ response = _context2.sent;
3032
+ if (response != null && response.status == 200) {
3033
+ onConditionApplied(currentQuery);
3034
+ }
3035
+ case 4:
3036
+ case "end":
3037
+ return _context2.stop();
3038
+ }
3039
+ }, _callee2);
3040
+ }))
3041
+ }, "Apply Filter")))));
3042
+ }
2743
3043
  "use strict";
2744
3044
 
2745
3045
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2746
3046
  Object.defineProperty(exports, "__esModule", {
2747
3047
  value: true
2748
3048
  });
2749
- exports.Pricing = Pricing;
2750
- var _react = _interopRequireDefault(require("react"));
2751
- var _system = require("@mui/system");
2752
- var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
3049
+ exports.Datasources = Datasources;
3050
+ var _react = _interopRequireWildcard(require("react"));
2753
3051
  var _Button = _interopRequireDefault(require("@mui/material/Button"));
2754
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
2755
- var _ChevronRightRounded = _interopRequireDefault(require("@mui/icons-material/ChevronRightRounded"));
3052
+ var _system = require("@mui/system");
3053
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
3054
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
3055
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
3056
+ var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
3057
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
3058
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
2756
3059
  var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
2757
3060
  var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
2758
3061
  var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
2759
3062
  var _Select = _interopRequireDefault(require("@mui/material/Select"));
2760
- var _reactHookForm = require("react-hook-form");
3063
+ var _Radio = _interopRequireDefault(require("@mui/material/Radio"));
3064
+ var _RadioGroup = _interopRequireDefault(require("@mui/material/RadioGroup"));
3065
+ var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
3066
+ var _FormLabel = _interopRequireDefault(require("@mui/material/FormLabel"));
2761
3067
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
3068
+ 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); }
3069
+ 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; }
2762
3070
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
2763
3071
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2764
3072
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
2765
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2766
- function Pricing(_ref) {
2767
- var _ref$title = _ref.title,
2768
- title = _ref$title === void 0 ? null : _ref$title,
2769
- _ref$tiers = _ref.tiers,
2770
- tiers = _ref$tiers === void 0 ? [] : _ref$tiers,
2771
- _ref$features = _ref.features,
2772
- features = _ref$features === void 0 ? null : _ref$features,
2773
- _ref$onButtonClicked = _ref.onButtonClicked,
2774
- onButtonClicked = _ref$onButtonClicked === void 0 ? null : _ref$onButtonClicked;
2775
- var _useForm = (0, _reactHookForm.useForm)(),
2776
- control = _useForm.control,
2777
- register = _useForm.register,
2778
- handleSubmit = _useForm.handleSubmit,
2779
- errors = _useForm.formState.errors,
2780
- watch = _useForm.watch,
2781
- setValue = _useForm.setValue;
2782
- var calculateQty = function calculateQty(qty) {
2783
- var newMax = qty.minQty + qty.maxQty;
2784
- var menuItemArray = [];
2785
- var newIndex = 1;
2786
- for (var index = qty.minQty; index < newMax; index++) {
2787
- menuItemArray[newIndex] = newIndex;
2788
- newIndex++;
3073
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3074
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3075
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3076
+ 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; }
3077
+ 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; } }
3078
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import {apiService, authService, StripeConnect, ReactDraft, EditableDatagrid, FileUploader} from 'authscape';
3079
+ function Datasources(_ref) {
3080
+ var _ref$disableTraining = _ref.disableTraining,
3081
+ disableTraining = _ref$disableTraining === void 0 ? false : _ref$disableTraining;
3082
+ var documentColumns = [{
3083
+ field: 'name',
3084
+ headerName: 'Name',
3085
+ width: 150,
3086
+ editable: false
3087
+ }, {
3088
+ field: "type",
3089
+ type: "actions",
3090
+ width: 200,
3091
+ flex: 1,
3092
+ headerName: "Data Source",
3093
+ getActions: function getActions(_ref2) {
3094
+ var id = _ref2.id,
3095
+ row = _ref2.row;
3096
+ return [/*#__PURE__*/_react["default"].createElement(_system.Box, {
3097
+ sx: {
3098
+ textAlign: "left"
3099
+ }
3100
+ }, row.type == 0 ? "Database" : "", row.type == 1 ? "Dynamic Mapping" : "", row.type == 2 ? "Custom Model" : "")];
2789
3101
  }
2790
- return menuItemArray;
2791
- };
3102
+ }, {
3103
+ field: "Detail",
3104
+ type: "actions",
3105
+ width: 200,
3106
+ flex: 1,
3107
+ headerName: "Mapping To",
3108
+ getActions: function getActions(_ref3) {
3109
+ var id = _ref3.id,
3110
+ row = _ref3.row;
3111
+ return [/*#__PURE__*/_react["default"].createElement(_system.Box, {
3112
+ sx: {
3113
+ textAlign: "left"
3114
+ }
3115
+ }, row.type == 0 ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "Table: ", row.tableName) : "", row.type == 1 ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "Database driven mapping") : "", row.type == 2 ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "Type Name: ", row.typeName, /*#__PURE__*/_react["default"].createElement("br", null), " Assembly Fullname: ", row.assemblyFullName) : "")];
3116
+ }
3117
+ }
3118
+ // {
3119
+ // field: "actions",
3120
+ // type: "actions",
3121
+ // width: 200,
3122
+ // headerName: "Archive",
3123
+ // cellClassName: "actions",
3124
+ // getActions: ({ id, row }) => {
3125
+ // return [
3126
+ // <GridActionsCellItem key={id}
3127
+ // icon={<DeleteRoundedIcon />}
3128
+ // label="Archive"
3129
+ // className="textPrimary"
3130
+ // onClick={async () => {
3131
+
3132
+ // let documentMappingId = "";
3133
+ // let documentComponentId = "";
3134
+
3135
+ // // archive the column
3136
+ // await apiService().delete("/DocumentMapping/RemoveColumnFromDocumentComponent?documentMappingId=" + documentMappingId + "&documentComponentId=" + documentComponentId)
3137
+
3138
+ // }}
3139
+ // />,
3140
+ // ];
3141
+ // },
3142
+ // }
3143
+ ];
3144
+
3145
+ var refDatabaseTableSelect = (0, _react.useRef)(null);
3146
+ var refNewDocTypeName = (0, _react.useRef)(null);
3147
+ var _useState = (0, _react.useState)(0),
3148
+ _useState2 = _slicedToArray(_useState, 2),
3149
+ dataGridRefreshKey = _useState2[0],
3150
+ setDataGridRefreshKey = _useState2[1];
3151
+ var _useState3 = (0, _react.useState)(null),
3152
+ _useState4 = _slicedToArray(_useState3, 2),
3153
+ document = _useState4[0],
3154
+ setDocument = _useState4[1];
3155
+ var _useState5 = (0, _react.useState)(false),
3156
+ _useState6 = _slicedToArray(_useState5, 2),
3157
+ showDatasource = _useState6[0],
3158
+ setShowDatasource = _useState6[1];
3159
+ var _useState7 = (0, _react.useState)(null),
3160
+ _useState8 = _slicedToArray(_useState7, 2),
3161
+ databaseTables = _useState8[0],
3162
+ setDatabaseTables = _useState8[1];
3163
+ var _useState9 = (0, _react.useState)("database"),
3164
+ _useState10 = _slicedToArray(_useState9, 2),
3165
+ mappingType = _useState10[0],
3166
+ setMappingType = _useState10[1];
3167
+ var refTypeName = (0, _react.useRef)(null);
3168
+ var refAssemblyFullName = (0, _react.useRef)(null);
3169
+ (0, _react.useEffect)(function () {
3170
+ var fetchData = /*#__PURE__*/function () {
3171
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3172
+ var response;
3173
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3174
+ while (1) switch (_context.prev = _context.next) {
3175
+ case 0:
3176
+ _context.next = 2;
3177
+ return apiService().get("/DocumentMapping/GetTablesFromDatabase");
3178
+ case 2:
3179
+ response = _context.sent;
3180
+ if (response != null && response.status == 200) {
3181
+ setDatabaseTables(response.data);
3182
+ }
3183
+ case 4:
3184
+ case "end":
3185
+ return _context.stop();
3186
+ }
3187
+ }, _callee);
3188
+ }));
3189
+ return function fetchData() {
3190
+ return _ref4.apply(this, arguments);
3191
+ };
3192
+ }();
3193
+ fetchData();
3194
+ }, []);
2792
3195
  return /*#__PURE__*/_react["default"].createElement(_system.Box, {
2793
3196
  sx: {
2794
- paddingTop: 2
3197
+ marginTop: 6
3198
+ }
3199
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, null, !disableTraining && /*#__PURE__*/_react["default"].createElement(_system.Box, {
3200
+ sx: {
3201
+ textAlign: "right",
3202
+ marginBottom: 2
3203
+ }
3204
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3205
+ variant: "contained",
3206
+ onClick: function onClick() {
3207
+ setShowDatasource(true);
3208
+ }
3209
+ }, "Add Data Source")), /*#__PURE__*/_react["default"].createElement(EditableDatagrid, {
3210
+ key: dataGridRefreshKey,
3211
+ loadedUser: true,
3212
+ url: "/DocumentMapping/GetDocumentTypes",
3213
+ columns: documentColumns
3214
+ })), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
3215
+ open: showDatasource,
3216
+ onClose: function onClose() {
3217
+ setShowDatasource(false);
3218
+ },
3219
+ "aria-labelledby": "alert-dialog-title",
3220
+ "aria-describedby": "alert-dialog-description"
3221
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
3222
+ id: "alert-dialog-title"
3223
+ }, "Data Source"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
3224
+ id: "alert-dialog-description"
3225
+ }, "A data source is a place or system where data is stored and collected. It can be a database, file, web service, or sensor. Data is extracted, transformed, and used for analysis and other purposes. Managing data sources is crucial for data-driven decision-making."), /*#__PURE__*/_react["default"].createElement(_system.Box, {
3226
+ sx: {
3227
+ marginTop: 3
3228
+ }
3229
+ }, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
3230
+ inputRef: refNewDocTypeName,
3231
+ label: "Name for data source",
3232
+ variant: "outlined",
3233
+ fullWidth: true
3234
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
3235
+ sx: {
3236
+ marginTop: 2
3237
+ }
3238
+ }, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], null, /*#__PURE__*/_react["default"].createElement(_FormLabel["default"], {
3239
+ id: "demo-row-radio-buttons-group-label"
3240
+ }, "How the data will connect:"), /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
3241
+ value: mappingType,
3242
+ row: true,
3243
+ "aria-labelledby": "demo-row-radio-buttons-group-label",
3244
+ name: "row-radio-buttons-group",
3245
+ onChange: function onChange(env) {
3246
+ setMappingType(env.currentTarget.value);
3247
+ }
3248
+ }, /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
3249
+ value: "database",
3250
+ control: /*#__PURE__*/_react["default"].createElement(_Radio["default"], null),
3251
+ label: "Database"
3252
+ }), /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
3253
+ value: "mappingTable",
3254
+ control: /*#__PURE__*/_react["default"].createElement(_Radio["default"], null),
3255
+ label: "Dynamic Mapping Table"
3256
+ }), /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
3257
+ value: "customModelMapping",
3258
+ control: /*#__PURE__*/_react["default"].createElement(_Radio["default"], null),
3259
+ label: "Custom Model"
3260
+ })))), mappingType == "database" && /*#__PURE__*/_react["default"].createElement(_system.Box, {
3261
+ sx: {
3262
+ marginTop: 2
3263
+ }
3264
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3265
+ sx: {
3266
+ minWidth: 120
3267
+ }
3268
+ }, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
3269
+ fullWidth: true
3270
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
3271
+ id: "demo-simple-select-label"
3272
+ }, "Database Tables"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
3273
+ inputRef: refDatabaseTableSelect,
3274
+ labelId: "demo-simple-select-label",
3275
+ label: "Age"
3276
+ }, databaseTables != null && databaseTables.map(function (table, index) {
3277
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
3278
+ value: table.tableName
3279
+ }, table.tableName);
3280
+ }))))), mappingType == "customModelMapping" && /*#__PURE__*/_react["default"].createElement(_system.Box, {
3281
+ sx: {
3282
+ marginTop: 2
3283
+ }
3284
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3285
+ sx: {
3286
+ minWidth: 120
3287
+ }
3288
+ }, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
3289
+ inputRef: refTypeName,
3290
+ label: "Type Name (Example: API.Controllers.InvoiceUpload)",
3291
+ variant: "outlined",
3292
+ fullWidth: true,
3293
+ sx: {
3294
+ marginTop: 1
3295
+ }
3296
+ }), /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
3297
+ inputRef: refAssemblyFullName,
3298
+ label: "Assembly Full Name (Example: API)",
3299
+ variant: "outlined",
3300
+ fullWidth: true,
3301
+ sx: {
3302
+ marginTop: 1
3303
+ }
3304
+ })))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3305
+ onClick: function onClick() {
3306
+ setShowDatasource(false);
3307
+ }
3308
+ }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3309
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3310
+ var response, _response;
3311
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3312
+ while (1) switch (_context2.prev = _context2.next) {
3313
+ case 0:
3314
+ if (!(mappingType == "customModelMapping")) {
3315
+ _context2.next = 7;
3316
+ break;
3317
+ }
3318
+ _context2.next = 3;
3319
+ return apiService().post("/DocumentMapping/AddDataSource", {
3320
+ name: refNewDocTypeName.current.value,
3321
+ dataTable: refNewDocTypeName.current.value,
3322
+ documentType: 2,
3323
+ typeName: refTypeName.current.value,
3324
+ assemblyFullName: refAssemblyFullName.current.value
3325
+ });
3326
+ case 3:
3327
+ response = _context2.sent;
3328
+ if (response != null && response.data.error != null) {
3329
+ alert(response.data.error);
3330
+ } else {
3331
+ if (response != null && (response.status == 204 || response.status == 200)) {
3332
+ setDataGridRefreshKey(dataGridRefreshKey + 1);
3333
+ setShowDatasource(false);
3334
+ }
3335
+ }
3336
+ _context2.next = 11;
3337
+ break;
3338
+ case 7:
3339
+ _context2.next = 9;
3340
+ return apiService().post("/DocumentMapping/AddDataSource", {
3341
+ name: refNewDocTypeName.current.value,
3342
+ dataTable: refDatabaseTableSelect.current != null ? refDatabaseTableSelect.current.value : "",
3343
+ documentType: mappingType == "database" ? 0 : 1
3344
+ });
3345
+ case 9:
3346
+ _response = _context2.sent;
3347
+ if (_response != null && (_response.status == 204 || _response.status == 200)) {
3348
+ setDataGridRefreshKey(dataGridRefreshKey + 1);
3349
+ setShowDatasource(false);
3350
+ }
3351
+ case 11:
3352
+ case "end":
3353
+ return _context2.stop();
3354
+ }
3355
+ }, _callee2);
3356
+ }))
3357
+ }, "Add Data Source"))));
3358
+ }
3359
+ "use strict";
3360
+
3361
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3362
+ Object.defineProperty(exports, "__esModule", {
3363
+ value: true
3364
+ });
3365
+ exports.FileMapping = FileMapping;
3366
+ var _react = _interopRequireWildcard(require("react"));
3367
+ var _system = require("@mui/system");
3368
+ 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); }
3369
+ 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; }
3370
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3371
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3372
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3373
+ 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; }
3374
+ 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; } }
3375
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3376
+ // import ManageMappingDocuments from './manageMappingDocuments';
3377
+ // import AssignMapping from './AssignMapping';
3378
+
3379
+ function FileMapping(_ref) {
3380
+ var currentUser = _ref.currentUser,
3381
+ _ref$fileUploadName = _ref.fileUploadName,
3382
+ fileUploadName = _ref$fileUploadName === void 0 ? "Upload Document" : _ref$fileUploadName,
3383
+ _ref$hideDocumentMana = _ref.hideDocumentManager,
3384
+ hideDocumentManager = _ref$hideDocumentMana === void 0 ? false : _ref$hideDocumentMana,
3385
+ _ref$setIsLoading = _ref.setIsLoading,
3386
+ setIsLoading = _ref$setIsLoading === void 0 ? null : _ref$setIsLoading,
3387
+ _ref$documentTypeId = _ref.documentTypeId,
3388
+ documentTypeId = _ref$documentTypeId === void 0 ? null : _ref$documentTypeId,
3389
+ _ref$onOpened = _ref.onOpened,
3390
+ onOpened = _ref$onOpened === void 0 ? null : _ref$onOpened,
3391
+ _ref$onPublished = _ref.onPublished,
3392
+ _onPublished = _ref$onPublished === void 0 ? null : _ref$onPublished,
3393
+ _ref$onCanceled = _ref.onCanceled,
3394
+ onCanceled = _ref$onCanceled === void 0 ? null : _ref$onCanceled,
3395
+ _ref$onArchived = _ref.onArchived,
3396
+ onArchived = _ref$onArchived === void 0 ? null : _ref$onArchived;
3397
+ var _useState = (0, _react.useState)(null),
3398
+ _useState2 = _slicedToArray(_useState, 2),
3399
+ documentComponentId = _useState2[0],
3400
+ setDocumentComponentId = _useState2[1];
3401
+ (0, _react.useEffect)(function () {
3402
+ if (documentComponentId != null) {
3403
+ if (onOpened != null) {
3404
+ onOpened(documentComponentId);
3405
+ }
3406
+ }
3407
+ }, [documentComponentId]);
3408
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, documentComponentId == null && /*#__PURE__*/_react["default"].createElement(ManageMappingDocuments, {
3409
+ fileUploadName: fileUploadName,
3410
+ documentTypeId: documentTypeId,
3411
+ hideDocumentManager: hideDocumentManager,
3412
+ companyId: currentUser != null ? currentUser.companyId : null,
3413
+ onManageField: function onManageField(documentComponentId) {
3414
+ setDocumentComponentId(documentComponentId);
3415
+ },
3416
+ onArchive: function onArchive(documentComponentId) {
3417
+ //alert(documentComponentId);
3418
+ if (onArchived != null) {
3419
+ onArchived(documentComponentId);
3420
+ }
3421
+ }
3422
+ }), documentComponentId != null && /*#__PURE__*/_react["default"].createElement(AssignMapping, {
3423
+ currentUser: currentUser,
3424
+ setIsLoading: setIsLoading,
3425
+ documentComponentId: documentComponentId,
3426
+ onCancel: function onCancel() {
3427
+ setDocumentComponentId(null);
3428
+ if (onCanceled != null) {
3429
+ onCanceled(documentComponentId);
3430
+ }
3431
+ },
3432
+ onPublished: function onPublished() {
3433
+ setDocumentComponentId(null);
3434
+ if (_onPublished != null) {
3435
+ _onPublished(documentComponentId);
3436
+ }
3437
+ }
3438
+ }));
3439
+ }
3440
+ "use strict";
3441
+
3442
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3443
+ Object.defineProperty(exports, "__esModule", {
3444
+ value: true
3445
+ });
3446
+ exports.ManageMappingDocuments = ManageMappingDocuments;
3447
+ var _react = _interopRequireWildcard(require("react"));
3448
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
3449
+ var _system = require("@mui/system");
3450
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
3451
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
3452
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
3453
+ var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
3454
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
3455
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
3456
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
3457
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
3458
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
3459
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
3460
+ var _xDataGrid = require("@mui/x-data-grid");
3461
+ var _DeleteRounded = _interopRequireDefault(require("@mui/icons-material/DeleteRounded"));
3462
+ var _ListRounded = _interopRequireDefault(require("@mui/icons-material/ListRounded"));
3463
+ var _PublishRounded = _interopRequireDefault(require("@mui/icons-material/PublishRounded"));
3464
+ var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
3465
+ var _DownloadRounded = _interopRequireDefault(require("@mui/icons-material/DownloadRounded"));
3466
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
3467
+ 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); }
3468
+ 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; }
3469
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3470
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
3471
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3472
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3473
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3474
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3475
+ 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; }
3476
+ 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; } }
3477
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import {apiService, authService, StripeConnect, ReactDraft, EditableDatagrid, FileUploader} from 'authscape';
3478
+ function ManageMappingDocuments(_ref) {
3479
+ var fileUploadName = _ref.fileUploadName,
3480
+ _ref$hideDocumentMana = _ref.hideDocumentManager,
3481
+ hideDocumentManager = _ref$hideDocumentMana === void 0 ? false : _ref$hideDocumentMana,
3482
+ _ref$documentTypeId = _ref.documentTypeId,
3483
+ documentTypeId = _ref$documentTypeId === void 0 ? null : _ref$documentTypeId,
3484
+ _ref$companyId = _ref.companyId,
3485
+ companyId = _ref$companyId === void 0 ? null : _ref$companyId,
3486
+ _ref$locationId = _ref.locationId,
3487
+ locationId = _ref$locationId === void 0 ? null : _ref$locationId,
3488
+ _ref$userId = _ref.userId,
3489
+ userId = _ref$userId === void 0 ? null : _ref$userId,
3490
+ _ref$onManageField = _ref.onManageField,
3491
+ onManageField = _ref$onManageField === void 0 ? null : _ref$onManageField,
3492
+ _ref$onArchive = _ref.onArchive,
3493
+ onArchive = _ref$onArchive === void 0 ? null : _ref$onArchive;
3494
+ var _useState = (0, _react.useState)(null),
3495
+ _useState2 = _slicedToArray(_useState, 2),
3496
+ document = _useState2[0],
3497
+ setDocument = _useState2[1];
3498
+ var _useState3 = (0, _react.useState)(false),
3499
+ _useState4 = _slicedToArray(_useState3, 2),
3500
+ addColumnDialog = _useState4[0],
3501
+ setAddColumnDialog = _useState4[1];
3502
+ var _useState5 = (0, _react.useState)(false),
3503
+ _useState6 = _slicedToArray(_useState5, 2),
3504
+ showAddNewDocument = _useState6[0],
3505
+ setShowAddNewDocument = _useState6[1];
3506
+ var _useState7 = (0, _react.useState)(false),
3507
+ _useState8 = _slicedToArray(_useState7, 2),
3508
+ showTrainingDocument = _useState8[0],
3509
+ setShowTrainingDocument = _useState8[1];
3510
+ var _useState9 = (0, _react.useState)(''),
3511
+ _useState10 = _slicedToArray(_useState9, 2),
3512
+ columnName = _useState10[0],
3513
+ setColumnName = _useState10[1];
3514
+ var _useState11 = (0, _react.useState)(null),
3515
+ _useState12 = _slicedToArray(_useState11, 2),
3516
+ selectedAddedColumn = _useState12[0],
3517
+ setSelectedAddedColumn = _useState12[1];
3518
+ var _useState13 = (0, _react.useState)(null),
3519
+ _useState14 = _slicedToArray(_useState13, 2),
3520
+ documentMappingColumns = _useState14[0],
3521
+ setDocumentMappingColumns = _useState14[1];
3522
+ var _useState15 = (0, _react.useState)(null),
3523
+ _useState16 = _slicedToArray(_useState15, 2),
3524
+ toColumnOptions = _useState16[0],
3525
+ setToColumnOptions = _useState16[1];
3526
+ var _useState17 = (0, _react.useState)(null),
3527
+ _useState18 = _slicedToArray(_useState17, 2),
3528
+ removeDocument = _useState18[0],
3529
+ setRemoveDocument = _useState18[1];
3530
+ var _useState19 = (0, _react.useState)(null),
3531
+ _useState20 = _slicedToArray(_useState19, 2),
3532
+ selectedDocumentComponentId = _useState20[0],
3533
+ setSelectedDocumentComponentId = _useState20[1];
3534
+ var _useState21 = (0, _react.useState)(0),
3535
+ _useState22 = _slicedToArray(_useState21, 2),
3536
+ dataGridRefreshKey = _useState22[0],
3537
+ setDataGridRefreshKey = _useState22[1];
3538
+ var _useState23 = (0, _react.useState)(0),
3539
+ _useState24 = _slicedToArray(_useState23, 2),
3540
+ dataGridMappingRefreshKey = _useState24[0],
3541
+ setDataGridMappingRefreshKey = _useState24[1];
3542
+ var _useState25 = (0, _react.useState)(null),
3543
+ _useState26 = _slicedToArray(_useState25, 2),
3544
+ selectedDocument = _useState26[0],
3545
+ setSelectedDocument = _useState26[1];
3546
+ var _useState27 = (0, _react.useState)(0),
3547
+ _useState28 = _slicedToArray(_useState27, 2),
3548
+ status = _useState28[0],
3549
+ setStatus = _useState28[1];
3550
+ var _useState29 = (0, _react.useState)([]),
3551
+ _useState30 = _slicedToArray(_useState29, 2),
3552
+ componentTypes = _useState30[0],
3553
+ setComponentTypes = _useState30[1];
3554
+ var refHeaderRowInput = (0, _react.useRef)(null);
3555
+ var fileUploaderRef = (0, _react.useRef)(null);
3556
+ var refNewDocumentName = (0, _react.useRef)(null);
3557
+ var refSelectDocumentType = (0, _react.useRef)(null);
3558
+ var refNewColumnFileColumn = (0, _react.useRef)(null);
3559
+ var documentColumns = [{
3560
+ field: 'name',
3561
+ flex: 1,
3562
+ headerName: 'Document Name',
3563
+ width: 150,
3564
+ editable: false
3565
+ }, {
3566
+ field: 'documentTypeName',
3567
+ flex: 1,
3568
+ headerName: 'Document Type',
3569
+ width: 150,
3570
+ editable: false
3571
+ }, {
3572
+ field: "actions",
3573
+ type: "actions",
3574
+ width: 200,
3575
+ flex: 1,
3576
+ headerName: "",
3577
+ cellClassName: "actions",
3578
+ getActions: function getActions(_ref2) {
3579
+ var id = _ref2.id,
3580
+ row = _ref2.row;
3581
+ return [/*#__PURE__*/_react["default"].createElement(_Button["default"], {
3582
+ variant: "text",
3583
+ startIcon: /*#__PURE__*/_react["default"].createElement(_ListRounded["default"], null),
3584
+ onClick: function onClick() {
3585
+ if (onManageField != null) {
3586
+ onManageField(row.id);
3587
+ }
3588
+ }
3589
+ }, "Manage Fields"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3590
+ variant: "text",
3591
+ startIcon: /*#__PURE__*/_react["default"].createElement(_DownloadRounded["default"], null),
3592
+ onClick: function onClick() {
3593
+ window.open("https://view.officeapps.live.com/op/view.aspx?src=" + row.fileUri + "&wdOrigin=BROWSELINK");
3594
+ }
3595
+ }, "Download File"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3596
+ variant: "text",
3597
+ startIcon: /*#__PURE__*/_react["default"].createElement(_DeleteRounded["default"], null),
3598
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3599
+ var documentMappingId;
3600
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3601
+ while (1) switch (_context.prev = _context.next) {
3602
+ case 0:
3603
+ documentMappingId = row.id;
3604
+ setRemoveDocument({
3605
+ companyId: companyId,
3606
+ documentMappingId: documentMappingId
3607
+ });
3608
+ case 2:
3609
+ case "end":
3610
+ return _context.stop();
3611
+ }
3612
+ }, _callee);
3613
+ }))
3614
+ }, "Remove")];
3615
+ }
3616
+ }];
3617
+ (0, _react.useEffect)(function () {
3618
+ if (document != null) {
3619
+ var fetchData = /*#__PURE__*/function () {
3620
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
3621
+ var response;
3622
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3623
+ while (1) switch (_context3.prev = _context3.next) {
3624
+ case 0:
3625
+ _context3.next = 2;
3626
+ return apiService().get("/DocumentMapping/GetMappingFieldsForDocument?documentId=" + document.id);
3627
+ case 2:
3628
+ response = _context3.sent;
3629
+ if (response != null) {
3630
+ setToColumnOptions(response.data);
3631
+ setDocumentMappingColumns([{
3632
+ field: 'name',
3633
+ flex: 1,
3634
+ headerName: 'File Column',
3635
+ width: 150,
3636
+ editable: true
3637
+ }, {
3638
+ field: 'toName',
3639
+ headerName: 'Upload To',
3640
+ flex: 1,
3641
+ width: 150,
3642
+ editable: true,
3643
+ type: 'singleSelect',
3644
+ valueOptions: response.data
3645
+ }, {
3646
+ field: "actions",
3647
+ type: "actions",
3648
+ width: 200,
3649
+ headerName: "Archive Fields",
3650
+ cellClassName: "actions",
3651
+ getActions: function getActions(_ref5) {
3652
+ var id = _ref5.id,
3653
+ row = _ref5.row;
3654
+ return [/*#__PURE__*/_react["default"].createElement(_xDataGrid.GridActionsCellItem, {
3655
+ key: id,
3656
+ icon: /*#__PURE__*/_react["default"].createElement(_DeleteRounded["default"], null),
3657
+ label: "Archive",
3658
+ className: "textPrimary",
3659
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3660
+ var documentMappingId, documentComponentId, response;
3661
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3662
+ while (1) switch (_context2.prev = _context2.next) {
3663
+ case 0:
3664
+ documentMappingId = row.id;
3665
+ documentComponentId = row.documentComponentId; // archive the column
3666
+ _context2.next = 4;
3667
+ return apiService()["delete"]("/DocumentMapping/RemoveColumnFromDocumentComponent?documentMappingId=" + documentMappingId + "&documentComponentId=" + documentComponentId);
3668
+ case 4:
3669
+ response = _context2.sent;
3670
+ if (response != null && response.status == 200) {
3671
+ setDataGridMappingRefreshKey(dataGridMappingRefreshKey + 1);
3672
+ }
3673
+ case 6:
3674
+ case "end":
3675
+ return _context2.stop();
3676
+ }
3677
+ }, _callee2);
3678
+ }))
3679
+ })];
3680
+ }
3681
+ }]);
3682
+ }
3683
+ case 4:
3684
+ case "end":
3685
+ return _context3.stop();
3686
+ }
3687
+ }, _callee3);
3688
+ }));
3689
+ return function fetchData() {
3690
+ return _ref4.apply(this, arguments);
3691
+ };
3692
+ }();
3693
+ fetchData();
3694
+ }
3695
+ }, [document]);
3696
+ (0, _react.useEffect)(function () {
3697
+ if (showAddNewDocument && documentTypeId == null) {
3698
+ // get all document types
3699
+ var fetchData = /*#__PURE__*/function () {
3700
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
3701
+ var response;
3702
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3703
+ while (1) switch (_context4.prev = _context4.next) {
3704
+ case 0:
3705
+ _context4.next = 2;
3706
+ return apiService().post("/DocumentMapping/GetDocumentTypes");
3707
+ case 2:
3708
+ response = _context4.sent;
3709
+ if (response != null && response.status == 200) {
3710
+ setComponentTypes(response.data.data);
3711
+ }
3712
+ case 4:
3713
+ case "end":
3714
+ return _context4.stop();
3715
+ }
3716
+ }, _callee4);
3717
+ }));
3718
+ return function fetchData() {
3719
+ return _ref7.apply(this, arguments);
3720
+ };
3721
+ }();
3722
+ fetchData();
3723
+ }
3724
+ }, [showAddNewDocument, documentTypeId]);
3725
+ var GetHeaderRowData = /*#__PURE__*/function () {
3726
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(documentComponentId) {
3727
+ var response;
3728
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3729
+ while (1) switch (_context5.prev = _context5.next) {
3730
+ case 0:
3731
+ _context5.next = 2;
3732
+ return apiService().get("/DocumentMapping/GetHeaderRow?documentComponentId=" + documentComponentId);
3733
+ case 2:
3734
+ response = _context5.sent;
3735
+ if (response != null && response.status == 200) {
3736
+ refHeaderRowInput.current.value = response.data;
3737
+ }
3738
+ case 4:
3739
+ case "end":
3740
+ return _context5.stop();
3741
+ }
3742
+ }, _callee5);
3743
+ }));
3744
+ return function GetHeaderRowData(_x2) {
3745
+ return _ref8.apply(this, arguments);
3746
+ };
3747
+ }();
3748
+ (0, _react.useEffect)(function () {
3749
+ if (status != null) {
3750
+ setDataGridRefreshKey(dataGridRefreshKey + 1);
3751
+ }
3752
+ }, [status]);
3753
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, !hideDocumentManager && /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
3754
+ container: true,
3755
+ spacing: 2,
3756
+ sx: {
3757
+ paddingBottom: 2
3758
+ }
3759
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
3760
+ item: true,
3761
+ xs: 3
3762
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3763
+ sx: {
3764
+ minWidth: 120
3765
+ }
3766
+ }, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
3767
+ fullWidth: true
3768
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
3769
+ id: "demo-simple-select-label"
3770
+ }, "Status"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
3771
+ labelId: "demo-simple-select-label",
3772
+ id: "demo-simple-select",
3773
+ value: status,
3774
+ label: "Status",
3775
+ onChange: function onChange(event) {
3776
+ setStatus(event.target.value);
3777
+ }
3778
+ }, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
3779
+ value: 0
3780
+ }, "Open"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
3781
+ value: 2
3782
+ }, "Published"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
3783
+ value: 1
3784
+ }, "Archived"))))), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
3785
+ item: true,
3786
+ xs: 9
3787
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3788
+ sx: {
3789
+ textAlign: "right",
3790
+ marginBottom: 2
3791
+ }
3792
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3793
+ variant: "contained",
3794
+ onClick: function onClick() {
3795
+ setShowAddNewDocument(true);
3796
+ }
3797
+ }, fileUploadName)))), /*#__PURE__*/_react["default"].createElement(EditableDatagrid, {
3798
+ key: dataGridRefreshKey,
3799
+ loadedUser: true,
3800
+ params: {
3801
+ companyId: companyId,
3802
+ userId: userId,
3803
+ locationId: locationId,
3804
+ status: status
3805
+ },
3806
+ url: "/DocumentMapping/GetDocumentComponents",
3807
+ columns: documentColumns
3808
+ })), hideDocumentManager && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3809
+ variant: "contained",
3810
+ onClick: function onClick() {
3811
+ setShowAddNewDocument(true);
3812
+ }
3813
+ }, fileUploadName), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
3814
+ open: showAddNewDocument,
3815
+ onClose: function onClose() {
3816
+ setShowAddNewDocument(false);
3817
+ },
3818
+ fullWidth: true,
3819
+ "aria-labelledby": "alert-dialog-title",
3820
+ "aria-describedby": "alert-dialog-description"
3821
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
3822
+ id: "alert-dialog-title"
3823
+ }, "Upload Document"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, documentTypeId == null && /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
3824
+ id: "alert-dialog-description",
3825
+ sx: {
3826
+ paddingBottom: 2
3827
+ }
3828
+ }, "Please select the type of document, then click \"Choose a file\""), documentTypeId == null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
3829
+ sx: {
3830
+ marginTop: 2
3831
+ }
3832
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3833
+ sx: {
3834
+ minWidth: 120
3835
+ }
3836
+ }, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
3837
+ fullWidth: true
3838
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
3839
+ id: "demo-simple-select-label"
3840
+ }, "Document Type"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
3841
+ labelId: "demo-simple-select-label",
3842
+ id: "demo-simple-select",
3843
+ inputRef: refSelectDocumentType,
3844
+ onChange: function onChange(val) {
3845
+ var _selectedDocument = componentTypes.find(function (s) {
3846
+ return s.id == val.target.value;
3847
+ });
3848
+ setSelectedDocument(_selectedDocument);
3849
+ },
3850
+ label: "DocumentType"
3851
+ }, componentTypes != null && componentTypes.map(function (componentType) {
3852
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
3853
+ value: componentType.id
3854
+ }, componentType.name);
3855
+ }))))), (selectedDocument != null || selectedDocument == null && documentTypeId != null) && /*#__PURE__*/_react["default"].createElement(_system.Box, {
3856
+ sx: {
3857
+ textAlign: "center",
3858
+ width: "100%",
3859
+ display: "flex",
3860
+ alignItems: "center",
3861
+ paddingTop: 2
3862
+ }
3863
+ }, /*#__PURE__*/_react["default"].createElement(FileUploader, {
3864
+ refOveride: fileUploaderRef,
3865
+ params: {
3866
+ documentTypeId: documentTypeId == null ? selectedDocument.id : documentTypeId,
3867
+ companyId: companyId
3868
+ },
3869
+ url: "/DocumentMapping/SyncDocument",
3870
+ multiple: true,
3871
+ variant: "custom",
3872
+ onUploadCompleted: function onUploadCompleted(responses) {
3873
+ if (responses.length > 0) {
3874
+ var row = responses[0].data;
3875
+ if (onManageField != null) {
3876
+ onManageField(row.id);
3877
+ }
3878
+ }
3879
+ setShowAddNewDocument(false);
3880
+ }
3881
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3882
+ sx: {
3883
+ display: "flex",
3884
+ alignItems: "center"
3885
+ }
3886
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3887
+ htmlFor: "file-upload",
3888
+ sx: {
3889
+ border: "2px dashed #aaa",
3890
+ padding: 20,
3891
+ textAlign: "center",
3892
+ cursor: "pointer"
3893
+ }
3894
+ }, 'Choose a file'))))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3895
+ onClick: function onClick() {
3896
+ setShowAddNewDocument(false);
3897
+ }
3898
+ }, "Cancel"))), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
3899
+ open: showTrainingDocument,
3900
+ onClose: function onClose() {
3901
+ setShowTrainingDocument(false);
3902
+ },
3903
+ fullWidth: true,
3904
+ "aria-labelledby": "alert-dialog-title",
3905
+ "aria-describedby": "alert-dialog-description"
3906
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
3907
+ id: "alert-dialog-title"
3908
+ }, "Setup Mapping"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
3909
+ id: "alert-dialog-description"
3910
+ }, "If you'd like to submit a file, we can assist in configuring the fields to match the formatting of your document."), document != null && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(FileUploader, {
3911
+ refOveride: fileUploaderRef,
3912
+ url: "/DocumentMapping/TrainDocument",
3913
+ params: {
3914
+ documentComponentId: document.id,
3915
+ companyId: companyId,
3916
+ locationId: locationId,
3917
+ userId: userId
3918
+ },
3919
+ multiple: false,
3920
+ variant: "custom",
3921
+ onUploadCompleted: function onUploadCompleted() {
3922
+ setDataGridMappingRefreshKey(dataGridMappingRefreshKey + 1);
3923
+
3924
+ // setUpdate(!update);
3925
+ // handleClose();
3926
+ }
3927
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3928
+ sx: {
3929
+ marginTop: 2,
3930
+ borderRadius: 2,
3931
+ backgroundColor: "#f5f5f5",
3932
+ border: "1px solid lightgray",
3933
+ cursor: "pointer",
3934
+ padding: 2
3935
+ }
3936
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3937
+ id: "FileUploader",
3938
+ "aria-controls": open ? 'demo-customized-menu' : undefined,
3939
+ "aria-haspopup": "true",
3940
+ "aria-expanded": open ? 'true' : undefined,
3941
+ variant: "text",
3942
+ disableElevation: true,
3943
+ startIcon: /*#__PURE__*/_react["default"].createElement(_PublishRounded["default"], null),
3944
+ sx: {
3945
+ marginLeft: 1
3946
+ }
3947
+ }, "Upload Sample File"))))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3948
+ onClick: function onClick() {
3949
+ setShowTrainingDocument(false);
3950
+ }
3951
+ }, "No, thank you"))), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
3952
+ open: addColumnDialog,
3953
+ onClose: function onClose() {
3954
+ setAddColumnDialog(false);
3955
+ },
3956
+ fullWidth: true,
3957
+ "aria-labelledby": "alert-dialog-title",
3958
+ "aria-describedby": "alert-dialog-description"
3959
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
3960
+ id: "alert-dialog-title"
3961
+ }, "Add Column"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
3962
+ id: "alert-dialog-description"
3963
+ }, "Include a column for document mapping"), /*#__PURE__*/_react["default"].createElement(_system.Box, {
3964
+ sx: {
3965
+ marginTop: 2
3966
+ }
3967
+ }, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
3968
+ inputRef: refNewColumnFileColumn,
3969
+ id: "outlined-basic",
3970
+ label: "File Column",
3971
+ fullWidth: true,
3972
+ variant: "outlined"
3973
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
3974
+ sx: {
3975
+ marginTop: 4
3976
+ }
3977
+ }, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
3978
+ fullWidth: true
3979
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
3980
+ id: "demo-simple-select-label"
3981
+ }, "Column Name"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
3982
+ labelId: "demo-simple-select-label",
3983
+ id: "demo-simple-select",
3984
+ value: selectedAddedColumn,
3985
+ label: "Column Name",
3986
+ onChange: function onChange(data) {
3987
+ setSelectedAddedColumn(data.target.value);
3988
+ }
3989
+ })))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3990
+ onClick: function onClick() {
3991
+ setAddColumnDialog(false);
3992
+ }
3993
+ }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
3994
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
3995
+ var response;
3996
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
3997
+ while (1) switch (_context6.prev = _context6.next) {
3998
+ case 0:
3999
+ _context6.next = 2;
4000
+ return apiService().post("/DocumentMapping/AddNewField", {
4001
+ tableName: document.name,
4002
+ fieldName: refNewColumnFileColumn.current.value,
4003
+ fileColumn: selectedAddedColumn,
4004
+ companyId: companyId,
4005
+ locationId: locationId,
4006
+ userId: userId
4007
+ });
4008
+ case 2:
4009
+ response = _context6.sent;
4010
+ if (response != null && response.status == 200) {
4011
+ setDataGridMappingRefreshKey(dataGridMappingRefreshKey + 1);
4012
+ setAddColumnDialog(false);
4013
+ }
4014
+ case 4:
4015
+ case "end":
4016
+ return _context6.stop();
4017
+ }
4018
+ }, _callee6);
4019
+ })),
4020
+ autoFocus: true
4021
+ }, "Add Column"))), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
4022
+ open: removeDocument != null ? true : false,
4023
+ onClose: function onClose() {
4024
+ setRemoveDocument(null);
4025
+ },
4026
+ fullWidth: true,
4027
+ "aria-labelledby": "alert-dialog-title",
4028
+ "aria-describedby": "alert-dialog-description"
4029
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
4030
+ id: "alert-dialog-title"
4031
+ }, "Remove the document"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
4032
+ id: "alert-dialog-description"
4033
+ }, "Are you sure you want to remove this document?")), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4034
+ onClick: function onClick() {
4035
+ setRemoveDocument(null);
4036
+ }
4037
+ }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4038
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
4039
+ var response;
4040
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
4041
+ while (1) switch (_context7.prev = _context7.next) {
4042
+ case 0:
4043
+ response = null;
4044
+ if (!(companyId != null)) {
4045
+ _context7.next = 7;
4046
+ break;
4047
+ }
4048
+ _context7.next = 4;
4049
+ return apiService()["delete"]("/DocumentMapping/RemoveDocument?companyId=" + removeDocument.companyId + "&documentId=" + removeDocument.documentMappingId);
4050
+ case 4:
4051
+ response = _context7.sent;
4052
+ _context7.next = 10;
4053
+ break;
4054
+ case 7:
4055
+ _context7.next = 9;
4056
+ return apiService()["delete"]("/DocumentMapping/RemoveDocument?documentId=" + removeDocument.documentMappingId);
4057
+ case 9:
4058
+ response = _context7.sent;
4059
+ case 10:
4060
+ if (response != null && response.status == 200) {
4061
+ setDataGridRefreshKey(dataGridRefreshKey + 1);
4062
+ setRemoveDocument(null);
4063
+ if (onArchive != null) {
4064
+ onArchive(removeDocument.documentMappingId);
4065
+ }
4066
+ }
4067
+ case 11:
4068
+ case "end":
4069
+ return _context7.stop();
4070
+ }
4071
+ }, _callee7);
4072
+ }))
4073
+ }, "Remove Document"))));
4074
+ }
4075
+ "use strict";
4076
+
4077
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4078
+ Object.defineProperty(exports, "__esModule", {
4079
+ value: true
4080
+ });
4081
+ exports.MappedColumn = MappedColumn;
4082
+ var _react = _interopRequireWildcard(require("react"));
4083
+ var _Card = _interopRequireDefault(require("@mui/material/Card"));
4084
+ var _CardActions = _interopRequireDefault(require("@mui/material/CardActions"));
4085
+ var _CardContent = _interopRequireDefault(require("@mui/material/CardContent"));
4086
+ var _system = require("@mui/system");
4087
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
4088
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
4089
+ var _Link = _interopRequireDefault(require("@mui/icons-material/Link"));
4090
+ var _LinkOff = _interopRequireDefault(require("@mui/icons-material/LinkOff"));
4091
+ var _Stack = _interopRequireDefault(require("@mui/material/Stack"));
4092
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4093
+ 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); }
4094
+ 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; }
4095
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4096
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4097
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } // import NewMappingColumn from './newMappingColumn';
4098
+ // import MatchExistingMappedColumn from './matchExisting';
4099
+ // import { apiService } from 'authscape';
4100
+
4101
+ function MappedColumn(_ref) {
4102
+ var companyId = _ref.companyId,
4103
+ documentId = _ref.documentId,
4104
+ documentType = _ref.documentType,
4105
+ documentMappingId = _ref.documentMappingId,
4106
+ name = _ref.name,
4107
+ toName = _ref.toName,
4108
+ isMapped = _ref.isMapped,
4109
+ toOptions = _ref.toOptions,
4110
+ onResponse = _ref.onResponse;
4111
+ var notMatchedColor = "#ffe5e5";
4112
+ var matchedColor = "#fff";
4113
+ return /*#__PURE__*/_react["default"].createElement(_Card["default"], {
4114
+ sx: {
4115
+ marginTop: 1
4116
+ }
4117
+ }, /*#__PURE__*/_react["default"].createElement(_CardContent["default"], {
4118
+ sx: {
4119
+ position: "relative",
4120
+ backgroundColor: isMapped ? notMatchedColor : matchedColor
4121
+ }
4122
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
4123
+ gutterBottom: true,
4124
+ variant: "h5",
4125
+ component: "div"
4126
+ }, name), /*#__PURE__*/_react["default"].createElement(_system.Box, {
4127
+ sx: {
4128
+ position: "absolute",
4129
+ top: "10px",
4130
+ right: "10px"
4131
+ }
4132
+ }, isMapped ? /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
4133
+ direction: "row",
4134
+ spacing: 1
4135
+ }, /*#__PURE__*/_react["default"].createElement(_LinkOff["default"], null), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
4136
+ variant: "body2",
4137
+ sx: {
4138
+ paddingTop: 0.5
4139
+ }
4140
+ }, "Not Matched")) : /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
4141
+ direction: "row",
4142
+ spacing: 1
4143
+ }, /*#__PURE__*/_react["default"].createElement(_Link["default"], null), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
4144
+ variant: "body2",
4145
+ sx: {
4146
+ paddingTop: 0.5
4147
+ }
4148
+ }, "Matched"))), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
4149
+ variant: "body2",
4150
+ color: "text.secondary"
4151
+ }, !isMapped && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "This column is matched with ", toName), isMapped && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "This column is not matched. If not matched it will not import"))), /*#__PURE__*/_react["default"].createElement(_CardActions["default"], {
4152
+ sx: {
4153
+ backgroundColor: isMapped ? notMatchedColor : matchedColor
4154
+ }
4155
+ }, !isMapped ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4156
+ startIcon: /*#__PURE__*/_react["default"].createElement(_LinkOff["default"], null),
4157
+ size: "small",
4158
+ sx: {
4159
+ paddingLeft: 3
4160
+ },
4161
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4162
+ var response;
4163
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4164
+ while (1) switch (_context.prev = _context.next) {
4165
+ case 0:
4166
+ _context.next = 2;
4167
+ return apiService()["delete"]("/DocumentMapping/RemoveMatch?companyId=" + companyId + "&documentId=" + documentId + "&documentMappingId=" + documentMappingId);
4168
+ case 2:
4169
+ response = _context.sent;
4170
+ if (response != null && response.status == 200) {
4171
+ onResponse();
4172
+ }
4173
+ case 4:
4174
+ case "end":
4175
+ return _context.stop();
4176
+ }
4177
+ }, _callee);
4178
+ }))
4179
+ }, "Remove Match")) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(MatchExistingMappedColumn, {
4180
+ companyId: companyId,
4181
+ documentId: documentId,
4182
+ documentMappingId: documentMappingId,
4183
+ fromName: name,
4184
+ toOptions: toOptions,
4185
+ onResponse: onResponse
4186
+ }), /*#__PURE__*/_react["default"].createElement(NewMappingColumn, {
4187
+ name: name,
4188
+ companyId: companyId,
4189
+ documentType: documentType,
4190
+ documentId: documentId,
4191
+ documentMappingId: documentMappingId,
4192
+ onResponse: onResponse
4193
+ }))));
4194
+ }
4195
+ "use strict";
4196
+
4197
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4198
+ Object.defineProperty(exports, "__esModule", {
4199
+ value: true
4200
+ });
4201
+ exports.MatchExistingMappedColumn = MatchExistingMappedColumn;
4202
+ var _react = _interopRequireWildcard(require("react"));
4203
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
4204
+ var _system = require("@mui/system");
4205
+ var _LinkRounded = _interopRequireDefault(require("@mui/icons-material/LinkRounded"));
4206
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
4207
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
4208
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
4209
+ var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
4210
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
4211
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
4212
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
4213
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
4214
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
4215
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
4216
+ var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
4217
+ var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
4218
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4219
+ 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); }
4220
+ 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; }
4221
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4222
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4223
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4224
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4225
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4226
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4227
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4228
+ 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; }
4229
+ 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; } }
4230
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import {apiService, authService, StripeConnect, ReactDraft, EditableDatagrid, FileUploader} from 'authscape';
4231
+ function MatchExistingMappedColumn(_ref) {
4232
+ var companyId = _ref.companyId,
4233
+ documentId = _ref.documentId,
4234
+ documentMappingId = _ref.documentMappingId,
4235
+ fromName = _ref.fromName,
4236
+ toOptions = _ref.toOptions,
4237
+ onResponse = _ref.onResponse;
4238
+ var _useState = (0, _react.useState)(false),
4239
+ _useState2 = _slicedToArray(_useState, 2),
4240
+ createNewOpen = _useState2[0],
4241
+ setCreateNewOpen = _useState2[1];
4242
+ var _useState3 = (0, _react.useState)(false),
4243
+ _useState4 = _slicedToArray(_useState3, 2),
4244
+ onlyAddRowIfFound = _useState4[0],
4245
+ setOnlyAddRowIfFound = _useState4[1];
4246
+ var _useState5 = (0, _react.useState)(true),
4247
+ _useState6 = _slicedToArray(_useState5, 2),
4248
+ rememberForNextTime = _useState6[0],
4249
+ setRememberForNextTime = _useState6[1];
4250
+ var _useState7 = (0, _react.useState)(null),
4251
+ _useState8 = _slicedToArray(_useState7, 2),
4252
+ selectedToColumn = _useState8[0],
4253
+ setSelectedToColumn = _useState8[1];
4254
+ var handleClose = function handleClose() {
4255
+ setCreateNewOpen(false);
4256
+ };
4257
+ var checkboxRememberLabel = {
4258
+ inputProps: {
4259
+ 'aria-label': 'Checkbox Remember'
4260
+ }
4261
+ };
4262
+ var SelectedExistingColumns = function SelectedExistingColumns(_ref2) {
4263
+ var toOptions = _ref2.toOptions;
4264
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, {
4265
+ sx: {
4266
+ minWidth: 120
4267
+ }
4268
+ }, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
4269
+ fullWidth: true
4270
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
4271
+ id: "demo-simple-select-label"
4272
+ }, "Match to column"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
4273
+ labelId: "demo-simple-select-label",
4274
+ id: "demo-simple-select",
4275
+ value: selectedToColumn,
4276
+ label: "Age",
4277
+ onChange: function onChange(event) {
4278
+ setSelectedToColumn(event.target.value);
4279
+ }
4280
+ }, toOptions != null && toOptions.map(function (toOption) {
4281
+ var isRequiredMessage = "";
4282
+ if (toOption.isRequired) {
4283
+ isRequiredMessage = " (Required)";
4284
+ }
4285
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
4286
+ value: toOption.name
4287
+ }, toOption.visibleName, " ", isRequiredMessage);
4288
+ }))));
4289
+ };
4290
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
4291
+ open: createNewOpen,
4292
+ onClose: handleClose,
4293
+ fullWidth: true,
4294
+ "aria-labelledby": "alert-dialog-title",
4295
+ "aria-describedby": "alert-dialog-description"
4296
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
4297
+ id: "alert-dialog-title"
4298
+ }, "Match existing column"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
4299
+ id: "alert-dialog-description"
4300
+ }, "***Inform the user about what it means to match existing columns***"), /*#__PURE__*/_react["default"].createElement(_system.Box, {
4301
+ sx: {
4302
+ paddingTop: 2
4303
+ }
4304
+ }, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
4305
+ id: "outlined-basic",
4306
+ label: "File Column Name",
4307
+ defaultValue: fromName,
4308
+ variant: "outlined",
4309
+ disabled: true,
4310
+ fullWidth: true
4311
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
4312
+ sx: {
4313
+ paddingTop: 2
4314
+ }
4315
+ }, /*#__PURE__*/_react["default"].createElement(SelectedExistingColumns, {
4316
+ toOptions: toOptions
4317
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
4318
+ sx: {
4319
+ paddingTop: 2
4320
+ }
4321
+ }, /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
4322
+ value: "end",
4323
+ control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], _extends({}, checkboxRememberLabel, {
4324
+ defaultChecked: true,
4325
+ onChange: function onChange(event) {
4326
+ setRememberForNextTime(event.target.checked);
4327
+ }
4328
+ })),
4329
+ label: "Remember match for next time",
4330
+ labelPlacement: "end"
4331
+ }))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4332
+ onClick: handleClose
4333
+ }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4334
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4335
+ var response;
4336
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4337
+ while (1) switch (_context.prev = _context.next) {
4338
+ case 0:
4339
+ _context.next = 2;
4340
+ return apiService().put("/DocumentMapping/AssignMapping", {
4341
+ companyId: companyId,
4342
+ documentId: documentId,
4343
+ fileColumnName: fromName,
4344
+ documentMappingId: documentMappingId,
4345
+ matchedColumn: selectedToColumn,
4346
+ onlyAddRowIfColumnFound: onlyAddRowIfFound,
4347
+ rememberForNextTime: rememberForNextTime
4348
+ });
4349
+ case 2:
4350
+ response = _context.sent;
4351
+ if (response != null && response.status == 200) {
4352
+ onResponse();
4353
+ handleClose();
4354
+ }
4355
+ case 4:
4356
+ case "end":
4357
+ return _context.stop();
4358
+ }
4359
+ }, _callee);
4360
+ })),
4361
+ autoFocus: true
4362
+ }, "Match Existing"))), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4363
+ startIcon: /*#__PURE__*/_react["default"].createElement(_LinkRounded["default"], null),
4364
+ size: "small",
4365
+ sx: {
4366
+ paddingLeft: 3
4367
+ },
4368
+ onClick: function onClick() {
4369
+ setCreateNewOpen(true);
4370
+ }
4371
+ }, "Match Existing"));
4372
+ }
4373
+ "use strict";
4374
+
4375
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4376
+ Object.defineProperty(exports, "__esModule", {
4377
+ value: true
4378
+ });
4379
+ exports.NewMappingColumn = NewMappingColumn;
4380
+ var _react = _interopRequireWildcard(require("react"));
4381
+ var _Card = _interopRequireDefault(require("@mui/material/Card"));
4382
+ var _CardContent = _interopRequireDefault(require("@mui/material/CardContent"));
4383
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
4384
+ var _system = require("@mui/system");
4385
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
4386
+ var _AddRounded = _interopRequireDefault(require("@mui/icons-material/AddRounded"));
4387
+ var _LinkRounded = _interopRequireDefault(require("@mui/icons-material/LinkRounded"));
4388
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
4389
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
4390
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
4391
+ var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
4392
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
4393
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
4394
+ var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
4395
+ var _LocalParkingRounded = _interopRequireDefault(require("@mui/icons-material/LocalParkingRounded"));
4396
+ var _TextFieldsRounded = _interopRequireDefault(require("@mui/icons-material/TextFieldsRounded"));
4397
+ var _IntegrationInstructionsRounded = _interopRequireDefault(require("@mui/icons-material/IntegrationInstructionsRounded"));
4398
+ var _ListAltRounded = _interopRequireDefault(require("@mui/icons-material/ListAltRounded"));
4399
+ var _CalendarMonthRounded = _interopRequireDefault(require("@mui/icons-material/CalendarMonthRounded"));
4400
+ var _CheckBoxRounded = _interopRequireDefault(require("@mui/icons-material/CheckBoxRounded"));
4401
+ var _InsertPhotoRounded = _interopRequireDefault(require("@mui/icons-material/InsertPhotoRounded"));
4402
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4403
+ 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); }
4404
+ 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; }
4405
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4406
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4407
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4408
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4409
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4410
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4411
+ 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; }
4412
+ 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; } }
4413
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4414
+ // import { apiService } from 'authscape';
4415
+
4416
+ function NewMappingColumn(_ref) {
4417
+ var name = _ref.name,
4418
+ companyId = _ref.companyId,
4419
+ documentType = _ref.documentType,
4420
+ documentId = _ref.documentId,
4421
+ documentMappingId = _ref.documentMappingId,
4422
+ onResponse = _ref.onResponse;
4423
+ var newColumnNameRef = (0, _react.useRef)(null);
4424
+ var newColumnDescriptionRef = (0, _react.useRef)(null);
4425
+ var _useState = (0, _react.useState)(false),
4426
+ _useState2 = _slicedToArray(_useState, 2),
4427
+ createNewOpen = _useState2[0],
4428
+ setCreateNewOpen = _useState2[1];
4429
+ var _useState3 = (0, _react.useState)(null),
4430
+ _useState4 = _slicedToArray(_useState3, 2),
4431
+ selectedAttributeId = _useState4[0],
4432
+ setSelectedAttributeId = _useState4[1];
4433
+ var handleClose = function handleClose() {
4434
+ setCreateNewOpen(false);
4435
+ };
4436
+ var AttributeTypeComponent = function AttributeTypeComponent(_ref2) {
4437
+ var id = _ref2.id,
4438
+ icon = _ref2.icon,
4439
+ text = _ref2.text;
4440
+ return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
4441
+ item: true,
4442
+ xs: 3
4443
+ }, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
4444
+ sx: {
4445
+ textAlign: "center",
4446
+ cursor: "pointer",
4447
+ backgroundColor: selectedAttributeId == id ? "#e5e5e5" : "none"
4448
+ },
4449
+ onClick: function onClick() {
4450
+ setSelectedAttributeId(id);
4451
+ }
4452
+ }, /*#__PURE__*/_react["default"].createElement(_CardContent["default"], null, icon, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
4453
+ variant: "body2",
4454
+ color: "text.secondary",
4455
+ sx: {
4456
+ paddingTop: 1
4457
+ }
4458
+ }, text))));
4459
+ };
4460
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
4461
+ open: createNewOpen,
4462
+ onClose: handleClose,
4463
+ fullWidth: true,
4464
+ "aria-labelledby": "alert-dialog-title",
4465
+ "aria-describedby": "alert-dialog-description"
4466
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
4467
+ id: "alert-dialog-title"
4468
+ }, "Match to new column"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
4469
+ id: "alert-dialog-description"
4470
+ }, "inform the user about adding a new columna and what that means here..."), /*#__PURE__*/_react["default"].createElement(_system.Box, {
4471
+ sx: {
4472
+ paddingTop: 2
4473
+ }
4474
+ }, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
4475
+ inputRef: newColumnNameRef,
4476
+ defaultValue: name,
4477
+ id: "outlined-basic",
4478
+ label: "Name",
4479
+ variant: "outlined",
4480
+ fullWidth: true
4481
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
4482
+ sx: {
4483
+ paddingTop: 2
4484
+ }
4485
+ }, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
4486
+ inputRef: newColumnDescriptionRef,
4487
+ id: "outlined-basic",
4488
+ label: "Description (optional)",
4489
+ variant: "outlined",
4490
+ fullWidth: true
4491
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
4492
+ sx: {
4493
+ paddingTop: 2
4494
+ }
4495
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
4496
+ variant: "body1",
4497
+ gutterBottom: true
4498
+ }, "Select how this column will be formatted")), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
4499
+ container: true,
4500
+ spacing: 2,
4501
+ sx: {
4502
+ paddingTop: 2
4503
+ }
4504
+ }, /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4505
+ id: 0,
4506
+ icon: /*#__PURE__*/_react["default"].createElement(_TextFieldsRounded["default"], null),
4507
+ text: "text"
4508
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4509
+ id: 1,
4510
+ icon: /*#__PURE__*/_react["default"].createElement(_LocalParkingRounded["default"], null),
4511
+ text: "Paragraph"
4512
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4513
+ id: 2,
4514
+ icon: /*#__PURE__*/_react["default"].createElement(_IntegrationInstructionsRounded["default"], null),
4515
+ text: "HTML"
4516
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4517
+ id: 3,
4518
+ icon: /*#__PURE__*/_react["default"].createElement(_system.Box, null, 123),
4519
+ text: "Integer"
4520
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4521
+ id: 4,
4522
+ icon: /*#__PURE__*/_react["default"].createElement(_system.Box, null, 10.23),
4523
+ text: "Decimal"
4524
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4525
+ id: 5,
4526
+ icon: /*#__PURE__*/_react["default"].createElement(_ListAltRounded["default"], null),
4527
+ text: "Dropdown"
4528
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4529
+ id: 6,
4530
+ icon: /*#__PURE__*/_react["default"].createElement(_CalendarMonthRounded["default"], null),
4531
+ text: "Date"
4532
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4533
+ id: 7,
4534
+ icon: /*#__PURE__*/_react["default"].createElement(_LinkRounded["default"], null),
4535
+ text: "URL"
4536
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4537
+ id: 8,
4538
+ icon: /*#__PURE__*/_react["default"].createElement(_CheckBoxRounded["default"], null),
4539
+ text: "Boolean"
4540
+ }), /*#__PURE__*/_react["default"].createElement(AttributeTypeComponent, {
4541
+ id: 9,
4542
+ icon: /*#__PURE__*/_react["default"].createElement(_InsertPhotoRounded["default"], null),
4543
+ text: "Photo"
4544
+ })))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4545
+ onClick: handleClose
4546
+ }, "Cancel"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4547
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4548
+ var response;
4549
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4550
+ while (1) switch (_context.prev = _context.next) {
4551
+ case 0:
4552
+ _context.next = 2;
4553
+ return apiService().post("/DocumentMapping/AddNewColumnAndMapping", {
4554
+ companyId: companyId,
4555
+ documentId: documentId,
4556
+ documentMappingId: documentMappingId,
4557
+ newColumn: newColumnNameRef.current.value,
4558
+ description: newColumnDescriptionRef.current.value,
4559
+ attributeFieldType: selectedAttributeId
4560
+ });
4561
+ case 2:
4562
+ response = _context.sent;
4563
+ if (response != null && response.status == 200) {
4564
+ handleClose();
4565
+ onResponse();
4566
+ }
4567
+ case 4:
4568
+ case "end":
4569
+ return _context.stop();
4570
+ }
4571
+ }, _callee);
4572
+ })),
4573
+ autoFocus: true
4574
+ }, "Create"))), documentType != null && documentType == 1 && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4575
+ startIcon: /*#__PURE__*/_react["default"].createElement(_AddRounded["default"], null),
4576
+ size: "small",
4577
+ sx: {
4578
+ paddingLeft: 3
4579
+ },
4580
+ onClick: function onClick() {
4581
+ setCreateNewOpen(true);
4582
+ }
4583
+ }, "Create New Column"));
4584
+ }
4585
+ "use strict";
4586
+
4587
+ Object.defineProperty(exports, "__esModule", {
4588
+ value: true
4589
+ });
4590
+ exports.SortableColumn = SortableColumn;
4591
+ var _react = _interopRequireDefault(require("react"));
4592
+ var _sortable = require("@dnd-kit/sortable");
4593
+ var _utilities = require("@dnd-kit/utilities");
4594
+ var _material = require("@mui/material");
4595
+ var _Menu = _interopRequireDefault(require("@mui/icons-material/Menu"));
4596
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4597
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4598
+ function SortableColumn(props) {
4599
+ var _useSortable = (0, _sortable.useSortable)({
4600
+ id: props.id
4601
+ }),
4602
+ attributes = _useSortable.attributes,
4603
+ listeners = _useSortable.listeners,
4604
+ setNodeRef = _useSortable.setNodeRef,
4605
+ transform = _useSortable.transform,
4606
+ transition = _useSortable.transition;
4607
+ var style = {
4608
+ transform: _utilities.CSS.Transform.toString(transform),
4609
+ transition: transition
4610
+ };
4611
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
4612
+ ref: setNodeRef,
4613
+ style: style
4614
+ }, attributes, listeners), /*#__PURE__*/_react["default"].createElement(_material.ListItem, {
4615
+ disablePadding: true
4616
+ }, /*#__PURE__*/_react["default"].createElement(_material.ListItemButton, null, /*#__PURE__*/_react["default"].createElement(_material.ListItemIcon, null, /*#__PURE__*/_react["default"].createElement(_Menu["default"], null)), /*#__PURE__*/_react["default"].createElement(_material.ListItemText, {
4617
+ primary: props.id
4618
+ }))));
4619
+ }
4620
+ "use strict";
4621
+
4622
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4623
+ Object.defineProperty(exports, "__esModule", {
4624
+ value: true
4625
+ });
4626
+ exports.UploadMappedFile = UploadMappedFile;
4627
+ var _react = _interopRequireWildcard(require("react"));
4628
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
4629
+ var _system = require("@mui/system");
4630
+ var _PublishRounded = _interopRequireDefault(require("@mui/icons-material/PublishRounded"));
4631
+ var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
4632
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
4633
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4634
+ 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); }
4635
+ 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; }
4636
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4637
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4638
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4639
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4640
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4641
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4642
+ 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; }
4643
+ 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; } }
4644
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { apiService, FileUploader} from 'authscape';
4645
+ function UploadMappedFile(_ref) {
4646
+ var loadedUser = _ref.loadedUser,
4647
+ _ref$url = _ref.url,
4648
+ url = _ref$url === void 0 ? null : _ref$url,
4649
+ _ref$companyId = _ref.companyId,
4650
+ companyId = _ref$companyId === void 0 ? null : _ref$companyId,
4651
+ _ref$locationId = _ref.locationId,
4652
+ locationId = _ref$locationId === void 0 ? null : _ref$locationId,
4653
+ _ref$userId = _ref.userId,
4654
+ userId = _ref$userId === void 0 ? null : _ref$userId;
4655
+ var _useState = (0, _react.useState)(null),
4656
+ _useState2 = _slicedToArray(_useState, 2),
4657
+ documentComponentOptions = _useState2[0],
4658
+ setDocumentComponentOptions = _useState2[1];
4659
+ var _useState3 = (0, _react.useState)(null),
4660
+ _useState4 = _slicedToArray(_useState3, 2),
4661
+ selectedDocumentComponentId = _useState4[0],
4662
+ setSelectedDocumentComponentId = _useState4[1];
4663
+ var _useState5 = (0, _react.useState)(null),
4664
+ _useState6 = _slicedToArray(_useState5, 2),
4665
+ anchorEl = _useState6[0],
4666
+ setAnchorEl = _useState6[1];
4667
+ var open = Boolean(anchorEl);
4668
+ var handleClose = function handleClose() {
4669
+ setAnchorEl(null);
4670
+ };
4671
+ var fileUploaderRef = (0, _react.useRef)(null);
4672
+ (0, _react.useEffect)(function () {
4673
+ if (selectedDocumentComponentId != null) {
4674
+ // trigger the file uploader, make sure param is filled in
4675
+ fileUploaderRef.current.click();
4676
+ }
4677
+ }, [selectedDocumentComponentId]);
4678
+ (0, _react.useEffect)(function () {
4679
+ if (loadedUser) {
4680
+ var fetchData = /*#__PURE__*/function () {
4681
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4682
+ var _params, response;
4683
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4684
+ while (1) switch (_context.prev = _context.next) {
4685
+ case 0:
4686
+ _params = {};
4687
+ if (companyId != null) {
4688
+ _params.companyId = companyId;
4689
+ }
4690
+ if (userId != null) {
4691
+ _params.userId = userId;
4692
+ }
4693
+ if (locationId != null) {
4694
+ _params.locationId = locationId;
4695
+ }
4696
+ _context.next = 6;
4697
+ return apiService().post("/DocumentMapping/GetDocumentComponents", _params);
4698
+ case 6:
4699
+ response = _context.sent;
4700
+ if (response != null && response.status == 200) {
4701
+ setDocumentComponentOptions(response.data.data);
4702
+ }
4703
+ case 8:
4704
+ case "end":
4705
+ return _context.stop();
4706
+ }
4707
+ }, _callee);
4708
+ }));
4709
+ return function fetchData() {
4710
+ return _ref2.apply(this, arguments);
4711
+ };
4712
+ }();
4713
+ fetchData();
4714
+ }
4715
+ }, [loadedUser]);
4716
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(FileUploader, {
4717
+ refOveride: fileUploaderRef,
4718
+ params: {
4719
+ documentComponentId: selectedDocumentComponentId,
4720
+ companyId: companyId,
4721
+ locationId: locationId,
4722
+ userId: userId
4723
+ },
4724
+ url: url,
4725
+ multiple: false,
4726
+ variant: "custom",
4727
+ onUploadCompleted: function onUploadCompleted() {
4728
+ setSelectedDocumentComponentId(null); // we need an onUploadCancelled
4729
+ }
4730
+ }), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4731
+ id: "demo-positioned-button",
4732
+ "aria-controls": open ? 'demo-positioned-menu' : undefined,
4733
+ "aria-haspopup": "true",
4734
+ "aria-expanded": open ? 'true' : undefined,
4735
+ startIcon: /*#__PURE__*/_react["default"].createElement(_PublishRounded["default"], null),
4736
+ sx: {
4737
+ marginLeft: 1
4738
+ },
4739
+ onClick: function onClick(event) {
4740
+ setAnchorEl(event.currentTarget);
4741
+ }
4742
+ }, "Upload File(s)"), /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
4743
+ id: "basic-menu",
4744
+ anchorEl: anchorEl,
4745
+ open: open,
4746
+ onClose: handleClose,
4747
+ MenuListProps: {
4748
+ 'aria-labelledby': 'basic-button'
4749
+ }
4750
+ }, documentComponentOptions != null && documentComponentOptions.map(function (documentComponent) {
4751
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
4752
+ onClick: function onClick() {
4753
+ // assigns the param document component id
4754
+ setSelectedDocumentComponentId(documentComponent.id);
4755
+
4756
+ // close the menu
4757
+ handleClose();
4758
+ }
4759
+ }, documentComponent.name + " (" + documentComponent.documentTypeName + ")");
4760
+ })));
4761
+ }
4762
+ "use strict";
4763
+
4764
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4765
+ Object.defineProperty(exports, "__esModule", {
4766
+ value: true
4767
+ });
4768
+ exports.NextImage = void 0;
4769
+ var _react = _interopRequireWildcard(require("react"));
4770
+ var _image = _interopRequireDefault(require("next/image"));
4771
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4772
+ 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); }
4773
+ 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; }
4774
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4775
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4776
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4777
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4778
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4779
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4780
+ 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; }
4781
+ 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; } }
4782
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4783
+ var NextImage = function NextImage(_ref) {
4784
+ var src = _ref.src,
4785
+ alt = _ref.alt,
4786
+ _ref$width = _ref.width,
4787
+ width = _ref$width === void 0 ? 200 : _ref$width,
4788
+ _ref$height = _ref.height,
4789
+ height = _ref$height === void 0 ? 200 : _ref$height,
4790
+ _ref$objectFit = _ref.objectFit,
4791
+ objectFit = _ref$objectFit === void 0 ? "contain" : _ref$objectFit,
4792
+ _ref$enableAuth = _ref.enableAuth,
4793
+ enableAuth = _ref$enableAuth === void 0 ? false : _ref$enableAuth;
4794
+ var _useState = (0, _react.useState)(false),
4795
+ _useState2 = _slicedToArray(_useState, 2),
4796
+ imageError = _useState2[0],
4797
+ setImageError = _useState2[1];
4798
+ var _useState3 = (0, _react.useState)(null),
4799
+ _useState4 = _slicedToArray(_useState3, 2),
4800
+ imageSrc = _useState4[0],
4801
+ setImageSrc = _useState4[1];
4802
+ (0, _react.useEffect)(function () {
4803
+ if (enableAuth) {
4804
+ var fetchData = /*#__PURE__*/function () {
4805
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4806
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4807
+ while (1) switch (_context.prev = _context.next) {
4808
+ case 0:
4809
+ _context.next = 2;
4810
+ return apiService().DownloadFile(src, "", function (data) {
4811
+ setImageSrc(data);
4812
+ }, true);
4813
+ case 2:
4814
+ case "end":
4815
+ return _context.stop();
4816
+ }
4817
+ }, _callee);
4818
+ }));
4819
+ return function fetchData() {
4820
+ return _ref2.apply(this, arguments);
4821
+ };
4822
+ }();
4823
+ fetchData();
4824
+ }
4825
+ }, [enableAuth]);
4826
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, enableAuth && imageSrc != null && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_image["default"], {
4827
+ src: imageError ? process.env.fallbackImageSrc : imageSrc,
4828
+ alt: alt,
4829
+ width: width,
4830
+ height: height,
4831
+ style: {
4832
+ objectFit: objectFit
4833
+ },
4834
+ onError: function onError() {
4835
+ return setImageError(true);
4836
+ }
4837
+ })), !enableAuth && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_image["default"], {
4838
+ src: imageError ? process.env.fallbackImageSrc : src,
4839
+ alt: alt,
4840
+ width: width,
4841
+ height: height,
4842
+ style: {
4843
+ objectFit: objectFit
4844
+ },
4845
+ onError: function onError() {
4846
+ return setImageError(true);
4847
+ }
4848
+ })));
4849
+ };
4850
+ exports.NextImage = NextImage;
4851
+ "use strict";
4852
+
4853
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4854
+ Object.defineProperty(exports, "__esModule", {
4855
+ value: true
4856
+ });
4857
+ exports.PageToPDF = void 0;
4858
+ var _react = _interopRequireWildcard(require("react"));
4859
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
4860
+ var _html2canvas = _interopRequireDefault(require("html2canvas"));
4861
+ var _jspdf = require("jspdf");
4862
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
4863
+ var _DownloadRounded = _interopRequireDefault(require("@mui/icons-material/DownloadRounded"));
4864
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4865
+ 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); }
4866
+ 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; }
4867
+ var PageToPDF = function PageToPDF(_ref) {
4868
+ var _ref$buttonText = _ref.buttonText,
4869
+ buttonText = _ref$buttonText === void 0 ? "Download" : _ref$buttonText,
4870
+ _ref$startIcon = _ref.startIcon,
4871
+ startIcon = _ref$startIcon === void 0 ? /*#__PURE__*/_react["default"].createElement(_DownloadRounded["default"], null) : _ref$startIcon,
4872
+ _ref$variant = _ref.variant,
4873
+ variant = _ref$variant === void 0 ? "contained" : _ref$variant,
4874
+ elementById = _ref.elementById,
4875
+ _ref$scale = _ref.scale,
4876
+ scale = _ref$scale === void 0 ? 2 : _ref$scale,
4877
+ _ref$showHideClassEle = _ref.showHideClassElements,
4878
+ showHideClassElements = _ref$showHideClassEle === void 0 ? [] : _ref$showHideClassEle,
4879
+ _ref$fileName = _ref.fileName,
4880
+ fileName = _ref$fileName === void 0 ? "download" : _ref$fileName;
4881
+ var onHideElements = function onHideElements() {
4882
+ for (var index = 0; index < showHideClassElements.length; index++) {
4883
+ var element = showHideClassElements[index];
4884
+ var elements = document.getElementsByClassName(element);
4885
+ for (var i = 0; i < elements.length; i++) {
4886
+ elements[i].style.display = "none";
4887
+ }
4888
+ }
4889
+ };
4890
+ var onShowElements = function onShowElements() {
4891
+ for (var index = 0; index < showHideClassElements.length; index++) {
4892
+ var element = showHideClassElements[index];
4893
+ var elements = document.getElementsByClassName(element);
4894
+ for (var i = 0; i < elements.length; i++) {
4895
+ elements[i].style.display = "block";
4896
+ }
4897
+ }
4898
+ };
4899
+ var printElement = function printElement() {
4900
+ onHideElements();
4901
+ var input = document.getElementById(elementById);
4902
+ (0, _html2canvas["default"])(input, {
4903
+ backgroundColor: null,
4904
+ scale: scale
4905
+ }).then(function (canvas) {
4906
+ var imgData = canvas.toDataURL("image/png", 1.0);
4907
+ var pdf = new _jspdf.jsPDF();
4908
+ var pdfWidth = pdf.internal.pageSize.getWidth();
4909
+ var pdfHeight = pdf.internal.pageSize.getHeight();
4910
+ var imgWidth = canvas.width;
4911
+ var imgHeight = canvas.height;
4912
+ var scaleFactor = Math.min(pdfWidth / imgWidth, pdfHeight / imgHeight);
4913
+ var scaledWidth = imgWidth * scaleFactor;
4914
+ var scaledHeight = imgHeight * scaleFactor;
4915
+ var x = (pdfWidth - scaledWidth) / 2;
4916
+ var y = 0; // Set y coordinate to 0 to align to the top
4917
+ pdf.addImage(imgData, "PNG", x, y, scaledWidth, scaledHeight);
4918
+ pdf.save(fileName + ".pdf");
4919
+ });
4920
+ onShowElements();
4921
+ };
4922
+ return /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
4923
+ startIcon: startIcon,
4924
+ variant: variant,
4925
+ onClick: function onClick() {
4926
+ printElement();
4927
+ }
4928
+ }, buttonText));
4929
+ };
4930
+ exports.PageToPDF = PageToPDF;
4931
+ "use strict";
4932
+
4933
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4934
+ Object.defineProperty(exports, "__esModule", {
4935
+ value: true
4936
+ });
4937
+ exports.Pricing = Pricing;
4938
+ var _react = _interopRequireDefault(require("react"));
4939
+ var _system = require("@mui/system");
4940
+ var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
4941
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
4942
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
4943
+ var _ChevronRightRounded = _interopRequireDefault(require("@mui/icons-material/ChevronRightRounded"));
4944
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
4945
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
4946
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
4947
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
4948
+ var _reactHookForm = require("react-hook-form");
4949
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
4950
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4951
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4952
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4953
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4954
+ function Pricing(_ref) {
4955
+ var _ref$title = _ref.title,
4956
+ title = _ref$title === void 0 ? null : _ref$title,
4957
+ _ref$tiers = _ref.tiers,
4958
+ tiers = _ref$tiers === void 0 ? [] : _ref$tiers,
4959
+ _ref$features = _ref.features,
4960
+ features = _ref$features === void 0 ? null : _ref$features,
4961
+ _ref$onButtonClicked = _ref.onButtonClicked,
4962
+ onButtonClicked = _ref$onButtonClicked === void 0 ? null : _ref$onButtonClicked;
4963
+ var _useForm = (0, _reactHookForm.useForm)(),
4964
+ control = _useForm.control,
4965
+ register = _useForm.register,
4966
+ handleSubmit = _useForm.handleSubmit,
4967
+ errors = _useForm.formState.errors,
4968
+ watch = _useForm.watch,
4969
+ setValue = _useForm.setValue;
4970
+ var calculateQty = function calculateQty(qty) {
4971
+ var newMax = qty.minQty + qty.maxQty;
4972
+ var menuItemArray = [];
4973
+ var newIndex = 1;
4974
+ for (var index = qty.minQty; index < newMax; index++) {
4975
+ menuItemArray[newIndex] = newIndex;
4976
+ newIndex++;
4977
+ }
4978
+ return menuItemArray;
4979
+ };
4980
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, {
4981
+ sx: {
4982
+ paddingTop: 2
4983
+ }
4984
+ }, /*#__PURE__*/_react["default"].createElement("form", null, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
4985
+ container: true,
4986
+ spacing: 0,
4987
+ justifyContent: "center",
4988
+ alignItems: "stretch",
4989
+ direction: "row"
4990
+ }, title != null && /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
4991
+ item: true,
4992
+ xs: 12,
4993
+ sm: 6,
4994
+ md: 3,
4995
+ key: "plans"
4996
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
4997
+ variant: "h4",
4998
+ gutterBottom: true
4999
+ }, title)), tiers.map(function (tier) {
5000
+ return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5001
+ item: true,
5002
+ xs: 12,
5003
+ sm: 6,
5004
+ md: 3,
5005
+ key: tier.title
5006
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
5007
+ sx: {
5008
+ paddingBottom: 2,
5009
+ padding: 2
5010
+ }
5011
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
5012
+ sx: {
5013
+ textAlign: "center",
5014
+ paddingTop: 2
5015
+ }
5016
+ }, tier.image != null && /*#__PURE__*/_react["default"].createElement("img", {
5017
+ src: tier.image,
5018
+ width: 200,
5019
+ height: 200
5020
+ }), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5021
+ variant: "h3",
5022
+ component: "h2",
5023
+ sx: {
5024
+ paddingTop: 3
5025
+ }
5026
+ }, tier.title), tier.subTitle && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5027
+ variant: "h6",
5028
+ component: "h2",
5029
+ sx: {
5030
+ paddingTop: 2
5031
+ }
5032
+ }, tier.subTitle), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5033
+ container: true,
5034
+ spacing: 0
5035
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5036
+ item: true,
5037
+ xs: tier.qty != null ? 6 : 12,
5038
+ sx: {
5039
+ padding: 4
5040
+ }
5041
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
5042
+ component: "span",
5043
+ sx: {
5044
+ fontSize: 30,
5045
+ fontWeight: "bold"
5046
+ }
5047
+ }, "$", tier.price), tier.duration != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
5048
+ component: "span"
5049
+ }, "/ ", tier.duration)), tier.qty != null && /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5050
+ item: true,
5051
+ xs: 6,
5052
+ sx: {
5053
+ padding: 4
5054
+ }
5055
+ }, /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
5056
+ name: "qty-" + tier.id,
5057
+ control: control,
5058
+ rules: {
5059
+ required: false
5060
+ },
5061
+ render: function render(_ref2) {
5062
+ var renderField = _ref2.renderField;
5063
+ return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
5064
+ fullWidth: true
5065
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
5066
+ id: "demo-simple-select-label"
5067
+ }, "Quantity"), /*#__PURE__*/_react["default"].createElement(_Select["default"], _extends({}, register("qty-" + tier.id, {
5068
+ required: false
5069
+ }), renderField, {
5070
+ labelId: "demo-simple-select-label",
5071
+ id: "demo-simple-select",
5072
+ defaultValue: 1,
5073
+ label: "Quantity"
5074
+ }), calculateQty(tier.qty).map(function (menuItem, index) {
5075
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
5076
+ key: index,
5077
+ value: menuItem
5078
+ }, menuItem);
5079
+ })));
5080
+ }
5081
+ }))), tier.modifiers != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
5082
+ sx: {
5083
+ paddingBottom: 2
5084
+ }
5085
+ }, tier.modifiers.map(function (modifier, index) {
5086
+ return /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
5087
+ name: "modifier-" + tier.id + modifier.name,
5088
+ control: control,
5089
+ rules: {
5090
+ required: false
5091
+ },
5092
+ render: function render(_ref3) {
5093
+ var renderField = _ref3.renderField;
5094
+ return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
5095
+ fullWidth: true,
5096
+ key: index,
5097
+ sx: {
5098
+ marginTop: 2
5099
+ }
5100
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
5101
+ id: "demo-simple-select-label"
5102
+ }, modifier.name), /*#__PURE__*/_react["default"].createElement(_Select["default"], _extends({}, register("modifier-" + tier.id + "-" + modifier.name, {
5103
+ required: false
5104
+ }), renderField, {
5105
+ labelId: "demo-simple-select-label",
5106
+ id: "demo-simple-select",
5107
+ defaultValue: 0,
5108
+ label: modifier.name
5109
+ }), modifier.options.map(function (mod, index) {
5110
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
5111
+ key: index,
5112
+ value: index
5113
+ }, mod);
5114
+ })));
5115
+ }
5116
+ });
5117
+ })), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5118
+ fullWidth: true,
5119
+ variant: tier.buttonVariant,
5120
+ endIcon: /*#__PURE__*/_react["default"].createElement(_ChevronRightRounded["default"], null),
5121
+ sx: {
5122
+ height: 50
5123
+ },
5124
+ onClick: handleSubmit( /*#__PURE__*/function () {
5125
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
5126
+ var modifiers, qty, index, modifier;
5127
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
5128
+ while (1) switch (_context.prev = _context.next) {
5129
+ case 0:
5130
+ modifiers = {};
5131
+ qty = null;
5132
+ if (tier.modifiers != null) {
5133
+ for (index = 0; index < tier.modifiers.length; index++) {
5134
+ modifier = tier.modifiers[index]; // assign the modifier as a property
5135
+ modifiers[modifier.name] = data["modifier-" + tier.id + "-" + modifier.name];
5136
+ }
5137
+ }
5138
+ if (tier.qty != null) {
5139
+ qty = parseInt(data["qty-" + tier.id]);
5140
+ }
5141
+ if (onButtonClicked != null) {
5142
+ onButtonClicked({
5143
+ id: tier.id,
5144
+ modifiers: modifiers,
5145
+ qty: qty
5146
+ });
5147
+ }
5148
+ case 5:
5149
+ case "end":
5150
+ return _context.stop();
5151
+ }
5152
+ }, _callee);
5153
+ }));
5154
+ return function (_x) {
5155
+ return _ref4.apply(this, arguments);
5156
+ };
5157
+ }())
5158
+ }, tier.buttonText), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5159
+ variant: "body2",
5160
+ sx: {
5161
+ paddingTop: 2,
5162
+ fontSize: 16,
5163
+ textAlign: "left",
5164
+ lineHeight: "1.5rem"
5165
+ }
5166
+ }, /*#__PURE__*/_react["default"].createElement("div", {
5167
+ dangerouslySetInnerHTML: {
5168
+ __html: tier.description
5169
+ }
5170
+ })))));
5171
+ })), features != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
5172
+ sx: {
5173
+ paddingTop: 1
5174
+ }
5175
+ }, features.map(function (feature) {
5176
+ return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_system.Box, {
5177
+ sx: {
5178
+ backgroundColor: "lightgray",
5179
+ padding: 1,
5180
+ borderRadius: 2
5181
+ }
5182
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5183
+ variant: "h5",
5184
+ gutterBottom: true
5185
+ }, feature.name)), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5186
+ container: true,
5187
+ spacing: 0,
5188
+ justifyContent: "center"
5189
+ }, feature.subfeatures.map(function (subfeature, subFeatureIndex) {
5190
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, subfeature.map(function (item, index) {
5191
+ return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5192
+ item: true,
5193
+ xs: 3,
5194
+ key: subfeature
5195
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
5196
+ sx: {
5197
+ padding: 2,
5198
+ height: 60,
5199
+ paddingTop: subFeatureIndex == 0 ? 3 : 2,
5200
+ textAlign: index == 0 ? "left" : "center"
5201
+ }
5202
+ }, item), feature.subfeatures.length - 1 != subFeatureIndex ? /*#__PURE__*/_react["default"].createElement("hr", null) : "");
5203
+ }));
5204
+ })));
5205
+ }))));
5206
+ }
5207
+ "use strict";
5208
+
5209
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5210
+ Object.defineProperty(exports, "__esModule", {
5211
+ value: true
5212
+ });
5213
+ exports.AddDomain = AddDomain;
5214
+ var _react = _interopRequireWildcard(require("react"));
5215
+ var _system = require("@mui/system");
5216
+ var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
5217
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
5218
+ var _styles = require("@mui/material/styles");
5219
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
5220
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
5221
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
5222
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
5223
+ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
5224
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
5225
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
5226
+ var _Stepper = _interopRequireDefault(require("@mui/material/Stepper"));
5227
+ var _Step = _interopRequireDefault(require("@mui/material/Step"));
5228
+ var _StepLabel = _interopRequireDefault(require("@mui/material/StepLabel"));
5229
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
5230
+ var _FmdBadRounded = _interopRequireDefault(require("@mui/icons-material/FmdBadRounded"));
5231
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
5232
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
5233
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
5234
+ var _ContentCopyRounded = _interopRequireDefault(require("@mui/icons-material/ContentCopyRounded"));
5235
+ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
5236
+ var _material = require("@mui/material");
5237
+ var _excluded = ["children", "onClose"];
5238
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
5239
+ 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); }
5240
+ 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; }
5241
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5242
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5243
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5244
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5245
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5246
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5247
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5248
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5249
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5250
+ 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; }
5251
+ 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; } }
5252
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { apiService } from 'authscape';
5253
+ function AddDomain(_ref) {
5254
+ var open = _ref.open,
5255
+ azureWebsite = _ref.azureWebsite,
5256
+ azureTxtValue = _ref.azureTxtValue,
5257
+ handleClose = _ref.handleClose;
5258
+ var steps = ['Enter a domain', 'Setup DNS Record', 'Go Live'];
5259
+ var _useState = (0, _react.useState)(0),
5260
+ _useState2 = _slicedToArray(_useState, 2),
5261
+ activeStep = _useState2[0],
5262
+ setActiveStep = _useState2[1];
5263
+ var _useState3 = (0, _react.useState)({}),
5264
+ _useState4 = _slicedToArray(_useState3, 2),
5265
+ completed = _useState4[0],
5266
+ setCompleted = _useState4[1];
5267
+
5268
+ // const [domain, setDomain] = useState(null);
5269
+ var _useState5 = (0, _react.useState)(null),
5270
+ _useState6 = _slicedToArray(_useState5, 2),
5271
+ subDomains = _useState6[0],
5272
+ setSubDomains = _useState6[1];
5273
+ // const [topLevelDomains , setTopLevelDomains ] = useState(null);
5274
+
5275
+ var _useState7 = (0, _react.useState)(null),
5276
+ _useState8 = _slicedToArray(_useState7, 2),
5277
+ fullDomain = _useState8[0],
5278
+ setFullDomain = _useState8[1];
5279
+ var _useState9 = (0, _react.useState)(null),
5280
+ _useState10 = _slicedToArray(_useState9, 2),
5281
+ errorMessage = _useState10[0],
5282
+ setErrorMessage = _useState10[1];
5283
+ var refDomain = (0, _react.useRef)(null);
5284
+ var refCNameTarget = (0, _react.useRef)(null);
5285
+ var reftxtTarget = (0, _react.useRef)(null);
5286
+ var refCNameName = (0, _react.useRef)(null);
5287
+ var reftxtName = (0, _react.useRef)(null);
5288
+ var totalSteps = function totalSteps() {
5289
+ return steps.length;
5290
+ };
5291
+ var completedSteps = function completedSteps() {
5292
+ return Object.keys(completed).length;
5293
+ };
5294
+ var isLastStep = function isLastStep() {
5295
+ return activeStep === totalSteps() - 1;
5296
+ };
5297
+ var allStepsCompleted = function allStepsCompleted() {
5298
+ return completedSteps() === totalSteps();
5299
+ };
5300
+ var handleNext = function handleNext() {
5301
+ var newActiveStep = isLastStep() && !allStepsCompleted() ?
5302
+ // It's the last step, but not all steps have been completed,
5303
+ // find the first step that has been completed
5304
+ steps.findIndex(function (step, i) {
5305
+ return !(i in completed);
5306
+ }) : activeStep + 1;
5307
+ setActiveStep(newActiveStep);
5308
+ };
5309
+ var handleBack = function handleBack() {
5310
+ setActiveStep(function (prevActiveStep) {
5311
+ return prevActiveStep - 1;
5312
+ });
5313
+ };
5314
+ var getSubdomain = function getSubdomain(hostName) {
5315
+ var host = hostName; // e.g., subdomain.example.com
5316
+ var parts = host.split('.');
5317
+ if (parts.length > 2) {
5318
+ return parts[0]; // This will be 'subdomain'
5319
+ }
5320
+
5321
+ return null; // No subdomain found
5322
+ };
5323
+
5324
+ var handleStep = function handleStep(step) {
5325
+ return function () {
5326
+ setActiveStep(step);
5327
+ };
5328
+ };
5329
+ var handleComplete = function handleComplete() {
5330
+ var newCompleted = completed;
5331
+ newCompleted[activeStep] = true;
5332
+ setCompleted(newCompleted);
5333
+ handleNext();
5334
+ };
5335
+ var BootstrapDialog = (0, _styles.styled)(_Dialog["default"])(function (_ref2) {
5336
+ var theme = _ref2.theme;
5337
+ return {
5338
+ '& .MuiDialogContent-root': {
5339
+ padding: theme.spacing(2)
5340
+ },
5341
+ '& .MuiDialogActions-root': {
5342
+ padding: theme.spacing(1)
5343
+ }
5344
+ };
5345
+ });
5346
+ var handleReset = function handleReset() {
5347
+ setActiveStep(0);
5348
+ setCompleted({});
5349
+ };
5350
+ var createTheDomainRequest = /*#__PURE__*/function () {
5351
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5352
+ var response, aStep;
5353
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
5354
+ while (1) switch (_context.prev = _context.next) {
5355
+ case 0:
5356
+ if (!(fullDomain == null || fullDomain == "")) {
5357
+ _context.next = 2;
5358
+ break;
5359
+ }
5360
+ return _context.abrupt("return");
5361
+ case 2:
5362
+ _context.next = 4;
5363
+ return apiService().post("/PrivateLabel/GenerateDomain", {
5364
+ hostName: fullDomain
5365
+ });
5366
+ case 4:
5367
+ response = _context.sent;
5368
+ if (response != null && response.status == 200) {
5369
+ if (handleClose != null) {
5370
+ handleClose();
5371
+ }
5372
+ } else {
5373
+ aStep = activeStep - 1;
5374
+ setActiveStep(aStep);
5375
+ setErrorMessage(response.data);
5376
+ }
5377
+ case 6:
5378
+ case "end":
5379
+ return _context.stop();
5380
+ }
5381
+ }, _callee);
5382
+ }));
5383
+ return function createTheDomainRequest() {
5384
+ return _ref3.apply(this, arguments);
5385
+ };
5386
+ }();
5387
+ (0, _react.useEffect)(function () {
5388
+ if (activeStep == 2) {
5389
+ createTheDomainRequest();
5390
+ }
5391
+ }, [activeStep]);
5392
+ var copyToClipboard = /*#__PURE__*/function () {
5393
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(text) {
5394
+ var permissions;
5395
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
5396
+ while (1) switch (_context2.prev = _context2.next) {
5397
+ case 0:
5398
+ _context2.prev = 0;
5399
+ _context2.next = 3;
5400
+ return navigator.permissions.query({
5401
+ name: "clipboard-write"
5402
+ });
5403
+ case 3:
5404
+ permissions = _context2.sent;
5405
+ if (!(permissions.state === "granted" || permissions.state === "prompt")) {
5406
+ _context2.next = 9;
5407
+ break;
5408
+ }
5409
+ _context2.next = 7;
5410
+ return navigator.clipboard.writeText(text);
5411
+ case 7:
5412
+ _context2.next = 10;
5413
+ break;
5414
+ case 9:
5415
+ throw new Error("Can't access the clipboard. Check your browser permissions.");
5416
+ case 10:
5417
+ _context2.next = 15;
5418
+ break;
5419
+ case 12:
5420
+ _context2.prev = 12;
5421
+ _context2.t0 = _context2["catch"](0);
5422
+ alert('Error copying to clipboard:', _context2.t0);
5423
+ case 15:
5424
+ case "end":
5425
+ return _context2.stop();
5426
+ }
5427
+ }, _callee2, null, [[0, 12]]);
5428
+ }));
5429
+ return function copyToClipboard(_x2) {
5430
+ return _ref4.apply(this, arguments);
5431
+ };
5432
+ }();
5433
+ function BootstrapDialogTitle(props) {
5434
+ var children = props.children,
5435
+ onClose = props.onClose,
5436
+ other = _objectWithoutProperties(props, _excluded);
5437
+ return /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], _extends({
5438
+ sx: {
5439
+ m: 0,
5440
+ p: 2
5441
+ }
5442
+ }, other), children, onClose ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
5443
+ "aria-label": "close",
5444
+ onClick: onClose,
5445
+ sx: {
5446
+ position: 'absolute',
5447
+ right: 8,
5448
+ top: 8,
5449
+ color: function color(theme) {
5450
+ return theme.palette.grey[500];
5451
+ }
5452
+ }
5453
+ }, /*#__PURE__*/_react["default"].createElement(_Close["default"], null)) : null);
5454
+ }
5455
+ return /*#__PURE__*/_react["default"].createElement(BootstrapDialog, {
5456
+ onClose: handleClose,
5457
+ "aria-labelledby": "customized-dialog-title",
5458
+ sx: {
5459
+ backgroundColor: "rgba(0, 0, 0, 0.6)"
5460
+ },
5461
+ fullWidth: true,
5462
+ maxWidth: "md",
5463
+ open: open
5464
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
5465
+ sx: {
5466
+ padding: 4
5467
+ }
5468
+ }, /*#__PURE__*/_react["default"].createElement(_Stepper["default"], {
5469
+ activeStep: activeStep,
5470
+ alternativeLabel: true
5471
+ }, steps.map(function (label) {
5472
+ return /*#__PURE__*/_react["default"].createElement(_Step["default"], {
5473
+ key: label
5474
+ }, /*#__PURE__*/_react["default"].createElement(_StepLabel["default"], {
5475
+ sx: {
5476
+ color: "#fff"
5477
+ }
5478
+ }, label));
5479
+ })), activeStep == 0 && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(BootstrapDialogTitle, {
5480
+ id: "customized-dialog-title",
5481
+ onClose: handleClose,
5482
+ sx: {
5483
+ textAlign: "center",
5484
+ fontSize: 30,
5485
+ marginTop: 2,
5486
+ lineHeight: 1
5487
+ }
5488
+ }, "What domain would you like to connect to ", process.env.companyName, "?"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
5489
+ inputRef: refDomain,
5490
+ id: "domainTxt",
5491
+ label: "Enter subdomain URL e.g catalog.mydomain.com",
5492
+ fullWidth: true,
5493
+ variant: "outlined",
5494
+ sx: {
5495
+ color: "white",
5496
+ marginTop: 2
5497
+ }
5498
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5499
+ sx: {
5500
+ marginTop: 2
5501
+ }
5502
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5503
+ gutterBottom: true,
5504
+ sx: {
5505
+ textAlign: "center",
5506
+ fontSize: 14
5507
+ }
5508
+ }, /*#__PURE__*/_react["default"].createElement(_FmdBadRounded["default"], {
5509
+ sx: {
5510
+ color: "#1976d2",
5511
+ position: "relative",
5512
+ top: 8
5513
+ }
5514
+ }), " You must own the domain and have the ability to add records"))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5515
+ variant: "contained",
5516
+ onClick: function onClick() {
5517
+ if (refDomain.current.value == "") {
5518
+ return;
5519
+ }
5520
+ setFullDomain(refDomain.current.value);
5521
+ var _subDomain = getSubdomain(refDomain.current.value);
5522
+ setSubDomains(_subDomain);
5523
+
5524
+ // var domainLand = parseDomain(refDomain.current.value);
5525
+ // setDomain(domainLand.domain);
5526
+ // setSubDomains(domainLand.subDomains);
5527
+ // setTopLevelDomains(domainLand.topLevelDomains);
5528
+
5529
+ handleNext();
5530
+ }
5531
+ }, "Next: Setup DNS"))), activeStep == 1 && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(BootstrapDialogTitle, {
5532
+ id: "customized-dialog-title",
5533
+ onClose: handleClose,
5534
+ sx: {
5535
+ textAlign: "center",
5536
+ fontSize: 30,
5537
+ marginTop: 2
5538
+ }
5539
+ }, "Configure your DNS"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5540
+ gutterBottom: true,
5541
+ sx: {
5542
+ textAlign: "center",
5543
+ fontSize: 14
5544
+ }
5545
+ }, "Add a CNAME and TXT Record to your domain by visiting your DNS provider.")), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5546
+ sx: {
5547
+ backgroundColor: "#f7f7f7",
5548
+ marginTop: 5,
5549
+ paddingLeft: 4,
5550
+ paddingRight: 4
5551
+ }
5552
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5553
+ container: true,
5554
+ spacing: 2,
5555
+ fullWidth: true
5556
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5557
+ item: true,
5558
+ xs: 2
5559
+ }, "Type", /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
5560
+ fullWidth: true,
5561
+ sx: {
5562
+ paddingTop: 2
5563
+ }
5564
+ }, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
5565
+ value: 1,
5566
+ readOnly: true
5567
+ }, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
5568
+ value: 1
5569
+ }, "CNAME")))), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5570
+ item: true,
5571
+ xs: 5
5572
+ }, "Name", /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
5573
+ inputRef: refCNameName,
5574
+ id: "NameDomainTxt",
5575
+ label: "",
5576
+ fullWidth: true,
5577
+ value: subDomains,
5578
+ variant: "outlined",
5579
+ sx: {
5580
+ color: "white",
5581
+ paddingTop: 2
5582
+ }
5583
+ }), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5584
+ sx: {
5585
+ textAlign: "center",
5586
+ paddingTop: 1
5587
+ }
5588
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5589
+ startIcon: /*#__PURE__*/_react["default"].createElement(_ContentCopyRounded["default"], null),
5590
+ sx: {
5591
+ width: "100%"
5592
+ },
5593
+ variant: "contained",
5594
+ onClick: function onClick() {
5595
+ copyToClipboard(refCNameName.current.value);
5596
+ }
5597
+ }, "Copy"))), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5598
+ item: true,
5599
+ xs: 5
5600
+ }, "Target", /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
5601
+ inputRef: refCNameTarget,
5602
+ id: "targetDomainTxt",
5603
+ label: "",
5604
+ fullWidth: true,
5605
+ value: azureWebsite,
5606
+ variant: "outlined",
5607
+ sx: {
5608
+ color: "white",
5609
+ paddingTop: 2
5610
+ }
5611
+ }), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5612
+ sx: {
5613
+ textAlign: "center",
5614
+ paddingTop: 1
5615
+ }
5616
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5617
+ startIcon: /*#__PURE__*/_react["default"].createElement(_ContentCopyRounded["default"], null),
5618
+ sx: {
5619
+ width: "100%"
5620
+ },
5621
+ variant: "contained",
5622
+ onClick: function onClick() {
5623
+ copyToClipboard(refCNameTarget.current.value);
5624
+ }
5625
+ }, "Copy"))))), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5626
+ sx: {
5627
+ backgroundColor: "#f7f7f7",
5628
+ paddingLeft: 4,
5629
+ paddingRight: 4,
5630
+ marginTop: 2,
5631
+ paddingBottom: 4
5632
+ }
5633
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5634
+ container: true,
5635
+ spacing: 2,
5636
+ fullWidth: true
5637
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5638
+ item: true,
5639
+ xs: 2
5640
+ }, "Type", /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
5641
+ fullWidth: true,
5642
+ sx: {
5643
+ paddingTop: 2
5644
+ }
5645
+ }, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
5646
+ value: 1,
5647
+ readOnly: true
5648
+ }, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
5649
+ value: 1
5650
+ }, "TXT")))), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5651
+ item: true,
5652
+ xs: 5
5653
+ }, "Name", /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
5654
+ inputRef: reftxtName,
5655
+ id: "NameDomain2Txt",
5656
+ label: "",
5657
+ fullWidth: true,
5658
+ value: "asuid." + subDomains,
5659
+ variant: "outlined",
5660
+ sx: {
5661
+ color: "white",
5662
+ marginTop: 2
5663
+ }
5664
+ }), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5665
+ sx: {
5666
+ textAlign: "center",
5667
+ paddingTop: 1
5668
+ }
5669
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5670
+ startIcon: /*#__PURE__*/_react["default"].createElement(_ContentCopyRounded["default"], null),
5671
+ sx: {
5672
+ width: "100%"
5673
+ },
5674
+ variant: "contained",
5675
+ onClick: function onClick() {
5676
+ copyToClipboard(reftxtName.current.value);
5677
+ }
5678
+ }, "Copy"))), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5679
+ item: true,
5680
+ xs: 5
5681
+ }, "Target", /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
5682
+ inputRef: reftxtTarget,
5683
+ id: "targetDomain2Txt",
5684
+ label: "",
5685
+ fullWidth: true,
5686
+ value: azureTxtValue,
5687
+ variant: "outlined",
5688
+ sx: {
5689
+ color: "white",
5690
+ marginTop: 2
5691
+ }
5692
+ }), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5693
+ sx: {
5694
+ textAlign: "center",
5695
+ paddingTop: 1
5696
+ }
5697
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5698
+ startIcon: /*#__PURE__*/_react["default"].createElement(_ContentCopyRounded["default"], null),
5699
+ sx: {
5700
+ width: "100%"
5701
+ },
5702
+ variant: "contained",
5703
+ onClick: function onClick() {
5704
+ copyToClipboard(reftxtTarget.current.value);
5705
+ }
5706
+ }, "Copy")))))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5707
+ variant: "contained",
5708
+ onClick: function onClick() {
5709
+ handleNext();
5710
+ }
5711
+ }, "Go Live"))), activeStep == 2 && /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(BootstrapDialogTitle, {
5712
+ id: "customized-dialog-title",
5713
+ onClose: handleClose,
5714
+ sx: {
5715
+ textAlign: "center",
5716
+ fontSize: 30,
5717
+ marginTop: 4
5718
+ }
5719
+ }, "Creating your private label experience"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_system.Box, {
5720
+ sx: {
5721
+ paddingTop: 2,
5722
+ textAlign: "center"
5723
+ }
5724
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
5725
+ gutterBottom: true,
5726
+ sx: {
5727
+ textAlign: "center",
5728
+ fontSize: 18
5729
+ }
5730
+ }, "Please wait while we complete a few things on our side."), /*#__PURE__*/_react["default"].createElement(_system.Box, {
5731
+ sx: {
5732
+ paddingTop: 2
5733
+ }
5734
+ }, /*#__PURE__*/_react["default"].createElement(_CircularProgress["default"], {
5735
+ color: "inherit"
5736
+ })))))), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
5737
+ open: errorMessage != null ? true : false,
5738
+ onClose: function onClose() {
5739
+ setErrorMessage(null);
5740
+ },
5741
+ "aria-labelledby": "alert-dialog-title",
5742
+ "aria-describedby": "alert-dialog-description"
5743
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
5744
+ id: "alert-dialog-title"
5745
+ }, "Issue Detected"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_material.DialogContentText, {
5746
+ id: "alert-dialog-description"
5747
+ }, errorMessage)), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
5748
+ onClick: function onClick() {
5749
+ setErrorMessage(null);
5750
+ },
5751
+ autoFocus: true
5752
+ }, "OK"))));
5753
+ }
5754
+ "use strict";
5755
+
5756
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5757
+ Object.defineProperty(exports, "__esModule", {
5758
+ value: true
5759
+ });
5760
+ exports.PrivateLabelEditor = PrivateLabelEditor;
5761
+ var _react = _interopRequireWildcard(require("react"));
5762
+ var _react2 = _interopRequireWildcard(require("@monaco-editor/react"));
5763
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
5764
+ var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
5765
+ var _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
5766
+ var _Tab = _interopRequireDefault(require("@mui/material/Tab"));
5767
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
5768
+ var _material = require("@mui/material");
5769
+ var _xDataGrid = require("@mui/x-data-grid");
5770
+ var _PublishRounded = _interopRequireDefault(require("@mui/icons-material/PublishRounded"));
5771
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
5772
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
5773
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
5774
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
5775
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
5776
+ 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); }
5777
+ 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; }
5778
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5779
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5780
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5781
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5782
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5783
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5784
+ 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; }
5785
+ 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; } }
5786
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5787
+ // remove after NPM
5788
+ // import {FileUploader, apiService, ColorPicker, Dropzone} from 'authscape';
5789
+ // import AddDomain from "./AddDomainModal";
5790
+
5791
+ function PrivateLabelEditor(_ref) {
5792
+ var loadedUser = _ref.loadedUser,
5793
+ notification = _ref.notification,
5794
+ _ref$showAllDomains = _ref.showAllDomains,
5795
+ showAllDomains = _ref$showAllDomains === void 0 ? false : _ref$showAllDomains,
5796
+ _ref$companyId = _ref.companyId,
5797
+ companyId = _ref$companyId === void 0 ? null : _ref$companyId,
5798
+ _ref$azureWebsite = _ref.azureWebsite,
5799
+ azureWebsite = _ref$azureWebsite === void 0 ? "" : _ref$azureWebsite,
5800
+ _ref$azureTxtValue = _ref.azureTxtValue,
5801
+ azureTxtValue = _ref$azureTxtValue === void 0 ? "" : _ref$azureTxtValue;
5802
+ var monaco = (0, _react2.useMonaco)();
5803
+ var cssEditorRef = (0, _react.useRef)(null);
5804
+ var htmlEditorRef = (0, _react.useRef)(null);
5805
+ var _useState = (0, _react.useState)(null),
5806
+ _useState2 = _slicedToArray(_useState, 2),
5807
+ data = _useState2[0],
5808
+ setData = _useState2[1];
5809
+ var _useState3 = (0, _react.useState)(0),
5810
+ _useState4 = _slicedToArray(_useState3, 2),
5811
+ value = _useState4[0],
5812
+ setValue = _useState4[1];
5813
+ var _useState5 = (0, _react.useState)([]),
5814
+ _useState6 = _slicedToArray(_useState5, 2),
5815
+ fonts = _useState6[0],
5816
+ setFonts = _useState6[1];
5817
+ var _useState7 = (0, _react.useState)([]),
5818
+ _useState8 = _slicedToArray(_useState7, 2),
5819
+ oEMDomainList = _useState8[0],
5820
+ setOEMDomainList = _useState8[1];
5821
+ var _useState9 = (0, _react.useState)([]),
5822
+ _useState10 = _slicedToArray(_useState9, 2),
5823
+ dnsFields = _useState10[0],
5824
+ setDnsFields = _useState10[1];
5825
+ var _useState11 = (0, _react.useState)(null),
5826
+ _useState12 = _slicedToArray(_useState11, 2),
5827
+ selectedFont = _useState12[0],
5828
+ setSelectedFont = _useState12[1];
5829
+ var _useState13 = (0, _react.useState)(null),
5830
+ _useState14 = _slicedToArray(_useState13, 2),
5831
+ fontUri = _useState14[0],
5832
+ setFontUri = _useState14[1];
5833
+ var _useState15 = (0, _react.useState)(null),
5834
+ _useState16 = _slicedToArray(_useState15, 2),
5835
+ oEMDomain = _useState16[0],
5836
+ setOEMDomain = _useState16[1];
5837
+ var _useState17 = (0, _react.useState)(''),
5838
+ _useState18 = _slicedToArray(_useState17, 2),
5839
+ stateBaseUri = _useState18[0],
5840
+ setBaseUri = _useState18[1];
5841
+ var _useState19 = (0, _react.useState)(false),
5842
+ _useState20 = _slicedToArray(_useState19, 2),
5843
+ isNewAccount = _useState20[0],
5844
+ setIsNewAccount = _useState20[1];
5845
+ var handleChange = function handleChange(event, newValue) {
5846
+ setValue(newValue);
5847
+ };
5848
+ var GetBaseUrl = function GetBaseUrl() {
5849
+ return window.location.protocol + "//" + window.location.host;
5850
+ };
5851
+ var loadDNSFields = /*#__PURE__*/function () {
5852
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5853
+ var _domain,
5854
+ domain,
5855
+ responseFields,
5856
+ _args = arguments;
5857
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
5858
+ while (1) switch (_context.prev = _context.next) {
5859
+ case 0:
5860
+ _domain = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
5861
+ domain = null;
5862
+ if (_domain != null) {
5863
+ domain = _domain;
5864
+ } else {
5865
+ domain = GetBaseUrl();
5866
+ }
5867
+ _context.next = 5;
5868
+ return apiService().get("/PrivateLabel/GetFields?domain=" + domain + (companyId != null ? "&companyId=" + companyId : ""));
5869
+ case 5:
5870
+ responseFields = _context.sent;
5871
+ if (responseFields != null && responseFields.status == 200) {
5872
+ setDnsFields(responseFields.data);
5873
+ }
5874
+ case 7:
5875
+ case "end":
5876
+ return _context.stop();
5877
+ }
5878
+ }, _callee);
5879
+ }));
5880
+ return function loadDNSFields() {
5881
+ return _ref2.apply(this, arguments);
5882
+ };
5883
+ }();
5884
+ (0, _react.useEffect)(function () {
5885
+ if (oEMDomain != null) {
5886
+ loadDNSFields(oEMDomain);
5887
+ }
5888
+ }, [oEMDomain]);
5889
+ var FetchOEMData = /*#__PURE__*/function () {
5890
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
5891
+ var response, _response, _response2;
5892
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
5893
+ while (1) switch (_context2.prev = _context2.next) {
5894
+ case 0:
5895
+ _context2.next = 2;
5896
+ return apiService().get("/PrivateLabel/GetFonts");
5897
+ case 2:
5898
+ response = _context2.sent;
5899
+ if (response != null && response.status == 200) {
5900
+ setFonts(response.data);
5901
+ }
5902
+ if (!showAllDomains) {
5903
+ _context2.next = 11;
5904
+ break;
5905
+ }
5906
+ _context2.next = 7;
5907
+ return apiService().get("/PrivateLabel/GetAllDomains");
5908
+ case 7:
5909
+ _response = _context2.sent;
5910
+ if (_response != null && _response.status == 200) {
5911
+ setOEMDomainList(_response.data);
5912
+ if (_response.data.length > 0) {
5913
+ setOEMDomain(_response.data[0].name);
5914
+ } else {
5915
+ setIsNewAccount(true);
5916
+ }
5917
+ }
5918
+ _context2.next = 15;
5919
+ break;
5920
+ case 11:
5921
+ _context2.next = 13;
5922
+ return apiService().get("/PrivateLabel/GetAllDomainsUser");
5923
+ case 13:
5924
+ _response2 = _context2.sent;
5925
+ if (_response2 != null && _response2.status == 200) {
5926
+ setOEMDomainList(_response2.data);
5927
+ if (_response2.data.length > 0) {
5928
+ setOEMDomain(_response2.data[0].name);
5929
+ } else {
5930
+ setIsNewAccount(true);
5931
+ }
5932
+ }
5933
+ case 15:
5934
+ case "end":
5935
+ return _context2.stop();
5936
+ }
5937
+ }, _callee2);
5938
+ }));
5939
+ return function FetchOEMData() {
5940
+ return _ref3.apply(this, arguments);
5941
+ };
5942
+ }();
5943
+ (0, _react.useEffect)(function () {
5944
+ if (loadedUser) {
5945
+ FetchOEMData();
5946
+ }
5947
+ }, [loadedUser]);
5948
+ var _React$useState = _react["default"].useState({
5949
+ page: 0,
5950
+ pageSize: 12
5951
+ }),
5952
+ _React$useState2 = _slicedToArray(_React$useState, 2),
5953
+ paginationModel = _React$useState2[0],
5954
+ setPaginationModel = _React$useState2[1];
5955
+ function handleCSSEditorDidMount(editor, monaco) {
5956
+ cssEditorRef.current = editor;
5957
+ }
5958
+ function handleHtmlEditorDidMount(editor, monaco) {
5959
+ htmlEditorRef.current = editor;
5960
+ }
5961
+ var columns = [{
5962
+ field: "label",
5963
+ headerName: "Fonts",
5964
+ editable: false,
5965
+ width: 300,
5966
+ renderCell: function renderCell(params) {
5967
+ var RenderData = function RenderData(row) {
5968
+ // const { id, value, field } = params;
5969
+ // const apiRef = useGridApiContext();
5970
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
5971
+ sx: {
5972
+ fontFamily: row.value,
5973
+ fontSize: 20,
5974
+ cursor: "pointer"
5975
+ }
5976
+ }, row.value), /*#__PURE__*/_react["default"].createElement("link", {
5977
+ href: "https://fonts.googleapis.com/css2?family=" + row.value,
5978
+ rel: "stylesheet"
5979
+ }));
5980
+ };
5981
+ return RenderData(params);
5982
+ }
5983
+ }];
5984
+ (0, _react.useEffect)(function () {
5985
+ var fetchData = /*#__PURE__*/function () {
5986
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
5987
+ var response;
5988
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
5989
+ while (1) switch (_context3.prev = _context3.next) {
5990
+ case 0:
5991
+ // if (monaco) {
5992
+ // //console.log("here is the monaco instance:", monaco);
5993
+ // }
5994
+
5995
+ setData(null);
5996
+ _context3.next = 3;
5997
+ return apiService().get("/PrivateLabel/GetEditorData?domain=" + oEMDomain + (companyId != null ? "&companyId=" + companyId : ""));
5998
+ case 3:
5999
+ response = _context3.sent;
6000
+ if (response.status == 200) {
6001
+ setData(response.data);
6002
+ setSelectedFont(response.data.fontFamily);
6003
+ setFontUri(response.data.fontUrl);
6004
+ }
6005
+ case 5:
6006
+ case "end":
6007
+ return _context3.stop();
6008
+ }
6009
+ }, _callee3);
6010
+ }));
6011
+ return function fetchData() {
6012
+ return _ref4.apply(this, arguments);
6013
+ };
6014
+ }();
6015
+ fetchData();
6016
+ }, [monaco, oEMDomain]);
6017
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6018
+ sx: {
6019
+ width: '100%'
6020
+ }
6021
+ }, selectedFont != null && fontUri == null && /*#__PURE__*/_react["default"].createElement("link", {
6022
+ href: "https://fonts.googleapis.com/css2?family=" + selectedFont,
6023
+ rel: "stylesheet"
6024
+ }), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6025
+ sx: {
6026
+ paddingTop: 6
6027
+ }
6028
+ }, oEMDomain != null && /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
6029
+ fullWidth: true
6030
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
6031
+ id: "demo-simple-select-label"
6032
+ }, "Website Domain"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
6033
+ labelId: "demo-simple-select-label",
6034
+ id: "demo-simple-select",
6035
+ defaultValue: oEMDomain,
6036
+ label: "Website Domain",
6037
+ onChange: function onChange(val) {
6038
+ setOEMDomain(val.target.value);
6039
+ }
6040
+ }, oEMDomainList.map(function (dns) {
6041
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
6042
+ value: dns.name
6043
+ }, dns.name);
6044
+ })))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6045
+ sx: {
6046
+ borderBottom: 1,
6047
+ borderColor: 'divider',
6048
+ paddingTop: 2
6049
+ }
6050
+ }, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
6051
+ value: value,
6052
+ onChange: handleChange,
6053
+ "aria-label": "basic tabs example"
6054
+ }, /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6055
+ label: "App Icon / Colors"
6056
+ }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6057
+ label: "Fonts"
6058
+ }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6059
+ label: "Style Sheet Editor"
6060
+ }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
6061
+ label: "HTML Import Editor"
6062
+ }))), /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6063
+ sx: {
6064
+ padding: 2
6065
+ }
6066
+ }, value == 0 && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, data != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6067
+ container: true,
6068
+ spacing: 2
6069
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6070
+ item: true,
6071
+ xs: 4
6072
+ }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6073
+ sx: {
6074
+ paddingBottom: 4
6075
+ }
6076
+ }, /*#__PURE__*/_react["default"].createElement(Dropzone, {
6077
+ image: "/DefaultNoImage.svg",
6078
+ text: "Drag 'n' drop your app icon here",
6079
+ onDrop: /*#__PURE__*/function () {
6080
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(file) {
6081
+ var data, response;
6082
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
6083
+ while (1) switch (_context4.prev = _context4.next) {
6084
+ case 0:
6085
+ data = new FormData();
6086
+ data.append("file", file);
6087
+ data.append("domain", stateBaseUri);
6088
+ _context4.next = 5;
6089
+ return apiService().post("/PrivateLabel/UploadAppIcon", data);
6090
+ case 5:
6091
+ response = _context4.sent;
6092
+ if (response != null && response.status == 200) {
6093
+ window.location.reload();
6094
+ }
6095
+ case 7:
6096
+ case "end":
6097
+ return _context4.stop();
6098
+ }
6099
+ }, _callee4);
6100
+ }));
6101
+ return function (_x2) {
6102
+ return _ref5.apply(this, arguments);
6103
+ };
6104
+ }()
6105
+ }))), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6106
+ item: true,
6107
+ xs: 8
6108
+ }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6109
+ sx: {
6110
+ paddingBottom: 2,
6111
+ fontWeight: "bold",
6112
+ fontSize: 16
6113
+ }
6114
+ }, "Adjust the colors for your site"), /*#__PURE__*/_react["default"].createElement(_Box["default"], null, dnsFields != null && dnsFields.map(function (dnsField, index) {
6115
+ return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6116
+ key: index
6117
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6118
+ container: true,
6119
+ spacing: 2
6120
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6121
+ item: true,
6122
+ xs: 3
6123
+ }, dnsField.name), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6124
+ item: true,
6125
+ xs: 9
6126
+ }, /*#__PURE__*/_react["default"].createElement(ColorPicker, {
6127
+ name: dnsField.name,
6128
+ defaultColor: dnsField.value,
6129
+ onColorChanged: /*#__PURE__*/function () {
6130
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(name, hex) {
6131
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
6132
+ while (1) switch (_context5.prev = _context5.next) {
6133
+ case 0:
6134
+ _context5.next = 2;
6135
+ return apiService().post("/PrivateLabel/SetFieldValue", {
6136
+ id: dnsField.id,
6137
+ fieldId: dnsField.fieldId,
6138
+ value: hex
6139
+ });
6140
+ case 2:
6141
+ notification(dnsField.name + " Saved");
6142
+ case 3:
6143
+ case "end":
6144
+ return _context5.stop();
6145
+ }
6146
+ }, _callee5);
6147
+ }));
6148
+ return function (_x3, _x4) {
6149
+ return _ref6.apply(this, arguments);
6150
+ };
6151
+ }()
6152
+ }))));
6153
+ })))))), value == 1 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6154
+ value: value,
6155
+ index: 1
6156
+ }, data != null && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6157
+ container: true,
6158
+ spacing: 2
6159
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6160
+ item: true,
6161
+ xs: 6
6162
+ }, loadedUser == true && /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_xDataGrid.DataGrid, {
6163
+ rows: fonts,
6164
+ columns: columns,
6165
+ sx: {
6166
+ height: "80vh",
6167
+ width: "100%"
6168
+ },
6169
+ pagination: true,
6170
+ disableSelectionOnClick: true,
6171
+ onPaginationModelChange: setPaginationModel,
6172
+ paginationModel: paginationModel
6173
+ //pageSizeOptions={[5]}
6174
+ // rowCount={100}
6175
+ // rowSelectionModel={selectedFont}
6176
+ ,
6177
+ onRowClick: /*#__PURE__*/function () {
6178
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
6179
+ var response;
6180
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
6181
+ while (1) switch (_context6.prev = _context6.next) {
6182
+ case 0:
6183
+ _context6.next = 2;
6184
+ return apiService().post("/PrivateLabel/SetFont", {
6185
+ companyId: companyId,
6186
+ domain: oEMDomain,
6187
+ value: params.row.label
6188
+ });
6189
+ case 2:
6190
+ response = _context6.sent;
6191
+ if (response != null && response.status == 200) {
6192
+ setSelectedFont(params.row.label);
6193
+ setFontUri(null);
6194
+ notification("Font saved!");
6195
+ }
6196
+ case 4:
6197
+ case "end":
6198
+ return _context6.stop();
6199
+ }
6200
+ }, _callee6);
6201
+ }));
6202
+ return function (_x5) {
6203
+ return _ref7.apply(this, arguments);
6204
+ };
6205
+ }()
6206
+ }))), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6207
+ item: true,
6208
+ xs: 6
6209
+ }, /*#__PURE__*/_react["default"].createElement(FileUploader, {
6210
+ url: "/PrivateLabel/UploadCustomFont",
6211
+ accept: ".otf,.ttf,.woff",
6212
+ params: {
6213
+ domain: stateBaseUri
6214
+ },
6215
+ multiple: true,
6216
+ variant: "custom",
6217
+ onUploadCompleted: function onUploadCompleted() {
6218
+ window.location.reload();
6219
+ }
6220
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6221
+ color: "primary",
6222
+ variant: "contained",
6223
+ fullWidth: true,
6224
+ sx: {
6225
+ height: 50
6226
+ },
6227
+ startIcon: /*#__PURE__*/_react["default"].createElement(_PublishRounded["default"], null)
6228
+ }, /*#__PURE__*/_react["default"].createElement(_Box["default"], null, "Upload Font"), "\xA0", /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6229
+ sx: {
6230
+ textAlign: "center"
6231
+ }
6232
+ }, /*#__PURE__*/_react["default"].createElement("small", null, "(.OTF, .TTF, OR .WOFF)")))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6233
+ sx: {
6234
+ marginTop: 4
6235
+ }
6236
+ }, "Font Selected:"), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6237
+ sx: {
6238
+ marginBottom: 2,
6239
+ fontWeight: "bold",
6240
+ fontSize: 20
6241
+ }
6242
+ }, " ", selectedFont), /*#__PURE__*/_react["default"].createElement("hr", null), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6243
+ sx: {
6244
+ fontFamily: selectedFont
6245
+ }
6246
+ }, "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"], {
6247
+ value: value,
6248
+ index: 3
6249
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6250
+ container: true,
6251
+ spacing: 2
6252
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6253
+ item: true,
6254
+ xs: 6
6255
+ }, /*#__PURE__*/_react["default"].createElement("h4", {
6256
+ style: {
6257
+ marginBottom: "0px"
6258
+ }
6259
+ }, "Global CSS edits"), /*#__PURE__*/_react["default"].createElement("small", null, "You can make edits to your stylesheet")), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6260
+ item: true,
6261
+ xs: 6,
6262
+ sx: {
6263
+ textAlign: "right"
6264
+ }
6265
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6266
+ startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null),
6267
+ sx: {
6268
+ marginTop: 4
6269
+ },
6270
+ variant: "contained",
6271
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
6272
+ var response;
6273
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
6274
+ while (1) switch (_context7.prev = _context7.next) {
6275
+ case 0:
6276
+ _context7.next = 2;
6277
+ return apiService().post("/PrivateLabel/SetGlobalCSS", {
6278
+ companyId: companyId,
6279
+ domain: oEMDomain,
6280
+ value: cssEditorRef.current.getValue()
6281
+ });
6282
+ case 2:
6283
+ response = _context7.sent;
6284
+ if (response != null && response.status == 200) {
6285
+ notification("CSS Saved!");
6286
+ }
6287
+ case 4:
6288
+ case "end":
6289
+ return _context7.stop();
6290
+ }
6291
+ }, _callee7);
6292
+ }))
6293
+ }, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6294
+ sx: {
6295
+ paddingTop: 1
2795
6296
  }
2796
- }, /*#__PURE__*/_react["default"].createElement("form", null, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
6297
+ }, data != null && /*#__PURE__*/_react["default"].createElement(_react2["default"], {
6298
+ height: "70vh",
6299
+ onMount: handleCSSEditorDidMount,
6300
+ defaultLanguage: "css",
6301
+ theme: "vs-dark",
6302
+ defaultValue: data == null || data.prettyCSS == null ? "" : data.prettyCSS
6303
+ }))), value == 3 && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
6304
+ value: value,
6305
+ index: 4
6306
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
2797
6307
  container: true,
2798
- spacing: 0,
2799
- justifyContent: "center",
2800
- alignItems: "stretch",
2801
- direction: "row"
2802
- }, title != null && /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
6308
+ spacing: 2
6309
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
2803
6310
  item: true,
2804
- xs: 12,
2805
- sm: 6,
2806
- md: 3,
2807
- key: "plans"
2808
- }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
2809
- variant: "h4",
2810
- gutterBottom: true
2811
- }, title)), tiers.map(function (tier) {
2812
- return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
2813
- item: true,
2814
- xs: 12,
2815
- sm: 6,
2816
- md: 3,
2817
- key: tier.title
2818
- }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
2819
- sx: {
2820
- paddingBottom: 2,
2821
- padding: 2
2822
- }
2823
- }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
2824
- sx: {
2825
- textAlign: "center",
2826
- paddingTop: 2
2827
- }
2828
- }, tier.image != null && /*#__PURE__*/_react["default"].createElement("img", {
2829
- src: tier.image,
2830
- width: 200,
2831
- height: 200
2832
- }), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
2833
- variant: "h3",
2834
- component: "h2",
2835
- sx: {
2836
- paddingTop: 3
2837
- }
2838
- }, tier.title), tier.subTitle && /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
2839
- variant: "h6",
2840
- component: "h2",
2841
- sx: {
2842
- paddingTop: 2
2843
- }
2844
- }, tier.subTitle), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
2845
- container: true,
2846
- spacing: 0
2847
- }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
2848
- item: true,
2849
- xs: tier.qty != null ? 6 : 12,
2850
- sx: {
2851
- padding: 4
2852
- }
2853
- }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
2854
- component: "span",
2855
- sx: {
2856
- fontSize: 30,
2857
- fontWeight: "bold"
2858
- }
2859
- }, "$", tier.price), tier.duration != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
2860
- component: "span"
2861
- }, "/ ", tier.duration)), tier.qty != null && /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
2862
- item: true,
2863
- xs: 6,
2864
- sx: {
2865
- padding: 4
2866
- }
2867
- }, /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
2868
- name: "qty-" + tier.id,
2869
- control: control,
2870
- rules: {
2871
- required: false
2872
- },
2873
- render: function render(_ref2) {
2874
- var renderField = _ref2.renderField;
2875
- return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
2876
- fullWidth: true
2877
- }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
2878
- id: "demo-simple-select-label"
2879
- }, "Quantity"), /*#__PURE__*/_react["default"].createElement(_Select["default"], _extends({}, register("qty-" + tier.id, {
2880
- required: false
2881
- }), renderField, {
2882
- labelId: "demo-simple-select-label",
2883
- id: "demo-simple-select",
2884
- defaultValue: 1,
2885
- label: "Quantity"
2886
- }), calculateQty(tier.qty).map(function (menuItem, index) {
2887
- return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
2888
- key: index,
2889
- value: menuItem
2890
- }, menuItem);
2891
- })));
2892
- }
2893
- }))), tier.modifiers != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
2894
- sx: {
2895
- paddingBottom: 2
2896
- }
2897
- }, tier.modifiers.map(function (modifier, index) {
2898
- return /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
2899
- name: "modifier-" + tier.id + modifier.name,
2900
- control: control,
2901
- rules: {
2902
- required: false
2903
- },
2904
- render: function render(_ref3) {
2905
- var renderField = _ref3.renderField;
2906
- return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
2907
- fullWidth: true,
2908
- key: index,
2909
- sx: {
2910
- marginTop: 2
6311
+ xs: 6
6312
+ }, /*#__PURE__*/_react["default"].createElement("h4", {
6313
+ style: {
6314
+ marginBottom: "0px"
6315
+ }
6316
+ }, "HTML import Edits"), /*#__PURE__*/_react["default"].createElement("small", null, "You can add imports such as google analytics or clarity")), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
6317
+ item: true,
6318
+ xs: 6,
6319
+ sx: {
6320
+ textAlign: "right"
6321
+ }
6322
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
6323
+ startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null),
6324
+ sx: {
6325
+ marginTop: 4
6326
+ },
6327
+ variant: "contained",
6328
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
6329
+ var response;
6330
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
6331
+ while (1) switch (_context8.prev = _context8.next) {
6332
+ case 0:
6333
+ _context8.next = 2;
6334
+ return apiService().post("/PrivateLabel/SetGlobalHTML", {
6335
+ companyId: companyId,
6336
+ domain: oEMDomain,
6337
+ value: htmlEditorRef.current.getValue()
6338
+ });
6339
+ case 2:
6340
+ response = _context8.sent;
6341
+ if (response != null && response.status == 200) {
6342
+ notification("HTML saved!");
2911
6343
  }
2912
- }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
2913
- id: "demo-simple-select-label"
2914
- }, modifier.name), /*#__PURE__*/_react["default"].createElement(_Select["default"], _extends({}, register("modifier-" + tier.id + "-" + modifier.name, {
2915
- required: false
2916
- }), renderField, {
2917
- labelId: "demo-simple-select-label",
2918
- id: "demo-simple-select",
2919
- defaultValue: 0,
2920
- label: modifier.name
2921
- }), modifier.options.map(function (mod, index) {
2922
- return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
2923
- key: index,
2924
- value: index
2925
- }, mod);
2926
- })));
6344
+ case 4:
6345
+ case "end":
6346
+ return _context8.stop();
2927
6347
  }
2928
- });
2929
- })), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
2930
- fullWidth: true,
2931
- variant: tier.buttonVariant,
2932
- endIcon: /*#__PURE__*/_react["default"].createElement(_ChevronRightRounded["default"], null),
2933
- sx: {
2934
- height: 50
2935
- },
2936
- onClick: handleSubmit( /*#__PURE__*/function () {
2937
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
2938
- var modifiers, qty, index, modifier;
2939
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2940
- while (1) switch (_context.prev = _context.next) {
2941
- case 0:
2942
- modifiers = {};
2943
- qty = null;
2944
- if (tier.modifiers != null) {
2945
- for (index = 0; index < tier.modifiers.length; index++) {
2946
- modifier = tier.modifiers[index]; // assign the modifier as a property
2947
- modifiers[modifier.name] = data["modifier-" + tier.id + "-" + modifier.name];
2948
- }
2949
- }
2950
- if (tier.qty != null) {
2951
- qty = parseInt(data["qty-" + tier.id]);
2952
- }
2953
- if (onButtonClicked != null) {
2954
- onButtonClicked({
2955
- id: tier.id,
2956
- modifiers: modifiers,
2957
- qty: qty
2958
- });
2959
- }
2960
- case 5:
2961
- case "end":
2962
- return _context.stop();
2963
- }
2964
- }, _callee);
2965
- }));
2966
- return function (_x) {
2967
- return _ref4.apply(this, arguments);
2968
- };
2969
- }())
2970
- }, tier.buttonText), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
2971
- variant: "body2",
2972
- sx: {
2973
- paddingTop: 2,
2974
- fontSize: 16,
2975
- textAlign: "left",
2976
- lineHeight: "1.5rem"
2977
- }
2978
- }, /*#__PURE__*/_react["default"].createElement("div", {
2979
- dangerouslySetInnerHTML: {
2980
- __html: tier.description
2981
- }
2982
- })))));
2983
- })), features != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
6348
+ }, _callee8);
6349
+ }))
6350
+ }, "Save Changes"))), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
2984
6351
  sx: {
2985
6352
  paddingTop: 1
2986
6353
  }
2987
- }, features.map(function (feature) {
2988
- return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_system.Box, {
2989
- sx: {
2990
- backgroundColor: "lightgray",
2991
- padding: 1,
2992
- borderRadius: 2
2993
- }
2994
- }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
2995
- variant: "h5",
2996
- gutterBottom: true
2997
- }, feature.name)), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
2998
- container: true,
2999
- spacing: 0,
3000
- justifyContent: "center"
3001
- }, feature.subfeatures.map(function (subfeature, subFeatureIndex) {
3002
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, subfeature.map(function (item, index) {
3003
- return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
3004
- item: true,
3005
- xs: 3,
3006
- key: subfeature
3007
- }, /*#__PURE__*/_react["default"].createElement(_system.Box, {
3008
- sx: {
3009
- padding: 2,
3010
- height: 60,
3011
- paddingTop: subFeatureIndex == 0 ? 3 : 2,
3012
- textAlign: index == 0 ? "left" : "center"
3013
- }
3014
- }, item), feature.subfeatures.length - 1 != subFeatureIndex ? /*#__PURE__*/_react["default"].createElement("hr", null) : "");
3015
- }));
3016
- })));
3017
- }))));
6354
+ }, data != null && /*#__PURE__*/_react["default"].createElement(_react2["default"], {
6355
+ height: "70vh",
6356
+ onMount: handleHtmlEditorDidMount,
6357
+ defaultLanguage: "html",
6358
+ theme: "vs-dark",
6359
+ defaultValue: data == null || data.prettyHTML == null ? "" : data.prettyHTML
6360
+ }))))), /*#__PURE__*/_react["default"].createElement(AddDomain, {
6361
+ open: isNewAccount,
6362
+ azureWebsite: azureWebsite,
6363
+ azureTxtValue: azureTxtValue,
6364
+ handleClose: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
6365
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
6366
+ while (1) switch (_context9.prev = _context9.next) {
6367
+ case 0:
6368
+ setIsNewAccount(false);
6369
+ _context9.next = 3;
6370
+ return FetchOEMData();
6371
+ case 3:
6372
+ case "end":
6373
+ return _context9.stop();
6374
+ }
6375
+ }, _callee9);
6376
+ }))
6377
+ })));
3018
6378
  }
3019
6379
  "use strict";
3020
6380
 
@@ -5677,6 +9037,12 @@ function _PrivateLabelPageModule() {
5677
9037
  if (data.demoCompanyId != null) {
5678
9038
  data.demoId = data.demoCompanyId;
5679
9039
  }
9040
+ if (data.favIcon != null) {
9041
+ data.favIcon = data.favIcon;
9042
+ }
9043
+ if (data.companyName != null) {
9044
+ data.companyName = data.companyName;
9045
+ }
5680
9046
  }
5681
9047
  case 10:
5682
9048
  return _context.abrupt("return", data);
@@ -5693,19 +9059,6 @@ function HeaderRecords(_ref) {
5693
9059
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, pageProps != null && pageProps.oemCompanyId != null && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("link", {
5694
9060
  href: process.env.apiUri + "/api/PrivateLabel/GetDataFromRecord?oemCompanyId=" + pageProps.oemCompanyId,
5695
9061
  rel: "stylesheet"
5696
- }), /*#__PURE__*/_react["default"].createElement("link", {
5697
- rel: "manifest",
5698
- href: "/manifest.json"
5699
- }), /*#__PURE__*/_react["default"].createElement("link", {
5700
- href: "/icons/favicon-16x16.png",
5701
- rel: "icon",
5702
- type: "image/png",
5703
- sizes: "16x16"
5704
- }), /*#__PURE__*/_react["default"].createElement("link", {
5705
- href: "/icons/favicon-32x32.png",
5706
- rel: "icon",
5707
- type: "image/png",
5708
- sizes: "32x32"
5709
9062
  })));
5710
9063
  }
5711
9064
  "use strict";