@propellerads/kyc-form 4.1.0 → 4.1.1

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.
@@ -7,67 +7,150 @@ import { errorColor, spacing, fontSmall, white, gray50, gray95, borderRadius, fo
7
7
  import TextArea from '@propellerads/textarea';
8
8
  import ImageUploader, { DIRECTION } from '@propellerads/image-uploader';
9
9
 
10
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
11
11
  try {
12
- var info = gen[key](arg);
13
- var value = info.value;
14
- } catch (error) {
15
- reject(error);
16
- return;
17
- }
18
-
19
- if (info.done) {
20
- resolve(value);
21
- } else {
22
- Promise.resolve(value).then(_next, _throw);
12
+ var i = n[a](c),
13
+ u = i.value;
14
+ } catch (n) {
15
+ return void e(n);
23
16
  }
17
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
24
18
  }
25
-
26
- function _asyncToGenerator(fn) {
19
+ function _asyncToGenerator(n) {
27
20
  return function () {
28
- var self = this,
29
- args = arguments;
30
- return new Promise(function (resolve, reject) {
31
- var gen = fn.apply(self, args);
32
-
33
- function _next(value) {
34
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
21
+ var t = this,
22
+ e = arguments;
23
+ return new Promise(function (r, o) {
24
+ var a = n.apply(t, e);
25
+ function _next(n) {
26
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
35
27
  }
36
-
37
- function _throw(err) {
38
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
28
+ function _throw(n) {
29
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
39
30
  }
40
-
41
- _next(undefined);
31
+ _next(void 0);
42
32
  });
43
33
  };
44
34
  }
45
-
46
35
  function _extends() {
47
- _extends = Object.assign || function (target) {
48
- for (var i = 1; i < arguments.length; i++) {
49
- var source = arguments[i];
50
-
51
- for (var key in source) {
52
- if (Object.prototype.hasOwnProperty.call(source, key)) {
53
- target[key] = source[key];
36
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
37
+ for (var e = 1; e < arguments.length; e++) {
38
+ var t = arguments[e];
39
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
40
+ }
41
+ return n;
42
+ }, _extends.apply(null, arguments);
43
+ }
44
+ function _regenerator() {
45
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
46
+ var e,
47
+ t,
48
+ r = "function" == typeof Symbol ? Symbol : {},
49
+ n = r.iterator || "@@iterator",
50
+ o = r.toStringTag || "@@toStringTag";
51
+ function i(r, n, o, i) {
52
+ var c = n && n.prototype instanceof Generator ? n : Generator,
53
+ u = Object.create(c.prototype);
54
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
55
+ var i,
56
+ c,
57
+ u,
58
+ f = 0,
59
+ p = o || [],
60
+ y = !1,
61
+ G = {
62
+ p: 0,
63
+ n: 0,
64
+ v: e,
65
+ a: d,
66
+ f: d.bind(e, 4),
67
+ d: function (t, r) {
68
+ return i = t, c = 0, u = e, G.n = r, a;
69
+ }
70
+ };
71
+ function d(r, n) {
72
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
73
+ var o,
74
+ i = p[t],
75
+ d = G.p,
76
+ l = i[2];
77
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
54
78
  }
79
+ if (o || r > 1) return a;
80
+ throw y = !0, n;
55
81
  }
56
- }
57
-
58
- return target;
59
- };
60
-
61
- return _extends.apply(this, arguments);
82
+ return function (o, p, l) {
83
+ if (f > 1) throw TypeError("Generator is already running");
84
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
85
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
86
+ try {
87
+ if (f = 2, i) {
88
+ if (c || (o = "next"), t = i[o]) {
89
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
90
+ if (!t.done) return t;
91
+ u = t.value, c < 2 && (c = 0);
92
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
93
+ i = e;
94
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
95
+ } catch (t) {
96
+ i = e, c = 1, u = t;
97
+ } finally {
98
+ f = 1;
99
+ }
100
+ }
101
+ return {
102
+ value: t,
103
+ done: y
104
+ };
105
+ };
106
+ }(r, o, i), !0), u;
107
+ }
108
+ var a = {};
109
+ function Generator() {}
110
+ function GeneratorFunction() {}
111
+ function GeneratorFunctionPrototype() {}
112
+ t = Object.getPrototypeOf;
113
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
114
+ return this;
115
+ }), t),
116
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
117
+ function f(e) {
118
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
119
+ }
120
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
121
+ return this;
122
+ }), _regeneratorDefine(u, "toString", function () {
123
+ return "[object Generator]";
124
+ }), (_regenerator = function () {
125
+ return {
126
+ w: i,
127
+ m: f
128
+ };
129
+ })();
62
130
  }
