@bigbinary/neeto-templates-frontend 1.2.0 → 2.0.1

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 CHANGED
@@ -4,26 +4,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var neetoCist = require('@bigbinary/neeto-cist');
7
- var neetoui = require('@bigbinary/neetoui');
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');
13
+ var neetoTagsFrontend = require('@bigbinary/neeto-tags-frontend');
14
+ var reactQuery = require('@tanstack/react-query');
15
+ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
11
16
  var ramda = require('ramda');
12
- var reactQuery = require('react-query');
13
17
  var axios = require('axios');
14
- var require$$0 = require('util');
15
- var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
16
- var i18next = require('i18next');
18
+ var jsxRuntime = require('react/jsx-runtime');
17
19
  var classnames = require('classnames');
18
- var utils$3 = require('@bigbinary/neeto-commons-frontend/utils');
19
- var neetoIcons = require('@bigbinary/neeto-icons');
20
- var formik$1 = require('@bigbinary/neetoui/formik');
20
+ var utils = require('@bigbinary/neeto-commons-frontend/utils');
21
+ var ResponsiveDevicePicker = require('@bigbinary/neeto-molecules/ResponsiveDevicePicker');
22
+ var Button = require('@bigbinary/neetoui/Button');
23
+ var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
24
+ var Form = require('@bigbinary/neetoui/formik/Form');
21
25
  var reactRouterDom = require('react-router-dom');
22
- var neetoTagsFrontend = require('@bigbinary/neeto-tags-frontend');
23
26
  var neetoImageUploaderFrontend = require('@bigbinary/neeto-image-uploader-frontend');
24
27
  var formik = require('formik');
25
28
  var Header = require('@bigbinary/neeto-molecules/Header');
26
29
  var Scrollable = require('@bigbinary/neeto-molecules/Scrollable');
30
+ var Label = require('@bigbinary/neetoui/Label');
31
+ var i18next = require('i18next');
27
32
 
28
33
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
29
34
 
@@ -46,15 +51,20 @@ function _interopNamespace(e) {
46
51
  }
47
52
 
48
53
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
49
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
54
+ var Modal__default = /*#__PURE__*/_interopDefaultLegacy(Modal);
50
55
  var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
51
56
  var Search__default = /*#__PURE__*/_interopDefaultLegacy(Search);
57
+ var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
58
+ var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
52
59
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
53
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
54
- var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
55
60
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
61
+ var ResponsiveDevicePicker__default = /*#__PURE__*/_interopDefaultLegacy(ResponsiveDevicePicker);
62
+ var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
63
+ var ActionBlock__default = /*#__PURE__*/_interopDefaultLegacy(ActionBlock);
64
+ var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
56
65
  var Header__default = /*#__PURE__*/_interopDefaultLegacy(Header);
57
66
  var Scrollable__default = /*#__PURE__*/_interopDefaultLegacy(Scrollable);
67
+ var Label__default = /*#__PURE__*/_interopDefaultLegacy(Label);
58
68
 
59
69
  function _arrayWithHoles(arr) {
60
70
  if (Array.isArray(arr)) return arr;
@@ -120,9 +130,10 @@ var DEFAULT_CATEGORY = {
120
130
  name: "All"
121
131
  };
122
132
  var INFINITE_SCROLL_DELAY = 500;
123
- var MENU_ITEMS = {
124
- CREATE: "create",
125
- PREVIEW: "preview"
133
+ var RESPONSIVE_DEVICES = {
134
+ DESKTOP: "desktop",
135
+ TABLET: "tablet",
136
+ MOBILE: "mobile"
126
137
  };
127
138
 
128
139
  function _typeof(o) {
@@ -405,7 +416,7 @@ const SvgCustom = props => /*#__PURE__*/React__namespace.createElement("svg", _e
405
416
  height: 40,
406
417
  x: 3,
407
418
  y: 2,
408
- fill: "#4558F9",
419
+ fill: "#008068",
409
420
  rx: 2
410
421
  })), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
411
422
  fill: "#fff",
@@ -414,2445 +425,345 @@ const SvgCustom = props => /*#__PURE__*/React__namespace.createElement("svg", _e
414
425
  clipRule: "evenodd"
415
426
  })));
416
427
 
417
- /* eslint complexity: [2, 18], max-statements: [2, 33] */
418
- var shams = function hasSymbols() {
419
- if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
420
- if (typeof Symbol.iterator === 'symbol') { return true; }
421
-
422
- var obj = {};
423
- var sym = Symbol('test');
424
- var symObj = Object(sym);
425
- if (typeof sym === 'string') { return false; }
426
-
427
- if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
428
- if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
429
-
430
- // temp disabled per https://github.com/ljharb/object.assign/issues/17
431
- // if (sym instanceof Symbol) { return false; }
432
- // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
433
- // if (!(symObj instanceof Symbol)) { return false; }
434
-
435
- // if (typeof Symbol.prototype.toString !== 'function') { return false; }
436
- // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
437
-
438
- var symVal = 42;
439
- obj[sym] = symVal;
440
- for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
441
- if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
442
-
443
- if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
444
-
445
- var syms = Object.getOwnPropertySymbols(obj);
446
- if (syms.length !== 1 || syms[0] !== sym) { return false; }
447
-
448
- if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
449
-
450
- if (typeof Object.getOwnPropertyDescriptor === 'function') {
451
- var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
452
- if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
453
- }
454
-
455
- return true;
456
- };
457
-
458
- var origSymbol = typeof Symbol !== 'undefined' && Symbol;
459
- var hasSymbolSham = shams;
460
-
461
- var hasSymbols$1 = function hasNativeSymbols() {
462
- if (typeof origSymbol !== 'function') { return false; }
463
- if (typeof Symbol !== 'function') { return false; }
464
- if (typeof origSymbol('foo') !== 'symbol') { return false; }
465
- if (typeof Symbol('bar') !== 'symbol') { return false; }
466
-
467
- return hasSymbolSham();
468
- };
428
+ var IMAGE_SIZE_LIMIT_IN_MEGABYTES = 1;
429
+ var NEETO_TEMPLATES_URL = "/neeto_templates_engine/api/v1";
430
+ var TEMPLATE_TAGS_URL = "".concat(NEETO_TEMPLATES_URL, "/tags/template_tags");
469
431
 
470
- var test = {
471
- foo: {}
432
+ //routes of the host
433
+ var TEMPLATES_URL = "/api/v1/templates";
434
+ var TEMPLATES_SETTINGS_URL = "/api/v1/settings";
435
+ var IMAGE_UPLOAD_CONFIG = {
436
+ maxImageSize: IMAGE_SIZE_LIMIT_IN_MEGABYTES
472
437
  };
473
438
 
474
- var $Object = Object;
475
-
476
- var hasProto$1 = function hasProto() {
477
- return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
439
+ var list$1 = function list(params) {
440
+ return axios__default["default"].get(TEMPLATES_URL, {
441
+ params: params
442
+ });
478
443
  };
479
-
480
- /* eslint no-invalid-this: 1 */
481
-
482
- var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
483
- var slice = Array.prototype.slice;
484
- var toStr$1 = Object.prototype.toString;
485
- var funcType = '[object Function]';
486
-
487
- var implementation$1 = function bind(that) {
488
- var target = this;
489
- if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
490
- throw new TypeError(ERROR_MESSAGE + target);
491
- }
492
- var args = slice.call(arguments, 1);
493
-
494
- var bound;
495
- var binder = function () {
496
- if (this instanceof bound) {
497
- var result = target.apply(
498
- this,
499
- args.concat(slice.call(arguments))
500
- );
501
- if (Object(result) === result) {
502
- return result;
503
- }
504
- return this;
505
- } else {
506
- return target.apply(
507
- that,
508
- args.concat(slice.call(arguments))
509
- );
510
- }
511
- };
512
-
513
- var boundLength = Math.max(0, target.length - args.length);
514
- var boundArgs = [];
515
- for (var i = 0; i < boundLength; i++) {
516
- boundArgs.push('$' + i);
517
- }
518
-
519
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
520
-
521
- if (target.prototype) {
522
- var Empty = function Empty() {};
523
- Empty.prototype = target.prototype;
524
- bound.prototype = new Empty();
525
- Empty.prototype = null;
444
+ var create$1 = function create(_ref) {
445
+ var id = _ref.id;
446
+ return axios__default["default"].post(TEMPLATES_URL, {
447
+ template: {
448
+ id: id
526
449
  }
527
-
528
- return bound;
450
+ }, {
451
+ showToastr: false
452
+ });
529
453
  };
530
-
531
- var implementation = implementation$1;
532
-
533
- var functionBind = Function.prototype.bind || implementation;
534
-
535
- var bind$1 = functionBind;
536
-
537
- var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
538
-
539
- var undefined$1;
540
-
541
- var $SyntaxError = SyntaxError;
542
- var $Function = Function;
543
- var $TypeError$1 = TypeError;
544
-
545
- // eslint-disable-next-line consistent-return
546
- var getEvalledConstructor = function (expressionSyntax) {
547
- try {
548
- return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
549
- } catch (e) {}
454
+ var fetch = function fetch(_ref2) {
455
+ var templateId = _ref2.templateId;
456
+ return axios__default["default"].get("".concat(TEMPLATES_SETTINGS_URL, "/").concat(templateId));
550
457
  };
551
-
552
- var $gOPD = Object.getOwnPropertyDescriptor;
553
- if ($gOPD) {
554
- try {
555
- $gOPD({}, '');
556
- } catch (e) {
557
- $gOPD = null; // this is IE 8, which has a broken gOPD
558
- }
559
- }
560
-
561
- var throwTypeError = function () {
562
- throw new $TypeError$1();
458
+ var update = function update(_ref3) {
459
+ var resourceId = _ref3.resourceId,
460
+ payload = _ref3.payload;
461
+ return axios__default["default"].put("".concat(TEMPLATES_SETTINGS_URL, "/").concat(resourceId), payload);
563
462
  };
564
- var ThrowTypeError = $gOPD
565
- ? (function () {
566
- try {
567
- // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
568
- arguments.callee; // IE 8 does not throw here
569
- return throwTypeError;
570
- } catch (calleeThrows) {
571
- try {
572
- // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
573
- return $gOPD(arguments, 'callee').get;
574
- } catch (gOPDthrows) {
575
- return throwTypeError;
576
- }
577
- }
578
- }())
579
- : throwTypeError;
580
-
581
- var hasSymbols = hasSymbols$1();
582
- var hasProto = hasProto$1();
583
-
584
- var getProto = Object.getPrototypeOf || (
585
- hasProto
586
- ? function (x) { return x.__proto__; } // eslint-disable-line no-proto
587
- : null
588
- );
589
-
590
- var needsEval = {};
591
-
592
- var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
593
-
594
- var INTRINSICS = {
595
- '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
596
- '%Array%': Array,
597
- '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
598
- '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
599
- '%AsyncFromSyncIteratorPrototype%': undefined$1,
600
- '%AsyncFunction%': needsEval,
601
- '%AsyncGenerator%': needsEval,
602
- '%AsyncGeneratorFunction%': needsEval,
603
- '%AsyncIteratorPrototype%': needsEval,
604
- '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
605
- '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
606
- '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
607
- '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
608
- '%Boolean%': Boolean,
609
- '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
610
- '%Date%': Date,
611
- '%decodeURI%': decodeURI,
612
- '%decodeURIComponent%': decodeURIComponent,
613
- '%encodeURI%': encodeURI,
614
- '%encodeURIComponent%': encodeURIComponent,
615
- '%Error%': Error,
616
- '%eval%': eval, // eslint-disable-line no-eval
617
- '%EvalError%': EvalError,
618
- '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
619
- '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
620
- '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
621
- '%Function%': $Function,
622
- '%GeneratorFunction%': needsEval,
623
- '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
624
- '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
625
- '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
626
- '%isFinite%': isFinite,
627
- '%isNaN%': isNaN,
628
- '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
629
- '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
630
- '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
631
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
632
- '%Math%': Math,
633
- '%Number%': Number,
634
- '%Object%': Object,
635
- '%parseFloat%': parseFloat,
636
- '%parseInt%': parseInt,
637
- '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
638
- '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
639
- '%RangeError%': RangeError,
640
- '%ReferenceError%': ReferenceError,
641
- '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
642
- '%RegExp%': RegExp,
643
- '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
644
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
645
- '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
646
- '%String%': String,
647
- '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
648
- '%Symbol%': hasSymbols ? Symbol : undefined$1,
649
- '%SyntaxError%': $SyntaxError,
650
- '%ThrowTypeError%': ThrowTypeError,
651
- '%TypedArray%': TypedArray,
652
- '%TypeError%': $TypeError$1,
653
- '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
654
- '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
655
- '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
656
- '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
657
- '%URIError%': URIError,
658
- '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
659
- '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
660
- '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
463
+ var templatesApi = {
464
+ list: list$1,
465
+ create: create$1,
466
+ update: update,
467
+ fetch: fetch
661
468
  };
662
469
 
663
- if (getProto) {
664
- try {
665
- null.error; // eslint-disable-line no-unused-expressions
666
- } catch (e) {
667
- // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
668
- var errorProto = getProto(getProto(e));
669
- INTRINSICS['%Error.prototype%'] = errorProto;
670
- }
671
- }
672
-
673
- var doEval = function doEval(name) {
674
- var value;
675
- if (name === '%AsyncFunction%') {
676
- value = getEvalledConstructor('async function () {}');
677
- } else if (name === '%GeneratorFunction%') {
678
- value = getEvalledConstructor('function* () {}');
679
- } else if (name === '%AsyncGeneratorFunction%') {
680
- value = getEvalledConstructor('async function* () {}');
681
- } else if (name === '%AsyncGenerator%') {
682
- var fn = doEval('%AsyncGeneratorFunction%');
683
- if (fn) {
684
- value = fn.prototype;
685
- }
686
- } else if (name === '%AsyncIteratorPrototype%') {
687
- var gen = doEval('%AsyncGenerator%');
688
- if (gen && getProto) {
689
- value = getProto(gen.prototype);
690
- }
691
- }
692
-
693
- INTRINSICS[name] = value;
694
-
695
- return value;
470
+ var QUERY_KEYS = {
471
+ TEMPLATES_LIST: "templates-list",
472
+ TEMPLATE: "templates-detail",
473
+ TEMPLATE_TAGS: "tag-key"
696
474
  };
697
475
 
698
- var LEGACY_ALIASES = {
699
- '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
700
- '%ArrayPrototype%': ['Array', 'prototype'],
701
- '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
702
- '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
703
- '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
704
- '%ArrayProto_values%': ['Array', 'prototype', 'values'],
705
- '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
706
- '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
707
- '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
708
- '%BooleanPrototype%': ['Boolean', 'prototype'],
709
- '%DataViewPrototype%': ['DataView', 'prototype'],
710
- '%DatePrototype%': ['Date', 'prototype'],
711
- '%ErrorPrototype%': ['Error', 'prototype'],
712
- '%EvalErrorPrototype%': ['EvalError', 'prototype'],
713
- '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
714
- '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
715
- '%FunctionPrototype%': ['Function', 'prototype'],
716
- '%Generator%': ['GeneratorFunction', 'prototype'],
717
- '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
718
- '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
719
- '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
720
- '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
721
- '%JSONParse%': ['JSON', 'parse'],
722
- '%JSONStringify%': ['JSON', 'stringify'],
723
- '%MapPrototype%': ['Map', 'prototype'],
724
- '%NumberPrototype%': ['Number', 'prototype'],
725
- '%ObjectPrototype%': ['Object', 'prototype'],
726
- '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
727
- '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
728
- '%PromisePrototype%': ['Promise', 'prototype'],
729
- '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
730
- '%Promise_all%': ['Promise', 'all'],
731
- '%Promise_reject%': ['Promise', 'reject'],
732
- '%Promise_resolve%': ['Promise', 'resolve'],
733
- '%RangeErrorPrototype%': ['RangeError', 'prototype'],
734
- '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
735
- '%RegExpPrototype%': ['RegExp', 'prototype'],
736
- '%SetPrototype%': ['Set', 'prototype'],
737
- '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
738
- '%StringPrototype%': ['String', 'prototype'],
739
- '%SymbolPrototype%': ['Symbol', 'prototype'],
740
- '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
741
- '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
742
- '%TypeErrorPrototype%': ['TypeError', 'prototype'],
743
- '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
744
- '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
745
- '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
746
- '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
747
- '%URIErrorPrototype%': ['URIError', 'prototype'],
748
- '%WeakMapPrototype%': ['WeakMap', 'prototype'],
749
- '%WeakSetPrototype%': ['WeakSet', 'prototype']
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; }
478
+ var useFetchTemplates = function useFetchTemplates(_ref) {
479
+ var searchTerm = _ref.searchTerm,
480
+ category = _ref.category;
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
+ },
492
+ getNextPageParam: function getNextPageParam(lastPage) {
493
+ return lastPage.hasNextPage ? lastPage.page + 1 : undefined;
494
+ },
495
+ select: function select(data) {
496
+ var templates = data.pages.flatMap(ramda.prop("templates"));
497
+ var lastPage = data.pages[data.pages.length - 1];
498
+ return {
499
+ templates: templates,
500
+ hasNextPage: lastPage.hasNextPage,
501
+ page: lastPage.page,
502
+ tags: lastPage.tags,
503
+ templatesCount: lastPage.templatesCount
504
+ };
505
+ },
506
+ keepPreviousData: true
507
+ });
750
508
  };
751
-
752
- var bind = functionBind;
753
- var hasOwn$1 = src;
754
- var $concat$1 = bind.call(Function.call, Array.prototype.concat);
755
- var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
756
- var $replace$1 = bind.call(Function.call, String.prototype.replace);
757
- var $strSlice = bind.call(Function.call, String.prototype.slice);
758
- var $exec = bind.call(Function.call, RegExp.prototype.exec);
759
-
760
- /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
761
- var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
762
- var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
763
- var stringToPath = function stringToPath(string) {
764
- var first = $strSlice(string, 0, 1);
765
- var last = $strSlice(string, -1);
766
- if (first === '%' && last !== '%') {
767
- throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
768
- } else if (last === '%' && first !== '%') {
769
- throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
770
- }
771
- var result = [];
772
- $replace$1(string, rePropName, function (match, number, quote, subString) {
773
- result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
774
- });
775
- return result;
509
+ var useCreateTemplate = function useCreateTemplate() {
510
+ return reactQuery.useMutation({
511
+ mutationFn: templatesApi.create
512
+ });
776
513
  };
777
- /* end adaptation */
778
-
779
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
780
- var intrinsicName = name;
781
- var alias;
782
- if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
783
- alias = LEGACY_ALIASES[intrinsicName];
784
- intrinsicName = '%' + alias[0] + '%';
785
- }
786
-
787
- if (hasOwn$1(INTRINSICS, intrinsicName)) {
788
- var value = INTRINSICS[intrinsicName];
789
- if (value === needsEval) {
790
- value = doEval(intrinsicName);
791
- }
792
- if (typeof value === 'undefined' && !allowMissing) {
793
- throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
794
- }
795
-
796
- return {
797
- alias: alias,
798
- name: intrinsicName,
799
- value: value
800
- };
801
- }
802
-
803
- throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
514
+ var useFetchTemplate = function useFetchTemplate(_ref3, options) {
515
+ var resourceId = _ref3.resourceId;
516
+ return reactQuery.useQuery(_objectSpread$5({
517
+ queryKey: [QUERY_KEYS.TEMPLATE, resourceId],
518
+ queryFn: function queryFn() {
519
+ return templatesApi.fetch({
520
+ templateId: resourceId
521
+ });
522
+ }
523
+ }, options));
804
524
  };
805
-
806
- var getIntrinsic = function GetIntrinsic(name, allowMissing) {
807
- if (typeof name !== 'string' || name.length === 0) {
808
- throw new $TypeError$1('intrinsic name must be a non-empty string');
809
- }
810
- if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
811
- throw new $TypeError$1('"allowMissing" argument must be a boolean');
812
- }
813
-
814
- if ($exec(/^%?[^%]*%?$/, name) === null) {
815
- throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
816
- }
817
- var parts = stringToPath(name);
818
- var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
819
-
820
- var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
821
- var intrinsicRealName = intrinsic.name;
822
- var value = intrinsic.value;
823
- var skipFurtherCaching = false;
824
-
825
- var alias = intrinsic.alias;
826
- if (alias) {
827
- intrinsicBaseName = alias[0];
828
- $spliceApply(parts, $concat$1([0, 1], alias));
829
- }
830
-
831
- for (var i = 1, isOwn = true; i < parts.length; i += 1) {
832
- var part = parts[i];
833
- var first = $strSlice(part, 0, 1);
834
- var last = $strSlice(part, -1);
835
- if (
836
- (
837
- (first === '"' || first === "'" || first === '`')
838
- || (last === '"' || last === "'" || last === '`')
839
- )
840
- && first !== last
841
- ) {
842
- throw new $SyntaxError('property names with quotes must have matching quotes');
843
- }
844
- if (part === 'constructor' || !isOwn) {
845
- skipFurtherCaching = true;
846
- }
847
-
848
- intrinsicBaseName += '.' + part;
849
- intrinsicRealName = '%' + intrinsicBaseName + '%';
850
-
851
- if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
852
- value = INTRINSICS[intrinsicRealName];
853
- } else if (value != null) {
854
- if (!(part in value)) {
855
- if (!allowMissing) {
856
- throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
857
- }
858
- return void undefined$1;
859
- }
860
- if ($gOPD && (i + 1) >= parts.length) {
861
- var desc = $gOPD(value, part);
862
- isOwn = !!desc;
863
-
864
- // By convention, when a data property is converted to an accessor
865
- // property to emulate a data property that does not suffer from
866
- // the override mistake, that accessor's getter is marked with
867
- // an `originalValue` property. Here, when we detect this, we
868
- // uphold the illusion by pretending to see that original data
869
- // property, i.e., returning the value rather than the getter
870
- // itself.
871
- if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
872
- value = desc.get;
873
- } else {
874
- value = value[part];
875
- }
876
- } else {
877
- isOwn = hasOwn$1(value, part);
878
- value = value[part];
879
- }
880
-
881
- if (isOwn && !skipFurtherCaching) {
882
- INTRINSICS[intrinsicRealName] = value;
883
- }
884
- }
885
- }
886
- return value;
525
+ var useUpdateTemplate = function useUpdateTemplate(_ref4) {
526
+ var resourceId = _ref4.resourceId;
527
+ return reactUtils.useMutationWithInvalidation(function (_ref5) {
528
+ var template = _ref5.template;
529
+ return templatesApi.update({
530
+ resourceId: resourceId,
531
+ payload: {
532
+ template: template
533
+ }
534
+ });
535
+ }, {
536
+ keysToInvalidate: [[QUERY_KEYS.TEMPLATES_LIST], [QUERY_KEYS.TEMPLATE, resourceId]],
537
+ onSuccess: function onSuccess() {
538
+ neetoTagsFrontend.refetchTags();
539
+ }
540
+ });
887
541
  };
888
542
 
889
- var callBind$1 = {exports: {}};
890
-
891
- callBind$1.exports;
892
-
893
- (function (module) {
894
-
895
- var bind = functionBind;
896
- var GetIntrinsic = getIntrinsic;
897
-
898
- var $apply = GetIntrinsic('%Function.prototype.apply%');
899
- var $call = GetIntrinsic('%Function.prototype.call%');
900
- var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
901
-
902
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
903
- var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
904
- var $max = GetIntrinsic('%Math.max%');
905
-
906
- if ($defineProperty) {
907
- try {
908
- $defineProperty({}, 'a', { value: 1 });
909
- } catch (e) {
910
- // IE 8 has a broken defineProperty
911
- $defineProperty = null;
912
- }
913
- }
914
-
915
- module.exports = function callBind(originalFunction) {
916
- var func = $reflectApply(bind, $call, arguments);
917
- if ($gOPD && $defineProperty) {
918
- var desc = $gOPD(func, 'length');
919
- if (desc.configurable) {
920
- // original length, plus the receiver, minus any additional arguments (after the receiver)
921
- $defineProperty(
922
- func,
923
- 'length',
924
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
925
- );
926
- }
927
- }
928
- return func;
929
- };
930
-
931
- var applyBind = function applyBind() {
932
- return $reflectApply(bind, $apply, arguments);
933
- };
934
-
935
- if ($defineProperty) {
936
- $defineProperty(module.exports, 'apply', { value: applyBind });
937
- } else {
938
- module.exports.apply = applyBind;
939
- }
940
- } (callBind$1));
941
-
942
- var callBindExports = callBind$1.exports;
943
-
944
- var GetIntrinsic$1 = getIntrinsic;
945
-
946
- var callBind = callBindExports;
947
-
948
- var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
949
-
950
- var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
951
- var intrinsic = GetIntrinsic$1(name, !!allowMissing);
952
- if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
953
- return callBind(intrinsic);
954
- }
955
- return intrinsic;
543
+ var BlankCard = function BlankCard(_ref) {
544
+ var Icon = _ref.icon,
545
+ title = _ref.title,
546
+ description = _ref.description,
547
+ _ref$onClick = _ref.onClick,
548
+ onClick = _ref$onClick === void 0 ? neetoCist.noop : _ref$onClick,
549
+ _ref$disabled = _ref.disabled,
550
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
551
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
552
+ 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",
553
+ "data-cy": "start-from-scratch-button",
554
+ tabIndex: 0,
555
+ onClick: !disabled ? onClick : neetoCist.noop,
556
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
557
+ className: "neeto-ui-text-primary-500 mb-4",
558
+ children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
559
+ size: 40
560
+ })
561
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
562
+ className: "text-center",
563
+ lineHeight: "normal",
564
+ style: "h5",
565
+ weight: "semibold",
566
+ children: title
567
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
568
+ className: "neeto-ui-text-gray-600 text-center",
569
+ lineHeight: "leading-4",
570
+ style: "body3",
571
+ children: description
572
+ })]
573
+ });
956
574
  };
