@bigbinary/neeto-email-notifications-frontend 2.2.21 → 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.
@@ -2,18 +2,60 @@
2
2
 
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
4
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
- var react = require('react');
5
+ var React = require('react');
6
6
  var neetoCist = require('@bigbinary/neeto-cist');
7
- var EmailForm = require('@bigbinary/neeto-molecules/EmailForm');
8
- var Spinner = require('@bigbinary/neetoui/Spinner');
7
+ var classnames = require('classnames');
8
+ var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
9
+ var EditorContent = require('@bigbinary/neeto-editor/EditorContent');
10
+ var Typography = require('@bigbinary/neetoui/Typography');
11
+ var Button = require('@bigbinary/neetoui/Button');
12
+ var emailNotificationApi = require('../emailNotificationApi-TbcNMxTw.js');
13
+ var jsxRuntime = require('react/jsx-runtime');
14
+ var formik = require('formik');
15
+ var FormikEditor = require('@bigbinary/neeto-editor/FormikEditor');
16
+ var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
17
+ var Radio = require('@bigbinary/neetoui/formik/Radio');
9
18
  var ramda = require('ramda');
10
19
  var reactI18next = require('react-i18next');
11
- var reactQuery = require('@tanstack/react-query');
12
- var constants = require('@bigbinary/neeto-commons-frontend/constants');
13
- var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
14
- var axios = require('axios');
20
+ var i18next = require('i18next');
21
+ var utils$1 = require('@bigbinary/neeto-editor/utils');
15
22
  var yup = require('yup');
16
- var jsxRuntime = require('react/jsx-runtime');
23
+ var Select = require('@bigbinary/neetoui/formik/Select');
24
+ var Input$1 = require('@bigbinary/neetoui/formik/Input');
25
+ var _typeof = require('@babel/runtime/helpers/typeof');
26
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
27
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
28
+ var Upload = require('@bigbinary/neeto-icons/Upload');
29
+ var Toastr = require('@bigbinary/neetoui/Toastr');
30
+ var MultiEmailInput = require('@bigbinary/neetoui/formik/MultiEmailInput');
31
+ var Pane = require('@bigbinary/neetoui/Pane');
32
+ var reactDropzone = require('react-dropzone');
33
+ var Download = require('@bigbinary/neeto-icons/Download');
34
+ var Callout = require('@bigbinary/neetoui/Callout');
35
+ require('stream');
36
+ var general = require('@bigbinary/neeto-commons-frontend/utils/general');
37
+ var Input = require('@bigbinary/neetoui/Input');
38
+ var Braces = require('@bigbinary/neeto-icons/Braces');
39
+ var Dropdown = require('@bigbinary/neetoui/Dropdown');
40
+ var Tooltip = require('@bigbinary/neetoui/Tooltip');
41
+ var BlockNavigation = require('@bigbinary/neetoui/formik/BlockNavigation');
42
+ var Switch = require('@bigbinary/neetoui/formik/Switch');
43
+ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
44
+ var reactRouterDom = require('react-router-dom');
45
+ var Help = require('@bigbinary/neeto-icons/Help');
46
+ var Popover = require('@bigbinary/neetoui/Popover');
47
+ var MenuHorizontal = require('@bigbinary/neeto-icons/MenuHorizontal');
48
+ var MenuVertical = require('@bigbinary/neeto-icons/MenuVertical');
49
+ var useFuncDebounce = require('@bigbinary/neeto-commons-frontend/react-utils/useFuncDebounce');
50
+ var useQueryParams = require('@bigbinary/neeto-commons-frontend/react-utils/useQueryParams');
51
+ var useUpdateEffect = require('@bigbinary/neeto-commons-frontend/react-utils/useUpdateEffect');
52
+ var Search$1 = require('@bigbinary/neeto-icons/Search');
53
+ var utils = require('@bigbinary/neeto-commons-frontend/utils');
54
+ var Form = require('@bigbinary/neetoui/formik/Form');
55
+ var Spinner = require('@bigbinary/neetoui/Spinner');
56
+ require('@tanstack/react-query');
57
+ require('@bigbinary/neeto-commons-frontend/constants');
58
+ require('axios');
17
59
 
18
60
  function _interopNamespaceDefault(e) {
19
61
  var n = Object.create(null);
@@ -34,58 +76,1545 @@ function _interopNamespaceDefault(e) {
34
76
 
35
77
  var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
36
78
 
37
- var EMAIL_NOTIFICATIONS_BASE_URL = "neeto_email_notifications/email_notification";
38
- var RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL = "".concat(EMAIL_NOTIFICATIONS_BASE_URL, "/reset_to_default");
79
+ var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
80
+ var EmailPreview = withT(function (_ref) {
81
+ var t = _ref.t,
82
+ _ref$to = _ref.to,
83
+ to = _ref$to === void 0 ? [] : _ref$to,
84
+ from = _ref.from,
85
+ subject = _ref.subject,
86
+ body = _ref.body,
87
+ actionButtonText = _ref.actionButtonText,
88
+ logo = _ref.logo,
89
+ _ref$className = _ref.className,
90
+ className = _ref$className === void 0 ? "" : _ref$className,
91
+ customContent = _ref.customContent;
92
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
93
+ "data-testid": "email-preview-card",
94
+ className: classnames("neeto-ui-bg-white neeto-ui-rounded-lg neeto-ui-theme--light neeto-notification-email-wrapper__preview relative flex flex-1 flex-col px-6 py-8", className),
95
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
96
+ className: "neeto-molecules-email-preview-ribbon",
97
+ children: t("neetoMolecules.emailPreview.previewMessage")
98
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
99
+ className: "w-full pb-4",
100
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
101
+ className: "neeto-ui-text-gray-800 min-w-0 grow space-x-2 break-words",
102
+ "data-testid": "email-subject-preview",
103
+ lineHeight: "normal",
104
+ style: "h4",
105
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
106
+ children: subject || /*#__PURE__*/jsxRuntime.jsx("span", {
107
+ className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-40"
108
+ })
109
+ })
110
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
111
+ className: "mt-4 flex items-center gap-2",
112
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
113
+ className: "shrink-0",
114
+ children: /*#__PURE__*/jsxRuntime.jsx(emailNotificationApi.SvgAvatarPlaceholder, {})
115
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
116
+ className: "neeto-ui-flex-col flex gap-1",
117
+ children: [neetoCist.isPresent(from) ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
118
+ style: "h6",
119
+ weight: "medium",
120
+ children: from
121
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
122
+ className: "flex gap-2",
123
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
124
+ className: "neeto-ui-bg-gray-100 neeto-ui-rounded-full h-2 w-24"
125
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
126
+ className: "neeto-ui-bg-gray-100 neeto-ui-rounded-full h-2 w-24"
127
+ })]
128
+ }), neetoCist.isPresent(to) ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
129
+ className: "neeto-ui-text-gray-500 line-clamp-1",
130
+ "data-testid": "email-to-block",
131
+ style: "nano",
132
+ children: to.join(", ")
133
+ }) : /*#__PURE__*/jsxRuntime.jsx("span", {
134
+ className: "neeto-ui-bg-gray-100 neeto-ui-rounded-full h-2 w-16",
135
+ "data-testid": "email-to-block"
136
+ })]
137
+ })]
138
+ })]
139
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
140
+ className: "neeto-ui-rounded neeto-ui-bg-gray-100 flex flex-1 flex-col justify-between gap-y-6 px-6 py-4 text-base leading-relaxed",
141
+ "data-testid": "email-body-preview-container",
142
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
143
+ className: "neeto-ui-bg-white w-full p-6 md:p-8 2xl:mx-auto 2xl:max-w-lg",
144
+ children: [body ? /*#__PURE__*/jsxRuntime.jsx(MemoizedEditorContent, {
145
+ className: "whitespace-normal",
146
+ content: body
147
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
148
+ className: "flex flex-col gap-y-4",
149
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
150
+ className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-48 max-w-full md:w-80"
151
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
152
+ className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-40 max-w-full md:w-72"
153
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
154
+ className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-48 max-w-full md:w-80"
155
+ })]
156
+ }), customContent && customContent, actionButtonText && /*#__PURE__*/jsxRuntime.jsx("div", {
157
+ className: "mt-6 flex w-full items-center justify-center",
158
+ children: /*#__PURE__*/jsxRuntime.jsx(Button, {
159
+ className: "pointer-events-none",
160
+ label: actionButtonText
161
+ })
162
+ }), logo && /*#__PURE__*/jsxRuntime.jsx("img", {
163
+ alt: t("neetoMolecules.emailPreview.logoAltText"),
164
+ className: "h-20 w-36 object-cover",
165
+ "data-testid": "company-logo-preview",
166
+ src: logo
167
+ })]
168
+ })
169
+ })]
170
+ });
171
+ });
172
+ EmailPreview.propTypes = {
173
+ /**
174
+ * The value of the send-to field.
175
+ */
176
+ to: emailNotificationApi.PropTypes.arrayOf(emailNotificationApi.PropTypes.string),
177
+ /**
178
+ * The value of the send-from field.
179
+ */
180
+ from: emailNotificationApi.PropTypes.string,
181
+ /**
182
+ * The subject of the email.
183
+ */
184
+ subject: emailNotificationApi.PropTypes.string,
185
+ /**
186
+ * The body of the email.
187
+ */
188
+ body: emailNotificationApi.PropTypes.string,
189
+ /**
190
+ * The text to be shown in the action button.
191
+ */
192
+ actionButtonText: emailNotificationApi.PropTypes.string,
193
+ /**
194
+ * Source link for the company logo.
195
+ */
196
+ logo: emailNotificationApi.PropTypes.string,
197
+ /**
198
+ * To pass custom content that will be rendered above the action button.
199
+ */
200
+ customContent: emailNotificationApi.PropTypes.string
201
+ };
202
+
203
+ var CSV_FILE_SIZE_IN_KB = 32;
204
+ var ONE_KILOBYTE_IN_BYTES = 1024;
205
+ var DOWNLOAD_SAMPLE_EMAIL_CSV_FILE = "https://d2v7kzglnr2dnh.cloudfront.net/others/sample-bulk-email.csv";
39
206
 