63
-
64
- function _taggedTemplateLiteralLoose(strings, raw) {
65
- if (!raw) {
66
- raw = strings.slice(0);
131
+ function _regeneratorDefine(e, r, n, t) {
132
+ var i = Object.defineProperty;
133
+ try {
134
+ i({}, "", {});
135
+ } catch (e) {
136
+ i = 0;
67
137
  }
68
-
69
- strings.raw = raw;
70
- return strings;
138
+ _regeneratorDefine = function (e, r, n, t) {
139
+ function o(r, n) {
140
+ _regeneratorDefine(e, r, function (e) {
141
+ return this._invoke(r, n, e);
142
+ });
143
+ }
144
+ r ? i ? i(e, r, {
145
+ value: n,
146
+ enumerable: !t,
147
+ configurable: !t,
148
+ writable: !t
149
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
150
+ }, _regeneratorDefine(e, r, n, t);
151
+ }
152
+ function _taggedTemplateLiteralLoose(e, t) {
153
+ return t || (t = e.slice(0)), e.raw = t, e;
71
154
  }
72
155
 
73
156
  var _templateObject, _templateObject2, _templateObject3;
@@ -91,7 +174,6 @@ var StyledKYCFailScreen = /*#__PURE__*/styled.div(_templateObject4 || (_template
91
174
  var StyledKYCFailScreenItem = /*#__PURE__*/styled.span(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: ", "px;\n"])), spacing * 6);
92
175
 
93
176
  var DOCUMENT_TYPES;
94
-
95
177
  (function (DOCUMENT_TYPES) {
96
178
  DOCUMENT_TYPES["ID"] = "id";
97
179
  DOCUMENT_TYPES["UB"] = "ub";
@@ -107,9 +189,7 @@ var DOCUMENT_TYPES;
107
189
  DOCUMENT_TYPES["OTHER"] = "other";
108
190
  DOCUMENT_TYPES["FEEDBACK"] = "feedback";
109
191
  })(DOCUMENT_TYPES || (DOCUMENT_TYPES = {}));
110
-
111
192
  var PART_TYPES;
112
-
113
193
  (function (PART_TYPES) {
114
194
  PART_TYPES["ID_FRONT"] = "id_front";
115
195
  PART_TYPES["ID_BACK"] = "id_back";
@@ -141,9 +221,9 @@ var OPTIONAL_DOCUMENT_PARTS = (_OPTIONAL_DOCUMENT_PA = {}, _OPTIONAL_DOCUMENT_PA
141
221
 
142
222
  var KYCSucessScreen = function KYCSucessScreen(props) {
143
223
  var elementId = props.elementId,
144
- title = props.title,
145
- description = props.description,
146
- support = props.support;
224
+ title = props.title,
225
+ description = props.description,
226
+ support = props.support;
147
227
  return React.createElement(StyledKYCSucessScreen, {
148
228
  id: elementId
149
229
  }, React.createElement(StyledKYCSucessScreenItem, null, React.createElement(SuccessLabel, {
@@ -151,11 +231,10 @@ var KYCSucessScreen = function KYCSucessScreen(props) {
151
231
  elementId: elementId + "_success"
152
232
  }, title)), description && React.createElement(StyledKYCSucessScreenItem, null, description), support && React.createElement(StyledKYCSucessScreenSuppport, null, support));
153
233
  };
154
-
155
234
  var KYCFailScreen = function KYCFailScreen(props) {
156
235
  var elementId = props.elementId,
157
- title = props.title,
158
- support = props.support;
236
+ title = props.title,
237
+ support = props.support;
159
238
  return React.createElement(StyledKYCFailScreen, {
160
239
  id: elementId
161
240
  }, React.createElement(StyledKYCFailScreenItem, null, React.createElement(KYCErrorLabel, {
@@ -163,772 +242,11 @@ var KYCFailScreen = function KYCFailScreen(props) {
163
242
  isDocumentPartError: false
164
243
  })), support);
165
244
  };
166
-
167
245
  var KYCStatusScreen = {
168
246
  KYCSucessScreen: KYCSucessScreen,
169
247
  KYCFailScreen: KYCFailScreen
170
248
  };
171
249
 
172
- function createCommonjsModule(fn, module) {
173
- return module = { exports: {} }, fn(module, module.exports), module.exports;
174
- }
175
-
176
- var runtime_1 = createCommonjsModule(function (module) {
177
- /**
178
- * Copyright (c) 2014-present, Facebook, Inc.
179
- *
180
- * This source code is licensed under the MIT license found in the
181
- * LICENSE file in the root directory of this source tree.
182
- */
183
-
184
- var runtime = (function (exports) {
185
-
186
- var Op = Object.prototype;
187
- var hasOwn = Op.hasOwnProperty;
188
- var undefined$1; // More compressible than void 0.
189
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
190
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
191
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
192
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
193
-
194
- function define(obj, key, value) {
195
- Object.defineProperty(obj, key, {
196
- value: value,
197
- enumerable: true,
198
- configurable: true,
199
- writable: true
200
- });
201
- return obj[key];
202
- }
203
- try {
204
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
205
- define({}, "");
206
- } catch (err) {
207
- define = function(obj, key, value) {
208
- return obj[key] = value;
209
- };
210
- }
211
-
212
- function wrap(innerFn, outerFn, self, tryLocsList) {
213
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
214
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
215
- var generator = Object.create(protoGenerator.prototype);
216
- var context = new Context(tryLocsList || []);
217
-
218
- // The ._invoke method unifies the implementations of the .next,
219
- // .throw, and .return methods.
220
- generator._invoke = makeInvokeMethod(innerFn, self, context);
221
-
222
- return generator;
223
- }
224
- exports.wrap = wrap;
225
-
226
- // Try/catch helper to minimize deoptimizations. Returns a completion
227
- // record like context.tryEntries[i].completion. This interface could
228
- // have been (and was previously) designed to take a closure to be
229
- // invoked without arguments, but in all the cases we care about we
230
- // already have an existing method we want to call, so there's no need
231
- // to create a new function object. We can even get away with assuming
232
- // the method takes exactly one argument, since that happens to be true
233
- // in every case, so we don't have to touch the arguments object. The
234
- // only additional allocation required is the completion record, which
235
- // has a stable shape and so hopefully should be cheap to allocate.
236
- function tryCatch(fn, obj, arg) {
237
- try {
238
- return { type: "normal", arg: fn.call(obj, arg) };
239
- } catch (err) {
240
- return { type: "throw", arg: err };
241
- }
242
- }
243
-
244
- var GenStateSuspendedStart = "suspendedStart";
245
- var GenStateSuspendedYield = "suspendedYield";
246
- var GenStateExecuting = "executing";
247
- var GenStateCompleted = "completed";
248
-
249
- // Returning this object from the innerFn has the same effect as
250
- // breaking out of the dispatch switch statement.
251
- var ContinueSentinel = {};
252
-
253
- // Dummy constructor functions that we use as the .constructor and
254
- // .constructor.prototype properties for functions that return Generator
255
- // objects. For full spec compliance, you may wish to configure your
256
- // minifier not to mangle the names of these two functions.
257
- function Generator() {}
258
- function GeneratorFunction() {}
259
- function GeneratorFunctionPrototype() {}
260
-
261
- // This is a polyfill for %IteratorPrototype% for environments that
262
- // don't natively support it.
263
- var IteratorPrototype = {};
264
- define(IteratorPrototype, iteratorSymbol, function () {
265
- return this;
266
- });
267
-
268
- var getProto = Object.getPrototypeOf;
269
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
270
- if (NativeIteratorPrototype &&
271
- NativeIteratorPrototype !== Op &&
272
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
273
- // This environment has a native %IteratorPrototype%; use it instead
274
- // of the polyfill.
275
- IteratorPrototype = NativeIteratorPrototype;
276
- }
277
-
278
- var Gp = GeneratorFunctionPrototype.prototype =
279
- Generator.prototype = Object.create(IteratorPrototype);
280
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
281
- define(Gp, "constructor", GeneratorFunctionPrototype);
282
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
283
- GeneratorFunction.displayName = define(
284
- GeneratorFunctionPrototype,
285
- toStringTagSymbol,
286
- "GeneratorFunction"
287
- );
288
-
289
- // Helper for defining the .next, .throw, and .return methods of the
290
- // Iterator interface in terms of a single ._invoke method.
291
- function defineIteratorMethods(prototype) {
292
- ["next", "throw", "return"].forEach(function(method) {
293
- define(prototype, method, function(arg) {
294
- return this._invoke(method, arg);
295
- });
296
- });
297
- }
298
-
299
- exports.isGeneratorFunction = function(genFun) {
300
- var ctor = typeof genFun === "function" && genFun.constructor;
301
- return ctor
302
- ? ctor === GeneratorFunction ||
303
- // For the native GeneratorFunction constructor, the best we can
304
- // do is to check its .name property.
305
- (ctor.displayName || ctor.name) === "GeneratorFunction"
306
- : false;
307
- };
308
-
309
- exports.mark = function(genFun) {
310
- if (Object.setPrototypeOf) {
311
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
312
- } else {
313
- genFun.__proto__ = GeneratorFunctionPrototype;
314
- define(genFun, toStringTagSymbol, "GeneratorFunction");
315
- }
316
- genFun.prototype = Object.create(Gp);
317
- return genFun;
318
- };
319
-
320
- // Within the body of any async function, `await x` is transformed to
321
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
322
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
323
- // meant to be awaited.
324
- exports.awrap = function(arg) {
325
- return { __await: arg };
326
- };
327
-
328
- function AsyncIterator(generator, PromiseImpl) {
329
- function invoke(method, arg, resolve, reject) {
330
- var record = tryCatch(generator[method], generator, arg);
331
- if (record.type === "throw") {
332
- reject(record.arg);
333
- } else {
334
- var result = record.arg;
335
- var value = result.value;
336
- if (value &&
337
- typeof value === "object" &&
338
- hasOwn.call(value, "__await")) {
339
- return PromiseImpl.resolve(value.__await).then(function(value) {
340
- invoke("next", value, resolve, reject);
341
- }, function(err) {
342
- invoke("throw", err, resolve, reject);
343
- });
344
- }
345
-
346
- return PromiseImpl.resolve(value).then(function(unwrapped) {
347
- // When a yielded Promise is resolved, its final value becomes
348
- // the .value of the Promise<{value,done}> result for the
349
- // current iteration.
350
- result.value = unwrapped;
351
- resolve(result);
352
- }, function(error) {
353
- // If a rejected Promise was yielded, throw the rejection back
354
- // into the async generator function so it can be handled there.
355
- return invoke("throw", error, resolve, reject);
356
- });
357
- }
358
- }
359
-
360
- var previousPromise;
361
-
362
- function enqueue(method, arg) {
363
- function callInvokeWithMethodAndArg() {
364
- return new PromiseImpl(function(resolve, reject) {
365
- invoke(method, arg, resolve, reject);
366
- });
367
- }
368
-
369
- return previousPromise =
370
- // If enqueue has been called before, then we want to wait until
371
- // all previous Promises have been resolved before calling invoke,
372
- // so that results are always delivered in the correct order. If
373
- // enqueue has not been called before, then it is important to
374
- // call invoke immediately, without waiting on a callback to fire,
375
- // so that the async generator function has the opportunity to do
376
- // any necessary setup in a predictable way. This predictability
377
- // is why the Promise constructor synchronously invokes its
378
- // executor callback, and why async functions synchronously
379
- // execute code before the first await. Since we implement simple
380
- // async functions in terms of async generators, it is especially
381
- // important to get this right, even though it requires care.
382
- previousPromise ? previousPromise.then(
383
- callInvokeWithMethodAndArg,
384
- // Avoid propagating failures to Promises returned by later
385
- // invocations of the iterator.
386
- callInvokeWithMethodAndArg
387
- ) : callInvokeWithMethodAndArg();
388
- }
389
-
390
- // Define the unified helper method that is used to implement .next,
391
- // .throw, and .return (see defineIteratorMethods).
392
- this._invoke = enqueue;
393
- }
394
-
395
- defineIteratorMethods(AsyncIterator.prototype);
396
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
397
- return this;
398
- });
399
- exports.AsyncIterator = AsyncIterator;
400
-
401
- // Note that simple async functions are implemented on top of
402
- // AsyncIterator objects; they just return a Promise for the value of
403
- // the final result produced by the iterator.
404
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
405
- if (PromiseImpl === void 0) PromiseImpl = Promise;
406
-
407
- var iter = new AsyncIterator(
408
- wrap(innerFn, outerFn, self, tryLocsList),
409
- PromiseImpl
410
- );
411
-
412
- return exports.isGeneratorFunction(outerFn)
413
- ? iter // If outerFn is a generator, return the full iterator.
414
- : iter.next().then(function(result) {
415
- return result.done ? result.value : iter.next();
416
- });
417
- };
418
-
419
- function makeInvokeMethod(innerFn, self, context) {
420
- var state = GenStateSuspendedStart;
421
-
422
- return function invoke(method, arg) {
423
- if (state === GenStateExecuting) {
424
- throw new Error("Generator is already running");
425
- }
426
-
427
- if (state === GenStateCompleted) {
428
- if (method === "throw") {
429
- throw arg;
430
- }
431
-
432
- // Be forgiving, per 25.3.3.3.3 of the spec:
433
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
434
- return doneResult();
435
- }
436
-
437
- context.method = method;
438
- context.arg = arg;
439
-
440
- while (true) {
441
- var delegate = context.delegate;
442
- if (delegate) {
443
- var delegateResult = maybeInvokeDelegate(delegate, context);
444
- if (delegateResult) {
445
- if (delegateResult === ContinueSentinel) continue;
446
- return delegateResult;
447
- }
448
- }
449
-
450
- if (context.method === "next") {
451
- // Setting context._sent for legacy support of Babel's
452
- // function.sent implementation.
453
- context.sent = context._sent = context.arg;
454
-
455
- } else if (context.method === "throw") {
456
- if (state === GenStateSuspendedStart) {
457
- state = GenStateCompleted;
458
- throw context.arg;
459
- }
460
-
461
- context.dispatchException(context.arg);
462
-
463
- } else if (context.method === "return") {
464
- context.abrupt("return", context.arg);
465
- }
466
-
467
- state = GenStateExecuting;
468
-
469
- var record = tryCatch(innerFn, self, context);
470
- if (record.type === "normal") {
471
- // If an exception is thrown from innerFn, we leave state ===
472
- // GenStateExecuting and loop back for another invocation.
473
- state = context.done
474
- ? GenStateCompleted
475
- : GenStateSuspendedYield;
476
-
477
- if (record.arg === ContinueSentinel) {
478
- continue;
479
- }
480
-
481
- return {
482
- value: record.arg,
483
- done: context.done
484
- };
485
-
486
- } else if (record.type === "throw") {
487
- state = GenStateCompleted;
488
- // Dispatch the exception by looping back around to the
489
- // context.dispatchException(context.arg) call above.
490
- context.method = "throw";
491
- context.arg = record.arg;
492
- }
493
- }
494
- };
495
- }
496
-
497
- // Call delegate.iterator[context.method](context.arg) and handle the
498
- // result, either by returning a { value, done } result from the
499
- // delegate iterator, or by modifying context.method and context.arg,
500
- // setting context.delegate to null, and returning the ContinueSentinel.
501
- function maybeInvokeDelegate(delegate, context) {
502
- var method = delegate.iterator[context.method];
503
- if (method === undefined$1) {
504
- // A .throw or .return when the delegate iterator has no .throw
505
- // method always terminates the yield* loop.
506
- context.delegate = null;
507
-
508
- if (context.method === "throw") {
509
- // Note: ["return"] must be used for ES3 parsing compatibility.
510
- if (delegate.iterator["return"]) {
511
- // If the delegate iterator has a return method, give it a
512
- // chance to clean up.
513
- context.method = "return";
514
- context.arg = undefined$1;
515
- maybeInvokeDelegate(delegate, context);
516
-
517
- if (context.method === "throw") {
518
- // If maybeInvokeDelegate(context) changed context.method from
519
- // "return" to "throw", let that override the TypeError below.
520
- return ContinueSentinel;
521
- }
522
- }
523
-
524
- context.method = "throw";
525
- context.arg = new TypeError(
526
- "The iterator does not provide a 'throw' method");
527
- }
528
-
529
- return ContinueSentinel;
530
- }
531
-
532
- var record = tryCatch(method, delegate.iterator, context.arg);
533
-
534
- if (record.type === "throw") {
535
- context.method = "throw";
536
- context.arg = record.arg;
537
- context.delegate = null;
538
- return ContinueSentinel;
539
- }
540
-
541
- var info = record.arg;
542
-
543
- if (! info) {
544
- context.method = "throw";
545
- context.arg = new TypeError("iterator result is not an object");
546
- context.delegate = null;
547
- return ContinueSentinel;
548
- }
549
-
550
- if (info.done) {
551
- // Assign the result of the finished delegate to the temporary
552
- // variable specified by delegate.resultName (see delegateYield).
553
- context[delegate.resultName] = info.value;
554
-
555
- // Resume execution at the desired location (see delegateYield).
556
- context.next = delegate.nextLoc;
557
-
558
- // If context.method was "throw" but the delegate handled the
559
- // exception, let the outer generator proceed normally. If
560
- // context.method was "next", forget context.arg since it has been
561
- // "consumed" by the delegate iterator. If context.method was
562
- // "return", allow the original .return call to continue in the
563
- // outer generator.
564
- if (context.method !== "return") {
565
- context.method = "next";
566
- context.arg = undefined$1;
567
- }
568
-
569
- } else {
570
- // Re-yield the result returned by the delegate method.
571
- return info;
572
- }
573
-
574
- // The delegate iterator is finished, so forget it and continue with
575
- // the outer generator.
576
- context.delegate = null;
577
- return ContinueSentinel;
578
- }
579
-
580
- // Define Generator.prototype.{next,throw,return} in terms of the
581
- // unified ._invoke helper method.
582
- defineIteratorMethods(Gp);
583
-
584
- define(Gp, toStringTagSymbol, "Generator");
585
-
586
- // A Generator should always return itself as the iterator object when the
587
- // @@iterator function is called on it. Some browsers' implementations of the
588
- // iterator prototype chain incorrectly implement this, causing the Generator
589
- // object to not be returned from this call. This ensures that doesn't happen.
590
- // See https://github.com/facebook/regenerator/issues/274 for more details.
591
- define(Gp, iteratorSymbol, function() {
592
- return this;
593
- });
594
-
595
- define(Gp, "toString", function() {
596
- return "[object Generator]";
597
- });
598
-
599
- function pushTryEntry(locs) {
600
- var entry = { tryLoc: locs[0] };
601
-
602
- if (1 in locs) {
603
- entry.catchLoc = locs[1];
604
- }
605
-
606
- if (2 in locs) {
607
- entry.finallyLoc = locs[2];
608
- entry.afterLoc = locs[3];
609
- }
610
-
611
- this.tryEntries.push(entry);
612
- }
613
-
614
- function resetTryEntry(entry) {
615
- var record = entry.completion || {};
616
- record.type = "normal";
617
- delete record.arg;
618
- entry.completion = record;
619
- }
620
-
621
- function Context(tryLocsList) {
622
- // The root entry object (effectively a try statement without a catch
623
- // or a finally block) gives us a place to store values thrown from
624
- // locations where there is no enclosing try statement.
625
- this.tryEntries = [{ tryLoc: "root" }];
626
- tryLocsList.forEach(pushTryEntry, this);
627
- this.reset(true);
628
- }
629
-
630
- exports.keys = function(object) {
631
- var keys = [];
632
- for (var key in object) {
633
- keys.push(key);
634
- }
635
- keys.reverse();
636
-
637
- // Rather than returning an object with a next method, we keep
638
- // things simple and return the next function itself.
639
- return function next() {
640
- while (keys.length) {
641
- var key = keys.pop();
642
- if (key in object) {
643
- next.value = key;
644
- next.done = false;
645
- return next;
646
- }
647
- }
648
-
649
- // To avoid creating an additional object, we just hang the .value
650
- // and .done properties off the next function object itself. This
651
- // also ensures that the minifier will not anonymize the function.
652
- next.done = true;
653
- return next;
654
- };
655
- };
656
-
657
- function values(iterable) {
658
- if (iterable) {
659
- var iteratorMethod = iterable[iteratorSymbol];
660
- if (iteratorMethod) {
661
- return iteratorMethod.call(iterable);
662
- }
663
-
664
- if (typeof iterable.next === "function") {
665
- return iterable;
666
- }
667
-
668
- if (!isNaN(iterable.length)) {
669
- var i = -1, next = function next() {
670
- while (++i < iterable.length) {
671
- if (hasOwn.call(iterable, i)) {
672
- next.value = iterable[i];
673
- next.done = false;
674
- return next;
675
- }
676
- }
677
-
678
- next.value = undefined$1;
679
- next.done = true;
680
-
681
- return next;
682
- };
683
-
684
- return next.next = next;
685
- }
686
- }
687
-
688
- // Return an iterator with no values.
689
- return { next: doneResult };
690
- }
691
- exports.values = values;
692
-
693
- function doneResult() {
694
- return { value: undefined$1, done: true };
695
- }
696
-
697
- Context.prototype = {
698
- constructor: Context,
699
-
700
- reset: function(skipTempReset) {
701
- this.prev = 0;
702
- this.next = 0;
703
- // Resetting context._sent for legacy support of Babel's
704
- // function.sent implementation.
705
- this.sent = this._sent = undefined$1;
706
- this.done = false;
707
- this.delegate = null;
708
-
709
- this.method = "next";
710
- this.arg = undefined$1;
711
-
712
- this.tryEntries.forEach(resetTryEntry);
713
-
714
- if (!skipTempReset) {
715
- for (var name in this) {
716
- // Not sure about the optimal order of these conditions:
717
- if (name.charAt(0) === "t" &&
718
- hasOwn.call(this, name) &&
719
- !isNaN(+name.slice(1))) {
720
- this[name] = undefined$1;
721
- }
722
- }
723
- }
724
- },
725
-
726
- stop: function() {
727
- this.done = true;
728
-
729
- var rootEntry = this.tryEntries[0];
730
- var rootRecord = rootEntry.completion;
731
- if (rootRecord.type === "throw") {
732
- throw rootRecord.arg;
733
- }
734
-
735
- return this.rval;
736
- },
737
-
738
- dispatchException: function(exception) {
739
- if (this.done) {
740
- throw exception;
741
- }
742
-
743
- var context = this;
744
- function handle(loc, caught) {
745
- record.type = "throw";
746
- record.arg = exception;
747
- context.next = loc;
748
-
749
- if (caught) {
750
- // If the dispatched exception was caught by a catch block,
751
- // then let that catch block handle the exception normally.
752
- context.method = "next";
753
- context.arg = undefined$1;
754
- }
755
-
756
- return !! caught;
757
- }
758
-
759
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
760
- var entry = this.tryEntries[i];
761
- var record = entry.completion;
762
-
763
- if (entry.tryLoc === "root") {
764
- // Exception thrown outside of any try block that could handle
765
- // it, so set the completion value of the entire function to
766
- // throw the exception.
767
- return handle("end");
768
- }
769
-
770
- if (entry.tryLoc <= this.prev) {
771
- var hasCatch = hasOwn.call(entry, "catchLoc");
772
- var hasFinally = hasOwn.call(entry, "finallyLoc");
773
-
774
- if (hasCatch && hasFinally) {
775
- if (this.prev < entry.catchLoc) {
776
- return handle(entry.catchLoc, true);
777
- } else if (this.prev < entry.finallyLoc) {
778
- return handle(entry.finallyLoc);
779
- }
780
-
781
- } else if (hasCatch) {
782
- if (this.prev < entry.catchLoc) {
783
- return handle(entry.catchLoc, true);
784
- }
785
-
786
- } else if (hasFinally) {
787
- if (this.prev < entry.finallyLoc) {
788
- return handle(entry.finallyLoc);
789
- }
790
-
791
- } else {
792
- throw new Error("try statement without catch or finally");
793
- }
794
- }
795
- }
796
- },
797
-
798
- abrupt: function(type, arg) {
799
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
800
- var entry = this.tryEntries[i];
801
- if (entry.tryLoc <= this.prev &&
802
- hasOwn.call(entry, "finallyLoc") &&
803
- this.prev < entry.finallyLoc) {
804
- var finallyEntry = entry;
805
- break;
806
- }
807
- }
808
-
809
- if (finallyEntry &&
810
- (type === "break" ||
811
- type === "continue") &&
812
- finallyEntry.tryLoc <= arg &&
813
- arg <= finallyEntry.finallyLoc) {
814
- // Ignore the finally entry if control is not jumping to a
815
- // location outside the try/catch block.
816
- finallyEntry = null;
817
- }
818
-
819
- var record = finallyEntry ? finallyEntry.completion : {};
820
- record.type = type;
821
- record.arg = arg;
822
-
823
- if (finallyEntry) {
824
- this.method = "next";
825
- this.next = finallyEntry.finallyLoc;
826
- return ContinueSentinel;
827
- }
828
-
829
- return this.complete(record);
830
- },
831
-
832
- complete: function(record, afterLoc) {
833
- if (record.type === "throw") {
834
- throw record.arg;
835
- }
836
-
837
- if (record.type === "break" ||
838
- record.type === "continue") {
839
- this.next = record.arg;
840
- } else if (record.type === "return") {
841
- this.rval = this.arg = record.arg;
842
- this.method = "return";
843
- this.next = "end";
844
- } else if (record.type === "normal" && afterLoc) {
845
- this.next = afterLoc;
846
- }
847
-
848
- return ContinueSentinel;
849
- },
850
-
851
- finish: function(finallyLoc) {
852
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
853
- var entry = this.tryEntries[i];
854
- if (entry.finallyLoc === finallyLoc) {
855
- this.complete(entry.completion, entry.afterLoc);
856
- resetTryEntry(entry);
857
- return ContinueSentinel;
858
- }
859
- }
860
- },
861
-
862
- "catch": function(tryLoc) {
863
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
864
- var entry = this.tryEntries[i];
865
- if (entry.tryLoc === tryLoc) {
866
- var record = entry.completion;
867
- if (record.type === "throw") {
868
- var thrown = record.arg;
869
- resetTryEntry(entry);
870
- }
871
- return thrown;
872
- }
873
- }
874
-
875
- // The context.catch method must only be called with a location
876
- // argument that corresponds to a known catch block.
877
- throw new Error("illegal catch attempt");
878
- },
879
-
880
- delegateYield: function(iterable, resultName, nextLoc) {
881
- this.delegate = {
882
- iterator: values(iterable),
883
- resultName: resultName,
884
- nextLoc: nextLoc
885
- };
886
-
887
- if (this.method === "next") {
888
- // Deliberately forget the last sent value so that we don't
889
- // accidentally pass it on to the delegate.
890
- this.arg = undefined$1;
891
- }
892
-
893
- return ContinueSentinel;
894
- }
895
- };
896
-
897
- // Regardless of whether this script is executing as a CommonJS module
898
- // or not, return the runtime object so that we can declare the variable
899
- // regeneratorRuntime in the outer scope, which allows this module to be
900
- // injected easily by `bin/regenerator --include-runtime script.js`.
901
- return exports;
902
-
903
- }(
904
- // If this script is executing as a CommonJS module, use module.exports
905
- // as the regeneratorRuntime namespace. Otherwise create a new empty
906
- // object. Either way, the resulting object will be used to initialize
907
- // the regeneratorRuntime variable at the top of this file.
908
- module.exports
909
- ));
910
-
911
- try {
912
- regeneratorRuntime = runtime;
913
- } catch (accidentalStrictMode) {
914
- // This module should not be running in strict mode, so the above
915
- // assignment should always work unless something is misconfigured. Just
916
- // in case runtime.js accidentally runs in strict mode, in modern engines
917
- // we can explicitly access globalThis. In older engines we can escape
918
- // strict mode using a global Function call. This could conceivably fail
919
- // if a Content Security Policy forbids using Function, but in that case
920
- // the proper solution is to fix the accidental strict mode problem. If
921
- // you've misconfigured your bundler to force strict mode and applied a
922
- // CSP to forbid Function, and you're not willing to fix either of those
923
- // problems, please detail your unique predicament in a GitHub issue.
924
- if (typeof globalThis === "object") {
925
- globalThis.regeneratorRuntime = runtime;
926
- } else {
927
- Function("r", "regeneratorRuntime = r")(runtime);
928
- }
929
- }
930
- });
931
-
932
250
  var _templateObject$2, _templateObject2$2, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
933
251
  var StyledKYCFormItem = /*#__PURE__*/styled.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: ", "px;\n margin-left: ", "px;\n"])), spacing * 4, spacing * 4);
934
252
  var StyledKYCFormItemFileTitle = /*#__PURE__*/styled.div(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: ", "px;\n"])), spacing);
@@ -942,65 +260,49 @@ var StyledKYCDocumentPartIconMiniature = /*#__PURE__*/styled.div(_templateObject
942
260
 
943
261
  var isDocumentExtraPartAvailable = function isDocumentExtraPartAvailable(documentType) {
944
262
  return AVAILABLE_EXTRA_PARTS_DOCUMENTS.includes(documentType);
945
- }; // eslint-disable-next-line max-len
946
-
947
-
263
+ };
264
+ // eslint-disable-next-line max-len
948
265
  var canAddExtraPart = function canAddExtraPart(documentType, parts) {
949
266
  return isDocumentExtraPartAvailable(documentType) && parts.every(function (part) {
950
267
  return Boolean(part.data);
951
268
  }) && parts.length < MAX_EXTRA_PARTS_COUNT && parts.length > 0;
952
269
  };
953
-
954
270
  var getMimeType = function getMimeType(partData) {
955
271
  var _partData$match;
956
-
957
- return partData == null ? void 0 : (_partData$match = partData.match(/[^:]\w+\/[\w-+\d.]+(?=;|,)/)) == null ? void 0 : _partData$match[0];
272
+ return partData == null || (_partData$match = partData.match(/[^:]\w+\/[\w-+\d.]+(?=;|,)/)) == null ? void 0 : _partData$match[0];
958
273
  };
959
-
960
274
  var isPDF = function isPDF(partData) {
961
275
  var mimeType = getMimeType(partData);
962
276
  return mimeType === PDF_MIME_TYPE;
963
277
  };
964
-
965
278
  var isHEIC = function isHEIC(partData) {
966
279
  var mimeType = getMimeType(partData);
967
280
  return mimeType === HEIC_MIME_TYPE;
968
281
  };
969
-
970
282
  var isFileUniqueInDocument = function isFileUniqueInDocument(file, parts) {
971
283
  return parts.every(function (part) {
972
284
  return part.data !== (file == null ? void 0 : file.data);
973
285
  });
974
286
  };
975
-
976
287
  var getFileBase64 = /*#__PURE__*/function () {
977
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(file) {
288
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(file) {
978
289
  var reader;
979
- return runtime_1.wrap(function _callee$(_context) {
980
- while (1) {
981
- switch (_context.prev = _context.next) {
982
- case 0:
983
- reader = new FileReader();
984
- return _context.abrupt("return", new Promise(function (resolve, reject) {
985
- reader.onload = function () {
986
- return resolve(reader.result);
987
- };
988
-
989
- reader.onerror = function (error) {
990
- return reject(error);
991
- };
992
-
993
- reader.readAsDataURL(file);
994
- }));
995
-
996
- case 2:
997
- case "end":
998
- return _context.stop();
999
- }
290
+ return _regenerator().w(function (_context) {
291
+ while (1) switch (_context.n) {
292
+ case 0:
293
+ reader = new FileReader();
294
+ return _context.a(2, new Promise(function (resolve, reject) {
295
+ reader.onload = function () {
296
+ return resolve(reader.result);
297
+ };
298
+ reader.onerror = function (error) {
299
+ return reject(error);
300
+ };
301
+ reader.readAsDataURL(file);
302
+ }));
1000
303
  }
1001
304
  }, _callee);
1002
305
  }));
1003
-
1004
306
  return function getFileBase64(_x) {
1005
307
  return _ref.apply(this, arguments);
1006
308
  };
@@ -1010,7 +312,6 @@ var KYCDocumentPartMiniature = function KYCDocumentPartMiniature(props) {
1010
312
  var data = props.data;
1011
313
  var isPDFPart = isPDF(data);
1012
314
  var isHEICPart = isHEIC(data);
1013
-
1014
315
  if (isPDFPart || isHEICPart) {
1015
316
  return React.createElement(StyledKYCDocumentPartIconMiniature, null, isPDFPart && React.createElement(Pdf, {
1016
317
  color: COLOR.GRAY,
@@ -1020,17 +321,15 @@ var KYCDocumentPartMiniature = function KYCDocumentPartMiniature(props) {
1020
321
  hoverColor: COLOR.GRAY
1021
322
  }));
1022
323
  }
1023
-
1024
324
  return React.createElement(StyledKYCDocumentPartImgMiniature, {
1025
325
  src: data
1026
326
  });
1027
327
  };
1028
-
1029
328
  var KYCFormItemFileExtraPart = function KYCFormItemFileExtraPart(props) {
1030
329
  var elementId = props.elementId,
1031
- title = props.title,
1032
- uploaderLabels = props.uploaderLabels,
1033
- onFileAdd = props.onFileAdd;
330
+ title = props.title,
331
+ uploaderLabels = props.uploaderLabels,
332
+ onFileAdd = props.onFileAdd;
1034
333
  return React.createElement(StyledKYCFormItemFileExtraPart, {
1035
334
  id: elementId
1036
335
  }, title && React.createElement(StyledKYCFormItemFileTitle, null, title), React.createElement(StyledKYCFormItemFileUploaderContainer, null, React.createElement(ImageUploader, {
@@ -1043,16 +342,15 @@ var KYCFormItemFileExtraPart = function KYCFormItemFileExtraPart(props) {
1043
342
  onDrop: onFileAdd
1044
343
  })));
1045
344
  };
1046
-
1047
345
  var KYCFormItemFile = function KYCFormItemFile(props) {
1048
346
  var name = props.name,
1049
- title = props.title,
1050
- data = props.data,
1051
- error = props.error,
1052
- elementId = props.elementId,
1053
- uploaderLabels = props.uploaderLabels,
1054
- onFileChange = props.onFileChange,
1055
- onFileRemove = props.onFileRemove;
347
+ title = props.title,
348
+ data = props.data,
349
+ error = props.error,
350
+ elementId = props.elementId,
351
+ uploaderLabels = props.uploaderLabels,
352
+ onFileChange = props.onFileChange,
353
+ onFileRemove = props.onFileRemove;
1056
354
  return React.createElement(StyledKYCFormItem, {
1057
355
  id: elementId
1058
356
  }, title && React.createElement(StyledKYCFormItemFileTitle, null, title), data ? React.createElement(StyledKYCFormItemFilePreview, null, React.createElement(KYCDocumentPartMiniature, {
@@ -1075,16 +373,13 @@ var KYCFormItemFile = function KYCFormItemFile(props) {
1075
373
  isDocumentPartError: true
1076
374
  }));
1077
375
  };
1078
-
1079
376
  var KYCFormItemText = function KYCFormItemText(props) {
1080
377
  var onFeedbackChange = props.onFeedbackChange,
1081
- _props$value = props.value,
1082
- value = _props$value === void 0 ? '' : _props$value;
1083
-
378
+ _props$value = props.value,
379
+ value = _props$value === void 0 ? '' : _props$value;
1084
380
  var handleChange = function handleChange(newValue) {
1085
381
  return onFeedbackChange(newValue);
1086
382
  };
1087
-
1088
383
  return React.createElement(StyledKYCFormItem, null, React.createElement(TextArea, {
1089
384
  onChange: handleChange,
1090
385
  onBlur: handleChange,
@@ -1094,7 +389,6 @@ var KYCFormItemText = function KYCFormItemText(props) {
1094
389
  elementId: "kyc-feedback-textarea"
1095
390
  }));
1096
391
  };
1097
-
1098
392
  var KYCDocumentParts = {
1099
393
  KYCFormItemFileExtraPart: KYCFormItemFileExtraPart,
1100
394
  KYCFormItemFile: KYCFormItemFile,
@@ -1109,47 +403,38 @@ var StyledKYCFormItemDescription = /*#__PURE__*/styled.div(_templateObject3$3 ||
1109
403
  var getErrorKey = function getErrorKey(documentIndex, partIndex) {
1110
404
  return "[" + documentIndex + "].parts[" + partIndex + "].data";
1111
405
  };
1112
-
1113
406
  var KYCFormItem = function KYCFormItem(props) {
1114
407
  var _documentLabelsParts$;
1115
-
1116
408
  var type = props.type,
1117
- index = props.index,
1118
- uploaderLabels = props.uploaderLabels,
1119
- documentLabels = props.documentLabels,
1120
- elementId = props.elementId,
1121
- parts = props.parts,
1122
- errors = props.errors,
1123
- onDocumentChange = props.onDocumentChange;
1124
-
409
+ index = props.index,
410
+ uploaderLabels = props.uploaderLabels,
411
+ documentLabels = props.documentLabels,
412
+ elementId = props.elementId,
413
+ parts = props.parts,
414
+ errors = props.errors,
415
+ onDocumentChange = props.onDocumentChange;
1125
416
  var _useState = useState(new Map()),
1126
- localErrors = _useState[0],
1127
- setLocalErrors = _useState[1];
1128
-
417
+ localErrors = _useState[0],
418
+ setLocalErrors = _useState[1];
1129
419
  var isAddExtraPartAvailable = canAddExtraPart(type, parts);
1130
420
  var documentLabelsParts = documentLabels == null ? void 0 : documentLabels.parts;
1131
-
1132
421
  var _useState2 = useState(new Map()),
1133
- fileNames = _useState2[0],
1134
- setFileNames = _useState2[1];
1135
-
422
+ fileNames = _useState2[0],
423
+ setFileNames = _useState2[1];
1136
424
  var setLocalErrorByPartIndex = function setLocalErrorByPartIndex(partIndex) {
1137
425
  var newLocalErrors = new Map(localErrors);
1138
426
  newLocalErrors.set(getErrorKey(index, partIndex), uploaderLabels.oversizeError);
1139
427
  setLocalErrors(newLocalErrors);
1140
428
  };
1141
-
1142
429
  var deleteLocalErrorByPartIndex = function deleteLocalErrorByPartIndex(partIndex) {
1143
430
  var newLocalErrors = new Map(localErrors);
1144
431
  newLocalErrors["delete"](getErrorKey(index, partIndex));
1145
432
  setLocalErrors(newLocalErrors);
1146
433
  };
1147
-
1148
434
  var updateDocumentPart = function updateDocumentPart(part, partIndex, data) {
1149
435
  var newPart = _extends({}, part, {
1150
436
  data: data
1151
437
  });
1152
-
1153
438
  var newParts = [].concat(parts);
1154
439
  newParts.splice(partIndex, 1, newPart);
1155
440
  var newDocument = {
@@ -1158,75 +443,59 @@ var KYCFormItem = function KYCFormItem(props) {
1158
443
  };
1159
444
  onDocumentChange(newDocument);
1160
445
  };
1161
-
1162
446
  var _onFileChange = /*#__PURE__*/function () {
1163
- var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(partIndex, file) {
447
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(partIndex, file) {
1164
448
  var part, data, newFileNames;
1165
- return runtime_1.wrap(function _callee$(_context) {
1166
- while (1) {
1167
- switch (_context.prev = _context.next) {
1168
- case 0:
1169
- if (file) {
1170
- _context.next = 3;
1171
- break;
1172
- }
1173
-
1174
- setLocalErrorByPartIndex(partIndex);
1175
- return _context.abrupt("return");
1176
-
1177
- case 3:
1178
- part = parts[partIndex] || parts[0];
1179
- _context.next = 6;
1180
- return getFileBase64(file);
1181
-
1182
- case 6:
1183
- data = _context.sent;
1184
- updateDocumentPart(part, partIndex, data);
1185
- newFileNames = new Map(fileNames);
1186
- newFileNames.set(data, file.name);
1187
- setFileNames(newFileNames);
1188
- deleteLocalErrorByPartIndex(partIndex);
1189
-
1190
- case 12:
1191
- case "end":
1192
- return _context.stop();
1193
- }
449
+ return _regenerator().w(function (_context) {
450
+ while (1) switch (_context.n) {
451
+ case 0:
452
+ if (file) {
453
+ _context.n = 1;
454
+ break;
455
+ }
456
+ setLocalErrorByPartIndex(partIndex);
457
+ return _context.a(2);
458
+ case 1:
459
+ part = parts[partIndex] || parts[0];
460
+ _context.n = 2;
461
+ return getFileBase64(file);
462
+ case 2:
463
+ data = _context.v;
464
+ updateDocumentPart(part, partIndex, data);
465
+ newFileNames = new Map(fileNames);
466
+ newFileNames.set(data, file.name);
467
+ setFileNames(newFileNames);
468
+ deleteLocalErrorByPartIndex(partIndex);
469
+ case 3:
470
+ return _context.a(2);
1194
471
  }
1195
472
  }, _callee);
1196
473
  }));
1197
-
1198
474
  return function onFileChange(_x, _x2) {
1199
475
  return _ref.apply(this, arguments);
1200
476
  };
1201
477
  }();
1202
-
1203
478
  var _onFileRemove = function onFileRemove(partIndex) {
1204
479
  var part = parts[partIndex];
1205
480
  updateDocumentPart(part, partIndex);
1206
481
  var removedPart = parts[partIndex];
1207
482
  var newFileNames = new Map(fileNames);
1208
-
1209
483
  if (removedPart != null && removedPart.data && isFileUniqueInDocument(removedPart, parts)) {
1210
484
  newFileNames["delete"](removedPart == null ? void 0 : removedPart.data);
1211
485
  }
1212
-
1213
486
  setFileNames(newFileNames);
1214
487
  deleteLocalErrorByPartIndex(partIndex);
1215
488
  };
1216
-
1217
489
  var getFileName = function getFileName(key) {
1218
490
  if (!key) {
1219
491
  return undefined;
1220
492
  }
1221
-
1222
493
  return fileNames.get(key);
1223
494
  };
1224
-
1225
495
  var _onFeedbackChange = function onFeedbackChange(partIndex, data) {
1226
496
  var part = parts[partIndex] || parts[0];
1227
497
  updateDocumentPart(part, partIndex, data);
1228
498
  };
1229
-
1230
499
  return React.createElement(StyledKYCFormItem$1, {
1231
500
  id: elementId
1232
501
  }, React.createElement(StyledKYCFormItemTitle, null, index + 1 + ". " + (documentLabels == null ? void 0 : documentLabels.title)), (documentLabels == null ? void 0 : documentLabels.description) && React.createElement(StyledKYCFormItemDescription, null, documentLabels == null ? void 0 : documentLabels.description), parts.map(function (part, partIndex) {
@@ -1234,20 +503,15 @@ var KYCFormItem = function KYCFormItem(props) {
1234
503
  var isExtraPartAvailable = isDocumentExtraPartAvailable(type);
1235
504
  var partLabels = documentLabelsParts == null ? void 0 : documentLabelsParts[part.type];
1236
505
  var partTitle = isExtraPartAvailable ? undefined : partLabels == null ? void 0 : partLabels.title;
1237
-
1238
506
  if (isDocumentExtraPartAvailable(type) && part.data) {
1239
507
  var _part$data;
1240
-
1241
508
  itemKey = itemKey + "_" + ((_part$data = part.data) == null ? void 0 : _part$data.substr(-32));
1242
-
1243
509
  if (!isFileUniqueInDocument(part, parts)) {
1244
510
  itemKey = itemKey + "_" + partIndex;
1245
511
  }
1246
512
  }
1247
-
1248
513
  var partError = errors == null ? void 0 : errors[getErrorKey(index, partIndex)];
1249
514
  var localPartError = localErrors.get(getErrorKey(index, partIndex));
1250
-
1251
515
  if (part.type === PART_TYPES.FEEDBACK) {
1252
516
  return React.createElement(KYCDocumentParts.KYCFormItemText, {
1253
517
  key: itemKey,
@@ -1257,7 +521,6 @@ var KYCFormItem = function KYCFormItem(props) {
1257
521
  }
1258
522
  });
1259
523
  }
1260
-
1261
524
  return React.createElement(KYCDocumentParts.KYCFormItemFile, {
1262
525
  title: partTitle,
1263
526
  data: part.data,
@@ -1276,7 +539,7 @@ var KYCFormItem = function KYCFormItem(props) {
1276
539
  });
1277
540
  }), isAddExtraPartAvailable && React.createElement(KYCDocumentParts.KYCFormItemFileExtraPart, {
1278
541
  elementId: elementId + "_extra",
1279
- title: documentLabelsParts == null ? void 0 : (_documentLabelsParts$ = documentLabelsParts[parts[0].type]) == null ? void 0 : _documentLabelsParts$.title,
542
+ title: documentLabelsParts == null || (_documentLabelsParts$ = documentLabelsParts[parts[0].type]) == null ? void 0 : _documentLabelsParts$.title,
1280
543
  uploaderLabels: uploaderLabels,
1281
544
  onFileAdd: function onFileAdd(file) {
1282
545
  return _onFileChange(parts.length, file);
@@ -1292,24 +555,21 @@ var StyledKYCFormButton = /*#__PURE__*/styled.div(_templateObject4$2 || (_templa
1292
555
 
1293
556
  var KYCForm = function KYCForm(props) {
1294
557
  var elementId = props.elementId,
1295
- title = props.title,
1296
- uploadButtonLabel = props.uploadButtonLabel,
1297
- uploaderLabels = props.uploaderLabels,
1298
- documentsLabels = props.documentsLabels,
1299
- documents = props.documents,
1300
- errors = props.errors,
1301
- isLoading = props.isLoading,
1302
- validator = props.validator,
1303
- onUploadClick = props.onUploadClick;
1304
-
558
+ title = props.title,
559
+ uploadButtonLabel = props.uploadButtonLabel,
560
+ uploaderLabels = props.uploaderLabels,
561
+ documentsLabels = props.documentsLabels,
562
+ documents = props.documents,
563
+ errors = props.errors,
564
+ isLoading = props.isLoading,
565
+ validator = props.validator,
566
+ onUploadClick = props.onUploadClick;
1305
567
  var _useState = useState(documents),
1306
- userDocuments = _useState[0],
1307
- setUserDocuments = _useState[1];
1308
-
568
+ userDocuments = _useState[0],
569
+ setUserDocuments = _useState[1];
1309
570
  var _useState2 = useState(true),
1310
- isButtonDisabled = _useState2[0],
1311
- setButtonDisabled = _useState2[1];
1312
-
571
+ isButtonDisabled = _useState2[0],
572
+ setButtonDisabled = _useState2[1];
1313
573
  useEffect(function () {
1314
574
  setUserDocuments(documents);
1315
575
  }, [documents]);
@@ -1317,13 +577,11 @@ var KYCForm = function KYCForm(props) {
1317
577
  var isValid = validator(userDocuments);
1318
578
  setButtonDisabled(!isValid);
1319
579
  }, [userDocuments, validator]);
1320
-
1321
580
  var _onDocumentChange = function onDocumentChange(index, document) {
1322
581
  var newDocuments = [].concat(userDocuments);
1323
582
  newDocuments.splice(index, 1, document);
1324
583
  setUserDocuments(newDocuments);
1325
584
  };
1326
-
1327
585
  return React.createElement(StyledKYCForm, {
1328
586
  id: elementId
1329
587
  }, title && React.createElement(StyledKYCFormTitle, null, title), React.createElement(StyledKYCFormDocuments, null, userDocuments.map(function (document, index) {
@@ -1351,7 +609,6 @@ var KYCForm = function KYCForm(props) {
1351
609
  }
1352
610
  }, uploadButtonLabel)));
1353
611
  };
1354
-
1355
612
  KYCForm.SucessScreen = KYCStatusScreen.KYCSucessScreen;
1356
613
  KYCForm.FailScreen = KYCStatusScreen.KYCFailScreen;
1357
614