957
575
 
958
- var util_inspect = require$$0__default["default"].inspect;
959
-
960
- var hasMap = typeof Map === 'function' && Map.prototype;
961
- var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
962
- var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
963
- var mapForEach = hasMap && Map.prototype.forEach;
964
- var hasSet = typeof Set === 'function' && Set.prototype;
965
- var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
966
- var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
967
- var setForEach = hasSet && Set.prototype.forEach;
968
- var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
969
- var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
970
- var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
971
- var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
972
- var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
973
- var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
974
- var booleanValueOf = Boolean.prototype.valueOf;
975
- var objectToString = Object.prototype.toString;
976
- var functionToString = Function.prototype.toString;
977
- var $match = String.prototype.match;
978
- var $slice = String.prototype.slice;
979
- var $replace = String.prototype.replace;
980
- var $toUpperCase = String.prototype.toUpperCase;
981
- var $toLowerCase = String.prototype.toLowerCase;
982
- var $test = RegExp.prototype.test;
983
- var $concat = Array.prototype.concat;
984
- var $join = Array.prototype.join;
985
- var $arrSlice = Array.prototype.slice;
986
- var $floor = Math.floor;
987
- var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
988
- var gOPS = Object.getOwnPropertySymbols;
989
- var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
990
- var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
991
- // ie, `has-tostringtag/shams
992
- var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
993
- ? Symbol.toStringTag
994
- : null;
995
- var isEnumerable = Object.prototype.propertyIsEnumerable;
996
-
997
- var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
998
- [].__proto__ === Array.prototype // eslint-disable-line no-proto
999
- ? function (O) {
1000
- return O.__proto__; // eslint-disable-line no-proto
1001
- }
1002
- : null
1003
- );
1004
-
1005
- function addNumericSeparator(num, str) {
1006
- if (
1007
- num === Infinity
1008
- || num === -Infinity
1009
- || num !== num
1010
- || (num && num > -1000 && num < 1000)
1011
- || $test.call(/e/, str)
1012
- ) {
1013
- return str;
1014
- }
1015
- var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
1016
- if (typeof num === 'number') {
1017
- var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
1018
- if (int !== num) {
1019
- var intStr = String(int);
1020
- var dec = $slice.call(str, intStr.length + 1);
1021
- return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
1022
- }
1023
- }
1024
- return $replace.call(str, sepRegex, '$&_');
1025
- }
1026
-
1027
- var utilInspect = util_inspect;
1028
- var inspectCustom = utilInspect.custom;
1029
- var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
1030
-
1031
- var objectInspect = function inspect_(obj, options, depth, seen) {
1032
- var opts = options || {};
1033
-
1034
- if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
1035
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
1036
- }
1037
- if (
1038
- has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
1039
- ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
1040
- : opts.maxStringLength !== null
1041
- )
1042
- ) {
1043
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
1044
- }
1045
- var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
1046
- if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
1047
- throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
1048
- }
1049
-
1050
- if (
1051
- has$3(opts, 'indent')
1052
- && opts.indent !== null
1053
- && opts.indent !== '\t'
1054
- && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
1055
- ) {
1056
- throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
1057
- }
1058
- if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
1059
- throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
1060
- }
1061
- var numericSeparator = opts.numericSeparator;
1062
-
1063
- if (typeof obj === 'undefined') {
1064
- return 'undefined';
1065
- }
1066
- if (obj === null) {
1067
- return 'null';
1068
- }
1069
- if (typeof obj === 'boolean') {
1070
- return obj ? 'true' : 'false';
1071
- }
1072
-
1073
- if (typeof obj === 'string') {
1074
- return inspectString(obj, opts);
1075
- }
1076
- if (typeof obj === 'number') {
1077
- if (obj === 0) {
1078
- return Infinity / obj > 0 ? '0' : '-0';
1079
- }
1080
- var str = String(obj);
1081
- return numericSeparator ? addNumericSeparator(obj, str) : str;
1082
- }
1083
- if (typeof obj === 'bigint') {
1084
- var bigIntStr = String(obj) + 'n';
1085
- return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
1086
- }
1087
-
1088
- var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
1089
- if (typeof depth === 'undefined') { depth = 0; }
1090
- if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
1091
- return isArray$3(obj) ? '[Array]' : '[Object]';
1092
- }
1093
-
1094
- var indent = getIndent(opts, depth);
1095
-
1096
- if (typeof seen === 'undefined') {
1097
- seen = [];
1098
- } else if (indexOf(seen, obj) >= 0) {
1099
- return '[Circular]';
1100
- }
576
+ var Card = function Card(_ref) {
577
+ var template = _ref.template,
578
+ onClick = _ref.onClick;
579
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
580
+ onClick: onClick,
581
+ className: "neeto-template neeto-template-thumbnail neeto-ui-bg-white neeto-ui-shadow-xs hover:neeto-ui-border-gray-500 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",
582
+ "data-cy": "template-card",
583
+ tabIndex: 0,
584
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
585
+ className: "neeto-template__header relative overflow-hidden",
586
+ children: /*#__PURE__*/jsxRuntime.jsx("img", {
587
+ className: "neeto-template__image",
588
+ "data-cy": "template-thumbnail-image",
589
+ src: template.imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
590
+ })
591
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
592
+ className: "neeto-template__description neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg px-3 py-1.5",
593
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
594
+ className: "neeto-template-thumbnail__title line-clamp-2",
595
+ "data-cy": "template-card-title",
596
+ lineHeight: "normal",
597
+ style: "h5",
598
+ children: template.title
599
+ })
600
+ })]
601
+ });
602
+ };
1101
603
 
1102
- function inspect(value, from, noIndent) {
1103
- if (from) {
1104
- seen = $arrSlice.call(seen);
1105
- seen.push(from);
1106
- }
1107
- if (noIndent) {
1108
- var newOpts = {
1109
- depth: opts.depth
1110
- };
1111
- if (has$3(opts, 'quoteStyle')) {
1112
- newOpts.quoteStyle = opts.quoteStyle;
1113
- }
1114
- return inspect_(value, newOpts, depth + 1, seen);
1115
- }
1116
- return inspect_(value, opts, depth + 1, seen);
1117
- }
604
+ var CategoryItem = function CategoryItem(_ref) {
605
+ var label = _ref.label,
606
+ count = _ref.count,
607
+ isActive = _ref.isActive,
608
+ setCurrentCategory = _ref.setCurrentCategory;
609
+ return /*#__PURE__*/jsxRuntime.jsxs("button", {
610
+ "data-cy": "category-".concat(utils.joinHyphenCase(label)),
611
+ tabIndex: 0,
612
+ 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", {
613
+ "neeto-ui-text-gray-700 hover:neeto-ui-bg-gray-200 focus:neeto-ui-bg-gray-200 border-transparent": !isActive,
614
+ "neeto-ui-text-gray-800 neeto-ui-bg-white neeto-ui-border-gray-300 focus:neeto-ui-border-gray-500": isActive
615
+ }),
616
+ onClick: setCurrentCategory,
617
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
618
+ children: label
619
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
620
+ children: count
621
+ })]
622
+ });
623
+ };
1118
624
 
