@bigbinary/neeto-email-notifications-frontend 2.2.7 → 2.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-email-notifications-frontend",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "description": "A repo acts as the source of truth for the new nano's structure, configs, data etc.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/bigbinary/neeto-email-notifications-nano",
@@ -61,14 +61,9 @@
61
61
  "@babel/preset-typescript": "7.26.0",
62
62
  "@babel/runtime": "7.26.0",
63
63
  "@bigbinary/babel-preset-neeto": "^1.0.3",
64
- "@bigbinary/eslint-plugin-neeto": "1.5.6",
65
- "@bigbinary/neeto-cist": "1.0.14",
66
- "@bigbinary/neeto-commons-frontend": "4.13.14",
67
- "@bigbinary/neeto-editor": "1.45.0",
68
- "@bigbinary/neeto-filters-frontend": "4.3.13",
69
- "@bigbinary/neeto-icons": "1.20.23",
70
- "@bigbinary/neeto-molecules": "3.15.6",
71
- "@bigbinary/neetoui": "8.2.54",
64
+ "@bigbinary/eslint-plugin-neeto": "1.5.7",
65
+ "@bigbinary/neeto-cist": "1.0.15",
66
+ "@bigbinary/neeto-filters-frontend": "4.3.15",
72
67
  "@emotion/is-prop-valid": "1.2.0",
73
68
  "@faker-js/faker": "8.2.0",
74
69
  "@honeybadger-io/js": "6.10.1",
@@ -175,13 +170,8 @@
175
170
  },
176
171
  "peerDependencies": {
177
172
  "@babel/runtime": "7.26.0",
178
- "@bigbinary/neeto-cist": "1.0.14",
179
- "@bigbinary/neeto-commons-frontend": "4.13.14",
180
- "@bigbinary/neeto-editor": "1.45.0",
181
- "@bigbinary/neeto-filters-frontend": "4.3.13",
182
- "@bigbinary/neeto-icons": "1.20.23",
183
- "@bigbinary/neeto-molecules": "3.15.6",
184
- "@bigbinary/neetoui": "8.2.54",
173
+ "@bigbinary/neeto-cist": "1.0.15",
174
+ "@bigbinary/neeto-filters-frontend": "4.3.15",
185
175
  "@honeybadger-io/js": "6.10.1",
186
176
  "@honeybadger-io/react": "6.1.25",
187
177
  "@tailwindcss/container-queries": "^0.1.1",
@@ -225,8 +215,9 @@
225
215
  "string-width": "4.1.0"
226
216
  },
227
217
  "engines": {
228
- "node": ">=18.12",
218
+ "node": ">=22.13",
229
219
  "npm": ">=9",
230
220
  "yarn": ">=1.22"
231
- }
221
+ },
222
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
232
223
  }