40
- var fetch = function fetch(params) {
41
- return axios.get(EMAIL_NOTIFICATIONS_BASE_URL, {
42
- params: params
207
+ var Requirements = withT(function (_ref) {
208
+ var t = _ref.t,
209
+ fileSize = _ref.fileSize;
210
+ return /*#__PURE__*/jsxRuntime.jsxs(Callout, {
211
+ className: "flex flex-col items-center py-6",
212
+ style: "info",
213
+ children: [/*#__PURE__*/jsxRuntime.jsxs("ul", {
214
+ className: "flex list-outside list-disc flex-col gap-y-1 font-normal leading-normal",
215
+ children: [fileSize && /*#__PURE__*/jsxRuntime.jsx("li", {
216
+ children: t("neetoMolecules.shareViaLink.requirements.fileTypeAndSize", {
217
+ limit: fileSize
218
+ })
219
+ }), /*#__PURE__*/jsxRuntime.jsx("li", {
220
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
221
+ components: {
222
+ strong: /*#__PURE__*/jsxRuntime.jsx("strong", {
223
+ className: "font-semibold"
224
+ })
225
+ },
226
+ i18nKey: "neetoMolecules.shareViaLink.requirements.shouldContainColumns"
227
+ })
228
+ })]
229
+ }), /*#__PURE__*/jsxRuntime.jsx(Button, {
230
+ href: DOWNLOAD_SAMPLE_EMAIL_CSV_FILE,
231
+ icon: Download,
232
+ iconPosition: "left",
233
+ label: t("neetoMolecules.shareViaLink.bulkUploadPane.downloadSampleCSV"),
234
+ style: "link"
235
+ })]
236
+ });
237
+ });
238
+ var Requirements$1 = /*#__PURE__*/React.memo(Requirements);
239
+
240
+ 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; }
241
+ 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; }
242
+ var BulkUploadPane = function BulkUploadPane(_ref) {
243
+ var _fileRejections$;
244
+ var isOpen = _ref.isOpen,
245
+ fileSize = _ref.fileSize,
246
+ onClose = _ref.onClose,
247
+ handleFileSubmit = _ref.handleFileSubmit;
248
+ var _useDropzone = reactDropzone.useDropzone({
249
+ accept: {
250
+ "text/csv": []
251
+ },
252
+ maxFiles: 1,
253
+ maxSize: fileSize * ONE_KILOBYTE_IN_BYTES,
254
+ onDrop: function onDrop(files) {
255
+ return files[0] && handleFileSubmit(files[0]);
256
+ }
257
+ }),
258
+ getRootProps = _useDropzone.getRootProps,
259
+ getInputProps = _useDropzone.getInputProps,
260
+ isDragActive = _useDropzone.isDragActive,
261
+ fileRejections = _useDropzone.fileRejections;
262
+ var errors = (_fileRejections$ = fileRejections[0]) === null || _fileRejections$ === void 0 ? void 0 : _fileRejections$.errors.map(function (_ref2) {
263
+ var message = _ref2.message,
264
+ code = _ref2.code;
265
+ return /*#__PURE__*/jsxRuntime.jsx(Typography, {
266
+ className: "neeto-ui-text-error-500 items",
267
+ "data-testid": "file-input-error-message",
268
+ style: "body3",
269
+ children: message
270
+ }, code);
271
+ });
272
+ var _useTranslation = reactI18next.useTranslation(),
273
+ t = _useTranslation.t;
274
+ return /*#__PURE__*/jsxRuntime.jsx(Pane, {
275
+ isOpen: isOpen,
276
+ onClose: onClose,
277
+ "data-testid": "bulk-upload-pane",
278
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
279
+ tabIndex: 0,
280
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Header, {
281
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
282
+ "data-testid": "bulk-upload-header",
283
+ style: "h2",
284
+ weight: "semibold",
285
+ children: t("neetoMolecules.shareViaLink.bulkUpload")
286
+ })
287
+ }), /*#__PURE__*/jsxRuntime.jsx(Pane.Body, {
288
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
289
+ className: "flex w-full flex-col gap-y-4",
290
+ children: [/*#__PURE__*/jsxRuntime.jsx(Requirements$1, {
291
+ fileSize: fileSize
292
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$1$3(_objectSpread$1$3({}, getRootProps({
293
+ className: classnames("flex flex-col p-2 border neeto-ui-border-primary-500 border-dashed neeto-ui-rounded-md transition duration-500 ease-in-out hover:neeto-ui-bg-gray-100 cursor-pointer items-center", {
294
+ "neeto-ui-border-gray-100": isDragActive,
295
+ "neeto-ui-border-error neeto-ui-bg-pastel-red hover:neeto-ui-bg-pastel-red": fileRejections.length
296
+ })
297
+ })), {}, {
298
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
299
+ className: "flex flex-col items-center gap-y-3 p-4",
300
+ children: [/*#__PURE__*/jsxRuntime.jsx(Upload, {
301
+ className: "neeto-ui-text-primary-500",
302
+ size: 32
303
+ }), /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread$1$3(_objectSpread$1$3({}, getInputProps()), {}, {
304
+ "data-testid": "csv-upload-input"
305
+ })), isDragActive ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
306
+ style: "body2",
307
+ children: t("neetoMolecules.shareViaLink.bulkUploadPane.dropFileHere")
308
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
309
+ className: "flex flex-col items-center gap-y-1",
310
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
311
+ className: "flex w-full items-center justify-center gap-x-1",
312
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
313
+ i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.dragNDrop",
314
+ components: {
315
+ Button: /*#__PURE__*/jsxRuntime.jsx(Button, {
316
+ style: "link"
317
+ })
318
+ }
319
+ })
320
+ }), /*#__PURE__*/jsxRuntime.jsxs(Typography, {
321
+ className: "neeto-ui-text-gray-700",
322
+ style: "body3",
323
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
324
+ i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.supportedFormat",
325
+ values: {
326
+ fileType: "csv"
327
+ },
328
+ components: {
329
+ code: /*#__PURE__*/jsxRuntime.jsx("code", {
330
+ className: "neeto-ui-typography neeto-ui-text-body3 neeto-ui-bg-white m-0 border-s-0 p-0"
331
+ })
332
+ }
333
+ }), " ", fileSize && t("neetoMolecules.shareViaLink.bulkUploadPane.supportedSize", {
334
+ fileSize: fileSize
335
+ })]
336
+ })]
337
+ })]
338
+ }), errors]
339
+ }))]
340
+ })
341
+ }), /*#__PURE__*/jsxRuntime.jsx(Pane.Footer, {
342
+ className: "flex items-center gap-x-2",
343
+ children: /*#__PURE__*/jsxRuntime.jsx(Button, {
344
+ "data-testid": "bulk-upload-cancel-button",
345
+ label: t("neetoMolecules.common.actions.cancel"),
346
+ style: "text",
347
+ type: "reset",
348
+ onClick: onClose
349
+ })
350
+ })]
351
+ })
43
352
  });
44
353
  };
45
- var update = function update(payload) {
46
- return axios.put(EMAIL_NOTIFICATIONS_BASE_URL, payload);
354
+
355
+ var isValidEmail$1 = function isValidEmail(email) {
356
+ return yup.string().email().isValidSync(email);
47
357
  };
48
- var resetToDefault = function resetToDefault(params) {
49
- return axios.post(RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL, params);
358
+ var createEmailOptions$1 = function createEmailOptions() {
359
+ var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
360
+ return emails.map(function (email) {
361
+ return {
362
+ label: email,
363
+ value: email,
364
+ valid: isValidEmail$1(email)
365
+ };
366
+ });
50
367
  };
51
- var emailNotificationsApi = {
52
- fetch: fetch,
53
- update: update,
54
- resetToDefault: resetToDefault
368
+ var parseCsvEmails = function parseCsvEmails(file, onSuccess) {
369
+ emailNotificationApi.Papa.parse(file, {
370
+ header: true,
371
+ skipEmptyLines: true,
372
+ transformHeader: function transformHeader(h) {
373
+ return h.toLowerCase().replace(/\W/g, "");
374
+ },
375
+ complete: function complete(results) {
376
+ var _results$meta$fields;
377
+ var isEmailFieldPresent = (_results$meta$fields = results.meta.fields) === null || _results$meta$fields === void 0 ? void 0 : _results$meta$fields.includes("email");
378
+ if (isEmailFieldPresent) {
379
+ var emails = results.data.filter(ramda.prop("email")).map(function (item) {
380
+ return item.email.trim();
381
+ });
382
+ onSuccess(createEmailOptions$1(emails));
383
+ } else {
384
+ Toastr.error(i18next.t("neetoMolecules.sendToFields.errors.invalidCsv"));
385
+ }
386
+ }
387
+ });
55
388
  };
56
389
 
57
- var QUERY_KEYS = {
58
- NEETO_EMAIL_NOTIFICATIONS: "neeto-email-notifications"
390
+ 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; }
391
+ 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; }
392
+ var SendToFields = function SendToFields(_ref) {
393
+ var emailInputProps = _ref.emailInputProps,
394
+ ccInputProps = _ref.ccInputProps,
395
+ bccInputProps = _ref.bccInputProps,
396
+ _ref$showUploadCsvBut = _ref.showUploadCsvButton,
397
+ showUploadCsvButton = _ref$showUploadCsvBut === void 0 ? false : _ref$showUploadCsvBut,
398
+ _ref$showCcBccButton = _ref.showCcBccButton,
399
+ showCcBccButton = _ref$showCcBccButton === void 0 ? false : _ref$showCcBccButton,
400
+ _ref$showCcField = _ref.showCcField,
401
+ showCcField = _ref$showCcField === void 0 ? false : _ref$showCcField,
402
+ _ref$showBccField = _ref.showBccField,
403
+ showBccField = _ref$showBccField === void 0 ? false : _ref$showBccField,
404
+ _ref$showSendToField = _ref.showSendToField,
405
+ showSendToField = _ref$showSendToField === void 0 ? true : _ref$showSendToField;
406
+ var _useState = React.useState(false),
407
+ _useState2 = _slicedToArray(_useState, 2),
408
+ isBulkUploadPaneOpen = _useState2[0],
409
+ setIsBulkUploadPaneOpen = _useState2[1];
410
+ var sendToFieldRef = React.useRef();
411
+ var _useFormikContext = formik.useFormikContext(),
412
+ _useFormikContext$val = _useFormikContext.values,
413
+ showCopyEmails = _useFormikContext$val.showCopyEmails,
414
+ existingSendToEmails = _useFormikContext$val[emailInputProps.name || "sendTo"],
415
+ setFieldValue = _useFormikContext.setFieldValue;
416
+ var _useTranslation = reactI18next.useTranslation(),
417
+ t = _useTranslation.t;
418
+ var handleCSVFile = function handleCSVFile(file) {
419
+ try {
420
+ var _sendToFieldRef$curre;
421
+ var onSuccess = function onSuccess(values) {
422
+ return setFieldValue(emailInputProps.name || "sendTo", [].concat(_toConsumableArray(existingSendToEmails), _toConsumableArray(values)));
423
+ };
424
+ parseCsvEmails(file, onSuccess);
425
+ setIsBulkUploadPaneOpen(false);
426
+ (_sendToFieldRef$curre = sendToFieldRef.current) === null || _sendToFieldRef$curre === void 0 || _sendToFieldRef$curre.focus();
427
+ } catch (error) {
428
+ Toastr.error(error);
429
+ }
430
+ };
431
+ var handelCcBccButtonClick = function handelCcBccButtonClick(e) {
432
+ e.stopPropagation();
433
+ setFieldValue("showCopyEmails", !showCopyEmails);
434
+ };
435
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
436
+ className: "relative w-full flex-col gap-2",
437
+ "data-testid": "send-to-text-field",
438
+ children: [showUploadCsvButton && /*#__PURE__*/jsxRuntime.jsx(Button, {
439
+ className: "absolute end-1 top-0",
440
+ "data-testid": "bulk-upload-button",
441
+ icon: Upload,
442
+ label: t("neetoMolecules.shareViaLink.bulkUpload"),
443
+ size: "small",
444
+ style: "link",
445
+ onClick: function onClick() {
446
+ return setIsBulkUploadPaneOpen(true);
447
+ }
448
+ }), showSendToField && /*#__PURE__*/jsxRuntime.jsx("div", {
449
+ className: "neeto-ui-border-gray-200 w-full border-b pb-1",
450
+ children: /*#__PURE__*/jsxRuntime.jsx(MultiEmailInput, _objectSpread$a(_objectSpread$a({
451
+ name: "sendTo",
452
+ ref: sendToFieldRef
453
+ }, emailInputProps), {}, {
454
+ suffix: showCcBccButton && /*#__PURE__*/jsxRuntime.jsx(Button, {
455
+ "data-testid": "cc-bcc-button",
456
+ label: t("neetoMolecules.emailForm.labels.ccBcc"),
457
+ size: "small",
458
+ style: "link",
459
+ onClick: handelCcBccButtonClick,
460
+ onKeyDown: function onKeyDown(event) {
461
+ return event.stopPropagation();
462
+ }
463
+ })
464
+ }))
465
+ }), (showCopyEmails || showCcField || showBccField) && /*#__PURE__*/jsxRuntime.jsxs("div", {
466
+ className: "mt-5 flex w-full flex-col gap-5",
467
+ children: [(showCopyEmails || showCcField) && /*#__PURE__*/jsxRuntime.jsx("div", {
468
+ className: "neeto-ui-border-gray-200 w-full border-b pb-1",
469
+ children: /*#__PURE__*/jsxRuntime.jsx(MultiEmailInput, _objectSpread$a({
470
+ name: "sendToBcc"
471
+ }, ccInputProps))
472
+ }), (showCopyEmails || showBccField) && /*#__PURE__*/jsxRuntime.jsx("div", {
473
+ className: "neeto-ui-border-gray-200 w-full border-b pb-1",
474
+ children: /*#__PURE__*/jsxRuntime.jsx(MultiEmailInput, _objectSpread$a({
475
+ name: "sendToCc"
476
+ }, bccInputProps))
477
+ })]
478
+ }), /*#__PURE__*/jsxRuntime.jsx(BulkUploadPane, {
479
+ fileSize: CSV_FILE_SIZE_IN_KB,
480
+ handleFileSubmit: handleCSVFile,
481
+ isOpen: isBulkUploadPaneOpen,
482
+ onClose: function onClose() {
483
+ return setIsBulkUploadPaneOpen(false);
484
+ }
485
+ })]
486
+ });
59
487
  };