1119
- if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
1120
- var name = nameOf(obj);
1121
- var keys = arrObjKeys(obj, inspect);
1122
- return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
1123
- }
1124
- if (isSymbol(obj)) {
1125
- var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
1126
- return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
1127
- }
1128
- if (isElement(obj)) {
1129
- var s = '<' + $toLowerCase.call(String(obj.nodeName));
1130
- var attrs = obj.attributes || [];
1131
- for (var i = 0; i < attrs.length; i++) {
1132
- s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
1133
- }
1134
- s += '>';
1135
- if (obj.childNodes && obj.childNodes.length) { s += '...'; }
1136
- s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
1137
- return s;
1138
- }
1139
- if (isArray$3(obj)) {
1140
- if (obj.length === 0) { return '[]'; }
1141
- var xs = arrObjKeys(obj, inspect);
1142
- if (indent && !singleLineValues(xs)) {
1143
- return '[' + indentedJoin(xs, indent) + ']';
1144
- }
1145
- return '[ ' + $join.call(xs, ', ') + ' ]';
1146
- }
1147
- if (isError(obj)) {
1148
- var parts = arrObjKeys(obj, inspect);
1149
- if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
1150
- return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
1151
- }
1152
- if (parts.length === 0) { return '[' + String(obj) + ']'; }
1153
- return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
1154
- }
1155
- if (typeof obj === 'object' && customInspect) {
1156
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
1157
- return utilInspect(obj, { depth: maxDepth - depth });
1158
- } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
1159
- return obj.inspect();
1160
- }
1161
- }
1162
- if (isMap(obj)) {
1163
- var mapParts = [];
1164
- if (mapForEach) {
1165
- mapForEach.call(obj, function (value, key) {
1166
- mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
625
+ 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; }
626
+ 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; }
627
+ var List = function List(_ref) {
628
+ var setCurrentScreen = _ref.setCurrentScreen,
629
+ setSelectedTemplate = _ref.setSelectedTemplate,
630
+ onCreate = _ref.onCreate,
631
+ isCreating = _ref.isCreating,
632
+ afterCreate = _ref.afterCreate,
633
+ refetchResource = _ref.refetchResource;
634
+ var _useTranslation = reactI18next.useTranslation(),
635
+ t = _useTranslation.t;
636
+ var _useState = React.useState(DEFAULT_CATEGORY),
637
+ _useState2 = _slicedToArray(_useState, 2),
638
+ currentCategory = _useState2[0],
639
+ _setCurrentCategory = _useState2[1];
640
+ var _useState3 = React.useState(""),
641
+ _useState4 = _slicedToArray(_useState3, 2),
642
+ searchTerm = _useState4[0],
643
+ setSearchTerm = _useState4[1];
644
+ var _useFetchTemplates = useFetchTemplates({
645
+ searchTerm: searchTerm,
646
+ category: currentCategory
647
+ }),
648
+ _useFetchTemplates$ha = _useFetchTemplates.hasNextPage,
649
+ hasNextPage = _useFetchTemplates$ha === void 0 ? false : _useFetchTemplates$ha,
650
+ fetchNextPage = _useFetchTemplates.fetchNextPage,
651
+ isTemplatesLoading = _useFetchTemplates.isLoading,
652
+ _useFetchTemplates$da = _useFetchTemplates.data,
653
+ data = _useFetchTemplates$da === void 0 ? {} : _useFetchTemplates$da;
654
+ var _useInfiniteScroll = useInfiniteScroll({
655
+ loading: isTemplatesLoading,
656
+ hasNextPage: hasNextPage,
657
+ onLoadMore: fetchNextPage,
658
+ rootMargin: "0px 0px 700px 0px",
659
+ delayInMs: INFINITE_SCROLL_DELAY
660
+ }),
661
+ _useInfiniteScroll2 = _slicedToArray(_useInfiniteScroll, 2),
662
+ sentryRef = _useInfiniteScroll2[0],
663
+ rootRef = _useInfiniteScroll2[1].rootRef;
664
+ var handleCardClick = function handleCardClick(template) {
665
+ setCurrentScreen(TEMPLATE_SCREENS.PREVIEW);
666
+ setSelectedTemplate(template);
667
+ };
668
+ if (isTemplatesLoading) {
669
+ return /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {});
670
+ }
671
+ var _data$tags = data.tags,
672
+ tags = _data$tags === void 0 ? [] : _data$tags,
673
+ _data$templates = data.templates,
674
+ templates = _data$templates === void 0 ? [] : _data$templates,
675
+ _data$templatesCount = data.templatesCount,
676
+ templatesCount = _data$templatesCount === void 0 ? 0 : _data$templatesCount;
677
+ var categories = [_objectSpread$4(_objectSpread$4({}, DEFAULT_CATEGORY), {}, {
678
+ count: templatesCount
679
+ })].concat(_toConsumableArray(tags));
680
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
681
+ className: "neeto-ui-bg-gray-100 relative flex min-h-full items-start",
682
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
683
+ 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",
684
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
685
+ className: "space-y-4",
686
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
687
+ className: "space-y-1",
688
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
689
+ "data-cy": "create-new-form-title",
690
+ style: "h2",
691
+ weight: "semibold",
692
+ children: t("neetoTemplate.templates.createNewEntity")
693
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
694
+ lineHeight: "normal",
695
+ style: "body2",
696
+ children: t("neetoTemplate.templates.description")
697
+ })]
698
+ }), /*#__PURE__*/jsxRuntime.jsx(Search__default["default"], {
699
+ autoFocus: true,
700
+ disableTrimOnBlur: true,
701
+ "data-cy": "template-search-input",
702
+ placeholder: t("neetoTemplate.templates.search"),
703
+ onSearch: function onSearch(value) {
704
+ return setSearchTerm(value);
705
+ }
706
+ })]
707
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
708
+ className: "space-y-3",
709
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
710
+ className: "uppercase",
711
+ "data-cy": "template-categories-label",
712
+ style: "h6",
713
+ children: t("neetoTemplate.templates.categories")
714
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
715
+ className: "space-y-2",
716
+ children: categories.map(function (_ref2) {
717
+ var id = _ref2.id,
718
+ name = _ref2.name,
719
+ count = _ref2.count;
720
+ return /*#__PURE__*/React.createElement(CategoryItem, {
721
+ count: count,
722
+ isActive: currentCategory.id === id,
723
+ key: id,
724
+ label: name,
725
+ setCurrentCategory: function setCurrentCategory() {
726
+ return _setCurrentCategory({
727
+ id: id,
728
+ name: name
729
+ });
730
+ }
1167
731
  });
1168
- }
1169
- return collectionOf('Map', mapSize.call(obj), mapParts, indent);
1170
- }
1171
- if (isSet(obj)) {
1172
- var setParts = [];
1173
- if (setForEach) {
1174
- setForEach.call(obj, function (value) {
1175
- setParts.push(inspect(value, obj));
732
+ })
733
+ })]
734
+ })]
735
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
736
+ className: "h-screen w-full overflow-y-auto py-8 pl-5 pr-4 md:pl-8 md:pr-20 xl:px-20",
737
+ ref: rootRef,
738
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
739
+ className: "flex-grow space-y-6",
740
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
741
+ 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",
742
+ children: [/*#__PURE__*/jsxRuntime.jsx(BlankCard, {
743
+ description: t("neetoTemplate.templates.blankCard.description"),
744
+ disabled: isCreating,
745
+ icon: isCreating ? Spinner__default["default"] : SvgCustom,
746
+ title: t("neetoTemplate.templates.blankCard.title"),
747
+ onClick: onCreate
748
+ }), templates.map(function (template, index) {
749
+ return /*#__PURE__*/React.createElement(Card, {
750
+ afterCreate: afterCreate,
751
+ refetchResource: refetchResource,
752
+ template: template,
753
+ key: index,
754
+ onClick: function onClick() {
755
+ return handleCardClick(template);
756
+ }
1176
757
  });
1177
- }
1178
- return collectionOf('Set', setSize.call(obj), setParts, indent);
1179
- }
1180
- if (isWeakMap(obj)) {
1181
- return weakCollectionOf('WeakMap');
1182
- }
1183
- if (isWeakSet(obj)) {
1184
- return weakCollectionOf('WeakSet');
1185
- }
1186
- if (isWeakRef(obj)) {
1187
- return weakCollectionOf('WeakRef');
1188
- }
1189
- if (isNumber(obj)) {
1190
- return markBoxed(inspect(Number(obj)));
1191
- }
1192
- if (isBigInt(obj)) {
1193
- return markBoxed(inspect(bigIntValueOf.call(obj)));
1194
- }
1195
- if (isBoolean(obj)) {
1196
- return markBoxed(booleanValueOf.call(obj));
1197
- }
1198
- if (isString(obj)) {
1199
- return markBoxed(inspect(String(obj)));
1200
- }
1201
- if (!isDate(obj) && !isRegExp$1(obj)) {
1202
- var ys = arrObjKeys(obj, inspect);
1203
- var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
1204
- var protoTag = obj instanceof Object ? '' : 'null prototype';
1205
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
1206
- var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
1207
- var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
1208
- if (ys.length === 0) { return tag + '{}'; }
1209
- if (indent) {
1210
- return tag + '{' + indentedJoin(ys, indent) + '}';
1211
- }
1212
- return tag + '{ ' + $join.call(ys, ', ') + ' }';
1213
- }
1214
- return String(obj);
1215
- };
1216
-
1217
- function wrapQuotes(s, defaultStyle, opts) {
1218
- var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
1219
- return quoteChar + s + quoteChar;
1220
- }
1221
-
1222
- function quote(s) {
1223
- return $replace.call(String(s), /"/g, '&quot;');
1224
- }
1225
-
1226
- function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1227
- function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1228
- function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1229
- function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1230
- function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1231
- function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1232
- function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1233
-
1234
- // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
1235
- function isSymbol(obj) {
1236
- if (hasShammedSymbols) {
1237
- return obj && typeof obj === 'object' && obj instanceof Symbol;
1238
- }
1239
- if (typeof obj === 'symbol') {
1240
- return true;
1241
- }
1242
- if (!obj || typeof obj !== 'object' || !symToString) {
1243
- return false;
1244
- }
1245
- try {
1246
- symToString.call(obj);
1247
- return true;
1248
- } catch (e) {}
1249
- return false;
1250
- }
1251
-
1252
- function isBigInt(obj) {
1253
- if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
1254
- return false;
1255
- }
1256
- try {
1257
- bigIntValueOf.call(obj);
1258
- return true;
1259
- } catch (e) {}
1260
- return false;
1261
- }
1262
-
1263
- var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
1264
- function has$3(obj, key) {
1265
- return hasOwn.call(obj, key);
1266
- }
1267
-
1268
- function toStr(obj) {
1269
- return objectToString.call(obj);
1270
- }
1271
-
1272
- function nameOf(f) {
1273
- if (f.name) { return f.name; }
1274
- var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
1275
- if (m) { return m[1]; }
1276
- return null;
1277
- }
1278
-
1279
- function indexOf(xs, x) {
1280
- if (xs.indexOf) { return xs.indexOf(x); }
1281
- for (var i = 0, l = xs.length; i < l; i++) {
1282
- if (xs[i] === x) { return i; }
1283
- }
1284
- return -1;
1285
- }
1286
-
1287
- function isMap(x) {
1288
- if (!mapSize || !x || typeof x !== 'object') {
1289
- return false;
1290
- }
1291
- try {
1292
- mapSize.call(x);
1293
- try {
1294
- setSize.call(x);
1295
- } catch (s) {
1296
- return true;
1297
- }
1298
- return x instanceof Map; // core-js workaround, pre-v2.5.0
1299
- } catch (e) {}
1300
- return false;
1301
- }
1302
-
1303
- function isWeakMap(x) {
1304
- if (!weakMapHas || !x || typeof x !== 'object') {
1305
- return false;
1306
- }
1307
- try {
1308
- weakMapHas.call(x, weakMapHas);
1309
- try {
1310
- weakSetHas.call(x, weakSetHas);
1311
- } catch (s) {
1312
- return true;
1313
- }
1314
- return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
1315
- } catch (e) {}
1316
- return false;
1317
- }
1318
-
1319
- function isWeakRef(x) {
1320
- if (!weakRefDeref || !x || typeof x !== 'object') {
1321
- return false;
1322
- }
1323
- try {
1324
- weakRefDeref.call(x);
1325
- return true;
1326
- } catch (e) {}
1327
- return false;
1328
- }
1329
-
1330
- function isSet(x) {
1331
- if (!setSize || !x || typeof x !== 'object') {
1332
- return false;
1333
- }
1334
- try {
1335
- setSize.call(x);
1336
- try {
1337
- mapSize.call(x);
1338
- } catch (m) {
1339
- return true;
1340
- }
1341
- return x instanceof Set; // core-js workaround, pre-v2.5.0
1342
- } catch (e) {}
1343
- return false;
1344
- }
1345
-
1346
- function isWeakSet(x) {
1347
- if (!weakSetHas || !x || typeof x !== 'object') {
1348
- return false;
1349
- }
1350
- try {
1351
- weakSetHas.call(x, weakSetHas);
1352
- try {
1353
- weakMapHas.call(x, weakMapHas);
1354
- } catch (s) {
1355
- return true;
1356
- }
1357
- return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
1358
- } catch (e) {}
1359
- return false;
1360
- }
1361
-
1362
- function isElement(x) {
1363
- if (!x || typeof x !== 'object') { return false; }
1364
- if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
1365
- return true;
1366
- }
1367
- return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
1368
- }
1369
-
1370
- function inspectString(str, opts) {
1371
- if (str.length > opts.maxStringLength) {
1372
- var remaining = str.length - opts.maxStringLength;
1373
- var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
1374
- return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
1375
- }
1376
- // eslint-disable-next-line no-control-regex
1377
- var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
1378
- return wrapQuotes(s, 'single', opts);
1379
- }
1380
-
1381
- function lowbyte(c) {
1382
- var n = c.charCodeAt(0);
1383
- var x = {
1384
- 8: 'b',
1385
- 9: 't',
1386
- 10: 'n',
1387
- 12: 'f',
1388
- 13: 'r'
1389
- }[n];
1390
- if (x) { return '\\' + x; }
1391
- return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
1392
- }
1393
-
1394
- function markBoxed(str) {
1395
- return 'Object(' + str + ')';
1396
- }
1397
-
1398
- function weakCollectionOf(type) {
1399
- return type + ' { ? }';
1400
- }
1401
-
1402
- function collectionOf(type, size, entries, indent) {
1403
- var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
1404
- return type + ' (' + size + ') {' + joinedEntries + '}';
1405
- }
1406
-
1407
- function singleLineValues(xs) {
1408
- for (var i = 0; i < xs.length; i++) {
1409
- if (indexOf(xs[i], '\n') >= 0) {
1410
- return false;
1411
- }
1412
- }
1413
- return true;
1414
- }
1415
-
1416
- function getIndent(opts, depth) {
1417
- var baseIndent;
1418
- if (opts.indent === '\t') {
1419
- baseIndent = '\t';
1420
- } else if (typeof opts.indent === 'number' && opts.indent > 0) {
1421
- baseIndent = $join.call(Array(opts.indent + 1), ' ');
1422
- } else {
1423
- return null;
1424
- }
1425
- return {
1426
- base: baseIndent,
1427
- prev: $join.call(Array(depth + 1), baseIndent)
1428
- };
1429
- }
1430
-
1431
- function indentedJoin(xs, indent) {
1432
- if (xs.length === 0) { return ''; }
1433
- var lineJoiner = '\n' + indent.prev + indent.base;
1434
- return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
1435
- }
1436
-
1437
- function arrObjKeys(obj, inspect) {
1438
- var isArr = isArray$3(obj);
1439
- var xs = [];
1440
- if (isArr) {
1441
- xs.length = obj.length;
1442
- for (var i = 0; i < obj.length; i++) {
1443
- xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
1444
- }
1445
- }
1446
- var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
1447
- var symMap;
1448
- if (hasShammedSymbols) {
1449
- symMap = {};
1450
- for (var k = 0; k < syms.length; k++) {
1451
- symMap['$' + syms[k]] = syms[k];
1452
- }
1453
- }
1454
-
1455
- for (var key in obj) { // eslint-disable-line no-restricted-syntax
1456
- if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1457
- if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1458
- if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1459
- // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
1460
- continue; // eslint-disable-line no-restricted-syntax, no-continue
1461
- } else if ($test.call(/[^\w$]/, key)) {
1462
- xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1463
- } else {
1464
- xs.push(key + ': ' + inspect(obj[key], obj));
1465
- }
1466
- }
1467
- if (typeof gOPS === 'function') {
1468
- for (var j = 0; j < syms.length; j++) {
1469
- if (isEnumerable.call(obj, syms[j])) {
1470
- xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1471
- }
1472
- }
1473
- }
1474
- return xs;
1475
- }
1476
-
1477
- var GetIntrinsic = getIntrinsic;
1478
- var callBound = callBound$1;
1479
- var inspect = objectInspect;
1480
-
1481
- var $TypeError = GetIntrinsic('%TypeError%');
1482
- var $WeakMap = GetIntrinsic('%WeakMap%', true);
1483
- var $Map = GetIntrinsic('%Map%', true);
1484
-
1485
- var $weakMapGet = callBound('WeakMap.prototype.get', true);
1486
- var $weakMapSet = callBound('WeakMap.prototype.set', true);
1487
- var $weakMapHas = callBound('WeakMap.prototype.has', true);
1488
- var $mapGet = callBound('Map.prototype.get', true);
1489
- var $mapSet = callBound('Map.prototype.set', true);
1490
- var $mapHas = callBound('Map.prototype.has', true);
1491
-
1492
- /*
1493
- * This function traverses the list returning the node corresponding to the
1494
- * given key.
1495
- *
1496
- * That node is also moved to the head of the list, so that if it's accessed
1497
- * again we don't need to traverse the whole list. By doing so, all the recently
1498
- * used nodes can be accessed relatively quickly.
1499
- */
1500
- var listGetNode = function (list, key) { // eslint-disable-line consistent-return
1501
- for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1502
- if (curr.key === key) {
1503
- prev.next = curr.next;
1504
- curr.next = list.next;
1505
- list.next = curr; // eslint-disable-line no-param-reassign
1506
- return curr;
1507
- }
1508
- }
1509
- };
1510
-
1511
- var listGet = function (objects, key) {
1512
- var node = listGetNode(objects, key);
1513
- return node && node.value;
1514
- };
1515
- var listSet = function (objects, key, value) {
1516
- var node = listGetNode(objects, key);
1517
- if (node) {
1518
- node.value = value;
1519
- } else {
1520
- // Prepend the new node to the beginning of the list
1521
- objects.next = { // eslint-disable-line no-param-reassign
1522
- key: key,
1523
- next: objects.next,
1524
- value: value
1525
- };
1526
- }
1527
- };
1528
- var listHas = function (objects, key) {
1529
- return !!listGetNode(objects, key);
1530
- };
1531
-
1532
- var sideChannel = function getSideChannel() {
1533
- var $wm;
1534
- var $m;
1535
- var $o;
1536
- var channel = {
1537
- assert: function (key) {
1538
- if (!channel.has(key)) {
1539
- throw new $TypeError('Side channel does not contain ' + inspect(key));
1540
- }
1541
- },
1542
- get: function (key) { // eslint-disable-line consistent-return
1543
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1544
- if ($wm) {
1545
- return $weakMapGet($wm, key);
1546
- }
1547
- } else if ($Map) {
1548
- if ($m) {
1549
- return $mapGet($m, key);
1550
- }
1551
- } else {
1552
- if ($o) { // eslint-disable-line no-lonely-if
1553
- return listGet($o, key);
1554
- }
1555
- }
1556
- },
1557
- has: function (key) {
1558
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1559
- if ($wm) {
1560
- return $weakMapHas($wm, key);
1561
- }
1562
- } else if ($Map) {
1563
- if ($m) {
1564
- return $mapHas($m, key);
1565
- }
1566
- } else {
1567
- if ($o) { // eslint-disable-line no-lonely-if
1568
- return listHas($o, key);
1569
- }
1570
- }
1571
- return false;
1572
- },
1573
- set: function (key, value) {
1574
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1575
- if (!$wm) {
1576
- $wm = new $WeakMap();
1577
- }
1578
- $weakMapSet($wm, key, value);
1579
- } else if ($Map) {
1580
- if (!$m) {
1581
- $m = new $Map();
1582
- }
1583
- $mapSet($m, key, value);
1584
- } else {
1585
- if (!$o) {
1586
- /*
1587
- * Initialize the linked list as an empty node, so that we don't have
1588
- * to special-case handling of the first node: we can always refer to
1589
- * it as (previous node).next, instead of something like (list).head
1590
- */
1591
- $o = { key: {}, next: null };
1592
- }
1593
- listSet($o, key, value);
1594
- }
1595
- }
1596
- };
1597
- return channel;
1598
- };
1599
-
1600
- var replace = String.prototype.replace;
1601
- var percentTwenties = /%20/g;
1602
-
1603
- var Format = {
1604
- RFC1738: 'RFC1738',
1605
- RFC3986: 'RFC3986'
1606
- };
1607
-
1608
- var formats$3 = {
1609
- 'default': Format.RFC3986,
1610
- formatters: {
1611
- RFC1738: function (value) {
1612
- return replace.call(value, percentTwenties, '+');
1613
- },
1614
- RFC3986: function (value) {
1615
- return String(value);
1616
- }
1617
- },
1618
- RFC1738: Format.RFC1738,
1619
- RFC3986: Format.RFC3986
1620
- };
1621
-
1622
- var formats$2 = formats$3;
1623
-
1624
- var has$2 = Object.prototype.hasOwnProperty;
1625
- var isArray$2 = Array.isArray;
1626
-
1627
- var hexTable = (function () {
1628
- var array = [];
1629
- for (var i = 0; i < 256; ++i) {
1630
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1631
- }
1632
-
1633
- return array;
1634
- }());
1635
-
1636
- var compactQueue = function compactQueue(queue) {
1637
- while (queue.length > 1) {
1638
- var item = queue.pop();
1639
- var obj = item.obj[item.prop];
1640
-
1641
- if (isArray$2(obj)) {
1642
- var compacted = [];
1643
-
1644
- for (var j = 0; j < obj.length; ++j) {
1645
- if (typeof obj[j] !== 'undefined') {
1646
- compacted.push(obj[j]);
1647
- }
1648
- }
1649
-
1650
- item.obj[item.prop] = compacted;
1651
- }
1652
- }
1653
- };
1654
-
1655
- var arrayToObject = function arrayToObject(source, options) {
1656
- var obj = options && options.plainObjects ? Object.create(null) : {};
1657
- for (var i = 0; i < source.length; ++i) {
1658
- if (typeof source[i] !== 'undefined') {
1659
- obj[i] = source[i];
1660
- }
1661
- }
1662
-
1663
- return obj;
1664
- };
1665
-
1666
- var merge = function merge(target, source, options) {
1667
- /* eslint no-param-reassign: 0 */
1668
- if (!source) {
1669
- return target;
1670
- }
1671
-
1672
- if (typeof source !== 'object') {
1673
- if (isArray$2(target)) {
1674
- target.push(source);
1675
- } else if (target && typeof target === 'object') {
1676
- if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
1677
- target[source] = true;
1678
- }
1679
- } else {
1680
- return [target, source];
1681
- }
1682
-
1683
- return target;
1684
- }
1685
-
1686
- if (!target || typeof target !== 'object') {
1687
- return [target].concat(source);
1688
- }
1689
-
1690
- var mergeTarget = target;
1691
- if (isArray$2(target) && !isArray$2(source)) {
1692
- mergeTarget = arrayToObject(target, options);
1693
- }
1694
-
1695
- if (isArray$2(target) && isArray$2(source)) {
1696
- source.forEach(function (item, i) {
1697
- if (has$2.call(target, i)) {
1698
- var targetItem = target[i];
1699
- if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1700
- target[i] = merge(targetItem, item, options);
1701
- } else {
1702
- target.push(item);
1703
- }
1704
- } else {
1705
- target[i] = item;
1706
- }
1707
- });
1708
- return target;
1709
- }
1710
-
1711
- return Object.keys(source).reduce(function (acc, key) {
1712
- var value = source[key];
1713
-
1714
- if (has$2.call(acc, key)) {
1715
- acc[key] = merge(acc[key], value, options);
1716
- } else {
1717
- acc[key] = value;
1718
- }
1719
- return acc;
1720
- }, mergeTarget);
1721
- };
1722
-
1723
- var assign = function assignSingleSource(target, source) {
1724
- return Object.keys(source).reduce(function (acc, key) {
1725
- acc[key] = source[key];
1726
- return acc;
1727
- }, target);
1728
- };
1729
-
1730
- var decode = function (str, decoder, charset) {
1731
- var strWithoutPlus = str.replace(/\+/g, ' ');
1732
- if (charset === 'iso-8859-1') {
1733
- // unescape never throws, no try...catch needed:
1734
- return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1735
- }
1736
- // utf-8
1737
- try {
1738
- return decodeURIComponent(strWithoutPlus);
1739
- } catch (e) {
1740
- return strWithoutPlus;
1741
- }
1742
- };
1743
-
1744
- var encode = function encode(str, defaultEncoder, charset, kind, format) {
1745
- // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1746
- // It has been adapted here for stricter adherence to RFC 3986
1747
- if (str.length === 0) {
1748
- return str;
1749
- }
1750
-
1751
- var string = str;
1752
- if (typeof str === 'symbol') {
1753
- string = Symbol.prototype.toString.call(str);
1754
- } else if (typeof str !== 'string') {
1755
- string = String(str);
1756
- }
1757
-
1758
- if (charset === 'iso-8859-1') {
1759
- return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1760
- return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1761
- });
1762
- }
1763
-
1764
- var out = '';
1765
- for (var i = 0; i < string.length; ++i) {
1766
- var c = string.charCodeAt(i);
1767
-
1768
- if (
1769
- c === 0x2D // -
1770
- || c === 0x2E // .
1771
- || c === 0x5F // _
1772
- || c === 0x7E // ~
1773
- || (c >= 0x30 && c <= 0x39) // 0-9
1774
- || (c >= 0x41 && c <= 0x5A) // a-z
1775
- || (c >= 0x61 && c <= 0x7A) // A-Z
1776
- || (format === formats$2.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
1777
- ) {
1778
- out += string.charAt(i);
1779
- continue;
1780
- }
1781
-
1782
- if (c < 0x80) {
1783
- out = out + hexTable[c];
1784
- continue;
1785
- }
1786
-
1787
- if (c < 0x800) {
1788
- out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
1789
- continue;
1790
- }
1791
-
1792
- if (c < 0xD800 || c >= 0xE000) {
1793
- out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
1794
- continue;
1795
- }
1796
-
1797
- i += 1;
1798
- c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
1799
- /* eslint operator-linebreak: [2, "before"] */
1800
- out += hexTable[0xF0 | (c >> 18)]
1801
- + hexTable[0x80 | ((c >> 12) & 0x3F)]
1802
- + hexTable[0x80 | ((c >> 6) & 0x3F)]
1803
- + hexTable[0x80 | (c & 0x3F)];
1804
- }
1805
-
1806
- return out;
1807
- };
1808
-
1809
- var compact = function compact(value) {
1810
- var queue = [{ obj: { o: value }, prop: 'o' }];
1811
- var refs = [];
1812
-
1813
- for (var i = 0; i < queue.length; ++i) {
1814
- var item = queue[i];
1815
- var obj = item.obj[item.prop];
1816
-
1817
- var keys = Object.keys(obj);
1818
- for (var j = 0; j < keys.length; ++j) {
1819
- var key = keys[j];
1820
- var val = obj[key];
1821
- if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
1822
- queue.push({ obj: obj, prop: key });
1823
- refs.push(val);
1824
- }
1825
- }
1826
- }
1827
-
1828
- compactQueue(queue);
1829
-
1830
- return value;
1831
- };
1832
-
1833
- var isRegExp = function isRegExp(obj) {
1834
- return Object.prototype.toString.call(obj) === '[object RegExp]';
1835
- };
1836
-
1837
- var isBuffer = function isBuffer(obj) {
1838
- if (!obj || typeof obj !== 'object') {
1839
- return false;
1840
- }
1841
-
1842
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1843
- };
1844
-
1845
- var combine = function combine(a, b) {
1846
- return [].concat(a, b);
1847
- };
1848
-
1849
- var maybeMap = function maybeMap(val, fn) {
1850
- if (isArray$2(val)) {
1851
- var mapped = [];
1852
- for (var i = 0; i < val.length; i += 1) {
1853
- mapped.push(fn(val[i]));
1854
- }
1855
- return mapped;
1856
- }
1857
- return fn(val);
1858
- };
1859
-
1860
- var utils$2 = {
1861
- arrayToObject: arrayToObject,
1862
- assign: assign,
1863
- combine: combine,
1864
- compact: compact,
1865
- decode: decode,
1866
- encode: encode,
1867
- isBuffer: isBuffer,
1868
- isRegExp: isRegExp,
1869
- maybeMap: maybeMap,
1870
- merge: merge
1871
- };
1872
-
1873
- var getSideChannel = sideChannel;
1874
- var utils$1 = utils$2;
1875
- var formats$1 = formats$3;
1876
- var has$1 = Object.prototype.hasOwnProperty;
1877
-
1878
- var arrayPrefixGenerators = {
1879
- brackets: function brackets(prefix) {
1880
- return prefix + '[]';
1881
- },
1882
- comma: 'comma',
1883
- indices: function indices(prefix, key) {
1884
- return prefix + '[' + key + ']';
1885
- },
1886
- repeat: function repeat(prefix) {
1887
- return prefix;
1888
- }
1889
- };
1890
-
1891
- var isArray$1 = Array.isArray;
1892
- var push = Array.prototype.push;
1893
- var pushToArray = function (arr, valueOrArray) {
1894
- push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
1895
- };
1896
-
1897
- var toISO = Date.prototype.toISOString;
1898
-
1899
- var defaultFormat = formats$1['default'];
1900
- var defaults$1 = {
1901
- addQueryPrefix: false,
1902
- allowDots: false,
1903
- charset: 'utf-8',
1904
- charsetSentinel: false,
1905
- delimiter: '&',
1906
- encode: true,
1907
- encoder: utils$1.encode,
1908
- encodeValuesOnly: false,
1909
- format: defaultFormat,
1910
- formatter: formats$1.formatters[defaultFormat],
1911
- // deprecated
1912
- indices: false,
1913
- serializeDate: function serializeDate(date) {
1914
- return toISO.call(date);
1915
- },
1916
- skipNulls: false,
1917
- strictNullHandling: false
1918
- };
1919
-
1920
- var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
1921
- return typeof v === 'string'
1922
- || typeof v === 'number'
1923
- || typeof v === 'boolean'
1924
- || typeof v === 'symbol'
1925
- || typeof v === 'bigint';
1926
- };
1927
-
1928
- var sentinel = {};
1929
-
1930
- var stringify$1 = function stringify(
1931
- object,
1932
- prefix,
1933
- generateArrayPrefix,
1934
- commaRoundTrip,
1935
- strictNullHandling,
1936
- skipNulls,
1937
- encoder,
1938
- filter,
1939
- sort,
1940
- allowDots,
1941
- serializeDate,
1942
- format,
1943
- formatter,
1944
- encodeValuesOnly,
1945
- charset,
1946
- sideChannel
1947
- ) {
1948
- var obj = object;
1949
-
1950
- var tmpSc = sideChannel;
1951
- var step = 0;
1952
- var findFlag = false;
1953
- while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
1954
- // Where object last appeared in the ref tree
1955
- var pos = tmpSc.get(object);
1956
- step += 1;
1957
- if (typeof pos !== 'undefined') {
1958
- if (pos === step) {
1959
- throw new RangeError('Cyclic object value');
1960
- } else {
1961
- findFlag = true; // Break while
1962
- }
1963
- }
1964
- if (typeof tmpSc.get(sentinel) === 'undefined') {
1965
- step = 0;
1966
- }
1967
- }
1968
-
1969
- if (typeof filter === 'function') {
1970
- obj = filter(prefix, obj);
1971
- } else if (obj instanceof Date) {
1972
- obj = serializeDate(obj);
1973
- } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
1974
- obj = utils$1.maybeMap(obj, function (value) {
1975
- if (value instanceof Date) {
1976
- return serializeDate(value);
1977
- }
1978
- return value;
1979
- });
1980
- }
1981
-
1982
- if (obj === null) {
1983
- if (strictNullHandling) {
1984
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
1985
- }
1986
-
1987
- obj = '';
1988
- }
1989
-
1990
- if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
1991
- if (encoder) {
1992
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
1993
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
1994
- }
1995
- return [formatter(prefix) + '=' + formatter(String(obj))];
1996
- }
1997
-
1998
- var values = [];
1999
-
2000
- if (typeof obj === 'undefined') {
2001
- return values;
2002
- }
2003
-
2004
- var objKeys;
2005
- if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
2006
- // we need to join elements in
2007
- if (encodeValuesOnly && encoder) {
2008
- obj = utils$1.maybeMap(obj, encoder);
2009
- }
2010
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
2011
- } else if (isArray$1(filter)) {
2012
- objKeys = filter;
2013
- } else {
2014
- var keys = Object.keys(obj);
2015
- objKeys = sort ? keys.sort(sort) : keys;
2016
- }
2017
-
2018
- var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
2019
-
2020
- for (var j = 0; j < objKeys.length; ++j) {
2021
- var key = objKeys[j];
2022
- var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
2023
-
2024
- if (skipNulls && value === null) {
2025
- continue;
2026
- }
2027
-
2028
- var keyPrefix = isArray$1(obj)
2029
- ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
2030
- : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
2031
-
2032
- sideChannel.set(object, step);
2033
- var valueSideChannel = getSideChannel();
2034
- valueSideChannel.set(sentinel, sideChannel);
2035
- pushToArray(values, stringify(
2036
- value,
2037
- keyPrefix,
2038
- generateArrayPrefix,
2039
- commaRoundTrip,
2040
- strictNullHandling,
2041
- skipNulls,
2042
- generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$1(obj) ? null : encoder,
2043
- filter,
2044
- sort,
2045
- allowDots,
2046
- serializeDate,
2047
- format,
2048
- formatter,
2049
- encodeValuesOnly,
2050
- charset,
2051
- valueSideChannel
2052
- ));
2053
- }
2054
-
2055
- return values;
2056
- };
2057
-
2058
- var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
2059
- if (!opts) {
2060
- return defaults$1;
2061
- }
2062
-
2063
- if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
2064
- throw new TypeError('Encoder has to be a function.');
2065
- }
2066
-
2067
- var charset = opts.charset || defaults$1.charset;
2068
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2069
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2070
- }
2071
-
2072
- var format = formats$1['default'];
2073
- if (typeof opts.format !== 'undefined') {
2074
- if (!has$1.call(formats$1.formatters, opts.format)) {
2075
- throw new TypeError('Unknown format option provided.');
2076
- }
2077
- format = opts.format;
2078
- }
2079
- var formatter = formats$1.formatters[format];
2080
-
2081
- var filter = defaults$1.filter;
2082
- if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
2083
- filter = opts.filter;
2084
- }
2085
-
2086
- return {
2087
- addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
2088
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
2089
- charset: charset,
2090
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
2091
- delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
2092
- encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
2093
- encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
2094
- encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
2095
- filter: filter,
2096
- format: format,
2097
- formatter: formatter,
2098
- serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
2099
- skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
2100
- sort: typeof opts.sort === 'function' ? opts.sort : null,
2101
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
2102
- };
2103
- };
2104
-
2105
- var stringify_1 = function (object, opts) {
2106
- var obj = object;
2107
- var options = normalizeStringifyOptions(opts);
2108
-
2109
- var objKeys;
2110
- var filter;
2111
-
2112
- if (typeof options.filter === 'function') {
2113
- filter = options.filter;
2114
- obj = filter('', obj);
2115
- } else if (isArray$1(options.filter)) {
2116
- filter = options.filter;
2117
- objKeys = filter;
2118
- }
2119
-
2120
- var keys = [];
2121
-
2122
- if (typeof obj !== 'object' || obj === null) {
2123
- return '';
2124
- }
2125
-
2126
- var arrayFormat;
2127
- if (opts && opts.arrayFormat in arrayPrefixGenerators) {
2128
- arrayFormat = opts.arrayFormat;
2129
- } else if (opts && 'indices' in opts) {
2130
- arrayFormat = opts.indices ? 'indices' : 'repeat';
2131
- } else {
2132
- arrayFormat = 'indices';
2133
- }
2134
-
2135
- var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
2136
- if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
2137
- throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
2138
- }
2139
- var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
2140
-
2141
- if (!objKeys) {
2142
- objKeys = Object.keys(obj);
2143
- }
2144
-
2145
- if (options.sort) {
2146
- objKeys.sort(options.sort);
2147
- }
2148
-
2149
- var sideChannel = getSideChannel();
2150
- for (var i = 0; i < objKeys.length; ++i) {
2151
- var key = objKeys[i];
2152
-
2153
- if (options.skipNulls && obj[key] === null) {
2154
- continue;
2155
- }
2156
- pushToArray(keys, stringify$1(
2157
- obj[key],
2158
- key,
2159
- generateArrayPrefix,
2160
- commaRoundTrip,
2161
- options.strictNullHandling,
2162
- options.skipNulls,
2163
- options.encode ? options.encoder : null,
2164
- options.filter,
2165
- options.sort,
2166
- options.allowDots,
2167
- options.serializeDate,
2168
- options.format,
2169
- options.formatter,
2170
- options.encodeValuesOnly,
2171
- options.charset,
2172
- sideChannel
2173
- ));
2174
- }
2175
-
2176
- var joined = keys.join(options.delimiter);
2177
- var prefix = options.addQueryPrefix === true ? '?' : '';
2178
-
2179
- if (options.charsetSentinel) {
2180
- if (options.charset === 'iso-8859-1') {
2181
- // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
2182
- prefix += 'utf8=%26%2310003%3B&';
2183
- } else {
2184
- // encodeURIComponent('✓')
2185
- prefix += 'utf8=%E2%9C%93&';
2186
- }
2187
- }
2188
-
2189
- return joined.length > 0 ? prefix + joined : '';
2190
- };
2191
-
2192
- var utils = utils$2;
2193
-
2194
- var has = Object.prototype.hasOwnProperty;
2195
- var isArray = Array.isArray;
2196
-
2197
- var defaults = {
2198
- allowDots: false,
2199
- allowPrototypes: false,
2200
- allowSparse: false,
2201
- arrayLimit: 20,
2202
- charset: 'utf-8',
2203
- charsetSentinel: false,
2204
- comma: false,
2205
- decoder: utils.decode,
2206
- delimiter: '&',
2207
- depth: 5,
2208
- ignoreQueryPrefix: false,
2209
- interpretNumericEntities: false,
2210
- parameterLimit: 1000,
2211
- parseArrays: true,
2212
- plainObjects: false,
2213
- strictNullHandling: false
2214
- };
2215
-
2216
- var interpretNumericEntities = function (str) {
2217
- return str.replace(/&#(\d+);/g, function ($0, numberStr) {
2218
- return String.fromCharCode(parseInt(numberStr, 10));
2219
- });
2220
- };
2221
-
2222
- var parseArrayValue = function (val, options) {
2223
- if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
2224
- return val.split(',');
2225
- }
2226
-
2227
- return val;
2228
- };
2229
-
2230
- // This is what browsers will submit when the ✓ character occurs in an
2231
- // application/x-www-form-urlencoded body and the encoding of the page containing
2232
- // the form is iso-8859-1, or when the submitted form has an accept-charset
2233
- // attribute of iso-8859-1. Presumably also with other charsets that do not contain
2234
- // the ✓ character, such as us-ascii.
2235
- var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
2236
-
2237
- // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
2238
- var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
2239
-
2240
- var parseValues = function parseQueryStringValues(str, options) {
2241
- var obj = { __proto__: null };
2242
-
2243
- var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
2244
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
2245
- var parts = cleanStr.split(options.delimiter, limit);
2246
- var skipIndex = -1; // Keep track of where the utf8 sentinel was found
2247
- var i;
2248
-
2249
- var charset = options.charset;
2250
- if (options.charsetSentinel) {
2251
- for (i = 0; i < parts.length; ++i) {
2252
- if (parts[i].indexOf('utf8=') === 0) {
2253
- if (parts[i] === charsetSentinel) {
2254
- charset = 'utf-8';
2255
- } else if (parts[i] === isoSentinel) {
2256
- charset = 'iso-8859-1';
2257
- }
2258
- skipIndex = i;
2259
- i = parts.length; // The eslint settings do not allow break;
2260
- }
2261
- }
2262
- }
2263
-
2264
- for (i = 0; i < parts.length; ++i) {
2265
- if (i === skipIndex) {
2266
- continue;
2267
- }
2268
- var part = parts[i];
2269
-
2270
- var bracketEqualsPos = part.indexOf(']=');
2271
- var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
2272
-
2273
- var key, val;
2274
- if (pos === -1) {
2275
- key = options.decoder(part, defaults.decoder, charset, 'key');
2276
- val = options.strictNullHandling ? null : '';
2277
- } else {
2278
- key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
2279
- val = utils.maybeMap(
2280
- parseArrayValue(part.slice(pos + 1), options),
2281
- function (encodedVal) {
2282
- return options.decoder(encodedVal, defaults.decoder, charset, 'value');
2283
- }
2284
- );
2285
- }
2286
-
2287
- if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
2288
- val = interpretNumericEntities(val);
2289
- }
2290
-
2291
- if (part.indexOf('[]=') > -1) {
2292
- val = isArray(val) ? [val] : val;
2293
- }
2294
-
2295
- if (has.call(obj, key)) {
2296
- obj[key] = utils.combine(obj[key], val);
2297
- } else {
2298
- obj[key] = val;
2299
- }
2300
- }
2301
-
2302
- return obj;
2303
- };
2304
-
2305
- var parseObject = function (chain, val, options, valuesParsed) {
2306
- var leaf = valuesParsed ? val : parseArrayValue(val, options);
2307
-
2308
- for (var i = chain.length - 1; i >= 0; --i) {
2309
- var obj;
2310
- var root = chain[i];
2311
-
2312
- if (root === '[]' && options.parseArrays) {
2313
- obj = [].concat(leaf);
2314
- } else {
2315
- obj = options.plainObjects ? Object.create(null) : {};
2316
- var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
2317
- var index = parseInt(cleanRoot, 10);
2318
- if (!options.parseArrays && cleanRoot === '') {
2319
- obj = { 0: leaf };
2320
- } else if (
2321
- !isNaN(index)
2322
- && root !== cleanRoot
2323
- && String(index) === cleanRoot
2324
- && index >= 0
2325
- && (options.parseArrays && index <= options.arrayLimit)
2326
- ) {
2327
- obj = [];
2328
- obj[index] = leaf;
2329
- } else if (cleanRoot !== '__proto__') {
2330
- obj[cleanRoot] = leaf;
2331
- }
2332
- }
2333
-
2334
- leaf = obj;
2335
- }
2336
-
2337
- return leaf;
2338
- };
2339
-
2340
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
2341
- if (!givenKey) {
2342
- return;
2343
- }
2344
-
2345
- // Transform dot notation to bracket notation
2346
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
2347
-
2348
- // The regex chunks
2349
-
2350
- var brackets = /(\[[^[\]]*])/;
2351
- var child = /(\[[^[\]]*])/g;
2352
-
2353
- // Get the parent
2354
-
2355
- var segment = options.depth > 0 && brackets.exec(key);
2356
- var parent = segment ? key.slice(0, segment.index) : key;
2357
-
2358
- // Stash the parent if it exists
2359
-
2360
- var keys = [];
2361
- if (parent) {
2362
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
2363
- if (!options.plainObjects && has.call(Object.prototype, parent)) {
2364
- if (!options.allowPrototypes) {
2365
- return;
2366
- }
2367
- }
2368
-
2369
- keys.push(parent);
2370
- }
2371
-
2372
- // Loop through children appending to the array until we hit depth
2373
-
2374
- var i = 0;
2375
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
2376
- i += 1;
2377
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
2378
- if (!options.allowPrototypes) {
2379
- return;
2380
- }
2381
- }
2382
- keys.push(segment[1]);
2383
- }
2384
-
2385
- // If there's a remainder, just add whatever is left
2386
-
2387
- if (segment) {
2388
- keys.push('[' + key.slice(segment.index) + ']');
2389
- }
2390
-
2391
- return parseObject(keys, val, options, valuesParsed);
2392
- };
2393
-
2394
- var normalizeParseOptions = function normalizeParseOptions(opts) {
2395
- if (!opts) {
2396
- return defaults;
2397
- }
2398
-
2399
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
2400
- throw new TypeError('Decoder has to be a function.');
2401
- }
2402
-
2403
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2404
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2405
- }
2406
- var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
2407
-
2408
- return {
2409
- allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
2410
- allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
2411
- allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
2412
- arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
2413
- charset: charset,
2414
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
2415
- comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
2416
- decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
2417
- delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
2418
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2419
- depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
2420
- ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2421
- interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
2422
- parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
2423
- parseArrays: opts.parseArrays !== false,
2424
- plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
2425
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
2426
- };
2427
- };
2428
-
2429
- var parse$1 = function (str, opts) {
2430
- var options = normalizeParseOptions(opts);
2431
-
2432
- if (str === '' || str === null || typeof str === 'undefined') {
2433
- return options.plainObjects ? Object.create(null) : {};
2434
- }
2435
-
2436
- var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
2437
- var obj = options.plainObjects ? Object.create(null) : {};
2438
-
2439
- // Iterate over the keys and setup the new object
2440
-
2441
- var keys = Object.keys(tempObj);
2442
- for (var i = 0; i < keys.length; ++i) {
2443
- var key = keys[i];
2444
- var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
2445
- obj = utils.merge(obj, newObj, options);
2446
- }
2447
-
2448
- if (options.allowSparse === true) {
2449
- return obj;
2450
- }
2451
-
2452
- return utils.compact(obj);
2453
- };
2454
-
2455
- var stringify = stringify_1;
2456
- var parse = parse$1;
2457
- var formats = formats$3;
2458
-
2459
- var lib = {
2460
- formats: formats,
2461
- parse: parse,
2462
- stringify: stringify
2463
- };
2464
-
2465
- var IMAGE_SIZE_LIMIT_IN_MEGABYTES = 1;
2466
- var NEETO_TEMPLATES_URL = "/neeto_templates_engine/api/v1";
2467
- var TEMPLATE_TAGS_URL = "".concat(NEETO_TEMPLATES_URL, "/tags/template_tags");
2468
-
2469
- //routes of the host
2470
- var TEMPLATES_URL = "/api/v1/templates";
2471
- var TEMPLATES_SETTINGS_URL = "/api/v1/settings";
2472
- var IMAGE_UPLOAD_CONFIG = {
2473
- maxImageSize: IMAGE_SIZE_LIMIT_IN_MEGABYTES
2474
- };
2475
-
2476
- var list$1 = function list(params) {
2477
- return axios__default["default"].get(TEMPLATES_URL, {
2478
- params: params,
2479
- paramsSerializer: function paramsSerializer(params) {
2480
- return lib.stringify(params, {
2481
- arrayFormat: "brackets"
2482
- });
2483
- }
2484
- });
2485
- };
2486
- var create$1 = function create(_ref) {
2487
- var id = _ref.id;
2488
- return axios__default["default"].post(TEMPLATES_URL, {
2489
- template: {
2490
- id: id
2491
- }
2492
- }, {
2493
- showToastr: false
2494
- });
2495
- };
2496
- var fetch = function fetch(_ref2) {
2497
- var templateId = _ref2.templateId;
2498
- return axios__default["default"].get("".concat(TEMPLATES_SETTINGS_URL, "/").concat(templateId));
2499
- };
2500
- var update = function update(_ref3) {
2501
- var resourceId = _ref3.resourceId,
2502
- payload = _ref3.payload;
2503
- return axios__default["default"].put("".concat(TEMPLATES_SETTINGS_URL, "/").concat(resourceId), payload);
2504
- };
2505
- var templatesApi = {
2506
- list: list$1,
2507
- create: create$1,
2508
- update: update,
2509
- fetch: fetch
2510
- };
2511
-
2512
- var QUERY_KEYS = {
2513
- TEMPLATES_LIST: "templates-list",
2514
- TEMPLATE: "templates-detail",
2515
- TEMPLATE_TAGS: "template-tags"
2516
- };
2517
-
2518
- 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; }
2519
- 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; }
2520
- var useFetchTemplates = function useFetchTemplates(_ref) {
2521
- var searchTerm = _ref.searchTerm,
2522
- category = _ref.category;
2523
- return reactQuery.useInfiniteQuery([QUERY_KEYS.TEMPLATES_LIST, searchTerm, category], function (_ref2) {
2524
- var _ref2$pageParam = _ref2.pageParam,
2525
- pageParam = _ref2$pageParam === void 0 ? 1 : _ref2$pageParam;
2526
- return templatesApi.list({
2527
- page: pageParam,
2528
- searchTerm: searchTerm,
2529
- category: category
2530
- });
2531
- }, {
2532
- getNextPageParam: function getNextPageParam(lastPage) {
2533
- return lastPage.hasNextPage ? lastPage.page + 1 : undefined;
2534
- },
2535
- select: function select(data) {
2536
- var templates = data.pages.flatMap(ramda.prop("templates"));
2537
- var lastPage = data.pages[data.pages.length - 1];
2538
- return {
2539
- templates: templates,
2540
- hasNextPage: lastPage.hasNextPage,
2541
- page: lastPage.page,
2542
- tags: lastPage.tags,
2543
- templatesCount: lastPage.templatesCount
2544
- };
2545
- },
2546
- keepPreviousData: true
2547
- });
2548
- };
2549
- var useCreateTemplate = function useCreateTemplate(_ref3, options) {
2550
- var refetchResource = _ref3.refetchResource;
2551
- return reactQuery.useMutation(templatesApi.create, _objectSpread$3(_objectSpread$3({}, options), {}, {
2552
- onSuccess: function onSuccess() {
2553
- refetchResource();
2554
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2555
- args[_key] = arguments[_key];
2556
- }
2557
- options === null || options === void 0 || options.onSuccess.apply(options, args);
2558
- }
2559
- }));
2560
- };
2561
- var useFetchTemplate = function useFetchTemplate(_ref4, options) {
2562
- var resourceId = _ref4.resourceId;
2563
- return reactQuery.useQuery([QUERY_KEYS.TEMPLATE, resourceId], function () {
2564
- return templatesApi.fetch({
2565
- templateId: resourceId
2566
- });
2567
- }, options);
2568
- };
2569
- var useUpdateTemplate = function useUpdateTemplate(_ref5) {
2570
- var resourceId = _ref5.resourceId;
2571
- var queryClient = reactQuery.useQueryClient();
2572
- return reactQuery.useMutation(function (_ref6) {
2573
- var template = _ref6.template;
2574
- return templatesApi.update({
2575
- resourceId: resourceId,
2576
- payload: {
2577
- template: template
2578
- }
2579
- });
2580
- }, {
2581
- onSuccess: function onSuccess() {
2582
- queryClient.invalidateQueries([QUERY_KEYS.TEMPLATE, resourceId]);
2583
- queryClient.invalidateQueries(QUERY_KEYS.TEMPLATES_LIST);
2584
- }
2585
- });
2586
- };
2587
-
2588
- var BlankCard = function BlankCard(_ref) {
2589
- var Icon = _ref.icon,
2590
- title = _ref.title,
2591
- description = _ref.description,
2592
- _ref$onClick = _ref.onClick,
2593
- onClick = _ref$onClick === void 0 ? neetoCist.noop : _ref$onClick,
2594
- _ref$disabled = _ref.disabled,
2595
- disabled = _ref$disabled === void 0 ? false : _ref$disabled;
2596
- return /*#__PURE__*/React__default["default"].createElement("div", {
2597
- className: "neeto-ui-rounded-lg neeto-ui-bg-white hover:neeto-ui-bg-white neeto-ui-border-primary-500 outline-none flex cursor-pointer flex-col items-center justify-center border border-dashed p-6 transition-all duration-300 ease-in-out hover:border-solid focus:border-solid",
2598
- "data-cy": "start-from-scratch-button",
2599
- tabIndex: 0,
2600
- onClick: !disabled ? onClick : neetoCist.noop
2601
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2602
- className: "neeto-ui-text-primary-500 mb-4"
2603
- }, /*#__PURE__*/React__default["default"].createElement(Icon, {
2604
- size: 40
2605
- })), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
2606
- className: "text-center",
2607
- lineHeight: "normal",
2608
- style: "h5",
2609
- weight: "semibold"
2610
- }, title), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
2611
- className: "neeto-ui-text-gray-600 text-center",
2612
- lineHeight: "leading-4",
2613
- style: "body3"
2614
- }, description));
2615
- };
2616
-
2617
- var ButtonLoader = function ButtonLoader() {
2618
- return /*#__PURE__*/React__default["default"].createElement("div", {
2619
- role: "status"
2620
- }, /*#__PURE__*/React__default["default"].createElement("svg", {
2621
- "aria-hidden": "true",
2622
- className: "neeto-ui-text-gray-400 inline h-4 w-4 animate-spin",
2623
- fill: "none",
2624
- viewBox: "0 0 100 101",
2625
- xmlns: "http://www.w3.org/2000/svg"
2626
- }, /*#__PURE__*/React__default["default"].createElement("path", {
2627
- 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",
2628
- fill: "currentColor"
2629
- }), /*#__PURE__*/React__default["default"].createElement("path", {
2630
- 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",
2631
- fill: "#3642df"
2632
- })));
2633
- };
2634
-
2635
- var getMenuItems = function getMenuItems(_ref) {
2636
- var handleCreateTemplate = _ref.handleCreateTemplate,
2637
- isCreating = _ref.isCreating,
2638
- template = _ref.template;
2639
- return [{
2640
- key: MENU_ITEMS.CREATE,
2641
- "data-cy": "use-this-template-button",
2642
- isDisabled: isCreating,
2643
- label: i18next.t("neetoTemplate.templates.editTemplate"),
2644
- suffix: isCreating && /*#__PURE__*/React__default["default"].createElement(ButtonLoader, null),
2645
- onClick: function onClick(event) {
2646
- return handleCreateTemplate(event, template.id);
2647
- }
2648
- }, {
2649
- key: MENU_ITEMS.PREVIEW,
2650
- "data-cy": "template-preview-button",
2651
- label: i18next.t("neetoTemplate.templates.preview")
2652
- }];
2653
- };
2654
-
2655
- var Card = function Card(_ref) {
2656
- var template = _ref.template,
2657
- onClick = _ref.onClick,
2658
- afterCreate = _ref.afterCreate,
2659
- refetchResource = _ref.refetchResource;
2660
- var _useCreateTemplate = useCreateTemplate({
2661
- refetchResource: refetchResource
2662
- }),
2663
- createTemplate = _useCreateTemplate.mutate,
2664
- isCreating = _useCreateTemplate.isLoading;
2665
- var handleCreateTemplate = function handleCreateTemplate(e, templateId) {
2666
- e.stopPropagation();
2667
- createTemplate({
2668
- id: templateId
2669
- }, {
2670
- onSuccess: function onSuccess(response) {
2671
- return afterCreate(response);
2672
- }
2673
- });
2674
- };
2675
- return /*#__PURE__*/React__default["default"].createElement("div", {
2676
- 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",
2677
- "data-cy": "template-card",
2678
- tabIndex: 0,
2679
- onClick: onClick
2680
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2681
- className: "neeto-template__header"
2682
- }, /*#__PURE__*/React__default["default"].createElement("img", {
2683
- className: "neeto-template__image",
2684
- "data-cy": "template-thumbnail-image",
2685
- src: template.imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
2686
- })), /*#__PURE__*/React__default["default"].createElement("div", {
2687
- className: "neeto-template__description neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg p-2 py-1.5"
2688
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
2689
- className: "neeto-ui-text-gray-800 line-clamp-2",
2690
- "data-cy": "template-card-title",
2691
- lineHeight: "normal",
2692
- style: "body2"
2693
- }, template.title), /*#__PURE__*/React__default["default"].createElement(MoreDropdown__default["default"], {
2694
- dropdownButtonProps: {
2695
- className: "flex-shrink-0",
2696
- size: "small"
2697
- },
2698
- dropdownProps: {
2699
- onClick: function onClick(event) {
2700
- return event.stopPropagation();
2701
- }
2702
- },
2703
- menuItems: getMenuItems({
2704
- handleCreateTemplate: handleCreateTemplate,
2705
- isCreating: isCreating,
2706
- template: template
2707
- })
2708
- })));
2709
- };
2710
-
2711
- var CategoryItem = function CategoryItem(_ref) {
2712
- var label = _ref.label,
2713
- count = _ref.count,
2714
- isActive = _ref.isActive,
2715
- setCurrentCategory = _ref.setCurrentCategory;
2716
- return /*#__PURE__*/React__default["default"].createElement("button", {
2717
- "data-cy": "category-".concat(utils$3.joinHyphenCase(label)),
2718
- tabIndex: 0,
2719
- 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", {
2720
- "neeto-ui-text-gray-700 hover:neeto-ui-bg-gray-200 focus:neeto-ui-bg-gray-200 border-transparent": !isActive,
2721
- "neeto-ui-text-gray-800 neeto-ui-bg-white neeto-ui-border-gray-300 focus:neeto-ui-border-gray-500": isActive
2722
- }),
2723
- onClick: setCurrentCategory
2724
- }, /*#__PURE__*/React__default["default"].createElement("span", null, label), /*#__PURE__*/React__default["default"].createElement("span", null, count));
2725
- };
2726
-
2727
- 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; }
2728
- 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; }
2729
- var List = function List(_ref) {
2730
- var setCurrentScreen = _ref.setCurrentScreen,
2731
- setSelectedTemplate = _ref.setSelectedTemplate,
2732
- onCreate = _ref.onCreate,
2733
- isCreating = _ref.isCreating,
2734
- afterCreate = _ref.afterCreate,
2735
- refetchResource = _ref.refetchResource;
2736
- var _useTranslation = reactI18next.useTranslation(),
2737
- t = _useTranslation.t;
2738
- var _useState = React.useState(DEFAULT_CATEGORY),
2739
- _useState2 = _slicedToArray(_useState, 2),
2740
- currentCategory = _useState2[0],
2741
- _setCurrentCategory = _useState2[1];
2742
- var _useState3 = React.useState(""),
2743
- _useState4 = _slicedToArray(_useState3, 2),
2744
- searchTerm = _useState4[0],
2745
- setSearchTerm = _useState4[1];
2746
- var _useFetchTemplates = useFetchTemplates({
2747
- searchTerm: searchTerm,
2748
- category: currentCategory
2749
- }),
2750
- _useFetchTemplates$ha = _useFetchTemplates.hasNextPage,
2751
- hasNextPage = _useFetchTemplates$ha === void 0 ? false : _useFetchTemplates$ha,
2752
- fetchNextPage = _useFetchTemplates.fetchNextPage,
2753
- isTemplatesLoading = _useFetchTemplates.isLoading,
2754
- _useFetchTemplates$da = _useFetchTemplates.data,
2755
- data = _useFetchTemplates$da === void 0 ? {} : _useFetchTemplates$da;
2756
- var _useInfiniteScroll = useInfiniteScroll({
2757
- loading: isTemplatesLoading,
2758
- hasNextPage: hasNextPage,
2759
- onLoadMore: fetchNextPage,
2760
- rootMargin: "0px 0px 700px 0px",
2761
- delayInMs: INFINITE_SCROLL_DELAY
2762
- }),
2763
- _useInfiniteScroll2 = _slicedToArray(_useInfiniteScroll, 2),
2764
- sentryRef = _useInfiniteScroll2[0],
2765
- rootRef = _useInfiniteScroll2[1].rootRef;
2766
- var handleCardClick = function handleCardClick(template) {
2767
- setCurrentScreen(TEMPLATE_SCREENS.PREVIEW);
2768
- setSelectedTemplate(template);
2769
- };
2770
- if (isTemplatesLoading) {
2771
- return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
2772
- }
2773
- var _data$tags = data.tags,
2774
- tags = _data$tags === void 0 ? [] : _data$tags,
2775
- _data$templates = data.templates,
2776
- templates = _data$templates === void 0 ? [] : _data$templates,
2777
- _data$templatesCount = data.templatesCount,
2778
- templatesCount = _data$templatesCount === void 0 ? 0 : _data$templatesCount;
2779
- var categories = [_objectSpread$2(_objectSpread$2({}, DEFAULT_CATEGORY), {}, {
2780
- count: templatesCount
2781
- })].concat(_toConsumableArray(tags));
2782
- return /*#__PURE__*/React__default["default"].createElement("div", {
2783
- className: "neeto-ui-bg-gray-100 relative flex min-h-full items-start"
2784
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2785
- 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"
2786
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2787
- className: "space-y-4"
2788
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2789
- className: "space-y-1"
2790
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
2791
- "data-cy": "create-new-form-title",
2792
- style: "h2",
2793
- weight: "semibold"
2794
- }, t("neetoTemplate.templates.createNewEntity")), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
2795
- lineHeight: "normal",
2796
- style: "body2"
2797
- }, t("neetoTemplate.templates.description"))), /*#__PURE__*/React__default["default"].createElement(Search__default["default"], {
2798
- autoFocus: true,
2799
- disableTrimOnBlur: true,
2800
- "data-cy": "template-search-input",
2801
- placeholder: t("neetoTemplate.templates.search"),
2802
- onSearch: function onSearch(value) {
2803
- return setSearchTerm(value);
2804
- }
2805
- })), /*#__PURE__*/React__default["default"].createElement("div", {
2806
- className: "space-y-3"
2807
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
2808
- className: "uppercase",
2809
- "data-cy": "template-categories-label",
2810
- style: "h6"
2811
- }, t("neetoTemplate.templates.categories")), /*#__PURE__*/React__default["default"].createElement("div", {
2812
- className: "space-y-2"
2813
- }, categories.map(function (_ref2) {
2814
- var id = _ref2.id,
2815
- name = _ref2.name,
2816
- count = _ref2.count;
2817
- return /*#__PURE__*/React__default["default"].createElement(CategoryItem, {
2818
- count: count,
2819
- isActive: currentCategory.id === id,
2820
- key: id,
2821
- label: name,
2822
- setCurrentCategory: function setCurrentCategory() {
2823
- return _setCurrentCategory({
2824
- id: id,
2825
- name: name
2826
- });
2827
- }
2828
- });
2829
- })))), /*#__PURE__*/React__default["default"].createElement("div", {
2830
- className: "h-screen overflow-y-auto py-8 pl-5 pr-4 md:pl-8 md:pr-20 xl:px-20",
2831
- ref: rootRef
2832
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2833
- className: "flex-grow space-y-6"
2834
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2835
- 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"
2836
- }, /*#__PURE__*/React__default["default"].createElement(BlankCard, {
2837
- description: t("neetoTemplate.templates.blankCard.description"),
2838
- disabled: isCreating,
2839
- icon: isCreating ? neetoui.Spinner : SvgCustom,
2840
- title: t("neetoTemplate.templates.blankCard.title"),
2841
- onClick: onCreate
2842
- }), templates.map(function (template, index) {
2843
- return /*#__PURE__*/React__default["default"].createElement(Card, {
2844
- afterCreate: afterCreate,
2845
- refetchResource: refetchResource,
2846
- template: template,
2847
- key: index,
2848
- onClick: function onClick() {
2849
- return handleCardClick(template);
2850
- }
2851
- });
2852
- })), hasNextPage && /*#__PURE__*/React__default["default"].createElement("div", {
2853
- className: "my-10 text-center",
2854
- ref: sentryRef
2855
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null)))));
758
+ })]
759
+ }), hasNextPage && /*#__PURE__*/jsxRuntime.jsx("div", {
760
+ className: "my-10 text-center",
761
+ ref: sentryRef,
762
+ children: /*#__PURE__*/jsxRuntime.jsx(Spinner__default["default"], {})
763
+ })]
764
+ })
765
+ })]
766
+ });
2856
767
  };
