@bigbinary/neeto-molecules 1.1.64 → 1.1.65
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 +224 -522
- package/dist/EmailForm.js.map +1 -1
- package/dist/EmailPreview.js +3 -44
- package/dist/EmailPreview.js.map +1 -1
- package/dist/SendToFields.js +218 -474
- package/dist/SendToFields.js.map +1 -1
- package/dist/ShareViaEmail.js +267 -1797
- package/dist/ShareViaEmail.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +12 -0
package/dist/SendToFields.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
2
|
import { useFormikContext } from 'formik';
|
|
3
|
-
import { Upload } from '@bigbinary/neeto-icons';
|
|
4
|
-
import {
|
|
3
|
+
import { Download, Upload } from '@bigbinary/neeto-icons';
|
|
4
|
+
import { Callout, Button, Typography, Pane, Toastr } from '@bigbinary/neetoui';
|
|
5
5
|
import { MultiEmailInput } from '@bigbinary/neetoui/formik';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Trans, useTranslation } from 'react-i18next';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { useDropzone } from 'react-dropzone';
|
|
9
|
+
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
7
10
|
import { t } from 'i18next';
|
|
8
11
|
import Papa from 'papaparse';
|
|
9
12
|
import { prop } from 'ramda';
|
|
@@ -55,409 +58,173 @@ function _toConsumableArray(arr) {
|
|
|
55
58
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
var info = gen[key](arg);
|
|
61
|
-
var value = info.value;
|
|
62
|
-
} catch (error) {
|
|
63
|
-
reject(error);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (info.done) {
|
|
67
|
-
resolve(value);
|
|
68
|
-
} else {
|
|
69
|
-
Promise.resolve(value).then(_next, _throw);
|
|
70
|
-
}
|
|
61
|
+
function _arrayWithHoles(arr) {
|
|
62
|
+
if (Array.isArray(arr)) return arr;
|
|
71
63
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
|
|
65
|
+
function _iterableToArrayLimit(arr, i) {
|
|
66
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
67
|
+
if (null != _i) {
|
|
68
|
+
var _s,
|
|
69
|
+
_e,
|
|
70
|
+
_x,
|
|
71
|
+
_r,
|
|
72
|
+
_arr = [],
|
|
73
|
+
_n = !0,
|
|
74
|
+
_d = !1;
|
|
75
|
+
try {
|
|
76
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
77
|
+
if (Object(_i) !== _i) return;
|
|
78
|
+
_n = !1;
|
|
79
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
_d = !0, _e = err;
|
|
82
|
+
} finally {
|
|
83
|
+
try {
|
|
84
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
85
|
+
} finally {
|
|
86
|
+
if (_d) throw _e;
|
|
83
87
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
88
|
+
}
|
|
89
|
+
return _arr;
|
|
90
|
+
}
|
|
87
91
|
}
|
|
88
92
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var _typeof = {exports: {}};
|
|
92
|
-
|
|
93
|
-
(function (module) {
|
|
94
|
-
function _typeof(obj) {
|
|
95
|
-
"@babel/helpers - typeof";
|
|
96
|
-
|
|
97
|
-
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
98
|
-
return typeof obj;
|
|
99
|
-
} : function (obj) {
|
|
100
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
101
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
102
|
-
}
|
|
103
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
104
|
-
} (_typeof));
|
|
105
|
-
|
|
106
|
-
(function (module) {
|
|
107
|
-
var _typeof$1 = _typeof.exports["default"];
|
|
108
|
-
function _regeneratorRuntime() {
|
|
109
|
-
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
110
|
-
return exports;
|
|
111
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
112
|
-
var exports = {},
|
|
113
|
-
Op = Object.prototype,
|
|
114
|
-
hasOwn = Op.hasOwnProperty,
|
|
115
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
116
|
-
obj[key] = desc.value;
|
|
117
|
-
},
|
|
118
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
119
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
120
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
121
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
122
|
-
function define(obj, key, value) {
|
|
123
|
-
return Object.defineProperty(obj, key, {
|
|
124
|
-
value: value,
|
|
125
|
-
enumerable: !0,
|
|
126
|
-
configurable: !0,
|
|
127
|
-
writable: !0
|
|
128
|
-
}), obj[key];
|
|
129
|
-
}
|
|
130
|
-
try {
|
|
131
|
-
define({}, "");
|
|
132
|
-
} catch (err) {
|
|
133
|
-
define = function define(obj, key, value) {
|
|
134
|
-
return obj[key] = value;
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
138
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
139
|
-
generator = Object.create(protoGenerator.prototype),
|
|
140
|
-
context = new Context(tryLocsList || []);
|
|
141
|
-
return defineProperty(generator, "_invoke", {
|
|
142
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
143
|
-
}), generator;
|
|
144
|
-
}
|
|
145
|
-
function tryCatch(fn, obj, arg) {
|
|
146
|
-
try {
|
|
147
|
-
return {
|
|
148
|
-
type: "normal",
|
|
149
|
-
arg: fn.call(obj, arg)
|
|
150
|
-
};
|
|
151
|
-
} catch (err) {
|
|
152
|
-
return {
|
|
153
|
-
type: "throw",
|
|
154
|
-
arg: err
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
exports.wrap = wrap;
|
|
159
|
-
var ContinueSentinel = {};
|
|
160
|
-
function Generator() {}
|
|
161
|
-
function GeneratorFunction() {}
|
|
162
|
-
function GeneratorFunctionPrototype() {}
|
|
163
|
-
var IteratorPrototype = {};
|
|
164
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
165
|
-
return this;
|
|
166
|
-
});
|
|
167
|
-
var getProto = Object.getPrototypeOf,
|
|
168
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
169
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
170
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
171
|
-
function defineIteratorMethods(prototype) {
|
|
172
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
173
|
-
define(prototype, method, function (arg) {
|
|
174
|
-
return this._invoke(method, arg);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
179
|
-
function invoke(method, arg, resolve, reject) {
|
|
180
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
181
|
-
if ("throw" !== record.type) {
|
|
182
|
-
var result = record.arg,
|
|
183
|
-
value = result.value;
|
|
184
|
-
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
185
|
-
invoke("next", value, resolve, reject);
|
|
186
|
-
}, function (err) {
|
|
187
|
-
invoke("throw", err, resolve, reject);
|
|
188
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
189
|
-
result.value = unwrapped, resolve(result);
|
|
190
|
-
}, function (error) {
|
|
191
|
-
return invoke("throw", error, resolve, reject);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
reject(record.arg);
|
|
195
|
-
}
|
|
196
|
-
var previousPromise;
|
|
197
|
-
defineProperty(this, "_invoke", {
|
|
198
|
-
value: function value(method, arg) {
|
|
199
|
-
function callInvokeWithMethodAndArg() {
|
|
200
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
201
|
-
invoke(method, arg, resolve, reject);
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
209
|
-
var state = "suspendedStart";
|
|
210
|
-
return function (method, arg) {
|
|
211
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
212
|
-
if ("completed" === state) {
|
|
213
|
-
if ("throw" === method) throw arg;
|
|
214
|
-
return doneResult();
|
|
215
|
-
}
|
|
216
|
-
for (context.method = method, context.arg = arg;;) {
|
|
217
|
-
var delegate = context.delegate;
|
|
218
|
-
if (delegate) {
|
|
219
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
220
|
-
if (delegateResult) {
|
|
221
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
222
|
-
return delegateResult;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
226
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
227
|
-
context.dispatchException(context.arg);
|
|
228
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
229
|
-
state = "executing";
|
|
230
|
-
var record = tryCatch(innerFn, self, context);
|
|
231
|
-
if ("normal" === record.type) {
|
|
232
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
233
|
-
return {
|
|
234
|
-
value: record.arg,
|
|
235
|
-
done: context.done
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
243
|
-
var methodName = context.method,
|
|
244
|
-
method = delegate.iterator[methodName];
|
|
245
|
-
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
246
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
247
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
248
|
-
var info = record.arg;
|
|
249
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
250
|
-
}
|
|
251
|
-
function pushTryEntry(locs) {
|
|
252
|
-
var entry = {
|
|
253
|
-
tryLoc: locs[0]
|
|
254
|
-
};
|
|
255
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
256
|
-
}
|
|
257
|
-
function resetTryEntry(entry) {
|
|
258
|
-
var record = entry.completion || {};
|
|
259
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
260
|
-
}
|
|
261
|
-
function Context(tryLocsList) {
|
|
262
|
-
this.tryEntries = [{
|
|
263
|
-
tryLoc: "root"
|
|
264
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
265
|
-
}
|
|
266
|
-
function values(iterable) {
|
|
267
|
-
if (iterable) {
|
|
268
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
269
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
270
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
271
|
-
if (!isNaN(iterable.length)) {
|
|
272
|
-
var i = -1,
|
|
273
|
-
next = function next() {
|
|
274
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
275
|
-
return next.value = undefined, next.done = !0, next;
|
|
276
|
-
};
|
|
277
|
-
return next.next = next;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return {
|
|
281
|
-
next: doneResult
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
function doneResult() {
|
|
285
|
-
return {
|
|
286
|
-
value: undefined,
|
|
287
|
-
done: !0
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
291
|
-
value: GeneratorFunctionPrototype,
|
|
292
|
-
configurable: !0
|
|
293
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
294
|
-
value: GeneratorFunction,
|
|
295
|
-
configurable: !0
|
|
296
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
297
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
298
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
299
|
-
}, exports.mark = function (genFun) {
|
|
300
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
301
|
-
}, exports.awrap = function (arg) {
|
|
302
|
-
return {
|
|
303
|
-
__await: arg
|
|
304
|
-
};
|
|
305
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
306
|
-
return this;
|
|
307
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
308
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
309
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
310
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
311
|
-
return result.done ? result.value : iter.next();
|
|
312
|
-
});
|
|
313
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
314
|
-
return this;
|
|
315
|
-
}), define(Gp, "toString", function () {
|
|
316
|
-
return "[object Generator]";
|
|
317
|
-
}), exports.keys = function (val) {
|
|
318
|
-
var object = Object(val),
|
|
319
|
-
keys = [];
|
|
320
|
-
for (var key in object) keys.push(key);
|
|
321
|
-
return keys.reverse(), function next() {
|
|
322
|
-
for (; keys.length;) {
|
|
323
|
-
var key = keys.pop();
|
|
324
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
325
|
-
}
|
|
326
|
-
return next.done = !0, next;
|
|
327
|
-
};
|
|
328
|
-
}, exports.values = values, Context.prototype = {
|
|
329
|
-
constructor: Context,
|
|
330
|
-
reset: function reset(skipTempReset) {
|
|
331
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
332
|
-
},
|
|
333
|
-
stop: function stop() {
|
|
334
|
-
this.done = !0;
|
|
335
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
336
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
337
|
-
return this.rval;
|
|
338
|
-
},
|
|
339
|
-
dispatchException: function dispatchException(exception) {
|
|
340
|
-
if (this.done) throw exception;
|
|
341
|
-
var context = this;
|
|
342
|
-
function handle(loc, caught) {
|
|
343
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
344
|
-
}
|
|
345
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
346
|
-
var entry = this.tryEntries[i],
|
|
347
|
-
record = entry.completion;
|
|
348
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
349
|
-
if (entry.tryLoc <= this.prev) {
|
|
350
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
351
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
352
|
-
if (hasCatch && hasFinally) {
|
|
353
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
354
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
355
|
-
} else if (hasCatch) {
|
|
356
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
357
|
-
} else {
|
|
358
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
359
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
abrupt: function abrupt(type, arg) {
|
|
365
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
366
|
-
var entry = this.tryEntries[i];
|
|
367
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
368
|
-
var finallyEntry = entry;
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
373
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
374
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
375
|
-
},
|
|
376
|
-
complete: function complete(record, afterLoc) {
|
|
377
|
-
if ("throw" === record.type) throw record.arg;
|
|
378
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
379
|
-
},
|
|
380
|
-
finish: function finish(finallyLoc) {
|
|
381
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
382
|
-
var entry = this.tryEntries[i];
|
|
383
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
"catch": function _catch(tryLoc) {
|
|
387
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
388
|
-
var entry = this.tryEntries[i];
|
|
389
|
-
if (entry.tryLoc === tryLoc) {
|
|
390
|
-
var record = entry.completion;
|
|
391
|
-
if ("throw" === record.type) {
|
|
392
|
-
var thrown = record.arg;
|
|
393
|
-
resetTryEntry(entry);
|
|
394
|
-
}
|
|
395
|
-
return thrown;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
throw new Error("illegal catch attempt");
|
|
399
|
-
},
|
|
400
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
401
|
-
return this.delegate = {
|
|
402
|
-
iterator: values(iterable),
|
|
403
|
-
resultName: resultName,
|
|
404
|
-
nextLoc: nextLoc
|
|
405
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
406
|
-
}
|
|
407
|
-
}, exports;
|
|
408
|
-
}
|
|
409
|
-
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
410
|
-
} (regeneratorRuntime$1));
|
|
411
|
-
|
|
412
|
-
// TODO(Babel 8): Remove this file.
|
|
413
|
-
|
|
414
|
-
var runtime = regeneratorRuntime$1.exports();
|
|
415
|
-
var regenerator = runtime;
|
|
416
|
-
|
|
417
|
-
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
418
|
-
try {
|
|
419
|
-
regeneratorRuntime = runtime;
|
|
420
|
-
} catch (accidentalStrictMode) {
|
|
421
|
-
if (typeof globalThis === "object") {
|
|
422
|
-
globalThis.regeneratorRuntime = runtime;
|
|
423
|
-
} else {
|
|
424
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
425
|
-
}
|
|
93
|
+
function _nonIterableRest() {
|
|
94
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
426
95
|
}
|
|
427
96
|
|
|
428
|
-
|
|
97
|
+
function _slicedToArray(arr, i) {
|
|
98
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
99
|
+
}
|
|
429
100
|
|
|
430
|
-
var
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
onChange = _ref.onChange,
|
|
434
|
-
children = _ref.children;
|
|
435
|
-
var inputRef = useRef();
|
|
436
|
-
var accept = types.reduce(function (acc, ext) {
|
|
437
|
-
return "".concat(acc, ", ").concat(ext);
|
|
438
|
-
}, "");
|
|
439
|
-
var handleInputChange = function handleInputChange(_ref2) {
|
|
440
|
-
var target = _ref2.target;
|
|
441
|
-
if (!target.files) return;
|
|
442
|
-
onChange(target.files);
|
|
101
|
+
var ALLOWED_FILE_TYPES = [".csv"];
|
|
102
|
+
var ONE_MEGABYTE_IN_BYTES = 1024 * 1024;
|
|
103
|
+
var DOWNLOAD_SAMPLE_EMAIL_CSV_FILE = "https://d2v7kzglnr2dnh.cloudfront.net/others/sample-bulk-email.csv";
|
|
443
104
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
105
|
+
var Requirements = withT(function (_ref) {
|
|
106
|
+
var t = _ref.t,
|
|
107
|
+
fileSize = _ref.fileSize;
|
|
108
|
+
return /*#__PURE__*/React.createElement(Callout, {
|
|
109
|
+
className: "flex flex-col items-center py-6",
|
|
110
|
+
style: "info"
|
|
111
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
112
|
+
className: "list-outside list-disc space-y-1 font-normal leading-normal"
|
|
113
|
+
}, fileSize && /*#__PURE__*/React.createElement("li", null, t("neetoMolecules.shareViaLink.requirements.fileTypeAndSize", {
|
|
114
|
+
limit: fileSize
|
|
115
|
+
})), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Trans, {
|
|
116
|
+
components: {
|
|
117
|
+
strong: /*#__PURE__*/React.createElement("strong", {
|
|
118
|
+
className: "font-semibold"
|
|
119
|
+
})
|
|
120
|
+
},
|
|
121
|
+
i18nKey: "neetoMolecules.shareViaLink.requirements.shouldContainColumns"
|
|
122
|
+
}))), /*#__PURE__*/React.createElement(Button, {
|
|
123
|
+
href: DOWNLOAD_SAMPLE_EMAIL_CSV_FILE,
|
|
124
|
+
icon: Download,
|
|
125
|
+
iconPosition: "left",
|
|
126
|
+
label: t("neetoMolecules.shareViaLink.bulkUploadPane.downloadSampleCSV"),
|
|
127
|
+
style: "link"
|
|
460
128
|
}));
|
|
129
|
+
});
|
|
130
|
+
var Requirements$1 = /*#__PURE__*/React.memo(Requirements);
|
|
131
|
+
|
|
132
|
+
var BulkUploadPane = function BulkUploadPane(_ref) {
|
|
133
|
+
var _fileRejections$;
|
|
134
|
+
var isOpen = _ref.isOpen,
|
|
135
|
+
fileType = _ref.fileType,
|
|
136
|
+
fileSize = _ref.fileSize,
|
|
137
|
+
onClose = _ref.onClose,
|
|
138
|
+
handleFileSubmit = _ref.handleFileSubmit;
|
|
139
|
+
var _useDropzone = useDropzone({
|
|
140
|
+
accept: fileType,
|
|
141
|
+
maxFiles: 1,
|
|
142
|
+
maxSize: fileSize * ONE_MEGABYTE_IN_BYTES,
|
|
143
|
+
onDrop: function onDrop(files) {
|
|
144
|
+
return files[0] && handleFileSubmit(files[0]);
|
|
145
|
+
}
|
|
146
|
+
}),
|
|
147
|
+
getRootProps = _useDropzone.getRootProps,
|
|
148
|
+
getInputProps = _useDropzone.getInputProps,
|
|
149
|
+
isDragActive = _useDropzone.isDragActive,
|
|
150
|
+
fileRejections = _useDropzone.fileRejections;
|
|
151
|
+
var errors = (_fileRejections$ = fileRejections[0]) === null || _fileRejections$ === void 0 ? void 0 : _fileRejections$.errors.map(function (_ref2) {
|
|
152
|
+
var message = _ref2.message,
|
|
153
|
+
code = _ref2.code;
|
|
154
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
155
|
+
className: "neeto-ui-text-error-500 items",
|
|
156
|
+
"data-cy": "file-input-error-message",
|
|
157
|
+
key: code,
|
|
158
|
+
style: "body3"
|
|
159
|
+
}, message);
|
|
160
|
+
});
|
|
161
|
+
var _useTranslation = useTranslation(),
|
|
162
|
+
t = _useTranslation.t;
|
|
163
|
+
return /*#__PURE__*/React.createElement(Pane, {
|
|
164
|
+
"data-testid": "bulk-upload-pane",
|
|
165
|
+
isOpen: isOpen,
|
|
166
|
+
onClose: onClose
|
|
167
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
168
|
+
tabIndex: 0
|
|
169
|
+
}, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
170
|
+
"data-testid": "bulk-upload-header",
|
|
171
|
+
style: "h2",
|
|
172
|
+
weight: "semibold"
|
|
173
|
+
}, t("neetoMolecules.shareViaLink.bulkUpload"))), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
|
|
174
|
+
className: "w-full space-y-4"
|
|
175
|
+
}, /*#__PURE__*/React.createElement(Requirements$1, {
|
|
176
|
+
fileSize: fileSize
|
|
177
|
+
}), /*#__PURE__*/React.createElement("div", getRootProps({
|
|
178
|
+
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", {
|
|
179
|
+
"neeto-ui-border-gray-100": isDragActive,
|
|
180
|
+
"neeto-ui-border-error neeto-ui-bg-pastel-red hover:neeto-ui-bg-pastel-red": fileRejections.length
|
|
181
|
+
})
|
|
182
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
183
|
+
className: "flex flex-col items-center space-y-3 p-4"
|
|
184
|
+
}, /*#__PURE__*/React.createElement(Upload, {
|
|
185
|
+
className: "neeto-ui-text-primary-500",
|
|
186
|
+
size: 32
|
|
187
|
+
}), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
|
|
188
|
+
"data-cy": "csv-upload-input",
|
|
189
|
+
"data-testid": "csv-upload-input"
|
|
190
|
+
})), isDragActive ? /*#__PURE__*/React.createElement(Typography, {
|
|
191
|
+
style: "body2"
|
|
192
|
+
}, t("neetoMolecules.shareViaLink.bulkUploadPane.dropFileHere")) : /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
className: "flex flex-col items-center space-y-1"
|
|
194
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
195
|
+
className: "flex w-full items-center justify-center gap-x-1"
|
|
196
|
+
}, /*#__PURE__*/React.createElement(Trans, {
|
|
197
|
+
i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.dragNDrop",
|
|
198
|
+
components: {
|
|
199
|
+
Button: /*#__PURE__*/React.createElement(Button, {
|
|
200
|
+
style: "link"
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
})), /*#__PURE__*/React.createElement(Typography, {
|
|
204
|
+
className: "neeto-ui-text-gray-700",
|
|
205
|
+
style: "body3"
|
|
206
|
+
}, fileType && /*#__PURE__*/React.createElement(Trans, {
|
|
207
|
+
i18nKey: "neetoMolecules.shareViaLink.bulkUploadPane.supportedFormat",
|
|
208
|
+
values: {
|
|
209
|
+
fileType: fileType
|
|
210
|
+
},
|
|
211
|
+
components: {
|
|
212
|
+
code: /*#__PURE__*/React.createElement("code", {
|
|
213
|
+
className: "neeto-ui-typography neeto-ui-text-body3 neeto-ui-bg-white m-0 border-l-0 p-0"
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
}), " ", fileSize && t("neetoMolecules.shareViaLink.bulkUploadPane.supportedSize", {
|
|
217
|
+
fileSize: fileSize
|
|
218
|
+
})))), errors))), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
219
|
+
className: "flex items-center space-x-2"
|
|
220
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
221
|
+
"data-cy": "bulk-upload-cancel-button",
|
|
222
|
+
"data-testid": "bulk-upload-cancel-button",
|
|
223
|
+
label: t("neetoMolecules.common.actions.cancel"),
|
|
224
|
+
style: "text",
|
|
225
|
+
type: "reset",
|
|
226
|
+
onClick: onClose
|
|
227
|
+
}))));
|
|
461
228
|
};
|
|
462
229
|
|
|
463
230
|
var isValidEmail = function isValidEmail(email) {
|
|
@@ -473,40 +240,27 @@ var createEmailOptions = function createEmailOptions() {
|
|
|
473
240
|
};
|
|
474
241
|
});
|
|
475
242
|
};
|
|
476
|
-
var parseCsvEmails =
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
});
|
|
494
|
-
onSuccess(createEmailOptions(emails));
|
|
495
|
-
} else {
|
|
496
|
-
Toastr.error(t("neetoMolecules.sendToFields.errors.invalidCsv"));
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
case 1:
|
|
501
|
-
case "end":
|
|
502
|
-
return _context.stop();
|
|
243
|
+
var parseCsvEmails = function parseCsvEmails(file, onSuccess) {
|
|
244
|
+
Papa.parse(file, {
|
|
245
|
+
header: true,
|
|
246
|
+
skipEmptyLines: true,
|
|
247
|
+
transformHeader: function transformHeader(h) {
|
|
248
|
+
return h.toLowerCase().replace(/\W/g, "");
|
|
249
|
+
},
|
|
250
|
+
complete: function complete(results) {
|
|
251
|
+
var _results$meta$fields;
|
|
252
|
+
var isEmailFieldPresent = (_results$meta$fields = results.meta.fields) === null || _results$meta$fields === void 0 ? void 0 : _results$meta$fields.includes("email");
|
|
253
|
+
if (isEmailFieldPresent) {
|
|
254
|
+
var emails = results.data.filter(prop("email")).map(function (item) {
|
|
255
|
+
return item.email.trim();
|
|
256
|
+
});
|
|
257
|
+
onSuccess(createEmailOptions(emails));
|
|
258
|
+
} else {
|
|
259
|
+
Toastr.error(t("neetoMolecules.sendToFields.errors.invalidCsv"));
|
|
503
260
|
}
|
|
504
|
-
}
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
return _ref.apply(this, arguments);
|
|
508
|
-
};
|
|
509
|
-
}();
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
};
|
|
510
264
|
|
|
511
265
|
var SendToFields = function SendToFields(_ref) {
|
|
512
266
|
var emailInputProps = _ref.emailInputProps,
|
|
@@ -516,6 +270,10 @@ var SendToFields = function SendToFields(_ref) {
|
|
|
516
270
|
showUploadCsvButton = _ref$showUploadCsvBut === void 0 ? false : _ref$showUploadCsvBut,
|
|
517
271
|
_ref$showCcBccButton = _ref.showCcBccButton,
|
|
518
272
|
showCcBccButton = _ref$showCcBccButton === void 0 ? false : _ref$showCcBccButton;
|
|
273
|
+
var _useState = useState(false),
|
|
274
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
275
|
+
isBulkUploadPaneOpen = _useState2[0],
|
|
276
|
+
setIsBulkUploadPaneOpen = _useState2[1];
|
|
519
277
|
var sendToFieldRef = useRef();
|
|
520
278
|
var _useFormikContext = useFormikContext(),
|
|
521
279
|
_useFormikContext$val = _useFormikContext.values,
|
|
@@ -524,58 +282,36 @@ var SendToFields = function SendToFields(_ref) {
|
|
|
524
282
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
525
283
|
var _useTranslation = useTranslation(),
|
|
526
284
|
t = _useTranslation.t;
|
|
527
|
-
var handleCSVFile =
|
|
528
|
-
|
|
529
|
-
var _sendToFieldRef$curre
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
(_sendToFieldRef$curre = sendToFieldRef.current) === null || _sendToFieldRef$curre === void 0 ? void 0 : _sendToFieldRef$curre.focus();
|
|
541
|
-
_context.next = 10;
|
|
542
|
-
break;
|
|
543
|
-
case 7:
|
|
544
|
-
_context.prev = 7;
|
|
545
|
-
_context.t0 = _context["catch"](0);
|
|
546
|
-
Toastr.error(_context.t0);
|
|
547
|
-
case 10:
|
|
548
|
-
case "end":
|
|
549
|
-
return _context.stop();
|
|
550
|
-
}
|
|
551
|
-
}, _callee, null, [[0, 7]]);
|
|
552
|
-
}));
|
|
553
|
-
return function handleCSVFile(_x) {
|
|
554
|
-
return _ref2.apply(this, arguments);
|
|
555
|
-
};
|
|
556
|
-
}();
|
|
285
|
+
var handleCSVFile = function handleCSVFile(file) {
|
|
286
|
+
try {
|
|
287
|
+
var _sendToFieldRef$curre;
|
|
288
|
+
var onSuccess = function onSuccess(values) {
|
|
289
|
+
return setFieldValue(emailInputProps.name || "sendTo", [].concat(_toConsumableArray(existingSendToEmails), _toConsumableArray(values)));
|
|
290
|
+
};
|
|
291
|
+
parseCsvEmails(file, onSuccess);
|
|
292
|
+
setIsBulkUploadPaneOpen(false);
|
|
293
|
+
(_sendToFieldRef$curre = sendToFieldRef.current) === null || _sendToFieldRef$curre === void 0 ? void 0 : _sendToFieldRef$curre.focus();
|
|
294
|
+
} catch (error) {
|
|
295
|
+
Toastr.error(error);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
557
298
|
var handelCcBccButtonClick = function handelCcBccButtonClick(e) {
|
|
558
299
|
e.stopPropagation();
|
|
559
300
|
setFieldValue("showCopyEmails", !showCopyEmails);
|
|
560
301
|
};
|
|
561
302
|
return /*#__PURE__*/React.createElement("div", {
|
|
562
303
|
className: "relative w-full flex-col gap-2"
|
|
563
|
-
}, showUploadCsvButton && /*#__PURE__*/React.createElement(
|
|
564
|
-
className: "absolute top-0 right-1"
|
|
565
|
-
|
|
566
|
-
types: ALLOWED_FILE_PICKER_TYPES,
|
|
567
|
-
onChange: handleCSVFile
|
|
568
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
569
|
-
"data-cy": "upload-csv-button",
|
|
304
|
+
}, showUploadCsvButton && /*#__PURE__*/React.createElement(Button, {
|
|
305
|
+
className: "absolute top-0 right-1",
|
|
306
|
+
"data-testid": "bulk-upload-button",
|
|
570
307
|
icon: Upload,
|
|
571
|
-
label: t("neetoMolecules.
|
|
308
|
+
label: t("neetoMolecules.shareViaLink.bulkUpload"),
|
|
572
309
|
size: "small",
|
|
573
310
|
style: "link",
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
position: "right"
|
|
311
|
+
onClick: function onClick() {
|
|
312
|
+
return setIsBulkUploadPaneOpen(true);
|
|
577
313
|
}
|
|
578
|
-
})
|
|
314
|
+
}), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
579
315
|
"data-testid": "emails",
|
|
580
316
|
name: "sendTo",
|
|
581
317
|
ref: sendToFieldRef
|
|
@@ -594,7 +330,15 @@ var SendToFields = function SendToFields(_ref) {
|
|
|
594
330
|
name: "sendToBcc"
|
|
595
331
|
}, ccInputProps)), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
|
|
596
332
|
name: "sendToCc"
|
|
597
|
-
}, bccInputProps)))
|
|
333
|
+
}, bccInputProps))), /*#__PURE__*/React.createElement(BulkUploadPane, {
|
|
334
|
+
fileSize: globalProps.endUserUploadedFileSizeLimitInMb,
|
|
335
|
+
fileType: ALLOWED_FILE_TYPES,
|
|
336
|
+
handleFileSubmit: handleCSVFile,
|
|
337
|
+
isOpen: isBulkUploadPaneOpen,
|
|
338
|
+
onClose: function onClose() {
|
|
339
|
+
return setIsBulkUploadPaneOpen(false);
|
|
340
|
+
}
|
|
341
|
+
}));
|
|
598
342
|
};
|
|
599
343
|
|
|
600
344
|
export { SendToFields as default };
|