@bigbinary/neeto-email-notifications-frontend 2.2.22 → 2.2.24
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/README.md +2 -2
- package/dist/.ready +1 -0
- package/dist/NeetoEmailNotificationForm.js +8 -62
- package/dist/NeetoEmailNotificationForm.js.map +1 -1
- package/dist/cjs/NeetoEmailNotificationForm.js +10 -64
- package/dist/cjs/NeetoEmailNotificationForm.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/NeetoEmailNotificationForm.js +257 -0
- package/dist/cjs/v2/NeetoEmailNotificationForm.js.map +1 -0
- package/dist/cjs/v2/index.js +23 -0
- package/dist/cjs/v2/index.js.map +1 -0
- package/dist/emailNotificationApi-234PRG05.js +64 -0
- package/dist/emailNotificationApi-234PRG05.js.map +1 -0
- package/dist/emailNotificationApi-BVsGH7CY.js +68 -0
- package/dist/emailNotificationApi-BVsGH7CY.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/v2/NeetoEmailNotificationForm.js +237 -0
- package/dist/v2/NeetoEmailNotificationForm.js.map +1 -0
- package/dist/v2/index.js +17 -0
- package/dist/v2/index.js.map +1 -0
- package/package.json +46 -35
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
7
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
8
|
+
var EmailForm = require('@bigbinary/neeto-molecules/v2/EmailForm');
|
|
9
|
+
var ramda = require('ramda');
|
|
10
|
+
var reactI18next = require('react-i18next');
|
|
11
|
+
var emailNotificationApi = require('../../emailNotificationApi-BVsGH7CY.js');
|
|
12
|
+
var yup = require('yup');
|
|
13
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
14
|
+
require('@tanstack/react-query');
|
|
15
|
+
require('@bigbinary/neeto-commons-frontend/constants');
|
|
16
|
+
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
17
|
+
require('axios');
|
|
18
|
+
|
|
19
|
+
function _interopNamespaceDefault(e) {
|
|
20
|
+
var n = Object.create(null);
|
|
21
|
+
if (e) {
|
|
22
|
+
Object.keys(e).forEach(function (k) {
|
|
23
|
+
if (k !== 'default') {
|
|
24
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return e[k]; }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
n.default = e;
|
|
33
|
+
return Object.freeze(n);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
|
|
37
|
+
|
|
38
|
+
var FORM_VALIDATION_SCHEMA = {
|
|
39
|
+
isEnabled: yup__namespace["boolean"]()
|
|
40
|
+
};
|
|
41
|
+
var DEFAULT_FIELDS_VISIBILITY = {
|
|
42
|
+
showSendToField: true,
|
|
43
|
+
showReplyToField: false,
|
|
44
|
+
showSendToAsRadio: false,
|
|
45
|
+
showBccField: false,
|
|
46
|
+
showCcField: false
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var _excluded$1 = ["notifyEmails", "notifyCcEmails", "notifyBccEmails", "replyToId", "customFields"],
|
|
50
|
+
_excluded2 = ["id", "isEnabled", "sendTo", "sendToCc", "sendToBcc", "showCopyEmails", "replyTo", "message", "subject", "sendFrom", "sendToId"];
|
|
51
|
+
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; }
|
|
52
|
+
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; }
|
|
53
|
+
var isValidEmail = function isValidEmail(email) {
|
|
54
|
+
return yup.string().email().isValidSync(email);
|
|
55
|
+
};
|
|
56
|
+
var createEmailOptions = function createEmailOptions() {
|
|
57
|
+
var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
58
|
+
return emails.map(function (email) {
|
|
59
|
+
return {
|
|
60
|
+
label: email,
|
|
61
|
+
value: email,
|
|
62
|
+
valid: isValidEmail(email)
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
var parseEmailsOptions = function parseEmailsOptions() {
|
|
67
|
+
var emailOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
68
|
+
return emailOptions.map(ramda.prop("label"));
|
|
69
|
+
};
|
|
70
|
+
var parseEmailNotificationData = function parseEmailNotificationData(data, sendToOptions) {
|
|
71
|
+
var _sendToOptions$;
|
|
72
|
+
var notifyEmails = data.notifyEmails,
|
|
73
|
+
notifyCcEmails = data.notifyCcEmails,
|
|
74
|
+
notifyBccEmails = data.notifyBccEmails,
|
|
75
|
+
replyToId = data.replyToId,
|
|
76
|
+
customFields = data.customFields,
|
|
77
|
+
rest = _objectWithoutProperties(data, _excluded$1);
|
|
78
|
+
var parsed = _objectSpread$1(_objectSpread$1({}, customFields), rest);
|
|
79
|
+
parsed.sendTo = notifyEmails ? createEmailOptions(notifyEmails) : [];
|
|
80
|
+
parsed.sendToCc = notifyCcEmails ? createEmailOptions(notifyCcEmails) : [];
|
|
81
|
+
parsed.sendToBcc = notifyCcEmails ? createEmailOptions(notifyBccEmails) : [];
|
|
82
|
+
parsed.replyTo = replyToId || customFields["replyTo"];
|
|
83
|
+
parsed.sendToId = customFields["sendToId"] || (sendToOptions === null || sendToOptions === void 0 || (_sendToOptions$ = sendToOptions[0]) === null || _sendToOptions$ === void 0 ? void 0 : _sendToOptions$.value) || "";
|
|
84
|
+
parsed.showCopyEmails = !!(notifyCcEmails !== null && notifyCcEmails !== void 0 && notifyCcEmails.length || notifyBccEmails !== null && notifyBccEmails !== void 0 && notifyBccEmails.length);
|
|
85
|
+
return parsed;
|
|
86
|
+
};
|
|
87
|
+
var packEmailPayload = function packEmailPayload(values, isReplyToDropdownField, isDisabledByUser) {
|
|
88
|
+
values.id;
|
|
89
|
+
var isEnabled = values.isEnabled,
|
|
90
|
+
sendTo = values.sendTo,
|
|
91
|
+
sendToCc = values.sendToCc,
|
|
92
|
+
sendToBcc = values.sendToBcc,
|
|
93
|
+
showCopyEmails = values.showCopyEmails,
|
|
94
|
+
replyTo = values.replyTo,
|
|
95
|
+
message = values.message,
|
|
96
|
+
subject = values.subject,
|
|
97
|
+
sendFrom = values.sendFrom,
|
|
98
|
+
sendToId = values.sendToId,
|
|
99
|
+
rest = _objectWithoutProperties(values, _excluded2);
|
|
100
|
+
var payload = {
|
|
101
|
+
isEnabled: isEnabled
|
|
102
|
+
};
|
|
103
|
+
if (isEnabled) {
|
|
104
|
+
payload = _objectSpread$1({}, payload);
|
|
105
|
+
payload.notifyEmails = parseEmailsOptions(sendTo);
|
|
106
|
+
payload.notifyBccEmails = showCopyEmails ? parseEmailsOptions(sendToBcc) : [];
|
|
107
|
+
payload.notifyCcEmails = showCopyEmails ? parseEmailsOptions(sendToCc) : [];
|
|
108
|
+
if (isReplyToDropdownField) {
|
|
109
|
+
payload.replyToId = replyTo;
|
|
110
|
+
} else {
|
|
111
|
+
rest.replyTo = replyTo;
|
|
112
|
+
}
|
|
113
|
+
payload.message = message;
|
|
114
|
+
payload.subject = subject;
|
|
115
|
+
payload.customFields = _objectSpread$1(_objectSpread$1({}, rest), {}, {
|
|
116
|
+
disabledByUser: false
|
|
117
|
+
});
|
|
118
|
+
if (neetoCist.isNotEmpty(sendToId)) {
|
|
119
|
+
payload.customFields = ramda.mergeLeft(payload.customFields, {
|
|
120
|
+
sendToId: sendToId
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
payload.sendFrom = sendFrom;
|
|
124
|
+
} else {
|
|
125
|
+
payload.customFields = {
|
|
126
|
+
disabledByUser: isDisabledByUser
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return payload;
|
|
130
|
+
};
|
|
131
|
+
var renderText = function renderText(text, fallbackTranslation) {
|
|
132
|
+
return ramda.isEmpty(text) ? fallbackTranslation : text;
|
|
133
|
+
};
|
|
134
|
+
var generateDefaultValues = function generateDefaultValues(data) {
|
|
135
|
+
var _data$defaultAttribut, _data$defaultAttribut2;
|
|
136
|
+
if (!(data !== null && data !== void 0 && data.defaultAttributes)) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
var currentDataFields = ["id", "customFields", "notifyCcEmails", "notifyBccEmails", "replyToId"];
|
|
140
|
+
var currentDataOverlay = ramda.pick(currentDataFields, data);
|
|
141
|
+
var normalizedDefaults = _objectSpread$1(_objectSpread$1({}, data.defaultAttributes), {}, {
|
|
142
|
+
message: ((_data$defaultAttribut = data.defaultAttributes.message) === null || _data$defaultAttribut === void 0 || (_data$defaultAttribut2 = _data$defaultAttribut.replaceAll) === null || _data$defaultAttribut2 === void 0 ? void 0 : _data$defaultAttribut2.call(_data$defaultAttribut, "<br />", "<br>")) || data.defaultAttributes.message
|
|
143
|
+
});
|
|
144
|
+
return ramda.mergeLeft(currentDataOverlay, normalizedDefaults);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
var _excluded = ["validationSchema"];
|
|
148
|
+
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; }
|
|
149
|
+
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; }
|
|
150
|
+
var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
|
|
151
|
+
var _emailFormProps$sendT, _emailFormProps$sendT2;
|
|
152
|
+
var _ref$emailNotificatio = _ref.emailNotificationParams,
|
|
153
|
+
emailNotificationParams = _ref$emailNotificatio === void 0 ? {} : _ref$emailNotificatio,
|
|
154
|
+
_ref$emailPreviewProp = _ref.emailPreviewProps,
|
|
155
|
+
emailPreviewProps = _ref$emailPreviewProp === void 0 ? {} : _ref$emailPreviewProp,
|
|
156
|
+
_ref$emailFormProps = _ref.emailFormProps,
|
|
157
|
+
emailFormProps = _ref$emailFormProps === void 0 ? {} : _ref$emailFormProps,
|
|
158
|
+
_ref$emailFormikProps = _ref.emailFormikProps,
|
|
159
|
+
emailFormikProps = _ref$emailFormikProps === void 0 ? {} : _ref$emailFormikProps,
|
|
160
|
+
_ref$title = _ref.title,
|
|
161
|
+
title = _ref$title === void 0 ? "" : _ref$title,
|
|
162
|
+
_ref$notificationTogg = _ref.notificationToggleLabel,
|
|
163
|
+
notificationToggleLabel = _ref$notificationTogg === void 0 ? "" : _ref$notificationTogg,
|
|
164
|
+
_ref$breadcrumbs = _ref.breadcrumbs,
|
|
165
|
+
breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
|
|
166
|
+
_ref$helpPopoverProps = _ref.helpPopoverProps,
|
|
167
|
+
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
|
|
168
|
+
_ref$tooltipProps = _ref.tooltipProps,
|
|
169
|
+
tooltipProps = _ref$tooltipProps === void 0 ? {} : _ref$tooltipProps,
|
|
170
|
+
_ref$disabled = _ref.disabled,
|
|
171
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
172
|
+
_ref$fieldsVisibility = _ref.fieldsVisibility,
|
|
173
|
+
fieldsVisibility = _ref$fieldsVisibility === void 0 ? {} : _ref$fieldsVisibility,
|
|
174
|
+
_ref$blockNavigation = _ref.blockNavigation,
|
|
175
|
+
blockNavigation = _ref$blockNavigation === void 0 ? false : _ref$blockNavigation,
|
|
176
|
+
_ref$onSuccess = _ref.onSuccess,
|
|
177
|
+
onSuccess = _ref$onSuccess === void 0 ? neetoCist.noop : _ref$onSuccess,
|
|
178
|
+
children = _ref.children;
|
|
179
|
+
var editorRef = react.useRef();
|
|
180
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
181
|
+
t = _useTranslation.t;
|
|
182
|
+
var _useFetchEmailNotific = emailNotificationApi.useFetchEmailNotifications(emailNotificationParams),
|
|
183
|
+
_useFetchEmailNotific2 = _useFetchEmailNotific.data,
|
|
184
|
+
data = _useFetchEmailNotific2 === void 0 ? {} : _useFetchEmailNotific2,
|
|
185
|
+
isLoading = _useFetchEmailNotific.isLoading;
|
|
186
|
+
var _useUpdateEmailNotifi = emailNotificationApi.useUpdateEmailNotification(),
|
|
187
|
+
updateEmailNotification = _useUpdateEmailNotifi.mutate,
|
|
188
|
+
isSubmitting = _useUpdateEmailNotifi.isPending;
|
|
189
|
+
var _useResetEmailNotific = emailNotificationApi.useResetEmailNotificationToDefault(),
|
|
190
|
+
resetToDefault = _useResetEmailNotific.mutate,
|
|
191
|
+
isResetting = _useResetEmailNotific.isPending;
|
|
192
|
+
var handleSubmit = function handleSubmit(values) {
|
|
193
|
+
var _emailFormProps$reply;
|
|
194
|
+
var isDisabledByUser = data.isEnabled && !values.isEnabled;
|
|
195
|
+
var isReplyToDropdownField = (emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$reply = emailFormProps.replyToFieldProps) === null || _emailFormProps$reply === void 0 ? void 0 : _emailFormProps$reply.options) !== undefined;
|
|
196
|
+
var body = ramda.mergeDeepLeft(packEmailPayload(values, isReplyToDropdownField, isDisabledByUser), emailNotificationParams);
|
|
197
|
+
updateEmailNotification(body, {
|
|
198
|
+
onSuccess: onSuccess
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
if (isLoading || neetoCist.isNotPresent(data)) {
|
|
202
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
203
|
+
className: "flex h-full w-full items-center justify-center",
|
|
204
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Spinner, {})
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
var newDefaultAttributes = generateDefaultValues(data);
|
|
208
|
+
var defaultValues = parseEmailNotificationData(newDefaultAttributes, emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$sendT = emailFormProps.sendToFieldProps) === null || _emailFormProps$sendT === void 0 ? void 0 : _emailFormProps$sendT.options);
|
|
209
|
+
defaultValues.defaultAttributes = data.defaultAttributes;
|
|
210
|
+
var formattedTitle = renderText(title, t("neetoEmailNotifications.emailNotification.title"));
|
|
211
|
+
var formattedNotificationToggleLabel = renderText(notificationToggleLabel, t("neetoEmailNotifications.emailNotification.notificationToggleLabel"));
|
|
212
|
+
var customValidationSchema = emailFormikProps.validationSchema,
|
|
213
|
+
formikProps = _objectWithoutProperties(emailFormikProps, _excluded);
|
|
214
|
+
var handleResetToDefault = function handleResetToDefault() {
|
|
215
|
+
resetToDefault(emailNotificationParams, {
|
|
216
|
+
onSuccess: function onSuccess(_ref2) {
|
|
217
|
+
var _editorRef$current;
|
|
218
|
+
var emailNotification = _ref2.emailNotification;
|
|
219
|
+
return editorRef === null || editorRef === void 0 || (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.editor) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.commands) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.setContent(emailNotification.message);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
224
|
+
className: "min-w-0 grow overflow-y-auto",
|
|
225
|
+
children: /*#__PURE__*/jsxRuntime.jsx(EmailForm, _objectSpread(_objectSpread({}, _objectSpread({
|
|
226
|
+
blockNavigation: blockNavigation,
|
|
227
|
+
emailPreviewProps: emailPreviewProps,
|
|
228
|
+
formikProps: formikProps,
|
|
229
|
+
tooltipProps: tooltipProps
|
|
230
|
+
}, ramda.mergeLeft(fieldsVisibility, DEFAULT_FIELDS_VISIBILITY))), {}, {
|
|
231
|
+
isLoading: isSubmitting,
|
|
232
|
+
validationSchema: customValidationSchema || FORM_VALIDATION_SCHEMA,
|
|
233
|
+
emailFormProps: _objectSpread({
|
|
234
|
+
editorRef: editorRef,
|
|
235
|
+
handleResetToDefault: handleResetToDefault,
|
|
236
|
+
isResetting: isResetting,
|
|
237
|
+
defaultValues: defaultValues
|
|
238
|
+
}, emailFormProps),
|
|
239
|
+
headerProps: {
|
|
240
|
+
title: formattedTitle,
|
|
241
|
+
titleHelpPopoverProps: helpPopoverProps,
|
|
242
|
+
breadcrumbs: breadcrumbs
|
|
243
|
+
},
|
|
244
|
+
initialValues: parseEmailNotificationData(data, emailFormProps === null || emailFormProps === void 0 || (_emailFormProps$sendT2 = emailFormProps.sendToFieldProps) === null || _emailFormProps$sendT2 === void 0 ? void 0 : _emailFormProps$sendT2.options),
|
|
245
|
+
switchProps: {
|
|
246
|
+
label: formattedNotificationToggleLabel,
|
|
247
|
+
disabled: disabled,
|
|
248
|
+
"data-testid": "receive-email-notification-switch"
|
|
249
|
+
},
|
|
250
|
+
onSubmit: handleSubmit,
|
|
251
|
+
children: children
|
|
252
|
+
}))
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
module.exports = NeetoEmailNotificationForm;
|
|
257
|
+
//# sourceMappingURL=NeetoEmailNotificationForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NeetoEmailNotificationForm.js","sources":["../../../app/javascript/src/v2/components/EmailNotificationForm/constants.js","../../../app/javascript/src/v2/components/EmailNotificationForm/utils.js","../../../app/javascript/src/v2/components/EmailNotificationForm/index.jsx"],"sourcesContent":["import * as yup from \"yup\";\n\nexport const FORM_VALIDATION_SCHEMA = { isEnabled: yup.boolean() };\n\nexport const DEFAULT_FIELDS_VISIBILITY = {\n showSendToField: true,\n showReplyToField: false,\n showSendToAsRadio: false,\n showBccField: false,\n showCcField: false,\n};\n","import { isNotEmpty } from \"neetocist\";\nimport { isEmpty, mergeLeft, prop, pick } 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 = (\n values,\n isReplyToDropdownField,\n isDisabledByUser\n) => {\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 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: isDisabledByUser };\n }\n\n return payload;\n};\n\nexport const renderText = (text, fallbackTranslation) =>\n isEmpty(text) ? fallbackTranslation : text;\n\nexport const generateDefaultValues = data => {\n if (!data?.defaultAttributes) {\n return null;\n }\n\n const currentDataFields = [\n \"id\",\n \"customFields\",\n \"notifyCcEmails\",\n \"notifyBccEmails\",\n \"replyToId\",\n ];\n\n const currentDataOverlay = pick(currentDataFields, data);\n\n const normalizedDefaults = {\n ...data.defaultAttributes,\n message:\n data.defaultAttributes.message?.replaceAll?.(\"<br />\", \"<br>\") ||\n data.defaultAttributes.message,\n };\n\n return mergeLeft(currentDataOverlay, normalizedDefaults);\n};\n","import { useRef } from \"react\";\n\nimport { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { isNotPresent, noop } from \"neetocist\";\nimport EmailForm from \"neetomolecules/v2/EmailForm\";\nimport { mergeDeepLeft, mergeLeft } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchEmailNotifications,\n useUpdateEmailNotification,\n useResetEmailNotificationToDefault,\n} from \"src/hooks/reactQuery/emailNotificationApi\";\n\nimport { DEFAULT_FIELDS_VISIBILITY, FORM_VALIDATION_SCHEMA } from \"./constants\";\nimport {\n packEmailPayload,\n parseEmailNotificationData,\n renderText,\n generateDefaultValues,\n} from \"./utils\";\n\nconst NeetoEmailNotificationForm = ({\n emailNotificationParams = {},\n emailPreviewProps = {},\n emailFormProps = {},\n emailFormikProps = {},\n title = \"\",\n notificationToggleLabel = \"\",\n breadcrumbs = [],\n helpPopoverProps = {},\n tooltipProps = {},\n disabled = false,\n fieldsVisibility = {},\n blockNavigation = false,\n onSuccess = noop,\n children,\n}) => {\n const editorRef = useRef();\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 { mutate: resetToDefault, isPending: isResetting } =\n useResetEmailNotificationToDefault();\n\n const handleSubmit = values => {\n const isDisabledByUser = data.isEnabled && !values.isEnabled;\n const isReplyToDropdownField =\n emailFormProps?.replyToFieldProps?.options !== undefined;\n\n const body = mergeDeepLeft(\n packEmailPayload(values, isReplyToDropdownField, isDisabledByUser),\n emailNotificationParams\n );\n updateEmailNotification(body, { onSuccess });\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 const newDefaultAttributes = generateDefaultValues(data);\n\n const defaultValues = parseEmailNotificationData(\n newDefaultAttributes,\n emailFormProps?.sendToFieldProps?.options\n );\n\n defaultValues.defaultAttributes = data.defaultAttributes;\n\n const formattedTitle = renderText(\n title,\n t(\"neetoEmailNotifications.emailNotification.title\")\n );\n\n const formattedNotificationToggleLabel = renderText(\n notificationToggleLabel,\n t(\"neetoEmailNotifications.emailNotification.notificationToggleLabel\")\n );\n\n const { validationSchema: customValidationSchema, ...formikProps } =\n emailFormikProps;\n\n const handleResetToDefault = () => {\n resetToDefault(emailNotificationParams, {\n onSuccess: ({ emailNotification }) =>\n editorRef?.current?.editor?.commands?.setContent(\n emailNotification.message\n ),\n });\n };\n\n return (\n <div className=\"min-w-0 grow overflow-y-auto\">\n <EmailForm\n {...{\n blockNavigation,\n emailPreviewProps,\n formikProps,\n tooltipProps,\n ...mergeLeft(fieldsVisibility, DEFAULT_FIELDS_VISIBILITY),\n }}\n isLoading={isSubmitting}\n validationSchema={customValidationSchema || FORM_VALIDATION_SCHEMA}\n emailFormProps={{\n editorRef,\n handleResetToDefault,\n isResetting,\n defaultValues,\n ...emailFormProps,\n }}\n headerProps={{\n title: formattedTitle,\n titleHelpPopoverProps: helpPopoverProps,\n breadcrumbs,\n }}\n initialValues={parseEmailNotificationData(\n data,\n emailFormProps?.sendToFieldProps?.options\n )}\n switchProps={{\n label: formattedNotificationToggleLabel,\n disabled,\n \"data-testid\": \"receive-email-notification-switch\",\n }}\n onSubmit={handleSubmit}\n >\n {children}\n </EmailForm>\n </div>\n );\n};\n\nexport default NeetoEmailNotificationForm;\n"],"names":["FORM_VALIDATION_SCHEMA","isEnabled","yup","DEFAULT_FIELDS_VISIBILITY","showSendToField","showReplyToField","showSendToAsRadio","showBccField","showCcField","isValidEmail","email","string","isValidSync","createEmailOptions","emails","arguments","length","undefined","map","label","value","valid","parseEmailsOptions","emailOptions","prop","parseEmailNotificationData","data","sendToOptions","_sendToOptions$","notifyEmails","notifyCcEmails","notifyBccEmails","replyToId","customFields","rest","_objectWithoutProperties","_excluded","parsed","_objectSpread","sendTo","sendToCc","sendToBcc","replyTo","sendToId","showCopyEmails","packEmailPayload","values","isReplyToDropdownField","isDisabledByUser","id","message","subject","sendFrom","_excluded2","payload","disabledByUser","isNotEmpty","mergeLeft","renderText","text","fallbackTranslation","isEmpty","generateDefaultValues","_data$defaultAttribut","_data$defaultAttribut2","defaultAttributes","currentDataFields","currentDataOverlay","pick","normalizedDefaults","replaceAll","call","NeetoEmailNotificationForm","_ref","_emailFormProps$sendT","_emailFormProps$sendT2","_ref$emailNotificatio","emailNotificationParams","_ref$emailPreviewProp","emailPreviewProps","_ref$emailFormProps","emailFormProps","_ref$emailFormikProps","emailFormikProps","_ref$title","title","_ref$notificationTogg","notificationToggleLabel","_ref$breadcrumbs","breadcrumbs","_ref$helpPopoverProps","helpPopoverProps","_ref$tooltipProps","tooltipProps","_ref$disabled","disabled","_ref$fieldsVisibility","fieldsVisibility","_ref$blockNavigation","blockNavigation","_ref$onSuccess","onSuccess","noop","children","editorRef","useRef","_useTranslation","useTranslation","t","_useFetchEmailNotific","useFetchEmailNotifications","_useFetchEmailNotific2","isLoading","_useUpdateEmailNotifi","useUpdateEmailNotification","updateEmailNotification","mutate","isSubmitting","isPending","_useResetEmailNotific","useResetEmailNotificationToDefault","resetToDefault","isResetting","handleSubmit","_emailFormProps$reply","replyToFieldProps","options","body","mergeDeepLeft","isNotPresent","_jsx","className","Spinner","newDefaultAttributes","defaultValues","sendToFieldProps","formattedTitle","formattedNotificationToggleLabel","customValidationSchema","validationSchema","formikProps","handleResetToDefault","_ref2","_editorRef$current","emailNotification","current","editor","commands","setContent","EmailForm","headerProps","titleHelpPopoverProps","initialValues","switchProps","onSubmit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,sBAAsB,GAAG;EAAEC,SAAS,EAAEC,cAAG,CAAA,SAAA,CAAQ;AAAG,CAAC;AAE3D,IAAMC,yBAAyB,GAAG;AACvCC,EAAAA,eAAe,EAAE,IAAI;AACrBC,EAAAA,gBAAgB,EAAE,KAAK;AACvBC,EAAAA,iBAAiB,EAAE,KAAK;AACxBC,EAAAA,YAAY,EAAE,KAAK;AACnBC,EAAAA,WAAW,EAAE;AACf,CAAC;;;;;;ACND,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK,EAAA;EAAA,OAAIC,UAAM,EAAE,CAACD,KAAK,EAAE,CAACE,WAAW,CAACF,KAAK,CAAC;AAAA,CAAA;AAEjE,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkB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QAAAA,oBAAoB,EAApBA,oBAAoB;AACpBnB,QAAAA,WAAW,EAAXA,WAAW;AACXY,QAAAA,aAAa,EAAbA;AAAa,OAAA,EACVrD,cAAc,CACjB;AACFqE,MAAAA,WAAW,EAAE;AACXjE,QAAAA,KAAK,EAAEmD,cAAc;AACrBe,QAAAA,qBAAqB,EAAE5D,gBAAgB;AACvCF,QAAAA,WAAW,EAAXA;OACA;MACF+D,aAAa,EAAE/H,0BAA0B,CACvCC,IAAI,EACJuD,cAAc,KAAA,IAAA,IAAdA,cAAc,KAAA,MAAA,IAAA,CAAAN,sBAAA,GAAdM,cAAc,CAAEsD,gBAAgB,MAAA,IAAA,IAAA5D,sBAAA,uBAAhCA,sBAAA,CAAkCmD,OACpC,CAAE;AACF2B,MAAAA,WAAW,EAAE;AACXtI,QAAAA,KAAK,EAAEsH,gCAAgC;AACvC1C,QAAAA,QAAQ,EAARA,QAAQ;AACR,QAAA,aAAa,EAAE;OACf;AACF2D,MAAAA,QAAQ,EAAE/B,YAAa;AAAApB,MAAAA,QAAA,EAEtBA;KAAQ,CACA;AAAC,GACT,CAAC;AAEV;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var v2_NeetoEmailNotificationForm = require('./NeetoEmailNotificationForm.js');
|
|
4
|
+
require('@babel/runtime/helpers/defineProperty');
|
|
5
|
+
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
+
require('react');
|
|
7
|
+
require('@bigbinary/neeto-atoms');
|
|
8
|
+
require('@bigbinary/neeto-cist');
|
|
9
|
+
require('@bigbinary/neeto-molecules/v2/EmailForm');
|
|
10
|
+
require('ramda');
|
|
11
|
+
require('react-i18next');
|
|
12
|
+
require('../../emailNotificationApi-BVsGH7CY.js');
|
|
13
|
+
require('@tanstack/react-query');
|
|
14
|
+
require('@bigbinary/neeto-commons-frontend/constants');
|
|
15
|
+
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
16
|
+
require('axios');
|
|
17
|
+
require('yup');
|
|
18
|
+
require('react/jsx-runtime');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.NeetoEmailNotificationForm = v2_NeetoEmailNotificationForm;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { isNotEmpty } from '@bigbinary/neeto-cist';
|
|
3
|
+
import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
|
|
4
|
+
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
|
+
import { prop } from 'ramda';
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
|
|
8
|
+
var EMAIL_NOTIFICATIONS_BASE_URL = "neeto_email_notifications/email_notification";
|
|
9
|
+
var RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL = "".concat(EMAIL_NOTIFICATIONS_BASE_URL, "/reset_to_default");
|
|
10
|
+
|
|
11
|
+
var fetch = function fetch(params) {
|
|
12
|
+
return axios.get(EMAIL_NOTIFICATIONS_BASE_URL, {
|
|
13
|
+
params: params
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var update = function update(payload) {
|
|
17
|
+
return axios.put(EMAIL_NOTIFICATIONS_BASE_URL, payload);
|
|
18
|
+
};
|
|
19
|
+
var resetToDefault = function resetToDefault(params) {
|
|
20
|
+
return axios.post(RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL, params);
|
|
21
|
+
};
|
|
22
|
+
var emailNotificationsApi = {
|
|
23
|
+
fetch: fetch,
|
|
24
|
+
update: update,
|
|
25
|
+
resetToDefault: resetToDefault
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var QUERY_KEYS = {
|
|
29
|
+
NEETO_EMAIL_NOTIFICATIONS: "neeto-email-notifications"
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var useFetchEmailNotifications = function useFetchEmailNotifications(params) {
|
|
33
|
+
return useQuery({
|
|
34
|
+
queryKey: [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, params["notificationHolderId"], params["customFields"]],
|
|
35
|
+
queryFn: function queryFn() {
|
|
36
|
+
return emailNotificationsApi.fetch(params);
|
|
37
|
+
},
|
|
38
|
+
staleTime: DEFAULT_STALE_TIME,
|
|
39
|
+
select: prop("emailNotification"),
|
|
40
|
+
enabled: isNotEmpty(params)
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var useUpdateEmailNotification = function useUpdateEmailNotification() {
|
|
44
|
+
return useMutationWithInvalidation(function (params) {
|
|
45
|
+
return emailNotificationsApi.update(params);
|
|
46
|
+
}, {
|
|
47
|
+
keysToInvalidate: [function (_, _ref) {
|
|
48
|
+
var notificationHolderId = _ref.notificationHolderId;
|
|
49
|
+
return [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, notificationHolderId];
|
|
50
|
+
}]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
var useResetEmailNotificationToDefault = function useResetEmailNotificationToDefault() {
|
|
54
|
+
return useMutationWithInvalidation(emailNotificationsApi.resetToDefault, {
|
|
55
|
+
keysToInvalidate: [function (_, _ref2) {
|
|
56
|
+
var notificationHolderId = _ref2.notificationHolderId,
|
|
57
|
+
customFields = _ref2.customFields;
|
|
58
|
+
return [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, notificationHolderId, customFields];
|
|
59
|
+
}]
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { useUpdateEmailNotification as a, useResetEmailNotificationToDefault as b, useFetchEmailNotifications as u };
|
|
64
|
+
//# sourceMappingURL=emailNotificationApi-234PRG05.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emailNotificationApi-234PRG05.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"],"sourcesContent":["export const EMAIL_NOTIFICATIONS_BASE_URL =\n \"neeto_email_notifications/email_notification\";\n\nexport const RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL = `${EMAIL_NOTIFICATIONS_BASE_URL}/reset_to_default`;\n","import axios from \"axios\";\n\nimport {\n RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL,\n EMAIL_NOTIFICATIONS_BASE_URL,\n} from \"src/constants\";\n\nconst fetch = params => axios.get(EMAIL_NOTIFICATIONS_BASE_URL, { params });\n\nconst update = payload => axios.put(EMAIL_NOTIFICATIONS_BASE_URL, payload);\n\nconst resetToDefault = params =>\n axios.post(RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL, params);\n\nconst emailNotificationsApi = { fetch, update, resetToDefault };\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\nexport const useResetEmailNotificationToDefault = () =>\n useMutationWithInvalidation(emailNotificationsApi.resetToDefault, {\n keysToInvalidate: [\n (_, { notificationHolderId, customFields }) => [\n QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS,\n notificationHolderId,\n customFields,\n ],\n ],\n });\n"],"names":["EMAIL_NOTIFICATIONS_BASE_URL","RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL","concat","fetch","params","axios","get","update","payload","put","resetToDefault","post","emailNotificationsApi","QUERY_KEYS","NEETO_EMAIL_NOTIFICATIONS","useFetchEmailNotifications","useQuery","queryKey","queryFn","staleTime","DEFAULT_STALE_TIME","select","prop","enabled","isNotEmpty","useUpdateEmailNotification","useMutationWithInvalidation","keysToInvalidate","_","_ref","notificationHolderId","useResetEmailNotificationToDefault","_ref2","customFields"],"mappings":";;;;;;;AAAO,IAAMA,4BAA4B,GACvC,8CAA8C;AAEzC,IAAMC,wCAAwC,GAAA,EAAA,CAAAC,MAAA,CAAMF,4BAA4B,EAAA,mBAAA,CAAmB;;ACI1G,IAAMG,KAAK,GAAG,SAARA,KAAKA,CAAGC,MAAM,EAAA;AAAA,EAAA,OAAIC,KAAK,CAACC,GAAG,CAACN,4BAA4B,EAAE;AAAEI,IAAAA,MAAM,EAANA;AAAO,GAAC,CAAC;AAAA,CAAA;AAE3E,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAGC,OAAO,EAAA;AAAA,EAAA,OAAIH,KAAK,CAACI,GAAG,CAACT,4BAA4B,EAAEQ,OAAO,CAAC;AAAA,CAAA;AAE1E,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAGN,MAAM,EAAA;AAAA,EAAA,OAC3BC,KAAK,CAACM,IAAI,CAACV,wCAAwC,EAAEG,MAAM,CAAC;AAAA,CAAA;AAE9D,IAAMQ,qBAAqB,GAAG;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,CAAC,EAAAI,KAAA,EAAA;AAAA,MAAA,IAAIF,oBAAoB,GAAAE,KAAA,CAApBF,oBAAoB;QAAEG,YAAY,GAAAD,KAAA,CAAZC,YAAY;MAAA,OAAO,CAC7CpB,UAAU,CAACC,yBAAyB,EACpCgB,oBAAoB,EACpBG,YAAY,CACb;AAAA,IAAA,CAAA;AAEL,GAAC,CAAC;AAAA;;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactQuery = require('@tanstack/react-query');
|
|
4
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
5
|
+
var constants = require('@bigbinary/neeto-commons-frontend/constants');
|
|
6
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
7
|
+
var ramda = require('ramda');
|
|
8
|
+
var axios = require('axios');
|
|
9
|
+
|
|
10
|
+
var EMAIL_NOTIFICATIONS_BASE_URL = "neeto_email_notifications/email_notification";
|
|
11
|
+
var RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL = "".concat(EMAIL_NOTIFICATIONS_BASE_URL, "/reset_to_default");
|
|
12
|
+
|
|
13
|
+
var fetch = function fetch(params) {
|
|
14
|
+
return axios.get(EMAIL_NOTIFICATIONS_BASE_URL, {
|
|
15
|
+
params: params
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
var update = function update(payload) {
|
|
19
|
+
return axios.put(EMAIL_NOTIFICATIONS_BASE_URL, payload);
|
|
20
|
+
};
|
|
21
|
+
var resetToDefault = function resetToDefault(params) {
|
|
22
|
+
return axios.post(RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL, params);
|
|
23
|
+
};
|
|
24
|
+
var emailNotificationsApi = {
|
|
25
|
+
fetch: fetch,
|
|
26
|
+
update: update,
|
|
27
|
+
resetToDefault: resetToDefault
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var QUERY_KEYS = {
|
|
31
|
+
NEETO_EMAIL_NOTIFICATIONS: "neeto-email-notifications"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var useFetchEmailNotifications = function useFetchEmailNotifications(params) {
|
|
35
|
+
return reactQuery.useQuery({
|
|
36
|
+
queryKey: [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, params["notificationHolderId"], params["customFields"]],
|
|
37
|
+
queryFn: function queryFn() {
|
|
38
|
+
return emailNotificationsApi.fetch(params);
|
|
39
|
+
},
|
|
40
|
+
staleTime: constants.DEFAULT_STALE_TIME,
|
|
41
|
+
select: ramda.prop("emailNotification"),
|
|
42
|
+
enabled: neetoCist.isNotEmpty(params)
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var useUpdateEmailNotification = function useUpdateEmailNotification() {
|
|
46
|
+
return reactUtils.useMutationWithInvalidation(function (params) {
|
|
47
|
+
return emailNotificationsApi.update(params);
|
|
48
|
+
}, {
|
|
49
|
+
keysToInvalidate: [function (_, _ref) {
|
|
50
|
+
var notificationHolderId = _ref.notificationHolderId;
|
|
51
|
+
return [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, notificationHolderId];
|
|
52
|
+
}]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var useResetEmailNotificationToDefault = function useResetEmailNotificationToDefault() {
|
|
56
|
+
return reactUtils.useMutationWithInvalidation(emailNotificationsApi.resetToDefault, {
|
|
57
|
+
keysToInvalidate: [function (_, _ref2) {
|
|
58
|
+
var notificationHolderId = _ref2.notificationHolderId,
|
|
59
|
+
customFields = _ref2.customFields;
|
|
60
|
+
return [QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS, notificationHolderId, customFields];
|
|
61
|
+
}]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.useFetchEmailNotifications = useFetchEmailNotifications;
|
|
66
|
+
exports.useResetEmailNotificationToDefault = useResetEmailNotificationToDefault;
|
|
67
|
+
exports.useUpdateEmailNotification = useUpdateEmailNotification;
|
|
68
|
+
//# sourceMappingURL=emailNotificationApi-BVsGH7CY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emailNotificationApi-BVsGH7CY.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"],"sourcesContent":["export const EMAIL_NOTIFICATIONS_BASE_URL =\n \"neeto_email_notifications/email_notification\";\n\nexport const RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL = `${EMAIL_NOTIFICATIONS_BASE_URL}/reset_to_default`;\n","import axios from \"axios\";\n\nimport {\n RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL,\n EMAIL_NOTIFICATIONS_BASE_URL,\n} from \"src/constants\";\n\nconst fetch = params => axios.get(EMAIL_NOTIFICATIONS_BASE_URL, { params });\n\nconst update = payload => axios.put(EMAIL_NOTIFICATIONS_BASE_URL, payload);\n\nconst resetToDefault = params =>\n axios.post(RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL, params);\n\nconst emailNotificationsApi = { fetch, update, resetToDefault };\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\nexport const useResetEmailNotificationToDefault = () =>\n useMutationWithInvalidation(emailNotificationsApi.resetToDefault, {\n keysToInvalidate: [\n (_, { notificationHolderId, customFields }) => [\n QUERY_KEYS.NEETO_EMAIL_NOTIFICATIONS,\n notificationHolderId,\n customFields,\n ],\n ],\n });\n"],"names":["EMAIL_NOTIFICATIONS_BASE_URL","RESET_EMAIL_NOTIFICATIONS_TO_DEFAULT_URL","concat","fetch","params","axios","get","update","payload","put","resetToDefault","post","emailNotificationsApi","QUERY_KEYS","NEETO_EMAIL_NOTIFICATIONS","useFetchEmailNotifications","useQuery","queryKey","queryFn","staleTime","DEFAULT_STALE_TIME","select","prop","enabled","isNotEmpty","useUpdateEmailNotification","useMutationWithInvalidation","keysToInvalidate","_","_ref","notificationHolderId","useResetEmailNotificationToDefault","_ref2","customFields"],"mappings":";;;;;;;;;AAAO,IAAMA,4BAA4B,GACvC,8CAA8C;AAEzC,IAAMC,wCAAwC,GAAA,EAAA,CAAAC,MAAA,CAAMF,4BAA4B,EAAA,mBAAA,CAAmB;;ACI1G,IAAMG,KAAK,GAAG,SAARA,KAAKA,CAAGC,MAAM,EAAA;AAAA,EAAA,OAAIC,KAAK,CAACC,GAAG,CAACN,4BAA4B,EAAE;AAAEI,IAAAA,MAAM,EAANA;AAAO,GAAC,CAAC;AAAA,CAAA;AAE3E,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAGC,OAAO,EAAA;AAAA,EAAA,OAAIH,KAAK,CAACI,GAAG,CAACT,4BAA4B,EAAEQ,OAAO,CAAC;AAAA,CAAA;AAE1E,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAGN,MAAM,EAAA;AAAA,EAAA,OAC3BC,KAAK,CAACM,I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,sCAA2B,CAACd,qBAAqB,CAACF,cAAc,EAAE;AAChEiB,IAAAA,gBAAgB,EAAE,CAChB,UAACC,CAAC,EAAAI,KAAA,EAAA;AAAA,MAAA,IAAIF,oBAAoB,GAAAE,KAAA,CAApBF,oBAAoB;QAAEG,YAAY,GAAAD,KAAA,CAAZC,YAAY;MAAA,OAAO,CAC7CpB,UAAU,CAACC,yBAAyB,EACpCgB,oBAAoB,EACpBG,YAAY,CACb;AAAA,IAAA,CAAA;AAEL,GAAC,CAAC;AAAA;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import '@bigbinary/neeto-molecules/EmailForm';
|
|
|
7
7
|
import '@bigbinary/neetoui/Spinner';
|
|
8
8
|
import 'ramda';
|
|
9
9
|
import 'react-i18next';
|
|
10
|
+
import './emailNotificationApi-234PRG05.js';
|
|
10
11
|
import '@tanstack/react-query';
|
|
11
12
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
12
13
|
import '@bigbinary/neeto-commons-frontend/react-utils';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|