2857
768
 
2858
769
  var Preview$1 = function Preview(_ref) {
@@ -2862,55 +773,87 @@ var Preview$1 = function Preview(_ref) {
2862
773
  refetchResource = _ref.refetchResource;
2863
774
  var _useTranslation = reactI18next.useTranslation(),
2864
775
  t = _useTranslation.t;
2865
- var _useCreateTemplate = useCreateTemplate({
2866
- refetchResource: refetchResource
2867
- }),
776
+ var _useBreakpoints = reactUtils.useBreakpoints(),
777
+ isSize = _useBreakpoints.isSize;
778
+ var _useCreateTemplate = useCreateTemplate(),
2868
779
  createTemplate = _useCreateTemplate.mutate,
2869
- isCreating = _useCreateTemplate.isLoading;
780
+ isCreating = _useCreateTemplate.isPending;
781
+ var _useState = React.useState(RESPONSIVE_DEVICES.DESKTOP),
782
+ _useState2 = _slicedToArray(_useState, 2),
783
+ selectedDevice = _useState2[0],
784
+ setSelectedDevice = _useState2[1];
2870
785
  var handleCreateTemplate = function handleCreateTemplate() {
2871
786
  createTemplate({
2872
787
  id: selectedTemplate.id
2873
788
  }, {
2874
789
  onSuccess: function onSuccess(response) {
2875
- return afterCreate(response);
790
+ afterCreate(response);
791
+ refetchResource();
2876
792
  }
2877
793
  });
2878
794
  };
2879
795
  var title = selectedTemplate.title,
2880
796
  previewUrl = selectedTemplate.previewUrl;
2881
- return /*#__PURE__*/React__default["default"].createElement("div", {
2882
- className: "m-auto flex h-full w-full max-w-5xl flex-col space-y-6 py-6"
2883
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2884
- className: "flex flex-col items-center justify-between gap-6 pl-4 pr-16 md:flex-row md:pr-20 xl:px-0"
2885
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2886
- className: "flex min-w-0 flex-grow items-center gap-2"
2887
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
2888
- className: "flex-shrink-0",
2889
- "data-cy": "preview-template-back-button",
2890
- icon: neetoIcons.LeftArrow,
2891
- style: "text",
2892
- onClick: function onClick() {
2893
- return setCurrentScreen(TEMPLATE_SCREENS.LIST);
2894
- }
2895
- }), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
2896
- className: "leading-none",
2897
- "data-cy": "preview-template-title",
2898
- style: "h2",
2899
- weight: "semibold"
2900
- }, title)), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
2901
- className: "flex-shrink-0",
2902
- "data-cy": "preview-use-template-button",
2903
- disabled: isCreating,
2904
- label: t("neetoTemplate.templates.editTemplate"),
2905
- loading: isCreating,
2906
- onClick: handleCreateTemplate
2907
- })), /*#__PURE__*/React__default["default"].createElement("div", {
2908
- className: "neeto-templates-share-preview neeto-ui-rounded-sm sticky top-10"
2909
- }, /*#__PURE__*/React__default["default"].createElement("iframe", {
2910
- className: "w-full flex-1 shadow-inner",
2911
- "data-cy": "iframe-id",
2912
- src: previewUrl
2913
- })));
797
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
798
+ className: "neeto-templates-full-page-preview flex h-full w-full flex-col",
799
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
800
+ className: "neeto-templates-full-page-preview__header neeto-ui-border-gray-200 border-b px-4",
801
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
802
+ className: "mx-auto flex w-full max-w-6xl items-center justify-between py-[9px]",
803
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
804
+ className: "w-1/3",
805
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
806
+ className: "truncate leading-tight",
807
+ "data-cy": "preview-template-title",
808
+ style: "h3",
809
+ weight: "semibold",
810
+ children: title
811
+ })
812
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
813
+ className: "hidden flex-shrink-0 lg:flex",
814
+ children: /*#__PURE__*/jsxRuntime.jsx(ResponsiveDevicePicker__default["default"], {
815
+ selectedDevice: selectedDevice,
816
+ onDeviceChange: setSelectedDevice
817
+ })
818
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
819
+ className: "flex w-1/3 items-center justify-end gap-2",
820
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
821
+ className: "flex-shrink-0",
822
+ "data-cy": "preview-template-back-button",
823
+ style: "secondary",
824
+ label: isSize("mobile") ? t("neetoTemplate.templates.back") : t("neetoTemplate.templates.backToTemplates"),
825
+ onClick: function onClick() {
826
+ return setCurrentScreen(TEMPLATE_SCREENS.LIST);
827
+ }
828
+ }), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
829
+ className: "flex-shrink-0",
830
+ "data-cy": "preview-use-template-button",
831
+ disabled: isCreating,
832
+ label: t("neetoTemplate.templates.editTemplate"),
833
+ loading: isCreating,
834
+ onClick: handleCreateTemplate
835
+ })]
836
+ })]
837
+ })
838
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
839
+ className: "neeto-ui-bg-gray-200 neeto-templates-full-page-preview__holder-wrapper min-h-0 flex-grow",
840
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
841
+ className: classnames__default["default"]("neeto-templates-full-page-preview__holder m-auto", {
842
+ "neeto-templates-full-page-preview__holder--desktop": selectedDevice === RESPONSIVE_DEVICES.DESKTOP,
843
+ "neeto-templates-full-page-preview__holder--tablet": selectedDevice === RESPONSIVE_DEVICES.TABLET,
844
+ "neeto-templates-full-page-preview__holder--mobile": selectedDevice === RESPONSIVE_DEVICES.MOBILE
845
+ }),
846
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
847
+ className: "neeto-templates-full-page-preview__device-border h-full w-full",
848
+ children: /*#__PURE__*/jsxRuntime.jsx("iframe", {
849
+ className: "neeto-templates-full-page-preview__iframe h-full w-full border-none",
850
+ "data-cy": "iframe-id",
851
+ src: previewUrl
852
+ })
853
+ })
854
+ })
855
+ })]
856
+ });
2914
857
  };
