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