60
488
 
61
- var useFetchEmailNotifications = function useFetchEmailNotifications(params) {
62
- return reactQuery.useQuery({
63
- queryKey: [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, params["notificationHolderId"], params["customFields"]],
64
- queryFn: function queryFn() {
65
- return emailNotificationsApi.fetch(params);
489
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=true===r.prepend?"prepend":"append",d=true===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
490
+
491
+ var css$5 = ".neeto-molecules-dynamic-variables{display:flex;flex-direction:column;gap:.375rem;max-width:22.5rem;min-width:11.5rem;padding:.5rem}.neeto-molecules-dynamic-variables__list{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}.neeto-molecules-dynamic-variables__list button{border:1px solid rgb(var(--neeto-ui-gray-300));border-radius:var(--neeto-ui-rounded-md);color:rgb(var(--neeto-ui-black));padding:.375rem;text-align:start;transition:var(--neeto-ui-transition);-webkit-user-select:none;-moz-user-select:none;user-select:none}@media (prefers-reduced-motion:reduce){.neeto-molecules-dynamic-variables__list button{transition:none}}.neeto-molecules-dynamic-variables__list button:focus,.neeto-molecules-dynamic-variables__list button:focus-visible,.neeto-molecules-dynamic-variables__list button:hover{border-color:rgb(var(--neeto-ui-primary-800));box-shadow:none;color:rgb(var(--neeto-ui-primary-800));outline:none}";
492
+ n(css$5,{});
493
+
494
+ var parseVariables = function parseVariables() {
495
+ var variableArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
496
+ var uncategorized = [];
497
+ var groupedVariables = [];
498
+ var categorySet = new Set();
499
+ variableArr.forEach(function (variable) {
500
+ var category = variable.category,
501
+ label = variable.label,
502
+ variables = variable.variables;
503
+ if (category && variables) {
504
+ var parsedVariables = variables.map(ramda.mergeLeft({
505
+ category: category,
506
+ categoryLabel: label
507
+ }));
508
+ if (!categorySet.has(category)) {
509
+ categorySet.add(category);
510
+ groupedVariables.push({
511
+ label: label,
512
+ variables: parsedVariables
513
+ });
514
+ } else {
515
+ var existingGroup = neetoCist.findBy({
516
+ label: label
517
+ }, groupedVariables);
518
+ existingGroup.variables = ramda.uniqBy(ramda.prop("key"), existingGroup.variables.concat(parsedVariables));
519
+ }
520
+ } else {
521
+ uncategorized.push(variable);
522
+ }
523
+ });
524
+ if (!ramda.isEmpty(uncategorized)) {
525
+ groupedVariables.push({
526
+ label: !ramda.isEmpty(groupedVariables) ? "Others" : null,
527
+ variables: uncategorized
528
+ });
529
+ }
530
+ return groupedVariables;
531
+ };
532
+
533
+ var _excluded$6 = ["onVariableClick", "variables", "buttonProps"];
534
+ 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; }
535
+ 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; }
536
+ var Menu$2 = Dropdown.Menu;
537
+ var DynamicVariables = function DynamicVariables(_ref) {
538
+ var _ref$onVariableClick = _ref.onVariableClick,
539
+ onVariableClick = _ref$onVariableClick === void 0 ? neetoCist.noop : _ref$onVariableClick,
540
+ _ref$variables = _ref.variables,
541
+ variables = _ref$variables === void 0 ? [] : _ref$variables,
542
+ buttonProps = _ref.buttonProps,
543
+ dropdownProps = _objectWithoutProperties(_ref, _excluded$6);
544
+ if (ramda.isEmpty(variables)) {
545
+ return null;
546
+ }
547
+ var parsedVariables = parseVariables(variables);
548
+ return /*#__PURE__*/jsxRuntime.jsx(Dropdown, _objectSpread$9(_objectSpread$9({
549
+ appendTo: function appendTo() {
550
+ return document.body;
66
551
  },
67
- staleTime: constants.DEFAULT_STALE_TIME,
68
- select: ramda.prop("emailNotification"),
69
- enabled: neetoCist.isNotEmpty(params)
552
+ buttonStyle: "secondary",
553
+ icon: Braces,
554
+ strategy: "fixed",
555
+ zIndex: 99999,
556
+ buttonProps: _objectSpread$9({
557
+ "data-testid": "dynamic-variables-button"
558
+ }, buttonProps)
559
+ }, dropdownProps), {}, {
560
+ children: /*#__PURE__*/jsxRuntime.jsx(Menu$2, {
561
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
562
+ className: "neeto-molecules-dynamic-variables",
563
+ "data-testid": "dynamic-variables-list",
564
+ children: parsedVariables.map(function (_ref2) {
565
+ var label = _ref2.label,
566
+ variables = _ref2.variables;
567
+ return /*#__PURE__*/jsxRuntime.jsxs(React.Fragment, {
568
+ children: [label && /*#__PURE__*/jsxRuntime.jsxs("div", {
569
+ className: "flex flex-row items-center gap-x-2",
570
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
571
+ style: "h6",
572
+ children: label
573
+ }), /*#__PURE__*/jsxRuntime.jsx("hr", {
574
+ className: "neeto-ui-border-gray-200 flex flex-grow"
575
+ })]
576
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
577
+ className: "neeto-molecules-dynamic-variables__list",
578
+ "data-testid": general.joinHyphenCase("dynamic-variables-list", label),
579
+ children: variables.map(function (item) {
580
+ return /*#__PURE__*/jsxRuntime.jsx("button", {
581
+ "data-testid": general.joinHyphenCase("dynamic-variables-list-item", item.label),
582
+ onClick: function onClick() {
583
+ return onVariableClick(item);
584
+ },
585
+ children: item.label
586
+ }, item.label);
587
+ })
588
+ })]
589
+ }, label);
590
+ })
591
+ })
592
+ })
593
+ }));
594
+ };
595
+
596
+ var css$4 = ".neeto-molecules-breadcrumb{align-items:center;display:flex;flex-direction:row;justify-content:flex-start;line-height:1}.neeto-molecules-breadcrumb a{text-decoration:none;transition:all .3s ease-in-out}@media (prefers-reduced-motion:reduce){.neeto-molecules-breadcrumb a{transition:none}}.neeto-molecules-breadcrumb a:focus-visible{border-radius:var(--neeto-ui-rounded-sm);outline:3px solid rgba(var(--neeto-ui-primary-500),50%)}.neeto-molecules-breadcrumb-separator{font-size:.75rem;line-height:1rem;margin-inline:.75rem}.neeto-molecules-breadcrumbs-wrap{display:flex;flex-wrap:wrap;gap:.375rem 0;margin-block-end:2.5rem}@media screen and (max-width:768px){.neeto-molecules-breadcrumbs-wrap{margin-block-end:1rem}}.neeto-molecules-breadcrumbs-list{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:0}";
597
+ n(css$4,{});
598
+
599
+ var Breadcrumbs = reactUtils.withT(function (_ref) {
600
+ var t = _ref.t,
601
+ breadcrumbs = _ref.breadcrumbs,
602
+ _ref$hasTrailingSepar = _ref.hasTrailingSeparator,
603
+ hasTrailingSeparator = _ref$hasTrailingSepar === void 0 ? false : _ref$hasTrailingSepar,
604
+ className = _ref.className;
605
+ return /*#__PURE__*/jsxRuntime.jsx("nav", {
606
+ "aria-label": t("neetoMolecules.breadcrumbs.breadcrumbAriaLabel"),
607
+ className: classnames("neeto-molecules-breadcrumbs-wrap", className),
608
+ children: /*#__PURE__*/jsxRuntime.jsx("ol", {
609
+ className: "neeto-molecules-breadcrumbs-list",
610
+ children: breadcrumbs.map(function (_ref2, index) {
611
+ var text = _ref2.text,
612
+ _ref2$link = _ref2.link,
613
+ link = _ref2$link === void 0 ? "#" : _ref2$link;
614
+ var isLast = index + 1 === breadcrumbs.length;
615
+ var isCurrentPage = isLast && !hasTrailingSeparator;
616
+ return /*#__PURE__*/jsxRuntime.jsxs("li", {
617
+ className: "neeto-molecules-breadcrumb",
618
+ "data-testid": "header-breadcrumb",
619
+ children: [isCurrentPage ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
620
+ "aria-current": "page",
621
+ className: "neeto-ui-text-gray-700 neeto-molecules-breadcrumb-link",
622
+ component: "span",
623
+ "data-testid": "".concat(general.hyphenize(text), "-breadcrumb"),
624
+ style: "body2",
625
+ weight: "normal",
626
+ children: text
627
+ }) : /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Link, {
628
+ to: link,
629
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
630
+ className: "neeto-ui-text-gray-700 hover:neeto-ui-text-gray-800 neeto-molecules-breadcrumb-link",
631
+ component: "span",
632
+ "data-testid": "".concat(general.hyphenize(text), "-breadcrumb"),
633
+ style: "body2",
634
+ weight: "normal",
635
+ children: text
636
+ })
637
+ }), !isCurrentPage && /*#__PURE__*/jsxRuntime.jsx("span", {
638
+ "aria-hidden": "true",
639
+ className: "neeto-molecules-breadcrumb-separator neeto-ui-text-black",
640
+ children: "/"
641
+ })]
642
+ }, index);
643
+ })
644
+ })
70
645
  });
646
+ });
647
+
648
+ var SIZE = {
649
+ "default": 16,
650
+ large: 20
71
651
  };
72
- var useUpdateEmailNotification = function useUpdateEmailNotification() {
73
- return reactUtils.useMutationWithInvalidation(function (params) {
74
- return emailNotificationsApi.update(params);
75
- }, {
76
- keysToInvalidate: [function (_, _ref) {
77
- var notificationHolderId = _ref.notificationHolderId;
78
- return [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, notificationHolderId];
79
- }]
652
+
653
+ var _excluded$5 = ["title", "size", "description", "helpLinkProps", "popoverProps", "className", "iconColor", "icon"];
654
+ 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; }
655
+ 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; }
656
+ var HelpPopover = function HelpPopover(_ref) {
657
+ var title = _ref.title,
658
+ _ref$size = _ref.size,
659
+ size = _ref$size === void 0 ? "large" : _ref$size,
660
+ description = _ref.description,
661
+ helpLinkProps = _ref.helpLinkProps,
662
+ popoverProps = _ref.popoverProps,
663
+ className = _ref.className,
664
+ _ref$iconColor = _ref.iconColor,
665
+ iconColor = _ref$iconColor === void 0 ? "currentColor" : _ref$iconColor,
666
+ _ref$icon = _ref.icon,
667
+ IconComponent = _ref$icon === void 0 ? Help : _ref$icon,
668
+ otherProps = _objectWithoutProperties(_ref, _excluded$5);
669
+ var _useTranslation = reactI18next.useTranslation(),
670
+ t = _useTranslation.t;
671
+ var popoverRef = React.useRef();
672
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
673
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$8(_objectSpread$8({}, otherProps), {}, {
674
+ "data-testid": "help-popover-button",
675
+ icon: function icon() {
676
+ return /*#__PURE__*/jsxRuntime.jsx(IconComponent, {
677
+ color: iconColor,
678
+ size: SIZE[size]
679
+ });
680
+ },
681
+ ref: popoverRef,
682
+ style: "text",
683
+ className: classnames("neeto-molecule-help-popover-trigger neeto-ui-rounded-full bg-transparent p-0", className)
684
+ })), /*#__PURE__*/jsxRuntime.jsx(Popover, _objectSpread$8(_objectSpread$8({
685
+ appendTo: function appendTo() {
686
+ return document.body;
687
+ },
688
+ reference: popoverRef
689
+ }, popoverProps), {}, {
690
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
691
+ className: "flex flex-col",
692
+ onClick: function onClick(event) {
693
+ return event.stopPropagation();
694
+ },
695
+ children: [title && /*#__PURE__*/jsxRuntime.jsx(Popover.Title, {
696
+ "data-testid": "help-popover-title",
697
+ children: title
698
+ }), typeof description === "string" ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
699
+ "data-testid": "help-popover-description",
700
+ lineHeight: "normal",
701
+ style: "body2",
702
+ children: description
703
+ }) : description, helpLinkProps && /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$8(_objectSpread$8({
704
+ className: "neeto-ui-mt-3",
705
+ "data-testid": "help-popover-link-button",
706
+ label: t("neetoMolecules.common.viewHelpArticle"),
707
+ size: "small"
708
+ }, helpLinkProps), {}, {
709
+ style: "link",
710
+ target: "_blank"
711
+ }))]
712
+ })
713
+ }))]
80
714
  });
