@bigbinary/neeto-email-notifications-frontend 2.2.22 → 2.2.23

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.
@@ -0,0 +1,2051 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
+ var React = require('react');
6
+ var neetoAtoms = require('@bigbinary/neeto-atoms');
7
+ var neetoCist = require('@bigbinary/neeto-cist');
8
+ var formik$1 = require('@bigbinary/neeto-atoms/formik');
9
+ var classnames = require('classnames');
10
+ var formik = require('formik');
11
+ var initializers = require('@bigbinary/neeto-commons-frontend/v2/initializers');
12
+ var FormikEditor = require('@bigbinary/neeto-editor/v2/FormikEditor');
13
+ var ramda = require('ramda');
14
+ var reactI18next = require('react-i18next');
15
+ var i18next = require('i18next');
16
+ var utils$1 = require('@bigbinary/neeto-editor/v2/utils');
17
+ var yup = require('yup');
18
+ var _typeof = require('@babel/runtime/helpers/typeof');
19
+ var jsxRuntime = require('react/jsx-runtime');
20
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
21
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
22
+ var reactDropzone = require('react-dropzone');
23
+ var reactUtils = require('@bigbinary/neeto-commons-frontend/v2/react-utils');
24
+ var emailNotificationApi = require('../../emailNotificationApi-TbcNMxTw.js');
25
+ require('stream');
26
+ var general = require('@bigbinary/neeto-commons-frontend/v2/utils/general');
27
+ var primitives = require('@bigbinary/neeto-atoms/primitives');
28
+ var reactRouterDom = require('react-router-dom');
29
+ var useFuncDebounce = require('@bigbinary/neeto-commons-frontend/v2/react-utils/useFuncDebounce');
30
+ var useQueryParams = require('@bigbinary/neeto-commons-frontend/v2/react-utils/useQueryParams');
31
+ var useUpdateEffect = require('@bigbinary/neeto-commons-frontend/v2/react-utils/useUpdateEffect');
32
+ var utils = require('@bigbinary/neeto-commons-frontend/v2/utils');
33
+ var reactUtils$1 = require('@bigbinary/neeto-commons-frontend/react-utils');
34
+ var EditorContent = require('@bigbinary/neeto-editor/v2/EditorContent');
35
+ require('@tanstack/react-query');
36
+ require('@bigbinary/neeto-commons-frontend/constants');
37
+ require('axios');
38
+
39
+ function _interopNamespaceDefault(e) {
40
+ var n = Object.create(null);
41
+ if (e) {
42
+ Object.keys(e).forEach(function (k) {
43
+ if (k !== 'default') {
44
+ var d = Object.getOwnPropertyDescriptor(e, k);
45
+ Object.defineProperty(n, k, d.get ? d : {
46
+ enumerable: true,
47
+ get: function () { return e[k]; }
48
+ });
49
+ }
50
+ });
51
+ }
52
+ n.default = e;
53
+ return Object.freeze(n);
54
+ }
55
+
56
+ var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
57
+
58
+ /**
59
+ * @license lucide-react v1.7.0 - ISC
60
+ *
61
+ * This source code is licensed under the ISC license.
62
+ * See the LICENSE file in the root directory of this source tree.
63
+ */
64
+
65
+ const mergeClasses = (...classes) => classes.filter((className, index, array) => {
66
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
67
+ }).join(" ").trim();
68
+
69
+ /**
70
+ * @license lucide-react v1.7.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ */
75
+
76
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
77
+
78
+ /**
79
+ * @license lucide-react v1.7.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */
84
+
85
+ const toCamelCase = (string) => string.replace(
86
+ /^([A-Z])|[\s-_]+(\w)/g,
87
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
88
+ );
89
+
90
+ /**
91
+ * @license lucide-react v1.7.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */
96
+
97
+
98
+ const toPascalCase = (string) => {
99
+ const camelCase = toCamelCase(string);
100
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
101
+ };
102
+
103
+ /**
104
+ * @license lucide-react v1.7.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */
109
+
110
+ var defaultAttributes = {
111
+ xmlns: "http://www.w3.org/2000/svg",
112
+ width: 24,
113
+ height: 24,
114
+ viewBox: "0 0 24 24",
115
+ fill: "none",
116
+ stroke: "currentColor",
117
+ strokeWidth: 2,
118
+ strokeLinecap: "round",
119
+ strokeLinejoin: "round"
120
+ };
121
+
122
+ /**
123
+ * @license lucide-react v1.7.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */
128
+
129
+ const hasA11yProp = (props) => {
130
+ for (const prop in props) {
131
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
132
+ return true;
133
+ }
134
+ }
135
+ return false;
136
+ };
137
+
138
+ const LucideContext = React.createContext({});
139
+ const useLucideContext = () => React.useContext(LucideContext);
140
+
141
+ const Icon = React.forwardRef(
142
+ ({ color, size, strokeWidth, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref) => {
143
+ const {
144
+ size: contextSize = 24,
145
+ strokeWidth: contextStrokeWidth = 2,
146
+ absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
147
+ color: contextColor = "currentColor",
148
+ className: contextClass = ""
149
+ } = useLucideContext() ?? {};
150
+ const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
151
+ return React.createElement(
152
+ "svg",
153
+ {
154
+ ref,
155
+ ...defaultAttributes,
156
+ width: size ?? contextSize ?? defaultAttributes.width,
157
+ height: size ?? contextSize ?? defaultAttributes.height,
158
+ stroke: color ?? contextColor,
159
+ strokeWidth: calculatedStrokeWidth,
160
+ className: mergeClasses("lucide", contextClass, className),
161
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
162
+ ...rest
163
+ },
164
+ [
165
+ ...iconNode.map(([tag, attrs]) => React.createElement(tag, attrs)),
166
+ ...Array.isArray(children) ? children : [children]
167
+ ]
168
+ );
169
+ }
170
+ );
171
+
172
+ /**
173
+ * @license lucide-react v1.7.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */
178
+
179
+
180
+ const createLucideIcon = (iconName, iconNode) => {
181
+ const Component = React.forwardRef(
182
+ ({ className, ...props }, ref) => React.createElement(Icon, {
183
+ ref,
184
+ iconNode,
185
+ className: mergeClasses(
186
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
187
+ `lucide-${iconName}`,
188
+ className
189
+ ),
190
+ ...props
191
+ })
192
+ );
193
+ Component.displayName = toPascalCase(iconName);
194
+ return Component;
195
+ };
196
+
197
+ /**
198
+ * @license lucide-react v1.7.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */
203
+
204
+
205
+ const __iconNode$6 = [
206
+ ["path", { d: "M12 15V3", key: "m9g1x1" }],
207
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
208
+ ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
209
+ ];
210
+ const Download = createLucideIcon("download", __iconNode$6);
211
+
212
+ /**
213
+ * @license lucide-react v1.7.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */
218
+
219
+
220
+ const __iconNode$5 = [
221
+ ["path", { d: "M12 3v12", key: "1x0j5s" }],
222
+ ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
223
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
224
+ ];
225
+ const Upload = createLucideIcon("upload", __iconNode$5);
226
+
227
+ var CSV_FILE_SIZE_IN_KB = 32;
228
+ var ONE_KILOBYTE_IN_BYTES = 1024;
229
+ var DOWNLOAD_SAMPLE_EMAIL_CSV_FILE = "https://d2v7kzglnr2dnh.cloudfront.net/others/sample-bulk-email.csv";
230
+
231
+ var Requirements = reactUtils.withT(function (_ref) {
232
+ var t = _ref.t,
233
+ fileSize = _ref.fileSize;
234
+ return /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Callout, {
235
+ className: "flex flex-col items-center py-6",
236
+ variant: "info",
237
+ children: [/*#__PURE__*/jsxRuntime.jsxs("ul", {
238
+ className: "flex list-outside list-disc flex-col gap-y-1 leading-normal font-normal",
239
+ children: [fileSize && /*#__PURE__*/jsxRuntime.jsx("li", {
240
+ children: t("neetoMolecules.shareViaLink.requirements.fileTypeAndSize", {
241
+ limit: fileSize
242
+ })
243
+ }), /*#__PURE__*/jsxRuntime.jsx("li", {
244
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
245
+ components: {
246
+ strong: /*#__PURE__*/jsxRuntime.jsx("strong", {
247
+ className: "font-semibold"
248
+ })
249
+ },
250
+ i18nKey: "neetoMolecules.shareViaLink.requirements.shouldContainColumns"
251
+ })
252
+ })]
253
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
254
+ href: DOWNLOAD_SAMPLE_EMAIL_CSV_FILE,
255
+ icon: Download,
256
+ iconPosition: "left",
257
+ label: t("neetoMolecules.shareViaLink.bulkUploadPane.downloadSampleCSV"),
258
+ variant: "link"
259
+ })]
260
+ });
261
+ });
262
+ var Requirements$1 = /*#__PURE__*/React.memo(Requirements);
263
+
264
+ function ownKeys$1$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; }
265
+ function _objectSpread$1$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
266
+ var BulkUploadPane = function BulkUploadPane(_ref) {
267
+ var _fileRejections$;
268
+ var isOpen = _ref.isOpen,
269
+ fileSize = _ref.fileSize,
270
+ onClose = _ref.onClose,
271
+ handleFileSubmit = _ref.handleFileSubmit;
272
+ var _useDropzone = reactDropzone.useDropzone({
273
+ accept: {
274
+ "text/csv": []
275
+ },
276
+ maxFiles: 1,
277
+ maxSize: fileSize * ONE_KILOBYTE_IN_BYTES,
278
+ onDrop: function onDrop(files) {
279
+ return files[0] && handleFileSubmit(files[0]);
280
+ }
281
+ }),
282
+ getRootProps = _useDropzone.getRootProps,
283
+ getInputProps = _useDropzone.getInputProps,
284
+ isDragActive = _useDropzone.isDragActive,
285
+ fileRejections = _useDropzone.fileRejections;
286
+ var errors = (_fileRejections$ = fileRejections[0]) === null || _fileRejections$ === void 0 ? void 0 : _fileRejections$.errors.map(function (_ref2) {
287
+ var message = _ref2.message,
288
+ code = _ref2.code;
289
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
290
+ className: "text-destructive items",
291
+ "data-testid": "file-input-error-message",
292
+ variant: "body3",
293
+ children: message
294
+ }, code);
295
+ });
296
+ var _useTranslation = reactI18next.useTranslation(),
297
+ t = _useTranslation.t;
298
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet, {
299
+ isOpen: isOpen,
300
+ onClose: onClose,
301
+ "aria-describedby": undefined,
302
+ "data-testid": "bulk-upload-pane",
303
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
304
+ tabIndex: 0,
305
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Header, {
306
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Title, {
307
+ "data-testid": "bulk-upload-header",
308
+ children: t("neetoMolecules.shareViaLink.bulkUpload")
309
+ })
310
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Body, {
311
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
312
+ className: "flex w-full flex-col gap-y-4",
313
+ children: [/*#__PURE__*/jsxRuntime.jsx(Requirements$1, {
314
+ fileSize: fileSize
315
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$1$3(_objectSpread$1$3({}, getRootProps({
316
+ className: classnames("border-primary flex cursor-pointer flex-col items-center rounded-md border border-dashed p-2 transition duration-500 ease-in-out hover:bg-muted", {
317
+ "border-muted": isDragActive,
318
+ "border-destructive bg-destructive/10 hover:bg-destructive/10": fileRejections.length
319
+ })
320
+ })), {}, {
321
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
322
+ className: "flex flex-col items-center gap-y-3 p-4",
323
+ children: [/*#__PURE__*/jsxRuntime.jsx(Upload, {
324
+ className: "text-primary",
325
+ size: 32
326
+ }), /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread$1$3(_objectSpread$1$3({}, getInputProps()), {}, {
327
+ "data-testid": "csv-upload-input"
328
+ })), isDragActive ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
329
+ variant: "body2",
330
+ children: t("neetoMolecules.shareViaLink.bulkUploadPane.dropFileHere")
331
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
332
+ className: "flex flex-col items-center gap-y-1",
333
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
334
+ className: "flex w-full items-center justify-center gap-x-1",
335
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
336
+ i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.dragNDrop",
337
+ components: {
338
+ Button: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
339
+ variant: "link"
340
+ })
341
+ }
342
+ })
343
+ }), /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Typography, {
344
+ className: "text-muted-foreground",
345
+ variant: "body3",
346
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
347
+ i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.supportedFormat",
348
+ values: {
349
+ fileType: "csv"
350
+ },
351
+ components: {
352
+ code: /*#__PURE__*/jsxRuntime.jsx("code", {
353
+ className: "bg-background m-0 border-s-0 p-0 text-sm"
354
+ })
355
+ }
356
+ }), " ", fileSize && t("neetoMolecules.shareViaLink.bulkUploadPane.supportedSize", {
357
+ fileSize: fileSize
358
+ })]
359
+ })]
360
+ })]
361
+ }), errors]
362
+ }))]
363
+ })
364
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Footer, {
365
+ className: "flex items-center gap-x-2",
366
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
367
+ "data-testid": "bulk-upload-cancel-button",
368
+ label: t("neetoMolecules.common.actions.cancel"),
369
+ type: "reset",
370
+ variant: "ghost",
371
+ onClick: onClose
372
+ })
373
+ })]
374
+ })
375
+ });
376
+ };
377
+
378
+ var isValidEmail$1 = function isValidEmail(email) {
379
+ return yup.string().email().isValidSync(email);
380
+ };
381
+ var createEmailOptions$1 = function createEmailOptions() {
382
+ var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
383
+ return emails.map(function (email) {
384
+ return {
385
+ label: email,
386
+ value: email,
387
+ valid: isValidEmail$1(email)
388
+ };
389
+ });
390
+ };
391
+ var parseCsvEmails = function parseCsvEmails(file, onSuccess) {
392
+ emailNotificationApi.Papa.parse(file, {
393
+ header: true,
394
+ skipEmptyLines: true,
395
+ transformHeader: function transformHeader(h) {
396
+ return h.toLowerCase().replace(/\W/g, "");
397
+ },
398
+ complete: function complete(results) {
399
+ var _results$meta$fields;
400
+ var isEmailFieldPresent = (_results$meta$fields = results.meta.fields) === null || _results$meta$fields === void 0 ? void 0 : _results$meta$fields.includes("email");
401
+ if (isEmailFieldPresent) {
402
+ var emails = results.data.filter(ramda.prop("email")).map(function (item) {
403
+ return item.email.trim();
404
+ });
405
+ onSuccess(createEmailOptions$1(emails));
406
+ } else {
407
+ neetoAtoms.Toastr.error(i18next.t("neetoMolecules.sendToFields.errors.invalidCsv"));
408
+ }
409
+ }
410
+ });
411
+ };
412
+
413
+ function ownKeys$a(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; }
414
+ function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
415
+ var SendToFields = function SendToFields(_ref) {
416
+ var emailInputProps = _ref.emailInputProps,
417
+ ccInputProps = _ref.ccInputProps,
418
+ bccInputProps = _ref.bccInputProps,
419
+ _ref$showUploadCsvBut = _ref.showUploadCsvButton,
420
+ showUploadCsvButton = _ref$showUploadCsvBut === void 0 ? false : _ref$showUploadCsvBut,
421
+ _ref$showCcBccButton = _ref.showCcBccButton,
422
+ showCcBccButton = _ref$showCcBccButton === void 0 ? false : _ref$showCcBccButton,
423
+ _ref$showCcField = _ref.showCcField,
424
+ showCcField = _ref$showCcField === void 0 ? false : _ref$showCcField,
425
+ _ref$showBccField = _ref.showBccField,
426
+ showBccField = _ref$showBccField === void 0 ? false : _ref$showBccField,
427
+ _ref$showSendToField = _ref.showSendToField,
428
+ showSendToField = _ref$showSendToField === void 0 ? true : _ref$showSendToField;
429
+ var _useState = React.useState(false),
430
+ _useState2 = _slicedToArray(_useState, 2),
431
+ isBulkUploadPaneOpen = _useState2[0],
432
+ setIsBulkUploadPaneOpen = _useState2[1];
433
+ var sendToFieldRef = React.useRef();
434
+ var _useFormikContext = formik.useFormikContext(),
435
+ _useFormikContext$val = _useFormikContext.values,
436
+ showCopyEmails = _useFormikContext$val.showCopyEmails,
437
+ existingSendToEmails = _useFormikContext$val[emailInputProps.name || "sendTo"],
438
+ setFieldValue = _useFormikContext.setFieldValue;
439
+ var _useTranslation = reactI18next.useTranslation(),
440
+ t = _useTranslation.t;
441
+ var handleCSVFile = function handleCSVFile(file) {
442
+ try {
443
+ var _sendToFieldRef$curre;
444
+ var onSuccess = function onSuccess(values) {
445
+ return setFieldValue(emailInputProps.name || "sendTo", [].concat(_toConsumableArray(existingSendToEmails), _toConsumableArray(values)));
446
+ };
447
+ parseCsvEmails(file, onSuccess);
448
+ setIsBulkUploadPaneOpen(false);
449
+ (_sendToFieldRef$curre = sendToFieldRef.current) === null || _sendToFieldRef$curre === void 0 || _sendToFieldRef$curre.focus();
450
+ } catch (error) {
451
+ neetoAtoms.Toastr.error(error);
452
+ }
453
+ };
454
+ var handelCcBccButtonClick = function handelCcBccButtonClick(e) {
455
+ e.stopPropagation();
456
+ setFieldValue("showCopyEmails", !showCopyEmails);
457
+ };
458
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
459
+ className: "w-full",
460
+ "data-testid": "send-to-text-field",
461
+ children: [showUploadCsvButton && /*#__PURE__*/jsxRuntime.jsx("div", {
462
+ className: "flex justify-end",
463
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
464
+ "data-testid": "bulk-upload-button",
465
+ icon: Upload,
466
+ label: t("neetoMolecules.shareViaLink.bulkUpload"),
467
+ size: "sm",
468
+ variant: "link",
469
+ onClick: function onClick() {
470
+ return setIsBulkUploadPaneOpen(true);
471
+ }
472
+ })
473
+ }), showSendToField && /*#__PURE__*/jsxRuntime.jsx("div", {
474
+ className: "border-border w-full border-b pb-1",
475
+ children: /*#__PURE__*/jsxRuntime.jsx(formik$1.MultiEmailInput, _objectSpread$a(_objectSpread$a({
476
+ name: "sendTo",
477
+ ref: sendToFieldRef
478
+ }, emailInputProps), {}, {
479
+ suffix: showCcBccButton && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
480
+ "data-testid": "cc-bcc-button",
481
+ label: t("neetoMolecules.emailForm.labels.ccBcc"),
482
+ size: "sm",
483
+ variant: "link",
484
+ onClick: handelCcBccButtonClick,
485
+ onKeyDown: function onKeyDown(event) {
486
+ return event.stopPropagation();
487
+ }
488
+ })
489
+ }))
490
+ }), (showCopyEmails || showCcField || showBccField) && /*#__PURE__*/jsxRuntime.jsxs("div", {
491
+ className: "mt-5 flex w-full flex-col gap-5",
492
+ children: [(showCopyEmails || showCcField) && /*#__PURE__*/jsxRuntime.jsx("div", {
493
+ className: "border-border w-full border-b pb-1",
494
+ children: /*#__PURE__*/jsxRuntime.jsx(formik$1.MultiEmailInput, _objectSpread$a({
495
+ name: "sendToBcc"
496
+ }, ccInputProps))
497
+ }), (showCopyEmails || showBccField) && /*#__PURE__*/jsxRuntime.jsx("div", {
498
+ className: "border-border w-full border-b pb-1",
499
+ children: /*#__PURE__*/jsxRuntime.jsx(formik$1.MultiEmailInput, _objectSpread$a({
500
+ name: "sendToCc"
501
+ }, bccInputProps))
502
+ })]
503
+ }), /*#__PURE__*/jsxRuntime.jsx(BulkUploadPane, {
504
+ fileSize: CSV_FILE_SIZE_IN_KB,
505
+ handleFileSubmit: handleCSVFile,
506
+ isOpen: isBulkUploadPaneOpen,
507
+ onClose: function onClose() {
508
+ return setIsBulkUploadPaneOpen(false);
509
+ }
510
+ })]
511
+ });
512
+ };
513
+
514
+ /**
515
+ * @license lucide-react v1.7.0 - ISC
516
+ *
517
+ * This source code is licensed under the ISC license.
518
+ * See the LICENSE file in the root directory of this source tree.
519
+ */
520
+
521
+
522
+ const __iconNode$4 = [
523
+ [
524
+ "path",
525
+ { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
526
+ ],
527
+ [
528
+ "path",
529
+ {
530
+ d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
531
+ key: "e1hn23"
532
+ }
533
+ ]
534
+ ];
535
+ const Braces = createLucideIcon("braces", __iconNode$4);
536
+
537
+ var parseVariables = function parseVariables() {
538
+ var variableArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
539
+ var uncategorized = [];
540
+ var groupedVariables = [];
541
+ var categorySet = new Set();
542
+ variableArr.forEach(function (variable) {
543
+ var category = variable.category,
544
+ label = variable.label,
545
+ variables = variable.variables;
546
+ if (category && variables) {
547
+ var parsedVariables = variables.map(ramda.mergeLeft({
548
+ category: category,
549
+ categoryLabel: label
550
+ }));
551
+ if (!categorySet.has(category)) {
552
+ categorySet.add(category);
553
+ groupedVariables.push({
554
+ label: label,
555
+ variables: parsedVariables
556
+ });
557
+ } else {
558
+ var existingGroup = neetoCist.findBy({
559
+ label: label
560
+ }, groupedVariables);
561
+ existingGroup.variables = ramda.uniqBy(ramda.prop("key"), existingGroup.variables.concat(parsedVariables));
562
+ }
563
+ } else {
564
+ uncategorized.push(variable);
565
+ }
566
+ });
567
+ if (!ramda.isEmpty(uncategorized)) {
568
+ groupedVariables.push({
569
+ label: !ramda.isEmpty(groupedVariables) ? "Others" : null,
570
+ variables: uncategorized
571
+ });
572
+ }
573
+ return groupedVariables;
574
+ };
575
+
576
+ var _excluded$6 = ["onVariableClick", "variables", "buttonProps"];
577
+ function ownKeys$9(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; }
578
+ function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
579
+ var DynamicVariables = function DynamicVariables(_ref) {
580
+ var _ref$onVariableClick = _ref.onVariableClick,
581
+ onVariableClick = _ref$onVariableClick === void 0 ? neetoCist.noop : _ref$onVariableClick,
582
+ _ref$variables = _ref.variables,
583
+ variables = _ref$variables === void 0 ? [] : _ref$variables,
584
+ buttonProps = _ref.buttonProps,
585
+ dropdownProps = _objectWithoutProperties(_ref, _excluded$6);
586
+ if (ramda.isEmpty(variables)) return null;
587
+ var parsedVariables = parseVariables(variables);
588
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DropdownMenu, _objectSpread$9(_objectSpread$9({
589
+ customTarget: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$9({
590
+ "data-testid": "dynamic-variables-button",
591
+ icon: Braces,
592
+ size: "icon",
593
+ variant: "outline"
594
+ }, buttonProps))
595
+ }, dropdownProps), {}, {
596
+ dropdownProps: _objectSpread$9({
597
+ className: "min-w-56"
598
+ }, dropdownProps === null || dropdownProps === void 0 ? void 0 : dropdownProps.dropdownProps),
599
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
600
+ className: "flex max-w-[22.5rem] min-w-[11.5rem] flex-col gap-1.5 p-2",
601
+ "data-testid": "dynamic-variables-list",
602
+ children: parsedVariables.map(function (_ref2) {
603
+ var label = _ref2.label,
604
+ variables = _ref2.variables;
605
+ return /*#__PURE__*/jsxRuntime.jsxs(React.Fragment, {
606
+ children: [label && /*#__PURE__*/jsxRuntime.jsxs("div", {
607
+ className: "flex flex-row items-center gap-x-2",
608
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
609
+ variant: "h6",
610
+ children: label
611
+ }), /*#__PURE__*/jsxRuntime.jsx("hr", {
612
+ className: "border-border flex flex-grow"
613
+ })]
614
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
615
+ className: "flex flex-wrap items-center gap-2",
616
+ "data-testid": general.joinHyphenCase("dynamic-variables-list", label),
617
+ children: variables.map(function (item) {
618
+ return /*#__PURE__*/jsxRuntime.jsx("button", {
619
+ className: "border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary rounded-md border p-1.5 text-start transition-colors select-none focus:outline-none",
620
+ "data-testid": general.joinHyphenCase("dynamic-variables-list-item", item.label),
621
+ onClick: function onClick() {
622
+ return onVariableClick(item);
623
+ },
624
+ children: item.label
625
+ }, item.label);
626
+ })
627
+ })]
628
+ }, label);
629
+ })
630
+ })
631
+ }));
632
+ };
633
+
634
+ var Breadcrumbs = reactUtils.withT(function (_ref) {
635
+ var t = _ref.t,
636
+ _ref$breadcrumbs = _ref.breadcrumbs,
637
+ breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
638
+ _ref$hasTrailingSepar = _ref.hasTrailingSeparator,
639
+ hasTrailingSeparator = _ref$hasTrailingSepar === void 0 ? false : _ref$hasTrailingSepar,
640
+ className = _ref.className;
641
+ return /*#__PURE__*/jsxRuntime.jsx(primitives.Breadcrumb, {
642
+ "aria-label": t("neetoMolecules.breadcrumbs.breadcrumbAriaLabel"),
643
+ className: classnames("mb-4", className),
644
+ children: /*#__PURE__*/jsxRuntime.jsx(primitives.BreadcrumbList, {
645
+ children: breadcrumbs.map(function (_ref2, index) {
646
+ var text = _ref2.text,
647
+ _ref2$link = _ref2.link,
648
+ link = _ref2$link === void 0 ? "#" : _ref2$link;
649
+ var isLast = index + 1 === breadcrumbs.length;
650
+ var isCurrentPage = isLast && !hasTrailingSeparator;
651
+ return /*#__PURE__*/jsxRuntime.jsxs(React.Fragment, {
652
+ children: [/*#__PURE__*/jsxRuntime.jsx(primitives.BreadcrumbItem, {
653
+ "data-testid": "header-breadcrumb",
654
+ children: isCurrentPage ? /*#__PURE__*/jsxRuntime.jsx(primitives.BreadcrumbPage, {
655
+ "data-testid": "".concat(general.hyphenize(text), "-breadcrumb"),
656
+ children: text
657
+ }) : /*#__PURE__*/jsxRuntime.jsx(primitives.BreadcrumbLink, {
658
+ asChild: true,
659
+ children: /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Link, {
660
+ "data-testid": "".concat(general.hyphenize(text), "-breadcrumb"),
661
+ to: link,
662
+ children: text
663
+ })
664
+ })
665
+ }), !isCurrentPage && /*#__PURE__*/jsxRuntime.jsx(primitives.BreadcrumbSeparator, {})]
666
+ }, index);
667
+ })
668
+ })
669
+ });
670
+ });
671
+
672
+ /**
673
+ * @license lucide-react v1.7.0 - ISC
674
+ *
675
+ * This source code is licensed under the ISC license.
676
+ * See the LICENSE file in the root directory of this source tree.
677
+ */
678
+
679
+
680
+ const __iconNode$3 = [
681
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
682
+ ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
683
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
684
+ ];
685
+ const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$3);
686
+
687
+ var SIZE = {
688
+ "default": 16,
689
+ large: 18
690
+ };
691
+
692
+ var _excluded$5 = ["label"];
693
+ function ownKeys$8(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; }
694
+ function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
695
+ var HelpPopover = function HelpPopover(_ref) {
696
+ var title = _ref.title,
697
+ _ref$size = _ref.size,
698
+ size = _ref$size === void 0 ? "large" : _ref$size,
699
+ description = _ref.description,
700
+ helpLinkProps = _ref.helpLinkProps,
701
+ className = _ref.className,
702
+ _ref$iconColor = _ref.iconColor,
703
+ iconColor = _ref$iconColor === void 0 ? "currentColor" : _ref$iconColor,
704
+ _ref$icon = _ref.icon,
705
+ IconComponent = _ref$icon === void 0 ? CircleQuestionMark : _ref$icon,
706
+ side = _ref.side,
707
+ sideOffset = _ref.sideOffset,
708
+ align = _ref.align,
709
+ alignOffset = _ref.alignOffset;
710
+ var _useTranslation = reactI18next.useTranslation(),
711
+ t = _useTranslation.t;
712
+ var position = align && align !== "center" ? "".concat(side, "-").concat(align) : side;
713
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Popover, {
714
+ alignOffset: alignOffset,
715
+ position: position,
716
+ sideOffset: sideOffset,
717
+ className: "!max-w-[calc(100vw-2rem)]",
718
+ closeDelay: 150,
719
+ collisionPadding: 12,
720
+ openDelay: 0,
721
+ trigger: /*#__PURE__*/jsxRuntime.jsx("button", {
722
+ "data-testid": "help-popover-button",
723
+ type: "button",
724
+ className: classnames("inline-flex cursor-pointer items-center justify-center rounded-full border-none bg-transparent p-0", className),
725
+ children: /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
726
+ color: iconColor,
727
+ size: SIZE[size]
728
+ })
729
+ }),
730
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
731
+ className: "flex flex-col",
732
+ onClick: function onClick(event) {
733
+ return event.stopPropagation();
734
+ },
735
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
736
+ asChild: true,
737
+ variant: "body2",
738
+ weight: "semibold",
739
+ children: /*#__PURE__*/jsxRuntime.jsx("h3", {
740
+ className: "mb-2",
741
+ "data-testid": "help-popover-title",
742
+ children: title
743
+ })
744
+ }), typeof description === "string" ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
745
+ color: "muted",
746
+ "data-testid": "help-popover-description",
747
+ variant: "body2",
748
+ children: description
749
+ }) : description, helpLinkProps && function () {
750
+ var linkLabel = helpLinkProps.label,
751
+ restLinkProps = _objectWithoutProperties(helpLinkProps, _excluded$5);
752
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
753
+ asChild: true,
754
+ className: "mt-3 self-start",
755
+ variant: "link",
756
+ children: /*#__PURE__*/jsxRuntime.jsx("a", _objectSpread$8(_objectSpread$8({
757
+ "data-testid": "help-popover-link-button",
758
+ rel: "noreferrer",
759
+ target: "_blank"
760
+ }, restLinkProps), {}, {
761
+ children: linkLabel !== null && linkLabel !== void 0 ? linkLabel : t("neetoMolecules.common.viewHelpArticle")
762
+ }))
763
+ });
764
+ }()]
765
+ })
766
+ });
767
+ };
768
+
769
+ /**
770
+ * @license lucide-react v1.7.0 - ISC
771
+ *
772
+ * This source code is licensed under the ISC license.
773
+ * See the LICENSE file in the root directory of this source tree.
774
+ */
775
+
776
+
777
+ const __iconNode$2 = [
778
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
779
+ ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
780
+ ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
781
+ ];
782
+ const Ellipsis = createLucideIcon("ellipsis", __iconNode$2);
783
+
784
+ /**
785
+ * @license lucide-react v1.7.0 - ISC
786
+ *
787
+ * This source code is licensed under the ISC license.
788
+ * See the LICENSE file in the root directory of this source tree.
789
+ */
790
+
791
+
792
+ const __iconNode$1 = [
793
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
794
+ ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
795
+ ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
796
+ ];
797
+ const EllipsisVertical = createLucideIcon("ellipsis-vertical", __iconNode$1);
798
+
799
+ var DEFAULT_TOOLTIP_PROPS = {
800
+ disabled: true,
801
+ position: "bottom"
802
+ };
803
+
804
+ var _excluded$2$1 = ["isVisible", "key"];
805
+ function ownKeys$2$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; }
806
+ function _objectSpread$2$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
807
+ var Submenu = reactUtils.withT(function (_ref) {
808
+ var t = _ref.t,
809
+ label = _ref.label,
810
+ _ref$menuItems = _ref.menuItems,
811
+ menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems;
812
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DropdownMenu.SubMenu, {
813
+ label: label,
814
+ triggerProps: {
815
+ "aria-haspopup": "menu"
816
+ },
817
+ contentProps: {
818
+ "aria-label": t("neetoMolecules.moreDropdown.submenuAriaLabel", {
819
+ label: label
820
+ })
821
+ },
822
+ children: menuItems.map(function (_ref2) {
823
+ var _ref2$isVisible = _ref2.isVisible,
824
+ isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
825
+ key = _ref2.key,
826
+ itemProps = _objectWithoutProperties(_ref2, _excluded$2$1);
827
+ if (!isVisible) return null;
828
+ return /*#__PURE__*/jsxRuntime.jsx(MenuItem, _objectSpread$2$1({}, itemProps), key !== null && key !== void 0 ? key : neetoCist.hyphenate(itemProps.label || "menu-item"));
829
+ })
830
+ });
831
+ });
832
+
833
+ var _excluded$1$1 = ["onClick", "label", "type", "hasSubItems", "menuItems", "dropdownProps"];
834
+ function ownKeys$1$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; }
835
+ function _objectSpread$1$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
836
+ var MenuItem = function MenuItem(_ref) {
837
+ var onClick = _ref.onClick,
838
+ label = _ref.label,
839
+ _ref$type = _ref.type,
840
+ type = _ref$type === void 0 ? "menuItem" : _ref$type,
841
+ _ref$hasSubItems = _ref.hasSubItems,
842
+ hasSubItems = _ref$hasSubItems === void 0 ? false : _ref$hasSubItems,
843
+ menuItems = _ref.menuItems,
844
+ dropdownProps = _ref.dropdownProps,
845
+ menuItemProps = _objectWithoutProperties(_ref, _excluded$1$1);
846
+ if (type === "divider") return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DropdownMenu.Divider, {
847
+ role: "separator"
848
+ });
849
+ if (hasSubItems) {
850
+ return /*#__PURE__*/jsxRuntime.jsx(Submenu, _objectSpread$1$2({}, _objectSpread$1$2({
851
+ dropdownProps: dropdownProps,
852
+ label: label,
853
+ menuItems: menuItems
854
+ }, menuItemProps)));
855
+ }
856
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DropdownMenu.MenuItem, _objectSpread$1$2(_objectSpread$1$2({
857
+ onClick: onClick,
858
+ role: "menuitem"
859
+ }, menuItemProps), {}, {
860
+ children: label
861
+ }));
862
+ };
863
+
864
+ var _excluded$4 = ["isRounded", "size", "tooltipProps", "variant"],
865
+ _excluded2$1 = ["className"],
866
+ _excluded3 = ["isVisible", "key"];
867
+ function ownKeys$7(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; }
868
+ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
869
+ var MoreDropdown = function MoreDropdown(_ref) {
870
+ var _ref$dropdownButtonPr = _ref.dropdownButtonProps,
871
+ dropdownButtonProps = _ref$dropdownButtonPr === void 0 ? {} : _ref$dropdownButtonPr,
872
+ _ref$isVertical = _ref.isVertical,
873
+ isVertical = _ref$isVertical === void 0 ? false : _ref$isVertical,
874
+ _ref$isDisabled = _ref.isDisabled,
875
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
876
+ _ref$dropdownProps = _ref.dropdownProps,
877
+ dropdownProps = _ref$dropdownProps === void 0 ? {} : _ref$dropdownProps,
878
+ menuTopChildren = _ref.menuTopChildren,
879
+ menuBottomChildren = _ref.menuBottomChildren,
880
+ _ref$menuItems = _ref.menuItems,
881
+ menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems;
882
+ var _useTranslation = reactI18next.useTranslation(),
883
+ t = _useTranslation.t;
884
+ var isRoundedButton = dropdownButtonProps.isRounded,
885
+ _dropdownButtonProps$ = dropdownButtonProps.size,
886
+ buttonSize = _dropdownButtonProps$ === void 0 ? "icon" : _dropdownButtonProps$,
887
+ customTooltipProps = dropdownButtonProps.tooltipProps,
888
+ _dropdownButtonProps$2 = dropdownButtonProps.variant,
889
+ variant = _dropdownButtonProps$2 === void 0 ? "ghost" : _dropdownButtonProps$2,
890
+ buttonProps = _objectWithoutProperties(dropdownButtonProps, _excluded$4);
891
+ var tooltipProps = ramda.mergeRight(DEFAULT_TOOLTIP_PROPS, customTooltipProps);
892
+ var TargetIcon = isVertical ? EllipsisVertical : Ellipsis;
893
+ var contentClassName = dropdownProps.className,
894
+ restDropdownProps = _objectWithoutProperties(dropdownProps, _excluded2$1);
895
+ var isDropdownDisabled = isDisabled || dropdownProps.disabled;
896
+ var triggerClassName = classnames("shrink-0", {
897
+ "rounded-full": isRoundedButton
898
+ });
899
+ if (isDropdownDisabled && !tooltipProps.disabled) {
900
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
901
+ content: tooltipProps.content,
902
+ position: tooltipProps.position || "bottom",
903
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
904
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$7({
905
+ variant: variant,
906
+ disabled: true,
907
+ className: triggerClassName,
908
+ "data-dropdown-button-style": "more-dropdown",
909
+ "data-testid": "more-dropdown-button",
910
+ icon: TargetIcon,
911
+ size: buttonSize
912
+ }, buttonProps))
913
+ })
914
+ });
915
+ }
916
+ return /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.DropdownMenu, _objectSpread$7(_objectSpread$7({
917
+ customTarget: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread$7({
918
+ variant: variant,
919
+ "aria-haspopup": "menu",
920
+ "aria-label": t("neetoMolecules.moreDropdown.buttonAriaLabel"),
921
+ className: triggerClassName,
922
+ "data-dropdown-button-style": "more-dropdown",
923
+ disabled: isDropdownDisabled,
924
+ icon: TargetIcon,
925
+ size: buttonSize
926
+ }, buttonProps)),
927
+ dropdownProps: {
928
+ "aria-label": t("neetoMolecules.moreDropdown.menuAriaLabel"),
929
+ className: contentClassName
930
+ }
931
+ }, restDropdownProps), {}, {
932
+ children: [menuTopChildren, menuItems.map(function (_ref2) {
933
+ var _ref2$isVisible = _ref2.isVisible,
934
+ isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
935
+ key = _ref2.key,
936
+ menuItemProps = _objectWithoutProperties(_ref2, _excluded3);
937
+ if (!isVisible) return null;
938
+ return /*#__PURE__*/jsxRuntime.jsx(MenuItem, _objectSpread$7({}, menuItemProps), key !== null && key !== void 0 ? key : neetoCist.hyphenate(menuItemProps.label || "menu-item"));
939
+ }), menuBottomChildren]
940
+ }));
941
+ };
942
+
943
+ /**
944
+ * @license lucide-react v1.7.0 - ISC
945
+ *
946
+ * This source code is licensed under the ISC license.
947
+ * See the LICENSE file in the root directory of this source tree.
948
+ */
949
+
950
+
951
+ const __iconNode = [
952
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
953
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
954
+ ];
955
+ const Search$1 = createLucideIcon("search", __iconNode);
956
+
957
+ var getInitialSearchValue = function getInitialSearchValue(_ref) {
958
+ var _ref$initialValue = _ref.initialValue,
959
+ initialValue = _ref$initialValue === void 0 ? "" : _ref$initialValue,
960
+ enableUrlSync = _ref.enableUrlSync,
961
+ searchParamName = _ref.searchParamName;
962
+ if (enableUrlSync) {
963
+ var _queryParams$searchPa;
964
+ var queryParams = utils.getQueryParams({
965
+ toCamelCase: false
966
+ });
967
+ return (_queryParams$searchPa = queryParams[searchParamName]) !== null && _queryParams$searchPa !== void 0 ? _queryParams$searchPa : "";
968
+ }
969
+ return initialValue;
970
+ };
971
+
972
+ var _excluded$3 = ["value", "debounceTime", "onSearch", "onChange", "enableUrlSync", "searchParamName", "className", "label"];
973
+ function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
974
+ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
975
+ var Search = function Search(_ref) {
976
+ var value = _ref.value,
977
+ _ref$debounceTime = _ref.debounceTime,
978
+ debounceTime = _ref$debounceTime === void 0 ? 300 : _ref$debounceTime,
979
+ onSearch = _ref.onSearch,
980
+ onChange = _ref.onChange,
981
+ _ref$enableUrlSync = _ref.enableUrlSync,
982
+ enableUrlSync = _ref$enableUrlSync === void 0 ? false : _ref$enableUrlSync,
983
+ _ref$searchParamName = _ref.searchParamName,
984
+ searchParamName = _ref$searchParamName === void 0 ? "search_term" : _ref$searchParamName,
985
+ className = _ref.className,
986
+ label = _ref.label,
987
+ inputProps = _objectWithoutProperties(_ref, _excluded$3);
988
+ var _useTranslation = reactI18next.useTranslation(),
989
+ t = _useTranslation.t;
990
+ var queryParams = useQueryParams({
991
+ toCamelCase: false
992
+ });
993
+ var history = reactRouterDom.useHistory();
994
+ var inputId = React.useId();
995
+ var _useState = React.useState(getInitialSearchValue({
996
+ initialValue: value,
997
+ enableUrlSync: enableUrlSync,
998
+ searchParamName: searchParamName
999
+ })),
1000
+ _useState2 = _slicedToArray(_useState, 2),
1001
+ internalValue = _useState2[0],
1002
+ setInternalValue = _useState2[1];
1003
+ var trimmedValue = value === null || value === void 0 ? void 0 : value.trim();
1004
+ useUpdateEffect(function () {
1005
+ var _queryParams$searchPa;
1006
+ if (!enableUrlSync) return;
1007
+ var searchParamValue = (_queryParams$searchPa = queryParams === null || queryParams === void 0 ? void 0 : queryParams[searchParamName]) !== null && _queryParams$searchPa !== void 0 ? _queryParams$searchPa : "";
1008
+ setInternalValue(searchParamValue);
1009
+ }, [queryParams === null || queryParams === void 0 ? void 0 : queryParams[searchParamName]]);
1010
+ var handleSearchQueryParams = function handleSearchQueryParams(trimmedValue) {
1011
+ if (!trimmedValue && !(queryParams !== null && queryParams !== void 0 && queryParams[searchParamName])) return;
1012
+ if (trimmedValue === (queryParams === null || queryParams === void 0 ? void 0 : queryParams[searchParamName])) return;
1013
+ var pathname = history.location.pathname;
1014
+ if (trimmedValue) {
1015
+ history.push(general.buildUrl(pathname, ramda.mergeLeft(_defineProperty({}, searchParamName, trimmedValue), queryParams)));
1016
+ } else {
1017
+ history.push(general.buildUrl(pathname, ramda.omit([searchParamName], queryParams)));
1018
+ }
1019
+ };
1020
+ var handleDebouncedSearchTermChange = useFuncDebounce(function (trimmedValue) {
1021
+ if (onSearch) onSearch(trimmedValue);else if (enableUrlSync) handleSearchQueryParams(trimmedValue);
1022
+ }, debounceTime);
1023
+ useUpdateEffect(function () {
1024
+ handleDebouncedSearchTermChange(trimmedValue);
1025
+ }, [trimmedValue]);
1026
+ var prevValueRef = React.useRef(value);
1027
+ if (value !== undefined && value !== prevValueRef.current) {
1028
+ setInternalValue(value);
1029
+ prevValueRef.current = value;
1030
+ }
1031
+ var handleOnChange = function handleOnChange(e) {
1032
+ var _e$target$value;
1033
+ var trimmedValue = (_e$target$value = e.target.value) === null || _e$target$value === void 0 ? void 0 : _e$target$value.trim();
1034
+ onChange === null || onChange === void 0 || onChange(e);
1035
+ setInternalValue(e.target.value);
1036
+ if ((internalValue === null || internalValue === void 0 ? void 0 : internalValue.trim()) !== trimmedValue) {
1037
+ handleDebouncedSearchTermChange(trimmedValue);
1038
+ }
1039
+ };
1040
+ React.useEffect(function () {
1041
+ return handleDebouncedSearchTermChange.cancel;
1042
+ }, []);
1043
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, _objectSpread$6({
1044
+ className: className,
1045
+ label: label,
1046
+ id: inputId,
1047
+ placeholder: t("neetoMolecules.common.actions.search"),
1048
+ prefix: /*#__PURE__*/jsxRuntime.jsx(Search$1, {}),
1049
+ type: "search",
1050
+ value: internalValue,
1051
+ onChange: handleOnChange
1052
+ }, inputProps));
1053
+ };
1054
+
1055
+ var SIZES = {
1056
+ nano: "nano"};
1057
+ var DROPDOWN_BUTTON_SIZES = {
1058
+ nano: "icon-sm",
1059
+ small: "icon"
1060
+ };
1061
+
1062
+ var _excluded$2 = ["dropdownButtonProps"];
1063
+ 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; }
1064
+ 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), true).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; }
1065
+ var Header = function Header(_ref) {
1066
+ var title = _ref.title,
1067
+ _ref$titleHelpPopover = _ref.titleHelpPopoverProps,
1068
+ titleHelpPopoverProps = _ref$titleHelpPopover === void 0 ? {} : _ref$titleHelpPopover,
1069
+ searchProps = _ref.searchProps,
1070
+ _ref$className = _ref.className,
1071
+ className = _ref$className === void 0 ? "" : _ref$className,
1072
+ actionBlock = _ref.actionBlock,
1073
+ _ref$breadcrumbs = _ref.breadcrumbs,
1074
+ breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
1075
+ _ref$renderDropdown = _ref.renderDropdown,
1076
+ renderDropdown = _ref$renderDropdown === void 0 ? neetoCist.noop : _ref$renderDropdown,
1077
+ _ref$size = _ref.size,
1078
+ size = _ref$size === void 0 ? "small" : _ref$size,
1079
+ _ref$dataTestid = _ref["data-testid"],
1080
+ dataTestId = _ref$dataTestid === void 0 ? "neeto-molecules-header" : _ref$dataTestid;
1081
+ var headerRef = React.useRef(null);
1082
+ React.useLayoutEffect(function () {
1083
+ var updateHeaderHeight = function updateHeaderHeight() {
1084
+ if (!headerRef.current) return;
1085
+ var height = headerRef.current.offsetHeight;
1086
+ document.body.style.setProperty("--nv-header-height", "".concat(height, "px"));
1087
+ };
1088
+ updateHeaderHeight();
1089
+ window.addEventListener("resize", updateHeaderHeight);
1090
+ return function () {
1091
+ window.removeEventListener("resize", updateHeaderHeight);
1092
+ document.body.style.removeProperty("--nv-header-height");
1093
+ };
1094
+ }, []);
1095
+ var isNano = size === SIZES.nano;
1096
+ var hasBreadcrumbs = neetoCist.isNotEmpty(breadcrumbs);
1097
+ var TitleTag = isNano ? "h3" : "h1";
1098
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1099
+ "data-testid": dataTestId,
1100
+ ref: headerRef,
1101
+ className: classnames("flex min-h-0 w-full shrink-0 flex-row items-start justify-between gap-4 pt-10 pb-6", "flex-wrap lg:flex-nowrap", className),
1102
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1103
+ className: "flex flex-wrap",
1104
+ children: [hasBreadcrumbs && /*#__PURE__*/jsxRuntime.jsx(Breadcrumbs, {
1105
+ breadcrumbs: breadcrumbs
1106
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1107
+ className: classnames("flex w-full flex-row items-center gap-3", hasBreadcrumbs ? "mt-0" : "-mt-1 max-lg:-mt-2.5 max-md:-mt-2 max-sm:-mt-1"),
1108
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
1109
+ asChild: true,
1110
+ variant: isNano ? "h4" : "h2",
1111
+ weight: "semibold",
1112
+ children: /*#__PURE__*/jsxRuntime.jsxs(TitleTag, {
1113
+ "data-testid": "main-header",
1114
+ children: [title, neetoCist.isPresent(titleHelpPopoverProps) && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$5({
1115
+ className: "ms-2 inline-flex align-middle",
1116
+ side: "right"
1117
+ }, titleHelpPopoverProps)), renderDropdown(function (_ref2) {
1118
+ var _ref2$dropdownButtonP = _ref2.dropdownButtonProps,
1119
+ dropdownButtonProps = _ref2$dropdownButtonP === void 0 ? {} : _ref2$dropdownButtonP,
1120
+ dropdownProps = _objectWithoutProperties(_ref2, _excluded$2);
1121
+ return /*#__PURE__*/jsxRuntime.jsx("span", {
1122
+ className: "ms-2 inline-flex align-middle",
1123
+ children: /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, _objectSpread$5({
1124
+ dropdownButtonProps: _objectSpread$5({
1125
+ size: DROPDOWN_BUTTON_SIZES[size]
1126
+ }, dropdownButtonProps)
1127
+ }, dropdownProps))
1128
+ });
1129
+ })]
1130
+ })
1131
+ })
1132
+ })]
1133
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1134
+ className: classnames("flex items-center gap-3 empty:hidden", "flex-wrap justify-start md:flex-nowrap md:justify-end"),
1135
+ children: [searchProps && /*#__PURE__*/jsxRuntime.jsx(Search, _objectSpread$5({
1136
+ enableUrlSync: true,
1137
+ className: classnames("min-w-[12.6rem] grow-0", searchProps.className)
1138
+ }, searchProps)), actionBlock && /*#__PURE__*/jsxRuntime.jsx("div", {
1139
+ className: "flex shrink-0 items-center justify-end gap-3 max-[360px]:shrink max-[360px]:flex-wrap max-[360px]:justify-start",
1140
+ children: actionBlock
1141
+ })]
1142
+ })]
1143
+ });
1144
+ };
1145
+
1146
+ var MobilePreviewHeader = reactUtils$1.withT(function (_ref) {
1147
+ var t = _ref.t,
1148
+ _ref$className = _ref.className,
1149
+ className = _ref$className === void 0 ? "" : _ref$className,
1150
+ _ref$message = _ref.message,
1151
+ message = _ref$message === void 0 ? "" : _ref$message;
1152
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1153
+ className: classnames("bg-muted px-6 py-5", className),
1154
+ "data-testid": "mobile-preview-header",
1155
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
1156
+ variant: "body2",
1157
+ children: message || t("neetoMolecules.mobilePreview.message")
1158
+ })
1159
+ });
1160
+ });
1161
+ MobilePreviewHeader.propTypes = {
1162
+ className: emailNotificationApi.PropTypes.string,
1163
+ message: emailNotificationApi.PropTypes.node
1164
+ };
1165
+
1166
+ var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
1167
+ var EmailPreview = reactUtils.withT(function (_ref) {
1168
+ var t = _ref.t,
1169
+ _ref$to = _ref.to,
1170
+ to = _ref$to === void 0 ? [] : _ref$to,
1171
+ from = _ref.from,
1172
+ subject = _ref.subject,
1173
+ body = _ref.body,
1174
+ actionButtonText = _ref.actionButtonText,
1175
+ logo = _ref.logo,
1176
+ _ref$className = _ref.className,
1177
+ className = _ref$className === void 0 ? "" : _ref$className,
1178
+ customContent = _ref.customContent;
1179
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1180
+ "data-testid": "email-preview-card",
1181
+ className: classnames("bg-background neeto-ui-theme--light relative flex flex-1 flex-col rounded-lg px-6 py-8", className),
1182
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1183
+ className: "absolute -end-1.5 -top-1.5 z-10 min-w-max rounded-ss-md rounded-se-md rounded-es-md px-3 py-1.5 text-center text-sm font-medium text-[#49545c] shadow-[0px_3px_4px_0px_#00000026] [background:#ffee6a] after:absolute after:end-0 after:top-full after:-z-20 after:[border-width:0_0_12px_6px] after:border-solid after:[border-color:transparent_#ddd06b] after:content-['']",
1184
+ children: t("neetoMolecules.emailPreview.previewMessage")
1185
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1186
+ className: "w-full pb-4",
1187
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
1188
+ className: "text-foreground min-w-0 grow space-x-2 leading-normal break-words",
1189
+ "data-testid": "email-subject-preview",
1190
+ variant: "h4",
1191
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
1192
+ children: subject || /*#__PURE__*/jsxRuntime.jsx("span", {
1193
+ className: "bg-muted h-2 w-40 rounded-full"
1194
+ })
1195
+ })
1196
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1197
+ className: "mt-4 flex items-center gap-2",
1198
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1199
+ className: "shrink-0",
1200
+ children: /*#__PURE__*/jsxRuntime.jsx(emailNotificationApi.SvgAvatarPlaceholder, {})
1201
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1202
+ className: "flex flex-col gap-1",
1203
+ children: [neetoCist.isPresent(from) ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
1204
+ variant: "h6",
1205
+ weight: "medium",
1206
+ children: from
1207
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
1208
+ className: "flex gap-2",
1209
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
1210
+ className: "bg-muted h-2 w-24 rounded-full"
1211
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
1212
+ className: "bg-muted h-2 w-24 rounded-full"
1213
+ })]
1214
+ }), neetoCist.isPresent(to) ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
1215
+ className: "text-muted-foreground line-clamp-1",
1216
+ "data-testid": "email-to-block",
1217
+ variant: "nano",
1218
+ children: to.join(", ")
1219
+ }) : /*#__PURE__*/jsxRuntime.jsx("span", {
1220
+ className: "bg-muted h-2 w-16 rounded-full",
1221
+ "data-testid": "email-to-block"
1222
+ })]
1223
+ })]
1224
+ })]
1225
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1226
+ className: "bg-muted flex flex-1 flex-col justify-between gap-y-6 rounded px-6 py-4 text-base leading-relaxed",
1227
+ "data-testid": "email-body-preview-container",
1228
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
1229
+ className: "bg-background w-full p-6 md:p-8 2xl:mx-auto 2xl:max-w-lg",
1230
+ children: [body ? /*#__PURE__*/jsxRuntime.jsx(MemoizedEditorContent, {
1231
+ className: "whitespace-normal",
1232
+ content: body
1233
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
1234
+ className: "flex flex-col gap-y-4",
1235
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1236
+ className: "bg-muted h-2 w-48 max-w-full rounded-full md:w-80"
1237
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1238
+ className: "bg-muted h-2 w-40 max-w-full rounded-full md:w-72"
1239
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1240
+ className: "bg-muted h-2 w-48 max-w-full rounded-full md:w-80"
1241
+ })]
1242
+ }), customContent && customContent, actionButtonText && /*#__PURE__*/jsxRuntime.jsx("div", {
1243
+ className: "mt-6 flex w-full items-center justify-center",
1244
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
1245
+ className: "pointer-events-none",
1246
+ label: actionButtonText
1247
+ })
1248
+ }), logo && /*#__PURE__*/jsxRuntime.jsx("img", {
1249
+ alt: t("neetoMolecules.emailPreview.logoAltText"),
1250
+ className: "h-20 w-36 object-cover",
1251
+ "data-testid": "company-logo-preview",
1252
+ src: logo
1253
+ })]
1254
+ })
1255
+ })]
1256
+ });
1257
+ });
1258
+ EmailPreview.propTypes = {
1259
+ /**
1260
+ * The value of the send-to field.
1261
+ */
1262
+ to: emailNotificationApi.PropTypes.arrayOf(emailNotificationApi.PropTypes.string),
1263
+ /**
1264
+ * The value of the send-from field.
1265
+ */
1266
+ from: emailNotificationApi.PropTypes.string,
1267
+ /**
1268
+ * The subject of the email.
1269
+ */
1270
+ subject: emailNotificationApi.PropTypes.string,
1271
+ /**
1272
+ * The body of the email.
1273
+ */
1274
+ body: emailNotificationApi.PropTypes.string,
1275
+ /**
1276
+ * The text to be shown in the action button.
1277
+ */
1278
+ actionButtonText: emailNotificationApi.PropTypes.string,
1279
+ /**
1280
+ * Source link for the company logo.
1281
+ */
1282
+ logo: emailNotificationApi.PropTypes.string,
1283
+ /**
1284
+ * To pass custom content that will be rendered above the action button.
1285
+ */
1286
+ customContent: emailNotificationApi.PropTypes.string
1287
+ };
1288
+
1289
+ var INITIAL_FORM_VALUES = {
1290
+ sendTo: [],
1291
+ sendToId: "",
1292
+ sendToCc: [],
1293
+ sendToBcc: [],
1294
+ replyTo: "",
1295
+ showCopyEmails: false,
1296
+ subject: "",
1297
+ message: "",
1298
+ isEnabled: false
1299
+ };
1300
+ var EMAIL_FORM_VALIDATION_SCHEMA = yup__namespace.object({
1301
+ subject: yup__namespace.string().required(i18next.t("neetoMolecules.emailForm.errors.subjectRequired")),
1302
+ message: yup__namespace.string().test("message", i18next.t("neetoMolecules.emailForm.errors.messageRequired"), function (value) {
1303
+ return !utils$1.isEditorEmpty(value);
1304
+ })
1305
+ });
1306
+ var sendToFieldValidation = function sendToFieldValidation(maxEmails) {
1307
+ var validation = yup__namespace.array().test("all-emails-valid", i18next.t("neetoMolecules.emailForm.errors.invalidEmailAddress"), function (emails) {
1308
+ return emails === null || emails === void 0 ? void 0 : emails.every(ramda.prop("valid"));
1309
+ }).test("max-email-count", i18next.t("neetoMolecules.emailForm.errors.maxEmails", {
1310
+ count: maxEmails
1311
+ }), function (emails) {
1312
+ return (emails === null || emails === void 0 ? void 0 : emails.length) <= maxEmails;
1313
+ });
1314
+ return yup__namespace.object({
1315
+ sendTo: validation.min(1, i18next.t("neetoMolecules.emailForm.errors.required", {
1316
+ entity: i18next.t("neetoMolecules.emailForm.fields.sendToEmailAddress")
1317
+ })).nullable(),
1318
+ sendToCc: validation,
1319
+ sendToBcc: validation
1320
+ });
1321
+ };
1322
+ var SEND_TO_ID_FIELD_VALIDATION = yup__namespace.object({
1323
+ sendToId: yup__namespace.string().required(i18next.t("neetoMolecules.emailForm.errors.required", {
1324
+ entity: i18next.t("neetoMolecules.emailForm.labels.sendTo")
1325
+ }))
1326
+ });
1327
+ var REPLY_TO_FIELD_VALIDATION = yup__namespace.object({
1328
+ replyTo: yup__namespace.string().nullable().email(i18next.t("neetoMolecules.emailForm.errors.invalidEmailAddress")).required(i18next.t("neetoMolecules.emailForm.errors.required", {
1329
+ entity: i18next.t("neetoMolecules.emailForm.fields.replyToEmailAddress")
1330
+ }))
1331
+ });
1332
+ var EDITOR_ADDONS = ["highlight", "emoji", "code-block", "block-quote", "image-upload", "divider", "video-embed"];
1333
+
1334
+ /* eslint-disable @bigbinary/neeto/use-zustand-for-global-state-management */
1335
+ var EmailFormContext = /*#__PURE__*/React.createContext({
1336
+ showSendToField: false,
1337
+ showSendToAsRadio: false,
1338
+ showReplyToField: false,
1339
+ showCcField: false,
1340
+ showBccField: false
1341
+ });
1342
+
1343
+ 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; }
1344
+ 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), true).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; }
1345
+ var getValidationSchema = function getValidationSchema(_ref) {
1346
+ var showSendToField = _ref.showSendToField,
1347
+ showReplyToField = _ref.showReplyToField,
1348
+ showSendToAsRadio = _ref.showSendToAsRadio,
1349
+ customValidations = _ref.customValidations,
1350
+ maxEmails = _ref.maxEmails;
1351
+ var schema = EMAIL_FORM_VALIDATION_SCHEMA.clone();
1352
+ if (showSendToField) {
1353
+ schema = schema.concat(showSendToAsRadio ? SEND_TO_ID_FIELD_VALIDATION : sendToFieldValidation(maxEmails));
1354
+ }
1355
+ if (showReplyToField) schema = schema.concat(REPLY_TO_FIELD_VALIDATION);
1356
+ var isYupObject = customValidations.type === "object";
1357
+ if (isYupObject) {
1358
+ var customFields = customValidations.fields || {};
1359
+ schema = schema.shape(customFields);
1360
+ } else if (_typeof(customValidations) === "object") {
1361
+ schema = schema.shape(customValidations);
1362
+ }
1363
+ return schema;
1364
+ };
1365
+ var getReplyToFieldLabelProps = function getReplyToFieldLabelProps(_ref2) {
1366
+ var popoverProps = _ref2.popoverProps;
1367
+ return {
1368
+ helpIconProps: _objectSpread$3({
1369
+ className: "reply-to-help-icon"
1370
+ }, neetoCist.isPresent(popoverProps) ? {
1371
+ popoverProps: _objectSpread$3(_objectSpread$3({}, popoverProps), {}, {
1372
+ description: popoverProps.description || i18next.t("neetoMolecules.emailForm.tooltips.replyTo")
1373
+ })
1374
+ } : {
1375
+ tooltipProps: {
1376
+ content: i18next.t("neetoMolecules.emailForm.tooltips.replyTo")
1377
+ }
1378
+ })
1379
+ };
1380
+ };
1381
+ var resolveContent = function resolveContent(content, func, variable) {
1382
+ if (typeof func === "function") {
1383
+ return func(content, variable);
1384
+ }
1385
+ return content;
1386
+ };
1387
+ var normalizeHtmlString = function normalizeHtmlString(str) {
1388
+ if (typeof str !== "string") return str;
1389
+ return str.replace(/\uFEFF/g, "").replace(/\r\n|\r/g, "\n").replace(/&nbsp;/g, " ").replace(/[\t ]+/g, " ").replace(/\s*\n\s*/g, "\n").replace(/\n+/g, "\n").replace(/>\s+</g, "><").trim();
1390
+ };
1391
+
1392
+ var ReplyToField = function ReplyToField(_ref) {
1393
+ var _ref$options = _ref.options,
1394
+ options = _ref$options === void 0 ? [] : _ref$options,
1395
+ _ref$popoverProps = _ref.popoverProps,
1396
+ popoverProps = _ref$popoverProps === void 0 ? {} : _ref$popoverProps;
1397
+ var _useTranslation = reactI18next.useTranslation(),
1398
+ t = _useTranslation.t;
1399
+ var _useFormikContext = formik.useFormikContext(),
1400
+ setFieldValue = _useFormikContext.setFieldValue;
1401
+ var isDropdownField = neetoCist.isNotEmpty(options);
1402
+ var labelProps = getReplyToFieldLabelProps({
1403
+ popoverProps: popoverProps
1404
+ });
1405
+ if (isDropdownField) {
1406
+ return /*#__PURE__*/jsxRuntime.jsx(formik$1.Select, {
1407
+ labelProps: labelProps,
1408
+ options: options,
1409
+ isClearable: true,
1410
+ className: "w-full",
1411
+ "data-testid": "reply-to-select-field",
1412
+ label: t("neetoMolecules.emailForm.labels.replyTo"),
1413
+ name: "replyTo",
1414
+ onChange: function onChange(value) {
1415
+ return setFieldValue("replyTo", value !== null && value !== void 0 ? value : "");
1416
+ }
1417
+ });
1418
+ }
1419
+ return /*#__PURE__*/jsxRuntime.jsx(formik$1.Input, {
1420
+ labelProps: labelProps,
1421
+ autoFocus: true,
1422
+ nakedInput: true,
1423
+ required: true,
1424
+ className: "w-full",
1425
+ "data-testid": "reply-to-input-field",
1426
+ label: t("neetoMolecules.emailForm.labels.replyTo"),
1427
+ name: "replyTo",
1428
+ placeholder: t("neetoMolecules.emailForm.placeholders.emailPlaceholder"),
1429
+ size: "large",
1430
+ onChange: function onChange(event) {
1431
+ var _event$target$value;
1432
+ return setFieldValue("replyTo", (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.toLowerCase());
1433
+ }
1434
+ });
1435
+ };
1436
+
1437
+ var SendToField = function SendToField(_ref) {
1438
+ var showBccField = _ref.showBccField,
1439
+ showCcField = _ref.showCcField,
1440
+ showSendToTextField = _ref.showSendToTextField;
1441
+ var _useTranslation = reactI18next.useTranslation(),
1442
+ t = _useTranslation.t;
1443
+ if (!showSendToTextField && !showBccField && !showCcField) return null;
1444
+ return /*#__PURE__*/jsxRuntime.jsx(SendToFields, {
1445
+ showCcBccButton: true,
1446
+ showBccField: showSendToTextField ? false : showBccField,
1447
+ showCcField: showSendToTextField ? false : showCcField,
1448
+ showSendToField: showSendToTextField,
1449
+ bccInputProps: {
1450
+ label: t("neetoMolecules.emailForm.labels.bCc"),
1451
+ name: "sendToBcc",
1452
+ placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
1453
+ },
1454
+ ccInputProps: {
1455
+ label: t("neetoMolecules.emailForm.labels.cc"),
1456
+ name: "sendToCc",
1457
+ placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
1458
+ },
1459
+ emailInputProps: {
1460
+ id: "sendTo",
1461
+ name: "sendTo",
1462
+ label: t("neetoMolecules.emailForm.labels.sendTo"),
1463
+ placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails"),
1464
+ required: true
1465
+ }
1466
+ });
1467
+ };
1468
+
1469
+ var SubjectField = function SubjectField(_ref) {
1470
+ var name = _ref.name,
1471
+ text = _ref.text,
1472
+ updateText = _ref.updateText,
1473
+ _ref$subjectVariables = _ref.subjectVariables,
1474
+ subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
1475
+ error = _ref.error,
1476
+ _ref$required = _ref.required,
1477
+ required = _ref$required === void 0 ? false : _ref$required,
1478
+ onBlur = _ref.onBlur;
1479
+ var _useState = React.useState(false),
1480
+ _useState2 = _slicedToArray(_useState, 2),
1481
+ isFieldFocusedOnce = _useState2[0],
1482
+ setIsFieldFocusedOnce = _useState2[1];
1483
+ var _useTranslation = reactI18next.useTranslation(),
1484
+ t = _useTranslation.t;
1485
+ var tagClickHandler = function tagClickHandler(_ref2) {
1486
+ var slug = _ref2.key,
1487
+ category = _ref2.category;
1488
+ var textAreaElement = document.querySelector("textarea[name=".concat(name, "]"));
1489
+ var splitIndex = isFieldFocusedOnce && textAreaElement ? textAreaElement.selectionEnd : text.length;
1490
+ var variable = category ? "".concat(category, ".").concat(slug) : slug;
1491
+ var updatedSubject = [text.slice(0, splitIndex), " {{".concat(variable, "}}"), text.slice(splitIndex)].join("");
1492
+ updateText(updatedSubject);
1493
+ };
1494
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
1495
+ error: error,
1496
+ name: name,
1497
+ onBlur: onBlur,
1498
+ required: required,
1499
+ nakedInput: true,
1500
+ label: t("neetoMolecules.emailForm.labels.subject"),
1501
+ placeholder: t("neetoMolecules.emailForm.placeholders.subject"),
1502
+ value: text,
1503
+ suffix: /*#__PURE__*/jsxRuntime.jsx(DynamicVariables, {
1504
+ buttonProps: {
1505
+ className: "m-1"
1506
+ },
1507
+ dropdownProps: {
1508
+ className: "overflow-y-auto"
1509
+ },
1510
+ variables: subjectVariables,
1511
+ onVariableClick: tagClickHandler
1512
+ }),
1513
+ onChange: general.withEventTargetValue(updateText),
1514
+ onFocus: function onFocus() {
1515
+ return setIsFieldFocusedOnce(true);
1516
+ }
1517
+ });
1518
+ };
1519
+
1520
+ 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; }
1521
+ 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), true).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; }
1522
+ var EmailForm = function EmailForm(_ref) {
1523
+ var _globalProps$user;
1524
+ var _ref$messageVariables = _ref.messageVariables,
1525
+ messageVariables = _ref$messageVariables === void 0 ? [] : _ref$messageVariables,
1526
+ _ref$subjectVariables = _ref.subjectVariables,
1527
+ subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
1528
+ handleCancel = _ref.handleCancel,
1529
+ handleResetToDefault = _ref.handleResetToDefault,
1530
+ isLoading = _ref.isLoading,
1531
+ replyToFieldProps = _ref.replyToFieldProps,
1532
+ sendToFieldProps = _ref.sendToFieldProps,
1533
+ replyToOptions = _ref.replyToOptions,
1534
+ _ref$sendToOptions = _ref.sendToOptions,
1535
+ sendToOptions = _ref$sendToOptions === void 0 ? [] : _ref$sendToOptions,
1536
+ _ref$isUpdating = _ref.isUpdating,
1537
+ isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating,
1538
+ _ref$isResetting = _ref.isResetting,
1539
+ isResetting = _ref$isResetting === void 0 ? false : _ref$isResetting,
1540
+ _ref$showFields = _ref.showFields,
1541
+ showFields = _ref$showFields === void 0 ? true : _ref$showFields,
1542
+ _ref$className = _ref.className,
1543
+ className = _ref$className === void 0 ? "" : _ref$className,
1544
+ _ref$editorAddons = _ref.editorAddons,
1545
+ editorAddons = _ref$editorAddons === void 0 ? EDITOR_ADDONS : _ref$editorAddons,
1546
+ showResetToDefaultButton = _ref.showResetToDefaultButton,
1547
+ _ref$editorRef = _ref.editorRef,
1548
+ editorRef = _ref$editorRef === void 0 ? null : _ref$editorRef,
1549
+ _ref$defaultValues = _ref.defaultValues,
1550
+ defaultValues = _ref$defaultValues === void 0 ? {} : _ref$defaultValues;
1551
+ var _useTranslation = reactI18next.useTranslation(),
1552
+ t = _useTranslation.t;
1553
+ var _useContext = React.useContext(EmailFormContext),
1554
+ showSendToField = _useContext.showSendToField,
1555
+ showSendToAsRadio = _useContext.showSendToAsRadio,
1556
+ showReplyToField = _useContext.showReplyToField,
1557
+ showCcField = _useContext.showCcField,
1558
+ showBccField = _useContext.showBccField;
1559
+ var _useFormikContext = formik.useFormikContext(),
1560
+ setFieldValue = _useFormikContext.setFieldValue,
1561
+ values = _useFormikContext.values,
1562
+ resetForm = _useFormikContext.resetForm;
1563
+ var normalizedValues = _objectSpread$2(_objectSpread$2({}, values), {}, {
1564
+ message: normalizeHtmlString(values.message)
1565
+ });
1566
+ var normalizedDefaultValues = _objectSpread$2(_objectSpread$2({}, defaultValues), {}, {
1567
+ message: normalizeHtmlString(defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.message)
1568
+ });
1569
+ normalizedDefaultValues.replyTo || (normalizedDefaultValues.replyTo = (_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email);
1570
+ var disabled = ramda.equals(normalizedValues, normalizedDefaultValues);
1571
+ var sendToFieldOptions = (sendToFieldProps === null || sendToFieldProps === void 0 ? void 0 : sendToFieldProps.options) || sendToOptions;
1572
+ var showSendToRadioField = showSendToField && showSendToAsRadio && neetoCist.isNotEmpty(sendToFieldOptions);
1573
+ var showSendToTextField = showSendToField && !showSendToRadioField;
1574
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1575
+ "data-testid": "email-form",
1576
+ className: classnames("flex flex-1 flex-col items-start gap-2 !pb-0", _defineProperty({}, className, className)),
1577
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1578
+ className: "w-full grow",
1579
+ children: showFields && /*#__PURE__*/jsxRuntime.jsxs("div", {
1580
+ className: "flex w-full flex-col items-start justify-start gap-5",
1581
+ children: [showSendToRadioField && /*#__PURE__*/jsxRuntime.jsx(formik$1.RadioGroup, {
1582
+ className: "pb-2",
1583
+ "data-testid": "send-to-id",
1584
+ label: t("neetoMolecules.emailForm.labels.sendTo"),
1585
+ labelProps: {
1586
+ required: true
1587
+ },
1588
+ name: "sendToId",
1589
+ children: sendToFieldOptions.map(function (_ref2) {
1590
+ var label = _ref2.label,
1591
+ value = _ref2.value;
1592
+ return /*#__PURE__*/React.createElement(formik$1.RadioGroup.Item, {
1593
+ label: label,
1594
+ value: value,
1595
+ key: value
1596
+ });
1597
+ })
1598
+ }), /*#__PURE__*/jsxRuntime.jsx(SendToField, {
1599
+ showBccField: showBccField,
1600
+ showCcField: showCcField,
1601
+ showSendToTextField: showSendToTextField
1602
+ }), showReplyToField && /*#__PURE__*/jsxRuntime.jsx("div", {
1603
+ className: "border-border w-full border-b pb-1",
1604
+ children: /*#__PURE__*/jsxRuntime.jsx(ReplyToField, _objectSpread$2({
1605
+ options: replyToOptions
1606
+ }, replyToFieldProps))
1607
+ }), /*#__PURE__*/jsxRuntime.jsx(formik.Field, {
1608
+ name: "subject",
1609
+ children: function children(_ref3) {
1610
+ var _ref3$field = _ref3.field,
1611
+ value = _ref3$field.value,
1612
+ onBlur = _ref3$field.onBlur,
1613
+ _ref3$meta = _ref3.meta,
1614
+ error = _ref3$meta.error,
1615
+ touched = _ref3$meta.touched;
1616
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1617
+ className: "border-border w-full border-b pb-1",
1618
+ children: /*#__PURE__*/jsxRuntime.jsx(SubjectField, {
1619
+ onBlur: onBlur,
1620
+ subjectVariables: subjectVariables,
1621
+ required: true,
1622
+ error: touched && error ? t(error) : undefined,
1623
+ name: "subject",
1624
+ text: value,
1625
+ updateText: function updateText(text) {
1626
+ return setFieldValue("subject", text);
1627
+ }
1628
+ })
1629
+ });
1630
+ }
1631
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1632
+ className: "w-full",
1633
+ "data-testid": "message-input-container",
1634
+ children: /*#__PURE__*/jsxRuntime.jsx(FormikEditor, {
1635
+ required: true,
1636
+ addons: editorAddons,
1637
+ "data-testid": "message-input-field",
1638
+ hideSlashCommands: false,
1639
+ id: "form_message",
1640
+ menuType: "fixed",
1641
+ name: "message",
1642
+ placeholder: t("neetoMolecules.emailForm.placeholders.message"),
1643
+ ref: editorRef,
1644
+ variables: messageVariables,
1645
+ shouldUpdate: function shouldUpdate(nextProps, prevProps) {
1646
+ return neetoCist.notEqualsDeep(nextProps.variables, prevProps.variables);
1647
+ }
1648
+ })
1649
+ })]
1650
+ })
1651
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1652
+ className: "bg-background z-10 flex w-full justify-between py-6 lg:sticky lg:bottom-0",
1653
+ children: [/*#__PURE__*/jsxRuntime.jsx(formik$1.ActionBlock, {
1654
+ cancelButtonProps: {
1655
+ onClick: handleCancel
1656
+ },
1657
+ isSubmitting: isLoading || isUpdating
1658
+ }), showResetToDefaultButton && /*#__PURE__*/jsxRuntime.jsx("div", {
1659
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
1660
+ disabled: disabled,
1661
+ "data-testid": "reset-to-default-button",
1662
+ label: t("neetoMolecules.emailForm.labels.resetToDefault"),
1663
+ loading: isResetting,
1664
+ variant: "secondary",
1665
+ onClick: function onClick() {
1666
+ resetForm();
1667
+ handleResetToDefault();
1668
+ }
1669
+ })
1670
+ })]
1671
+ })]
1672
+ });
1673
+ };
1674
+
1675
+ function ownKeys$1$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; }
1676
+ function _objectSpread$1$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1677
+ var EmailFormComponent = function EmailFormComponent(_ref) {
1678
+ var _ref$onSubmit = _ref.onSubmit,
1679
+ onSubmit = _ref$onSubmit === void 0 ? neetoCist.noop : _ref$onSubmit,
1680
+ _ref$initialValues = _ref.initialValues,
1681
+ initialValues = _ref$initialValues === void 0 ? INITIAL_FORM_VALUES : _ref$initialValues,
1682
+ _children = _ref.children,
1683
+ formikProps = _ref.formikProps,
1684
+ validationSchema = _ref.validationSchema,
1685
+ _ref$showSendToField = _ref.showSendToField,
1686
+ showSendToField = _ref$showSendToField === void 0 ? false : _ref$showSendToField,
1687
+ _ref$showReplyToField = _ref.showReplyToField,
1688
+ showReplyToField = _ref$showReplyToField === void 0 ? false : _ref$showReplyToField,
1689
+ _ref$showSendToAsRadi = _ref.showSendToAsRadio,
1690
+ showSendToAsRadio = _ref$showSendToAsRadi === void 0 ? false : _ref$showSendToAsRadi,
1691
+ _ref$blockNavigation = _ref.blockNavigation,
1692
+ blockNavigation = _ref$blockNavigation === void 0 ? true : _ref$blockNavigation,
1693
+ _ref$showCcField = _ref.showCcField,
1694
+ showCcField = _ref$showCcField === void 0 ? false : _ref$showCcField,
1695
+ _ref$showBccField = _ref.showBccField,
1696
+ showBccField = _ref$showBccField === void 0 ? false : _ref$showBccField,
1697
+ _ref$isLoading = _ref.isLoading,
1698
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
1699
+ _ref$maxEmails = _ref.maxEmails,
1700
+ maxEmails = _ref$maxEmails === void 0 ? 10 : _ref$maxEmails,
1701
+ _ref$emailFormProps = _ref.emailFormProps,
1702
+ emailFormProps = _ref$emailFormProps === void 0 ? {} : _ref$emailFormProps,
1703
+ _ref$emailPreviewProp = _ref.emailPreviewProps,
1704
+ emailPreviewProps = _ref$emailPreviewProp === void 0 ? {} : _ref$emailPreviewProp,
1705
+ _ref$headerProps = _ref.headerProps,
1706
+ headerProps = _ref$headerProps === void 0 ? {} : _ref$headerProps,
1707
+ _ref$tooltipProps = _ref.tooltipProps,
1708
+ tooltipProps = _ref$tooltipProps === void 0 ? {} : _ref$tooltipProps,
1709
+ _ref$switchProps = _ref.switchProps,
1710
+ switchProps = _ref$switchProps === void 0 ? {} : _ref$switchProps,
1711
+ _ref$mobilePreviewPro = _ref.mobilePreviewProps,
1712
+ mobilePreviewProps = _ref$mobilePreviewPro === void 0 ? {} : _ref$mobilePreviewPro;
1713
+ var formatBody = emailPreviewProps.formatBody,
1714
+ formatSubject = emailPreviewProps.formatSubject,
1715
+ bodyVariables = emailPreviewProps.bodyVariables,
1716
+ subjectVariables = emailPreviewProps.subjectVariables;
1717
+ var shouldShowFields = function shouldShowFields(values) {
1718
+ return ramda.isEmpty(switchProps) || values.isEnabled;
1719
+ };
1720
+ return /*#__PURE__*/jsxRuntime.jsx(EmailFormProvider, {
1721
+ formikProps: formikProps,
1722
+ initialValues: initialValues,
1723
+ maxEmails: maxEmails,
1724
+ onSubmit: onSubmit,
1725
+ showBccField: showBccField,
1726
+ showCcField: showCcField,
1727
+ showReplyToField: showReplyToField,
1728
+ showSendToAsRadio: showSendToAsRadio,
1729
+ showSendToField: showSendToField,
1730
+ validationSchema: validationSchema,
1731
+ children: function children(_ref2) {
1732
+ var _values$sendTo;
1733
+ var values = _ref2.values,
1734
+ isSubmitting = _ref2.isSubmitting;
1735
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1736
+ className: "flex h-[calc(100dvh-64px)] flex-grow flex-col overflow-y-auto lg:flex-row",
1737
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1738
+ className: "flex w-full flex-col px-5 md:px-10 lg:h-full lg:w-1/2 lg:overflow-y-auto",
1739
+ children: [blockNavigation && /*#__PURE__*/jsxRuntime.jsx(formik$1.BlockNavigation, {}), neetoCist.isNotEmpty(headerProps) && /*#__PURE__*/jsxRuntime.jsx(Header, _objectSpread$1$1({
1740
+ className: "px-0",
1741
+ size: "small"
1742
+ }, headerProps)), neetoCist.isNotEmpty(switchProps) && /*#__PURE__*/jsxRuntime.jsx("div", {
1743
+ className: "flex items-center justify-between gap-y-0.5 pb-6",
1744
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, _objectSpread$1$1(_objectSpread$1$1({
1745
+ disabled: !(switchProps !== null && switchProps !== void 0 && switchProps.disabled),
1746
+ position: "top"
1747
+ }, tooltipProps), {}, {
1748
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
1749
+ className: "flex items-center gap-2",
1750
+ children: /*#__PURE__*/jsxRuntime.jsx(formik$1.Switch, _objectSpread$1$1({
1751
+ "data-testid": "switch",
1752
+ name: "isEnabled"
1753
+ }, switchProps))
1754
+ })
1755
+ }))
1756
+ }), shouldShowFields(values) && _children, /*#__PURE__*/jsxRuntime.jsx(EmailForm, _objectSpread$1$1({
1757
+ isLoading: isSubmitting || isLoading,
1758
+ isUpdating: isSubmitting || isLoading,
1759
+ showFields: shouldShowFields(values)
1760
+ }, emailFormProps))]
1761
+ }), shouldShowFields(values) && /*#__PURE__*/jsxRuntime.jsx(MobilePreviewHeader, _objectSpread$1$1({
1762
+ className: "lg:hidden"
1763
+ }, mobilePreviewProps)), shouldShowFields(values) && /*#__PURE__*/jsxRuntime.jsx("div", {
1764
+ className: "bg-muted w-full px-6 py-10 lg:w-1/2 lg:overflow-y-auto",
1765
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailPreview, _objectSpread$1$1({
1766
+ body: resolveContent(values.message, formatBody, bodyVariables),
1767
+ from: values.sendFrom,
1768
+ to: ramda.pluck("value", (_values$sendTo = values === null || values === void 0 ? void 0 : values.sendTo) !== null && _values$sendTo !== void 0 ? _values$sendTo : []),
1769
+ subject: resolveContent(values.subject, formatSubject, subjectVariables)
1770
+ }, emailPreviewProps))
1771
+ })]
1772
+ });
1773
+ }
1774
+ });
1775
+ };
1776
+
1777
+ 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; }
1778
+ 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), true).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; }
1779
+ var EmailFormProvider = function EmailFormProvider(_ref) {
1780
+ var _globalProps$user;
1781
+ var _ref$onSubmit = _ref.onSubmit,
1782
+ onSubmit = _ref$onSubmit === void 0 ? neetoCist.noop : _ref$onSubmit,
1783
+ _ref$initialValues = _ref.initialValues,
1784
+ initialValues = _ref$initialValues === void 0 ? INITIAL_FORM_VALUES : _ref$initialValues,
1785
+ children = _ref.children,
1786
+ formikProps = _ref.formikProps,
1787
+ _ref$validationSchema = _ref.validationSchema,
1788
+ customValidations = _ref$validationSchema === void 0 ? {} : _ref$validationSchema,
1789
+ _ref$showSendToField = _ref.showSendToField,
1790
+ showSendToField = _ref$showSendToField === void 0 ? false : _ref$showSendToField,
1791
+ _ref$showReplyToField = _ref.showReplyToField,
1792
+ showReplyToField = _ref$showReplyToField === void 0 ? false : _ref$showReplyToField,
1793
+ _ref$showSendToAsRadi = _ref.showSendToAsRadio,
1794
+ showSendToAsRadio = _ref$showSendToAsRadi === void 0 ? false : _ref$showSendToAsRadi,
1795
+ _ref$showCcField = _ref.showCcField,
1796
+ showCcField = _ref$showCcField === void 0 ? false : _ref$showCcField,
1797
+ _ref$showBccField = _ref.showBccField,
1798
+ showBccField = _ref$showBccField === void 0 ? false : _ref$showBccField,
1799
+ _ref$maxEmails = _ref.maxEmails,
1800
+ maxEmails = _ref$maxEmails === void 0 ? 10 : _ref$maxEmails;
1801
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1802
+ "data-testid": "email-form-provider",
1803
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailFormContext.Provider, {
1804
+ value: {
1805
+ showSendToField: showSendToField,
1806
+ showSendToAsRadio: showSendToAsRadio,
1807
+ showReplyToField: showReplyToField,
1808
+ showCcField: showCcField,
1809
+ showBccField: showBccField
1810
+ },
1811
+ children: /*#__PURE__*/jsxRuntime.jsx(formik$1.Form, {
1812
+ formikProps: _objectSpread$4({
1813
+ enableReinitialize: true,
1814
+ validationSchema: getValidationSchema({
1815
+ showSendToField: showSendToField,
1816
+ showReplyToField: showReplyToField,
1817
+ showSendToAsRadio: showSendToAsRadio,
1818
+ customValidations: customValidations,
1819
+ maxEmails: maxEmails
1820
+ }),
1821
+ initialValues: _objectSpread$4(_objectSpread$4({}, initialValues), {}, {
1822
+ replyTo: initialValues.replyTo || ((_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email)
1823
+ }),
1824
+ onSubmit: onSubmit
1825
+ }, formikProps),
1826
+ children: children
1827
+ })
1828
+ })
1829
+ });
1830
+ };
1831
+
1832
+ var FORM_VALIDATION_SCHEMA = {
1833
+ isEnabled: yup__namespace["boolean"]()
1834
+ };
1835
+ var DEFAULT_FIELDS_VISIBILITY = {
1836
+ showSendToField: true,
1837
+ showReplyToField: false,
1838
+ showSendToAsRadio: false,
1839
+ showBccField: false,
1840
+ showCcField: false
1841
+ };
1842
+
1843
+ var _excluded$1 = ["notifyEmails", "notifyCcEmails", "notifyBccEmails", "replyToId", "customFields"],
1844
+ _excluded2 = ["id", "isEnabled", "sendTo", "sendToCc", "sendToBcc", "showCopyEmails", "replyTo", "message", "subject", "sendFrom", "sendToId"];
1845
+ 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; }
1846
+ 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), true).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; }
1847
+ var isValidEmail = function isValidEmail(email) {
1848
+ return yup.string().email().isValidSync(email);
1849
+ };
1850
+ var createEmailOptions = function createEmailOptions() {
1851
+ var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1852
+ return emails.map(function (email) {
1853
+ return {
1854
+ label: email,
1855
+ value: email,
1856
+ valid: isValidEmail(email)
1857
+ };
1858
+ });
1859
+ };
1860
+ var parseEmailsOptions = function parseEmailsOptions() {
1861
+ var emailOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1862
+ return emailOptions.map(ramda.prop("label"));
1863
+ };
1864
+ var parseEmailNotificationData = function parseEmailNotificationData(data, sendToOptions) {
1865
+ var _sendToOptions$;
1866
+ var notifyEmails = data.notifyEmails,
1867
+ notifyCcEmails = data.notifyCcEmails,
1868
+ notifyBccEmails = data.notifyBccEmails,
1869
+ replyToId = data.replyToId,
1870
+ customFields = data.customFields,
1871
+ rest = _objectWithoutProperties(data, _excluded$1);
1872
+ var parsed = _objectSpread$1(_objectSpread$1({}, customFields), rest);
1873
+ parsed.sendTo = notifyEmails ? createEmailOptions(notifyEmails) : [];
1874
+ parsed.sendToCc = notifyCcEmails ? createEmailOptions(notifyCcEmails) : [];
1875
+ parsed.sendToBcc = notifyCcEmails ? createEmailOptions(notifyBccEmails) : [];
1876
+ parsed.replyTo = replyToId || customFields["replyTo"];
1877
+ parsed.sendToId = customFields["sendToId"] || (sendToOptions === null || sendToOptions === void 0 || (_sendToOptions$ = sendToOptions[0]) === null || _sendToOptions$ === void 0 ? void 0 : _sendToOptions$.value) || "";
1878
+ parsed.showCopyEmails = !!(notifyCcEmails !== null && notifyCcEmails !== void 0 && notifyCcEmails.length || notifyBccEmails !== null && notifyBccEmails !== void 0 && notifyBccEmails.length);
1879
+ return parsed;
1880
+ };
1881
+ var packEmailPayload = function packEmailPayload(values, isReplyToDropdownField, isDisabledByUser) {
1882
+ values.id;
1883
+ var isEnabled = values.isEnabled,
1884
+ sendTo = values.sendTo,
1885
+ sendToCc = values.sendToCc,
1886
+ sendToBcc = values.sendToBcc,
1887
+ showCopyEmails = values.showCopyEmails,
1888
+ replyTo = values.replyTo,
1889
+ message = values.message,
1890
+ subject = values.subject,
1891
+ sendFrom = values.sendFrom,
1892
+ sendToId = values.sendToId,
1893
+ rest = _objectWithoutProperties(values, _excluded2);
1894
+ var payload = {
1895
+ isEnabled: isEnabled
1896
+ };
1897
+ if (isEnabled) {
1898
+ payload = _objectSpread$1({}, payload);
1899
+ payload.notifyEmails = parseEmailsOptions(sendTo);
1900
+ payload.notifyBccEmails = showCopyEmails ? parseEmailsOptions(sendToBcc) : [];
1901
+ payload.notifyCcEmails = showCopyEmails ? parseEmailsOptions(sendToCc) : [];
1902
+ if (isReplyToDropdownField) {
1903
+ payload.replyToId = replyTo;
1904
+ } else {
1905
+ rest.replyTo = replyTo;
1906
+ }
1907
+ payload.message = message;
1908
+ payload.subject = subject;
1909
+ payload.customFields = _objectSpread$1(_objectSpread$1({}, rest), {}, {
1910
+ disabledByUser: false
1911
+ });
1912
+ if (neetoCist.isNotEmpty(sendToId)) {
1913
+ payload.customFields = ramda.mergeLeft(payload.customFields, {
1914
+ sendToId: sendToId
1915
+ });
1916
+ }
1917
+ payload.sendFrom = sendFrom;
1918
+ } else {
1919
+ payload.customFields = {
1920
+ disabledByUser: isDisabledByUser
1921
+ };
1922
+ }
1923
+ return payload;
1924
+ };
1925
+ var renderText = function renderText(text, fallbackTranslation) {
1926
+ return ramda.isEmpty(text) ? fallbackTranslation : text;
1927
+ };
1928
+ var generateDefaultValues = function generateDefaultValues(data) {
1929
+ var _data$defaultAttribut, _data$defaultAttribut2;
1930
+ if (!(data !== null && data !== void 0 && data.defaultAttributes)) {
1931
+ return null;
1932
+ }
1933
+ var currentDataFields = ["id", "customFields", "notifyCcEmails", "notifyBccEmails", "replyToId"];
1934
+ var currentDataOverlay = ramda.pick(currentDataFields, data);
1935
+ var normalizedDefaults = _objectSpread$1(_objectSpread$1({}, data.defaultAttributes), {}, {
1936
+ message: ((_data$defaultAttribut = data.defaultAttributes.message) === null || _data$defaultAttribut === void 0 || (_data$defaultAttribut2 = _data$defaultAttribut.replaceAll) === null || _data$defaultAttribut2 === void 0 ? void 0 : _data$defaultAttribut2.call(_data$defaultAttribut, "<br />", "<br>")) || data.defaultAttributes.message
1937
+ });
1938
+ return ramda.mergeLeft(currentDataOverlay, normalizedDefaults);
1939
+ };
1940
+
1941
+ var _excluded = ["validationSchema"];
1942
+ 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; }
1943
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).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; }
1944
+ var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
1945
+ var _emailFormProps$sendT, _emailFormProps$sendT2;
1946
+ var _ref$emailNotificatio = _ref.emailNotificationParams,
1947
+ emailNotificationParams = _ref$emailNotificatio === void 0 ? {} : _ref$emailNotificatio,
1948
+ _ref$emailPreviewProp = _ref.emailPreviewProps,
1949
+ emailPreviewProps = _ref$emailPreviewProp === void 0 ? {} : _ref$emailPreviewProp,
1950
+ _ref$emailFormProps = _ref.emailFormProps,
1951
+ emailFormProps = _ref$emailFormProps === void 0 ? {} : _ref$emailFormProps,
1952
+ _ref$emailFormikProps = _ref.emailFormikProps,
1953
+ emailFormikProps = _ref$emailFormikProps === void 0 ? {} : _ref$emailFormikProps,
1954
+ _ref$title = _ref.title,
1955
+ title = _ref$title === void 0 ? "" : _ref$title,
1956
+ _ref$notificationTogg = _ref.notificationToggleLabel,
1957
+ notificationToggleLabel = _ref$notificationTogg === void 0 ? "" : _ref$notificationTogg,
1958
+ _ref$breadcrumbs = _ref.breadcrumbs,
1959
+ breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
1960
+ _ref$helpPopoverProps = _ref.helpPopoverProps,
1961
+ helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
1962
+ _ref$tooltipProps = _ref.tooltipProps,
1963
+ tooltipProps = _ref$tooltipProps === void 0 ? {} : _ref$tooltipProps,
1964
+ _ref$disabled = _ref.disabled,
1965
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1966
+ _ref$fieldsVisibility = _ref.fieldsVisibility,
1967
+ fieldsVisibility = _ref$fieldsVisibility === void 0 ? {} : _ref$fieldsVisibility,
1968
+ _ref$blockNavigation = _ref.blockNavigation,
1969
+ blockNavigation = _ref$blockNavigation === void 0 ? false : _ref$blockNavigation,
1970
+ _ref$onSuccess = _ref.onSuccess,
1971
+ onSuccess = _ref$onSuccess === void 0 ? neetoCist.noop : _ref$onSuccess,
1972
+ children = _ref.children;
1973
+ var editorRef = React.useRef();
1974
+ var _useTranslation = reactI18next.useTranslation(),
1975
+ t = _useTranslation.t;
1976
+ var _useFetchEmailNotific = emailNotificationApi.useFetchEmailNotifications(emailNotificationParams),
1977
+ _useFetchEmailNotific2 = _useFetchEmailNotific.data,
1978
+ data = _useFetchEmailNotific2 === void 0 ? {} : _useFetchEmailNotific2,
1979
+ isLoading = _useFetchEmailNotific.isLoading;
1980
+ var _useUpdateEmailNotifi = emailNotificationApi.useUpdateEmailNotification(),
1981
+ updateEmailNotification = _useUpdateEmailNotifi.mutate,
1982
+ isSubmitting = _useUpdateEmailNotifi.isPending;
1983
+ var _useResetEmailNotific = emailNotificationApi.useResetEmailNotificationToDefault(),
1984
+ resetToDefault = _useResetEmailNotific.mutate,
1985
+ isResetting = _useResetEmailNotific.isPending;
1986
+ var handleSubmit = function handleSubmit(values) {
1987
+ var _emailFormProps$reply;
1988
+ var isDisabledByUser = data.isEnabled && !values.isEnabled;
1989
+ var isReplyToDropdownField = (emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$reply = emailFormProps.replyToFieldProps) === null || _emailFormProps$reply === void 0 ? void 0 : _emailFormProps$reply.options) !== undefined;
1990
+ var body = ramda.mergeDeepLeft(packEmailPayload(values, isReplyToDropdownField, isDisabledByUser), emailNotificationParams);
1991
+ updateEmailNotification(body, {
1992
+ onSuccess: onSuccess
1993
+ });
1994
+ };
1995
+ if (isLoading || neetoCist.isNotPresent(data)) {
1996
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1997
+ className: "flex h-full w-full items-center justify-center",
1998
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Spinner, {})
1999
+ });
2000
+ }
2001
+ var newDefaultAttributes = generateDefaultValues(data);
2002
+ var defaultValues = parseEmailNotificationData(newDefaultAttributes, emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$sendT = emailFormProps.sendToFieldProps) === null || _emailFormProps$sendT === void 0 ? void 0 : _emailFormProps$sendT.options);
2003
+ defaultValues.defaultAttributes = data.defaultAttributes;
2004
+ var formattedTitle = renderText(title, t("neetoEmailNotifications.emailNotification.title"));
2005
+ var formattedNotificationToggleLabel = renderText(notificationToggleLabel, t("neetoEmailNotifications.emailNotification.notificationToggleLabel"));
2006
+ var customValidationSchema = emailFormikProps.validationSchema,
2007
+ formikProps = _objectWithoutProperties(emailFormikProps, _excluded);
2008
+ var handleResetToDefault = function handleResetToDefault() {
2009
+ resetToDefault(emailNotificationParams, {
2010
+ onSuccess: function onSuccess(_ref2) {
2011
+ var _editorRef$current;
2012
+ var emailNotification = _ref2.emailNotification;
2013
+ return editorRef === null || editorRef === void 0 || (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.editor) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.commands) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.setContent(emailNotification.message);
2014
+ }
2015
+ });
2016
+ };
2017
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
2018
+ className: "min-w-0 grow overflow-y-auto",
2019
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailFormComponent, _objectSpread(_objectSpread({}, _objectSpread({
2020
+ blockNavigation: blockNavigation,
2021
+ emailPreviewProps: emailPreviewProps,
2022
+ formikProps: formikProps,
2023
+ tooltipProps: tooltipProps
2024
+ }, ramda.mergeLeft(fieldsVisibility, DEFAULT_FIELDS_VISIBILITY))), {}, {
2025
+ isLoading: isSubmitting,
2026
+ validationSchema: customValidationSchema || FORM_VALIDATION_SCHEMA,
2027
+ emailFormProps: _objectSpread({
2028
+ editorRef: editorRef,
2029
+ handleResetToDefault: handleResetToDefault,
2030
+ isResetting: isResetting,
2031
+ defaultValues: defaultValues
2032
+ }, emailFormProps),
2033
+ headerProps: {
2034
+ title: formattedTitle,
2035
+ titleHelpPopoverProps: helpPopoverProps,
2036
+ breadcrumbs: breadcrumbs
2037
+ },
2038
+ initialValues: parseEmailNotificationData(data, emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$sendT2 = emailFormProps.sendToFieldProps) === null || _emailFormProps$sendT2 === void 0 ? void 0 : _emailFormProps$sendT2.options),
2039
+ switchProps: {
2040
+ label: formattedNotificationToggleLabel,
2041
+ disabled: disabled,
2042
+ "data-testid": "receive-email-notification-switch"
2043
+ },
2044
+ onSubmit: handleSubmit,
2045
+ children: children
2046
+ }))
2047
+ });
2048
+ };
2049
+
2050
+ module.exports = NeetoEmailNotificationForm;
2051
+ //# sourceMappingURL=NeetoEmailNotificationForm.js.map