2915
858
 
2916
859
  var CreateTemplateModal = function CreateTemplateModal(_ref) {
@@ -2937,24 +880,26 @@ var CreateTemplateModal = function CreateTemplateModal(_ref) {
2937
880
  }, 300); //To accommodate the animation duration.
2938
881
  };
2939
882
 
2940
- return /*#__PURE__*/React__default["default"].createElement(neetoui.Modal, {
2941
- className: "neeto-template-list h-screen w-screen overflow-y-auto",
883
+ return /*#__PURE__*/jsxRuntime.jsx(Modal__default["default"], {
2942
884
  isOpen: isOpen,
885
+ className: "neeto-template-list h-screen w-screen overflow-y-auto",
886
+ closeButton: currentScreen === TEMPLATE_SCREENS.LIST,
2943
887
  size: "fullScreen",
2944
- onClose: onModalClose
2945
- }, currentScreen === TEMPLATE_SCREENS.LIST ? /*#__PURE__*/React__default["default"].createElement(List, {
2946
- setCurrentScreen: setCurrentScreen,
2947
- setSelectedTemplate: setSelectedTemplate,
2948
- isCreating: isCreating,
2949
- afterCreate: afterCreate,
2950
- onCreate: onCreate,
2951
- refetchResource: refetchResource
2952
- }) : /*#__PURE__*/React__default["default"].createElement(Preview$1, {
2953
- selectedTemplate: selectedTemplate,
2954
- setCurrentScreen: setCurrentScreen,
2955
- afterCreate: afterCreate,
2956
- refetchResource: refetchResource
2957
- }));
888
+ onClose: onModalClose,
889
+ children: currentScreen === TEMPLATE_SCREENS.LIST ? /*#__PURE__*/jsxRuntime.jsx(List, {
890
+ afterCreate: afterCreate,
891
+ isCreating: isCreating,
892
+ onCreate: onCreate,
893
+ refetchResource: refetchResource,
894
+ setCurrentScreen: setCurrentScreen,
895
+ setSelectedTemplate: setSelectedTemplate
896
+ }) : /*#__PURE__*/jsxRuntime.jsx(Preview$1, {
897
+ afterCreate: afterCreate,
898
+ refetchResource: refetchResource,
899
+ selectedTemplate: selectedTemplate,
900
+ setCurrentScreen: setCurrentScreen
901
+ })
902
+ });
2958
903
  };