81
715
  };
82
- var useResetEmailNotificationToDefault = function useResetEmailNotificationToDefault() {
83
- return reactUtils.useMutationWithInvalidation(emailNotificationsApi.resetToDefault, {
84
- keysToInvalidate: [function (_, _ref2) {
85
- var notificationHolderId = _ref2.notificationHolderId,
86
- customFields = _ref2.customFields;
87
- return [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, notificationHolderId, customFields];
88
- }]
716
+
717
+ var MENU_ITEM_TYPES = {
718
+ menuItem: "menuItem",
719
+ divider: "divider"
720
+ };
721
+ var DEFAULT_TOOLTIP_PROPS = {
722
+ disabled: true,
723
+ position: "bottom",
724
+ touch: ["hold", 500]
725
+ };
726
+
727
+ var _excluded$2$1 = ["t", "label", "key"],
728
+ _excluded2$1 = ["isVisible", "key"];
729
+ 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; }
730
+ 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; }
731
+ var MenuItem$1 = Dropdown.MenuItem,
732
+ Menu$1 = Dropdown.Menu;
733
+ var Submenu = reactUtils.withT(function (_ref) {
734
+ var t = _ref.t,
735
+ label = _ref.label,
736
+ key = _ref.key,
737
+ menuItemProps = _objectWithoutProperties(_ref, _excluded$2$1);
738
+ return /*#__PURE__*/jsxRuntime.jsx(Dropdown, _objectSpread$2$1(_objectSpread$2$1({
739
+ appendTo: "parent",
740
+ position: "left",
741
+ trigger: "hover",
742
+ customTarget: /*#__PURE__*/jsxRuntime.jsx(MenuItem$1.Button, {
743
+ "aria-haspopup": "menu",
744
+ role: "menuitem",
745
+ children: label
746
+ })
747
+ }, menuItemProps.dropdownProps), {}, {
748
+ children: /*#__PURE__*/jsxRuntime.jsx(Menu$1, {
749
+ "aria-label": t("neetoMolecules.moreDropdown.submenuAriaLabel", {
750
+ label: label
751
+ }),
752
+ role: "menu",
753
+ children: menuItemProps.menuItems.map(function (_ref2) {
754
+ var _ref2$isVisible = _ref2.isVisible,
755
+ isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
756
+ key = _ref2.key,
757
+ menuItemProps = _objectWithoutProperties(_ref2, _excluded2$1);
758
+ if (!isVisible) return null;
759
+ return /*#__PURE__*/jsxRuntime.jsx(MoreDropdownMenuItem, _objectSpread$2$1({}, menuItemProps), key);
760
+ })
761
+ })
762
+ }), key);
763
+ });
764
+
765
+ var _excluded$1$1 = ["onClick", "label", "type", "hasSubItems"];
766
+ 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; }
767
+ 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; }
768
+ var MenuItem = Dropdown.MenuItem,
769
+ Divider = Dropdown.Divider;
770
+ var MoreDropdownMenuItem = function MoreDropdownMenuItem(_ref) {
771
+ var onClick = _ref.onClick,
772
+ label = _ref.label,
773
+ _ref$type = _ref.type,
774
+ type = _ref$type === void 0 ? MENU_ITEM_TYPES.menuItem : _ref$type,
775
+ _ref$hasSubItems = _ref.hasSubItems,
776
+ hasSubItems = _ref$hasSubItems === void 0 ? false : _ref$hasSubItems,
777
+ menuItemProps = _objectWithoutProperties(_ref, _excluded$1$1);
778
+ if (type === MENU_ITEM_TYPES.divider) {
779
+ return /*#__PURE__*/jsxRuntime.jsx(Divider, {
780
+ role: "separator"
781
+ });
782
+ }
783
+ if (hasSubItems) {
784
+ return /*#__PURE__*/jsxRuntime.jsx(Submenu, _objectSpread$1$2({}, _objectSpread$1$2({
785
+ label: label
786
+ }, menuItemProps)));
787
+ }
788
+ return /*#__PURE__*/jsxRuntime.jsx(MenuItem.Button, _objectSpread$1$2(_objectSpread$1$2({}, _objectSpread$1$2({
789
+ onClick: onClick
790
+ }, menuItemProps)), {}, {
791
+ role: "menuitem",
792
+ children: label
793
+ }));
794
+ };
795
+
796
+ var css$3 = ".neeto-ui-btn.neeto-ui-btn--icon-only[data-dropdown-button-style=more-dropdown],.neeto-ui-btn.neeto-ui-btn--icon-only[data-testid=column-menu-button]{--neeto-ui-btn-icon-size:1.25rem;--neeto-ui-btn-padding-x:0;--neeto-ui-btn-padding-y:0;height:1.75rem;justify-content:center;width:1.75rem}.neeto-ui-btn.neeto-ui-btn--icon-only.neeto-ui-btn--size-medium[data-dropdown-button-style=more-dropdown],.neeto-ui-btn.neeto-ui-btn--icon-only.neeto-ui-btn--size-medium[data-testid=column-menu-button]{--neeto-ui-btn-icon-size:1.5rem;--neeto-ui-btn-padding-x:0;--neeto-ui-btn-padding-y:0;height:2rem;justify-content:center;width:2rem}.neeto-ui-btn.neeto-ui-btn--icon-only.neeto-ui-btn--size-large[data-dropdown-button-style=more-dropdown],.neeto-ui-btn.neeto-ui-btn--icon-only.neeto-ui-btn--size-large[data-testid=column-menu-button]{--neeto-ui-btn-icon-size:1.875rem;--neeto-ui-btn-padding-x:0;--neeto-ui-btn-padding-y:0;height:2.5rem;justify-content:center;width:2.5rem}.neeto-ui-btn.neeto-molecule-moredropdown--rounded[data-dropdown-button-style=more-dropdown]{border-radius:100%}";
797
+ n(css$3,{});
798
+
799
+ var _excluded$4 = ["isRounded"],
800
+ _excluded2$2 = ["isVisible", "key"];
801
+ 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; }
802
+ 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; }
803
+ var Menu = Dropdown.Menu;
804
+ var MoreDropdown = function MoreDropdown(_ref) {
805
+ var _ref$dropdownButtonPr = _ref.dropdownButtonProps,
806
+ dropdownButtonProps = _ref$dropdownButtonPr === void 0 ? {} : _ref$dropdownButtonPr,
807
+ _ref$isVertical = _ref.isVertical,
808
+ isVertical = _ref$isVertical === void 0 ? false : _ref$isVertical,
809
+ _ref$isDisabled = _ref.isDisabled,
810
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
811
+ _ref$dropdownProps = _ref.dropdownProps,
812
+ dropdownProps = _ref$dropdownProps === void 0 ? {} : _ref$dropdownProps,
813
+ menuTopChildren = _ref.menuTopChildren,
814
+ menuBottomChildren = _ref.menuBottomChildren,
815
+ _ref$menuItems = _ref.menuItems,
816
+ menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems;
817
+ var _useTranslation = reactI18next.useTranslation(),
818
+ t = _useTranslation.t;
819
+ var isRoundedButton = dropdownButtonProps.isRounded,
820
+ buttonProps = _objectWithoutProperties(dropdownButtonProps, _excluded$4);
821
+ var tooltipProps = ramda.mergeRight(DEFAULT_TOOLTIP_PROPS, dropdownButtonProps.tooltipProps);
822
+ var targetIcon = isVertical ? MenuVertical : MenuHorizontal;
823
+ var isDropdownDisabled = isDisabled || dropdownProps.disabled;
824
+ if (isDropdownDisabled && !tooltipProps.disabled) {
825
+ return /*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread$7(_objectSpread$7({}, tooltipProps), {}, {
826
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
827
+ children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$7({
828
+ disabled: true,
829
+ "data-dropdown-button-style": "more-dropdown",
830
+ "data-testid": "more-dropdown-button",
831
+ icon: targetIcon,
832
+ iconPosition: "right",
833
+ size: "medium",
834
+ style: "text",
835
+ className: classnames({
836
+ "neeto-molecule-moredropdown--rounded": isRoundedButton
837
+ })
838
+ }, buttonProps))
839
+ })
840
+ }));
841
+ }
842
+ return /*#__PURE__*/jsxRuntime.jsx(Dropdown, _objectSpread$7(_objectSpread$7({
843
+ className: "flex",
844
+ disabled: isDisabled,
845
+ icon: targetIcon,
846
+ zIndex: 99999,
847
+ buttonProps: _objectSpread$7({
848
+ "data-dropdown-button-style": "more-dropdown",
849
+ className: classnames("min-h-0 flex-shrink-0 neeto-molecule-moredropdown-btn", {
850
+ "neeto-molecule-moredropdown--rounded": isRoundedButton
851
+ }),
852
+ style: "text",
853
+ tooltipProps: {
854
+ content: t("neetoMolecules.moreDropdown.tooltip"),
855
+ position: "top",
856
+ touch: ["hold", 500]
857
+ },
858
+ "aria-haspopup": "menu",
859
+ "aria-label": t("neetoMolecules.moreDropdown.buttonAriaLabel")
860
+ }, buttonProps)
861
+ }, dropdownProps), {}, {
862
+ children: /*#__PURE__*/jsxRuntime.jsxs(Menu, {
863
+ "aria-label": t("neetoMolecules.moreDropdown.menuAriaLabel"),
864
+ role: "menu",
865
+ children: [menuTopChildren, menuItems.map(function (_ref2) {
866
+ var _ref2$isVisible = _ref2.isVisible,
867
+ isVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
868
+ key = _ref2.key,
869
+ menuItemProps = _objectWithoutProperties(_ref2, _excluded2$2);
870
+ if (!isVisible) return null;
871
+ return /*#__PURE__*/jsxRuntime.jsx(MoreDropdownMenuItem, _objectSpread$7({}, menuItemProps), key !== null && key !== void 0 ? key : neetoCist.hyphenate(menuItemProps.label));
872
+ }), menuBottomChildren]
873
+ })
874
+ }));
875
+ };
876
+
877
+ var css$2 = ".neeto-molecules-search__wrapper input[type=search]::-webkit-search-cancel-button:hover,.neeto-molecules-search__wrapper input[type=search]::-webkit-search-decoration:hover{cursor:pointer}";
878
+ n(css$2,{});
879
+
880
+ var getInitialSearchValue = function getInitialSearchValue(_ref) {
881
+ var _ref$initialValue = _ref.initialValue,
882
+ initialValue = _ref$initialValue === void 0 ? "" : _ref$initialValue,
883
+ enableUrlSync = _ref.enableUrlSync,
884
+ searchParamName = _ref.searchParamName;
885
+ if (enableUrlSync) {
886
+ var _queryParams$searchPa;
887
+ var queryParams = utils.getQueryParams({
888
+ toCamelCase: false
889
+ });
890
+ return (_queryParams$searchPa = queryParams[searchParamName]) !== null && _queryParams$searchPa !== void 0 ? _queryParams$searchPa : "";
891
+ }
892
+ return initialValue;
893
+ };
894
+
895
+ var _excluded$3 = ["value", "debounceTime", "onSearch", "onChange", "enableUrlSync", "searchParamName"];
896
+ 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; }
897
+ 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; }
898
+ var Search = function Search(_ref) {
899
+ var value = _ref.value,
900
+ _ref$debounceTime = _ref.debounceTime,
901
+ debounceTime = _ref$debounceTime === void 0 ? 300 : _ref$debounceTime,
902
+ onSearch = _ref.onSearch,
903
+ onChange = _ref.onChange,
904
+ _ref$enableUrlSync = _ref.enableUrlSync,
905
+ enableUrlSync = _ref$enableUrlSync === void 0 ? false : _ref$enableUrlSync,
906
+ _ref$searchParamName = _ref.searchParamName,
907
+ searchParamName = _ref$searchParamName === void 0 ? "search_term" : _ref$searchParamName,
908
+ inputProps = _objectWithoutProperties(_ref, _excluded$3);
909
+ var _useTranslation = reactI18next.useTranslation(),
910
+ t = _useTranslation.t;
911
+ var queryParams = useQueryParams({
912
+ toCamelCase: false
913
+ });
914
+ var history = reactRouterDom.useHistory();
915
+ var _useState = React.useState(getInitialSearchValue({
916
+ initialValue: value,
917
+ enableUrlSync: enableUrlSync,
918
+ searchParamName: searchParamName
919
+ })),
920
+ _useState2 = _slicedToArray(_useState, 2),
921
+ internalValue = _useState2[0],
922
+ setInternalValue = _useState2[1];
923
+ var trimmedValue = value === null || value === void 0 ? void 0 : value.trim();
924
+ useUpdateEffect(function () {
925
+ if (!enableUrlSync || neetoCist.isPresent(queryParams === null || queryParams === void 0 ? void 0 : queryParams[searchParamName])) return;
926
+ setInternalValue("");
927
+ }, [queryParams === null || queryParams === void 0 ? void 0 : queryParams[searchParamName]]);
928
+ var handleSearchQueryParams = function handleSearchQueryParams(trimmedValue) {
929
+ if (!trimmedValue && !(queryParams !== null && queryParams !== void 0 && queryParams[searchParamName])) return;
930
+ if (trimmedValue === (queryParams === null || queryParams === void 0 ? void 0 : queryParams[searchParamName])) return;
931
+ var searchParams = {};
932
+ var pathname = window.location.pathname;
933
+ if (trimmedValue) searchParams = _defineProperty({}, searchParamName, trimmedValue);else queryParams === null || queryParams === void 0 || delete queryParams[searchParamName];
934
+ history.push(general.buildUrl(pathname, ramda.mergeLeft(searchParams, queryParams)));
935
+ };
936
+ var handleDebouncedSearchTermChange = useFuncDebounce(function (trimmedValue) {
937
+ if (onSearch) onSearch(trimmedValue);else if (enableUrlSync) handleSearchQueryParams(trimmedValue);
938
+ }, debounceTime);
939
+ useUpdateEffect(function () {
940
+ handleDebouncedSearchTermChange(trimmedValue);
941
+ }, [trimmedValue]);
942
+ if (value !== undefined && internalValue !== value) {
943
+ setInternalValue(value);
944
+ }
945
+ var handleOnChange = function handleOnChange(e) {
946
+ var _e$target$value;
947
+ var trimmedValue = (_e$target$value = e.target.value) === null || _e$target$value === void 0 ? void 0 : _e$target$value.trim();
948
+ onChange === null || onChange === void 0 || onChange(e);
949
+ setInternalValue(e.target.value);
950
+ if ((internalValue === null || internalValue === void 0 ? void 0 : internalValue.trim()) !== trimmedValue) {
951
+ handleDebouncedSearchTermChange(trimmedValue);
952
+ }
953
+ };
954
+ React.useEffect(function () {
955
+ return handleDebouncedSearchTermChange.cancel;
956
+ }, []);
957
+ return /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$6({
958
+ className: "neeto-molecules-search__wrapper",
959
+ placeholder: t("neetoMolecules.common.actions.search"),
960
+ prefix: /*#__PURE__*/jsxRuntime.jsx(Search$1, {}),
961
+ type: "search",
962
+ value: internalValue,
963
+ onChange: handleOnChange
964
+ }, inputProps));
965
+ };
966
+
967
+ var SIZES = {
968
+ nano: "nano",
969
+ small: "small"
970
+ };
971
+ var DROPDOWN_BUTTON_SIZES = {
972
+ nano: "small",
973
+ small: "medium"
974
+ };
975
+
976
+ var css$1 = ":root{--neeto-molecules-main-header-height:6.25rem;--neeto-molecules-main-header-with-breadcrumbs-height:8.25rem;--neeto-molecules-effective-header-height:0px}.neeto-molecules-header{align-items:flex-start;background:rgb(var(--neeto-ui-white));display:flex;flex-direction:row;flex-shrink:0;gap:1rem;justify-content:space-between;padding:2.5rem 0 1.5rem;width:100%}@media screen and (max-width:1024px){.neeto-molecules-header{flex-wrap:wrap}}.neeto-molecules-header .neeto-molecules-header__toggle-menubar-btn{margin-inline-end:.5rem}.neeto-molecules-header .neeto-molecules-header__left{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start}.neeto-molecules-header .neeto-molecules-header__left-data-wrap{display:flex;flex-wrap:wrap}.neeto-molecules-header .neeto-molecules-header__page-title{align-items:center;display:flex;flex-direction:row;gap:.75rem;margin-top:-.25rem;width:100%}.neeto-molecules-header .neeto-molecules-header__page-title .neeto-molecule-help-popover-trigger,.neeto-molecules-header .neeto-molecules-header__page-title .neeto-molecule-moredropdown-btn{margin-inline-start:.5rem;vertical-align:middle}@media screen and (max-width:1024px){.neeto-molecules-header .neeto-molecules-header__page-title{margin-top:-.625rem}}@media screen and (max-width:768px){.neeto-molecules-header .neeto-molecules-header__page-title{margin-top:-.5rem}}@media screen and (max-width:576px){.neeto-molecules-header .neeto-molecules-header__page-title{margin-top:-.25rem}}.neeto-molecules-header .neeto-molecules-header__page-title h1{line-height:var(--neeto-ui-leading-tight)}.neeto-molecules-header .neeto-molecules-header__right{align-items:center;display:flex;gap:.75rem;justify-content:flex-end}.neeto-molecules-header .neeto-molecules-header__right:empty{display:none;visibility:hidden}@media screen and (max-width:768px){.neeto-molecules-header .neeto-molecules-header__right{flex-wrap:wrap;justify-content:flex-start}}.neeto-molecules-header .neeto-molecules-header__right .neeto-ui-btn{flex-shrink:0}.neeto-molecules-header .neeto-molecules-header__right .neeto-molecules-header__search-input{flex-grow:0;min-width:12.6rem}.neeto-molecules-header .neeto-molecules-header__right .neeto-molecules-header__action-block{align-items:center;display:flex;flex-shrink:0;gap:.75rem;justify-content:flex-end}@media screen and (max-width:360px){.neeto-molecules-header .neeto-molecules-header__right .neeto-molecules-header__action-block{flex-shrink:1;flex-wrap:wrap;justify-content:flex-start}}.neeto-molecules-header--has-breadcrumbs .neeto-molecules-breadcrumbs-wrap{margin:0 0 1rem}.neeto-molecules-header--has-breadcrumbs .neeto-molecules-header__page-title{margin-top:0}.neeto-molecules-header--nano,.neeto-molecules-header--small{flex-shrink:0;min-height:0}.neeto-molecules-header--nano .neeto-molecules-header__page-title{margin-top:0}";
977
+ n(css$1,{});
978
+
979
+ var _excluded$2 = ["dropdownButtonProps"];
980
+ 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; }
981
+ 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; }
982
+ var Header = function Header(_ref) {
983
+ var title = _ref.title,
984
+ _ref$titleHelpPopover = _ref.titleHelpPopoverProps,
985
+ titleHelpPopoverProps = _ref$titleHelpPopover === void 0 ? {} : _ref$titleHelpPopover,
986
+ searchProps = _ref.searchProps,
987
+ _ref$className = _ref.className,
988
+ className = _ref$className === void 0 ? "" : _ref$className,
989
+ actionBlock = _ref.actionBlock,
990
+ _ref$breadcrumbs = _ref.breadcrumbs,
991
+ breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
992
+ _ref$renderDropdown = _ref.renderDropdown,
993
+ renderDropdown = _ref$renderDropdown === void 0 ? neetoCist.noop : _ref$renderDropdown,
994
+ _ref$size = _ref.size,
995
+ size = _ref$size === void 0 ? "small" : _ref$size,
996
+ _ref$dataTestid = _ref["data-testid"],
997
+ dataTestId = _ref$dataTestid === void 0 ? "neeto-molecules-header" : _ref$dataTestid;
998
+ var headerRef = React.useRef(null);
999
+ React.useLayoutEffect(function () {
1000
+ var updateHeaderHeight = function updateHeaderHeight() {
1001
+ if (!headerRef.current) return;
1002
+ var height = headerRef.current.offsetHeight;
1003
+ document.body.style.setProperty("--neeto-molecules-effective-header-height", "".concat(height, "px"));
1004
+ };
1005
+ updateHeaderHeight();
1006
+ window.addEventListener("resize", updateHeaderHeight);
1007
+ return function () {
1008
+ return window.removeEventListener("resize", updateHeaderHeight);
1009
+ };
1010
+ }, []);
1011
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1012
+ "data-testid": dataTestId,
1013
+ ref: headerRef,
1014
+ className: classnames(["neeto-molecules-header", {
1015
+ "neeto-molecules-header--has-breadcrumbs": neetoCist.isNotEmpty(breadcrumbs),
1016
+ "neeto-molecules-header--small": size === SIZES.small,
1017
+ "neeto-molecules-header--nano": size === SIZES.nano
1018
+ }, className]),
1019
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1020
+ className: "neeto-molecules-header__left",
1021
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
1022
+ className: "neeto-molecules-header__left-data-wrap",
1023
+ children: [neetoCist.isNotEmpty(breadcrumbs) && /*#__PURE__*/jsxRuntime.jsx(Breadcrumbs, {
1024
+ breadcrumbs: breadcrumbs
1025
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1026
+ className: "neeto-molecules-header__page-title",
1027
+ children: /*#__PURE__*/jsxRuntime.jsxs(Typography, {
1028
+ "data-testid": "main-header",
1029
+ lineHeight: "tight",
1030
+ style: size === SIZES.nano ? "h3" : "h1",
1031
+ weight: "semibold",
1032
+ children: [title, neetoCist.isPresent(titleHelpPopoverProps) && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$5({}, titleHelpPopoverProps)), renderDropdown(function (_ref2) {
1033
+ var _ref2$dropdownButtonP = _ref2.dropdownButtonProps,
1034
+ dropdownButtonProps = _ref2$dropdownButtonP === void 0 ? {} : _ref2$dropdownButtonP,
1035
+ dropdownProps = _objectWithoutProperties(_ref2, _excluded$2);
1036
+ return /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, _objectSpread$5({
1037
+ dropdownButtonProps: _objectSpread$5({
1038
+ size: DROPDOWN_BUTTON_SIZES[size]
1039
+ }, dropdownButtonProps)
1040
+ }, dropdownProps));
1041
+ })]
1042
+ })
1043
+ })]
1044
+ })
1045
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1046
+ className: "neeto-molecules-header__right",
1047
+ children: [searchProps && /*#__PURE__*/jsxRuntime.jsx(Search, _objectSpread$5({
1048
+ enableUrlSync: true,
1049
+ className: classnames(["neeto-molecules-header__search-input", searchProps.className])
1050
+ }, searchProps)), actionBlock && /*#__PURE__*/jsxRuntime.jsx("div", {
1051
+ className: "neeto-molecules-header__action-block",
1052
+ children: actionBlock
1053
+ })]
1054
+ })]
1055
+ });
1056
+ };
1057
+
1058
+ var MobilePreviewHeader = function MobilePreviewHeader(_ref) {
1059
+ var _ref$className = _ref.className,
1060
+ className = _ref$className === void 0 ? "" : _ref$className,
1061
+ _ref$message = _ref.message,
1062
+ message = _ref$message === void 0 ? "" : _ref$message;
1063
+ var _useTranslation = reactI18next.useTranslation(),
1064
+ t = _useTranslation.t;
1065
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1066
+ className: classnames(["neeto-ui-bg-gray-200 px-6 py-5", className]),
1067
+ "data-testid": "mobile-preview-header",
1068
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
1069
+ lineHeight: "normal",
1070
+ style: "body2",
1071
+ children: message || t("neetoMolecules.mobilePreview.message")
1072
+ })
1073
+ });
1074
+ };
1075
+
1076
+ var INITIAL_FORM_VALUES = {
1077
+ sendTo: [],
1078
+ sendToId: "",
1079
+ sendToCc: [],
1080
+ sendToBcc: [],
1081
+ replyTo: "",
1082
+ showCopyEmails: false,
1083
+ subject: "",
1084
+ message: "",
1085
+ isEnabled: false
1086
+ };
1087
+ var EMAIL_FORM_VALIDATION_SCHEMA = yup__namespace.object({
1088
+ subject: yup__namespace.string().required(i18next.t("neetoMolecules.emailForm.errors.subjectRequired")),
1089
+ message: yup__namespace.string().test("message", i18next.t("neetoMolecules.emailForm.errors.messageRequired"), function (value) {
1090
+ return !utils$1.isEditorEmpty(value);
1091
+ })
1092
+ });
1093
+ var sendToFieldValidation = function sendToFieldValidation(maxEmails) {
1094
+ var validation = yup__namespace.array().test("all-emails-valid", i18next.t("neetoMolecules.emailForm.errors.invalidEmailAddress"), function (emails) {
1095
+ return emails === null || emails === void 0 ? void 0 : emails.every(ramda.prop("valid"));
1096
+ }).test("max-email-count", i18next.t("neetoMolecules.emailForm.errors.maxEmails", {
1097
+ count: maxEmails
1098
+ }), function (emails) {
1099
+ return (emails === null || emails === void 0 ? void 0 : emails.length) <= maxEmails;
1100
+ });
1101
+ return yup__namespace.object({
1102
+ sendTo: validation.min(1, i18next.t("neetoMolecules.emailForm.errors.required", {
1103
+ entity: i18next.t("neetoMolecules.emailForm.fields.sendToEmailAddress")
1104
+ })).nullable(),
1105
+ sendToCc: validation,
1106
+ sendToBcc: validation
1107
+ });
1108
+ };
1109
+ var SEND_TO_ID_FIELD_VALIDATION = yup__namespace.object({
1110
+ sendToId: yup__namespace.string().required(i18next.t("neetoMolecules.emailForm.errors.required", {
1111
+ entity: i18next.t("neetoMolecules.emailForm.labels.sendTo")
1112
+ }))
1113
+ });
1114
+ var REPLY_TO_FIELD_VALIDATION = yup__namespace.object({
1115
+ replyTo: yup__namespace.string().nullable().email(i18next.t("neetoMolecules.emailForm.errors.invalidEmailAddress")).required(i18next.t("neetoMolecules.emailForm.errors.required", {
1116
+ entity: i18next.t("neetoMolecules.emailForm.fields.replyToEmailAddress")
1117
+ }))
1118
+ });
1119
+ var EDITOR_ADDONS = ["highlight", "emoji", "code-block", "block-quote", "image-upload", "divider", "video-embed"];
1120
+
1121
+ /* eslint-disable @bigbinary/neeto/use-zustand-for-global-state-management */
1122
+ var EmailFormContext = /*#__PURE__*/React.createContext({
1123
+ showSendToField: false,
1124
+ showSendToAsRadio: false,
1125
+ showReplyToField: false,
1126
+ showCcField: false,
1127
+ showBccField: false
1128
+ });
1129
+
1130
+ 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; }
1131
+ 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; }
1132
+ var getValidationSchema = function getValidationSchema(_ref) {
1133
+ var showSendToField = _ref.showSendToField,
1134
+ showReplyToField = _ref.showReplyToField,
1135
+ showSendToAsRadio = _ref.showSendToAsRadio,
1136
+ customValidations = _ref.customValidations,
1137
+ maxEmails = _ref.maxEmails;
1138
+ var schema = EMAIL_FORM_VALIDATION_SCHEMA.clone();
1139
+ if (showSendToField) {
1140
+ schema = schema.concat(showSendToAsRadio ? SEND_TO_ID_FIELD_VALIDATION : sendToFieldValidation(maxEmails));
1141
+ }
1142
+ if (showReplyToField) schema = schema.concat(REPLY_TO_FIELD_VALIDATION);
1143
+ var isYupObject = customValidations.type === "object";
1144
+ if (isYupObject) {
1145
+ var customFields = customValidations.fields || {};
1146
+ schema = schema.shape(customFields);
1147
+ } else if (_typeof(customValidations) === "object") {
1148
+ schema = schema.shape(customValidations);
1149
+ }
1150
+ return schema;
1151
+ };
1152
+ var getReplyToFieldLabelProps = function getReplyToFieldLabelProps(_ref2) {
1153
+ var popoverProps = _ref2.popoverProps;
1154
+ return {
1155
+ helpIconProps: _defineProperty(_defineProperty(_defineProperty({}, "data-testid", "reply-to-tooltip"), "tooltipProps", !neetoCist.isPresent(popoverProps) && {
1156
+ content: i18next.t("neetoMolecules.emailForm.tooltips.replyTo"),
1157
+ touch: ["hold", 500]
1158
+ }), "popoverProps", neetoCist.isPresent(popoverProps) && _objectSpread$3(_objectSpread$3({}, popoverProps), {}, {
1159
+ appendTo: "parent",
1160
+ description: popoverProps.description || i18next.t("neetoMolecules.emailForm.tooltips.replyTo")
1161
+ }))
1162
+ };
1163
+ };
1164
+ var resolveContent = function resolveContent(content, func, variable) {
1165
+ if (typeof func === "function") {
1166
+ return func(content, variable);
1167
+ }
1168
+ return content;
1169
+ };
1170
+ var normalizeHtmlString = function normalizeHtmlString(str) {
1171
+ if (typeof str !== "string") return str;
1172
+ 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();
1173
+ };
1174
+
1175
+ var ReplyToField = function ReplyToField(_ref) {
1176
+ var _ref$options = _ref.options,
1177
+ options = _ref$options === void 0 ? [] : _ref$options,
1178
+ _ref$popoverProps = _ref.popoverProps,
1179
+ popoverProps = _ref$popoverProps === void 0 ? {} : _ref$popoverProps;
1180
+ var _useTranslation = reactI18next.useTranslation(),
1181
+ t = _useTranslation.t;
1182
+ var _useFormikContext = formik.useFormikContext(),
1183
+ setFieldValue = _useFormikContext.setFieldValue;
1184
+ var isDropdownField = neetoCist.isNotEmpty(options);
1185
+ var labelProps = getReplyToFieldLabelProps({
1186
+ popoverProps: popoverProps
1187
+ });
1188
+ if (isDropdownField) {
1189
+ return /*#__PURE__*/jsxRuntime.jsx(Select, {
1190
+ labelProps: labelProps,
1191
+ options: options,
1192
+ isClearable: true,
1193
+ className: "w-full",
1194
+ "data-testid": "reply-to-select-field",
1195
+ label: t("neetoMolecules.emailForm.labels.replyTo"),
1196
+ name: "replyTo",
1197
+ onChange: function onChange(data) {
1198
+ var _data$value;
1199
+ return setFieldValue("replyTo", (_data$value = data === null || data === void 0 ? void 0 : data.value) !== null && _data$value !== void 0 ? _data$value : "");
1200
+ }
1201
+ });
1202
+ }
1203
+ return /*#__PURE__*/jsxRuntime.jsx(Input$1, {
1204
+ labelProps: labelProps,
1205
+ autoFocus: true,
1206
+ nakedInput: true,
1207
+ required: true,
1208
+ className: "w-full",
1209
+ "data-testid": "reply-to-input-field",
1210
+ label: t("neetoMolecules.emailForm.labels.replyTo"),
1211
+ name: "replyTo",
1212
+ placeholder: t("neetoMolecules.emailForm.placeholders.emailPlaceholder"),
1213
+ size: "large",
1214
+ onChange: function onChange(event) {
1215
+ var _event$target$value;
1216
+ return setFieldValue("replyTo", (_event$target$value = event.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.toLowerCase());
1217
+ }
1218
+ });
1219
+ };
1220
+
1221
+ var SendToField = function SendToField(_ref) {
1222
+ var showBccField = _ref.showBccField,
1223
+ showCcField = _ref.showCcField,
1224
+ showSendToTextField = _ref.showSendToTextField;
1225
+ var _useTranslation = reactI18next.useTranslation(),
1226
+ t = _useTranslation.t;
1227
+ if (!showSendToTextField && !showBccField && !showCcField) return null;
1228
+ return /*#__PURE__*/jsxRuntime.jsx(SendToFields, {
1229
+ showCcBccButton: true,
1230
+ showBccField: showSendToTextField ? false : showBccField,
1231
+ showCcField: showSendToTextField ? false : showCcField,
1232
+ showSendToField: showSendToTextField,
1233
+ bccInputProps: {
1234
+ label: t("neetoMolecules.emailForm.labels.bCc"),
1235
+ name: "sendToBcc",
1236
+ placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
1237
+ },
1238
+ ccInputProps: {
1239
+ label: t("neetoMolecules.emailForm.labels.cc"),
1240
+ name: "sendToCc",
1241
+ placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
1242
+ },
1243
+ emailInputProps: {
1244
+ id: "sendTo",
1245
+ name: "sendTo",
1246
+ label: t("neetoMolecules.emailForm.labels.sendTo"),
1247
+ placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails"),
1248
+ required: true
1249
+ }
1250
+ });
1251
+ };
1252
+
1253
+ var SubjectField = function SubjectField(_ref) {
1254
+ var name = _ref.name,
1255
+ text = _ref.text,
1256
+ updateText = _ref.updateText,
1257
+ _ref$subjectVariables = _ref.subjectVariables,
1258
+ subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
1259
+ error = _ref.error,
1260
+ _ref$required = _ref.required,
1261
+ required = _ref$required === void 0 ? false : _ref$required,
1262
+ onBlur = _ref.onBlur;
1263
+ var _useState = React.useState(false),
1264
+ _useState2 = _slicedToArray(_useState, 2),
1265
+ isFieldFocusedOnce = _useState2[0],
1266
+ setIsFieldFocusedOnce = _useState2[1];
1267
+ var _useTranslation = reactI18next.useTranslation(),
1268
+ t = _useTranslation.t;
1269
+ var tagClickHandler = function tagClickHandler(_ref2) {
1270
+ var slug = _ref2.key,
1271
+ category = _ref2.category;
1272
+ var textAreaElement = document.querySelector("textarea[name=".concat(name, "]"));
1273
+ var splitIndex = isFieldFocusedOnce && textAreaElement ? textAreaElement.selectionEnd : text.length;
1274
+ var variable = category ? "".concat(category, ".").concat(slug) : slug;
1275
+ var updatedSubject = [text.slice(0, splitIndex), " {{".concat(variable, "}}"), text.slice(splitIndex)].join("");
1276
+ updateText(updatedSubject);
1277
+ };
1278
+ return /*#__PURE__*/jsxRuntime.jsx(Input, {
1279
+ error: error,
1280
+ name: name,
1281
+ onBlur: onBlur,
1282
+ required: required,
1283
+ nakedInput: true,
1284
+ label: t("neetoMolecules.emailForm.labels.subject"),
1285
+ placeholder: t("neetoMolecules.emailForm.placeholders.subject"),
1286
+ value: text,
1287
+ suffix: /*#__PURE__*/jsxRuntime.jsx(DynamicVariables, {
1288
+ buttonProps: {
1289
+ className: "m-1"
1290
+ },
1291
+ variables: subjectVariables,
1292
+ dropdownProps: {
1293
+ className: "neeto-ui-dropdown__popup overflow-y-auto",
1294
+ buttonSize: "small"
1295
+ },
1296
+ onVariableClick: tagClickHandler
1297
+ }),
1298
+ onChange: general.withEventTargetValue(updateText),
1299
+ onFocus: function onFocus() {
1300
+ return setIsFieldFocusedOnce(true);
1301
+ }
1302
+ });
1303
+ };
1304
+
1305
+ 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; }
1306
+ 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; }
1307
+ var EmailForm = function EmailForm(_ref) {
1308
+ var _ref$messageVariables = _ref.messageVariables,
1309
+ messageVariables = _ref$messageVariables === void 0 ? [] : _ref$messageVariables,
1310
+ _ref$subjectVariables = _ref.subjectVariables,
1311
+ subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
1312
+ handleCancel = _ref.handleCancel,
1313
+ handleResetToDefault = _ref.handleResetToDefault,
1314
+ isLoading = _ref.isLoading,
1315
+ replyToFieldProps = _ref.replyToFieldProps,
1316
+ sendToFieldProps = _ref.sendToFieldProps,
1317
+ replyToOptions = _ref.replyToOptions,
1318
+ _ref$sendToOptions = _ref.sendToOptions,
1319
+ sendToOptions = _ref$sendToOptions === void 0 ? [] : _ref$sendToOptions,
1320
+ _ref$isUpdating = _ref.isUpdating,
1321
+ isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating,
1322
+ _ref$isResetting = _ref.isResetting,
1323
+ isResetting = _ref$isResetting === void 0 ? false : _ref$isResetting,
1324
+ _ref$showFields = _ref.showFields,
1325
+ showFields = _ref$showFields === void 0 ? true : _ref$showFields,
1326
+ _ref$className = _ref.className,
1327
+ className = _ref$className === void 0 ? "" : _ref$className,
1328
+ _ref$editorAddons = _ref.editorAddons,
1329
+ editorAddons = _ref$editorAddons === void 0 ? EDITOR_ADDONS : _ref$editorAddons,
1330
+ showResetToDefaultButton = _ref.showResetToDefaultButton,
1331
+ _ref$editorRef = _ref.editorRef,
1332
+ editorRef = _ref$editorRef === void 0 ? null : _ref$editorRef,
1333
+ _ref$defaultValues = _ref.defaultValues,
1334
+ defaultValues = _ref$defaultValues === void 0 ? {} : _ref$defaultValues;
1335
+ var _useTranslation = reactI18next.useTranslation(),
1336
+ t = _useTranslation.t;
1337
+ var _useContext = React.useContext(EmailFormContext),
1338
+ showSendToField = _useContext.showSendToField,
1339
+ showSendToAsRadio = _useContext.showSendToAsRadio,
1340
+ showReplyToField = _useContext.showReplyToField,
1341
+ showCcField = _useContext.showCcField,
1342
+ showBccField = _useContext.showBccField;
1343
+ var _useFormikContext = formik.useFormikContext(),
1344
+ setFieldValue = _useFormikContext.setFieldValue,
1345
+ values = _useFormikContext.values,
1346
+ resetForm = _useFormikContext.resetForm;
1347
+ var normalizedValues = _objectSpread$2(_objectSpread$2({}, values), {}, {
1348
+ message: normalizeHtmlString(values.message)
1349
+ });
1350
+ var normalizedDefaultValues = _objectSpread$2(_objectSpread$2({}, defaultValues), {}, {
1351
+ message: normalizeHtmlString(defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.message)
1352
+ });
1353
+ normalizedDefaultValues.replyTo || (normalizedDefaultValues.replyTo = globalProps.user.email);
1354
+ var disabled = ramda.equals(normalizedValues, normalizedDefaultValues);
1355
+ var sendToFieldOptions = (sendToFieldProps === null || sendToFieldProps === void 0 ? void 0 : sendToFieldProps.options) || sendToOptions;
1356
+ var showSendToRadioField = showSendToField && showSendToAsRadio && neetoCist.isNotEmpty(sendToFieldOptions);
1357
+ var showSendToTextField = showSendToField && !showSendToRadioField;
1358
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1359
+ "data-testid": "email-form",
1360
+ className: classnames("neeto-notification-email-wrapper__form-container flex flex-1 flex-col items-start gap-2 !pb-0", _defineProperty({}, className, className)),
1361
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1362
+ className: "w-full grow",
1363
+ children: showFields && /*#__PURE__*/jsxRuntime.jsxs("div", {
1364
+ className: "flex w-full flex-col items-start justify-start gap-5",
1365
+ children: [showSendToRadioField && /*#__PURE__*/jsxRuntime.jsx(Radio, {
1366
+ className: "pb-2",
1367
+ "data-testid": "send-to-id",
1368
+ label: t("neetoMolecules.emailForm.labels.sendTo"),
1369
+ labelProps: {
1370
+ required: true
1371
+ },
1372
+ name: "sendToId",
1373
+ children: sendToFieldOptions.map(function (_ref2) {
1374
+ var label = _ref2.label,
1375
+ value = _ref2.value;
1376
+ return /*#__PURE__*/React.createElement(Radio.Item, {
1377
+ label: label,
1378
+ value: value,
1379
+ key: value
1380
+ });
1381
+ })
1382
+ }), /*#__PURE__*/jsxRuntime.jsx(SendToField, {
1383
+ showBccField: showBccField,
1384
+ showCcField: showCcField,
1385
+ showSendToTextField: showSendToTextField
1386
+ }), showReplyToField && /*#__PURE__*/jsxRuntime.jsx("div", {
1387
+ className: "neeto-ui-border-gray-200 w-full border-b pb-1",
1388
+ children: /*#__PURE__*/jsxRuntime.jsx(ReplyToField, _objectSpread$2({
1389
+ options: replyToOptions
1390
+ }, replyToFieldProps))
1391
+ }), /*#__PURE__*/jsxRuntime.jsx(formik.Field, {
1392
+ name: "subject",
1393
+ children: function children(_ref3) {
1394
+ var _ref3$field = _ref3.field,
1395
+ value = _ref3$field.value,
1396
+ onBlur = _ref3$field.onBlur,
1397
+ _ref3$meta = _ref3.meta,
1398
+ error = _ref3$meta.error,
1399
+ touched = _ref3$meta.touched;
1400
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1401
+ className: "neeto-notification-email-subject-block neeto-ui-border-gray-200 w-full border-b pb-1",
1402
+ children: /*#__PURE__*/jsxRuntime.jsx(SubjectField, {
1403
+ onBlur: onBlur,
1404
+ subjectVariables: subjectVariables,
1405
+ required: true,
1406
+ error: touched && error ? t(error) : undefined,
1407
+ name: "subject",
1408
+ text: value,
1409
+ updateText: function updateText(text) {
1410
+ return setFieldValue("subject", text);
1411
+ }
1412
+ })
1413
+ });
1414
+ }
1415
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1416
+ className: "neeto-notification-email-message-block w-full",
1417
+ "data-testid": "message-input-container",
1418
+ children: /*#__PURE__*/jsxRuntime.jsx(FormikEditor, {
1419
+ required: true,
1420
+ addons: editorAddons,
1421
+ "data-testid": "message-input-field",
1422
+ hideSlashCommands: false,
1423
+ id: "form_message",
1424
+ menuType: "fixed",
1425
+ name: "message",
1426
+ placeholder: t("neetoMolecules.emailForm.placeholders.message"),
1427
+ ref: editorRef,
1428
+ variables: messageVariables,
1429
+ shouldUpdate: function shouldUpdate(nextProps, prevProps) {
1430
+ return neetoCist.notEqualsDeep(nextProps.variables, prevProps.variables);
1431
+ }
1432
+ })
1433
+ })]
1434
+ })
1435
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1436
+ className: "neeto-ui-bg-white neeto-notification-email-wrapper__action-block z-10 flex w-full justify-between py-6 lg:sticky lg:bottom-0",
1437
+ children: [/*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
1438
+ cancelButtonProps: {
1439
+ onClick: handleCancel
1440
+ },
1441
+ isSubmitting: isLoading || isUpdating
1442
+ }), showResetToDefaultButton && /*#__PURE__*/jsxRuntime.jsx("div", {
1443
+ className: "neeto-ui-action-block__wrapper",
1444
+ children: /*#__PURE__*/jsxRuntime.jsx(Button, {
1445
+ disabled: disabled,
1446
+ "data-testid": "reset-to-default-button",
1447
+ label: t("neetoMolecules.emailForm.labels.resetToDefault"),
1448
+ loading: isResetting,
1449
+ style: "tertiary",
1450
+ onClick: function onClick() {
1451
+ resetForm();
1452
+ handleResetToDefault();
1453
+ }
1454
+ })
1455
+ })]
1456
+ })]
1457
+ });
1458
+ };
1459
+
1460
+ var css = ".neeto-notification-email-wrapper{height:calc(100vh - 64px);height:calc(100dvh - 64px)}.neeto-notification-email-outer-wrapper .neeto-ui-react-select__container .neeto-ui-react-select__control{border:none}.neeto-notification-email-outer-wrapper .neeto-ui-react-select__container .neeto-ui-react-select__control--is-focused{box-shadow:none!important}.neeto-notification-email-outer-wrapper .neeto-ui-react-select__container .neeto-ui-react-select__value-container{padding-left:0}.neeto-notification-email-message-block p.is-editor-empty{font-size:14px}.neeto-notification-email-subject-block .neeto-ui-input__suffix{padding:0}.neeto-molecules-email-preview-ribbon{background:#ffee6a;border-bottom-left-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;box-shadow:0 3px 4px 0 rgba(0,0,0,.149);color:#49545c;font-size:14px;font-weight:500;min-width:-moz-max-content;min-width:max-content;padding:6px 12px;position:absolute;right:-6px;text-align:center;top:-6px;z-index:10}.neeto-molecules-email-preview-ribbon:after{border-color:transparent #ddd06b;border-style:solid;border-width:0 0 12px 6px;content:\"\";left:auto;position:absolute;right:0;top:100%;z-index:-20}";
1461
+ n(css,{});
1462
+
1463
+ 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; }
1464
+ 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; }
1465
+ var EmailFormComponent = function EmailFormComponent(_ref) {
1466
+ var _ref$onSubmit = _ref.onSubmit,
1467
+ onSubmit = _ref$onSubmit === void 0 ? neetoCist.noop : _ref$onSubmit,
1468
+ _ref$initialValues = _ref.initialValues,
1469
+ initialValues = _ref$initialValues === void 0 ? INITIAL_FORM_VALUES : _ref$initialValues,
1470
+ _children = _ref.children,
1471
+ formikProps = _ref.formikProps,
1472
+ validationSchema = _ref.validationSchema,
1473
+ _ref$showSendToField = _ref.showSendToField,
1474
+ showSendToField = _ref$showSendToField === void 0 ? false : _ref$showSendToField,
1475
+ _ref$showReplyToField = _ref.showReplyToField,
1476
+ showReplyToField = _ref$showReplyToField === void 0 ? false : _ref$showReplyToField,
1477
+ _ref$showSendToAsRadi = _ref.showSendToAsRadio,
1478
+ showSendToAsRadio = _ref$showSendToAsRadi === void 0 ? false : _ref$showSendToAsRadi,
1479
+ _ref$blockNavigation = _ref.blockNavigation,
1480
+ blockNavigation = _ref$blockNavigation === void 0 ? true : _ref$blockNavigation,
1481
+ _ref$showCcField = _ref.showCcField,
1482
+ showCcField = _ref$showCcField === void 0 ? false : _ref$showCcField,
1483
+ _ref$showBccField = _ref.showBccField,
1484
+ showBccField = _ref$showBccField === void 0 ? false : _ref$showBccField,
1485
+ _ref$isLoading = _ref.isLoading,
1486
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
1487
+ _ref$maxEmails = _ref.maxEmails,
1488
+ maxEmails = _ref$maxEmails === void 0 ? 10 : _ref$maxEmails,
1489
+ _ref$emailFormProps = _ref.emailFormProps,
1490
+ emailFormProps = _ref$emailFormProps === void 0 ? {} : _ref$emailFormProps,
1491
+ _ref$emailPreviewProp = _ref.emailPreviewProps,
1492
+ emailPreviewProps = _ref$emailPreviewProp === void 0 ? {} : _ref$emailPreviewProp,
1493
+ _ref$headerProps = _ref.headerProps,
1494
+ headerProps = _ref$headerProps === void 0 ? {} : _ref$headerProps,
1495
+ _ref$tooltipProps = _ref.tooltipProps,
1496
+ tooltipProps = _ref$tooltipProps === void 0 ? {} : _ref$tooltipProps,
1497
+ _ref$switchProps = _ref.switchProps,
1498
+ switchProps = _ref$switchProps === void 0 ? {} : _ref$switchProps,
1499
+ _ref$mobilePreviewPro = _ref.mobilePreviewProps,
1500
+ mobilePreviewProps = _ref$mobilePreviewPro === void 0 ? {} : _ref$mobilePreviewPro;
1501
+ var formatBody = emailPreviewProps.formatBody,
1502
+ formatSubject = emailPreviewProps.formatSubject,
1503
+ bodyVariables = emailPreviewProps.bodyVariables,
1504
+ subjectVariables = emailPreviewProps.subjectVariables;
1505
+ var shouldShowFields = function shouldShowFields(values) {
1506
+ return ramda.isEmpty(switchProps) || values.isEnabled;
1507
+ };
1508
+ return /*#__PURE__*/jsxRuntime.jsx(EmailFormProvider, {
1509
+ formikProps: formikProps,
1510
+ initialValues: initialValues,
1511
+ maxEmails: maxEmails,
1512
+ onSubmit: onSubmit,
1513
+ showBccField: showBccField,
1514
+ showCcField: showCcField,
1515
+ showReplyToField: showReplyToField,
1516
+ showSendToAsRadio: showSendToAsRadio,
1517
+ showSendToField: showSendToField,
1518
+ validationSchema: validationSchema,
1519
+ children: function children(_ref2) {
1520
+ var _values$sendTo;
1521
+ var values = _ref2.values,
1522
+ isSubmitting = _ref2.isSubmitting;
1523
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1524
+ className: "neeto-notification-email-wrapper flex flex-grow flex-col overflow-y-auto lg:flex-row",
1525
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1526
+ className: "neeto-notification-email-wrapper__form-wrapper flex w-full flex-col px-5 md:px-10 lg:h-full lg:w-1/2 lg:overflow-y-auto",
1527
+ children: [blockNavigation && /*#__PURE__*/jsxRuntime.jsx(BlockNavigation, {}), neetoCist.isNotEmpty(headerProps) && /*#__PURE__*/jsxRuntime.jsx(Header, _objectSpread$1$1({
1528
+ className: "px-0",
1529
+ size: "small"
1530
+ }, headerProps)), neetoCist.isNotEmpty(switchProps) && /*#__PURE__*/jsxRuntime.jsx("div", {
1531
+ className: "flex items-center justify-between gap-y-0.5 pb-6",
1532
+ children: /*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread$1$1(_objectSpread$1$1({
1533
+ disabled: !(switchProps !== null && switchProps !== void 0 && switchProps.disabled),
1534
+ position: "top"
1535
+ }, tooltipProps), {}, {
1536
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
1537
+ className: "flex items-center gap-2",
1538
+ children: /*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$1$1({
1539
+ "data-testid": "switch",
1540
+ name: "isEnabled"
1541
+ }, switchProps))
1542
+ })
1543
+ }))
1544
+ }), shouldShowFields(values) && _children, /*#__PURE__*/jsxRuntime.jsx(EmailForm, _objectSpread$1$1({
1545
+ isLoading: isSubmitting || isLoading,
1546
+ isUpdating: isSubmitting || isLoading,
1547
+ showFields: shouldShowFields(values)
1548
+ }, emailFormProps))]
1549
+ }), shouldShowFields(values) && /*#__PURE__*/jsxRuntime.jsx(MobilePreviewHeader, _objectSpread$1$1({
1550
+ className: "lg:hidden"
1551
+ }, mobilePreviewProps)), shouldShowFields(values) && /*#__PURE__*/jsxRuntime.jsx("div", {
1552
+ className: "neeto-notification-email-wrapper__preview-wrapper neeto-ui-bg-gray-100 w-full px-6 py-10 lg:w-1/2 lg:overflow-y-auto",
1553
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailPreview, _objectSpread$1$1({
1554
+ body: resolveContent(values.message, formatBody, bodyVariables),
1555
+ from: values.sendFrom,
1556
+ to: ramda.pluck("value", (_values$sendTo = values === null || values === void 0 ? void 0 : values.sendTo) !== null && _values$sendTo !== void 0 ? _values$sendTo : []),
1557
+ subject: resolveContent(values.subject, formatSubject, subjectVariables)
1558
+ }, emailPreviewProps))
1559
+ })]
1560
+ });
1561
+ }
1562
+ });
1563
+ };
1564
+
1565
+ 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; }
1566
+ 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; }
1567
+ var EmailFormProvider = function EmailFormProvider(_ref) {
1568
+ var _ref$onSubmit = _ref.onSubmit,
1569
+ onSubmit = _ref$onSubmit === void 0 ? neetoCist.noop : _ref$onSubmit,
1570
+ _ref$initialValues = _ref.initialValues,
1571
+ initialValues = _ref$initialValues === void 0 ? INITIAL_FORM_VALUES : _ref$initialValues,
1572
+ children = _ref.children,
1573
+ formikProps = _ref.formikProps,
1574
+ _ref$validationSchema = _ref.validationSchema,
1575
+ customValidations = _ref$validationSchema === void 0 ? {} : _ref$validationSchema,
1576
+ _ref$showSendToField = _ref.showSendToField,
1577
+ showSendToField = _ref$showSendToField === void 0 ? false : _ref$showSendToField,
1578
+ _ref$showReplyToField = _ref.showReplyToField,
1579
+ showReplyToField = _ref$showReplyToField === void 0 ? false : _ref$showReplyToField,
1580
+ _ref$showSendToAsRadi = _ref.showSendToAsRadio,
1581
+ showSendToAsRadio = _ref$showSendToAsRadi === void 0 ? false : _ref$showSendToAsRadi,
1582
+ _ref$showCcField = _ref.showCcField,
1583
+ showCcField = _ref$showCcField === void 0 ? false : _ref$showCcField,
1584
+ _ref$showBccField = _ref.showBccField,
1585
+ showBccField = _ref$showBccField === void 0 ? false : _ref$showBccField,
1586
+ _ref$maxEmails = _ref.maxEmails,
1587
+ maxEmails = _ref$maxEmails === void 0 ? 10 : _ref$maxEmails;
1588
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1589
+ className: "neeto-notification-email-outer-wrapper",
1590
+ "data-testid": "email-form-provider",
1591
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailFormContext.Provider, {
1592
+ value: {
1593
+ showSendToField: showSendToField,
1594
+ showSendToAsRadio: showSendToAsRadio,
1595
+ showReplyToField: showReplyToField,
1596
+ showCcField: showCcField,
1597
+ showBccField: showBccField
1598
+ },
1599
+ children: /*#__PURE__*/jsxRuntime.jsx(Form, {
1600
+ className: "neeto-notification-email-inner-wrapper",
1601
+ formikProps: _objectSpread$4({
1602
+ enableReinitialize: true,
1603
+ validationSchema: getValidationSchema({
1604
+ showSendToField: showSendToField,
1605
+ showReplyToField: showReplyToField,
1606
+ showSendToAsRadio: showSendToAsRadio,
1607
+ customValidations: customValidations,
1608
+ maxEmails: maxEmails
1609
+ }),
1610
+ initialValues: _objectSpread$4(_objectSpread$4({}, initialValues), {}, {
1611
+ replyTo: initialValues.replyTo || globalProps.user.email
1612
+ }),
1613
+ onSubmit: onSubmit
1614
+ }, formikProps),
1615
+ children: children
1616
+ })
1617
+ })
89
1618
  });
