@bigbinary/neeto-templates-frontend 1.1.36 → 1.2.0-beta1
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/dist/index.cjs.js +438 -345
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +432 -345
- package/dist/index.js.map +1 -1
- package/package.json +15 -14
package/dist/index.cjs.js
CHANGED
|
@@ -4,26 +4,32 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
7
|
-
var
|
|
7
|
+
var Modal = require('@bigbinary/neetoui/Modal');
|
|
8
8
|
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
9
9
|
var Search = require('@bigbinary/neeto-molecules/Search');
|
|
10
|
+
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
11
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
10
12
|
var reactI18next = require('react-i18next');
|
|
11
13
|
var neetoTagsFrontend = require('@bigbinary/neeto-tags-frontend');
|
|
14
|
+
var reactQuery = require('@tanstack/react-query');
|
|
12
15
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
13
16
|
var ramda = require('ramda');
|
|
14
|
-
var reactQuery = require('react-query');
|
|
15
17
|
var axios = require('axios');
|
|
18
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
19
|
var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
17
20
|
var i18next = require('i18next');
|
|
18
21
|
var classnames = require('classnames');
|
|
19
22
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
20
23
|
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
21
|
-
var
|
|
24
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
25
|
+
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
26
|
+
var Form = require('@bigbinary/neetoui/formik/Form');
|
|
22
27
|
var reactRouterDom = require('react-router-dom');
|
|
23
28
|
var neetoImageUploaderFrontend = require('@bigbinary/neeto-image-uploader-frontend');
|
|
24
29
|
var formik = require('formik');
|
|
25
30
|
var Header = require('@bigbinary/neeto-molecules/Header');
|
|
26
31
|
var Scrollable = require('@bigbinary/neeto-molecules/Scrollable');
|
|
32
|
+
var Label = require('@bigbinary/neetoui/Label');
|
|
27
33
|
|
|
28
34
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
29
35
|
|
|
@@ -46,14 +52,20 @@ function _interopNamespace(e) {
|
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
49
|
-
var
|
|
55
|
+
var Modal__default = /*#__PURE__*/_interopDefaultLegacy(Modal);
|
|
50
56
|
var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
51
57
|
var Search__default = /*#__PURE__*/_interopDefaultLegacy(Search);
|
|
58
|
+
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
59
|
+
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
52
60
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
53
61
|
var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
|
|
54
62
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
63
|
+
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
64
|
+
var ActionBlock__default = /*#__PURE__*/_interopDefaultLegacy(ActionBlock);
|
|
65
|
+
var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
|
|
55
66
|
var Header__default = /*#__PURE__*/_interopDefaultLegacy(Header);
|
|
56
67
|
var Scrollable__default = /*#__PURE__*/_interopDefaultLegacy(Scrollable);
|
|
68
|
+
var Label__default = /*#__PURE__*/_interopDefaultLegacy(Label);
|
|
57
69
|
|
|
58
70
|
function _arrayWithHoles(arr) {
|
|
59
71
|
if (Array.isArray(arr)) return arr;
|
|
@@ -461,20 +473,22 @@ var QUERY_KEYS = {
|
|
|
461
473
|
TEMPLATE_TAGS: "tag-key"
|
|
462
474
|
};
|
|
463
475
|
|
|
464
|
-
function ownKeys$
|
|
465
|
-
function _objectSpread$
|
|
476
|
+
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
477
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
466
478
|
var useFetchTemplates = function useFetchTemplates(_ref) {
|
|
467
479
|
var searchTerm = _ref.searchTerm,
|
|
468
480
|
category = _ref.category;
|
|
469
|
-
return reactQuery.useInfiniteQuery(
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
481
|
+
return reactQuery.useInfiniteQuery({
|
|
482
|
+
queryKey: [QUERY_KEYS.TEMPLATES_LIST, searchTerm, category],
|
|
483
|
+
queryFn: function queryFn(_ref2) {
|
|
484
|
+
var _ref2$pageParam = _ref2.pageParam,
|
|
485
|
+
pageParam = _ref2$pageParam === void 0 ? 1 : _ref2$pageParam;
|
|
486
|
+
return templatesApi.list({
|
|
487
|
+
page: pageParam,
|
|
488
|
+
searchTerm: searchTerm,
|
|
489
|
+
category: category
|
|
490
|
+
});
|
|
491
|
+
},
|
|
478
492
|
getNextPageParam: function getNextPageParam(lastPage) {
|
|
479
493
|
return lastPage.hasNextPage ? lastPage.page + 1 : undefined;
|
|
480
494
|
},
|
|
@@ -494,7 +508,9 @@ var useFetchTemplates = function useFetchTemplates(_ref) {
|
|
|
494
508
|
};
|
|
495
509
|
var useCreateTemplate = function useCreateTemplate(_ref3, options) {
|
|
496
510
|
var refetchResource = _ref3.refetchResource;
|
|
497
|
-
return reactQuery.useMutation(
|
|
511
|
+
return reactQuery.useMutation(_objectSpread$5(_objectSpread$5({
|
|
512
|
+
mutationFn: templatesApi.create
|
|
513
|
+
}, options), {}, {
|
|
498
514
|
onSuccess: function onSuccess() {
|
|
499
515
|
refetchResource();
|
|
500
516
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -506,11 +522,14 @@ var useCreateTemplate = function useCreateTemplate(_ref3, options) {
|
|
|
506
522
|
};
|
|
507
523
|
var useFetchTemplate = function useFetchTemplate(_ref4, options) {
|
|
508
524
|
var resourceId = _ref4.resourceId;
|
|
509
|
-
return reactQuery.useQuery(
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
525
|
+
return reactQuery.useQuery(_objectSpread$5({
|
|
526
|
+
queryKey: [QUERY_KEYS.TEMPLATE, resourceId],
|
|
527
|
+
queryFn: function queryFn() {
|
|
528
|
+
return templatesApi.fetch({
|
|
529
|
+
templateId: resourceId
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}, options));
|
|
514
533
|
};
|
|
515
534
|
var useUpdateTemplate = function useUpdateTemplate(_ref5) {
|
|
516
535
|
var resourceId = _ref5.resourceId;
|
|
@@ -538,43 +557,49 @@ var BlankCard = function BlankCard(_ref) {
|
|
|
538
557
|
onClick = _ref$onClick === void 0 ? neetoCist.noop : _ref$onClick,
|
|
539
558
|
_ref$disabled = _ref.disabled,
|
|
540
559
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
541
|
-
return /*#__PURE__*/
|
|
560
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
542
561
|
className: "neeto-ui-rounded-lg neeto-ui-bg-white hover:neeto-ui-bg-white neeto-ui-border-primary-500 flex cursor-pointer flex-col items-center justify-center border border-dashed p-6 outline-none transition-all duration-300 ease-in-out hover:border-solid focus:border-solid",
|
|
543
562
|
"data-cy": "start-from-scratch-button",
|
|
544
563
|
tabIndex: 0,
|
|
545
|
-
onClick: !disabled ? onClick : neetoCist.noop
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
564
|
+
onClick: !disabled ? onClick : neetoCist.noop,
|
|
565
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
566
|
+
className: "neeto-ui-text-primary-500 mb-4",
|
|
567
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
568
|
+
size: 40
|
|
569
|
+
})
|
|
570
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
571
|
+
className: "text-center",
|
|
572
|
+
lineHeight: "normal",
|
|
573
|
+
style: "h5",
|
|
574
|
+
weight: "semibold",
|
|
575
|
+
children: title
|
|
576
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
577
|
+
className: "neeto-ui-text-gray-600 text-center",
|
|
578
|
+
lineHeight: "leading-4",
|
|
579
|
+
style: "body3",
|
|
580
|
+
children: description
|
|
581
|
+
})]
|
|
582
|
+
});
|
|
560
583
|
};
|
|
561
584
|
|
|
562
585
|
var ButtonLoader = function ButtonLoader() {
|
|
563
|
-
return /*#__PURE__*/
|
|
564
|
-
role: "status"
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
586
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
587
|
+
role: "status",
|
|
588
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
589
|
+
"aria-hidden": "true",
|
|
590
|
+
className: "neeto-ui-text-gray-400 inline h-4 w-4 animate-spin",
|
|
591
|
+
fill: "none",
|
|
592
|
+
viewBox: "0 0 100 101",
|
|
593
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
594
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("path", {
|
|
595
|
+
d: "M100 50.59c0 27.615-22.386 50.001-50 50.001s-50-22.386-50-50 22.386-50 50-50 50 22.386 50 50zm-90.919 0c0 22.6 18.32 40.92 40.919 40.92 22.599 0 40.919-18.32 40.919-40.92 0-22.598-18.32-40.918-40.919-40.918-22.599 0-40.919 18.32-40.919 40.919z",
|
|
596
|
+
fill: "currentColor"
|
|
597
|
+
}), /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
598
|
+
d: "M93.968 39.04c2.425-.636 3.894-3.128 3.04-5.486A50 50 0 0041.735 1.279c-2.474.414-3.922 2.919-3.285 5.344.637 2.426 3.12 3.849 5.6 3.484a40.916 40.916 0 0144.131 25.769c.902 2.34 3.361 3.802 5.787 3.165z",
|
|
599
|
+
fill: "#3642df"
|
|
600
|
+
})]
|
|
601
|
+
})
|
|
602
|
+
});
|
|
578
603
|
};
|
|
579
604
|
|
|
580
605
|
var getMenuItems = function getMenuItems(_ref) {
|
|
@@ -586,7 +611,7 @@ var getMenuItems = function getMenuItems(_ref) {
|
|
|
586
611
|
"data-cy": "use-this-template-button",
|
|
587
612
|
isDisabled: isCreating,
|
|
588
613
|
label: i18next.t("neetoTemplate.templates.editTemplate"),
|
|
589
|
-
suffix: isCreating && /*#__PURE__*/
|
|
614
|
+
suffix: isCreating && /*#__PURE__*/jsxRuntime.jsx(ButtonLoader, {}),
|
|
590
615
|
onClick: function onClick(event) {
|
|
591
616
|
return handleCreateTemplate(event, template.id);
|
|
592
617
|
}
|
|
@@ -606,7 +631,7 @@ var Card = function Card(_ref) {
|
|
|
606
631
|
refetchResource: refetchResource
|
|
607
632
|
}),
|
|
608
633
|
createTemplate = _useCreateTemplate.mutate,
|
|
609
|
-
isCreating = _useCreateTemplate.
|
|
634
|
+
isCreating = _useCreateTemplate.isPending;
|
|
610
635
|
var handleCreateTemplate = function handleCreateTemplate(e, templateId) {
|
|
611
636
|
e.stopPropagation();
|
|
612
637
|
createTemplate({
|
|
@@ -617,40 +642,44 @@ var Card = function Card(_ref) {
|
|
|
617
642
|
}
|
|
618
643
|
});
|
|
619
644
|
};
|
|
620
|
-
return /*#__PURE__*/
|
|
621
|
-
|
|
645
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
646
|
+
onClick: onClick,
|
|
647
|
+
className: "neeto-template neeto-ui-bg-white neeto-ui-shadow-sm hover:neeto-ui-border-gray-400 focus:neeto-ui-border-gray-500 neeto-ui-rounded-lg flex cursor-pointer flex-col overflow-hidden border outline-none transition-colors duration-300 ease-in-out",
|
|
622
648
|
"data-cy": "template-card",
|
|
623
649
|
tabIndex: 0,
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
650
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
651
|
+
className: "neeto-template__header",
|
|
652
|
+
children: /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
653
|
+
className: "neeto-template__image",
|
|
654
|
+
"data-cy": "template-thumbnail-image",
|
|
655
|
+
src: template.imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
|
|
656
|
+
})
|
|
657
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
658
|
+
className: "neeto-template__description neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg p-2 py-1.5",
|
|
659
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
660
|
+
className: "neeto-ui-text-gray-800 line-clamp-2",
|
|
661
|
+
"data-cy": "template-card-title",
|
|
662
|
+
lineHeight: "normal",
|
|
663
|
+
style: "body2",
|
|
664
|
+
children: template.title
|
|
665
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown__default["default"], {
|
|
666
|
+
dropdownButtonProps: {
|
|
667
|
+
className: "flex-shrink-0",
|
|
668
|
+
size: "small"
|
|
669
|
+
},
|
|
670
|
+
dropdownProps: {
|
|
671
|
+
onClick: function onClick(event) {
|
|
672
|
+
return event.stopPropagation();
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
menuItems: getMenuItems({
|
|
676
|
+
handleCreateTemplate: handleCreateTemplate,
|
|
677
|
+
isCreating: isCreating,
|
|
678
|
+
template: template
|
|
679
|
+
})
|
|
680
|
+
})]
|
|
681
|
+
})]
|
|
682
|
+
});
|
|
654
683
|
};
|
|
655
684
|
|
|
656
685
|
var CategoryItem = function CategoryItem(_ref) {
|
|
@@ -658,19 +687,24 @@ var CategoryItem = function CategoryItem(_ref) {
|
|
|
658
687
|
count = _ref.count,
|
|
659
688
|
isActive = _ref.isActive,
|
|
660
689
|
setCurrentCategory = _ref.setCurrentCategory;
|
|
661
|
-
return /*#__PURE__*/
|
|
690
|
+
return /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
662
691
|
"data-cy": "category-".concat(utils.joinHyphenCase(label)),
|
|
663
692
|
tabIndex: 0,
|
|
664
693
|
className: classnames__default["default"]("neeto-ui-rounded-lg outline-none flex w-full items-center justify-between gap-2 border border-solid px-3 py-2 text-sm font-medium leading-4 transition-all duration-300 ease-in-out", {
|
|
665
694
|
"neeto-ui-text-gray-700 hover:neeto-ui-bg-gray-200 focus:neeto-ui-bg-gray-200 border-transparent": !isActive,
|
|
666
695
|
"neeto-ui-text-gray-800 neeto-ui-bg-white neeto-ui-border-gray-300 focus:neeto-ui-border-gray-500": isActive
|
|
667
696
|
}),
|
|
668
|
-
onClick: setCurrentCategory
|
|
669
|
-
|
|
697
|
+
onClick: setCurrentCategory,
|
|
698
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
699
|
+
children: label
|
|
700
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
701
|
+
children: count
|
|
702
|
+
})]
|
|
703
|
+
});
|
|
670
704
|
};
|
|
671
705
|
|
|
672
|
-
function ownKeys$
|
|
673
|
-
function _objectSpread$
|
|
706
|
+
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
707
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
674
708
|
var List = function List(_ref) {
|
|
675
709
|
var setCurrentScreen = _ref.setCurrentScreen,
|
|
676
710
|
setSelectedTemplate = _ref.setSelectedTemplate,
|
|
@@ -713,7 +747,7 @@ var List = function List(_ref) {
|
|
|
713
747
|
setSelectedTemplate(template);
|
|
714
748
|
};
|
|
715
749
|
if (isTemplatesLoading) {
|
|
716
|
-
return /*#__PURE__*/
|
|
750
|
+
return /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {});
|
|
717
751
|
}
|
|
718
752
|
var _data$tags = data.tags,
|
|
719
753
|
tags = _data$tags === void 0 ? [] : _data$tags,
|
|
@@ -721,83 +755,96 @@ var List = function List(_ref) {
|
|
|
721
755
|
templates = _data$templates === void 0 ? [] : _data$templates,
|
|
722
756
|
_data$templatesCount = data.templatesCount,
|
|
723
757
|
templatesCount = _data$templatesCount === void 0 ? 0 : _data$templatesCount;
|
|
724
|
-
var categories = [_objectSpread$
|
|
758
|
+
var categories = [_objectSpread$4(_objectSpread$4({}, DEFAULT_CATEGORY), {}, {
|
|
725
759
|
count: templatesCount
|
|
726
760
|
})].concat(_toConsumableArray(tags));
|
|
727
|
-
return /*#__PURE__*/
|
|
728
|
-
className: "neeto-ui-bg-gray-100 relative flex min-h-full items-start"
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
761
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
762
|
+
className: "neeto-ui-bg-gray-100 relative flex min-h-full items-start",
|
|
763
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
764
|
+
className: "sticky left-0 top-0 w-52 flex-shrink-0 space-y-8 py-6 pl-4 md:w-72 md:pl-10 lg:w-80 xl:pl-16",
|
|
765
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
766
|
+
className: "space-y-4",
|
|
767
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
768
|
+
className: "space-y-1",
|
|
769
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
770
|
+
"data-cy": "create-new-form-title",
|
|
771
|
+
style: "h2",
|
|
772
|
+
weight: "semibold",
|
|
773
|
+
children: t("neetoTemplate.templates.createNewEntity")
|
|
774
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
775
|
+
lineHeight: "normal",
|
|
776
|
+
style: "body2",
|
|
777
|
+
children: t("neetoTemplate.templates.description")
|
|
778
|
+
})]
|
|
779
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Search__default["default"], {
|
|
780
|
+
autoFocus: true,
|
|
781
|
+
disableTrimOnBlur: true,
|
|
782
|
+
"data-cy": "template-search-input",
|
|
783
|
+
placeholder: t("neetoTemplate.templates.search"),
|
|
784
|
+
onSearch: function onSearch(value) {
|
|
785
|
+
return setSearchTerm(value);
|
|
786
|
+
}
|
|
787
|
+
})]
|
|
788
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
789
|
+
className: "space-y-3",
|
|
790
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
791
|
+
className: "uppercase",
|
|
792
|
+
"data-cy": "template-categories-label",
|
|
793
|
+
style: "h6",
|
|
794
|
+
children: t("neetoTemplate.templates.categories")
|
|
795
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
796
|
+
className: "space-y-2",
|
|
797
|
+
children: categories.map(function (_ref2) {
|
|
798
|
+
var id = _ref2.id,
|
|
799
|
+
name = _ref2.name,
|
|
800
|
+
count = _ref2.count;
|
|
801
|
+
return /*#__PURE__*/React.createElement(CategoryItem, {
|
|
802
|
+
count: count,
|
|
803
|
+
isActive: currentCategory.id === id,
|
|
804
|
+
key: id,
|
|
805
|
+
label: name,
|
|
806
|
+
setCurrentCategory: function setCurrentCategory() {
|
|
807
|
+
return _setCurrentCategory({
|
|
808
|
+
id: id,
|
|
809
|
+
name: name
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
})
|
|
814
|
+
})]
|
|
815
|
+
})]
|
|
816
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
817
|
+
className: "h-screen w-full overflow-y-auto py-8 pl-5 pr-4 md:pl-8 md:pr-20 xl:px-20",
|
|
818
|
+
ref: rootRef,
|
|
819
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
820
|
+
className: "flex-grow space-y-6",
|
|
821
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
822
|
+
className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 lg:gap-5 xl:gap-6 2xl:grid-cols-4",
|
|
823
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(BlankCard, {
|
|
824
|
+
description: t("neetoTemplate.templates.blankCard.description"),
|
|
825
|
+
disabled: isCreating,
|
|
826
|
+
icon: isCreating ? Spinner__default["default"] : SvgCustom,
|
|
827
|
+
title: t("neetoTemplate.templates.blankCard.title"),
|
|
828
|
+
onClick: onCreate
|
|
829
|
+
}), templates.map(function (template, index) {
|
|
830
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
831
|
+
afterCreate: afterCreate,
|
|
832
|
+
refetchResource: refetchResource,
|
|
833
|
+
template: template,
|
|
834
|
+
key: index,
|
|
835
|
+
onClick: function onClick() {
|
|
836
|
+
return handleCardClick(template);
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
})]
|
|
840
|
+
}), hasNextPage && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
841
|
+
className: "my-10 text-center",
|
|
842
|
+
ref: sentryRef,
|
|
843
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner__default["default"], {})
|
|
844
|
+
})]
|
|
845
|
+
})
|
|
846
|
+
})]
|
|
847
|
+
});
|
|
801
848
|
};
|
|
802
849
|
|
|
803
850
|
var Preview$1 = function Preview(_ref) {
|
|
@@ -811,7 +858,7 @@ var Preview$1 = function Preview(_ref) {
|
|
|
811
858
|
refetchResource: refetchResource
|
|
812
859
|
}),
|
|
813
860
|
createTemplate = _useCreateTemplate.mutate,
|
|
814
|
-
isCreating = _useCreateTemplate.
|
|
861
|
+
isCreating = _useCreateTemplate.isPending;
|
|
815
862
|
var handleCreateTemplate = function handleCreateTemplate() {
|
|
816
863
|
createTemplate({
|
|
817
864
|
id: selectedTemplate.id
|
|
@@ -823,39 +870,44 @@ var Preview$1 = function Preview(_ref) {
|
|
|
823
870
|
};
|
|
824
871
|
var title = selectedTemplate.title,
|
|
825
872
|
previewUrl = selectedTemplate.previewUrl;
|
|
826
|
-
return /*#__PURE__*/
|
|
827
|
-
className: "m-auto flex h-full w-full max-w-6xl flex-col space-y-6 py-6"
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
873
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
874
|
+
className: "m-auto flex h-full w-full max-w-6xl flex-col space-y-6 py-6",
|
|
875
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
876
|
+
className: "flex flex-col items-center justify-between gap-6 pl-4 pr-16 md:flex-row md:pr-20 xl:px-0",
|
|
877
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
878
|
+
className: "flex min-w-0 flex-grow items-center gap-2",
|
|
879
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
880
|
+
className: "flex-shrink-0",
|
|
881
|
+
"data-cy": "preview-template-back-button",
|
|
882
|
+
icon: neetoIcons.LeftArrow,
|
|
883
|
+
style: "text",
|
|
884
|
+
onClick: function onClick() {
|
|
885
|
+
return setCurrentScreen(TEMPLATE_SCREENS.LIST);
|
|
886
|
+
}
|
|
887
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
888
|
+
className: "leading-none",
|
|
889
|
+
"data-cy": "preview-template-title",
|
|
890
|
+
style: "h2",
|
|
891
|
+
weight: "semibold",
|
|
892
|
+
children: title
|
|
893
|
+
})]
|
|
894
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
895
|
+
className: "flex-shrink-0",
|
|
896
|
+
"data-cy": "preview-use-template-button",
|
|
897
|
+
disabled: isCreating,
|
|
898
|
+
label: t("neetoTemplate.templates.editTemplate"),
|
|
899
|
+
loading: isCreating,
|
|
900
|
+
onClick: handleCreateTemplate
|
|
901
|
+
})]
|
|
902
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
903
|
+
className: "neeto-templates-share-preview neeto-ui-rounded-sm sticky top-10",
|
|
904
|
+
children: /*#__PURE__*/jsxRuntime.jsx("iframe", {
|
|
905
|
+
className: "w-full flex-1 shadow-inner",
|
|
906
|
+
"data-cy": "iframe-id",
|
|
907
|
+
src: previewUrl
|
|
908
|
+
})
|
|
909
|
+
})]
|
|
910
|
+
});
|
|
859
911
|
};
|
|
860
912
|
|
|
861
913
|
var CreateTemplateModal = function CreateTemplateModal(_ref) {
|
|
@@ -882,24 +934,25 @@ var CreateTemplateModal = function CreateTemplateModal(_ref) {
|
|
|
882
934
|
}, 300); //To accommodate the animation duration.
|
|
883
935
|
};
|
|
884
936
|
|
|
885
|
-
return /*#__PURE__*/
|
|
937
|
+
return /*#__PURE__*/jsxRuntime.jsx(Modal__default["default"], {
|
|
886
938
|
className: "neeto-template-list h-screen w-screen overflow-y-auto",
|
|
887
939
|
isOpen: isOpen,
|
|
888
940
|
size: "fullScreen",
|
|
889
|
-
onClose: onModalClose
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
941
|
+
onClose: onModalClose,
|
|
942
|
+
children: currentScreen === TEMPLATE_SCREENS.LIST ? /*#__PURE__*/jsxRuntime.jsx(List, {
|
|
943
|
+
setCurrentScreen: setCurrentScreen,
|
|
944
|
+
setSelectedTemplate: setSelectedTemplate,
|
|
945
|
+
isCreating: isCreating,
|
|
946
|
+
afterCreate: afterCreate,
|
|
947
|
+
onCreate: onCreate,
|
|
948
|
+
refetchResource: refetchResource
|
|
949
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Preview$1, {
|
|
950
|
+
selectedTemplate: selectedTemplate,
|
|
951
|
+
setCurrentScreen: setCurrentScreen,
|
|
952
|
+
afterCreate: afterCreate,
|
|
953
|
+
refetchResource: refetchResource
|
|
954
|
+
})
|
|
955
|
+
});
|
|
903
956
|
};
|
|
904
957
|
|
|
905
958
|
var create = function create(payload) {
|
|
@@ -917,10 +970,12 @@ var templateTagsApi = {
|
|
|
917
970
|
list: list
|
|
918
971
|
};
|
|
919
972
|
|
|
920
|
-
function ownKeys$
|
|
921
|
-
function _objectSpread$
|
|
973
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
974
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
922
975
|
var useCreateTemplateTag = function useCreateTemplateTag(options) {
|
|
923
|
-
return reactQuery.useMutation(
|
|
976
|
+
return reactQuery.useMutation(_objectSpread$3(_objectSpread$3({
|
|
977
|
+
mutationFn: templateTagsApi.create
|
|
978
|
+
}, options), {}, {
|
|
924
979
|
onSuccess: function onSuccess() {
|
|
925
980
|
var _options$onSuccess;
|
|
926
981
|
neetoTagsFrontend.refetchTags();
|
|
@@ -929,7 +984,10 @@ var useCreateTemplateTag = function useCreateTemplateTag(options) {
|
|
|
929
984
|
}));
|
|
930
985
|
};
|
|
931
986
|
var useFetchTemplateTags = function useFetchTemplateTags() {
|
|
932
|
-
return reactQuery.useQuery(
|
|
987
|
+
return reactQuery.useQuery({
|
|
988
|
+
queryKey: [QUERY_KEYS.TEMPLATE_TAGS],
|
|
989
|
+
queryFn: templateTagsApi.list
|
|
990
|
+
});
|
|
933
991
|
};
|
|
934
992
|
|
|
935
993
|
var FormikImageUploader = function FormikImageUploader(_ref) {
|
|
@@ -945,7 +1003,7 @@ var FormikImageUploader = function FormikImageUploader(_ref) {
|
|
|
945
1003
|
setFieldValue("imageSignedId", file.signedId);
|
|
946
1004
|
return setValue(file.url);
|
|
947
1005
|
};
|
|
948
|
-
return /*#__PURE__*/
|
|
1006
|
+
return /*#__PURE__*/jsxRuntime.jsx(neetoImageUploaderFrontend.ImageUploader, {
|
|
949
1007
|
className: "h-52 w-full md:h-80",
|
|
950
1008
|
src: field.value,
|
|
951
1009
|
uploadConfig: IMAGE_UPLOAD_CONFIG,
|
|
@@ -956,20 +1014,22 @@ var FormikImageUploader = function FormikImageUploader(_ref) {
|
|
|
956
1014
|
var PageWrapper = function PageWrapper(_ref) {
|
|
957
1015
|
var children = _ref.children,
|
|
958
1016
|
className = _ref.className;
|
|
959
|
-
return /*#__PURE__*/
|
|
960
|
-
className: classnames__default["default"]("w-full flex-col", className)
|
|
961
|
-
|
|
1017
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1018
|
+
className: classnames__default["default"]("w-full flex-col", className),
|
|
1019
|
+
children: children
|
|
1020
|
+
});
|
|
962
1021
|
};
|
|
963
1022
|
var PageHeader = function PageHeader(_ref2) {
|
|
964
1023
|
var title = _ref2.title,
|
|
965
1024
|
breadcrumbs = _ref2.breadcrumbs;
|
|
966
|
-
return /*#__PURE__*/
|
|
967
|
-
className: "w-full px-6"
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1025
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1026
|
+
className: "w-full px-6",
|
|
1027
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Header__default["default"], {
|
|
1028
|
+
breadcrumbs: breadcrumbs,
|
|
1029
|
+
size: "small",
|
|
1030
|
+
title: title
|
|
1031
|
+
})
|
|
1032
|
+
});
|
|
973
1033
|
};
|
|
974
1034
|
var customPropEqualityCheck = function customPropEqualityCheck(prevProps, nextProps) {
|
|
975
1035
|
return prevProps.title === nextProps.title && prevProps.breadcrumbs === nextProps.breadcrumbs;
|
|
@@ -979,13 +1039,17 @@ var PageContent = function PageContent(_ref3) {
|
|
|
979
1039
|
var children = _ref3.children,
|
|
980
1040
|
_ref3$className = _ref3.className,
|
|
981
1041
|
className = _ref3$className === void 0 ? "" : _ref3$className;
|
|
982
|
-
return /*#__PURE__*/
|
|
983
|
-
className: "w-full px-6 pb-6"
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1042
|
+
return /*#__PURE__*/jsxRuntime.jsx(Scrollable__default["default"], {
|
|
1043
|
+
className: "w-full px-6 pb-6",
|
|
1044
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1045
|
+
className: classnames__default["default"](["mx-auto max-w-7xl", className]),
|
|
1046
|
+
children: children
|
|
1047
|
+
})
|
|
1048
|
+
});
|
|
987
1049
|
};
|
|
988
1050
|
|
|
1051
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1052
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
989
1053
|
var Tags = function Tags(_ref) {
|
|
990
1054
|
var allTags = _ref.allTags,
|
|
991
1055
|
selectedTags = _ref.selectedTags,
|
|
@@ -1017,44 +1081,52 @@ var Tags = function Tags(_ref) {
|
|
|
1017
1081
|
}
|
|
1018
1082
|
});
|
|
1019
1083
|
};
|
|
1020
|
-
return /*#__PURE__*/
|
|
1021
|
-
className: className
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1084
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1085
|
+
className: className,
|
|
1086
|
+
children: [labelProps.label && /*#__PURE__*/jsxRuntime.jsx(Label__default["default"], _objectSpread$2(_objectSpread$2({}, labelProps), {}, {
|
|
1087
|
+
children: labelProps.label
|
|
1088
|
+
})), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1089
|
+
className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white border p-4",
|
|
1090
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoTagsFrontend.TagsComponent, {
|
|
1091
|
+
allTags: allTags,
|
|
1092
|
+
selectedTags: selectedTags,
|
|
1093
|
+
buttonProps: {
|
|
1094
|
+
loading: isLoading,
|
|
1095
|
+
disabled: isLoading,
|
|
1096
|
+
iconPosition: "left"
|
|
1097
|
+
},
|
|
1098
|
+
onTagCreate: handleTagCreate,
|
|
1099
|
+
onTagDelete: handleTagRemove,
|
|
1100
|
+
onTagSelect: handleTagSelect
|
|
1101
|
+
})
|
|
1102
|
+
})]
|
|
1103
|
+
});
|
|
1036
1104
|
};
|
|
1037
1105
|
|
|
1038
1106
|
var Preview = function Preview(_ref) {
|
|
1039
1107
|
var template = _ref.template,
|
|
1040
1108
|
imageUrl = _ref.imageUrl;
|
|
1041
|
-
return /*#__PURE__*/
|
|
1109
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1042
1110
|
className: "neeto-template neeto-ui-bg-white outline-none neeto-ui-shadow-sm hover:neeto-ui-border-gray-400 focus:neeto-ui-border-gray-500 neeto-ui-rounded-lg flex cursor-pointer flex-col overflow-hidden border transition-colors duration-300 ease-in-out",
|
|
1043
|
-
tabIndex: 0
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1111
|
+
tabIndex: 0,
|
|
1112
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1113
|
+
className: "neeto-template__header",
|
|
1114
|
+
children: /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
1115
|
+
className: "neeto-template__image",
|
|
1116
|
+
"data-cy": "template-image-preview",
|
|
1117
|
+
src: imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
|
|
1118
|
+
})
|
|
1119
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1120
|
+
className: "neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg px-2 py-1.5",
|
|
1121
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1122
|
+
className: "neeto-ui-text-gray-800",
|
|
1123
|
+
"data-cy": "template-title-text",
|
|
1124
|
+
lineHeight: "normal",
|
|
1125
|
+
style: "body2",
|
|
1126
|
+
children: template.title
|
|
1127
|
+
})
|
|
1128
|
+
})]
|
|
1129
|
+
});
|
|
1058
1130
|
};
|
|
1059
1131
|
|
|
1060
1132
|
var buildSelectOptionsBy = function buildSelectOptionsBy(labelField) {
|
|
@@ -1103,10 +1175,10 @@ var TemplateSettings = function TemplateSettings(_ref) {
|
|
|
1103
1175
|
resourceId: resourceId
|
|
1104
1176
|
}),
|
|
1105
1177
|
updateTemplate = _useUpdateTemplate.mutate,
|
|
1106
|
-
isUpdatingTemplate = _useUpdateTemplate.
|
|
1178
|
+
isUpdatingTemplate = _useUpdateTemplate.isPending;
|
|
1107
1179
|
var _useCreateTemplateTag = useCreateTemplateTag(),
|
|
1108
1180
|
createTemplateTag = _useCreateTemplateTag.mutate,
|
|
1109
|
-
isCreatingTags = _useCreateTemplateTag.
|
|
1181
|
+
isCreatingTags = _useCreateTemplateTag.isPending;
|
|
1110
1182
|
var _useFetchTemplateTags = useFetchTemplateTags(),
|
|
1111
1183
|
_useFetchTemplateTags2 = _useFetchTemplateTags.data,
|
|
1112
1184
|
templateTags = _useFetchTemplateTags2 === void 0 ? {} : _useFetchTemplateTags2,
|
|
@@ -1123,74 +1195,88 @@ var TemplateSettings = function TemplateSettings(_ref) {
|
|
|
1123
1195
|
}, data), {}, {
|
|
1124
1196
|
tags: tags
|
|
1125
1197
|
});
|
|
1126
|
-
return /*#__PURE__*/
|
|
1127
|
-
className: className
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1198
|
+
return /*#__PURE__*/jsxRuntime.jsxs(PageWrapper, {
|
|
1199
|
+
className: className,
|
|
1200
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(MemoizedPageHeader, {
|
|
1201
|
+
breadcrumbs: breadcrumbs,
|
|
1202
|
+
title: t("neetoTemplate.templateSettings.title")
|
|
1203
|
+
}), /*#__PURE__*/jsxRuntime.jsx(PageContent, {
|
|
1204
|
+
className: classnames__default["default"]({
|
|
1205
|
+
"min-h-0": !isLoading,
|
|
1206
|
+
"h-full": isLoading
|
|
1207
|
+
}),
|
|
1208
|
+
children: isLoading ? /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1209
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1210
|
+
className: "mb-1",
|
|
1211
|
+
"data-cy": "thank-you-action-text",
|
|
1212
|
+
style: "h2",
|
|
1213
|
+
weight: "semibold",
|
|
1214
|
+
children: t("neetoTemplate.templateSettings.configureTemplates")
|
|
1215
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1216
|
+
className: "mb-2",
|
|
1217
|
+
"data-cy": "thank-you-description-label",
|
|
1218
|
+
style: "body2",
|
|
1219
|
+
children: t("neetoTemplate.templateSettings.subText")
|
|
1220
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Form__default["default"], {
|
|
1221
|
+
formikProps: {
|
|
1222
|
+
enableReinitialize: true,
|
|
1223
|
+
initialValues: resourceInitialValues,
|
|
1224
|
+
onSubmit: handleSubmit
|
|
1225
|
+
},
|
|
1226
|
+
children: function children(_ref2) {
|
|
1227
|
+
var values = _ref2.values,
|
|
1228
|
+
setFieldValue = _ref2.setFieldValue;
|
|
1229
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1230
|
+
className: "grid grid-cols-2 gap-8 pt-6",
|
|
1231
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1232
|
+
className: "space-y-4",
|
|
1233
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1234
|
+
className: "mb-3",
|
|
1235
|
+
style: "h4",
|
|
1236
|
+
weight: "semibold",
|
|
1237
|
+
children: t("neetoTemplate.templateSettings.imageLabel")
|
|
1238
|
+
}), /*#__PURE__*/jsxRuntime.jsx(FormikImageUploader, {
|
|
1239
|
+
name: "imageUrl"
|
|
1240
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Tags, {
|
|
1241
|
+
allTags: buildSelectOptionsBy("name", templateTags.tags),
|
|
1242
|
+
className: "space-y-2",
|
|
1243
|
+
isLoading: isCreatingTags,
|
|
1244
|
+
selectedTags: values.tags,
|
|
1245
|
+
labelProps: {
|
|
1246
|
+
label: t("neetoTemplate.templateSettings.categoryLabel")
|
|
1247
|
+
},
|
|
1248
|
+
onCreate: createTemplateTag,
|
|
1249
|
+
onUpdate: function onUpdate(tags) {
|
|
1250
|
+
return setFieldValue("tags", tags);
|
|
1251
|
+
}
|
|
1252
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1253
|
+
className: "mt-12 flex flex-row items-center justify-start",
|
|
1254
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock__default["default"], {
|
|
1255
|
+
isSubmitting: isUpdatingTemplate,
|
|
1256
|
+
cancelButtonProps: {
|
|
1257
|
+
to: onCancelTemplatePreview,
|
|
1258
|
+
"data-cy": "reset-changes-button",
|
|
1259
|
+
onClick: neetoCist.noop
|
|
1260
|
+
}
|
|
1261
|
+
})
|
|
1262
|
+
})]
|
|
1263
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1264
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1265
|
+
className: "mb-3",
|
|
1266
|
+
style: "h4",
|
|
1267
|
+
weight: "semibold",
|
|
1268
|
+
children: t("neetoTemplate.templateSettings.previewLabel")
|
|
1269
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Preview, {
|
|
1270
|
+
imageUrl: values.imageUrl,
|
|
1271
|
+
template: data
|
|
1272
|
+
})]
|
|
1273
|
+
})]
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
})]
|
|
1277
|
+
})
|
|
1278
|
+
})]
|
|
1279
|
+
});
|
|
1194
1280
|
};
|
|
1195
1281
|
|
|
1196
1282
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
@@ -1234,9 +1320,10 @@ var TAG_TYPES = [{
|
|
|
1234
1320
|
width: 300,
|
|
1235
1321
|
sorter: true,
|
|
1236
1322
|
render: function render(templatesCount) {
|
|
1237
|
-
return templatesCount !== 0 ? /*#__PURE__*/
|
|
1238
|
-
style: "body1"
|
|
1239
|
-
|
|
1323
|
+
return templatesCount !== 0 ? /*#__PURE__*/jsxRuntime.jsxs(Typography__default["default"], {
|
|
1324
|
+
style: "body1",
|
|
1325
|
+
children: [" ", templatesCount, " "]
|
|
1326
|
+
}) : "-";
|
|
1240
1327
|
}
|
|
1241
1328
|
}]
|
|
1242
1329
|
}];
|
|
@@ -1250,12 +1337,18 @@ var TemplateTags = function TemplateTags(_ref) {
|
|
|
1250
1337
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
1251
1338
|
var queryClient = reactQuery.useQueryClient();
|
|
1252
1339
|
var invalidateTags = function invalidateTags() {
|
|
1253
|
-
queryClient.invalidateQueries(
|
|
1340
|
+
queryClient.invalidateQueries({
|
|
1341
|
+
queryKey: [QUERY_KEYS.TEMPLATE_TAGS]
|
|
1342
|
+
});
|
|
1254
1343
|
};
|
|
1255
1344
|
var invalidateTagsAndTemplates = function invalidateTagsAndTemplates() {
|
|
1256
1345
|
invalidateTags();
|
|
1257
|
-
queryClient.invalidateQueries(
|
|
1258
|
-
|
|
1346
|
+
queryClient.invalidateQueries({
|
|
1347
|
+
queryKey: [QUERY_KEYS.TEMPLATES_LIST]
|
|
1348
|
+
});
|
|
1349
|
+
queryClient.invalidateQueries({
|
|
1350
|
+
queryKey: [QUERY_KEYS.TEMPLATE]
|
|
1351
|
+
});
|
|
1259
1352
|
};
|
|
1260
1353
|
var config = _objectSpread({
|
|
1261
1354
|
tagTypes: TAG_TYPES,
|
|
@@ -1285,7 +1378,7 @@ var TemplateTags = function TemplateTags(_ref) {
|
|
|
1285
1378
|
}
|
|
1286
1379
|
}
|
|
1287
1380
|
}, otherProps);
|
|
1288
|
-
return /*#__PURE__*/
|
|
1381
|
+
return /*#__PURE__*/jsxRuntime.jsx(neetoTagsFrontend.NeetoTags, {
|
|
1289
1382
|
config: config
|
|
1290
1383
|
});
|
|
1291
1384
|
};
|