2959
904
 
2960
905
  var create = function create(payload) {
@@ -2972,21 +917,24 @@ var templateTagsApi = {
2972
917
  list: list
2973
918
  };
2974
919
 
2975
- function ownKeys$1(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; }
2976
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
920
+ 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; }
921
+ 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; }
2977
922
  var useCreateTemplateTag = function useCreateTemplateTag(options) {
2978
- var queryClient = reactQuery.useQueryClient();
2979
- return reactQuery.useMutation(templateTagsApi.create, _objectSpread$1(_objectSpread$1({}, options), {}, {
923
+ return reactQuery.useMutation(_objectSpread$3(_objectSpread$3({
924
+ mutationFn: templateTagsApi.create
925
+ }, options), {}, {
2980
926
  onSuccess: function onSuccess() {
2981
927
  var _options$onSuccess;
2982
928
  neetoTagsFrontend.refetchTags();
2983
- queryClient.invalidateQueries(QUERY_KEYS.TEMPLATE_TAGS);
2984
929
  options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options);
2985
930
  }
2986
931
  }));
2987
932
  };
2988
933
  var useFetchTemplateTags = function useFetchTemplateTags() {
2989
- return reactQuery.useQuery([QUERY_KEYS.TEMPLATE_TAGS], templateTagsApi.list);
934
+ return reactQuery.useQuery({
935
+ queryKey: [QUERY_KEYS.TEMPLATE_TAGS],
936
+ queryFn: templateTagsApi.list
937
+ });
2990
938
  };
2991
939
 
2992
940
  var FormikImageUploader = function FormikImageUploader(_ref) {
@@ -3002,7 +950,7 @@ var FormikImageUploader = function FormikImageUploader(_ref) {
3002
950
  setFieldValue("imageSignedId", file.signedId);
3003
951
  return setValue(file.url);
3004
952
  };
3005
- return /*#__PURE__*/React__default["default"].createElement(neetoImageUploaderFrontend.ImageUploader, {
953
+ return /*#__PURE__*/jsxRuntime.jsx(neetoImageUploaderFrontend.ImageUploader, {
3006
954
  className: "h-52 w-full md:h-80",
3007
955
  src: field.value,
3008
956
  uploadConfig: IMAGE_UPLOAD_CONFIG,
@@ -3013,20 +961,22 @@ var FormikImageUploader = function FormikImageUploader(_ref) {
3013
961
  var PageWrapper = function PageWrapper(_ref) {
3014
962
  var children = _ref.children,
3015
963
  className = _ref.className;
3016
- return /*#__PURE__*/React__default["default"].createElement("div", {
3017
- className: classnames__default["default"]("w-full flex-col", className)
3018
- }, children);
964
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
965
+ className: classnames__default["default"]("w-full flex-col", className),
966
+ children: children
967
+ });
3019
968
  };
3020
969
  var PageHeader = function PageHeader(_ref2) {
3021
970
  var title = _ref2.title,
3022
971
  breadcrumbs = _ref2.breadcrumbs;
3023
- return /*#__PURE__*/React__default["default"].createElement("div", {
3024
- className: "w-full px-6"
3025
- }, /*#__PURE__*/React__default["default"].createElement(Header__default["default"], {
3026
- breadcrumbs: breadcrumbs,
3027
- size: "small",
3028
- title: title
3029
- }));
972
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
973
+ className: "w-full px-6",
974
+ children: /*#__PURE__*/jsxRuntime.jsx(Header__default["default"], {
975
+ breadcrumbs: breadcrumbs,
976
+ size: "small",
977
+ title: title
978
+ })
979
+ });
3030
980
  };
3031
981
  var customPropEqualityCheck = function customPropEqualityCheck(prevProps, nextProps) {
3032
982
  return prevProps.title === nextProps.title && prevProps.breadcrumbs === nextProps.breadcrumbs;
@@ -3036,13 +986,17 @@ var PageContent = function PageContent(_ref3) {
3036
986
  var children = _ref3.children,
3037
987
  _ref3$className = _ref3.className,
3038
988
  className = _ref3$className === void 0 ? "" : _ref3$className;
3039
- return /*#__PURE__*/React__default["default"].createElement(Scrollable__default["default"], {
3040
- className: "w-full px-6 pb-6"
3041
- }, /*#__PURE__*/React__default["default"].createElement("div", {
3042
- className: classnames__default["default"](["mx-auto max-w-7xl", className])
3043
- }, children));
989
+ return /*#__PURE__*/jsxRuntime.jsx(Scrollable__default["default"], {
990
+ className: "w-full px-6 pb-6",
991
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
992
+ className: classnames__default["default"](["mx-auto max-w-7xl", className]),
993
+ children: children
994
+ })
995
+ });
3044
996
  };
3045
997
 
998
+ 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; }
999
+ 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; }
3046
1000
  var Tags = function Tags(_ref) {
3047
1001
  var allTags = _ref.allTags,
3048
1002
  selectedTags = _ref.selectedTags,
@@ -3074,44 +1028,52 @@ var Tags = function Tags(_ref) {
3074
1028
  }
3075
1029
  });