90
1619
  };
91
1620
 
@@ -103,7 +1632,7 @@ var DEFAULT_FIELDS_VISIBILITY = {
103
1632
  var _excluded$1 = ["notifyEmails", "notifyCcEmails", "notifyBccEmails", "replyToId", "customFields"],
104
1633
  _excluded2 = ["id", "isEnabled", "sendTo", "sendToCc", "sendToBcc", "showCopyEmails", "replyTo", "message", "subject", "sendFrom", "sendToId"];
105
1634
  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; }
106
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1635
+ 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; }
107
1636
  var isValidEmail = function isValidEmail(email) {
108
1637
  return yup.string().email().isValidSync(email);
109
1638
  };
@@ -200,7 +1729,7 @@ var generateDefaultValues = function generateDefaultValues(data) {
200
1729
 
201
1730
  var _excluded = ["validationSchema"];
202
1731
  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; }
203
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1732
+ 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; }
204
1733
  var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
205
1734
  var _emailFormProps$sendT, _emailFormProps$sendT2;
206
1735
  var _ref$emailNotificatio = _ref.emailNotificationParams,
@@ -230,17 +1759,17 @@ var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
230
1759
  _ref$onSuccess = _ref.onSuccess,
231
1760
  onSuccess = _ref$onSuccess === void 0 ? neetoCist.noop : _ref$onSuccess,
