@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.js
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { useState, useRef, useCallback, useEffect, createElement, memo } from 'react';
|
|
3
3
|
import { noop, removeBy, renameKeys } from '@bigbinary/neeto-cist';
|
|
4
|
-
import
|
|
4
|
+
import Modal from '@bigbinary/neetoui/Modal';
|
|
5
5
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
6
6
|
import Search from '@bigbinary/neeto-molecules/Search';
|
|
7
|
+
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
8
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
7
9
|
import { useTranslation } from 'react-i18next';
|
|
8
10
|
import { refetchTags, TagsComponent, NeetoTags } from '@bigbinary/neeto-tags-frontend';
|
|
11
|
+
import { useQuery, useInfiniteQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
9
12
|
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
10
13
|
import { prop, pluck } from 'ramda';
|
|
11
|
-
import { useQuery, useInfiniteQuery, useMutation, useQueryClient } from 'react-query';
|
|
12
14
|
import axios from 'axios';
|
|
15
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
13
16
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
14
17
|
import { t as t$1 } from 'i18next';
|
|
15
18
|
import classnames from 'classnames';
|
|
16
19
|
import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
|
|
17
20
|
import { LeftArrow } from '@bigbinary/neeto-icons';
|
|
18
|
-
import
|
|
21
|
+
import Button from '@bigbinary/neetoui/Button';
|
|
22
|
+
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
23
|
+
import Form from '@bigbinary/neetoui/formik/Form';
|
|
19
24
|
import { useParams } from 'react-router-dom';
|
|
20
25
|
import { ImageUploader } from '@bigbinary/neeto-image-uploader-frontend';
|
|
21
26
|
import { useField, useFormikContext } from 'formik';
|
|
22
27
|
import Header from '@bigbinary/neeto-molecules/Header';
|
|
23
28
|
import Scrollable from '@bigbinary/neeto-molecules/Scrollable';
|
|
29
|
+
import Label from '@bigbinary/neetoui/Label';
|
|
24
30
|
|
|
25
31
|
function _arrayWithHoles(arr) {
|
|
26
32
|
if (Array.isArray(arr)) return arr;
|
|
@@ -428,20 +434,22 @@ var QUERY_KEYS = {
|
|
|
428
434
|
TEMPLATE_TAGS: "tag-key"
|
|
429
435
|
};
|
|
430
436
|
|
|
431
|
-
function ownKeys$
|
|
432
|
-
function _objectSpread$
|
|
437
|
+
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; }
|
|
438
|
+
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; }
|
|
433
439
|
var useFetchTemplates = function useFetchTemplates(_ref) {
|
|
434
440
|
var searchTerm = _ref.searchTerm,
|
|
435
441
|
category = _ref.category;
|
|
436
|
-
return useInfiniteQuery(
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
442
|
+
return useInfiniteQuery({
|
|
443
|
+
queryKey: [QUERY_KEYS.TEMPLATES_LIST, searchTerm, category],
|
|
444
|
+
queryFn: function queryFn(_ref2) {
|
|
445
|
+
var _ref2$pageParam = _ref2.pageParam,
|
|
446
|
+
pageParam = _ref2$pageParam === void 0 ? 1 : _ref2$pageParam;
|
|
447
|
+
return templatesApi.list({
|
|
448
|
+
page: pageParam,
|
|
449
|
+
searchTerm: searchTerm,
|
|
450
|
+
category: category
|
|
451
|
+
});
|
|
452
|
+
},
|
|
445
453
|
getNextPageParam: function getNextPageParam(lastPage) {
|
|
446
454
|
return lastPage.hasNextPage ? lastPage.page + 1 : undefined;
|
|
447
455
|
},
|
|
@@ -461,7 +469,9 @@ var useFetchTemplates = function useFetchTemplates(_ref) {
|
|
|
461
469
|
};
|
|
462
470
|
var useCreateTemplate = function useCreateTemplate(_ref3, options) {
|
|
463
471
|
var refetchResource = _ref3.refetchResource;
|
|
464
|
-
return useMutation(
|
|
472
|
+
return useMutation(_objectSpread$5(_objectSpread$5({
|
|
473
|
+
mutationFn: templatesApi.create
|
|
474
|
+
}, options), {}, {
|
|
465
475
|
onSuccess: function onSuccess() {
|
|
466
476
|
refetchResource();
|
|
467
477
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -473,11 +483,14 @@ var useCreateTemplate = function useCreateTemplate(_ref3, options) {
|
|
|
473
483
|
};
|
|
474
484
|
var useFetchTemplate = function useFetchTemplate(_ref4, options) {
|
|
475
485
|
var resourceId = _ref4.resourceId;
|
|
476
|
-
return useQuery(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
486
|
+
return useQuery(_objectSpread$5({
|
|
487
|
+
queryKey: [QUERY_KEYS.TEMPLATE, resourceId],
|
|
488
|
+
queryFn: function queryFn() {
|
|
489
|
+
return templatesApi.fetch({
|
|
490
|
+
templateId: resourceId
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
}, options));
|
|
481
494
|
};
|
|
482
495
|
var useUpdateTemplate = function useUpdateTemplate(_ref5) {
|
|
483
496
|
var resourceId = _ref5.resourceId;
|
|
@@ -505,43 +518,49 @@ var BlankCard = function BlankCard(_ref) {
|
|
|
505
518
|
onClick = _ref$onClick === void 0 ? noop : _ref$onClick,
|
|
506
519
|
_ref$disabled = _ref.disabled,
|
|
507
520
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
508
|
-
return /*#__PURE__*/
|
|
521
|
+
return /*#__PURE__*/jsxs("div", {
|
|
509
522
|
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",
|
|
510
523
|
"data-cy": "start-from-scratch-button",
|
|
511
524
|
tabIndex: 0,
|
|
512
|
-
onClick: !disabled ? onClick : noop
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
525
|
+
onClick: !disabled ? onClick : noop,
|
|
526
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
527
|
+
className: "neeto-ui-text-primary-500 mb-4",
|
|
528
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
529
|
+
size: 40
|
|
530
|
+
})
|
|
531
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
532
|
+
className: "text-center",
|
|
533
|
+
lineHeight: "normal",
|
|
534
|
+
style: "h5",
|
|
535
|
+
weight: "semibold",
|
|
536
|
+
children: title
|
|
537
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
538
|
+
className: "neeto-ui-text-gray-600 text-center",
|
|
539
|
+
lineHeight: "leading-4",
|
|
540
|
+
style: "body3",
|
|
541
|
+
children: description
|
|
542
|
+
})]
|
|
543
|
+
});
|
|
527
544
|
};
|
|
528
545
|
|
|
529
546
|
var ButtonLoader = function ButtonLoader() {
|
|
530
|
-
return /*#__PURE__*/
|
|
531
|
-
role: "status"
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
547
|
+
return /*#__PURE__*/jsx("div", {
|
|
548
|
+
role: "status",
|
|
549
|
+
children: /*#__PURE__*/jsxs("svg", {
|
|
550
|
+
"aria-hidden": "true",
|
|
551
|
+
className: "neeto-ui-text-gray-400 inline h-4 w-4 animate-spin",
|
|
552
|
+
fill: "none",
|
|
553
|
+
viewBox: "0 0 100 101",
|
|
554
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
555
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
556
|
+
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",
|
|
557
|
+
fill: "currentColor"
|
|
558
|
+
}), /*#__PURE__*/jsx("path", {
|
|
559
|
+
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",
|
|
560
|
+
fill: "#3642df"
|
|
561
|
+
})]
|
|
562
|
+
})
|
|
563
|
+
});
|
|
545
564
|
};
|
|
546
565
|
|
|
547
566
|
var getMenuItems = function getMenuItems(_ref) {
|
|
@@ -553,7 +572,7 @@ var getMenuItems = function getMenuItems(_ref) {
|
|
|
553
572
|
"data-cy": "use-this-template-button",
|
|
554
573
|
isDisabled: isCreating,
|
|
555
574
|
label: t$1("neetoTemplate.templates.editTemplate"),
|
|
556
|
-
suffix: isCreating && /*#__PURE__*/
|
|
575
|
+
suffix: isCreating && /*#__PURE__*/jsx(ButtonLoader, {}),
|
|
557
576
|
onClick: function onClick(event) {
|
|
558
577
|
return handleCreateTemplate(event, template.id);
|
|
559
578
|
}
|
|
@@ -573,7 +592,7 @@ var Card = function Card(_ref) {
|
|
|
573
592
|
refetchResource: refetchResource
|
|
574
593
|
}),
|
|
575
594
|
createTemplate = _useCreateTemplate.mutate,
|
|
576
|
-
isCreating = _useCreateTemplate.
|
|
595
|
+
isCreating = _useCreateTemplate.isPending;
|
|
577
596
|
var handleCreateTemplate = function handleCreateTemplate(e, templateId) {
|
|
578
597
|
e.stopPropagation();
|
|
579
598
|
createTemplate({
|
|
@@ -584,40 +603,44 @@ var Card = function Card(_ref) {
|
|
|
584
603
|
}
|
|
585
604
|
});
|
|
586
605
|
};
|
|
587
|
-
return /*#__PURE__*/
|
|
588
|
-
|
|
606
|
+
return /*#__PURE__*/jsxs("div", {
|
|
607
|
+
onClick: onClick,
|
|
608
|
+
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",
|
|
589
609
|
"data-cy": "template-card",
|
|
590
610
|
tabIndex: 0,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
611
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
612
|
+
className: "neeto-template__header",
|
|
613
|
+
children: /*#__PURE__*/jsx("img", {
|
|
614
|
+
className: "neeto-template__image",
|
|
615
|
+
"data-cy": "template-thumbnail-image",
|
|
616
|
+
src: template.imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
|
|
617
|
+
})
|
|
618
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
619
|
+
className: "neeto-template__description neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg p-2 py-1.5",
|
|
620
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
621
|
+
className: "neeto-ui-text-gray-800 line-clamp-2",
|
|
622
|
+
"data-cy": "template-card-title",
|
|
623
|
+
lineHeight: "normal",
|
|
624
|
+
style: "body2",
|
|
625
|
+
children: template.title
|
|
626
|
+
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
627
|
+
dropdownButtonProps: {
|
|
628
|
+
className: "flex-shrink-0",
|
|
629
|
+
size: "small"
|
|
630
|
+
},
|
|
631
|
+
dropdownProps: {
|
|
632
|
+
onClick: function onClick(event) {
|
|
633
|
+
return event.stopPropagation();
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
menuItems: getMenuItems({
|
|
637
|
+
handleCreateTemplate: handleCreateTemplate,
|
|
638
|
+
isCreating: isCreating,
|
|
639
|
+
template: template
|
|
640
|
+
})
|
|
641
|
+
})]
|
|
642
|
+
})]
|
|
643
|
+
});
|
|
621
644
|
};
|
|
622
645
|
|
|
623
646
|
var CategoryItem = function CategoryItem(_ref) {
|
|
@@ -625,19 +648,24 @@ var CategoryItem = function CategoryItem(_ref) {
|
|
|
625
648
|
count = _ref.count,
|
|
626
649
|
isActive = _ref.isActive,
|
|
627
650
|
setCurrentCategory = _ref.setCurrentCategory;
|
|
628
|
-
return /*#__PURE__*/
|
|
651
|
+
return /*#__PURE__*/jsxs("button", {
|
|
629
652
|
"data-cy": "category-".concat(joinHyphenCase(label)),
|
|
630
653
|
tabIndex: 0,
|
|
631
654
|
className: classnames("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", {
|
|
632
655
|
"neeto-ui-text-gray-700 hover:neeto-ui-bg-gray-200 focus:neeto-ui-bg-gray-200 border-transparent": !isActive,
|
|
633
656
|
"neeto-ui-text-gray-800 neeto-ui-bg-white neeto-ui-border-gray-300 focus:neeto-ui-border-gray-500": isActive
|
|
634
657
|
}),
|
|
635
|
-
onClick: setCurrentCategory
|
|
636
|
-
|
|
658
|
+
onClick: setCurrentCategory,
|
|
659
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
660
|
+
children: label
|
|
661
|
+
}), /*#__PURE__*/jsx("span", {
|
|
662
|
+
children: count
|
|
663
|
+
})]
|
|
664
|
+
});
|
|
637
665
|
};
|
|
638
666
|
|
|
639
|
-
function ownKeys$
|
|
640
|
-
function _objectSpread$
|
|
667
|
+
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; }
|
|
668
|
+
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; }
|
|
641
669
|
var List = function List(_ref) {
|
|
642
670
|
var setCurrentScreen = _ref.setCurrentScreen,
|
|
643
671
|
setSelectedTemplate = _ref.setSelectedTemplate,
|
|
@@ -680,7 +708,7 @@ var List = function List(_ref) {
|
|
|
680
708
|
setSelectedTemplate(template);
|
|
681
709
|
};
|
|
682
710
|
if (isTemplatesLoading) {
|
|
683
|
-
return /*#__PURE__*/
|
|
711
|
+
return /*#__PURE__*/jsx(PageLoader, {});
|
|
684
712
|
}
|
|
685
713
|
var _data$tags = data.tags,
|
|
686
714
|
tags = _data$tags === void 0 ? [] : _data$tags,
|
|
@@ -688,83 +716,96 @@ var List = function List(_ref) {
|
|
|
688
716
|
templates = _data$templates === void 0 ? [] : _data$templates,
|
|
689
717
|
_data$templatesCount = data.templatesCount,
|
|
690
718
|
templatesCount = _data$templatesCount === void 0 ? 0 : _data$templatesCount;
|
|
691
|
-
var categories = [_objectSpread$
|
|
719
|
+
var categories = [_objectSpread$4(_objectSpread$4({}, DEFAULT_CATEGORY), {}, {
|
|
692
720
|
count: templatesCount
|
|
693
721
|
})].concat(_toConsumableArray(tags));
|
|
694
|
-
return /*#__PURE__*/
|
|
695
|
-
className: "neeto-ui-bg-gray-100 relative flex min-h-full items-start"
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
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
|
-
|
|
722
|
+
return /*#__PURE__*/jsxs("div", {
|
|
723
|
+
className: "neeto-ui-bg-gray-100 relative flex min-h-full items-start",
|
|
724
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
725
|
+
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",
|
|
726
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
727
|
+
className: "space-y-4",
|
|
728
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
729
|
+
className: "space-y-1",
|
|
730
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
731
|
+
"data-cy": "create-new-form-title",
|
|
732
|
+
style: "h2",
|
|
733
|
+
weight: "semibold",
|
|
734
|
+
children: t("neetoTemplate.templates.createNewEntity")
|
|
735
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
736
|
+
lineHeight: "normal",
|
|
737
|
+
style: "body2",
|
|
738
|
+
children: t("neetoTemplate.templates.description")
|
|
739
|
+
})]
|
|
740
|
+
}), /*#__PURE__*/jsx(Search, {
|
|
741
|
+
autoFocus: true,
|
|
742
|
+
disableTrimOnBlur: true,
|
|
743
|
+
"data-cy": "template-search-input",
|
|
744
|
+
placeholder: t("neetoTemplate.templates.search"),
|
|
745
|
+
onSearch: function onSearch(value) {
|
|
746
|
+
return setSearchTerm(value);
|
|
747
|
+
}
|
|
748
|
+
})]
|
|
749
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
750
|
+
className: "space-y-3",
|
|
751
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
752
|
+
className: "uppercase",
|
|
753
|
+
"data-cy": "template-categories-label",
|
|
754
|
+
style: "h6",
|
|
755
|
+
children: t("neetoTemplate.templates.categories")
|
|
756
|
+
}), /*#__PURE__*/jsx("div", {
|
|
757
|
+
className: "space-y-2",
|
|
758
|
+
children: categories.map(function (_ref2) {
|
|
759
|
+
var id = _ref2.id,
|
|
760
|
+
name = _ref2.name,
|
|
761
|
+
count = _ref2.count;
|
|
762
|
+
return /*#__PURE__*/createElement(CategoryItem, {
|
|
763
|
+
count: count,
|
|
764
|
+
isActive: currentCategory.id === id,
|
|
765
|
+
key: id,
|
|
766
|
+
label: name,
|
|
767
|
+
setCurrentCategory: function setCurrentCategory() {
|
|
768
|
+
return _setCurrentCategory({
|
|
769
|
+
id: id,
|
|
770
|
+
name: name
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
})
|
|
775
|
+
})]
|
|
776
|
+
})]
|
|
777
|
+
}), /*#__PURE__*/jsx("div", {
|
|
778
|
+
className: "h-screen w-full overflow-y-auto py-8 pl-5 pr-4 md:pl-8 md:pr-20 xl:px-20",
|
|
779
|
+
ref: rootRef,
|
|
780
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
781
|
+
className: "flex-grow space-y-6",
|
|
782
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
783
|
+
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",
|
|
784
|
+
children: [/*#__PURE__*/jsx(BlankCard, {
|
|
785
|
+
description: t("neetoTemplate.templates.blankCard.description"),
|
|
786
|
+
disabled: isCreating,
|
|
787
|
+
icon: isCreating ? Spinner : SvgCustom,
|
|
788
|
+
title: t("neetoTemplate.templates.blankCard.title"),
|
|
789
|
+
onClick: onCreate
|
|
790
|
+
}), templates.map(function (template, index) {
|
|
791
|
+
return /*#__PURE__*/createElement(Card, {
|
|
792
|
+
afterCreate: afterCreate,
|
|
793
|
+
refetchResource: refetchResource,
|
|
794
|
+
template: template,
|
|
795
|
+
key: index,
|
|
796
|
+
onClick: function onClick() {
|
|
797
|
+
return handleCardClick(template);
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
})]
|
|
801
|
+
}), hasNextPage && /*#__PURE__*/jsx("div", {
|
|
802
|
+
className: "my-10 text-center",
|
|
803
|
+
ref: sentryRef,
|
|
804
|
+
children: /*#__PURE__*/jsx(Spinner, {})
|
|
805
|
+
})]
|
|
806
|
+
})
|
|
807
|
+
})]
|
|
808
|
+
});
|
|
768
809
|
};
|
|
769
810
|
|
|
770
811
|
var Preview$1 = function Preview(_ref) {
|
|
@@ -778,7 +819,7 @@ var Preview$1 = function Preview(_ref) {
|
|
|
778
819
|
refetchResource: refetchResource
|
|
779
820
|
}),
|
|
780
821
|
createTemplate = _useCreateTemplate.mutate,
|
|
781
|
-
isCreating = _useCreateTemplate.
|
|
822
|
+
isCreating = _useCreateTemplate.isPending;
|
|
782
823
|
var handleCreateTemplate = function handleCreateTemplate() {
|
|
783
824
|
createTemplate({
|
|
784
825
|
id: selectedTemplate.id
|
|
@@ -790,39 +831,44 @@ var Preview$1 = function Preview(_ref) {
|
|
|
790
831
|
};
|
|
791
832
|
var title = selectedTemplate.title,
|
|
792
833
|
previewUrl = selectedTemplate.previewUrl;
|
|
793
|
-
return /*#__PURE__*/
|
|
794
|
-
className: "m-auto flex h-full w-full max-w-6xl flex-col space-y-6 py-6"
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
834
|
+
return /*#__PURE__*/jsxs("div", {
|
|
835
|
+
className: "m-auto flex h-full w-full max-w-6xl flex-col space-y-6 py-6",
|
|
836
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
837
|
+
className: "flex flex-col items-center justify-between gap-6 pl-4 pr-16 md:flex-row md:pr-20 xl:px-0",
|
|
838
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
839
|
+
className: "flex min-w-0 flex-grow items-center gap-2",
|
|
840
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
841
|
+
className: "flex-shrink-0",
|
|
842
|
+
"data-cy": "preview-template-back-button",
|
|
843
|
+
icon: LeftArrow,
|
|
844
|
+
style: "text",
|
|
845
|
+
onClick: function onClick() {
|
|
846
|
+
return setCurrentScreen(TEMPLATE_SCREENS.LIST);
|
|
847
|
+
}
|
|
848
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
849
|
+
className: "leading-none",
|
|
850
|
+
"data-cy": "preview-template-title",
|
|
851
|
+
style: "h2",
|
|
852
|
+
weight: "semibold",
|
|
853
|
+
children: title
|
|
854
|
+
})]
|
|
855
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
856
|
+
className: "flex-shrink-0",
|
|
857
|
+
"data-cy": "preview-use-template-button",
|
|
858
|
+
disabled: isCreating,
|
|
859
|
+
label: t("neetoTemplate.templates.editTemplate"),
|
|
860
|
+
loading: isCreating,
|
|
861
|
+
onClick: handleCreateTemplate
|
|
862
|
+
})]
|
|
863
|
+
}), /*#__PURE__*/jsx("div", {
|
|
864
|
+
className: "neeto-templates-share-preview neeto-ui-rounded-sm sticky top-10",
|
|
865
|
+
children: /*#__PURE__*/jsx("iframe", {
|
|
866
|
+
className: "w-full flex-1 shadow-inner",
|
|
867
|
+
"data-cy": "iframe-id",
|
|
868
|
+
src: previewUrl
|
|
869
|
+
})
|
|
870
|
+
})]
|
|
871
|
+
});
|
|
826
872
|
};
|
|
827
873
|
|
|
828
874
|
var CreateTemplateModal = function CreateTemplateModal(_ref) {
|
|
@@ -849,24 +895,25 @@ var CreateTemplateModal = function CreateTemplateModal(_ref) {
|
|
|
849
895
|
}, 300); //To accommodate the animation duration.
|
|
850
896
|
};
|
|
851
897
|
|
|
852
|
-
return /*#__PURE__*/
|
|
898
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
853
899
|
className: "neeto-template-list h-screen w-screen overflow-y-auto",
|
|
854
900
|
isOpen: isOpen,
|
|
855
901
|
size: "fullScreen",
|
|
856
|
-
onClose: onModalClose
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
902
|
+
onClose: onModalClose,
|
|
903
|
+
children: currentScreen === TEMPLATE_SCREENS.LIST ? /*#__PURE__*/jsx(List, {
|
|
904
|
+
setCurrentScreen: setCurrentScreen,
|
|
905
|
+
setSelectedTemplate: setSelectedTemplate,
|
|
906
|
+
isCreating: isCreating,
|
|
907
|
+
afterCreate: afterCreate,
|
|
908
|
+
onCreate: onCreate,
|
|
909
|
+
refetchResource: refetchResource
|
|
910
|
+
}) : /*#__PURE__*/jsx(Preview$1, {
|
|
911
|
+
selectedTemplate: selectedTemplate,
|
|
912
|
+
setCurrentScreen: setCurrentScreen,
|
|
913
|
+
afterCreate: afterCreate,
|
|
914
|
+
refetchResource: refetchResource
|
|
915
|
+
})
|
|
916
|
+
});
|
|
870
917
|
};
|
|
871
918
|
|
|
872
919
|
var create = function create(payload) {
|
|
@@ -884,10 +931,12 @@ var templateTagsApi = {
|
|
|
884
931
|
list: list
|
|
885
932
|
};
|
|
886
933
|
|
|
887
|
-
function ownKeys$
|
|
888
|
-
function _objectSpread$
|
|
934
|
+
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; }
|
|
935
|
+
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; }
|
|
889
936
|
var useCreateTemplateTag = function useCreateTemplateTag(options) {
|
|
890
|
-
return useMutation(
|
|
937
|
+
return useMutation(_objectSpread$3(_objectSpread$3({
|
|
938
|
+
mutationFn: templateTagsApi.create
|
|
939
|
+
}, options), {}, {
|
|
891
940
|
onSuccess: function onSuccess() {
|
|
892
941
|
var _options$onSuccess;
|
|
893
942
|
refetchTags();
|
|
@@ -896,7 +945,10 @@ var useCreateTemplateTag = function useCreateTemplateTag(options) {
|
|
|
896
945
|
}));
|
|
897
946
|
};
|
|
898
947
|
var useFetchTemplateTags = function useFetchTemplateTags() {
|
|
899
|
-
return useQuery(
|
|
948
|
+
return useQuery({
|
|
949
|
+
queryKey: [QUERY_KEYS.TEMPLATE_TAGS],
|
|
950
|
+
queryFn: templateTagsApi.list
|
|
951
|
+
});
|
|
900
952
|
};
|
|
901
953
|
|
|
902
954
|
var FormikImageUploader = function FormikImageUploader(_ref) {
|
|
@@ -912,7 +964,7 @@ var FormikImageUploader = function FormikImageUploader(_ref) {
|
|
|
912
964
|
setFieldValue("imageSignedId", file.signedId);
|
|
913
965
|
return setValue(file.url);
|
|
914
966
|
};
|
|
915
|
-
return /*#__PURE__*/
|
|
967
|
+
return /*#__PURE__*/jsx(ImageUploader, {
|
|
916
968
|
className: "h-52 w-full md:h-80",
|
|
917
969
|
src: field.value,
|
|
918
970
|
uploadConfig: IMAGE_UPLOAD_CONFIG,
|
|
@@ -923,20 +975,22 @@ var FormikImageUploader = function FormikImageUploader(_ref) {
|
|
|
923
975
|
var PageWrapper = function PageWrapper(_ref) {
|
|
924
976
|
var children = _ref.children,
|
|
925
977
|
className = _ref.className;
|
|
926
|
-
return /*#__PURE__*/
|
|
927
|
-
className: classnames("w-full flex-col", className)
|
|
928
|
-
|
|
978
|
+
return /*#__PURE__*/jsx("div", {
|
|
979
|
+
className: classnames("w-full flex-col", className),
|
|
980
|
+
children: children
|
|
981
|
+
});
|
|
929
982
|
};
|
|
930
983
|
var PageHeader = function PageHeader(_ref2) {
|
|
931
984
|
var title = _ref2.title,
|
|
932
985
|
breadcrumbs = _ref2.breadcrumbs;
|
|
933
|
-
return /*#__PURE__*/
|
|
934
|
-
className: "w-full px-6"
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
986
|
+
return /*#__PURE__*/jsx("div", {
|
|
987
|
+
className: "w-full px-6",
|
|
988
|
+
children: /*#__PURE__*/jsx(Header, {
|
|
989
|
+
breadcrumbs: breadcrumbs,
|
|
990
|
+
size: "small",
|
|
991
|
+
title: title
|
|
992
|
+
})
|
|
993
|
+
});
|
|
940
994
|
};
|
|
941
995
|
var customPropEqualityCheck = function customPropEqualityCheck(prevProps, nextProps) {
|
|
942
996
|
return prevProps.title === nextProps.title && prevProps.breadcrumbs === nextProps.breadcrumbs;
|
|
@@ -946,13 +1000,17 @@ var PageContent = function PageContent(_ref3) {
|
|
|
946
1000
|
var children = _ref3.children,
|
|
947
1001
|
_ref3$className = _ref3.className,
|
|
948
1002
|
className = _ref3$className === void 0 ? "" : _ref3$className;
|
|
949
|
-
return /*#__PURE__*/
|
|
950
|
-
className: "w-full px-6 pb-6"
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1003
|
+
return /*#__PURE__*/jsx(Scrollable, {
|
|
1004
|
+
className: "w-full px-6 pb-6",
|
|
1005
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1006
|
+
className: classnames(["mx-auto max-w-7xl", className]),
|
|
1007
|
+
children: children
|
|
1008
|
+
})
|
|
1009
|
+
});
|
|
954
1010
|
};
|
|
955
1011
|
|
|
1012
|
+
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; }
|
|
1013
|
+
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; }
|
|
956
1014
|
var Tags = function Tags(_ref) {
|
|
957
1015
|
var allTags = _ref.allTags,
|
|
958
1016
|
selectedTags = _ref.selectedTags,
|
|
@@ -984,44 +1042,52 @@ var Tags = function Tags(_ref) {
|
|
|
984
1042
|
}
|
|
985
1043
|
});
|
|
986
1044
|
};
|
|
987
|
-
return /*#__PURE__*/
|
|
988
|
-
className: className
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1045
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1046
|
+
className: className,
|
|
1047
|
+
children: [labelProps.label && /*#__PURE__*/jsx(Label, _objectSpread$2(_objectSpread$2({}, labelProps), {}, {
|
|
1048
|
+
children: labelProps.label
|
|
1049
|
+
})), /*#__PURE__*/jsx("div", {
|
|
1050
|
+
className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white border p-4",
|
|
1051
|
+
children: /*#__PURE__*/jsx(TagsComponent, {
|
|
1052
|
+
allTags: allTags,
|
|
1053
|
+
selectedTags: selectedTags,
|
|
1054
|
+
buttonProps: {
|
|
1055
|
+
loading: isLoading,
|
|
1056
|
+
disabled: isLoading,
|
|
1057
|
+
iconPosition: "left"
|
|
1058
|
+
},
|
|
1059
|
+
onTagCreate: handleTagCreate,
|
|
1060
|
+
onTagDelete: handleTagRemove,
|
|
1061
|
+
onTagSelect: handleTagSelect
|
|
1062
|
+
})
|
|
1063
|
+
})]
|
|
1064
|
+
});
|
|
1003
1065
|
};
|
|
1004
1066
|
|
|
1005
1067
|
var Preview = function Preview(_ref) {
|
|
1006
1068
|
var template = _ref.template,
|
|
1007
1069
|
imageUrl = _ref.imageUrl;
|
|
1008
|
-
return /*#__PURE__*/
|
|
1070
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1009
1071
|
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",
|
|
1010
|
-
tabIndex: 0
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1072
|
+
tabIndex: 0,
|
|
1073
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
1074
|
+
className: "neeto-template__header",
|
|
1075
|
+
children: /*#__PURE__*/jsx("img", {
|
|
1076
|
+
className: "neeto-template__image",
|
|
1077
|
+
"data-cy": "template-image-preview",
|
|
1078
|
+
src: imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
|
|
1079
|
+
})
|
|
1080
|
+
}), /*#__PURE__*/jsx("div", {
|
|
1081
|
+
className: "neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg px-2 py-1.5",
|
|
1082
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
1083
|
+
className: "neeto-ui-text-gray-800",
|
|
1084
|
+
"data-cy": "template-title-text",
|
|
1085
|
+
lineHeight: "normal",
|
|
1086
|
+
style: "body2",
|
|
1087
|
+
children: template.title
|
|
1088
|
+
})
|
|
1089
|
+
})]
|
|
1090
|
+
});
|
|
1025
1091
|
};
|
|
1026
1092
|
|
|
1027
1093
|
var buildSelectOptionsBy = function buildSelectOptionsBy(labelField) {
|
|
@@ -1070,10 +1136,10 @@ var TemplateSettings = function TemplateSettings(_ref) {
|
|
|
1070
1136
|
resourceId: resourceId
|
|
1071
1137
|
}),
|
|
1072
1138
|
updateTemplate = _useUpdateTemplate.mutate,
|
|
1073
|
-
isUpdatingTemplate = _useUpdateTemplate.
|
|
1139
|
+
isUpdatingTemplate = _useUpdateTemplate.isPending;
|
|
1074
1140
|
var _useCreateTemplateTag = useCreateTemplateTag(),
|
|
1075
1141
|
createTemplateTag = _useCreateTemplateTag.mutate,
|
|
1076
|
-
isCreatingTags = _useCreateTemplateTag.
|
|
1142
|
+
isCreatingTags = _useCreateTemplateTag.isPending;
|
|
1077
1143
|
var _useFetchTemplateTags = useFetchTemplateTags(),
|
|
1078
1144
|
_useFetchTemplateTags2 = _useFetchTemplateTags.data,
|
|
1079
1145
|
templateTags = _useFetchTemplateTags2 === void 0 ? {} : _useFetchTemplateTags2,
|
|
@@ -1090,74 +1156,88 @@ var TemplateSettings = function TemplateSettings(_ref) {
|
|
|
1090
1156
|
}, data), {}, {
|
|
1091
1157
|
tags: tags
|
|
1092
1158
|
});
|
|
1093
|
-
return /*#__PURE__*/
|
|
1094
|
-
className: className
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
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
|
-
|
|
1159
|
+
return /*#__PURE__*/jsxs(PageWrapper, {
|
|
1160
|
+
className: className,
|
|
1161
|
+
children: [/*#__PURE__*/jsx(MemoizedPageHeader, {
|
|
1162
|
+
breadcrumbs: breadcrumbs,
|
|
1163
|
+
title: t("neetoTemplate.templateSettings.title")
|
|
1164
|
+
}), /*#__PURE__*/jsx(PageContent, {
|
|
1165
|
+
className: classnames({
|
|
1166
|
+
"min-h-0": !isLoading,
|
|
1167
|
+
"h-full": isLoading
|
|
1168
|
+
}),
|
|
1169
|
+
children: isLoading ? /*#__PURE__*/jsx(PageLoader, {}) : /*#__PURE__*/jsxs(Fragment, {
|
|
1170
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1171
|
+
className: "mb-1",
|
|
1172
|
+
"data-cy": "thank-you-action-text",
|
|
1173
|
+
style: "h2",
|
|
1174
|
+
weight: "semibold",
|
|
1175
|
+
children: t("neetoTemplate.templateSettings.configureTemplates")
|
|
1176
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
1177
|
+
className: "mb-2",
|
|
1178
|
+
"data-cy": "thank-you-description-label",
|
|
1179
|
+
style: "body2",
|
|
1180
|
+
children: t("neetoTemplate.templateSettings.subText")
|
|
1181
|
+
}), /*#__PURE__*/jsx(Form, {
|
|
1182
|
+
formikProps: {
|
|
1183
|
+
enableReinitialize: true,
|
|
1184
|
+
initialValues: resourceInitialValues,
|
|
1185
|
+
onSubmit: handleSubmit
|
|
1186
|
+
},
|
|
1187
|
+
children: function children(_ref2) {
|
|
1188
|
+
var values = _ref2.values,
|
|
1189
|
+
setFieldValue = _ref2.setFieldValue;
|
|
1190
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1191
|
+
className: "grid grid-cols-2 gap-8 pt-6",
|
|
1192
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1193
|
+
className: "space-y-4",
|
|
1194
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1195
|
+
className: "mb-3",
|
|
1196
|
+
style: "h4",
|
|
1197
|
+
weight: "semibold",
|
|
1198
|
+
children: t("neetoTemplate.templateSettings.imageLabel")
|
|
1199
|
+
}), /*#__PURE__*/jsx(FormikImageUploader, {
|
|
1200
|
+
name: "imageUrl"
|
|
1201
|
+
}), /*#__PURE__*/jsx(Tags, {
|
|
1202
|
+
allTags: buildSelectOptionsBy("name", templateTags.tags),
|
|
1203
|
+
className: "space-y-2",
|
|
1204
|
+
isLoading: isCreatingTags,
|
|
1205
|
+
selectedTags: values.tags,
|
|
1206
|
+
labelProps: {
|
|
1207
|
+
label: t("neetoTemplate.templateSettings.categoryLabel")
|
|
1208
|
+
},
|
|
1209
|
+
onCreate: createTemplateTag,
|
|
1210
|
+
onUpdate: function onUpdate(tags) {
|
|
1211
|
+
return setFieldValue("tags", tags);
|
|
1212
|
+
}
|
|
1213
|
+
}), /*#__PURE__*/jsx("div", {
|
|
1214
|
+
className: "mt-12 flex flex-row items-center justify-start",
|
|
1215
|
+
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
1216
|
+
isSubmitting: isUpdatingTemplate,
|
|
1217
|
+
cancelButtonProps: {
|
|
1218
|
+
to: onCancelTemplatePreview,
|
|
1219
|
+
"data-cy": "reset-changes-button",
|
|
1220
|
+
onClick: noop
|
|
1221
|
+
}
|
|
1222
|
+
})
|
|
1223
|
+
})]
|
|
1224
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1225
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1226
|
+
className: "mb-3",
|
|
1227
|
+
style: "h4",
|
|
1228
|
+
weight: "semibold",
|
|
1229
|
+
children: t("neetoTemplate.templateSettings.previewLabel")
|
|
1230
|
+
}), /*#__PURE__*/jsx(Preview, {
|
|
1231
|
+
imageUrl: values.imageUrl,
|
|
1232
|
+
template: data
|
|
1233
|
+
})]
|
|
1234
|
+
})]
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
})]
|
|
1238
|
+
})
|
|
1239
|
+
})]
|
|
1240
|
+
});
|
|
1161
1241
|
};
|
|
1162
1242
|
|
|
1163
1243
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
@@ -1201,9 +1281,10 @@ var TAG_TYPES = [{
|
|
|
1201
1281
|
width: 300,
|
|
1202
1282
|
sorter: true,
|
|
1203
1283
|
render: function render(templatesCount) {
|
|
1204
|
-
return templatesCount !== 0 ? /*#__PURE__*/
|
|
1205
|
-
style: "body1"
|
|
1206
|
-
|
|
1284
|
+
return templatesCount !== 0 ? /*#__PURE__*/jsxs(Typography, {
|
|
1285
|
+
style: "body1",
|
|
1286
|
+
children: [" ", templatesCount, " "]
|
|
1287
|
+
}) : "-";
|
|
1207
1288
|
}
|
|
1208
1289
|
}]
|
|
1209
1290
|
}];
|
|
@@ -1217,12 +1298,18 @@ var TemplateTags = function TemplateTags(_ref) {
|
|
|
1217
1298
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
1218
1299
|
var queryClient = useQueryClient();
|
|
1219
1300
|
var invalidateTags = function invalidateTags() {
|
|
1220
|
-
queryClient.invalidateQueries(
|
|
1301
|
+
queryClient.invalidateQueries({
|
|
1302
|
+
queryKey: [QUERY_KEYS.TEMPLATE_TAGS]
|
|
1303
|
+
});
|
|
1221
1304
|
};
|
|
1222
1305
|
var invalidateTagsAndTemplates = function invalidateTagsAndTemplates() {
|
|
1223
1306
|
invalidateTags();
|
|
1224
|
-
queryClient.invalidateQueries(
|
|
1225
|
-
|
|
1307
|
+
queryClient.invalidateQueries({
|
|
1308
|
+
queryKey: [QUERY_KEYS.TEMPLATES_LIST]
|
|
1309
|
+
});
|
|
1310
|
+
queryClient.invalidateQueries({
|
|
1311
|
+
queryKey: [QUERY_KEYS.TEMPLATE]
|
|
1312
|
+
});
|
|
1226
1313
|
};
|
|
1227
1314
|
var config = _objectSpread({
|
|
1228
1315
|
tagTypes: TAG_TYPES,
|
|
@@ -1252,7 +1339,7 @@ var TemplateTags = function TemplateTags(_ref) {
|
|
|
1252
1339
|
}
|
|
1253
1340
|
}
|
|
1254
1341
|
}, otherProps);
|
|
1255
|
-
return /*#__PURE__*/
|
|
1342
|
+
return /*#__PURE__*/jsx(NeetoTags, {
|
|
1256
1343
|
config: config
|
|
1257
1344
|
});
|
|
1258
1345
|
};
|