@bigbinary/neeto-molecules 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EmailForm.js +1079 -1079
- package/dist/EmailForm.js.map +1 -1
- package/dist/EmailPreview.js +3 -3
- package/dist/EmailPreview.js.map +1 -1
- package/dist/IconPicker.js +9 -5
- package/dist/IconPicker.js.map +1 -1
- package/dist/ShareViaEmail.js +1254 -22
- package/dist/ShareViaEmail.js.map +1 -1
- package/dist/ShareViaLink.js +11 -8
- package/dist/ShareViaLink.js.map +1 -1
- package/package.json +1 -1
package/dist/EmailForm.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useState, useRef, useContext } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
+
import { isPresent, isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
4
|
+
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
|
+
import { EditorContent, isEditorEmpty, FormikEditor } from '@bigbinary/neeto-editor';
|
|
6
|
+
import { Typography, Button, Callout, Pane, Toastr, Input as Input$1 } from '@bigbinary/neetoui';
|
|
3
7
|
import { useFormikContext, Field } from 'formik';
|
|
4
|
-
import { isNotEmpty, noop, isPresent } from '@bigbinary/neeto-cist';
|
|
5
|
-
import { isEditorEmpty, FormikEditor, EditorContent } from '@bigbinary/neeto-editor';
|
|
6
|
-
import { Callout, Button, Typography, Pane, Toastr, Input as Input$1 } from '@bigbinary/neetoui';
|
|
7
8
|
import { Select, Input, MultiEmailInput, Radio, ActionBlock, Form } from '@bigbinary/neetoui/formik';
|
|
8
9
|
import { useTranslation, Trans } from 'react-i18next';
|
|
9
10
|
import { t } from 'i18next';
|
|
@@ -11,832 +12,129 @@ import { prop } from 'ramda';
|
|
|
11
12
|
import * as yup from 'yup';
|
|
12
13
|
import { string } from 'yup';
|
|
13
14
|
import { Info, Download, Upload } from '@bigbinary/neeto-icons';
|
|
14
|
-
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
15
15
|
import { useDropzone } from 'react-dropzone';
|
|
16
16
|
import Papa from 'papaparse';
|
|
17
17
|
import { withEventTargetValue } from '@bigbinary/neeto-commons-frontend/utils';
|
|
18
18
|
import DynamicVariables from '@bigbinary/neeto-molecules/DynamicVariables';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
"@babel/helpers - typeof";
|
|
20
|
+
var propTypes = {exports: {}};
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
return typeof o;
|
|
25
|
-
} : function (o) {
|
|
26
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
27
|
-
}, _typeof(o);
|
|
28
|
-
}
|
|
22
|
+
var reactIs = {exports: {}};
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
32
|
-
var prim = input[Symbol.toPrimitive];
|
|
33
|
-
if (prim !== undefined) {
|
|
34
|
-
var res = prim.call(input, hint || "default");
|
|
35
|
-
if (_typeof(res) !== "object") return res;
|
|
36
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
37
|
-
}
|
|
38
|
-
return (hint === "string" ? String : Number)(input);
|
|
39
|
-
}
|
|
24
|
+
var reactIs_production_min = {};
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
/** @license React v16.13.1
|
|
27
|
+
* react-is.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return obj;
|
|
35
|
+
var hasRequiredReactIs_production_min;
|
|
36
|
+
|
|
37
|
+
function requireReactIs_production_min () {
|
|
38
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
39
|
+
hasRequiredReactIs_production_min = 1;
|
|
40
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
41
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
42
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
43
|
+
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
44
|
+
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
45
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
46
|
+
return reactIs_production_min;
|
|
59
47
|
}
|
|
60
48
|
|
|
61
|
-
var
|
|
62
|
-
sendTo: [],
|
|
63
|
-
sendToId: "",
|
|
64
|
-
sendToCc: [],
|
|
65
|
-
sendToBcc: [],
|
|
66
|
-
replyTo: "",
|
|
67
|
-
showCopyEmails: false,
|
|
68
|
-
subject: "",
|
|
69
|
-
message: ""
|
|
70
|
-
};
|
|
71
|
-
var EMAIL_FORM_VALIDATION_SCHEMA = yup.object({
|
|
72
|
-
subject: yup.string().required(t("neetoMolecules.emailForm.errors.subjectRequired")),
|
|
73
|
-
message: yup.string().test("message", t("neetoMolecules.emailForm.errors.messageRequired"), function (value) {
|
|
74
|
-
return !isEditorEmpty(value);
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
var SEND_TO_FIELD_VALIDATION = yup.object({
|
|
78
|
-
sendTo: yup.array().min(1, t("neetoMolecules.emailForm.errors.required", {
|
|
79
|
-
entity: t("neetoMolecules.emailForm.fields.sendToEmailAddress")
|
|
80
|
-
})).test("all-emails-valid", t("neetoMolecules.emailForm.errors.invalidEmailAddress"), function (emails) {
|
|
81
|
-
return emails === null || emails === void 0 ? void 0 : emails.every(prop("valid"));
|
|
82
|
-
}).nullable()
|
|
83
|
-
});
|
|
84
|
-
var SEND_TO_ID_FIELD_VALIDATION = yup.object({
|
|
85
|
-
sendToId: yup.string().required(t("neetoMolecules.emailForm.errors.required", {
|
|
86
|
-
entity: t("neetoMolecules.emailForm.labels.sendTo")
|
|
87
|
-
}))
|
|
88
|
-
});
|
|
89
|
-
var REPLY_TO_FIELD_VALIDATION = yup.object({
|
|
90
|
-
replyTo: yup.string().nullable().email(t("neetoMolecules.emailForm.errors.invalidEmailAddress")).required(t("neetoMolecules.emailForm.errors.required", {
|
|
91
|
-
entity: t("neetoMolecules.emailForm.fields.replyToEmailAddress")
|
|
92
|
-
}))
|
|
93
|
-
});
|
|
94
|
-
var EDITOR_ADDONS = ["highlight", "emoji", "code-block", "block-quote", "image-upload", "divider", "video-embed"];
|
|
49
|
+
var reactIs_development = {};
|
|
95
50
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
51
|
+
/** @license React v16.13.1
|
|
52
|
+
* react-is.development.js
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/
|
|
102
59
|
|
|
103
|
-
var
|
|
104
|
-
var replyToOptions = _ref.replyToOptions;
|
|
105
|
-
var _useTranslation = useTranslation(),
|
|
106
|
-
t = _useTranslation.t;
|
|
107
|
-
var isDropdownField = isNotEmpty(replyToOptions);
|
|
108
|
-
var _useFormikContext = useFormikContext(),
|
|
109
|
-
setFieldValue = _useFormikContext.setFieldValue;
|
|
110
|
-
if (isDropdownField) {
|
|
111
|
-
return /*#__PURE__*/React.createElement(Select, {
|
|
112
|
-
isClearable: true,
|
|
113
|
-
className: "w-full",
|
|
114
|
-
"data-testid": "replyToOptions",
|
|
115
|
-
label: t("neetoMolecules.emailForm.labels.replyTo"),
|
|
116
|
-
name: "replyTo",
|
|
117
|
-
options: replyToOptions,
|
|
118
|
-
labelProps: {
|
|
119
|
-
helpIconProps: _defineProperty(_defineProperty({
|
|
120
|
-
icon: Info
|
|
121
|
-
}, "data-testid", "reply-to-tooltip"), "tooltipProps", {
|
|
122
|
-
content: t("neetoMolecules.emailForm.tooltips.replyTo")
|
|
123
|
-
})
|
|
124
|
-
},
|
|
125
|
-
onChange: function onChange(data) {
|
|
126
|
-
var _data$value;
|
|
127
|
-
return setFieldValue("replyTo", (_data$value = data === null || data === void 0 ? void 0 : data.value) !== null && _data$value !== void 0 ? _data$value : "");
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return /*#__PURE__*/React.createElement(Input, {
|
|
132
|
-
autoFocus: true,
|
|
133
|
-
required: true,
|
|
134
|
-
className: "w-full",
|
|
135
|
-
"data-testid": "replyToInput",
|
|
136
|
-
label: t("neetoMolecules.emailForm.labels.replyTo"),
|
|
137
|
-
name: "replyTo",
|
|
138
|
-
placeholder: t("neetoMolecules.emailForm.placeholders.emailPlaceholder"),
|
|
139
|
-
size: "large",
|
|
140
|
-
labelProps: {
|
|
141
|
-
helpIconProps: _defineProperty(_defineProperty({
|
|
142
|
-
icon: Info
|
|
143
|
-
}, "data-testid", "reply-to-tooltip"), "tooltipProps", {
|
|
144
|
-
content: t("neetoMolecules.emailForm.tooltips.replyTo")
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
};
|
|
60
|
+
var hasRequiredReactIs_development;
|
|
149
61
|
|
|
150
|
-
function
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
var source = arguments[i];
|
|
154
|
-
for (var key in source) {
|
|
155
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
156
|
-
target[key] = source[key];
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return target;
|
|
161
|
-
};
|
|
162
|
-
return _extends.apply(this, arguments);
|
|
163
|
-
}
|
|
62
|
+
function requireReactIs_development () {
|
|
63
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
64
|
+
hasRequiredReactIs_development = 1;
|
|
164
65
|
|
|
165
|
-
function _arrayLikeToArray(arr, len) {
|
|
166
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
167
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
168
|
-
return arr2;
|
|
169
|
-
}
|
|
170
66
|
|
|
171
|
-
function _arrayWithoutHoles(arr) {
|
|
172
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
173
|
-
}
|
|
174
67
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
68
|
+
if (process.env.NODE_ENV !== "production") {
|
|
69
|
+
(function() {
|
|
178
70
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
71
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
72
|
+
// nor polyfill, then a plain number is used for performance.
|
|
73
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
74
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
75
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
76
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
77
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
78
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
79
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
80
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
81
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
187
82
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
83
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
84
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
85
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
86
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
87
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
88
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
89
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
90
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
91
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
92
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
93
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
191
94
|
|
|
192
|
-
function
|
|
193
|
-
|
|
194
|
-
|
|
95
|
+
function isValidElementType(type) {
|
|
96
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
97
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
98
|
+
}
|
|
195
99
|
|
|
196
|
-
function
|
|
197
|
-
|
|
198
|
-
|
|
100
|
+
function typeOf(object) {
|
|
101
|
+
if (typeof object === 'object' && object !== null) {
|
|
102
|
+
var $$typeof = object.$$typeof;
|
|
199
103
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
var e,
|
|
204
|
-
n,
|
|
205
|
-
i,
|
|
206
|
-
u,
|
|
207
|
-
a = [],
|
|
208
|
-
f = !0,
|
|
209
|
-
o = !1;
|
|
210
|
-
try {
|
|
211
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
212
|
-
if (Object(t) !== t) return;
|
|
213
|
-
f = !1;
|
|
214
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
215
|
-
} catch (r) {
|
|
216
|
-
o = !0, n = r;
|
|
217
|
-
} finally {
|
|
218
|
-
try {
|
|
219
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
220
|
-
} finally {
|
|
221
|
-
if (o) throw n;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return a;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
104
|
+
switch ($$typeof) {
|
|
105
|
+
case REACT_ELEMENT_TYPE:
|
|
106
|
+
var type = object.type;
|
|
227
107
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
108
|
+
switch (type) {
|
|
109
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
110
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
111
|
+
case REACT_FRAGMENT_TYPE:
|
|
112
|
+
case REACT_PROFILER_TYPE:
|
|
113
|
+
case REACT_STRICT_MODE_TYPE:
|
|
114
|
+
case REACT_SUSPENSE_TYPE:
|
|
115
|
+
return type;
|
|
231
116
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
117
|
+
default:
|
|
118
|
+
var $$typeofType = type && type.$$typeof;
|
|
235
119
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
120
|
+
switch ($$typeofType) {
|
|
121
|
+
case REACT_CONTEXT_TYPE:
|
|
122
|
+
case REACT_FORWARD_REF_TYPE:
|
|
123
|
+
case REACT_LAZY_TYPE:
|
|
124
|
+
case REACT_MEMO_TYPE:
|
|
125
|
+
case REACT_PROVIDER_TYPE:
|
|
126
|
+
return $$typeofType;
|
|
239
127
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return /*#__PURE__*/React.createElement(Callout, {
|
|
244
|
-
className: "flex flex-col items-center py-6",
|
|
245
|
-
style: "info"
|
|
246
|
-
}, /*#__PURE__*/React.createElement("ul", {
|
|
247
|
-
className: "list-outside list-disc space-y-1 font-normal leading-normal"
|
|
248
|
-
}, fileSize && /*#__PURE__*/React.createElement("li", null, t("neetoMolecules.shareViaLink.requirements.fileTypeAndSize", {
|
|
249
|
-
limit: fileSize
|
|
250
|
-
})), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Trans, {
|
|
251
|
-
components: {
|
|
252
|
-
strong: /*#__PURE__*/React.createElement("strong", {
|
|
253
|
-
className: "font-semibold"
|
|
254
|
-
})
|
|
255
|
-
},
|
|
256
|
-
i18nKey: "neetoMolecules.shareViaLink.requirements.shouldContainColumns"
|
|
257
|
-
}))), /*#__PURE__*/React.createElement(Button, {
|
|
258
|
-
href: DOWNLOAD_SAMPLE_EMAIL_CSV_FILE,
|
|
259
|
-
icon: Download,
|
|
260
|
-
iconPosition: "left",
|
|
261
|
-
label: t("neetoMolecules.shareViaLink.bulkUploadPane.downloadSampleCSV"),
|
|
262
|
-
style: "link"
|
|
263
|
-
}));
|
|
264
|
-
});
|
|
265
|
-
var Requirements$1 = /*#__PURE__*/React.memo(Requirements);
|
|
128
|
+
default:
|
|
129
|
+
return $$typeof;
|
|
130
|
+
}
|
|
266
131
|
|
|
267
|
-
|
|
268
|
-
var _fileRejections$;
|
|
269
|
-
var isOpen = _ref.isOpen,
|
|
270
|
-
fileType = _ref.fileType,
|
|
271
|
-
fileSize = _ref.fileSize,
|
|
272
|
-
onClose = _ref.onClose,
|
|
273
|
-
handleFileSubmit = _ref.handleFileSubmit;
|
|
274
|
-
var _useDropzone = useDropzone({
|
|
275
|
-
accept: fileType,
|
|
276
|
-
maxFiles: 1,
|
|
277
|
-
maxSize: fileSize * ONE_MEGABYTE_IN_BYTES,
|
|
278
|
-
onDrop: function onDrop(files) {
|
|
279
|
-
return files[0] && handleFileSubmit(files[0]);
|
|
280
|
-
}
|
|
281
|
-
}),
|
|
282
|
-
getRootProps = _useDropzone.getRootProps,
|
|
283
|
-
getInputProps = _useDropzone.getInputProps,
|
|
284
|
-
isDragActive = _useDropzone.isDragActive,
|
|
285
|
-
fileRejections = _useDropzone.fileRejections;
|
|
286
|
-
var errors = (_fileRejections$ = fileRejections[0]) === null || _fileRejections$ === void 0 ? void 0 : _fileRejections$.errors.map(function (_ref2) {
|
|
287
|
-
var message = _ref2.message,
|
|
288
|
-
code = _ref2.code;
|
|
289
|
-
return /*#__PURE__*/React.createElement(Typography, {
|
|
290
|
-
className: "neeto-ui-text-error-500 items",
|
|
291
|
-
"data-cy": "file-input-error-message",
|
|
292
|
-
key: code,
|
|
293
|
-
style: "body3"
|
|
294
|
-
}, message);
|
|
295
|
-
});
|
|
296
|
-
var _useTranslation = useTranslation(),
|
|
297
|
-
t = _useTranslation.t;
|
|
298
|
-
return /*#__PURE__*/React.createElement(Pane, {
|
|
299
|
-
"data-testid": "bulk-upload-pane",
|
|
300
|
-
isOpen: isOpen,
|
|
301
|
-
onClose: onClose
|
|
302
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
303
|
-
tabIndex: 0
|
|
304
|
-
}, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
305
|
-
"data-testid": "bulk-upload-header",
|
|
306
|
-
style: "h2",
|
|
307
|
-
weight: "semibold"
|
|
308
|
-
}, t("neetoMolecules.shareViaLink.bulkUpload"))), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
|
|
309
|
-
className: "w-full space-y-4"
|
|
310
|
-
}, /*#__PURE__*/React.createElement(Requirements$1, {
|
|
311
|
-
fileSize: fileSize
|
|
312
|
-
}), /*#__PURE__*/React.createElement("div", getRootProps({
|
|
313
|
-
className: classnames("flex flex-col p-2 border neeto-ui-border-primary-500 border-dashed neeto-ui-rounded-md transition duration-500 ease-in-out hover:neeto-ui-bg-gray-100 cursor-pointer items-center", {
|
|
314
|
-
"neeto-ui-border-gray-100": isDragActive,
|
|
315
|
-
"neeto-ui-border-error neeto-ui-bg-pastel-red hover:neeto-ui-bg-pastel-red": fileRejections.length
|
|
316
|
-
})
|
|
317
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
318
|
-
className: "flex flex-col items-center space-y-3 p-4"
|
|
319
|
-
}, /*#__PURE__*/React.createElement(Upload, {
|
|
320
|
-
className: "neeto-ui-text-primary-500",
|
|
321
|
-
size: 32
|
|
322
|
-
}), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
|
|
323
|
-
"data-cy": "csv-upload-input",
|
|
324
|
-
"data-testid": "csv-upload-input"
|
|
325
|
-
})), isDragActive ? /*#__PURE__*/React.createElement(Typography, {
|
|
326
|
-
style: "body2"
|
|
327
|
-
}, t("neetoMolecules.shareViaLink.bulkUploadPane.dropFileHere")) : /*#__PURE__*/React.createElement("div", {
|
|
328
|
-
className: "flex flex-col items-center space-y-1"
|
|
329
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
330
|
-
className: "flex w-full items-center justify-center gap-x-1"
|
|
331
|
-
}, /*#__PURE__*/React.createElement(Trans, {
|
|
332
|
-
i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.dragNDrop",
|
|
333
|
-
components: {
|
|
334
|
-
Button: /*#__PURE__*/React.createElement(Button, {
|
|
335
|
-
style: "link"
|
|
336
|
-
})
|
|
337
|
-
}
|
|
338
|
-
})), /*#__PURE__*/React.createElement(Typography, {
|
|
339
|
-
className: "neeto-ui-text-gray-700",
|
|
340
|
-
style: "body3"
|
|
341
|
-
}, fileType && /*#__PURE__*/React.createElement(Trans, {
|
|
342
|
-
i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.supportedFormat",
|
|
343
|
-
values: {
|
|
344
|
-
fileType: fileType
|
|
345
|
-
},
|
|
346
|
-
components: {
|
|
347
|
-
code: /*#__PURE__*/React.createElement("code", {
|
|
348
|
-
className: "neeto-ui-typography neeto-ui-text-body3 neeto-ui-bg-white m-0 border-l-0 p-0"
|
|
349
|
-
})
|
|
350
|
-
}
|
|
351
|
-
}), " ", fileSize && t("neetoMolecules.shareViaLink.bulkUploadPane.supportedSize", {
|
|
352
|
-
fileSize: fileSize
|
|
353
|
-
})))), errors))), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
354
|
-
className: "flex items-center space-x-2"
|
|
355
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
356
|
-
"data-cy": "bulk-upload-cancel-button",
|
|
357
|
-
"data-testid": "bulk-upload-cancel-button",
|
|
358
|
-
label: t("neetoMolecules.common.actions.cancel"),
|
|
359
|
-
style: "text",
|
|
360
|
-
type: "reset",
|
|
361
|
-
onClick: onClose
|
|
362
|
-
}))));
|
|
363
|
-
};
|
|
132
|
+
}
|
|
364
133
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
370
|
-
return emails.map(function (email) {
|
|
371
|
-
return {
|
|
372
|
-
label: email,
|
|
373
|
-
value: email,
|
|
374
|
-
valid: isValidEmail(email)
|
|
375
|
-
};
|
|
376
|
-
});
|
|
377
|
-
};
|
|
378
|
-
var parseCsvEmails = function parseCsvEmails(file, onSuccess) {
|
|
379
|
-
Papa.parse(file, {
|
|
380
|
-
header: true,
|
|
381
|
-
skipEmptyLines: true,
|
|
382
|
-
transformHeader: function transformHeader(h) {
|
|
383
|
-
return h.toLowerCase().replace(/\W/g, "");
|
|
384
|
-
},
|
|
385
|
-
complete: function complete(results) {
|
|
386
|
-
var _results$meta$fields;
|
|
387
|
-
var isEmailFieldPresent = (_results$meta$fields = results.meta.fields) === null || _results$meta$fields === void 0 ? void 0 : _results$meta$fields.includes("email");
|
|
388
|
-
if (isEmailFieldPresent) {
|
|
389
|
-
var emails = results.data.filter(prop("email")).map(function (item) {
|
|
390
|
-
return item.email.trim();
|
|
391
|
-
});
|
|
392
|
-
onSuccess(createEmailOptions(emails));
|
|
393
|
-
} else {
|
|
394
|
-
Toastr.error(t("neetoMolecules.sendToFields.errors.invalidCsv"));
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
var SendToFields = function SendToFields(_ref) {
|
|
401
|
-
var emailInputProps = _ref.emailInputProps,
|
|
402
|
-
ccInputProps = _ref.ccInputProps,
|
|
403
|
-
bccInputProps = _ref.bccInputProps,
|
|
404
|
-
_ref$showUploadCsvBut = _ref.showUploadCsvButton,
|
|
405
|
-
showUploadCsvButton = _ref$showUploadCsvBut === void 0 ? false : _ref$showUploadCsvBut,
|
|
406
|
-
_ref$showCcBccButton = _ref.showCcBccButton,
|
|
407
|
-
showCcBccButton = _ref$showCcBccButton === void 0 ? false : _ref$showCcBccButton;
|
|
408
|
-
var _useState = useState(false),
|
|
409
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
410
|
-
isBulkUploadPaneOpen = _useState2[0],
|
|
411
|
-
setIsBulkUploadPaneOpen = _useState2[1];
|
|
412
|
-
var sendToFieldRef = useRef();
|
|
413
|
-
var _useFormikContext = useFormikContext(),
|
|
414
|
-
_useFormikContext$val = _useFormikContext.values,
|
|
415
|
-
showCopyEmails = _useFormikContext$val.showCopyEmails,
|
|
416
|
-
existingSendToEmails = _useFormikContext$val[emailInputProps.name || "sendTo"],
|
|
417
|
-
setFieldValue = _useFormikContext.setFieldValue;
|
|
418
|
-
var _useTranslation = useTranslation(),
|
|
419
|
-
t = _useTranslation.t;
|
|
420
|
-
var handleCSVFile = function handleCSVFile(file) {
|
|
421
|
-
try {
|
|
422
|
-
var _sendToFieldRef$curre;
|
|
423
|
-
var onSuccess = function onSuccess(values) {
|
|
424
|
-
return setFieldValue(emailInputProps.name || "sendTo", [].concat(_toConsumableArray(existingSendToEmails), _toConsumableArray(values)));
|
|
425
|
-
};
|
|
426
|
-
parseCsvEmails(file, onSuccess);
|
|
427
|
-
setIsBulkUploadPaneOpen(false);
|
|
428
|
-
(_sendToFieldRef$curre = sendToFieldRef.current) === null || _sendToFieldRef$curre === void 0 ? void 0 : _sendToFieldRef$curre.focus();
|
|
429
|
-
} catch (error) {
|
|
430
|
-
Toastr.error(error);
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
var handelCcBccButtonClick = function handelCcBccButtonClick(e) {
|
|
434
|
-
e.stopPropagation();
|
|
435
|
-
setFieldValue("showCopyEmails", !showCopyEmails);
|
|
436
|
-
};
|
|
437
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
438
|
-
className: "relative w-full flex-col gap-2"
|
|
439
|
-
}, showUploadCsvButton && /*#__PURE__*/React.createElement(Button, {
|
|
440
|
-
className: "absolute top-0 right-1",
|
|
441
|
-
"data-testid": "bulk-upload-button",
|
|
442
|
-
icon: Upload,
|
|
443
|
-
label: t("neetoMolecules.shareViaLink.bulkUpload"),
|
|
444
|
-
size: "small",
|
|
445
|
-
style: "link",
|
|
446
|
-
onClick: function onClick() {
|
|
447
|
-
return setIsBulkUploadPaneOpen(true);
|
|
448
|
-
}
|
|
449
|
-
}), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
450
|
-
"data-testid": "emails",
|
|
451
|
-
name: "sendTo",
|
|
452
|
-
ref: sendToFieldRef
|
|
453
|
-
}, emailInputProps, {
|
|
454
|
-
suffix: showCcBccButton && /*#__PURE__*/React.createElement(Button, {
|
|
455
|
-
"data-cy": "cc-bcc-button",
|
|
456
|
-
"data-testid": "cc-bcc-button",
|
|
457
|
-
label: t("neetoMolecules.emailForm.labels.ccBcc"),
|
|
458
|
-
size: "small",
|
|
459
|
-
style: "link",
|
|
460
|
-
onClick: handelCcBccButtonClick
|
|
461
|
-
})
|
|
462
|
-
})), showCopyEmails && /*#__PURE__*/React.createElement("div", {
|
|
463
|
-
className: "mt-5 flex w-full flex-col gap-6"
|
|
464
|
-
}, /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
465
|
-
name: "sendToBcc"
|
|
466
|
-
}, ccInputProps)), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
467
|
-
name: "sendToCc"
|
|
468
|
-
}, bccInputProps))), /*#__PURE__*/React.createElement(BulkUploadPane, {
|
|
469
|
-
fileSize: globalProps.endUserUploadedFileSizeLimitInMb,
|
|
470
|
-
fileType: ALLOWED_FILE_TYPES,
|
|
471
|
-
handleFileSubmit: handleCSVFile,
|
|
472
|
-
isOpen: isBulkUploadPaneOpen,
|
|
473
|
-
onClose: function onClose() {
|
|
474
|
-
return setIsBulkUploadPaneOpen(false);
|
|
475
|
-
}
|
|
476
|
-
}));
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
var SendToField = withT(function (_ref) {
|
|
480
|
-
var t = _ref.t;
|
|
481
|
-
return /*#__PURE__*/React.createElement(SendToFields, {
|
|
482
|
-
showCcBccButton: true,
|
|
483
|
-
showUploadCsvButton: true,
|
|
484
|
-
bccInputProps: {
|
|
485
|
-
label: t("neetoMolecules.emailForm.labels.bCc"),
|
|
486
|
-
name: "sendToBcc",
|
|
487
|
-
placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
|
|
488
|
-
},
|
|
489
|
-
ccInputProps: {
|
|
490
|
-
label: t("neetoMolecules.emailForm.labels.cc"),
|
|
491
|
-
name: "sendToCc",
|
|
492
|
-
placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
|
|
493
|
-
},
|
|
494
|
-
emailInputProps: {
|
|
495
|
-
id: "sendTo",
|
|
496
|
-
name: "sendTo",
|
|
497
|
-
label: t("neetoMolecules.emailForm.labels.sendTo"),
|
|
498
|
-
placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails"),
|
|
499
|
-
required: true
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
var SubjectField = function SubjectField(_ref) {
|
|
505
|
-
var name = _ref.name,
|
|
506
|
-
text = _ref.text,
|
|
507
|
-
updateText = _ref.updateText,
|
|
508
|
-
_ref$subjectVariables = _ref.subjectVariables,
|
|
509
|
-
subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
|
|
510
|
-
error = _ref.error,
|
|
511
|
-
_ref$required = _ref.required,
|
|
512
|
-
required = _ref$required === void 0 ? false : _ref$required;
|
|
513
|
-
var _useState = useState(false),
|
|
514
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
515
|
-
isFieldFocusedOnce = _useState2[0],
|
|
516
|
-
setIsFieldFocusedOnce = _useState2[1];
|
|
517
|
-
var _useTranslation = useTranslation(),
|
|
518
|
-
t = _useTranslation.t;
|
|
519
|
-
var tagClickHandler = function tagClickHandler(_ref2) {
|
|
520
|
-
var slug = _ref2.key;
|
|
521
|
-
var textAreaElement = document.querySelector("textarea[name=".concat(name, "]"));
|
|
522
|
-
var splitIndex = isFieldFocusedOnce && textAreaElement ? textAreaElement.selectionEnd : text.length;
|
|
523
|
-
var updatedSubject = [text.slice(0, splitIndex), " {{".concat(slug, "}}"), text.slice(splitIndex)].join("");
|
|
524
|
-
updateText(updatedSubject);
|
|
525
|
-
};
|
|
526
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input$1, {
|
|
527
|
-
error: error,
|
|
528
|
-
name: name,
|
|
529
|
-
required: required,
|
|
530
|
-
label: t("neetoMolecules.emailForm.labels.subject"),
|
|
531
|
-
size: "large",
|
|
532
|
-
value: text,
|
|
533
|
-
suffix: /*#__PURE__*/React.createElement(DynamicVariables, {
|
|
534
|
-
variables: subjectVariables,
|
|
535
|
-
dropdownProps: {
|
|
536
|
-
className: "neeto-ui-dropdown__popup overflow-y-auto",
|
|
537
|
-
buttonSize: "small"
|
|
538
|
-
},
|
|
539
|
-
onVariableClick: tagClickHandler
|
|
540
|
-
}),
|
|
541
|
-
onChange: withEventTargetValue(updateText),
|
|
542
|
-
onFocus: function onFocus() {
|
|
543
|
-
return setIsFieldFocusedOnce(true);
|
|
544
|
-
}
|
|
545
|
-
}), /*#__PURE__*/React.createElement(Typography, {
|
|
546
|
-
className: "neeto-ui-text-gray-600 mt-2",
|
|
547
|
-
"data-cy": "subject-input-variable-label",
|
|
548
|
-
style: "body3"
|
|
549
|
-
}, /*#__PURE__*/React.createElement(Trans, {
|
|
550
|
-
components: {
|
|
551
|
-
span: /*#__PURE__*/React.createElement("span", {
|
|
552
|
-
className: "font-semibold"
|
|
553
|
-
})
|
|
554
|
-
},
|
|
555
|
-
i18nKey: "neetoMolecules.emailForm.helpText",
|
|
556
|
-
values: {
|
|
557
|
-
type: "subject"
|
|
558
|
-
}
|
|
559
|
-
})));
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
var EmailForm = function EmailForm(_ref) {
|
|
563
|
-
var _ref$messageVariables = _ref.messageVariables,
|
|
564
|
-
messageVariables = _ref$messageVariables === void 0 ? [] : _ref$messageVariables,
|
|
565
|
-
_ref$subjectVariables = _ref.subjectVariables,
|
|
566
|
-
subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
|
|
567
|
-
handleCancel = _ref.handleCancel,
|
|
568
|
-
isLoading = _ref.isLoading,
|
|
569
|
-
_ref$replyToOptions = _ref.replyToOptions,
|
|
570
|
-
replyToOptions = _ref$replyToOptions === void 0 ? [] : _ref$replyToOptions,
|
|
571
|
-
_ref$sendToOptions = _ref.sendToOptions,
|
|
572
|
-
sendToOptions = _ref$sendToOptions === void 0 ? [] : _ref$sendToOptions,
|
|
573
|
-
_ref$isUpdating = _ref.isUpdating,
|
|
574
|
-
isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating,
|
|
575
|
-
_ref$showFields = _ref.showFields,
|
|
576
|
-
showFields = _ref$showFields === void 0 ? true : _ref$showFields,
|
|
577
|
-
_ref$className = _ref.className,
|
|
578
|
-
className = _ref$className === void 0 ? "" : _ref$className;
|
|
579
|
-
var _useTranslation = useTranslation(),
|
|
580
|
-
t = _useTranslation.t;
|
|
581
|
-
var _useContext = useContext(EmailFormContext),
|
|
582
|
-
showSendToField = _useContext.showSendToField,
|
|
583
|
-
showSendToAsRadio = _useContext.showSendToAsRadio,
|
|
584
|
-
showReplyToField = _useContext.showReplyToField;
|
|
585
|
-
var _useFormikContext = useFormikContext(),
|
|
586
|
-
setFieldValue = _useFormikContext.setFieldValue,
|
|
587
|
-
dirty = _useFormikContext.dirty;
|
|
588
|
-
var showSendToRadioField = showSendToField && showSendToAsRadio && isNotEmpty(sendToOptions);
|
|
589
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
590
|
-
"data-testid": "email-form",
|
|
591
|
-
className: classnames("flex flex-1 flex-col items-start gap-2", _defineProperty({}, className, className))
|
|
592
|
-
}, showFields && /*#__PURE__*/React.createElement("div", {
|
|
593
|
-
className: "flex w-full flex-col items-start justify-start gap-6"
|
|
594
|
-
}, /*#__PURE__*/React.createElement(Field, {
|
|
595
|
-
name: "subject"
|
|
596
|
-
}, function (_ref2) {
|
|
597
|
-
var value = _ref2.field.value,
|
|
598
|
-
error = _ref2.meta.error;
|
|
599
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
600
|
-
className: "w-full"
|
|
601
|
-
}, /*#__PURE__*/React.createElement(SubjectField, {
|
|
602
|
-
error: t(error),
|
|
603
|
-
name: "subject",
|
|
604
|
-
subjectVariables: subjectVariables,
|
|
605
|
-
required: true,
|
|
606
|
-
text: value,
|
|
607
|
-
updateText: function updateText(text) {
|
|
608
|
-
return setFieldValue("subject", text);
|
|
609
|
-
}
|
|
610
|
-
}));
|
|
611
|
-
}), showSendToRadioField ? /*#__PURE__*/React.createElement(Radio, {
|
|
612
|
-
"data-testid": "send-to-id",
|
|
613
|
-
label: t("neetoMolecules.emailForm.labels.sendTo"),
|
|
614
|
-
labelProps: {
|
|
615
|
-
required: true
|
|
616
|
-
},
|
|
617
|
-
name: "sendToId"
|
|
618
|
-
}, sendToOptions.map(function (_ref3) {
|
|
619
|
-
var label = _ref3.label,
|
|
620
|
-
value = _ref3.value;
|
|
621
|
-
return /*#__PURE__*/React.createElement(Radio.Item, {
|
|
622
|
-
label: label,
|
|
623
|
-
value: value,
|
|
624
|
-
key: value
|
|
625
|
-
});
|
|
626
|
-
})) : /*#__PURE__*/React.createElement(SendToField, null), showReplyToField && /*#__PURE__*/React.createElement(ReplyToField, {
|
|
627
|
-
replyToOptions: replyToOptions
|
|
628
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
629
|
-
className: "w-full"
|
|
630
|
-
}, /*#__PURE__*/React.createElement(FormikEditor, {
|
|
631
|
-
isMenuCollapsible: true,
|
|
632
|
-
required: true,
|
|
633
|
-
addons: EDITOR_ADDONS,
|
|
634
|
-
"data-cy": "message-input-field",
|
|
635
|
-
id: "form_message",
|
|
636
|
-
label: t("neetoMolecules.emailForm.labels.message"),
|
|
637
|
-
name: "message",
|
|
638
|
-
variables: messageVariables
|
|
639
|
-
}), /*#__PURE__*/React.createElement(Typography, {
|
|
640
|
-
className: "neeto-ui-text-gray-500 mt-2",
|
|
641
|
-
"data-cy": "message-input-variable-label",
|
|
642
|
-
style: "body3"
|
|
643
|
-
}, /*#__PURE__*/React.createElement(Trans, {
|
|
644
|
-
i18nKey: "neetoMolecules.emailForm.helpText",
|
|
645
|
-
values: {
|
|
646
|
-
type: "message"
|
|
647
|
-
},
|
|
648
|
-
components: {
|
|
649
|
-
span: /*#__PURE__*/React.createElement("span", {
|
|
650
|
-
className: "font-semibold"
|
|
651
|
-
})
|
|
652
|
-
}
|
|
653
|
-
})))), /*#__PURE__*/React.createElement(ActionBlock, {
|
|
654
|
-
className: "mt-6 w-full justify-start",
|
|
655
|
-
cancelButtonProps: {
|
|
656
|
-
disabled: false,
|
|
657
|
-
onClick: handleCancel,
|
|
658
|
-
className: "ml-3"
|
|
659
|
-
},
|
|
660
|
-
submitButtonProps: {
|
|
661
|
-
loading: isLoading,
|
|
662
|
-
disabled: !dirty || isUpdating
|
|
663
|
-
}
|
|
664
|
-
}));
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
var getValidationSchema = function getValidationSchema(_ref) {
|
|
668
|
-
var showSendToField = _ref.showSendToField,
|
|
669
|
-
showReplyToField = _ref.showReplyToField,
|
|
670
|
-
showSendToAsRadio = _ref.showSendToAsRadio,
|
|
671
|
-
customValidations = _ref.customValidations;
|
|
672
|
-
var schema = EMAIL_FORM_VALIDATION_SCHEMA.clone();
|
|
673
|
-
if (showSendToField) {
|
|
674
|
-
schema = schema.concat(showSendToAsRadio ? SEND_TO_ID_FIELD_VALIDATION : SEND_TO_FIELD_VALIDATION);
|
|
675
|
-
}
|
|
676
|
-
if (showReplyToField) schema = schema.concat(REPLY_TO_FIELD_VALIDATION);
|
|
677
|
-
return schema.shape(customValidations);
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
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; }
|
|
681
|
-
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; }
|
|
682
|
-
var EmailFormProvider = function EmailFormProvider(_ref) {
|
|
683
|
-
var _ref$onSubmit = _ref.onSubmit,
|
|
684
|
-
onSubmit = _ref$onSubmit === void 0 ? noop : _ref$onSubmit,
|
|
685
|
-
_ref$initialValues = _ref.initialValues,
|
|
686
|
-
initialValues = _ref$initialValues === void 0 ? INITIAL_FORM_VALUES : _ref$initialValues,
|
|
687
|
-
children = _ref.children,
|
|
688
|
-
formikProps = _ref.formikProps,
|
|
689
|
-
_ref$validationSchema = _ref.validationSchema,
|
|
690
|
-
customValidations = _ref$validationSchema === void 0 ? {} : _ref$validationSchema,
|
|
691
|
-
_ref$showSendToField = _ref.showSendToField,
|
|
692
|
-
showSendToField = _ref$showSendToField === void 0 ? false : _ref$showSendToField,
|
|
693
|
-
_ref$showReplyToField = _ref.showReplyToField,
|
|
694
|
-
showReplyToField = _ref$showReplyToField === void 0 ? false : _ref$showReplyToField,
|
|
695
|
-
_ref$showSendToAsRadi = _ref.showSendToAsRadio,
|
|
696
|
-
showSendToAsRadio = _ref$showSendToAsRadi === void 0 ? false : _ref$showSendToAsRadi;
|
|
697
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
698
|
-
"data-testid": "email-form-provider"
|
|
699
|
-
}, /*#__PURE__*/React.createElement(EmailFormContext.Provider, {
|
|
700
|
-
value: {
|
|
701
|
-
showSendToField: showSendToField,
|
|
702
|
-
showSendToAsRadio: showSendToAsRadio,
|
|
703
|
-
showReplyToField: showReplyToField
|
|
704
|
-
}
|
|
705
|
-
}, /*#__PURE__*/React.createElement(Form, {
|
|
706
|
-
formikProps: _objectSpread({
|
|
707
|
-
enableReinitialize: true,
|
|
708
|
-
validationSchema: getValidationSchema({
|
|
709
|
-
showSendToField: showSendToField,
|
|
710
|
-
showReplyToField: showReplyToField,
|
|
711
|
-
showSendToAsRadio: showSendToAsRadio,
|
|
712
|
-
customValidations: customValidations
|
|
713
|
-
}),
|
|
714
|
-
initialValues: _objectSpread(_objectSpread({}, initialValues), {}, {
|
|
715
|
-
replyTo: initialValues.replyTo || globalProps.user.email
|
|
716
|
-
}),
|
|
717
|
-
onSubmit: onSubmit
|
|
718
|
-
}, formikProps)
|
|
719
|
-
}, children)));
|
|
720
|
-
};
|
|
721
|
-
|
|
722
|
-
var propTypes = {exports: {}};
|
|
723
|
-
|
|
724
|
-
var reactIs = {exports: {}};
|
|
725
|
-
|
|
726
|
-
var reactIs_production_min = {};
|
|
727
|
-
|
|
728
|
-
/** @license React v16.13.1
|
|
729
|
-
* react-is.production.min.js
|
|
730
|
-
*
|
|
731
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
732
|
-
*
|
|
733
|
-
* This source code is licensed under the MIT license found in the
|
|
734
|
-
* LICENSE file in the root directory of this source tree.
|
|
735
|
-
*/
|
|
736
|
-
|
|
737
|
-
var hasRequiredReactIs_production_min;
|
|
738
|
-
|
|
739
|
-
function requireReactIs_production_min () {
|
|
740
|
-
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
741
|
-
hasRequiredReactIs_production_min = 1;
|
|
742
|
-
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
743
|
-
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
744
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
745
|
-
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
746
|
-
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
747
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
748
|
-
return reactIs_production_min;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
var reactIs_development = {};
|
|
752
|
-
|
|
753
|
-
/** @license React v16.13.1
|
|
754
|
-
* react-is.development.js
|
|
755
|
-
*
|
|
756
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
757
|
-
*
|
|
758
|
-
* This source code is licensed under the MIT license found in the
|
|
759
|
-
* LICENSE file in the root directory of this source tree.
|
|
760
|
-
*/
|
|
761
|
-
|
|
762
|
-
var hasRequiredReactIs_development;
|
|
763
|
-
|
|
764
|
-
function requireReactIs_development () {
|
|
765
|
-
if (hasRequiredReactIs_development) return reactIs_development;
|
|
766
|
-
hasRequiredReactIs_development = 1;
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
if (process.env.NODE_ENV !== "production") {
|
|
771
|
-
(function() {
|
|
772
|
-
|
|
773
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
774
|
-
// nor polyfill, then a plain number is used for performance.
|
|
775
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
776
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
777
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
778
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
779
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
780
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
781
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
782
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
783
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
784
|
-
|
|
785
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
786
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
787
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
788
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
789
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
790
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
791
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
792
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
793
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
794
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
795
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
796
|
-
|
|
797
|
-
function isValidElementType(type) {
|
|
798
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
799
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
function typeOf(object) {
|
|
803
|
-
if (typeof object === 'object' && object !== null) {
|
|
804
|
-
var $$typeof = object.$$typeof;
|
|
805
|
-
|
|
806
|
-
switch ($$typeof) {
|
|
807
|
-
case REACT_ELEMENT_TYPE:
|
|
808
|
-
var type = object.type;
|
|
809
|
-
|
|
810
|
-
switch (type) {
|
|
811
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
812
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
813
|
-
case REACT_FRAGMENT_TYPE:
|
|
814
|
-
case REACT_PROFILER_TYPE:
|
|
815
|
-
case REACT_STRICT_MODE_TYPE:
|
|
816
|
-
case REACT_SUSPENSE_TYPE:
|
|
817
|
-
return type;
|
|
818
|
-
|
|
819
|
-
default:
|
|
820
|
-
var $$typeofType = type && type.$$typeof;
|
|
821
|
-
|
|
822
|
-
switch ($$typeofType) {
|
|
823
|
-
case REACT_CONTEXT_TYPE:
|
|
824
|
-
case REACT_FORWARD_REF_TYPE:
|
|
825
|
-
case REACT_LAZY_TYPE:
|
|
826
|
-
case REACT_MEMO_TYPE:
|
|
827
|
-
case REACT_PROVIDER_TYPE:
|
|
828
|
-
return $$typeofType;
|
|
829
|
-
|
|
830
|
-
default:
|
|
831
|
-
return $$typeof;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
case REACT_PORTAL_TYPE:
|
|
837
|
-
return $$typeof;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
134
|
+
case REACT_PORTAL_TYPE:
|
|
135
|
+
return $$typeof;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
840
138
|
|
|
841
139
|
return undefined;
|
|
842
140
|
} // AsyncMode is deprecated along with isAsyncMode
|
|
@@ -1711,315 +1009,1017 @@ function requireFactoryWithTypeCheckers () {
|
|
|
1711
1009
|
return false;
|
|
1712
1010
|
}
|
|
1713
1011
|
|
|
1714
|
-
return true;
|
|
1715
|
-
default:
|
|
1716
|
-
return false;
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1012
|
+
return true;
|
|
1013
|
+
default:
|
|
1014
|
+
return false;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
function isSymbol(propType, propValue) {
|
|
1019
|
+
// Native Symbol.
|
|
1020
|
+
if (propType === 'symbol') {
|
|
1021
|
+
return true;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// falsy value can't be a Symbol
|
|
1025
|
+
if (!propValue) {
|
|
1026
|
+
return false;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1030
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1031
|
+
return true;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1035
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1036
|
+
return true;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1043
|
+
function getPropType(propValue) {
|
|
1044
|
+
var propType = typeof propValue;
|
|
1045
|
+
if (Array.isArray(propValue)) {
|
|
1046
|
+
return 'array';
|
|
1047
|
+
}
|
|
1048
|
+
if (propValue instanceof RegExp) {
|
|
1049
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1050
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1051
|
+
// passes PropTypes.object.
|
|
1052
|
+
return 'object';
|
|
1053
|
+
}
|
|
1054
|
+
if (isSymbol(propType, propValue)) {
|
|
1055
|
+
return 'symbol';
|
|
1056
|
+
}
|
|
1057
|
+
return propType;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1061
|
+
// See `createPrimitiveTypeChecker`.
|
|
1062
|
+
function getPreciseType(propValue) {
|
|
1063
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1064
|
+
return '' + propValue;
|
|
1065
|
+
}
|
|
1066
|
+
var propType = getPropType(propValue);
|
|
1067
|
+
if (propType === 'object') {
|
|
1068
|
+
if (propValue instanceof Date) {
|
|
1069
|
+
return 'date';
|
|
1070
|
+
} else if (propValue instanceof RegExp) {
|
|
1071
|
+
return 'regexp';
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
return propType;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1078
|
+
// For example, "undefined" or "of type array"
|
|
1079
|
+
function getPostfixForTypeWarning(value) {
|
|
1080
|
+
var type = getPreciseType(value);
|
|
1081
|
+
switch (type) {
|
|
1082
|
+
case 'array':
|
|
1083
|
+
case 'object':
|
|
1084
|
+
return 'an ' + type;
|
|
1085
|
+
case 'boolean':
|
|
1086
|
+
case 'date':
|
|
1087
|
+
case 'regexp':
|
|
1088
|
+
return 'a ' + type;
|
|
1089
|
+
default:
|
|
1090
|
+
return type;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// Returns class name of the object, if any.
|
|
1095
|
+
function getClassName(propValue) {
|
|
1096
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1097
|
+
return ANONYMOUS;
|
|
1098
|
+
}
|
|
1099
|
+
return propValue.constructor.name;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1103
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1104
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1105
|
+
|
|
1106
|
+
return ReactPropTypes;
|
|
1107
|
+
};
|
|
1108
|
+
return factoryWithTypeCheckers;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1113
|
+
*
|
|
1114
|
+
* This source code is licensed under the MIT license found in the
|
|
1115
|
+
* LICENSE file in the root directory of this source tree.
|
|
1116
|
+
*/
|
|
1117
|
+
|
|
1118
|
+
var factoryWithThrowingShims;
|
|
1119
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
1120
|
+
|
|
1121
|
+
function requireFactoryWithThrowingShims () {
|
|
1122
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1123
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
1124
|
+
|
|
1125
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
1126
|
+
|
|
1127
|
+
function emptyFunction() {}
|
|
1128
|
+
function emptyFunctionWithReset() {}
|
|
1129
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1130
|
+
|
|
1131
|
+
factoryWithThrowingShims = function() {
|
|
1132
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1133
|
+
if (secret === ReactPropTypesSecret) {
|
|
1134
|
+
// It is still safe when called from React.
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
var err = new Error(
|
|
1138
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1139
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1140
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
1141
|
+
);
|
|
1142
|
+
err.name = 'Invariant Violation';
|
|
1143
|
+
throw err;
|
|
1144
|
+
} shim.isRequired = shim;
|
|
1145
|
+
function getShim() {
|
|
1146
|
+
return shim;
|
|
1147
|
+
} // Important!
|
|
1148
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1149
|
+
var ReactPropTypes = {
|
|
1150
|
+
array: shim,
|
|
1151
|
+
bigint: shim,
|
|
1152
|
+
bool: shim,
|
|
1153
|
+
func: shim,
|
|
1154
|
+
number: shim,
|
|
1155
|
+
object: shim,
|
|
1156
|
+
string: shim,
|
|
1157
|
+
symbol: shim,
|
|
1158
|
+
|
|
1159
|
+
any: shim,
|
|
1160
|
+
arrayOf: getShim,
|
|
1161
|
+
element: shim,
|
|
1162
|
+
elementType: shim,
|
|
1163
|
+
instanceOf: getShim,
|
|
1164
|
+
node: shim,
|
|
1165
|
+
objectOf: getShim,
|
|
1166
|
+
oneOf: getShim,
|
|
1167
|
+
oneOfType: getShim,
|
|
1168
|
+
shape: getShim,
|
|
1169
|
+
exact: getShim,
|
|
1170
|
+
|
|
1171
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1172
|
+
resetWarningCache: emptyFunction
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1176
|
+
|
|
1177
|
+
return ReactPropTypes;
|
|
1178
|
+
};
|
|
1179
|
+
return factoryWithThrowingShims;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1184
|
+
*
|
|
1185
|
+
* This source code is licensed under the MIT license found in the
|
|
1186
|
+
* LICENSE file in the root directory of this source tree.
|
|
1187
|
+
*/
|
|
1188
|
+
|
|
1189
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1190
|
+
var ReactIs = requireReactIs();
|
|
1191
|
+
|
|
1192
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1193
|
+
// http://fb.me/prop-types-in-prod
|
|
1194
|
+
var throwOnDirectAccess = true;
|
|
1195
|
+
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
1196
|
+
} else {
|
|
1197
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1198
|
+
// http://fb.me/prop-types-in-prod
|
|
1199
|
+
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
|
|
1203
|
+
var EmailPreview = withT(function (_ref) {
|
|
1204
|
+
var t = _ref.t,
|
|
1205
|
+
_ref$to = _ref.to,
|
|
1206
|
+
to = _ref$to === void 0 ? [] : _ref$to,
|
|
1207
|
+
from = _ref.from,
|
|
1208
|
+
subject = _ref.subject,
|
|
1209
|
+
body = _ref.body,
|
|
1210
|
+
productName = _ref.productName,
|
|
1211
|
+
actionButtonText = _ref.actionButtonText,
|
|
1212
|
+
logo = _ref.logo,
|
|
1213
|
+
_ref$className = _ref.className,
|
|
1214
|
+
className = _ref$className === void 0 ? "" : _ref$className;
|
|
1215
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1216
|
+
"data-cy": "email-preview-card",
|
|
1217
|
+
"data-testid": "email-preview",
|
|
1218
|
+
className: classnames("neeto-ui-border-gray-300 neeto-ui-shadow-m neeto-ui-bg-white flex flex-1 flex-col border", className)
|
|
1219
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1220
|
+
className: "neeto-ui-border-gray-300 space-y-3 divide-y divide-gray-200 border-b p-6"
|
|
1221
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1222
|
+
className: "flex gap-2",
|
|
1223
|
+
"data-cy": "email-send-to-preview",
|
|
1224
|
+
"data-testid": "email-to-block"
|
|
1225
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
1226
|
+
className: "neeto-ui-text-gray-500",
|
|
1227
|
+
lineHeight: "normal",
|
|
1228
|
+
style: "body2"
|
|
1229
|
+
}, t("neetoMolecules.emailPreview.to"), ":"), isPresent(to) ? /*#__PURE__*/React.createElement(Typography, {
|
|
1230
|
+
className: "neeto-ui-text-gray-800 min-w-0 flex-grow break-words",
|
|
1231
|
+
lineHeight: "normal",
|
|
1232
|
+
style: "body2"
|
|
1233
|
+
}, to.join(", ")) : /*#__PURE__*/React.createElement("div", {
|
|
1234
|
+
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full mt-2 h-2 w-40"
|
|
1235
|
+
})), from && /*#__PURE__*/React.createElement("div", {
|
|
1236
|
+
className: "flex items-center gap-2 pt-3"
|
|
1237
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
1238
|
+
className: "neeto-ui-text-gray-500",
|
|
1239
|
+
lineHeight: "normal",
|
|
1240
|
+
style: "body2"
|
|
1241
|
+
}, t("neetoMolecules.emailPreview.from"), ":"), /*#__PURE__*/React.createElement(Typography, {
|
|
1242
|
+
className: "neeto-ui-text-gray-800 min-w-0 flex-grow break-words",
|
|
1243
|
+
"data-cy": "email-send-from-preview",
|
|
1244
|
+
lineHeight: "normal",
|
|
1245
|
+
style: "body2"
|
|
1246
|
+
}, from)), /*#__PURE__*/React.createElement("div", {
|
|
1247
|
+
className: "flex items-center gap-2 pt-3"
|
|
1248
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
1249
|
+
className: "neeto-ui-text-gray-500",
|
|
1250
|
+
lineHeight: "normal",
|
|
1251
|
+
style: "body2"
|
|
1252
|
+
}, t("neetoMolecules.emailPreview.subject"), ":"), /*#__PURE__*/React.createElement(Typography, {
|
|
1253
|
+
className: "neeto-ui-text-gray-800 min-w-0 flex-grow break-words",
|
|
1254
|
+
"data-cy": "email-subject-preview",
|
|
1255
|
+
lineHeight: "normal",
|
|
1256
|
+
style: "body2"
|
|
1257
|
+
}, subject || /*#__PURE__*/React.createElement("span", {
|
|
1258
|
+
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-40"
|
|
1259
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
1260
|
+
className: "neeto-ui-text-gray-800 flex flex-1 flex-col justify-between space-y-6 p-6 pr-10 text-base leading-relaxed",
|
|
1261
|
+
"data-cy": "email-body-preview-container"
|
|
1262
|
+
}, body ? /*#__PURE__*/React.createElement(MemoizedEditorContent, {
|
|
1263
|
+
content: body
|
|
1264
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
1265
|
+
className: "space-y-4"
|
|
1266
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1267
|
+
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-80 max-w-full"
|
|
1268
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1269
|
+
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-72 max-w-full"
|
|
1270
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1271
|
+
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-80 max-w-full"
|
|
1272
|
+
})), actionButtonText && /*#__PURE__*/React.createElement("div", {
|
|
1273
|
+
className: "mt-6 flex w-full items-center justify-center"
|
|
1274
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1275
|
+
className: "pointer-events-none",
|
|
1276
|
+
label: actionButtonText
|
|
1277
|
+
})), logo && /*#__PURE__*/React.createElement("img", {
|
|
1278
|
+
alt: t("neetoMolecules.emailPreview.logoAltText"),
|
|
1279
|
+
className: "h-20 w-36 object-cover",
|
|
1280
|
+
"data-cy": "company-logo-preview",
|
|
1281
|
+
src: logo
|
|
1282
|
+
})), productName && /*#__PURE__*/React.createElement("div", {
|
|
1283
|
+
className: "neeto-ui-bg-gray-100 mt-auto p-2",
|
|
1284
|
+
"data-testid": "product-name-block"
|
|
1285
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
1286
|
+
className: "neeto-ui-text-gray-600 text-center leading-6",
|
|
1287
|
+
style: "body3"
|
|
1288
|
+
}, t("neetoMolecules.emailPreview.poweredBy"), /*#__PURE__*/React.createElement("span", {
|
|
1289
|
+
className: "neeto-ui-text-gray-800 font-medium"
|
|
1290
|
+
}, productName))));
|
|
1291
|
+
});
|
|
1292
|
+
EmailPreview.propTypes = {
|
|
1293
|
+
/**
|
|
1294
|
+
* The value of the send-to field.
|
|
1295
|
+
*/
|
|
1296
|
+
to: propTypes.exports.arrayOf(propTypes.exports.string),
|
|
1297
|
+
/**
|
|
1298
|
+
* The value of the send-from field.
|
|
1299
|
+
*/
|
|
1300
|
+
from: propTypes.exports.string,
|
|
1301
|
+
/**
|
|
1302
|
+
* The subject of the email.
|
|
1303
|
+
*/
|
|
1304
|
+
subject: propTypes.exports.string,
|
|
1305
|
+
/**
|
|
1306
|
+
* The body of the email.
|
|
1307
|
+
*/
|
|
1308
|
+
body: propTypes.exports.string,
|
|
1309
|
+
/**
|
|
1310
|
+
* The name of the neeto product to be previewed.
|
|
1311
|
+
*/
|
|
1312
|
+
productName: propTypes.exports.string,
|
|
1313
|
+
/**
|
|
1314
|
+
* The text to be shown in the action button.
|
|
1315
|
+
*/
|
|
1316
|
+
actionButtonText: propTypes.exports.string,
|
|
1317
|
+
/**
|
|
1318
|
+
* Source link for the company logo.
|
|
1319
|
+
*/
|
|
1320
|
+
logo: propTypes.exports.string
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
function _typeof(o) {
|
|
1324
|
+
"@babel/helpers - typeof";
|
|
1719
1325
|
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1326
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
1327
|
+
return typeof o;
|
|
1328
|
+
} : function (o) {
|
|
1329
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1330
|
+
}, _typeof(o);
|
|
1331
|
+
}
|
|
1725
1332
|
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1333
|
+
function _toPrimitive(input, hint) {
|
|
1334
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
1335
|
+
var prim = input[Symbol.toPrimitive];
|
|
1336
|
+
if (prim !== undefined) {
|
|
1337
|
+
var res = prim.call(input, hint || "default");
|
|
1338
|
+
if (_typeof(res) !== "object") return res;
|
|
1339
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1340
|
+
}
|
|
1341
|
+
return (hint === "string" ? String : Number)(input);
|
|
1342
|
+
}
|
|
1730
1343
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1344
|
+
function _toPropertyKey(arg) {
|
|
1345
|
+
var key = _toPrimitive(arg, "string");
|
|
1346
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
1347
|
+
}
|
|
1735
1348
|
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1349
|
+
function _defineProperty(obj, key, value) {
|
|
1350
|
+
key = _toPropertyKey(key);
|
|
1351
|
+
if (key in obj) {
|
|
1352
|
+
Object.defineProperty(obj, key, {
|
|
1353
|
+
value: value,
|
|
1354
|
+
enumerable: true,
|
|
1355
|
+
configurable: true,
|
|
1356
|
+
writable: true
|
|
1357
|
+
});
|
|
1358
|
+
} else {
|
|
1359
|
+
obj[key] = value;
|
|
1360
|
+
}
|
|
1361
|
+
return obj;
|
|
1362
|
+
}
|
|
1740
1363
|
|
|
1741
|
-
|
|
1742
|
-
|
|
1364
|
+
var INITIAL_FORM_VALUES = {
|
|
1365
|
+
sendTo: [],
|
|
1366
|
+
sendToId: "",
|
|
1367
|
+
sendToCc: [],
|
|
1368
|
+
sendToBcc: [],
|
|
1369
|
+
replyTo: "",
|
|
1370
|
+
showCopyEmails: false,
|
|
1371
|
+
subject: "",
|
|
1372
|
+
message: ""
|
|
1373
|
+
};
|
|
1374
|
+
var EMAIL_FORM_VALIDATION_SCHEMA = yup.object({
|
|
1375
|
+
subject: yup.string().required(t("neetoMolecules.emailForm.errors.subjectRequired")),
|
|
1376
|
+
message: yup.string().test("message", t("neetoMolecules.emailForm.errors.messageRequired"), function (value) {
|
|
1377
|
+
return !isEditorEmpty(value);
|
|
1378
|
+
})
|
|
1379
|
+
});
|
|
1380
|
+
var SEND_TO_FIELD_VALIDATION = yup.object({
|
|
1381
|
+
sendTo: yup.array().min(1, t("neetoMolecules.emailForm.errors.required", {
|
|
1382
|
+
entity: t("neetoMolecules.emailForm.fields.sendToEmailAddress")
|
|
1383
|
+
})).test("all-emails-valid", t("neetoMolecules.emailForm.errors.invalidEmailAddress"), function (emails) {
|
|
1384
|
+
return emails === null || emails === void 0 ? void 0 : emails.every(prop("valid"));
|
|
1385
|
+
}).nullable()
|
|
1386
|
+
});
|
|
1387
|
+
var SEND_TO_ID_FIELD_VALIDATION = yup.object({
|
|
1388
|
+
sendToId: yup.string().required(t("neetoMolecules.emailForm.errors.required", {
|
|
1389
|
+
entity: t("neetoMolecules.emailForm.labels.sendTo")
|
|
1390
|
+
}))
|
|
1391
|
+
});
|
|
1392
|
+
var REPLY_TO_FIELD_VALIDATION = yup.object({
|
|
1393
|
+
replyTo: yup.string().nullable().email(t("neetoMolecules.emailForm.errors.invalidEmailAddress")).required(t("neetoMolecules.emailForm.errors.required", {
|
|
1394
|
+
entity: t("neetoMolecules.emailForm.fields.replyToEmailAddress")
|
|
1395
|
+
}))
|
|
1396
|
+
});
|
|
1397
|
+
var EDITOR_ADDONS = ["highlight", "emoji", "code-block", "block-quote", "image-upload", "divider", "video-embed"];
|
|
1743
1398
|
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
if (propValue instanceof RegExp) {
|
|
1751
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1752
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1753
|
-
// passes PropTypes.object.
|
|
1754
|
-
return 'object';
|
|
1755
|
-
}
|
|
1756
|
-
if (isSymbol(propType, propValue)) {
|
|
1757
|
-
return 'symbol';
|
|
1758
|
-
}
|
|
1759
|
-
return propType;
|
|
1760
|
-
}
|
|
1399
|
+
/* eslint-disable @bigbinary/neeto/use-zustand-for-global-state-management */
|
|
1400
|
+
var EmailFormContext = /*#__PURE__*/React.createContext({
|
|
1401
|
+
showSendToField: false,
|
|
1402
|
+
showSendToAsRadio: false,
|
|
1403
|
+
showReplyToField: false
|
|
1404
|
+
});
|
|
1761
1405
|
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1406
|
+
var ReplyToField = function ReplyToField(_ref) {
|
|
1407
|
+
var replyToOptions = _ref.replyToOptions;
|
|
1408
|
+
var _useTranslation = useTranslation(),
|
|
1409
|
+
t = _useTranslation.t;
|
|
1410
|
+
var isDropdownField = isNotEmpty(replyToOptions);
|
|
1411
|
+
var _useFormikContext = useFormikContext(),
|
|
1412
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
1413
|
+
if (isDropdownField) {
|
|
1414
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
1415
|
+
isClearable: true,
|
|
1416
|
+
className: "w-full",
|
|
1417
|
+
"data-testid": "replyToOptions",
|
|
1418
|
+
label: t("neetoMolecules.emailForm.labels.replyTo"),
|
|
1419
|
+
name: "replyTo",
|
|
1420
|
+
options: replyToOptions,
|
|
1421
|
+
labelProps: {
|
|
1422
|
+
helpIconProps: _defineProperty(_defineProperty({
|
|
1423
|
+
icon: Info
|
|
1424
|
+
}, "data-testid", "reply-to-tooltip"), "tooltipProps", {
|
|
1425
|
+
content: t("neetoMolecules.emailForm.tooltips.replyTo")
|
|
1426
|
+
})
|
|
1427
|
+
},
|
|
1428
|
+
onChange: function onChange(data) {
|
|
1429
|
+
var _data$value;
|
|
1430
|
+
return setFieldValue("replyTo", (_data$value = data === null || data === void 0 ? void 0 : data.value) !== null && _data$value !== void 0 ? _data$value : "");
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
1435
|
+
autoFocus: true,
|
|
1436
|
+
required: true,
|
|
1437
|
+
className: "w-full",
|
|
1438
|
+
"data-testid": "replyToInput",
|
|
1439
|
+
label: t("neetoMolecules.emailForm.labels.replyTo"),
|
|
1440
|
+
name: "replyTo",
|
|
1441
|
+
placeholder: t("neetoMolecules.emailForm.placeholders.emailPlaceholder"),
|
|
1442
|
+
size: "large",
|
|
1443
|
+
labelProps: {
|
|
1444
|
+
helpIconProps: _defineProperty(_defineProperty({
|
|
1445
|
+
icon: Info
|
|
1446
|
+
}, "data-testid", "reply-to-tooltip"), "tooltipProps", {
|
|
1447
|
+
content: t("neetoMolecules.emailForm.tooltips.replyTo")
|
|
1448
|
+
})
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
};
|
|
1778
1452
|
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1453
|
+
function _extends() {
|
|
1454
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1455
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1456
|
+
var source = arguments[i];
|
|
1457
|
+
for (var key in source) {
|
|
1458
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1459
|
+
target[key] = source[key];
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
return target;
|
|
1464
|
+
};
|
|
1465
|
+
return _extends.apply(this, arguments);
|
|
1466
|
+
}
|
|
1795
1467
|
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
return propValue.constructor.name;
|
|
1802
|
-
}
|
|
1468
|
+
function _arrayLikeToArray(arr, len) {
|
|
1469
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1470
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1471
|
+
return arr2;
|
|
1472
|
+
}
|
|
1803
1473
|
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1474
|
+
function _arrayWithoutHoles(arr) {
|
|
1475
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
1476
|
+
}
|
|
1807
1477
|
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
return factoryWithTypeCheckers;
|
|
1478
|
+
function _iterableToArray(iter) {
|
|
1479
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1811
1480
|
}
|
|
1812
1481
|
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1482
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1483
|
+
if (!o) return;
|
|
1484
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1485
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1486
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1487
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1488
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1489
|
+
}
|
|
1819
1490
|
|
|
1820
|
-
|
|
1821
|
-
|
|
1491
|
+
function _nonIterableSpread() {
|
|
1492
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1493
|
+
}
|
|
1822
1494
|
|
|
1823
|
-
function
|
|
1824
|
-
|
|
1825
|
-
|
|
1495
|
+
function _toConsumableArray(arr) {
|
|
1496
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
1497
|
+
}
|
|
1826
1498
|
|
|
1827
|
-
|
|
1499
|
+
function _arrayWithHoles(arr) {
|
|
1500
|
+
if (Array.isArray(arr)) return arr;
|
|
1501
|
+
}
|
|
1828
1502
|
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1503
|
+
function _iterableToArrayLimit(r, l) {
|
|
1504
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1505
|
+
if (null != t) {
|
|
1506
|
+
var e,
|
|
1507
|
+
n,
|
|
1508
|
+
i,
|
|
1509
|
+
u,
|
|
1510
|
+
a = [],
|
|
1511
|
+
f = !0,
|
|
1512
|
+
o = !1;
|
|
1513
|
+
try {
|
|
1514
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1515
|
+
if (Object(t) !== t) return;
|
|
1516
|
+
f = !1;
|
|
1517
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1518
|
+
} catch (r) {
|
|
1519
|
+
o = !0, n = r;
|
|
1520
|
+
} finally {
|
|
1521
|
+
try {
|
|
1522
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
1523
|
+
} finally {
|
|
1524
|
+
if (o) throw n;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
return a;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1832
1530
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
// It is still safe when called from React.
|
|
1837
|
-
return;
|
|
1838
|
-
}
|
|
1839
|
-
var err = new Error(
|
|
1840
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1841
|
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1842
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
1843
|
-
);
|
|
1844
|
-
err.name = 'Invariant Violation';
|
|
1845
|
-
throw err;
|
|
1846
|
-
} shim.isRequired = shim;
|
|
1847
|
-
function getShim() {
|
|
1848
|
-
return shim;
|
|
1849
|
-
} // Important!
|
|
1850
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1851
|
-
var ReactPropTypes = {
|
|
1852
|
-
array: shim,
|
|
1853
|
-
bigint: shim,
|
|
1854
|
-
bool: shim,
|
|
1855
|
-
func: shim,
|
|
1856
|
-
number: shim,
|
|
1857
|
-
object: shim,
|
|
1858
|
-
string: shim,
|
|
1859
|
-
symbol: shim,
|
|
1531
|
+
function _nonIterableRest() {
|
|
1532
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1533
|
+
}
|
|
1860
1534
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
elementType: shim,
|
|
1865
|
-
instanceOf: getShim,
|
|
1866
|
-
node: shim,
|
|
1867
|
-
objectOf: getShim,
|
|
1868
|
-
oneOf: getShim,
|
|
1869
|
-
oneOfType: getShim,
|
|
1870
|
-
shape: getShim,
|
|
1871
|
-
exact: getShim,
|
|
1535
|
+
function _slicedToArray(arr, i) {
|
|
1536
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1537
|
+
}
|
|
1872
1538
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1539
|
+
var ALLOWED_FILE_TYPES = [".csv"];
|
|
1540
|
+
var ONE_MEGABYTE_IN_BYTES = 1024 * 1024;
|
|
1541
|
+
var DOWNLOAD_SAMPLE_EMAIL_CSV_FILE = "https://d2v7kzglnr2dnh.cloudfront.net/others/sample-bulk-email.csv";
|
|
1876
1542
|
|
|
1877
|
-
|
|
1543
|
+
var Requirements = withT(function (_ref) {
|
|
1544
|
+
var t = _ref.t,
|
|
1545
|
+
fileSize = _ref.fileSize;
|
|
1546
|
+
return /*#__PURE__*/React.createElement(Callout, {
|
|
1547
|
+
className: "flex flex-col items-center py-6",
|
|
1548
|
+
style: "info"
|
|
1549
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
1550
|
+
className: "list-outside list-disc space-y-1 font-normal leading-normal"
|
|
1551
|
+
}, fileSize && /*#__PURE__*/React.createElement("li", null, t("neetoMolecules.shareViaLink.requirements.fileTypeAndSize", {
|
|
1552
|
+
limit: fileSize
|
|
1553
|
+
})), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Trans, {
|
|
1554
|
+
components: {
|
|
1555
|
+
strong: /*#__PURE__*/React.createElement("strong", {
|
|
1556
|
+
className: "font-semibold"
|
|
1557
|
+
})
|
|
1558
|
+
},
|
|
1559
|
+
i18nKey: "neetoMolecules.shareViaLink.requirements.shouldContainColumns"
|
|
1560
|
+
}))), /*#__PURE__*/React.createElement(Button, {
|
|
1561
|
+
href: DOWNLOAD_SAMPLE_EMAIL_CSV_FILE,
|
|
1562
|
+
icon: Download,
|
|
1563
|
+
iconPosition: "left",
|
|
1564
|
+
label: t("neetoMolecules.shareViaLink.bulkUploadPane.downloadSampleCSV"),
|
|
1565
|
+
style: "link"
|
|
1566
|
+
}));
|
|
1567
|
+
});
|
|
1568
|
+
var Requirements$1 = /*#__PURE__*/React.memo(Requirements);
|
|
1878
1569
|
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1570
|
+
var BulkUploadPane = function BulkUploadPane(_ref) {
|
|
1571
|
+
var _fileRejections$;
|
|
1572
|
+
var isOpen = _ref.isOpen,
|
|
1573
|
+
fileType = _ref.fileType,
|
|
1574
|
+
fileSize = _ref.fileSize,
|
|
1575
|
+
onClose = _ref.onClose,
|
|
1576
|
+
handleFileSubmit = _ref.handleFileSubmit;
|
|
1577
|
+
var _useDropzone = useDropzone({
|
|
1578
|
+
accept: fileType,
|
|
1579
|
+
maxFiles: 1,
|
|
1580
|
+
maxSize: fileSize * ONE_MEGABYTE_IN_BYTES,
|
|
1581
|
+
onDrop: function onDrop(files) {
|
|
1582
|
+
return files[0] && handleFileSubmit(files[0]);
|
|
1583
|
+
}
|
|
1584
|
+
}),
|
|
1585
|
+
getRootProps = _useDropzone.getRootProps,
|
|
1586
|
+
getInputProps = _useDropzone.getInputProps,
|
|
1587
|
+
isDragActive = _useDropzone.isDragActive,
|
|
1588
|
+
fileRejections = _useDropzone.fileRejections;
|
|
1589
|
+
var errors = (_fileRejections$ = fileRejections[0]) === null || _fileRejections$ === void 0 ? void 0 : _fileRejections$.errors.map(function (_ref2) {
|
|
1590
|
+
var message = _ref2.message,
|
|
1591
|
+
code = _ref2.code;
|
|
1592
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
1593
|
+
className: "neeto-ui-text-error-500 items",
|
|
1594
|
+
"data-cy": "file-input-error-message",
|
|
1595
|
+
key: code,
|
|
1596
|
+
style: "body3"
|
|
1597
|
+
}, message);
|
|
1598
|
+
});
|
|
1599
|
+
var _useTranslation = useTranslation(),
|
|
1600
|
+
t = _useTranslation.t;
|
|
1601
|
+
return /*#__PURE__*/React.createElement(Pane, {
|
|
1602
|
+
"data-testid": "bulk-upload-pane",
|
|
1603
|
+
isOpen: isOpen,
|
|
1604
|
+
onClose: onClose
|
|
1605
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1606
|
+
tabIndex: 0
|
|
1607
|
+
}, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
1608
|
+
"data-testid": "bulk-upload-header",
|
|
1609
|
+
style: "h2",
|
|
1610
|
+
weight: "semibold"
|
|
1611
|
+
}, t("neetoMolecules.shareViaLink.bulkUpload"))), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
|
|
1612
|
+
className: "w-full space-y-4"
|
|
1613
|
+
}, /*#__PURE__*/React.createElement(Requirements$1, {
|
|
1614
|
+
fileSize: fileSize
|
|
1615
|
+
}), /*#__PURE__*/React.createElement("div", getRootProps({
|
|
1616
|
+
className: classnames("flex flex-col p-2 border neeto-ui-border-primary-500 border-dashed neeto-ui-rounded-md transition duration-500 ease-in-out hover:neeto-ui-bg-gray-100 cursor-pointer items-center", {
|
|
1617
|
+
"neeto-ui-border-gray-100": isDragActive,
|
|
1618
|
+
"neeto-ui-border-error neeto-ui-bg-pastel-red hover:neeto-ui-bg-pastel-red": fileRejections.length
|
|
1619
|
+
})
|
|
1620
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1621
|
+
className: "flex flex-col items-center space-y-3 p-4"
|
|
1622
|
+
}, /*#__PURE__*/React.createElement(Upload, {
|
|
1623
|
+
className: "neeto-ui-text-primary-500",
|
|
1624
|
+
size: 32
|
|
1625
|
+
}), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
|
|
1626
|
+
"data-cy": "csv-upload-input",
|
|
1627
|
+
"data-testid": "csv-upload-input"
|
|
1628
|
+
})), isDragActive ? /*#__PURE__*/React.createElement(Typography, {
|
|
1629
|
+
style: "body2"
|
|
1630
|
+
}, t("neetoMolecules.shareViaLink.bulkUploadPane.dropFileHere")) : /*#__PURE__*/React.createElement("div", {
|
|
1631
|
+
className: "flex flex-col items-center space-y-1"
|
|
1632
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1633
|
+
className: "flex w-full items-center justify-center gap-x-1"
|
|
1634
|
+
}, /*#__PURE__*/React.createElement(Trans, {
|
|
1635
|
+
i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.dragNDrop",
|
|
1636
|
+
components: {
|
|
1637
|
+
Button: /*#__PURE__*/React.createElement(Button, {
|
|
1638
|
+
style: "link"
|
|
1639
|
+
})
|
|
1640
|
+
}
|
|
1641
|
+
})), /*#__PURE__*/React.createElement(Typography, {
|
|
1642
|
+
className: "neeto-ui-text-gray-700",
|
|
1643
|
+
style: "body3"
|
|
1644
|
+
}, fileType && /*#__PURE__*/React.createElement(Trans, {
|
|
1645
|
+
i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.supportedFormat",
|
|
1646
|
+
values: {
|
|
1647
|
+
fileType: fileType
|
|
1648
|
+
},
|
|
1649
|
+
components: {
|
|
1650
|
+
code: /*#__PURE__*/React.createElement("code", {
|
|
1651
|
+
className: "neeto-ui-typography neeto-ui-text-body3 neeto-ui-bg-white m-0 border-l-0 p-0"
|
|
1652
|
+
})
|
|
1653
|
+
}
|
|
1654
|
+
}), " ", fileSize && t("neetoMolecules.shareViaLink.bulkUploadPane.supportedSize", {
|
|
1655
|
+
fileSize: fileSize
|
|
1656
|
+
})))), errors))), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
1657
|
+
className: "flex items-center space-x-2"
|
|
1658
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1659
|
+
"data-cy": "bulk-upload-cancel-button",
|
|
1660
|
+
"data-testid": "bulk-upload-cancel-button",
|
|
1661
|
+
label: t("neetoMolecules.common.actions.cancel"),
|
|
1662
|
+
style: "text",
|
|
1663
|
+
type: "reset",
|
|
1664
|
+
onClick: onClose
|
|
1665
|
+
}))));
|
|
1666
|
+
};
|
|
1883
1667
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1668
|
+
var isValidEmail = function isValidEmail(email) {
|
|
1669
|
+
return string().email().isValidSync(email);
|
|
1670
|
+
};
|
|
1671
|
+
var createEmailOptions = function createEmailOptions() {
|
|
1672
|
+
var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1673
|
+
return emails.map(function (email) {
|
|
1674
|
+
return {
|
|
1675
|
+
label: email,
|
|
1676
|
+
value: email,
|
|
1677
|
+
valid: isValidEmail(email)
|
|
1678
|
+
};
|
|
1679
|
+
});
|
|
1680
|
+
};
|
|
1681
|
+
var parseCsvEmails = function parseCsvEmails(file, onSuccess) {
|
|
1682
|
+
Papa.parse(file, {
|
|
1683
|
+
header: true,
|
|
1684
|
+
skipEmptyLines: true,
|
|
1685
|
+
transformHeader: function transformHeader(h) {
|
|
1686
|
+
return h.toLowerCase().replace(/\W/g, "");
|
|
1687
|
+
},
|
|
1688
|
+
complete: function complete(results) {
|
|
1689
|
+
var _results$meta$fields;
|
|
1690
|
+
var isEmailFieldPresent = (_results$meta$fields = results.meta.fields) === null || _results$meta$fields === void 0 ? void 0 : _results$meta$fields.includes("email");
|
|
1691
|
+
if (isEmailFieldPresent) {
|
|
1692
|
+
var emails = results.data.filter(prop("email")).map(function (item) {
|
|
1693
|
+
return item.email.trim();
|
|
1694
|
+
});
|
|
1695
|
+
onSuccess(createEmailOptions(emails));
|
|
1696
|
+
} else {
|
|
1697
|
+
Toastr.error(t("neetoMolecules.sendToFields.errors.invalidCsv"));
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
});
|
|
1701
|
+
};
|
|
1890
1702
|
|
|
1891
|
-
|
|
1892
|
-
var
|
|
1703
|
+
var SendToFields = function SendToFields(_ref) {
|
|
1704
|
+
var emailInputProps = _ref.emailInputProps,
|
|
1705
|
+
ccInputProps = _ref.ccInputProps,
|
|
1706
|
+
bccInputProps = _ref.bccInputProps,
|
|
1707
|
+
_ref$showUploadCsvBut = _ref.showUploadCsvButton,
|
|
1708
|
+
showUploadCsvButton = _ref$showUploadCsvBut === void 0 ? false : _ref$showUploadCsvBut,
|
|
1709
|
+
_ref$showCcBccButton = _ref.showCcBccButton,
|
|
1710
|
+
showCcBccButton = _ref$showCcBccButton === void 0 ? false : _ref$showCcBccButton;
|
|
1711
|
+
var _useState = useState(false),
|
|
1712
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1713
|
+
isBulkUploadPaneOpen = _useState2[0],
|
|
1714
|
+
setIsBulkUploadPaneOpen = _useState2[1];
|
|
1715
|
+
var sendToFieldRef = useRef();
|
|
1716
|
+
var _useFormikContext = useFormikContext(),
|
|
1717
|
+
_useFormikContext$val = _useFormikContext.values,
|
|
1718
|
+
showCopyEmails = _useFormikContext$val.showCopyEmails,
|
|
1719
|
+
existingSendToEmails = _useFormikContext$val[emailInputProps.name || "sendTo"],
|
|
1720
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
1721
|
+
var _useTranslation = useTranslation(),
|
|
1722
|
+
t = _useTranslation.t;
|
|
1723
|
+
var handleCSVFile = function handleCSVFile(file) {
|
|
1724
|
+
try {
|
|
1725
|
+
var _sendToFieldRef$curre;
|
|
1726
|
+
var onSuccess = function onSuccess(values) {
|
|
1727
|
+
return setFieldValue(emailInputProps.name || "sendTo", [].concat(_toConsumableArray(existingSendToEmails), _toConsumableArray(values)));
|
|
1728
|
+
};
|
|
1729
|
+
parseCsvEmails(file, onSuccess);
|
|
1730
|
+
setIsBulkUploadPaneOpen(false);
|
|
1731
|
+
(_sendToFieldRef$curre = sendToFieldRef.current) === null || _sendToFieldRef$curre === void 0 ? void 0 : _sendToFieldRef$curre.focus();
|
|
1732
|
+
} catch (error) {
|
|
1733
|
+
Toastr.error(error);
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
var handelCcBccButtonClick = function handelCcBccButtonClick(e) {
|
|
1737
|
+
e.stopPropagation();
|
|
1738
|
+
setFieldValue("showCopyEmails", !showCopyEmails);
|
|
1739
|
+
};
|
|
1740
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1741
|
+
className: "relative w-full flex-col gap-2"
|
|
1742
|
+
}, showUploadCsvButton && /*#__PURE__*/React.createElement(Button, {
|
|
1743
|
+
className: "absolute top-0 right-1",
|
|
1744
|
+
"data-testid": "bulk-upload-button",
|
|
1745
|
+
icon: Upload,
|
|
1746
|
+
label: t("neetoMolecules.shareViaLink.bulkUpload"),
|
|
1747
|
+
size: "small",
|
|
1748
|
+
style: "link",
|
|
1749
|
+
onClick: function onClick() {
|
|
1750
|
+
return setIsBulkUploadPaneOpen(true);
|
|
1751
|
+
}
|
|
1752
|
+
}), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
1753
|
+
"data-testid": "emails",
|
|
1754
|
+
name: "sendTo",
|
|
1755
|
+
ref: sendToFieldRef
|
|
1756
|
+
}, emailInputProps, {
|
|
1757
|
+
suffix: showCcBccButton && /*#__PURE__*/React.createElement(Button, {
|
|
1758
|
+
"data-cy": "cc-bcc-button",
|
|
1759
|
+
"data-testid": "cc-bcc-button",
|
|
1760
|
+
label: t("neetoMolecules.emailForm.labels.ccBcc"),
|
|
1761
|
+
size: "small",
|
|
1762
|
+
style: "link",
|
|
1763
|
+
onClick: handelCcBccButtonClick
|
|
1764
|
+
})
|
|
1765
|
+
})), showCopyEmails && /*#__PURE__*/React.createElement("div", {
|
|
1766
|
+
className: "mt-5 flex w-full flex-col gap-6"
|
|
1767
|
+
}, /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
1768
|
+
name: "sendToBcc"
|
|
1769
|
+
}, ccInputProps)), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
1770
|
+
name: "sendToCc"
|
|
1771
|
+
}, bccInputProps))), /*#__PURE__*/React.createElement(BulkUploadPane, {
|
|
1772
|
+
fileSize: globalProps.endUserUploadedFileSizeLimitInMb,
|
|
1773
|
+
fileType: ALLOWED_FILE_TYPES,
|
|
1774
|
+
handleFileSubmit: handleCSVFile,
|
|
1775
|
+
isOpen: isBulkUploadPaneOpen,
|
|
1776
|
+
onClose: function onClose() {
|
|
1777
|
+
return setIsBulkUploadPaneOpen(false);
|
|
1778
|
+
}
|
|
1779
|
+
}));
|
|
1780
|
+
};
|
|
1893
1781
|
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1782
|
+
var SendToField = withT(function (_ref) {
|
|
1783
|
+
var t = _ref.t;
|
|
1784
|
+
return /*#__PURE__*/React.createElement(SendToFields, {
|
|
1785
|
+
showCcBccButton: true,
|
|
1786
|
+
showUploadCsvButton: true,
|
|
1787
|
+
bccInputProps: {
|
|
1788
|
+
label: t("neetoMolecules.emailForm.labels.bCc"),
|
|
1789
|
+
name: "sendToBcc",
|
|
1790
|
+
placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
|
|
1791
|
+
},
|
|
1792
|
+
ccInputProps: {
|
|
1793
|
+
label: t("neetoMolecules.emailForm.labels.cc"),
|
|
1794
|
+
name: "sendToCc",
|
|
1795
|
+
placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
|
|
1796
|
+
},
|
|
1797
|
+
emailInputProps: {
|
|
1798
|
+
id: "sendTo",
|
|
1799
|
+
name: "sendTo",
|
|
1800
|
+
label: t("neetoMolecules.emailForm.labels.sendTo"),
|
|
1801
|
+
placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails"),
|
|
1802
|
+
required: true
|
|
1803
|
+
}
|
|
1804
|
+
});
|
|
1805
|
+
});
|
|
1903
1806
|
|
|
1904
|
-
var
|
|
1905
|
-
var
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1807
|
+
var SubjectField = function SubjectField(_ref) {
|
|
1808
|
+
var name = _ref.name,
|
|
1809
|
+
text = _ref.text,
|
|
1810
|
+
updateText = _ref.updateText,
|
|
1811
|
+
_ref$subjectVariables = _ref.subjectVariables,
|
|
1812
|
+
subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
|
|
1813
|
+
error = _ref.error,
|
|
1814
|
+
_ref$required = _ref.required,
|
|
1815
|
+
required = _ref$required === void 0 ? false : _ref$required;
|
|
1816
|
+
var _useState = useState(false),
|
|
1817
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1818
|
+
isFieldFocusedOnce = _useState2[0],
|
|
1819
|
+
setIsFieldFocusedOnce = _useState2[1];
|
|
1820
|
+
var _useTranslation = useTranslation(),
|
|
1821
|
+
t = _useTranslation.t;
|
|
1822
|
+
var tagClickHandler = function tagClickHandler(_ref2) {
|
|
1823
|
+
var slug = _ref2.key;
|
|
1824
|
+
var textAreaElement = document.querySelector("textarea[name=".concat(name, "]"));
|
|
1825
|
+
var splitIndex = isFieldFocusedOnce && textAreaElement ? textAreaElement.selectionEnd : text.length;
|
|
1826
|
+
var updatedSubject = [text.slice(0, splitIndex), " {{".concat(slug, "}}"), text.slice(splitIndex)].join("");
|
|
1827
|
+
updateText(updatedSubject);
|
|
1828
|
+
};
|
|
1829
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input$1, {
|
|
1830
|
+
error: error,
|
|
1831
|
+
name: name,
|
|
1832
|
+
required: required,
|
|
1833
|
+
label: t("neetoMolecules.emailForm.labels.subject"),
|
|
1834
|
+
size: "large",
|
|
1835
|
+
value: text,
|
|
1836
|
+
suffix: /*#__PURE__*/React.createElement(DynamicVariables, {
|
|
1837
|
+
variables: subjectVariables,
|
|
1838
|
+
dropdownProps: {
|
|
1839
|
+
className: "neeto-ui-dropdown__popup overflow-y-auto",
|
|
1840
|
+
buttonSize: "small"
|
|
1841
|
+
},
|
|
1842
|
+
onVariableClick: tagClickHandler
|
|
1843
|
+
}),
|
|
1844
|
+
onChange: withEventTargetValue(updateText),
|
|
1845
|
+
onFocus: function onFocus() {
|
|
1846
|
+
return setIsFieldFocusedOnce(true);
|
|
1847
|
+
}
|
|
1848
|
+
}), /*#__PURE__*/React.createElement(Typography, {
|
|
1849
|
+
className: "neeto-ui-text-gray-600 mt-2",
|
|
1850
|
+
"data-cy": "subject-input-variable-label",
|
|
1851
|
+
style: "body3"
|
|
1852
|
+
}, /*#__PURE__*/React.createElement(Trans, {
|
|
1853
|
+
components: {
|
|
1854
|
+
span: /*#__PURE__*/React.createElement("span", {
|
|
1855
|
+
className: "font-semibold"
|
|
1856
|
+
})
|
|
1857
|
+
},
|
|
1858
|
+
i18nKey: "neetoMolecules.emailForm.helpText",
|
|
1859
|
+
values: {
|
|
1860
|
+
type: "subject"
|
|
1861
|
+
}
|
|
1862
|
+
})));
|
|
1863
|
+
};
|
|
1864
|
+
|
|
1865
|
+
var EmailForm = function EmailForm(_ref) {
|
|
1866
|
+
var _ref$messageVariables = _ref.messageVariables,
|
|
1867
|
+
messageVariables = _ref$messageVariables === void 0 ? [] : _ref$messageVariables,
|
|
1868
|
+
_ref$subjectVariables = _ref.subjectVariables,
|
|
1869
|
+
subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
|
|
1870
|
+
handleCancel = _ref.handleCancel,
|
|
1871
|
+
isLoading = _ref.isLoading,
|
|
1872
|
+
_ref$replyToOptions = _ref.replyToOptions,
|
|
1873
|
+
replyToOptions = _ref$replyToOptions === void 0 ? [] : _ref$replyToOptions,
|
|
1874
|
+
_ref$sendToOptions = _ref.sendToOptions,
|
|
1875
|
+
sendToOptions = _ref$sendToOptions === void 0 ? [] : _ref$sendToOptions,
|
|
1876
|
+
_ref$isUpdating = _ref.isUpdating,
|
|
1877
|
+
isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating,
|
|
1878
|
+
_ref$showFields = _ref.showFields,
|
|
1879
|
+
showFields = _ref$showFields === void 0 ? true : _ref$showFields,
|
|
1915
1880
|
_ref$className = _ref.className,
|
|
1916
1881
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
1882
|
+
var _useTranslation = useTranslation(),
|
|
1883
|
+
t = _useTranslation.t;
|
|
1884
|
+
var _useContext = useContext(EmailFormContext),
|
|
1885
|
+
showSendToField = _useContext.showSendToField,
|
|
1886
|
+
showSendToAsRadio = _useContext.showSendToAsRadio,
|
|
1887
|
+
showReplyToField = _useContext.showReplyToField;
|
|
1888
|
+
var _useFormikContext = useFormikContext(),
|
|
1889
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
1890
|
+
dirty = _useFormikContext.dirty;
|
|
1891
|
+
var showSendToRadioField = showSendToField && showSendToAsRadio && isNotEmpty(sendToOptions);
|
|
1917
1892
|
return /*#__PURE__*/React.createElement("div", {
|
|
1918
|
-
"data-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
}, /*#__PURE__*/React.createElement(
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
"data-cy": "email-subject-preview",
|
|
1957
|
-
lineHeight: "normal",
|
|
1958
|
-
style: "body2"
|
|
1959
|
-
}, subject || /*#__PURE__*/React.createElement("span", {
|
|
1960
|
-
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-40"
|
|
1961
|
-
})))), /*#__PURE__*/React.createElement("div", {
|
|
1962
|
-
className: "neeto-ui-text-gray-800 flex flex-1 flex-col justify-between space-y-6 p-6 pr-10 text-base leading-relaxed",
|
|
1963
|
-
"data-cy": "email-body-preview-container"
|
|
1964
|
-
}, body ? /*#__PURE__*/React.createElement(MemoizedEditorContent, {
|
|
1965
|
-
content: body
|
|
1966
|
-
}) : /*#__PURE__*/React.createElement("div", {
|
|
1967
|
-
className: "space-y-4"
|
|
1968
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1969
|
-
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-80"
|
|
1970
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
1971
|
-
className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-72"
|
|
1893
|
+
"data-testid": "email-form",
|
|
1894
|
+
className: classnames("flex flex-1 flex-col items-start gap-2", _defineProperty({}, className, className))
|
|
1895
|
+
}, showFields && /*#__PURE__*/React.createElement("div", {
|
|
1896
|
+
className: "flex w-full flex-col items-start justify-start gap-6"
|
|
1897
|
+
}, /*#__PURE__*/React.createElement(Field, {
|
|
1898
|
+
name: "subject"
|
|
1899
|
+
}, function (_ref2) {
|
|
1900
|
+
var value = _ref2.field.value,
|
|
1901
|
+
error = _ref2.meta.error;
|
|
1902
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1903
|
+
className: "w-full"
|
|
1904
|
+
}, /*#__PURE__*/React.createElement(SubjectField, {
|
|
1905
|
+
error: t(error),
|
|
1906
|
+
name: "subject",
|
|
1907
|
+
subjectVariables: subjectVariables,
|
|
1908
|
+
required: true,
|
|
1909
|
+
text: value,
|
|
1910
|
+
updateText: function updateText(text) {
|
|
1911
|
+
return setFieldValue("subject", text);
|
|
1912
|
+
}
|
|
1913
|
+
}));
|
|
1914
|
+
}), showSendToRadioField ? /*#__PURE__*/React.createElement(Radio, {
|
|
1915
|
+
"data-testid": "send-to-id",
|
|
1916
|
+
label: t("neetoMolecules.emailForm.labels.sendTo"),
|
|
1917
|
+
labelProps: {
|
|
1918
|
+
required: true
|
|
1919
|
+
},
|
|
1920
|
+
name: "sendToId"
|
|
1921
|
+
}, sendToOptions.map(function (_ref3) {
|
|
1922
|
+
var label = _ref3.label,
|
|
1923
|
+
value = _ref3.value;
|
|
1924
|
+
return /*#__PURE__*/React.createElement(Radio.Item, {
|
|
1925
|
+
label: label,
|
|
1926
|
+
value: value,
|
|
1927
|
+
key: value
|
|
1928
|
+
});
|
|
1929
|
+
})) : /*#__PURE__*/React.createElement(SendToField, null), showReplyToField && /*#__PURE__*/React.createElement(ReplyToField, {
|
|
1930
|
+
replyToOptions: replyToOptions
|
|
1972
1931
|
}), /*#__PURE__*/React.createElement("div", {
|
|
1973
|
-
className: "
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
"data-testid": "product-name-block"
|
|
1987
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
1988
|
-
className: "neeto-ui-text-gray-600 text-center leading-6",
|
|
1932
|
+
className: "w-full"
|
|
1933
|
+
}, /*#__PURE__*/React.createElement(FormikEditor, {
|
|
1934
|
+
isMenuCollapsible: true,
|
|
1935
|
+
required: true,
|
|
1936
|
+
addons: EDITOR_ADDONS,
|
|
1937
|
+
"data-cy": "message-input-field",
|
|
1938
|
+
id: "form_message",
|
|
1939
|
+
label: t("neetoMolecules.emailForm.labels.message"),
|
|
1940
|
+
name: "message",
|
|
1941
|
+
variables: messageVariables
|
|
1942
|
+
}), /*#__PURE__*/React.createElement(Typography, {
|
|
1943
|
+
className: "neeto-ui-text-gray-500 mt-2",
|
|
1944
|
+
"data-cy": "message-input-variable-label",
|
|
1989
1945
|
style: "body3"
|
|
1990
|
-
},
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
1946
|
+
}, /*#__PURE__*/React.createElement(Trans, {
|
|
1947
|
+
i18nKey: "neetoMolecules.emailForm.helpText",
|
|
1948
|
+
values: {
|
|
1949
|
+
type: "message"
|
|
1950
|
+
},
|
|
1951
|
+
components: {
|
|
1952
|
+
span: /*#__PURE__*/React.createElement("span", {
|
|
1953
|
+
className: "font-semibold"
|
|
1954
|
+
})
|
|
1955
|
+
}
|
|
1956
|
+
})))), /*#__PURE__*/React.createElement(ActionBlock, {
|
|
1957
|
+
className: "mt-6 w-full justify-start",
|
|
1958
|
+
cancelButtonProps: {
|
|
1959
|
+
disabled: false,
|
|
1960
|
+
onClick: handleCancel,
|
|
1961
|
+
className: "ml-3"
|
|
1962
|
+
},
|
|
1963
|
+
submitButtonProps: {
|
|
1964
|
+
loading: isLoading,
|
|
1965
|
+
disabled: !dirty || isUpdating
|
|
1966
|
+
}
|
|
1967
|
+
}));
|
|
1968
|
+
};
|
|
1969
|
+
|
|
1970
|
+
var getValidationSchema = function getValidationSchema(_ref) {
|
|
1971
|
+
var showSendToField = _ref.showSendToField,
|
|
1972
|
+
showReplyToField = _ref.showReplyToField,
|
|
1973
|
+
showSendToAsRadio = _ref.showSendToAsRadio,
|
|
1974
|
+
customValidations = _ref.customValidations;
|
|
1975
|
+
var schema = EMAIL_FORM_VALIDATION_SCHEMA.clone();
|
|
1976
|
+
if (showSendToField) {
|
|
1977
|
+
schema = schema.concat(showSendToAsRadio ? SEND_TO_ID_FIELD_VALIDATION : SEND_TO_FIELD_VALIDATION);
|
|
1978
|
+
}
|
|
1979
|
+
if (showReplyToField) schema = schema.concat(REPLY_TO_FIELD_VALIDATION);
|
|
1980
|
+
return schema.shape(customValidations);
|
|
1981
|
+
};
|
|
1982
|
+
|
|
1983
|
+
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; }
|
|
1984
|
+
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; }
|
|
1985
|
+
var EmailFormProvider = function EmailFormProvider(_ref) {
|
|
1986
|
+
var _ref$onSubmit = _ref.onSubmit,
|
|
1987
|
+
onSubmit = _ref$onSubmit === void 0 ? noop : _ref$onSubmit,
|
|
1988
|
+
_ref$initialValues = _ref.initialValues,
|
|
1989
|
+
initialValues = _ref$initialValues === void 0 ? INITIAL_FORM_VALUES : _ref$initialValues,
|
|
1990
|
+
children = _ref.children,
|
|
1991
|
+
formikProps = _ref.formikProps,
|
|
1992
|
+
_ref$validationSchema = _ref.validationSchema,
|
|
1993
|
+
customValidations = _ref$validationSchema === void 0 ? {} : _ref$validationSchema,
|
|
1994
|
+
_ref$showSendToField = _ref.showSendToField,
|
|
1995
|
+
showSendToField = _ref$showSendToField === void 0 ? false : _ref$showSendToField,
|
|
1996
|
+
_ref$showReplyToField = _ref.showReplyToField,
|
|
1997
|
+
showReplyToField = _ref$showReplyToField === void 0 ? false : _ref$showReplyToField,
|
|
1998
|
+
_ref$showSendToAsRadi = _ref.showSendToAsRadio,
|
|
1999
|
+
showSendToAsRadio = _ref$showSendToAsRadi === void 0 ? false : _ref$showSendToAsRadi;
|
|
2000
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2001
|
+
"data-testid": "email-form-provider"
|
|
2002
|
+
}, /*#__PURE__*/React.createElement(EmailFormContext.Provider, {
|
|
2003
|
+
value: {
|
|
2004
|
+
showSendToField: showSendToField,
|
|
2005
|
+
showSendToAsRadio: showSendToAsRadio,
|
|
2006
|
+
showReplyToField: showReplyToField
|
|
2007
|
+
}
|
|
2008
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
2009
|
+
formikProps: _objectSpread({
|
|
2010
|
+
enableReinitialize: true,
|
|
2011
|
+
validationSchema: getValidationSchema({
|
|
2012
|
+
showSendToField: showSendToField,
|
|
2013
|
+
showReplyToField: showReplyToField,
|
|
2014
|
+
showSendToAsRadio: showSendToAsRadio,
|
|
2015
|
+
customValidations: customValidations
|
|
2016
|
+
}),
|
|
2017
|
+
initialValues: _objectSpread(_objectSpread({}, initialValues), {}, {
|
|
2018
|
+
replyTo: initialValues.replyTo || globalProps.user.email
|
|
2019
|
+
}),
|
|
2020
|
+
onSubmit: onSubmit
|
|
2021
|
+
}, formikProps)
|
|
2022
|
+
}, children)));
|
|
2023
2023
|
};
|
|
2024
2024
|
|
|
2025
2025
|
export { EmailForm, EmailFormProvider, EmailPreview };
|