232
1761
  children = _ref.children;
233
- var editorRef = react.useRef();
1762
+ var editorRef = React.useRef();
234
1763
  var _useTranslation = reactI18next.useTranslation(),
235
1764
  t = _useTranslation.t;
236
- var _useFetchEmailNotific = useFetchEmailNotifications(emailNotificationParams),
1765
+ var _useFetchEmailNotific = emailNotificationApi.useFetchEmailNotifications(emailNotificationParams),
237
1766
  _useFetchEmailNotific2 = _useFetchEmailNotific.data,
238
1767
  data = _useFetchEmailNotific2 === void 0 ? {} : _useFetchEmailNotific2,
239
1768
  isLoading = _useFetchEmailNotific.isLoading;
240
- var _useUpdateEmailNotifi = useUpdateEmailNotification(),
1769
+ var _useUpdateEmailNotifi = emailNotificationApi.useUpdateEmailNotification(),
241
1770
  updateEmailNotification = _useUpdateEmailNotifi.mutate,
242
1771
  isSubmitting = _useUpdateEmailNotifi.isPending;
243
- var _useResetEmailNotific = useResetEmailNotificationToDefault(),
1772
+ var _useResetEmailNotific = emailNotificationApi.useResetEmailNotificationToDefault(),
244
1773
  resetToDefault = _useResetEmailNotific.mutate,
245
1774
  isResetting = _useResetEmailNotific.isPending;
246
1775
  var handleSubmit = function handleSubmit(values) {
@@ -276,7 +1805,7 @@ var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
276
1805
  };
277
1806
  return /*#__PURE__*/jsxRuntime.jsx("div", {
278
1807
  className: "min-w-0 grow overflow-y-auto",
279
- children: /*#__PURE__*/jsxRuntime.jsx(EmailForm, _objectSpread(_objectSpread({}, _objectSpread({
1808
+ children: /*#__PURE__*/jsxRuntime.jsx(EmailFormComponent, _objectSpread(_objectSpread({}, _objectSpread({
280
1809
  blockNavigation: blockNavigation,
281
1810
  emailPreviewProps: emailPreviewProps,
282
1811
  formikProps: formikProps,