3076
1030
  };
3077
- return /*#__PURE__*/React__default["default"].createElement("div", {
3078
- className: className
3079
- }, labelProps.label && /*#__PURE__*/React__default["default"].createElement(neetoui.Label, labelProps, labelProps.label), /*#__PURE__*/React__default["default"].createElement("div", {
3080
- className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white border p-4"
3081
- }, /*#__PURE__*/React__default["default"].createElement(neetoTagsFrontend.TagsComponent, {
3082
- allTags: allTags,
3083
- selectedTags: selectedTags,
3084
- buttonProps: {
3085
- loading: isLoading,
3086
- disabled: isLoading,
3087
- iconPosition: "left"
3088
- },
3089
- onTagCreate: handleTagCreate,
3090
- onTagDelete: handleTagRemove,
3091
- onTagSelect: handleTagSelect
3092
- })));
1031
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1032
+ className: className,
1033
+ children: [labelProps.label && /*#__PURE__*/jsxRuntime.jsx(Label__default["default"], _objectSpread$2(_objectSpread$2({}, labelProps), {}, {
1034
+ children: labelProps.label
1035
+ })), /*#__PURE__*/jsxRuntime.jsx("div", {
1036
+ className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white border p-4",
1037
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoTagsFrontend.TagsComponent, {
1038
+ allTags: allTags,
1039
+ selectedTags: selectedTags,
1040
+ buttonProps: {
1041
+ loading: isLoading,
1042
+ disabled: isLoading,
1043
+ iconPosition: "left"
1044
+ },
1045
+ onTagCreate: handleTagCreate,
1046
+ onTagDelete: handleTagRemove,
1047
+ onTagSelect: handleTagSelect
1048
+ })
1049
+ })]
1050
+ });
3093
1051
  };
3094
1052
 
3095
1053
  var Preview = function Preview(_ref) {
3096
1054
  var template = _ref.template,
3097
1055
  imageUrl = _ref.imageUrl;
3098
- return /*#__PURE__*/React__default["default"].createElement("div", {
1056
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
3099
1057
  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",
3100
- tabIndex: 0
3101
- }, /*#__PURE__*/React__default["default"].createElement("div", {
3102
- className: "neeto-template__header"
3103
- }, /*#__PURE__*/React__default["default"].createElement("img", {
3104
- className: "neeto-template__image",
3105
- "data-cy": "template-image-preview",
3106
- src: imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
3107
- })), /*#__PURE__*/React__default["default"].createElement("div", {
3108
- className: "neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg px-2 py-1.5"
3109
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
3110
- className: "neeto-ui-text-gray-800",
3111
- "data-cy": "template-title-text",
3112
- lineHeight: "normal",
3113
- style: "body2"
3114
- }, template.title)));
1058
+ tabIndex: 0,
1059
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1060
+ className: "neeto-template__header",
1061
+ children: /*#__PURE__*/jsxRuntime.jsx("img", {
1062
+ className: "neeto-template__image",
1063
+ "data-cy": "template-image-preview",
1064
+ src: imageUrl || "https://d2v7kzglnr2dnh.cloudfront.net/images/neetoForm/default-form-template.svg"
1065
+ })
1066
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1067
+ className: "neeto-ui-bg-white flex items-center justify-between gap-2 rounded-b-lg px-2 py-1.5",
1068
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
1069
+ className: "neeto-ui-text-gray-800",
1070
+ "data-cy": "template-title-text",
1071
+ lineHeight: "normal",
1072
+ style: "body2",
1073
+ children: template.title
1074
+ })
1075
+ })]
1076
+ });
3115
1077
  };
3116
1078
 
3117
1079
  var buildSelectOptionsBy = function buildSelectOptionsBy(labelField) {
@@ -3138,8 +1100,8 @@ var buildTemplateUpdatePayload = function buildTemplateUpdatePayload(values) {
3138
1100
  };
3139
1101
  };
3140
1102
 
3141
- function ownKeys(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; }
3142
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1103
+ function ownKeys$1(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; }
1104
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3143
1105
  var TemplateSettings = function TemplateSettings(_ref) {
3144
1106
  var _ref$onCancelTemplate = _ref.onCancelTemplatePreview,
3145
1107
  onCancelTemplatePreview = _ref$onCancelTemplate === void 0 ? "" : _ref$onCancelTemplate,
@@ -3160,10 +1122,10 @@ var TemplateSettings = function TemplateSettings(_ref) {
3160
1122
  resourceId: resourceId
3161
1123
  }),
3162
1124
  updateTemplate = _useUpdateTemplate.mutate,
3163
- isUpdatingTemplate = _useUpdateTemplate.isLoading;
1125
+ isUpdatingTemplate = _useUpdateTemplate.isPending;
3164
1126
  var _useCreateTemplateTag = useCreateTemplateTag(),
3165
1127
  createTemplateTag = _useCreateTemplateTag.mutate,
3166
- isCreatingTags = _useCreateTemplateTag.isLoading;
1128
+ isCreatingTags = _useCreateTemplateTag.isPending;
3167
1129
  var _useFetchTemplateTags = useFetchTemplateTags(),
3168
1130
  _useFetchTemplateTags2 = _useFetchTemplateTags.data,
3169
1131
  templateTags = _useFetchTemplateTags2 === void 0 ? {} : _useFetchTemplateTags2,
@@ -3175,92 +1137,205 @@ var TemplateSettings = function TemplateSettings(_ref) {
3175
1137
  };
3176
1138
  var isLoading = isFetchingTemplate || isTagsLoading;
3177
1139
  var tags = buildTagOptions(data === null || data === void 0 ? void 0 : data.tags);
3178
- var resourceInitialValues = _objectSpread(_objectSpread({
1140
+ var resourceInitialValues = _objectSpread$1(_objectSpread$1({
3179
1141
  imageUrl: null
3180
1142
  }, data), {}, {
3181
1143
  tags: tags
3182
1144
  });
3183
- return /*#__PURE__*/React__default["default"].createElement(PageWrapper, {
3184
- className: className
3185
- }, /*#__PURE__*/React__default["default"].createElement(MemoizedPageHeader, {
3186
- breadcrumbs: breadcrumbs,
3187
- title: t("neetoTemplate.templateSettings.title")
3188
- }), /*#__PURE__*/React__default["default"].createElement(PageContent, {
3189
- className: classnames__default["default"]({
3190
- "min-h-0": !isLoading,
3191
- "h-full": isLoading
3192
- })
3193
- }, isLoading ? /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
3194
- className: "mb-1",
3195
- "data-cy": "thank-you-action-text",
3196
- style: "h2",
3197
- weight: "semibold"
3198
- }, t("neetoTemplate.templateSettings.configureTemplates")), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
3199
- className: "mb-2",
3200
- "data-cy": "thank-you-description-label",
3201
- style: "body2"
3202
- }, t("neetoTemplate.templateSettings.subText")), /*#__PURE__*/React__default["default"].createElement(formik$1.Form, {
3203
- formikProps: {
3204
- enableReinitialize: true,
3205
- initialValues: resourceInitialValues,
3206
- onSubmit: handleSubmit
1145
+ return /*#__PURE__*/jsxRuntime.jsxs(PageWrapper, {
1146
+ className: className,
1147
+ children: [/*#__PURE__*/jsxRuntime.jsx(MemoizedPageHeader, {
1148
+ breadcrumbs: breadcrumbs,
1149
+ title: t("neetoTemplate.templateSettings.title")
1150
+ }), /*#__PURE__*/jsxRuntime.jsx(PageContent, {
1151
+ className: classnames__default["default"]({
1152
+ "min-h-0": !isLoading,
1153
+ "h-full": isLoading
1154
+ }),
1155
+ children: isLoading ? /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1156
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
1157
+ className: "mb-1",
1158
+ "data-cy": "thank-you-action-text",
1159
+ style: "h2",
1160
+ weight: "semibold",
1161
+ children: t("neetoTemplate.templateSettings.configureTemplates")
1162
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
1163
+ className: "mb-2",
1164
+ "data-cy": "thank-you-description-label",
1165
+ style: "body2",
1166
+ children: t("neetoTemplate.templateSettings.subText")
1167
+ }), /*#__PURE__*/jsxRuntime.jsx(Form__default["default"], {
1168
+ formikProps: {
1169
+ enableReinitialize: true,
1170
+ initialValues: resourceInitialValues,
1171
+ onSubmit: handleSubmit
1172
+ },
1173
+ children: function children(_ref2) {
1174
+ var values = _ref2.values,
1175
+ setFieldValue = _ref2.setFieldValue;
1176
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1177
+ className: "grid grid-cols-2 gap-8 pt-6",
1178
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1179
+ className: "space-y-4",
1180
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
1181
+ className: "mb-3",
1182
+ style: "h4",
1183
+ weight: "semibold",
1184
+ children: t("neetoTemplate.templateSettings.imageLabel")
1185
+ }), /*#__PURE__*/jsxRuntime.jsx(FormikImageUploader, {
1186
+ name: "imageUrl"
1187
+ }), /*#__PURE__*/jsxRuntime.jsx(Tags, {
1188
+ allTags: buildSelectOptionsBy("name", templateTags.tags),
1189
+ className: "space-y-2",
1190
+ isLoading: isCreatingTags,
1191
+ selectedTags: values.tags,
1192
+ labelProps: {
1193
+ label: t("neetoTemplate.templateSettings.categoryLabel")
1194
+ },
1195
+ onCreate: createTemplateTag,
1196
+ onUpdate: function onUpdate(tags) {
1197
+ return setFieldValue("tags", tags);
1198
+ }
1199
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1200
+ className: "mt-12 flex flex-row items-center justify-start",
1201
+ children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock__default["default"], {
1202
+ isSubmitting: isUpdatingTemplate,
1203
+ cancelButtonProps: {
1204
+ to: onCancelTemplatePreview,
1205
+ "data-cy": "reset-changes-button",
1206
+ onClick: neetoCist.noop
1207
+ }
1208
+ })
1209
+ })]
1210
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1211
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
1212
+ className: "mb-3",
1213
+ style: "h4",
1214
+ weight: "semibold",
1215
+ children: t("neetoTemplate.templateSettings.previewLabel")
1216
+ }), /*#__PURE__*/jsxRuntime.jsx(Preview, {
1217
+ imageUrl: values.imageUrl,
1218
+ template: data
1219
+ })]
1220
+ })]
1221
+ });
1222
+ }
1223
+ })]
1224
+ })
1225
+ })]
1226
+ });
1227
+ };
1228
+
1229
+ function _objectWithoutPropertiesLoose(source, excluded) {
1230
+ if (source == null) return {};
1231
+ var target = {};
1232
+ var sourceKeys = Object.keys(source);
1233
+ var key, i;
1234
+ for (i = 0; i < sourceKeys.length; i++) {
1235
+ key = sourceKeys[i];
1236
+ if (excluded.indexOf(key) >= 0) continue;
1237
+ target[key] = source[key];
1238
+ }
1239
+ return target;
1240
+ }
1241
+
1242
+ function _objectWithoutProperties(source, excluded) {
1243
+ if (source == null) return {};
1244
+ var target = _objectWithoutPropertiesLoose(source, excluded);
1245
+ var key, i;
1246
+ if (Object.getOwnPropertySymbols) {
1247
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1248
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1249
+ key = sourceSymbolKeys[i];
1250
+ if (excluded.indexOf(key) >= 0) continue;
1251
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1252
+ target[key] = source[key];
3207
1253
  }
3208
- }, function (_ref2) {
3209
- var values = _ref2.values,
3210
- setFieldValue = _ref2.setFieldValue,
3211
- dirty = _ref2.dirty;
3212
- return /*#__PURE__*/React__default["default"].createElement("div", {
3213
- className: "grid grid-cols-2 gap-8 pt-6"
3214
- }, /*#__PURE__*/React__default["default"].createElement("div", {
3215
- className: "space-y-4"
3216
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
3217
- className: "mb-3",
3218
- style: "h4",
3219
- weight: "semibold"
3220
- }, t("neetoTemplate.templateSettings.imageLabel")), /*#__PURE__*/React__default["default"].createElement(FormikImageUploader, {
3221
- name: "imageUrl"
3222
- }), /*#__PURE__*/React__default["default"].createElement(Tags, {
3223
- allTags: buildSelectOptionsBy("name", templateTags.tags),
3224
- className: "space-y-2",
3225
- isLoading: isCreatingTags,
3226
- selectedTags: values.tags,
3227
- labelProps: {
3228
- label: t("neetoTemplate.templateSettings.categoryLabel")
3229
- },
3230
- onCreate: createTemplateTag,
3231
- onUpdate: function onUpdate(tags) {
3232
- return setFieldValue("tags", tags);
1254
+ }
1255
+ return target;
1256
+ }
1257
+
1258
+ var TAG_TYPES = [{
1259
+ id: 1,
1260
+ label: i18next.t("neetoTemplate.templatesTags.template"),
1261
+ url: "".concat(NEETO_TEMPLATES_URL, "/tags/template_tags"),
1262
+ columns: [{
1263
+ title: i18next.t("neetoTemplate.templatesTags.numberOfActiveTemplates"),
1264
+ key: "templates_count",
1265
+ dataIndex: "templatesCount",
1266
+ align: "center",
1267
+ width: 300,
1268
+ sorter: true,
1269
+ render: function render(templatesCount) {
1270
+ return templatesCount !== 0 ? /*#__PURE__*/jsxRuntime.jsxs(Typography__default["default"], {
1271
+ style: "body1",
1272
+ children: [" ", templatesCount, " "]
1273
+ }) : "-";
1274
+ }
1275
+ }]
1276
+ }];
1277
+
1278
+ var _excluded = ["breadcrumbs", "tagsPath"];
1279
+ function ownKeys(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; }
1280
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1281
+ var TemplateTags = function TemplateTags(_ref) {
1282
+ var breadcrumbs = _ref.breadcrumbs,
1283
+ tagsPath = _ref.tagsPath,
1284
+ otherProps = _objectWithoutProperties(_ref, _excluded);
1285
+ var queryClient = reactQuery.useQueryClient();
1286
+ var invalidateTags = function invalidateTags() {
1287
+ queryClient.invalidateQueries({
1288
+ queryKey: [QUERY_KEYS.TEMPLATE_TAGS]
1289
+ });
1290
+ };
1291
+ var invalidateTagsAndTemplates = function invalidateTagsAndTemplates() {
1292
+ invalidateTags();
1293
+ queryClient.invalidateQueries({
1294
+ queryKey: [QUERY_KEYS.TEMPLATES_LIST]
1295
+ });
1296
+ queryClient.invalidateQueries({
1297
+ queryKey: [QUERY_KEYS.TEMPLATE]
1298
+ });
1299
+ };
1300
+ var config = _objectSpread({
1301
+ tagTypes: TAG_TYPES,
1302
+ tagsMergable: true,
1303
+ breadcrumbs: breadcrumbs,
1304
+ displayMenu: false,
1305
+ tagsPath: tagsPath,
1306
+ onTagRowClick: neetoCist.noop,
1307
+ createTags: {
1308
+ onSuccess: {
1309
+ callback: invalidateTags
3233
1310
  }
3234
- }), /*#__PURE__*/React__default["default"].createElement("div", {
3235
- className: "mt-12 flex flex-row items-center justify-start"
3236
- }, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
3237
- className: "mr-3 flex-shrink-0",
3238
- "data-cy": "save-changes-button",
3239
- disabled: !dirty,
3240
- loading: isUpdatingTemplate,
3241
- type: "submit",
3242
- label: t("neetoTemplate.templateSettings.button.saveChanges")
3243
- }), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
3244
- "data-cy": "reset-changes-button",
3245
- style: "text",
3246
- to: onCancelTemplatePreview,
3247
- label: t("neetoTemplate.templateSettings.button.cancel")
3248
- }))), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
3249
- className: "mb-3",
3250
- style: "h4",
3251
- weight: "semibold"
3252
- }, t("neetoTemplate.templateSettings.previewLabel")), /*#__PURE__*/React__default["default"].createElement(Preview, {
3253
- imageUrl: values.imageUrl,
3254
- template: data
3255
- })));
3256
- }))));
1311
+ },
1312
+ updateTags: {
1313
+ onSuccess: {
1314
+ callback: invalidateTagsAndTemplates
1315
+ }
1316
+ },
1317
+ deleteTags: {
1318
+ onSuccess: {
1319
+ callback: invalidateTagsAndTemplates
1320
+ }
1321
+ },
1322
+ mergeTags: {
1323
+ onSuccess: {
1324
+ callback: invalidateTagsAndTemplates
1325
+ }
1326
+ }
1327
+ }, otherProps);
1328
+ return /*#__PURE__*/jsxRuntime.jsx(neetoTagsFrontend.NeetoTags, {
1329
+ config: config
1330
+ });
3257
1331
  };
3258
1332
 
3259
1333
  var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
3260
1334
 