@@ -1,295 +0,0 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import classNames from 'classnames';
3
- import { isNotEmpty, isNotPresent, noop } from '@bigbinary/neeto-cist';
4
- import { EmailFormProvider, EmailForm, EmailPreview } from '@bigbinary/neeto-molecules/EmailForm';
5
- import MobilePreviewHeader from '@bigbinary/neeto-molecules/MobilePreviewHeader';
6
- import Spinner from '@bigbinary/neetoui/Spinner';
7
- import Tooltip from '@bigbinary/neetoui/Tooltip';
8
- import Typography from '@bigbinary/neetoui/Typography';
9
- import BlockNavigation from '@bigbinary/neetoui/formik/BlockNavigation';
10
- import Switch from '@bigbinary/neetoui/formik/Switch';
11
- import { prop, mergeLeft, isEmpty, mergeDeepLeft, pluck } from 'ramda';
12
- import { useTranslation } from 'react-i18next';
13
- import { useQuery } from '@tanstack/react-query';
14
- import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
15
- import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
16
- import axios from 'axios';
17
- import * as yup from 'yup';
18
- import { string } from 'yup';
19
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
20
- import { jsx, jsxs } from 'react/jsx-runtime';
21
-
22
- var EMAIL_NOTIFICATIONS_URL = "neeto_email_notifications/email_notification";
23
-
24
- var fetch = function fetch(params) {
25
- return axios.get(EMAIL_NOTIFICATIONS_URL, {
26
- params: params
27
- });
28
- };
29
- var update = function update(payload) {
30
- return axios.put(EMAIL_NOTIFICATIONS_URL, payload);
31
- };
32
- var emailNotificationsApi = {
33
- fetch: fetch,
34
- update: update
35
- };
36
-
37
- var QUERY_KEYS = {
38
- NEETO_EMAIL_NOTIFICATIONS: "neeto-email-notifications"
39
- };
40
-
41
- var useFetchEmailNotifications = function useFetchEmailNotifications(params) {
42
- return useQuery({
43
- queryKey: [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, params["notificationHolderId"], params["customFields"]],
44
- queryFn: function queryFn() {
45
- return emailNotificationsApi.fetch(params);
46
- },
47
- staleTime: DEFAULT_STALE_TIME,
48
- select: prop("emailNotification"),
49
- enabled: isNotEmpty(params)
50
- });
51
- };
52
- var useUpdateEmailNotification = function useUpdateEmailNotification() {
53
- return useMutationWithInvalidation(function (params) {
54
- return emailNotificationsApi.update(params);
55
- }, {
56
- keysToInvalidate: [function (_, _ref) {
57
- var notificationHolderId = _ref.notificationHolderId;
58
- return [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, notificationHolderId];
59
- }]
60
- });
61
- };
62
-
63
- var FORM_VALIDATION_SCHEMA = {
64
- isEnabled: yup["boolean"]()
65
- };
66
-
67
- var _excluded = ["notifyEmails", "notifyCcEmails", "notifyBccEmails", "replyToId", "customFields"],
68
- _excluded2 = ["id", "isEnabled", "sendTo", "sendToCc", "sendToBcc", "showCopyEmails", "replyTo", "message", "subject", "sendFrom", "disabledByUser", "sendToId"];
69
- 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; }
70
- 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; }
71
- var isValidEmail = function isValidEmail(email) {
72
- return string().email().isValidSync(email);
73
- };
74
- var createEmailOptions = function createEmailOptions() {
75
- var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
76
- return emails.map(function (email) {
77
- return {
78
- label: email,
79
- value: email,
80
- valid: isValidEmail(email)
81
- };
82
- });
83
- };
84
- var parseEmailsOptions = function parseEmailsOptions() {
85
- var emailOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
86
- return emailOptions.map(prop("label"));
87
- };
88
- var parseEmailNotificationData = function parseEmailNotificationData(data, sendToOptions) {
89
- var _sendToOptions$;
90
- var notifyEmails = data.notifyEmails,
91
- notifyCcEmails = data.notifyCcEmails,
92
- notifyBccEmails = data.notifyBccEmails,
93
- replyToId = data.replyToId,
94
- customFields = data.customFields,
95
- rest = _objectWithoutProperties(data, _excluded);
96
- var parsed = _objectSpread$1(_objectSpread$1({}, customFields), rest);
97
- parsed.sendTo = notifyEmails ? createEmailOptions(notifyEmails) : [];
98
- parsed.sendToCc = notifyCcEmails ? createEmailOptions(notifyCcEmails) : [];
99
- parsed.sendToBcc = notifyCcEmails ? createEmailOptions(notifyBccEmails) : [];
100
- parsed.replyTo = replyToId || customFields["replyTo"];
101
- parsed.sendToId = customFields["sendToId"] || (sendToOptions === null || sendToOptions === void 0 || (_sendToOptions$ = sendToOptions[0]) === null || _sendToOptions$ === void 0 ? void 0 : _sendToOptions$.value) || "";
102
- parsed.showCopyEmails = !!(notifyCcEmails !== null && notifyCcEmails !== void 0 && notifyCcEmails.length || notifyBccEmails !== null && notifyBccEmails !== void 0 && notifyBccEmails.length);
103
- return parsed;
104
- };
105
- var packEmailPayload = function packEmailPayload(values, isReplyToDropdownField) {
106
- values.id;
107
- var isEnabled = values.isEnabled,
108
- sendTo = values.sendTo,
109
- sendToCc = values.sendToCc,
110
- sendToBcc = values.sendToBcc,
111
- showCopyEmails = values.showCopyEmails,
112
- replyTo = values.replyTo,
113
- message = values.message,
114
- subject = values.subject,
115
- sendFrom = values.sendFrom,
116
- disabledByUser = values.disabledByUser,
117
- sendToId = values.sendToId,
118
- rest = _objectWithoutProperties(values, _excluded2);
119
- var payload = {
120
- isEnabled: isEnabled
121
- };
122
- if (isEnabled) {
123
- payload = _objectSpread$1({}, payload);
124
- payload.notifyEmails = parseEmailsOptions(sendTo);
125
- payload.notifyBccEmails = showCopyEmails ? parseEmailsOptions(sendToBcc) : [];
126
- payload.notifyCcEmails = showCopyEmails ? parseEmailsOptions(sendToCc) : [];
127
- if (isReplyToDropdownField) {
128
- payload.replyToId = replyTo;
129
- } else {
130
- rest.replyTo = replyTo;
131
- }
132
- payload.message = message;
133
- payload.subject = subject;
134
- payload.customFields = _objectSpread$1(_objectSpread$1({}, rest), {}, {
135
- disabledByUser: false
136
- });
137
- if (isNotEmpty(sendToId)) {
138
- payload.customFields = mergeLeft(payload.customFields, {
139
- sendToId: sendToId
140
- });
141
- }
142
- payload.sendFrom = sendFrom;
143
- } else {
144
- payload.customFields = {
145
- disabledByUser: disabledByUser
146
- };
147
- }
148
- return payload;
149
- };
150
- var renderText = function renderText(text, fallbackTranslation) {
151
- return isEmpty(text) ? fallbackTranslation : text;
152
- };
153
-
154
- 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; }
155
- 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; }
156
- var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
157
- var _emailFormProps$sendT;
158
- var _ref$emailNotificatio = _ref.emailNotificationParams,
159
- emailNotificationParams = _ref$emailNotificatio === void 0 ? {} : _ref$emailNotificatio,
160
- _ref$emailPreviewProp = _ref.emailPreviewProps,
161
- emailPreviewProps = _ref$emailPreviewProp === void 0 ? {} : _ref$emailPreviewProp,
162
- _ref$emailFormProps = _ref.emailFormProps,
163
- emailFormProps = _ref$emailFormProps === void 0 ? {} : _ref$emailFormProps,
164
- _ref$emailFormikProps = _ref.emailFormikProps,
165
- emailFormikProps = _ref$emailFormikProps === void 0 ? {} : _ref$emailFormikProps,
166
- _ref$title = _ref.title,
167
- title = _ref$title === void 0 ? "" : _ref$title,
168
- _ref$subTitle = _ref.subTitle,
169
- subTitle = _ref$subTitle === void 0 ? "" : _ref$subTitle,
170
- _ref$disabled = _ref.disabled,
171
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
172
- _ref$tooltipProps = _ref.tooltipProps,
173
- tooltipProps = _ref$tooltipProps === void 0 ? {} : _ref$tooltipProps,
174
- _ref$onSuccess = _ref.onSuccess,
175
- onSuccess = _ref$onSuccess === void 0 ? noop : _ref$onSuccess,
176
- _ref$blockNavigation = _ref.blockNavigation,
177
- blockNavigation = _ref$blockNavigation === void 0 ? false : _ref$blockNavigation,
178
- _children = _ref.children;
179
- var _useTranslation = useTranslation(),
180
- t = _useTranslation.t;
181
- var _useFetchEmailNotific = useFetchEmailNotifications(emailNotificationParams),
182
- _useFetchEmailNotific2 = _useFetchEmailNotific.data,
183
- data = _useFetchEmailNotific2 === void 0 ? {} : _useFetchEmailNotific2,
184
- isLoading = _useFetchEmailNotific.isLoading;
185
- var _useUpdateEmailNotifi = useUpdateEmailNotification(),
186
- updateEmailNotification = _useUpdateEmailNotifi.mutate,
187
- isSubmitting = _useUpdateEmailNotifi.isPending;
188
- var handleSubmit = function handleSubmit(values) {
189
- var _emailFormProps$reply;
190
- var isReplyToDropdownField = (emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$reply = emailFormProps.replyToFieldProps) === null || _emailFormProps$reply === void 0 ? void 0 : _emailFormProps$reply.options) !== undefined;
191
- var body = mergeDeepLeft(packEmailPayload(values, isReplyToDropdownField), emailNotificationParams);
192
- updateEmailNotification(body, {
193
- onSuccess: onSuccess
194
- });
195
- };
196
- var handleSwitchChange = function handleSwitchChange(_ref2) {
197
- var _event$target, _event$target2;
198
- var event = _ref2.event,
199
- values = _ref2.values,
200
- setFieldValue = _ref2.setFieldValue;
201
- if ((event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.checked) === true) {
202
- setFieldValue("isEnabled", true);
203
- } else if ((event === null || event === void 0 || (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.checked) === false) {
204
- if ((values === null || values === void 0 ? void 0 : values.isEnabled) === true) setFieldValue("disabledByUser", true);
205
- setFieldValue("isEnabled", false);
206
- }
207
- };
208
- if (isLoading || isNotPresent(data)) {
209
- return /*#__PURE__*/jsx("div", {
210
- className: "flex h-full w-full items-center justify-center",
211
- children: /*#__PURE__*/jsx(Spinner, {})
212
- });
213
- }
214
- return /*#__PURE__*/jsx("div", {
215
- className: "min-w-0 flex-grow",
216
- children: /*#__PURE__*/jsx(EmailFormProvider, _objectSpread(_objectSpread({
217
- showSendToField: true,
218
- formikProps: {
219
- validateOnBlur: true,
220
- validateOnChange: true
221
- },
222
- validationSchema: FORM_VALIDATION_SCHEMA,
223
- initialValues: parseEmailNotificationData(data, (emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$sendT = emailFormProps.sendToFieldProps) === null || _emailFormProps$sendT === void 0 ? void 0 : _emailFormProps$sendT.options) || (emailFormProps === null || emailFormProps === void 0 ? void 0 : emailFormProps.sendToOptions)),
224
- onSubmit: handleSubmit
225
- }, emailFormikProps), {}, {
226
- children: function children(_ref3) {
227
- var values = _ref3.values,
228
- setFieldValue = _ref3.setFieldValue;
229
- return /*#__PURE__*/jsxs("div", {
230
- className: "nf-email-notification-wrapper flex h-full flex-grow flex-col lg:flex-row",
231
- children: [/*#__PURE__*/jsxs("div", {
232
- className: "flex w-full flex-col px-5 py-6 pb-0 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10",
233
- children: [blockNavigation && /*#__PURE__*/jsx(BlockNavigation, {}), /*#__PURE__*/jsx("div", {
234
- className: "flex items-center justify-between gap-6",
235
- children: /*#__PURE__*/jsxs("div", {
236
- className: "space-y-0.5",
237
- children: [/*#__PURE__*/jsx(Tooltip, _objectSpread(_objectSpread({
238
- disabled: !disabled,
239
- position: "top"
240
- }, tooltipProps), {}, {
241
- children: /*#__PURE__*/jsxs("div", {
242
- className: "flex items-center gap-2",
243
- children: [/*#__PURE__*/jsx(Switch, {
244
- disabled: disabled,
245
- "data-cy": "receive-email-notification-switch",
246
- name: "isEnabled",
247
- onChange: function onChange(event) {
248
- return handleSwitchChange({
249
- event: event,
250
- setFieldValue: setFieldValue,
251
- values: values
252
- });
253
- }
254
- }), /*#__PURE__*/jsx(Typography, {
255
- component: "span",
256
- "data-cy": "receive-email-notification-label",
257
- lineHeight: "normal",
258
- style: "h3",
259
- weight: "semibold",
260
- children: renderText(title, t("neetoEmailNotifications.emailNotification.title"))
261
- })]
262
- })
263
- })), /*#__PURE__*/jsx(Typography, {
264
- lineHeight: "normal",
265
- style: "body2",
266
- children: renderText(subTitle, t("neetoEmailNotifications.emailNotification.subTitle"))
267
- })]
268
- })
269
- }), values.isEnabled && _children, /*#__PURE__*/jsx(EmailForm, _objectSpread({
270
- showSendToField: true,
271
- className: classNames({
272
- "pt-3 ": values.isEnabled
273
- }),
274
- isLoading: isSubmitting,
275
- showFields: values.isEnabled
276
- }, emailFormProps))]
277
- }), /*#__PURE__*/jsx(MobilePreviewHeader, {
278
- className: "lg:hidden"
279
- }), values.isEnabled && /*#__PURE__*/jsx("div", {
280
- className: "neeto-ui-bg-gray-100 w-full px-5 py-6 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10",
281
- children: /*#__PURE__*/jsx(EmailPreview, _objectSpread({
282
- body: values.message,
283
- from: values.sendFrom,
284
- subject: values.subject,
285
- to: pluck("value", values.sendTo)
286
- }, emailPreviewProps))
287
- })]
288
- });
289
- }
290
- }))
291
- });
292
- };
293
-
294
- export { NeetoEmailNotificationForm as default };
295
- //# sourceMappingURL=NeetoEmailNotificationForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NeetoEmailNotificationForm.js","sources":["../app/javascript/src/constants/index.js","../app/javascript/src/apis/email_notifications.js","../app/javascript/src/constants/query.js","../app/javascript/src/hooks/reactQuery/emailNotificationApi.js","../app/javascript/src/components/EmailNotificationForm/constants.js","../app/javascript/src/components/EmailNotificationForm/utils.js","../app/javascript/src/components/EmailNotificationForm/index.jsx"],"sourcesContent":["export const EMAIL_NOTIFICATIONS_URL =\n \"neeto_email_notifications/email_notification\";\n","import axios from \"axios\";\n\nimport { EMAIL_NOTIFICATIONS_URL } from \"src/constants\";\n\nconst fetch = params => axios.get(EMAIL_NOTIFICATIONS_URL, { params });\n\nconst update = payload => axios.put(EMAIL_NOTIFICATIONS_URL, payload);\n\nconst emailNotificationsApi = { fetch, update };\n\nexport default emailNotificationsApi;\n","export const QUERY_KEYS = {\n NEETO_EMAIL_NOTIFICATIONS: \"neeto-email-notifications\",\n};\n","import { useQuery } from \"@tanstack/react-query\";\nimport { isNotEmpty } from \"neetocist\";\nimport { DEFAULT_STALE_TIME } from \"neetocommons/constants\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\nimport { prop } from \"ramda\";\n\nimport emailNotificationsApi from \"src/apis/email_notifications\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchEmailNotifications = params =>\n useQuery({\n queryKey: [\n QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS,\n params[\"notificationHolderId\"],\n params[\"customFields\"],\n ],\n queryFn: () => emailNotificationsApi.fetch(params),\n staleTime: DEFAULT_STALE_TIME,\n select: prop(\"emailNotification\"),\n enabled: isNotEmpty(params),\n });\n\nexport const useUpdateEmailNotification = () =>\n useMutationWithInvalidation(params => emailNotificationsApi.update(params), {\n keysToInvalidate: [\n (_, { notificationHolderId }) => [\n QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS,\n notificationHolderId,\n ],\n ],\n });\n","import * as yup from \"yup\";\n\nexport const FORM_VALIDATION_SCHEMA = { isEnabled: yup.boolean() };\n","import { isNotEmpty } from \"neetocist\";\nimport { isEmpty, mergeLeft, prop } from \"ramda\";\nimport { string } from \"yup\";\n\nconst isValidEmail = email => string().email().isValidSync(email);\n\nconst createEmailOptions = (emails = []) =>\n emails.map(email => ({\n label: email,\n value: email,\n valid: isValidEmail(email),\n }));\n\nexport const parseEmailsOptions = (emailOptions = []) =>\n emailOptions.map(prop(\"label\"));\n\nexport const parseEmailNotificationData = (data, sendToOptions) => {\n const {\n notifyEmails,\n notifyCcEmails,\n notifyBccEmails,\n replyToId,\n customFields,\n ...rest\n } = data;\n\n const parsed = { ...customFields, ...rest };\n parsed.sendTo = notifyEmails ? createEmailOptions(notifyEmails) : [];\n parsed.sendToCc = notifyCcEmails ? createEmailOptions(notifyCcEmails) : [];\n parsed.sendToBcc = notifyCcEmails ? createEmailOptions(notifyBccEmails) : [];\n parsed.replyTo = replyToId || customFields[\"replyTo\"];\n parsed.sendToId = customFields[\"sendToId\"] || sendToOptions?.[0]?.value || \"\";\n parsed.showCopyEmails = !!(notifyCcEmails?.length || notifyBccEmails?.length);\n\n return parsed;\n};\n\nexport const packEmailPayload = (values, isReplyToDropdownField) => {\n const {\n // eslint-disable-next-line no-unused-vars\n id: _,\n isEnabled,\n sendTo,\n sendToCc,\n sendToBcc,\n showCopyEmails,\n replyTo,\n message,\n subject,\n sendFrom,\n disabledByUser,\n sendToId,\n ...rest\n } = values;\n let payload = { isEnabled };\n\n if (isEnabled) {\n payload = { ...payload };\n payload.notifyEmails = parseEmailsOptions(sendTo);\n payload.notifyBccEmails = showCopyEmails\n ? parseEmailsOptions(sendToBcc)\n : [];\n\n payload.notifyCcEmails = showCopyEmails ? parseEmailsOptions(sendToCc) : [];\n if (isReplyToDropdownField) {\n payload.replyToId = replyTo;\n } else {\n rest.replyTo = replyTo;\n }\n payload.message = message;\n payload.subject = subject;\n payload.customFields = { ...rest, disabledByUser: false };\n\n if (isNotEmpty(sendToId)) {\n payload.customFields = mergeLeft(payload.customFields, { sendToId });\n }\n payload.sendFrom = sendFrom;\n } else {\n payload.customFields = { disabledByUser };\n }\n\n return payload;\n};\n\nexport const renderText = (text, fallbackTranslation) =>\n isEmpty(text) ? fallbackTranslation : text;\n","import classNames from \"classnames\";\nimport { isNotPresent, noop } from \"neetocist\";\nimport {\n EmailFormProvider,\n EmailForm,\n EmailPreview,\n} from \"neetomolecules/EmailForm\";\nimport MobilePreviewHeader from \"neetomolecules/MobilePreviewHeader\";\nimport { Spinner, Tooltip, Typography } from \"neetoui\";\nimport { BlockNavigation, Switch } from \"neetoui/formik\";\nimport { mergeDeepLeft, pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchEmailNotifications,\n useUpdateEmailNotification,\n} from \"src/hooks/reactQuery/emailNotificationApi\";\n\nimport { FORM_VALIDATION_SCHEMA } from \"./constants\";\nimport {\n packEmailPayload,\n parseEmailNotificationData,\n renderText,\n} from \"./utils\";\n\nconst NeetoEmailNotificationForm = ({\n emailNotificationParams = {},\n emailPreviewProps = {},\n emailFormProps = {},\n emailFormikProps = {},\n title = \"\",\n subTitle = \"\",\n disabled = false,\n tooltipProps = {},\n onSuccess = noop,\n blockNavigation = false,\n children,\n}) => {\n const { t } = useTranslation();\n\n const { data = {}, isLoading } = useFetchEmailNotifications(\n emailNotificationParams\n );\n\n const { mutate: updateEmailNotification, isPending: isSubmitting } =\n useUpdateEmailNotification();\n\n const handleSubmit = values => {\n const isReplyToDropdownField =\n emailFormProps?.replyToFieldProps?.options !== undefined;\n\n const body = mergeDeepLeft(\n packEmailPayload(values, isReplyToDropdownField),\n emailNotificationParams\n );\n updateEmailNotification(body, { onSuccess });\n };\n\n const handleSwitchChange = ({ event, values, setFieldValue }) => {\n if (event?.target?.checked === true) {\n setFieldValue(\"isEnabled\", true);\n } else if (event?.target?.checked === false) {\n if (values?.isEnabled === true) setFieldValue(\"disabledByUser\", true);\n setFieldValue(\"isEnabled\", false);\n }\n };\n\n if (isLoading || isNotPresent(data)) {\n return (\n <div className=\"flex h-full w-full items-center justify-center\">\n <Spinner />\n </div>\n );\n }\n\n return (\n <div className=\"min-w-0 flex-grow\">\n <EmailFormProvider\n showSendToField\n formikProps={{ validateOnBlur: true, validateOnChange: true }}\n validationSchema={FORM_VALIDATION_SCHEMA}\n initialValues={parseEmailNotificationData(\n data,\n emailFormProps?.sendToFieldProps?.options ||\n emailFormProps?.sendToOptions\n )}\n onSubmit={handleSubmit}\n {...emailFormikProps}\n >\n {({ values, setFieldValue }) => (\n <div className=\"nf-email-notification-wrapper flex h-full flex-grow flex-col lg:flex-row\">\n <div className=\"flex w-full flex-col px-5 py-6 pb-0 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10\">\n {blockNavigation && <BlockNavigation />}\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"space-y-0.5\">\n <Tooltip\n disabled={!disabled}\n position=\"top\"\n {...tooltipProps}\n >\n <div className=\"flex items-center gap-2\">\n <Switch\n {...{ disabled }}\n data-cy=\"receive-email-notification-switch\"\n name=\"isEnabled\"\n onChange={event =>\n handleSwitchChange({ event, setFieldValue, values })\n }\n />\n <Typography\n component=\"span\"\n data-cy=\"receive-email-notification-label\"\n lineHeight=\"normal\"\n style=\"h3\"\n weight=\"semibold\"\n >\n {renderText(\n title,\n t(\"neetoEmailNotifications.emailNotification.title\")\n )}\n </Typography>\n </div>\n </Tooltip>\n <Typography lineHeight=\"normal\" style=\"body2\">\n {renderText(\n subTitle,\n t(\"neetoEmailNotifications.emailNotification.subTitle\")\n )}\n </Typography>\n </div>\n </div>\n {values.isEnabled && children}\n <EmailForm\n showSendToField\n className={classNames({ \"pt-3 \": values.isEnabled })}\n isLoading={isSubmitting}\n showFields={values.isEnabled}\n {...emailFormProps}\n />\n </div>\n <MobilePreviewHeader className=\"lg:hidden\" />\n {values.isEnabled && (\n <div className=\"neeto-ui-bg-gray-100 w-full px-5 py-6 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10\">\n <EmailPreview\n body={values.message}\n from={values.sendFrom}\n subject={values.subject}\n to={pluck(\"value\", values.sendTo)}\n {...emailPreviewProps}\n />\n </div>\n )}\n </div>\n )}\n </EmailFormProvider>\n </div>\n );\n};\nexport default NeetoEmailNotificationForm;\n"],"names":["EMAIL_NOTIFICATIONS_URL","fetch","params","axios","get","update","payload","put","emailNotificationsApi","QUERY_KEYS","NEETO_EMAIL_NOTIFICATIONS","useFetchEmailNotifications","useQuery","queryKey","queryFn","staleTime","DEFAULT_STALE_TIME","select","prop","enabled","isNotEmpty","useUpdateEmailNotification","useMutationWithInvalidation","keysToInvalidate","_","_ref","notificationHolderId","FORM_VALIDATION_SCHEMA","isEnabled","yup","isValidEmail","email","string","isValidSync","createEmailOptions","emails","arguments","length","undefined","map","label","value","valid","parseEmailsOptions","emailOptions","parseEmailNotificationData","data","sendToOptions","_sendToOptions$","notifyEmails","notifyCcEmails","notifyBccEmails","replyToId","customFields","rest","_objectWithoutProperties","_excluded","parsed","_objectSpread","sendTo","sendToCc","sendToBcc","replyTo","sendToId","showCopyEmails","packEmailPayload","values","isReplyToDropdownField","id","message","subject","sendFrom","disabledByUser","_excluded2","mergeLeft","renderText","text","fallbackTranslation","isEmpty","NeetoEmailNotificationForm","_emailFormProps$sendT","_ref$emailNotificatio","emailNotificationParams","_ref$emailPreviewProp","emailPreviewProps","_ref$emailFormProps","emailFormProps","_ref$emailFormikProps","emailFormikProps","_ref$title","title","_ref$subTitle","subTitle","_ref$disabled","disabled","_ref$tooltipProps","tooltipProps","_ref$onSuccess","onSuccess","noop","_ref$blockNavigation","blockNavigation","children","_useTranslation","useTranslation","t","_useFetchEmailNotific","_useFetchEmailNotific2","isLoading","_useUpdateEmailNotifi","updateEmailNotification","mutate","isSubmitting","isPending","handleSubmit","_emailFormProps$reply","replyToFieldProps","options","body","mergeDeepLeft","handleSwitchChange","_ref2","_event$target","_event$target2","event","setFieldValue","target","checked","isNotPresent","_jsx","className","Spinner","EmailFormProvider","showSendToField","formikProps","validateOnBlur","validateOnChange","validationSchema","initialValues","sendToFieldProps","onSubmit","_ref3","_jsxs","BlockNavigation","Tooltip","position","Switch","name","onChange","Typography","component","lineHeight","style","weight","EmailForm","classNames","showFields","MobilePreviewHeader","EmailPreview","from","to","pluck"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,uBAAuB,GAClC,8CAA8C;;ACGhD,IAAMC,KAAK,GAAG,SAARA,KAAKA,CAAGC,MAAM,EAAA;AAAA,EAAA,OAAIC,KAAK,CAACC,GAAG,CAACJ,uBAAuB,EAAE;AAAEE,IAAAA,MAAM,EAANA;AAAO,GAAC,CAAC;AAAA,CAAA;AAEtE,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAGC,OAAO,EAAA;AAAA,EAAA,OAAIH,KAAK,CAACI,GAAG,CAACP,uBAAuB,EAAEM,OAAO,CAAC;AAAA,CAAA;AAErE,IAAME,qBAAqB,GAAG;AAAEP,EAAAA,KAAK,EAALA,KAAK;AAAEI,EAAAA,MAAM,EAANA;AAAO,CAAC;;ACRxC,IAAMI,UAAU,GAAG;AACxBC,EAAAA,yBAAyB,EAAE;AAC7B,CAAC;;ACOM,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAGT,MAAM,EAAA;AAAA,EAAA,OAC9CU,QAAQ,CAAC;AACPC,IAAAA,Q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S,CAAC;eACV;AAAC,aACH,CAAC,EACLvC,MAAM,CAACtC,SAAS,IAAI0E,SAAQ,eAC7B2B,GAAA,CAACyB,SAAS,EAAAhG,aAAA,CAAA;cACR2E,eAAe,EAAA,IAAA;cACfH,SAAS,EAAEyB,UAAU,CAAC;gBAAE,OAAO,EAAEzF,MAAM,CAACtC;AAAU,eAAC,CAAE;AACrDgF,cAAAA,SAAS,EAAEI,YAAa;cACxB4C,UAAU,EAAE1F,MAAM,CAACtC;aACf0D,EAAAA,cAAc,CACnB,CAAC;AAAA,WACC,CAAC,eACN2C,GAAA,CAAC4B,mBAAmB,EAAA;AAAC3B,YAAAA,SAAS,EAAC;AAAW,WAAE,CAAC,EAC5ChE,MAAM,CAACtC,SAAS,iBACfqG,GAAA,CAAA,KAAA,EAAA;AAAKC,YAAAA,SAAS,EAAC,sFAAsF;AAAA5B,YAAAA,QAAA,eACnG2B,GAAA,CAAC6B,YAAY,EAAApG,aAAA,CAAA;cACX4D,IAAI,EAAEpD,MAAM,CAACG,OAAQ;cACrB0F,IAAI,EAAE7F,MAAM,CAACK,QAAS;cACtBD,OAAO,EAAEJ,MAAM,CAACI,OAAQ;AACxB0F,cAAAA,EAAE,EAAEC,KAAK,CAAC,OAAO,EAAE/F,MAAM,CAACP,MAAM;AAAE,aAAA,EAC9ByB,iBAAiB,CACtB;AAAC,WACC,CACN;AAAA,SACE,CAAC;AAAA;KAES,CAAA;AAAC,GACjB,CAAC;AAEV;;;;"}
@@ -1,315 +0,0 @@
1
- 'use strict';
2
-
3
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- var classNames = require('classnames');
5
- var neetoCist = require('@bigbinary/neeto-cist');
6
- var EmailForm = require('@bigbinary/neeto-molecules/EmailForm');
7
- var MobilePreviewHeader = require('@bigbinary/neeto-molecules/MobilePreviewHeader');
8
- var Spinner = require('@bigbinary/neetoui/Spinner');
9
- var Tooltip = require('@bigbinary/neetoui/Tooltip');
10
- var Typography = require('@bigbinary/neetoui/Typography');
11
- var BlockNavigation = require('@bigbinary/neetoui/formik/BlockNavigation');
12
- var Switch = require('@bigbinary/neetoui/formik/Switch');
13
- var ramda = require('ramda');
14
- var reactI18next = require('react-i18next');
15
- var reactQuery = require('@tanstack/react-query');
16
- var constants = require('@bigbinary/neeto-commons-frontend/constants');
17
- var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
18
- var axios = require('axios');
19
- var yup = require('yup');
20
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
21
- var jsxRuntime = require('react/jsx-runtime');
22
-
23
- function _interopNamespaceDefault(e) {
24
- var n = Object.create(null);
25
- if (e) {
26
- Object.keys(e).forEach(function (k) {
27
- if (k !== 'default') {
28
- var d = Object.getOwnPropertyDescriptor(e, k);
29
- Object.defineProperty(n, k, d.get ? d : {
30
- enumerable: true,
31
- get: function () { return e[k]; }
32
- });
33
- }
34
- });
35
- }
36
- n.default = e;
37
- return Object.freeze(n);
38
- }
39
-
40
- var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
41
-
42
- var EMAIL_NOTIFICATIONS_URL = "neeto_email_notifications/email_notification";
43
-
44
- var fetch = function fetch(params) {
45
- return axios.get(EMAIL_NOTIFICATIONS_URL, {
46
- params: params
47
- });
48
- };
49
- var update = function update(payload) {
50
- return axios.put(EMAIL_NOTIFICATIONS_URL, payload);
51
- };
52
- var emailNotificationsApi = {
53
- fetch: fetch,
54
- update: update
55
- };
56
-
57
- var QUERY_KEYS = {
58
- NEETO_EMAIL_NOTIFICATIONS: "neeto-email-notifications"
59
- };
60
-
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);
66
- },
67
- staleTime: constants.DEFAULT_STALE_TIME,
68
- select: ramda.prop("emailNotification"),
69
- enabled: neetoCist.isNotEmpty(params)
70
- });
71
- };
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
- }]
80
- });
81
- };
82
-
83
- var FORM_VALIDATION_SCHEMA = {
84
- isEnabled: yup__namespace["boolean"]()
85
- };
86
-
87
- var _excluded = ["notifyEmails", "notifyCcEmails", "notifyBccEmails", "replyToId", "customFields"],
88
- _excluded2 = ["id", "isEnabled", "sendTo", "sendToCc", "sendToBcc", "showCopyEmails", "replyTo", "message", "subject", "sendFrom", "disabledByUser", "sendToId"];
89
- 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; }
90
- 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; }
91
- var isValidEmail = function isValidEmail(email) {
92
- return yup.string().email().isValidSync(email);
93
- };
94
- var createEmailOptions = function createEmailOptions() {
95
- var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
96
- return emails.map(function (email) {
97
- return {
98
- label: email,
99
- value: email,
100
- valid: isValidEmail(email)
101
- };
102
- });
103
- };
104
- var parseEmailsOptions = function parseEmailsOptions() {
105
- var emailOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
106
- return emailOptions.map(ramda.prop("label"));
107
- };
108
- var parseEmailNotificationData = function parseEmailNotificationData(data, sendToOptions) {
109
- var _sendToOptions$;
110
- var notifyEmails = data.notifyEmails,
111
- notifyCcEmails = data.notifyCcEmails,
112
- notifyBccEmails = data.notifyBccEmails,
113
- replyToId = data.replyToId,
114
- customFields = data.customFields,
115
- rest = _objectWithoutProperties(data, _excluded);
116
- var parsed = _objectSpread$1(_objectSpread$1({}, customFields), rest);
117
- parsed.sendTo = notifyEmails ? createEmailOptions(notifyEmails) : [];
118
- parsed.sendToCc = notifyCcEmails ? createEmailOptions(notifyCcEmails) : [];
119
- parsed.sendToBcc = notifyCcEmails ? createEmailOptions(notifyBccEmails) : [];
120
- parsed.replyTo = replyToId || customFields["replyTo"];
121
- parsed.sendToId = customFields["sendToId"] || (sendToOptions === null || sendToOptions === void 0 || (_sendToOptions$ = sendToOptions[0]) === null || _sendToOptions$ === void 0 ? void 0 : _sendToOptions$.value) || "";
122
- parsed.showCopyEmails = !!(notifyCcEmails !== null && notifyCcEmails !== void 0 && notifyCcEmails.length || notifyBccEmails !== null && notifyBccEmails !== void 0 && notifyBccEmails.length);
123
- return parsed;
124
- };
125
- var packEmailPayload = function packEmailPayload(values, isReplyToDropdownField) {
126
- values.id;
127
- var isEnabled = values.isEnabled,
128
- sendTo = values.sendTo,
129
- sendToCc = values.sendToCc,
130
- sendToBcc = values.sendToBcc,
131
- showCopyEmails = values.showCopyEmails,
132
- replyTo = values.replyTo,
133
- message = values.message,
134
- subject = values.subject,
135
- sendFrom = values.sendFrom,
136
- disabledByUser = values.disabledByUser,
137
- sendToId = values.sendToId,
138
- rest = _objectWithoutProperties(values, _excluded2);
139
- var payload = {
140
- isEnabled: isEnabled
141
- };
142
- if (isEnabled) {
143
- payload = _objectSpread$1({}, payload);
144
- payload.notifyEmails = parseEmailsOptions(sendTo);
145
- payload.notifyBccEmails = showCopyEmails ? parseEmailsOptions(sendToBcc) : [];
146
- payload.notifyCcEmails = showCopyEmails ? parseEmailsOptions(sendToCc) : [];
147
- if (isReplyToDropdownField) {
148
- payload.replyToId = replyTo;
149
- } else {
150
- rest.replyTo = replyTo;
151
- }
152
- payload.message = message;
153
- payload.subject = subject;
154
- payload.customFields = _objectSpread$1(_objectSpread$1({}, rest), {}, {
155
- disabledByUser: false
156
- });
157
- if (neetoCist.isNotEmpty(sendToId)) {
158
- payload.customFields = ramda.mergeLeft(payload.customFields, {
159
- sendToId: sendToId
160
- });
161
- }
162
- payload.sendFrom = sendFrom;
163
- } else {
164
- payload.customFields = {
165
- disabledByUser: disabledByUser
166
- };
167
- }
168
- return payload;
169
- };
170
- var renderText = function renderText(text, fallbackTranslation) {
171
- return ramda.isEmpty(text) ? fallbackTranslation : text;
172
- };
173
-
174
- 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; }
175
- 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; }
176
- var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
177
- var _emailFormProps$sendT;
178
- var _ref$emailNotificatio = _ref.emailNotificationParams,
179
- emailNotificationParams = _ref$emailNotificatio === void 0 ? {} : _ref$emailNotificatio,
180
- _ref$emailPreviewProp = _ref.emailPreviewProps,
181
- emailPreviewProps = _ref$emailPreviewProp === void 0 ? {} : _ref$emailPreviewProp,
182
- _ref$emailFormProps = _ref.emailFormProps,
183
- emailFormProps = _ref$emailFormProps === void 0 ? {} : _ref$emailFormProps,
184
- _ref$emailFormikProps = _ref.emailFormikProps,
185
- emailFormikProps = _ref$emailFormikProps === void 0 ? {} : _ref$emailFormikProps,
186
- _ref$title = _ref.title,
187
- title = _ref$title === void 0 ? "" : _ref$title,
188
- _ref$subTitle = _ref.subTitle,
189
- subTitle = _ref$subTitle === void 0 ? "" : _ref$subTitle,
190
- _ref$disabled = _ref.disabled,
191
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
192
- _ref$tooltipProps = _ref.tooltipProps,
193
- tooltipProps = _ref$tooltipProps === void 0 ? {} : _ref$tooltipProps,
194
- _ref$onSuccess = _ref.onSuccess,
195
- onSuccess = _ref$onSuccess === void 0 ? neetoCist.noop : _ref$onSuccess,
196
- _ref$blockNavigation = _ref.blockNavigation,
197
- blockNavigation = _ref$blockNavigation === void 0 ? false : _ref$blockNavigation,
198
- _children = _ref.children;
199
- var _useTranslation = reactI18next.useTranslation(),
200
- t = _useTranslation.t;
201
- var _useFetchEmailNotific = useFetchEmailNotifications(emailNotificationParams),
202
- _useFetchEmailNotific2 = _useFetchEmailNotific.data,
203
- data = _useFetchEmailNotific2 === void 0 ? {} : _useFetchEmailNotific2,
204
- isLoading = _useFetchEmailNotific.isLoading;
205
- var _useUpdateEmailNotifi = useUpdateEmailNotification(),
206
- updateEmailNotification = _useUpdateEmailNotifi.mutate,
207
- isSubmitting = _useUpdateEmailNotifi.isPending;
208
- var handleSubmit = function handleSubmit(values) {
209
- var _emailFormProps$reply;
210
- var isReplyToDropdownField = (emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$reply = emailFormProps.replyToFieldProps) === null || _emailFormProps$reply === void 0 ? void 0 : _emailFormProps$reply.options) !== undefined;
211
- var body = ramda.mergeDeepLeft(packEmailPayload(values, isReplyToDropdownField), emailNotificationParams);
212
- updateEmailNotification(body, {
213
- onSuccess: onSuccess
214
- });
215
- };
216
- var handleSwitchChange = function handleSwitchChange(_ref2) {
217
- var _event$target, _event$target2;
218
- var event = _ref2.event,
219
- values = _ref2.values,
220
- setFieldValue = _ref2.setFieldValue;
221
- if ((event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.checked) === true) {
222
- setFieldValue("isEnabled", true);
223
- } else if ((event === null || event === void 0 || (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.checked) === false) {
224
- if ((values === null || values === void 0 ? void 0 : values.isEnabled) === true) setFieldValue("disabledByUser", true);
225
- setFieldValue("isEnabled", false);
226
- }
227
- };
228
- if (isLoading || neetoCist.isNotPresent(data)) {
229
- return /*#__PURE__*/jsxRuntime.jsx("div", {
230
- className: "flex h-full w-full items-center justify-center",
231
- children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
232
- });
233
- }
234
- return /*#__PURE__*/jsxRuntime.jsx("div", {
235
- className: "min-w-0 flex-grow",
236
- children: /*#__PURE__*/jsxRuntime.jsx(EmailForm.EmailFormProvider, _objectSpread(_objectSpread({
237
- showSendToField: true,
238
- formikProps: {
239
- validateOnBlur: true,
240
- validateOnChange: true
241
- },
242
- validationSchema: FORM_VALIDATION_SCHEMA,
243
- initialValues: parseEmailNotificationData(data, (emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$sendT = emailFormProps.sendToFieldProps) === null || _emailFormProps$sendT === void 0 ? void 0 : _emailFormProps$sendT.options) || (emailFormProps === null || emailFormProps === void 0 ? void 0 : emailFormProps.sendToOptions)),
244
- onSubmit: handleSubmit
245
- }, emailFormikProps), {}, {
246
- children: function children(_ref3) {
247
- var values = _ref3.values,
248
- setFieldValue = _ref3.setFieldValue;
249
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
250
- className: "nf-email-notification-wrapper flex h-full flex-grow flex-col lg:flex-row",
251
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
252
- className: "flex w-full flex-col px-5 py-6 pb-0 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10",
253
- children: [blockNavigation && /*#__PURE__*/jsxRuntime.jsx(BlockNavigation, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
254
- className: "flex items-center justify-between gap-6",
255
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
256
- className: "space-y-0.5",
257
- children: [/*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread(_objectSpread({
258
- disabled: !disabled,
259
- position: "top"
260
- }, tooltipProps), {}, {
261
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
262
- className: "flex items-center gap-2",
263
- children: [/*#__PURE__*/jsxRuntime.jsx(Switch, {
264
- disabled: disabled,
265
- "data-cy": "receive-email-notification-switch",
266
- name: "isEnabled",
267
- onChange: function onChange(event) {
268
- return handleSwitchChange({
269
- event: event,
270
- setFieldValue: setFieldValue,
271
- values: values
272
- });
273
- }
274
- }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
275
- component: "span",
276
- "data-cy": "receive-email-notification-label",
277
- lineHeight: "normal",
278
- style: "h3",
279
- weight: "semibold",
280
- children: renderText(title, t("neetoEmailNotifications.emailNotification.title"))
281
- })]
282
- })
283
- })), /*#__PURE__*/jsxRuntime.jsx(Typography, {
284
- lineHeight: "normal",
285
- style: "body2",
286
- children: renderText(subTitle, t("neetoEmailNotifications.emailNotification.subTitle"))
287
- })]
288
- })
289
- }), values.isEnabled && _children, /*#__PURE__*/jsxRuntime.jsx(EmailForm.EmailForm, _objectSpread({
290
- showSendToField: true,
291
- className: classNames({
292
- "pt-3 ": values.isEnabled
293
- }),
294
- isLoading: isSubmitting,
295
- showFields: values.isEnabled
296
- }, emailFormProps))]
297
- }), /*#__PURE__*/jsxRuntime.jsx(MobilePreviewHeader, {
298
- className: "lg:hidden"
299
- }), values.isEnabled && /*#__PURE__*/jsxRuntime.jsx("div", {
300
- className: "neeto-ui-bg-gray-100 w-full px-5 py-6 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10",
301
- children: /*#__PURE__*/jsxRuntime.jsx(EmailForm.EmailPreview, _objectSpread({
302
- body: values.message,
303
- from: values.sendFrom,
304
- subject: values.subject,
305
- to: ramda.pluck("value", values.sendTo)
306
- }, emailPreviewProps))
307
- })]
308
- });
309
- }
310
- }))
311
- });
312
- };
313
-
314
- module.exports = NeetoEmailNotificationForm;
315
- //# sourceMappingURL=NeetoEmailNotificationForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NeetoEmailNotificationForm.js","sources":["../../app/javascript/src/constants/index.js","../../app/javascript/src/apis/email_notifications.js","../../app/javascript/src/constants/query.js","../../app/javascript/src/hooks/reactQuery/emailNotificationApi.js","../../app/javascript/src/components/EmailNotificationForm/constants.js","../../app/javascript/src/components/EmailNotificationForm/utils.js","../../app/javascript/src/components/EmailNotificationForm/index.jsx"],"sourcesContent":["export const EMAIL_NOTIFICATIONS_URL =\n \"neeto_email_notifications/email_notification\";\n","import axios from \"axios\";\n\nimport { EMAIL_NOTIFICATIONS_URL } from \"src/constants\";\n\nconst fetch = params => axios.get(EMAIL_NOTIFICATIONS_URL, { params });\n\nconst update = payload => axios.put(EMAIL_NOTIFICATIONS_URL, payload);\n\nconst emailNotificationsApi = { fetch, update };\n\nexport default emailNotificationsApi;\n","export const QUERY_KEYS = {\n NEETO_EMAIL_NOTIFICATIONS: \"neeto-email-notifications\",\n};\n","import { useQuery } from \"@tanstack/react-query\";\nimport { isNotEmpty } from \"neetocist\";\nimport { DEFAULT_STALE_TIME } from \"neetocommons/constants\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\nimport { prop } from \"ramda\";\n\nimport emailNotificationsApi from \"src/apis/email_notifications\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useFetchEmailNotifications = params =>\n useQuery({\n queryKey: [\n QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS,\n params[\"notificationHolderId\"],\n params[\"customFields\"],\n ],\n queryFn: () => emailNotificationsApi.fetch(params),\n staleTime: DEFAULT_STALE_TIME,\n select: prop(\"emailNotification\"),\n enabled: isNotEmpty(params),\n });\n\nexport const useUpdateEmailNotification = () =>\n useMutationWithInvalidation(params => emailNotificationsApi.update(params), {\n keysToInvalidate: [\n (_, { notificationHolderId }) => [\n QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS,\n notificationHolderId,\n ],\n ],\n });\n","import * as yup from \"yup\";\n\nexport const FORM_VALIDATION_SCHEMA = { isEnabled: yup.boolean() };\n","import { isNotEmpty } from \"neetocist\";\nimport { isEmpty, mergeLeft, prop } from \"ramda\";\nimport { string } from \"yup\";\n\nconst isValidEmail = email => string().email().isValidSync(email);\n\nconst createEmailOptions = (emails = []) =>\n emails.map(email => ({\n label: email,\n value: email,\n valid: isValidEmail(email),\n }));\n\nexport const parseEmailsOptions = (emailOptions = []) =>\n emailOptions.map(prop(\"label\"));\n\nexport const parseEmailNotificationData = (data, sendToOptions) => {\n const {\n notifyEmails,\n notifyCcEmails,\n notifyBccEmails,\n replyToId,\n customFields,\n ...rest\n } = data;\n\n const parsed = { ...customFields, ...rest };\n parsed.sendTo = notifyEmails ? createEmailOptions(notifyEmails) : [];\n parsed.sendToCc = notifyCcEmails ? createEmailOptions(notifyCcEmails) : [];\n parsed.sendToBcc = notifyCcEmails ? createEmailOptions(notifyBccEmails) : [];\n parsed.replyTo = replyToId || customFields[\"replyTo\"];\n parsed.sendToId = customFields[\"sendToId\"] || sendToOptions?.[0]?.value || \"\";\n parsed.showCopyEmails = !!(notifyCcEmails?.length || notifyBccEmails?.length);\n\n return parsed;\n};\n\nexport const packEmailPayload = (values, isReplyToDropdownField) => {\n const {\n // eslint-disable-next-line no-unused-vars\n id: _,\n isEnabled,\n sendTo,\n sendToCc,\n sendToBcc,\n showCopyEmails,\n replyTo,\n message,\n subject,\n sendFrom,\n disabledByUser,\n sendToId,\n ...rest\n } = values;\n let payload = { isEnabled };\n\n if (isEnabled) {\n payload = { ...payload };\n payload.notifyEmails = parseEmailsOptions(sendTo);\n payload.notifyBccEmails = showCopyEmails\n ? parseEmailsOptions(sendToBcc)\n : [];\n\n payload.notifyCcEmails = showCopyEmails ? parseEmailsOptions(sendToCc) : [];\n if (isReplyToDropdownField) {\n payload.replyToId = replyTo;\n } else {\n rest.replyTo = replyTo;\n }\n payload.message = message;\n payload.subject = subject;\n payload.customFields = { ...rest, disabledByUser: false };\n\n if (isNotEmpty(sendToId)) {\n payload.customFields = mergeLeft(payload.customFields, { sendToId });\n }\n payload.sendFrom = sendFrom;\n } else {\n payload.customFields = { disabledByUser };\n }\n\n return payload;\n};\n\nexport const renderText = (text, fallbackTranslation) =>\n isEmpty(text) ? fallbackTranslation : text;\n","import classNames from \"classnames\";\nimport { isNotPresent, noop } from \"neetocist\";\nimport {\n EmailFormProvider,\n EmailForm,\n EmailPreview,\n} from \"neetomolecules/EmailForm\";\nimport MobilePreviewHeader from \"neetomolecules/MobilePreviewHeader\";\nimport { Spinner, Tooltip, Typography } from \"neetoui\";\nimport { BlockNavigation, Switch } from \"neetoui/formik\";\nimport { mergeDeepLeft, pluck } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchEmailNotifications,\n useUpdateEmailNotification,\n} from \"src/hooks/reactQuery/emailNotificationApi\";\n\nimport { FORM_VALIDATION_SCHEMA } from \"./constants\";\nimport {\n packEmailPayload,\n parseEmailNotificationData,\n renderText,\n} from \"./utils\";\n\nconst NeetoEmailNotificationForm = ({\n emailNotificationParams = {},\n emailPreviewProps = {},\n emailFormProps = {},\n emailFormikProps = {},\n title = \"\",\n subTitle = \"\",\n disabled = false,\n tooltipProps = {},\n onSuccess = noop,\n blockNavigation = false,\n children,\n}) => {\n const { t } = useTranslation();\n\n const { data = {}, isLoading } = useFetchEmailNotifications(\n emailNotificationParams\n );\n\n const { mutate: updateEmailNotification, isPending: isSubmitting } =\n useUpdateEmailNotification();\n\n const handleSubmit = values => {\n const isReplyToDropdownField =\n emailFormProps?.replyToFieldProps?.options !== undefined;\n\n const body = mergeDeepLeft(\n packEmailPayload(values, isReplyToDropdownField),\n emailNotificationParams\n );\n updateEmailNotification(body, { onSuccess });\n };\n\n const handleSwitchChange = ({ event, values, setFieldValue }) => {\n if (event?.target?.checked === true) {\n setFieldValue(\"isEnabled\", true);\n } else if (event?.target?.checked === false) {\n if (values?.isEnabled === true) setFieldValue(\"disabledByUser\", true);\n setFieldValue(\"isEnabled\", false);\n }\n };\n\n if (isLoading || isNotPresent(data)) {\n return (\n <div className=\"flex h-full w-full items-center justify-center\">\n <Spinner />\n </div>\n );\n }\n\n return (\n <div className=\"min-w-0 flex-grow\">\n <EmailFormProvider\n showSendToField\n formikProps={{ validateOnBlur: true, validateOnChange: true }}\n validationSchema={FORM_VALIDATION_SCHEMA}\n initialValues={parseEmailNotificationData(\n data,\n emailFormProps?.sendToFieldProps?.options ||\n emailFormProps?.sendToOptions\n )}\n onSubmit={handleSubmit}\n {...emailFormikProps}\n >\n {({ values, setFieldValue }) => (\n <div className=\"nf-email-notification-wrapper flex h-full flex-grow flex-col lg:flex-row\">\n <div className=\"flex w-full flex-col px-5 py-6 pb-0 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10\">\n {blockNavigation && <BlockNavigation />}\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"space-y-0.5\">\n <Tooltip\n disabled={!disabled}\n position=\"top\"\n {...tooltipProps}\n >\n <div className=\"flex items-center gap-2\">\n <Switch\n {...{ disabled }}\n data-cy=\"receive-email-notification-switch\"\n name=\"isEnabled\"\n onChange={event =>\n handleSwitchChange({ event, setFieldValue, values })\n }\n />\n <Typography\n component=\"span\"\n data-cy=\"receive-email-notification-label\"\n lineHeight=\"normal\"\n style=\"h3\"\n weight=\"semibold\"\n >\n {renderText(\n title,\n t(\"neetoEmailNotifications.emailNotification.title\")\n )}\n </Typography>\n </div>\n </Tooltip>\n <Typography lineHeight=\"normal\" style=\"body2\">\n {renderText(\n subTitle,\n t(\"neetoEmailNotifications.emailNotification.subTitle\")\n )}\n </Typography>\n </div>\n </div>\n {values.isEnabled && children}\n <EmailForm\n showSendToField\n className={classNames({ \"pt-3 \": values.isEnabled })}\n isLoading={isSubmitting}\n showFields={values.isEnabled}\n {...emailFormProps}\n />\n </div>\n <MobilePreviewHeader className=\"lg:hidden\" />\n {values.isEnabled && (\n <div className=\"neeto-ui-bg-gray-100 w-full px-5 py-6 lg:h-full lg:w-1/2 lg:overflow-y-auto lg:px-10\">\n <EmailPreview\n body={values.message}\n from={values.sendFrom}\n subject={values.subject}\n to={pluck(\"value\", values.sendTo)}\n {...emailPreviewProps}\n />\n </div>\n )}\n </div>\n )}\n </EmailFormProvider>\n </div>\n );\n};\nexport default NeetoEmailNotificationForm;\n"],"names":["EMAIL_NOTIFICATIONS_URL","fetch","params","axios","get","update","payload","put","emailNotificationsApi","QUERY_KEYS","NEETO_EMAIL_NOTIFICATIONS","useFetchEmailNotifications","useQuery","queryKey","queryFn","staleTime","DEFAULT_STALE_TIME","select","prop","enabled","isNotEmpty","useUpdateEmailNotification","useMutationWithInvalidation","keysToInvalidate","_","_ref","notificationHolderId","FORM_VALIDATION_SCHEMA","isEnabled","yup","isValidEmail","email","string","isValidSync","createEmailOptions","emails","arguments","length","undefined","map","label","value","valid","parseEmailsOptions","emailOptions","parseEmailNotificationData","data","sendToOptions","_sendToOptions$","notifyEmails","notifyCcEmails","notifyBccEmails","replyToId","customFields","rest","_objectWithoutProperties","_excluded","parsed","_objectSpread","sendTo","sendToCc","sendToBcc","replyTo","sendToId","showCopyEmails","packEmailPayload","values","isReplyToDropdownField","id","message","subject","sendFrom","disabledByUser","_excluded2","mergeLeft","renderText","text","fallbackTranslation","isEmpty","NeetoEmailNotificationForm","_emailFormProps$sendT","_ref$emailNotificatio","emailNotificationParams","_ref$emailPreviewProp","emailPreviewProps","_ref$emailFormProps","emailFormProps","_ref$emailFormikProps","emailFormikProps","_ref$title","title","_ref$subTitle","subTitle","_ref$disabled","disabled","_ref$tooltipProps","tooltipProps","_ref$onSuccess","onSuccess","noop","_ref$blockNavigation","blockNavigation","children","_useTranslation","useTranslation","t","_useFetchEmailNotific","_useFetchEmailNotific2","isLoading","_useUpdateEmailNotifi","updateEmailNotification","mutate","isSubmitting","isPending","handleSubmit","_emailFormProps$reply","replyToFieldProps","options","body","mergeDeepLeft","handleSwitchChange","_ref2","_event$target","_event$target2","event","setFieldValue","target","checked","isNotPresent","_jsx","className","Spinner","EmailFormProvider","showSendToField","formikProps","validateOnBlur","validateOnChange","validationSchema","initialValues","sendToFieldProps","onSubmit","_ref3","_jsxs","BlockNavigation","Tooltip","position","Switch","name","onChange","Typography","component","lineHeight","style","weight","EmailForm","classNames","showFields","MobilePreviewHeader","EmailPreview","from","to","pluck"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,uBAAuB,GAClC,8CAA8C;;ACGhD,IAAMC,KAAK,GAAG,SAARA,KAAKA,CAAGC,MAAM,EAAA;AAAA,EAAA,OAAIC,KAAK,CAACC,GAAG,CAACJ,uBAAuB,EAAE;AAAEE,IAAAA,MAAM,EAANA;AAAO,GAAC,CAAC;AAAA,CAAA;AAEtE,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAGC,OAAO,EAAA;AAAA,EAAA,OAAIH,KAAK,CAACI,GAAG,CAACP,uBAAuB,EAAEM,OAAO,CAAC;AAAA,CAAA;AAErE,IAAME,qBAAqB,GAAG;AAAEP,EAAAA,KAAK,EAALA,KAAK;AAAEI,EAAAA,MAAM,EAANA;AAAO,CAAC;;ACRxC,IAAMI,UAAU,GAAG;AACxBC,EAAAA,yBAAyB,EAAE;AAC7B,CAAC;;ACOM,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAGT,MAAM,EAAA;AAAA,EAAA,OAC9CU,mBAAQ,CAAC;AACPC,IAAAA,QAAQ,EAAE,CACRJ,UAAU,CAACC,yBAAyB,EACpCR,MAAM,CAAC,sBAAsB,CAAC,EAC9BA,MAAM,CAAC,cAAc,CAAC,CACvB;IACDY,OAAO,EAAE,SAATA,OAAOA,GAAA;AAAA,MAAA,OAAQN,qBAAqB,CAACP,KAAK,CAACC,MAAM,CAAC;AAAA,KAAA;AAClDa,IAAAA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,CAAE;AACrDgF,cAAAA,SAAS,EAAEI,YAAa;cACxB4C,UAAU,EAAE1F,MAAM,CAACtC;aACf0D,EAAAA,cAAc,CACnB,CAAC;AAAA,WACC,CAAC,eACN2C,cAAA,CAAC4B,mBAAmB,EAAA;AAAC3B,YAAAA,SAAS,EAAC;AAAW,WAAE,CAAC,EAC5ChE,MAAM,CAACtC,SAAS,iBACfqG,cAAA,CAAA,KAAA,EAAA;AAAKC,YAAAA,SAAS,EAAC,sFAAsF;AAAA5B,YAAAA,QAAA,eACnG2B,cAAA,CAAC6B,sBAAY,EAAApG,aAAA,CAAA;cACX4D,IAAI,EAAEpD,MAAM,CAACG,OAAQ;cACrB0F,IAAI,EAAE7F,MAAM,CAACK,QAAS;cACtBD,OAAO,EAAEJ,MAAM,CAACI,OAAQ;AACxB0F,cAAAA,EAAE,EAAEC,WAAK,CAAC,OAAO,EAAE/F,MAAM,CAACP,MAAM;AAAE,aAAA,EAC9ByB,iBAAiB,CACtB;AAAC,WACC,CACN;AAAA,SACE,CAAC;AAAA;KAES,CAAA;AAAC,GACjB,CAAC;AAEV;;;;"}
package/dist/cjs/index.js DELETED
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- var NeetoEmailNotificationForm = require('./NeetoEmailNotificationForm.js');
4
- require('@babel/runtime/helpers/defineProperty');
5
- require('classnames');
6
- require('@bigbinary/neeto-cist');
7
- require('@bigbinary/neeto-molecules/EmailForm');
8
- require('@bigbinary/neeto-molecules/MobilePreviewHeader');
9
- require('@bigbinary/neetoui/Spinner');
10
- require('@bigbinary/neetoui/Tooltip');
11
- require('@bigbinary/neetoui/Typography');
12
- require('@bigbinary/neetoui/formik/BlockNavigation');
13
- require('@bigbinary/neetoui/formik/Switch');
14
- require('ramda');
15
- require('react-i18next');
16
- require('@tanstack/react-query');
17
- require('@bigbinary/neeto-commons-frontend/constants');
18
- require('@bigbinary/neeto-commons-frontend/react-utils');
19
- require('axios');
20
- require('yup');
21
- require('@babel/runtime/helpers/objectWithoutProperties');
22
- require('react/jsx-runtime');
23
-
24
-
25
-
26
- exports.NeetoEmailNotificationForm = NeetoEmailNotificationForm;
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js DELETED
@@ -1,21 +0,0 @@
1
- export { default as NeetoEmailNotificationForm } from './NeetoEmailNotificationForm.js';
2
- import '@babel/runtime/helpers/defineProperty';
3
- import 'classnames';
4
- import '@bigbinary/neeto-cist';
5
- import '@bigbinary/neeto-molecules/EmailForm';
6
- import '@bigbinary/neeto-molecules/MobilePreviewHeader';
7
- import '@bigbinary/neetoui/Spinner';
8
- import '@bigbinary/neetoui/Tooltip';
9
- import '@bigbinary/neetoui/Typography';
10
- import '@bigbinary/neetoui/formik/BlockNavigation';
11
- import '@bigbinary/neetoui/formik/Switch';
12
- import 'ramda';
13
- import 'react-i18next';
14
- import '@tanstack/react-query';
15
- import '@bigbinary/neeto-commons-frontend/constants';
16
- import '@bigbinary/neeto-commons-frontend/react-utils';
17
- import 'axios';
18
- import 'yup';
19
- import '@babel/runtime/helpers/objectWithoutProperties';
20
- import 'react/jsx-runtime';
21
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}