3261
- var css = ".neeto-template-list .neeto-ui-modal__close{z-index:1}.neeto-template__header{flex-grow:1;min-height:120px}.neeto-template__image{aspect-ratio:16/9;max-height:100%;max-width:100%;-o-object-fit:cover;object-fit:cover;width:100%}.neeto-template__description{min-height:54px}.neeto-templates-share-preview{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-gray-300));box-shadow:var(--neeto-ui-shadow-m);display:flex;flex-direction:column;height:calc(100vh - 104px);width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL3RlbXBsYXRlcy9fdGVtcGxhdGUtbGlzdC5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL3RlbXBsYXRlcy9fc2hhcmUuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDRSw0Q0FDRSxTQ0FKLENES0Usd0JBRUUsV0FBQSxDQURBLGdCQ0RKLENES0UsdUJBRUUsaUJBQUEsQ0FHQSxlQUFBLENBREEsY0FBQSxDQURBLG1CQUFBLENBQUEsZ0JBQUEsQ0FGQSxVQ0NKLENES0UsNkJBQ0UsZUNISixDQ2pCQSwrQkFPRSwyQ0FBQSxDQUpBLCtDQUFBLENBQ0EsbUNBQUEsQ0FDQSxZQUFBLENBQ0EscUJBQUEsQ0FKQSwwQkFBQSxDQURBLFVEMEJGIiwic291cmNlc0NvbnRlbnQiOlsiLm5lZXRvLXRlbXBsYXRlLWxpc3Qge1xuICAubmVldG8tdWktbW9kYWxfX2Nsb3NlIHtcbiAgICB6LWluZGV4OiAxO1xuICB9XG59XG5cbi5uZWV0by10ZW1wbGF0ZSB7XG4gICZfX2hlYWRlciB7XG4gICAgbWluLWhlaWdodDogJG5lZXRvLXRlbXBsYXRlLWhlYWRlci1taW4taGVpZ2h0O1xuICAgIGZsZXgtZ3JvdzogMTtcbiAgfVxuXG4gICZfX2ltYWdlIHtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBhc3BlY3QtcmF0aW86IDE2IC8gOTtcbiAgICBvYmplY3QtZml0OiBjb3ZlcjtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgbWF4LWhlaWdodDogMTAwJTtcbiAgfVxuICAmX19kZXNjcmlwdGlvbiB7XG4gICAgbWluLWhlaWdodDogJG5lZXRvLXRlbXBsYXRlLWRlc2NyaXB0aW9uLW1pbi1oZWlnaHQ7XG4gIH1cbn1cbiIsIi5uZWV0by10ZW1wbGF0ZS1saXN0IC5uZWV0by11aS1tb2RhbF9fY2xvc2Uge1xuICB6LWluZGV4OiAxO1xufVxuXG4ubmVldG8tdGVtcGxhdGVfX2hlYWRlciB7XG4gIG1pbi1oZWlnaHQ6IDEyMHB4O1xuICBmbGV4LWdyb3c6IDE7XG59XG4ubmVldG8tdGVtcGxhdGVfX2ltYWdlIHtcbiAgd2lkdGg6IDEwMCU7XG4gIGFzcGVjdC1yYXRpbzogMTYvOTtcbiAgb2JqZWN0LWZpdDogY292ZXI7XG4gIG1heC13aWR0aDogMTAwJTtcbiAgbWF4LWhlaWdodDogMTAwJTtcbn1cbi5uZWV0by10ZW1wbGF0ZV9fZGVzY3JpcHRpb24ge1xuICBtaW4taGVpZ2h0OiA1NHB4O1xufVxuXG4ubmVldG8tdGVtcGxhdGVzLXNoYXJlLXByZXZpZXcge1xuICB3aWR0aDogMTAwJTtcbiAgaGVpZ2h0OiBjYWxjKDEwMHZoIC0gMTA0cHgpO1xuICBib3JkZXI6IHRoaW4gc29saWQgcmdiKHZhcigtLW5lZXRvLXVpLWdyYXktMzAwKSk7XG4gIGJveC1zaGFkb3c6IHZhcigtLW5lZXRvLXVpLXNoYWRvdy1tKTtcbiAgZGlzcGxheTogZmxleDtcbiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgYmFja2dyb3VuZC1jb2xvcjogcmdiKHZhcigtLW5lZXRvLXVpLXdoaXRlKSk7XG59IiwiLm5lZXRvLXRlbXBsYXRlcy1zaGFyZS1wcmV2aWV3IHtcbiAgd2lkdGg6IDEwMCU7XG4gIGhlaWdodDogY2FsYygxMDB2aCAtIDEwNHB4KTtcbiAgYm9yZGVyOiB0aGluIHNvbGlkIHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTMwMCkpO1xuICBib3gtc2hhZG93OiB2YXIoLS1uZWV0by11aS1zaGFkb3ctbSk7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gIGJhY2tncm91bmQtY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS13aGl0ZSkpO1xufVxuIl19 */";
1335
+ var css = ".neeto-template-list .neeto-ui-modal__close{z-index:1}.neeto-template__header{flex-grow:1;min-height:120px}.neeto-template__image{aspect-ratio:16/9;max-height:100%;max-width:100%;-o-object-fit:cover;object-fit:cover;width:100%}.neeto-template__description{min-height:54px}.neeto-template-thumbnail .neeto-template__image{transition:transform .5s ease}.neeto-template-thumbnail .neeto-template-thumbnail__title{transition:color .5s ease}.neeto-template-thumbnail:hover .neeto-template__image{transform:scale(1.08)}.neeto-template-thumbnail:hover .neeto-template-thumbnail__title{color:rgb(var(--neeto-ui-black))!important}.neeto-templates-full-page-preview__holder{transition:all .2s ease-in-out}.neeto-templates-full-page-preview__holder--desktop{height:100%;max-width:100%;width:100%}.neeto-templates-full-page-preview__holder--tablet{height:1024px;margin-top:16px!important;max-height:calc(100% - 32px);max-width:768px}.neeto-templates-full-page-preview__holder--tablet .neeto-templates-full-page-preview__iframe{border:1px solid rgb(var(--neeto-ui-gray-300))!important}.neeto-templates-full-page-preview__holder--mobile{height:896px;margin-top:16px!important;max-height:calc(100% - 32px);max-width:384px}.neeto-templates-full-page-preview__holder--mobile .neeto-templates-full-page-preview__iframe{border:1px solid rgb(var(--neeto-ui-gray-300))!important}.neeto-templates-share-preview{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-gray-300));box-shadow:var(--neeto-ui-shadow-m);display:flex;flex-direction:column;height:calc(100vh - 104px);width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL3RlbXBsYXRlcy9fdGVtcGxhdGUtbGlzdC5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL3RlbXBsYXRlcy9fc2hhcmUuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDRSw0Q0FDRSxTQ0FKLENES0Usd0JBRUUsV0FBQSxDQURBLGdCQ0RKLENES0UsdUJBRUUsaUJBQUEsQ0FHQSxlQUFBLENBREEsY0FBQSxDQURBLG1CQUFBLENBQUEsZ0JBQUEsQ0FGQSxVQ0NKLENES0UsNkJBQ0UsZUNISixDRFFFLGlEQUNFLDZCQ0xKLENET0UsMkRBQ0UseUJDTEosQ0RRSSx1REFDRSxxQkNOTixDRFFJLGlFQUNFLDBDQ05OLENEV0EsMkNBQ0UsOEJDUkYsQ0RXQSxvREFFRSxXQUFBLENBQ0EsY0FBQSxDQUZBLFVDTkYsQ0RXQSxtREFFRSxhQUFBLENBRUEseUJBQUEsQ0FEQSw0QkFBQSxDQUZBLGVDTEYsQ0RVRSw4RkFDRSx3RENSSixDRFlBLG1EQUVFLFlBQUEsQ0FFQSx5QkFBQSxDQURBLDRCQUFBLENBRkEsZUNORixDRFdFLDhGQUNFLHdEQ1RKLENDNURBLCtCQU9FLDJDQUFBLENBSkEsK0NBQUEsQ0FDQSxtQ0FBQSxDQUNBLFlBQUEsQ0FDQSxxQkFBQSxDQUpBLDBCQUFBLENBREEsVURxRUYiLCJzb3VyY2VzQ29udGVudCI6WyIubmVldG8tdGVtcGxhdGUtbGlzdCB7XG4gIC5uZWV0by11aS1tb2RhbF9fY2xvc2Uge1xuICAgIHotaW5kZXg6IDE7XG4gIH1cbn1cblxuLm5lZXRvLXRlbXBsYXRlIHtcbiAgJl9faGVhZGVyIHtcbiAgICBtaW4taGVpZ2h0OiAkbmVldG8tdGVtcGxhdGUtaGVhZGVyLW1pbi1oZWlnaHQ7XG4gICAgZmxleC1ncm93OiAxO1xuICB9XG5cbiAgJl9faW1hZ2Uge1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIGFzcGVjdC1yYXRpbzogMTYgLyA5O1xuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xuICAgIG1heC13aWR0aDogMTAwJTtcbiAgICBtYXgtaGVpZ2h0OiAxMDAlO1xuICB9XG4gICZfX2Rlc2NyaXB0aW9uIHtcbiAgICBtaW4taGVpZ2h0OiAkbmVldG8tdGVtcGxhdGUtZGVzY3JpcHRpb24tbWluLWhlaWdodDtcbiAgfVxufVxuXG4ubmVldG8tdGVtcGxhdGUtdGh1bWJuYWlsIHtcbiAgLm5lZXRvLXRlbXBsYXRlX19pbWFnZSB7XG4gICAgdHJhbnNpdGlvbjogdHJhbnNmb3JtIDAuNXMgZWFzZTtcbiAgfVxuICAubmVldG8tdGVtcGxhdGUtdGh1bWJuYWlsX190aXRsZSB7XG4gICAgdHJhbnNpdGlvbjogY29sb3IgMC41cyBlYXNlO1xuICB9XG4gICY6aG92ZXIge1xuICAgIC5uZWV0by10ZW1wbGF0ZV9faW1hZ2Uge1xuICAgICAgdHJhbnNmb3JtOiBzY2FsZSgxLjA4KTtcbiAgICB9XG4gICAgLm5lZXRvLXRlbXBsYXRlLXRodW1ibmFpbF9fdGl0bGUge1xuICAgICAgY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1ibGFjaykpICFpbXBvcnRhbnQ7XG4gICAgfVxuICB9XG59XG5cbi5uZWV0by10ZW1wbGF0ZXMtZnVsbC1wYWdlLXByZXZpZXdfX2hvbGRlciB7XG4gIHRyYW5zaXRpb246IGFsbCAwLjJzIGVhc2UtaW4tb3V0O1xufVxuXG4ubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19ob2xkZXItLWRlc2t0b3Age1xuICB3aWR0aDogMTAwJTtcbiAgaGVpZ2h0OiAxMDAlO1xuICBtYXgtd2lkdGg6IDEwMCU7XG59XG5cbi5uZWV0by10ZW1wbGF0ZXMtZnVsbC1wYWdlLXByZXZpZXdfX2hvbGRlci0tdGFibGV0IHtcbiAgbWF4LXdpZHRoOiA3NjhweDtcbiAgaGVpZ2h0OiAxMDI0cHg7XG4gIG1heC1oZWlnaHQ6IGNhbGMoMTAwJSAtIDMycHgpO1xuICBtYXJnaW4tdG9wOiAxNnB4ICFpbXBvcnRhbnQ7XG5cbiAgLm5lZXRvLXRlbXBsYXRlcy1mdWxsLXBhZ2UtcHJldmlld19faWZyYW1lIHtcbiAgICBib3JkZXI6IDFweCBzb2xpZCByZ2IodmFyKC0tbmVldG8tdWktZ3JheS0zMDApKSAhaW1wb3J0YW50O1xuICB9XG59XG5cbi5uZWV0by10ZW1wbGF0ZXMtZnVsbC1wYWdlLXByZXZpZXdfX2hvbGRlci0tbW9iaWxlIHtcbiAgbWF4LXdpZHRoOiAzODRweDtcbiAgaGVpZ2h0OiA4OTZweDtcbiAgbWF4LWhlaWdodDogY2FsYygxMDAlIC0gMzJweCk7XG4gIG1hcmdpbi10b3A6IDE2cHggIWltcG9ydGFudDtcblxuICAubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19pZnJhbWUge1xuICAgIGJvcmRlcjogMXB4IHNvbGlkIHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTMwMCkpICFpbXBvcnRhbnQ7XG4gIH1cbn1cbiIsIi5uZWV0by10ZW1wbGF0ZS1saXN0IC5uZWV0by11aS1tb2RhbF9fY2xvc2Uge1xuICB6LWluZGV4OiAxO1xufVxuXG4ubmVldG8tdGVtcGxhdGVfX2hlYWRlciB7XG4gIG1pbi1oZWlnaHQ6IDEyMHB4O1xuICBmbGV4LWdyb3c6IDE7XG59XG4ubmVldG8tdGVtcGxhdGVfX2ltYWdlIHtcbiAgd2lkdGg6IDEwMCU7XG4gIGFzcGVjdC1yYXRpbzogMTYvOTtcbiAgb2JqZWN0LWZpdDogY292ZXI7XG4gIG1heC13aWR0aDogMTAwJTtcbiAgbWF4LWhlaWdodDogMTAwJTtcbn1cbi5uZWV0by10ZW1wbGF0ZV9fZGVzY3JpcHRpb24ge1xuICBtaW4taGVpZ2h0OiA1NHB4O1xufVxuXG4ubmVldG8tdGVtcGxhdGUtdGh1bWJuYWlsIC5uZWV0by10ZW1wbGF0ZV9faW1hZ2Uge1xuICB0cmFuc2l0aW9uOiB0cmFuc2Zvcm0gMC41cyBlYXNlO1xufVxuLm5lZXRvLXRlbXBsYXRlLXRodW1ibmFpbCAubmVldG8tdGVtcGxhdGUtdGh1bWJuYWlsX190aXRsZSB7XG4gIHRyYW5zaXRpb246IGNvbG9yIDAuNXMgZWFzZTtcbn1cbi5uZWV0by10ZW1wbGF0ZS10aHVtYm5haWw6aG92ZXIgLm5lZXRvLXRlbXBsYXRlX19pbWFnZSB7XG4gIHRyYW5zZm9ybTogc2NhbGUoMS4wOCk7XG59XG4ubmVldG8tdGVtcGxhdGUtdGh1bWJuYWlsOmhvdmVyIC5uZWV0by10ZW1wbGF0ZS10aHVtYm5haWxfX3RpdGxlIHtcbiAgY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1ibGFjaykpICFpbXBvcnRhbnQ7XG59XG5cbi5uZWV0by10ZW1wbGF0ZXMtZnVsbC1wYWdlLXByZXZpZXdfX2hvbGRlciB7XG4gIHRyYW5zaXRpb246IGFsbCAwLjJzIGVhc2UtaW4tb3V0O1xufVxuXG4ubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19ob2xkZXItLWRlc2t0b3Age1xuICB3aWR0aDogMTAwJTtcbiAgaGVpZ2h0OiAxMDAlO1xuICBtYXgtd2lkdGg6IDEwMCU7XG59XG5cbi5uZWV0by10ZW1wbGF0ZXMtZnVsbC1wYWdlLXByZXZpZXdfX2hvbGRlci0tdGFibGV0IHtcbiAgbWF4LXdpZHRoOiA3NjhweDtcbiAgaGVpZ2h0OiAxMDI0cHg7XG4gIG1heC1oZWlnaHQ6IGNhbGMoMTAwJSAtIDMycHgpO1xuICBtYXJnaW4tdG9wOiAxNnB4ICFpbXBvcnRhbnQ7XG59XG4ubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19ob2xkZXItLXRhYmxldCAubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19pZnJhbWUge1xuICBib3JkZXI6IDFweCBzb2xpZCByZ2IodmFyKC0tbmVldG8tdWktZ3JheS0zMDApKSAhaW1wb3J0YW50O1xufVxuXG4ubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19ob2xkZXItLW1vYmlsZSB7XG4gIG1heC13aWR0aDogMzg0cHg7XG4gIGhlaWdodDogODk2cHg7XG4gIG1heC1oZWlnaHQ6IGNhbGMoMTAwJSAtIDMycHgpO1xuICBtYXJnaW4tdG9wOiAxNnB4ICFpbXBvcnRhbnQ7XG59XG4ubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19ob2xkZXItLW1vYmlsZSAubmVldG8tdGVtcGxhdGVzLWZ1bGwtcGFnZS1wcmV2aWV3X19pZnJhbWUge1xuICBib3JkZXI6IDFweCBzb2xpZCByZ2IodmFyKC0tbmVldG8tdWktZ3JheS0zMDApKSAhaW1wb3J0YW50O1xufVxuXG4ubmVldG8tdGVtcGxhdGVzLXNoYXJlLXByZXZpZXcge1xuICB3aWR0aDogMTAwJTtcbiAgaGVpZ2h0OiBjYWxjKDEwMHZoIC0gMTA0cHgpO1xuICBib3JkZXI6IHRoaW4gc29saWQgcmdiKHZhcigtLW5lZXRvLXVpLWdyYXktMzAwKSk7XG4gIGJveC1zaGFkb3c6IHZhcigtLW5lZXRvLXVpLXNoYWRvdy1tKTtcbiAgZGlzcGxheTogZmxleDtcbiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgYmFja2dyb3VuZC1jb2xvcjogcmdiKHZhcigtLW5lZXRvLXVpLXdoaXRlKSk7XG59IiwiLm5lZXRvLXRlbXBsYXRlcy1zaGFyZS1wcmV2aWV3IHtcbiAgd2lkdGg6IDEwMCU7XG4gIGhlaWdodDogY2FsYygxMDB2aCAtIDEwNHB4KTtcbiAgYm9yZGVyOiB0aGluIHNvbGlkIHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTMwMCkpO1xuICBib3gtc2hhZG93OiB2YXIoLS1uZWV0by11aS1zaGFkb3ctbSk7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gIGJhY2tncm91bmQtY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS13aGl0ZSkpO1xufVxuIl19 */";
3262
1336
  n(css,{});
3263
1337
 
3264
1338
  exports.CreateTemplateModal = CreateTemplateModal;
3265
1339
  exports.TemplateSettings = TemplateSettings;
1340
+ exports.TemplateTags = TemplateTags;
3266
1341
  //# sourceMappingURL=index.cjs.js.map