@propellerads/kyc-form 4.1.8 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,11 +14,11 @@
14
14
 
15
15
  ### How to use
16
16
 
17
- - `import KycForm from '@propellerads/kyc-form';`
17
+ - `import KYCForm, {DocumentType, PartType} from '@propellerads/kyc-form';`
18
18
  - And render
19
19
 
20
- ```
21
- <KycForm
20
+ ```tsx
21
+ <KYCForm
22
22
  elementId="kyc-form-component"
23
23
  title="PropellerAds is integrating KYC systems into the business processes. To continue working we kindly ask you to provide the following documents:"
24
24
  uploadButtonLabel="Send documents"
@@ -27,18 +27,18 @@
27
27
  action: 'upload from your computer',
28
28
  oversizeError: 'File is too big',
29
29
  }}
30
- documentsLabels={
31
- [DOCUMENT_TYPES.CARD]: {
30
+ documentsLabels={{
31
+ [DocumentType.Card]: {
32
32
  title: 'Photo of the account owner’s ID card.',
33
33
  description: '(Passport/driver’s license/aadhar card etc.)',
34
34
  }
35
- }
35
+ }}
36
36
  documents={[{
37
- type: DOCUMENT_TYPES.ID,
37
+ type: DocumentType.Id,
38
38
  parts:[{
39
- type: PART_TYPES.ID_FRONT,
39
+ type: PartType.IdFront,
40
40
  }, {
41
- type: PART_TYPES.ID_BACK,
41
+ type: PartType.IdBack,
42
42
  }],
43
43
  }]}
44
44
  onUploadClick={console.log}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,109 @@
1
- import React from 'react';
2
- import { ACCEPT_FORMATS, AVAILABLE_EXTRA_PARTS_DOCUMENTS, MAX_EXTRA_PARTS_COUNT, MAX_FILE_SIZE, OPTIONAL_DOCUMENT_PARTS, PDF_MIME_TYPE } from './constants';
3
- import { DOCUMENT_TYPES, PART_TYPES } from './document.types';
4
- import { KYCFormProps } from './types';
5
- declare const KYCForm: {
6
- (props: KYCFormProps): React.JSX.Element;
7
- SucessScreen: (props: import("./KYCStatusScreen/types").KYCSucessScreenProps) => React.JSX.Element;
8
- FailScreen: (props: import("./KYCStatusScreen/types").KYCFailScreenProps) => React.JSX.Element;
9
- };
10
- export default KYCForm;
11
- export { ACCEPT_FORMATS, AVAILABLE_EXTRA_PARTS_DOCUMENTS, DOCUMENT_TYPES, MAX_EXTRA_PARTS_COUNT, MAX_FILE_SIZE, OPTIONAL_DOCUMENT_PARTS, PART_TYPES, PDF_MIME_TYPE, };
1
+ import { ReactNode } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { ImageUploaderProps } from '@propellerads/image-uploader';
4
+
5
+ type KYCSuccessScreenProps = {
6
+ elementId: string;
7
+ title: string;
8
+ description?: ReactNode;
9
+ support?: ReactNode;
10
+ };
11
+ type KYCFailScreenProps = {
12
+ elementId: string;
13
+ title: string;
14
+ support?: ReactNode;
15
+ };
16
+
17
+ declare const DocumentType: {
18
+ readonly Id: "id";
19
+ readonly Ub: "ub";
20
+ readonly IdExtra: "id_extra";
21
+ readonly Card: "bank_card";
22
+ readonly PaymentSystemScreen: "payment_system_screen";
23
+ readonly OnlineBankingStatement: "online_banking_statement";
24
+ readonly CompanyRegistrationDocument: "company_registration_document";
25
+ readonly SelfieWithIdCard: "selfie_with_id_card_or_bank_card";
26
+ readonly PaypalDetailsPage: "pay_pal_details_page";
27
+ readonly BankWireDetails: "bank_wire_details";
28
+ readonly TransactionConfirmation: "transaction_confirmation";
29
+ readonly Other: "other";
30
+ readonly Feedback: "feedback";
31
+ };
32
+ type DocumentType = (typeof DocumentType)[keyof typeof DocumentType];
33
+ declare const PartType: {
34
+ readonly IdFront: "id_front";
35
+ readonly IdBack: "id_back";
36
+ readonly Ub: "ub_item";
37
+ readonly Card: "card_item";
38
+ readonly PaymentSystemScreen: "screen_item";
39
+ readonly OnlineBankingStatement: "obs_item";
40
+ readonly CompanyRegistrationDocument: "crd_item";
41
+ readonly SelfieWithIdCard: "selfie_item";
42
+ readonly PaypalDetailsPageImage: "pay_pal_details_page_image";
43
+ readonly BankWireDetailsPage: "bank_wire_details_image";
44
+ readonly TransactionConfirmationImage: "transaction_confirmation_image";
45
+ readonly OtherImage: "other_image";
46
+ readonly Feedback: "feedback";
47
+ };
48
+ type PartType = (typeof PartType)[keyof typeof PartType];
49
+ type KYCFileData = string | undefined;
50
+ type KYCFile = {
51
+ type: PartType;
52
+ data?: KYCFileData;
53
+ };
54
+ type KYCDocument = {
55
+ type: DocumentType;
56
+ parts: KYCFile[];
57
+ };
58
+
59
+ declare const MAX_FILE_SIZE = 5242880;
60
+ declare const MAX_EXTRA_PARTS_COUNT = 3;
61
+ declare const PDF_MIME_TYPE = "application/pdf";
62
+ declare const ACCEPT_FORMATS: ImageUploaderProps['acceptFormats'];
63
+ declare const AVAILABLE_EXTRA_PARTS_DOCUMENTS: DocumentType[];
64
+ declare const OPTIONAL_DOCUMENT_PARTS: {
65
+ id: {
66
+ parts: "id_back"[];
67
+ };
68
+ id_extra: {
69
+ parts: "id_back"[];
70
+ };
71
+ };
72
+
73
+ type UploaderLabels = {
74
+ title?: string;
75
+ description?: string;
76
+ action?: string;
77
+ oversizeError: string;
78
+ };
79
+ type PartLabels = {
80
+ title?: string;
81
+ };
82
+ type PartsLabels = Partial<Record<PartType, PartLabels>>;
83
+ type DocumentLabels = {
84
+ title: string;
85
+ description?: string;
86
+ parts?: PartsLabels;
87
+ };
88
+ type DocumentsLabels = Partial<Record<DocumentType, DocumentLabels>>;
89
+
90
+ type KYCFormProps = {
91
+ elementId: string;
92
+ title: ReactNode;
93
+ uploadButtonLabel: string;
94
+ uploaderLabels: UploaderLabels;
95
+ documentsLabels: DocumentsLabels;
96
+ documents: KYCDocument[];
97
+ isLoading?: boolean;
98
+ errors?: Record<string, string>;
99
+ validator: (documents: KYCDocument[]) => boolean;
100
+ onUploadClick: (documents: KYCDocument[]) => void;
101
+ };
102
+
103
+ declare const KYCForm: {
104
+ (props: KYCFormProps): react_jsx_runtime.JSX.Element;
105
+ SuccessScreen: (props: KYCSuccessScreenProps) => react_jsx_runtime.JSX.Element;
106
+ FailScreen: (props: KYCFailScreenProps) => react_jsx_runtime.JSX.Element;
107
+ };
108
+
109
+ export { ACCEPT_FORMATS, AVAILABLE_EXTRA_PARTS_DOCUMENTS, DocumentType, MAX_EXTRA_PARTS_COUNT, MAX_FILE_SIZE, OPTIONAL_DOCUMENT_PARTS, PDF_MIME_TYPE, PartType, KYCForm as default };
package/dist/index.js CHANGED
@@ -1,8 +1,400 @@
1
+ import { jsxs as C, jsx as n } from "react/jsx-runtime";
2
+ import pe, { ButtonType as ue } from "@propellerads/button";
3
+ import { useState as v, useEffect as N } from "react";
4
+ import { Close as ye, Size as ge, Color as S, Delete as he, Pdf as Ce, Insert as fe } from "@propellerads/icon";
5
+ import j, { Direction as z } from "@propellerads/image-uploader";
6
+ import _e from "@propellerads/textarea";
7
+ import c from "styled-components";
8
+ import { errorColor as W, spacing as m, fontSmall as G, white as X, gray95 as Se, borderRadius as B, fontNormal as H, black as Fe, gray50 as V } from "@propellerads/stylevariables";
9
+ import be from "@propellerads/success-label";
10
+ const g = {
11
+ Id: "id",
12
+ Ub: "ub",
13
+ IdExtra: "id_extra",
14
+ Card: "bank_card",
15
+ PaymentSystemScreen: "payment_system_screen",
16
+ OnlineBankingStatement: "online_banking_statement",
17
+ CompanyRegistrationDocument: "company_registration_document",
18
+ SelfieWithIdCard: "selfie_with_id_card_or_bank_card",
19
+ PaypalDetailsPage: "pay_pal_details_page",
20
+ BankWireDetails: "bank_wire_details",
21
+ TransactionConfirmation: "transaction_confirmation",
22
+ Other: "other",
23
+ Feedback: "feedback"
24
+ }, L = {
25
+ IdFront: "id_front",
26
+ IdBack: "id_back",
27
+ Ub: "ub_item",
28
+ Card: "card_item",
29
+ PaymentSystemScreen: "screen_item",
30
+ OnlineBankingStatement: "obs_item",
31
+ CompanyRegistrationDocument: "crd_item",
32
+ SelfieWithIdCard: "selfie_item",
33
+ PaypalDetailsPageImage: "pay_pal_details_page_image",
34
+ BankWireDetailsPage: "bank_wire_details_image",
35
+ TransactionConfirmationImage: "transaction_confirmation_image",
36
+ OtherImage: "other_image",
37
+ Feedback: "feedback"
38
+ }, q = 5242880, xe = 3, Z = "application/pdf", J = "image/heic", Q = {
39
+ "image/png": [".png"],
40
+ "image/jpeg": [".jpg", ".jpe", ".jpeg"],
41
+ [Z]: [".pdf"],
42
+ [J]: [".heic"]
43
+ }, $e = [
44
+ g.Card,
45
+ g.Card,
46
+ g.PaypalDetailsPage,
47
+ g.BankWireDetails,
48
+ g.TransactionConfirmation,
49
+ g.SelfieWithIdCard,
50
+ g.PaymentSystemScreen,
51
+ g.Other
52
+ ], mt = {
53
+ [g.Id]: {
54
+ parts: [L.IdBack]
55
+ },
56
+ [g.IdExtra]: {
57
+ parts: [L.IdBack]
58
+ }
59
+ }, Pe = c.div`
60
+ display: flex;
61
+ align-items: center;
62
+ color: ${W};
63
+ margin-top: ${m * 2}px;
64
+ margin-bottom: ${m * 4}px;
65
+ `, Ie = c.span`
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ width: 14px;
70
+ height: 14px;
71
+ border-radius: 100%;
72
+ background-color: ${W};
1
73
 
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./kyc-form.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./kyc-form.cjs.development.js')
8
- }
74
+ &:before {
75
+ font-size: ${G};
76
+ color: ${X};
77
+ content: '!';
78
+ }
79
+ `, De = c.span`
80
+ margin-left: ${m * 2}px;
81
+ `, ee = (r) => /* @__PURE__ */ C(Pe, { children: [
82
+ r.isDocumentPartError ? /* @__PURE__ */ n(Ie, {}) : /* @__PURE__ */ n(ye, { color: S.Error, hoverColor: S.Error, size: ge.Small }),
83
+ /* @__PURE__ */ n(De, { children: r.label })
84
+ ] }), A = (r) => $e.includes(r), Ee = (r, e) => A(r) && e.every((o) => !!o.data) && e.length < xe && e.length > 0, te = (r) => r?.match(/[^:]\w+\/[\w-+\d.]+(?=;|,)/)?.[0], Ke = (r) => te(r) === Z, Ye = (r) => te(r) === J, O = (r, e) => e.every((o) => o.data !== r?.data), ve = async (r) => {
85
+ const e = new FileReader();
86
+ return new Promise((o, i) => {
87
+ e.onload = () => o(e.result), e.onerror = (l) => i(l), e.readAsDataURL(r);
88
+ });
89
+ }, ne = c.div`
90
+ margin-top: ${m * 4}px;
91
+ margin-left: ${m * 4}px;
92
+ `, re = c.div`
93
+ margin-bottom: ${m}px;
94
+ `, we = c.div`
95
+ display: flex;
96
+ align-items: center;
97
+ background-color: ${Se};
98
+ padding: ${m * 2}px;
99
+ border-radius: ${B}px;
100
+ `, ke = c.span`
101
+ width: 100%;
102
+ margin-left: ${m * 4}px;
103
+ margin-right: ${m * 2}px;
104
+ `, Te = c.span`
105
+ cursor: pointer !important;
106
+ margin-right: ${m * 2}px;
107
+ `, oe = c.div`
108
+ height: 66px;
109
+ `, Le = c.div`
110
+ display: flex;
111
+ flex-direction: column;
112
+ margin-top: ${m * 4}px;
113
+ margin-left: ${m * 4}px;
114
+ `, Ae = c.img`
115
+ width: auto;
116
+ max-width: 204px;
117
+ height: 50px;
118
+ object-fit: contain;
119
+ border-radius: ${B}px;
120
+ `, Be = c.div`
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: center;
124
+ min-width: 50px;
125
+ height: 50px;
126
+ border-radius: ${B}px;
127
+ background-color: ${X};
128
+ `, Me = (r) => {
129
+ const { data: e } = r, o = Ke(e), i = Ye(e);
130
+ return o || i ? /* @__PURE__ */ C(Be, { children: [
131
+ o && /* @__PURE__ */ n(Ce, { color: S.Gray, hoverColor: S.Gray }),
132
+ i && /* @__PURE__ */ n(fe, { color: S.Gray, hoverColor: S.Gray })
133
+ ] }) : /* @__PURE__ */ n(Ae, { src: e });
134
+ }, Re = (r) => {
135
+ const { elementId: e, title: o, uploaderLabels: i, onFileAdd: l } = r, u = (s) => {
136
+ const [f] = s;
137
+ f && l(f);
138
+ };
139
+ return /* @__PURE__ */ C(Le, { id: e, children: [
140
+ o && /* @__PURE__ */ n(re, { children: o }),
141
+ /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ n(
142
+ j,
143
+ {
144
+ title: i.title,
145
+ action: i.action,
146
+ maxSize: q,
147
+ acceptFormats: Q,
148
+ elementId: `${e}_uploader`,
149
+ direction: z.Row,
150
+ onDrop: u
151
+ }
152
+ ) })
153
+ ] });
154
+ }, Ne = (r) => {
155
+ const { name: e, title: o, data: i, error: l, elementId: u, uploaderLabels: s, onFileChange: f, onFileRemove: P } = r, _ = ($) => {
156
+ const [y] = $;
157
+ y && f(y);
158
+ };
159
+ return /* @__PURE__ */ C(ne, { id: u, children: [
160
+ o && /* @__PURE__ */ n(re, { children: o }),
161
+ i ? /* @__PURE__ */ C(we, { children: [
162
+ /* @__PURE__ */ n(Me, { data: i }),
163
+ /* @__PURE__ */ n(ke, { children: e }),
164
+ /* @__PURE__ */ n(Te, { onClick: P, children: /* @__PURE__ */ n(he, { color: S.Blue, hoverColor: S.Blue }) })
165
+ ] }) : /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ n(
166
+ j,
167
+ {
168
+ title: s.title,
169
+ action: s.action,
170
+ maxSize: q,
171
+ acceptFormats: Q,
172
+ elementId: `${u}_uploader`,
173
+ direction: z.Row,
174
+ onDrop: _
175
+ }
176
+ ) }),
177
+ l && /* @__PURE__ */ n(ee, { label: l, isDocumentPartError: !0 })
178
+ ] });
179
+ }, Oe = (r) => {
180
+ const { onFeedbackChange: e, value: o = "" } = r, i = (l) => e(l);
181
+ return /* @__PURE__ */ n(ne, { children: /* @__PURE__ */ n(
182
+ _e,
183
+ {
184
+ onChange: i,
185
+ onBlur: i,
186
+ value: o,
187
+ errors: [],
188
+ name: "kyc-client-comments",
189
+ elementId: "kyc-feedback-textarea"
190
+ }
191
+ ) });
192
+ }, T = {
193
+ KYCFormItemFileExtraPart: Re,
194
+ KYCFormItemFile: Ne,
195
+ KYCFormItemText: Oe
196
+ }, Ue = c.div`
197
+ margin-top: ${m * 6}px;
198
+ `, je = c.div`
199
+ font-size: ${H}px;
200
+ font-weight: bold;
201
+ color: ${Fe};
202
+ margin-bottom: ${m}px;
203
+ `, ze = c.div`
204
+ font-size: ${G}px;
205
+ color: ${V};
206
+ margin-left: ${m * 4}px;
207
+ `, Y = (r, e) => `[${r}].parts[${e}].data`, We = (r) => {
208
+ const { type: e, index: o, uploaderLabels: i, documentLabels: l, elementId: u, parts: s, errors: f, onDocumentChange: P } = r, [_, $] = v(/* @__PURE__ */ new Map()), y = Ee(e, s), I = l?.parts, D = s[0], w = D ? I?.[D.type]?.title : void 0, [E, p] = v(/* @__PURE__ */ new Map()), F = (t) => {
209
+ const a = new Map(_);
210
+ a.set(Y(o, t), i.oversizeError), $(a);
211
+ }, b = (t) => {
212
+ const a = new Map(_);
213
+ a.delete(Y(o, t)), $(a);
214
+ }, K = (t, a, d) => {
215
+ const h = {
216
+ ...t,
217
+ data: d
218
+ }, x = [...s];
219
+ x.splice(a, 1, h), P({
220
+ type: e,
221
+ parts: x
222
+ });
223
+ }, M = async (t, a) => {
224
+ if (!a) {
225
+ F(t);
226
+ return;
227
+ }
228
+ const d = s[t] ?? s[0];
229
+ if (!d)
230
+ return;
231
+ const h = await ve(a);
232
+ K(d, t, h);
233
+ const x = new Map(E);
234
+ x.set(h, a.name), p(x), b(t);
235
+ }, ce = (t) => {
236
+ const a = s[t];
237
+ if (!a)
238
+ return;
239
+ K(a, t);
240
+ const d = s[t], h = new Map(E);
241
+ d?.data && O(d, s) && h.delete(d?.data), p(h), b(t);
242
+ }, se = (t) => {
243
+ if (t)
244
+ return E.get(t);
245
+ }, le = (t, a) => {
246
+ const d = s[t] ?? s[0];
247
+ d && K(d, t, a);
248
+ };
249
+ return /* @__PURE__ */ C(Ue, { id: u, children: [
250
+ /* @__PURE__ */ n(je, { children: `${o + 1}. ${l?.title}` }),
251
+ l?.description && /* @__PURE__ */ n(ze, { children: l?.description }),
252
+ s.map((t, a) => {
253
+ let d = `kyc-form_item_file_${t.type}`;
254
+ const h = A(e), x = I?.[t.type], R = h ? void 0 : x?.title;
255
+ A(e) && t.data && (d = `${d}_${t.data?.substr(-32)}`, O(t, s) || (d = `${d}_${a}`));
256
+ const de = f?.[Y(o, a)], me = _.get(Y(o, a));
257
+ return t.type === L.Feedback ? /* @__PURE__ */ n(
258
+ T.KYCFormItemText,
259
+ {
260
+ value: t.data,
261
+ onFeedbackChange: (k) => le(a, k)
262
+ },
263
+ d
264
+ ) : /* @__PURE__ */ n(
265
+ T.KYCFormItemFile,
266
+ {
267
+ title: R,
268
+ data: t.data,
269
+ type: t.type,
270
+ name: se(t.data),
271
+ uploaderLabels: i,
272
+ error: me || de,
273
+ elementId: `${u}_part_${t.type}_${a}`,
274
+ onFileChange: (k) => M(a, k),
275
+ onFileRemove: () => ce(a)
276
+ },
277
+ d
278
+ );
279
+ }),
280
+ y && D && /* @__PURE__ */ n(
281
+ T.KYCFormItemFileExtraPart,
282
+ {
283
+ elementId: `${u}_extra`,
284
+ title: w,
285
+ uploaderLabels: i,
286
+ onFileAdd: (t) => M(s.length, t)
287
+ }
288
+ )
289
+ ] });
290
+ }, Ge = c.div`
291
+ display: flex;
292
+ flex-direction: column;
293
+ `, U = c.span`
294
+ margin-bottom: ${m * 8}px;
295
+ `, Xe = c.span`
296
+ color: ${V};
297
+ `, He = c.div`
298
+ display: flex;
299
+ flex-direction: column;
300
+ `, Ve = c.span`
301
+ margin-bottom: ${m * 6}px;
302
+ `, qe = (r) => {
303
+ const { elementId: e, title: o, description: i, support: l } = r;
304
+ return /* @__PURE__ */ C(Ge, { id: e, children: [
305
+ /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(be, { show: !0, elementId: `${e}_success`, children: o }) }),
306
+ i && /* @__PURE__ */ n(U, { children: i }),
307
+ l && /* @__PURE__ */ n(Xe, { children: l })
308
+ ] });
309
+ }, Ze = (r) => {
310
+ const { elementId: e, title: o, support: i } = r;
311
+ return /* @__PURE__ */ C(He, { id: e, children: [
312
+ /* @__PURE__ */ n(Ve, { children: /* @__PURE__ */ n(ee, { label: o, isDocumentPartError: !1 }) }),
313
+ i
314
+ ] });
315
+ }, ie = {
316
+ KYCSuccessScreen: qe,
317
+ KYCFailScreen: Ze
318
+ }, Je = c.div`
319
+ display: flex;
320
+ flex-direction: column;
321
+ align-items: flex-start;
322
+ width: 100%;
323
+ `, Qe = c.div`
324
+ font-size: ${H}px;
325
+ `, et = c.div`
326
+ width: 100%;
327
+ margin-bottom: ${m * 6}px;
328
+ `, tt = c.div`
329
+ display: flex;
330
+ justify-content: flex-end;
331
+ width: 100%;
332
+ `, ae = (r) => {
333
+ const {
334
+ elementId: e,
335
+ title: o,
336
+ uploadButtonLabel: i,
337
+ uploaderLabels: l,
338
+ documentsLabels: u,
339
+ documents: s,
340
+ errors: f,
341
+ isLoading: P,
342
+ validator: _,
343
+ onUploadClick: $
344
+ } = r, [y, I] = v(s), [D, w] = v(!0);
345
+ N(() => {
346
+ I(s);
347
+ }, [s]), N(() => {
348
+ const p = _(y);
349
+ w(!p);
350
+ }, [y, _]);
351
+ const E = (p, F) => {
352
+ const b = [...y];
353
+ b.splice(p, 1, F), I(b);
354
+ };
355
+ return /* @__PURE__ */ C(Je, { id: e, children: [
356
+ o && /* @__PURE__ */ n(Qe, { children: o }),
357
+ /* @__PURE__ */ n(et, { children: y.map((p, F) => {
358
+ const b = `kyc-form_item_${p.type}_${F}`;
359
+ return /* @__PURE__ */ n(
360
+ We,
361
+ {
362
+ index: F,
363
+ type: p.type,
364
+ parts: p.parts,
365
+ documentLabels: u[p.type],
366
+ uploaderLabels: l,
367
+ errors: f,
368
+ elementId: `${e}_item_${p.type}`,
369
+ onDocumentChange: (K) => E(F, K)
370
+ },
371
+ b
372
+ );
373
+ }) }),
374
+ /* @__PURE__ */ n(tt, { children: /* @__PURE__ */ n(
375
+ pe,
376
+ {
377
+ elementId: `${e}_button`,
378
+ type: ue.Primary,
379
+ isDisabled: D,
380
+ isLoading: P || !1,
381
+ onClick: () => $(y),
382
+ children: i
383
+ }
384
+ ) })
385
+ ] });
386
+ };
387
+ ae.SuccessScreen = ie.KYCSuccessScreen;
388
+ ae.FailScreen = ie.KYCFailScreen;
389
+ export {
390
+ Q as ACCEPT_FORMATS,
391
+ $e as AVAILABLE_EXTRA_PARTS_DOCUMENTS,
392
+ g as DocumentType,
393
+ xe as MAX_EXTRA_PARTS_COUNT,
394
+ q as MAX_FILE_SIZE,
395
+ mt as OPTIONAL_DOCUMENT_PARTS,
396
+ Z as PDF_MIME_TYPE,
397
+ L as PartType,
398
+ ae as default
399
+ };
400
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/document.types.ts","../src/constants.ts","../src/KYCErrorLabel/style.tsx","../src/KYCErrorLabel/index.tsx","../src/utils.ts","../src/KYCDocumentParts/style.tsx","../src/KYCDocumentParts/index.tsx","../src/KYCFormItem/style.tsx","../src/KYCFormItem/index.tsx","../src/KYCStatusScreen/style.tsx","../src/KYCStatusScreen/index.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["export const DocumentType = {\n Id: 'id',\n Ub: 'ub',\n IdExtra: 'id_extra',\n Card: 'bank_card',\n PaymentSystemScreen: 'payment_system_screen',\n OnlineBankingStatement: 'online_banking_statement',\n CompanyRegistrationDocument: 'company_registration_document',\n SelfieWithIdCard: 'selfie_with_id_card_or_bank_card',\n PaypalDetailsPage: 'pay_pal_details_page',\n BankWireDetails: 'bank_wire_details',\n TransactionConfirmation: 'transaction_confirmation',\n Other: 'other',\n Feedback: 'feedback',\n} as const;\nexport type DocumentType = (typeof DocumentType)[keyof typeof DocumentType];\n\nexport const PartType = {\n IdFront: 'id_front',\n IdBack: 'id_back',\n Ub: 'ub_item',\n Card: 'card_item',\n PaymentSystemScreen: 'screen_item',\n OnlineBankingStatement: 'obs_item',\n CompanyRegistrationDocument: 'crd_item',\n SelfieWithIdCard: 'selfie_item',\n PaypalDetailsPageImage: 'pay_pal_details_page_image',\n BankWireDetailsPage: 'bank_wire_details_image',\n TransactionConfirmationImage: 'transaction_confirmation_image',\n OtherImage: 'other_image',\n Feedback: 'feedback',\n} as const;\nexport type PartType = (typeof PartType)[keyof typeof PartType];\n\nexport type KYCFileData = string | undefined;\n\nexport type KYCFile = {\n type: PartType;\n data?: KYCFileData;\n};\n\nexport type KYCDocument = {\n type: DocumentType;\n parts: KYCFile[];\n};\n","import type {ImageUploaderProps} from '@propellerads/image-uploader';\nimport {DocumentType, PartType} from './document.types';\n\nexport const MAX_FILE_SIZE = 5242880;\n\nexport const MAX_EXTRA_PARTS_COUNT = 3;\n\nexport const PDF_MIME_TYPE = 'application/pdf';\nexport const HEIC_MIME_TYPE = 'image/heic';\nexport const ACCEPT_FORMATS: ImageUploaderProps['acceptFormats'] = {\n 'image/png': ['.png'],\n 'image/jpeg': ['.jpg', '.jpe', '.jpeg'],\n [PDF_MIME_TYPE]: ['.pdf'],\n [HEIC_MIME_TYPE]: ['.heic'],\n};\n\nexport const AVAILABLE_EXTRA_PARTS_DOCUMENTS: DocumentType[] = [\n DocumentType.Card,\n DocumentType.Card,\n DocumentType.PaypalDetailsPage,\n DocumentType.BankWireDetails,\n DocumentType.TransactionConfirmation,\n DocumentType.SelfieWithIdCard,\n DocumentType.PaymentSystemScreen,\n DocumentType.Other,\n];\n\nexport const OPTIONAL_DOCUMENT_PARTS = {\n [DocumentType.Id]: {\n parts: [PartType.IdBack],\n },\n [DocumentType.IdExtra]: {\n parts: [PartType.IdBack],\n },\n};\n","import styled from 'styled-components';\nimport {fontSmall, spacing, white, errorColor} from '@propellerads/stylevariables';\n\nconst StyledKYCErrorLabel = styled.div`\n display: flex;\n align-items: center;\n color: ${errorColor};\n margin-top: ${spacing * 2}px;\n margin-bottom: ${spacing * 4}px;\n`;\n\nconst StyledKYCErrorLabelIcon = styled.span`\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n border-radius: 100%;\n background-color: ${errorColor};\n\n &:before {\n font-size: ${fontSmall};\n color: ${white};\n content: '!';\n }\n`;\n\nconst StyledKYCErrorLabelText = styled.span`\n margin-left: ${spacing * 2}px;\n`;\n\nexport {StyledKYCErrorLabel, StyledKYCErrorLabelIcon, StyledKYCErrorLabelText};\n","import {Close, Color, Size} from '@propellerads/icon';\nimport {StyledKYCErrorLabel, StyledKYCErrorLabelIcon, StyledKYCErrorLabelText} from './style';\nimport {KYCErrorLabelProps} from './types';\n\nconst KYCErrorLabel = (props: KYCErrorLabelProps) => (\n <StyledKYCErrorLabel>\n {props.isDocumentPartError ? (\n <StyledKYCErrorLabelIcon />\n ) : (\n <Close color={Color.Error} hoverColor={Color.Error} size={Size.Small} />\n )}\n <StyledKYCErrorLabelText>{props.label}</StyledKYCErrorLabelText>\n </StyledKYCErrorLabel>\n);\n\nexport default KYCErrorLabel;\n","import {AVAILABLE_EXTRA_PARTS_DOCUMENTS, HEIC_MIME_TYPE, MAX_EXTRA_PARTS_COUNT, PDF_MIME_TYPE} from './constants';\nimport {DocumentType, KYCFile, KYCFileData} from './document.types';\n\nconst isDocumentExtraPartAvailable = (documentType: DocumentType): boolean =>\n AVAILABLE_EXTRA_PARTS_DOCUMENTS.includes(documentType);\n\nconst canAddExtraPart = (documentType: DocumentType, parts: KYCFile[]): boolean =>\n isDocumentExtraPartAvailable(documentType) &&\n parts.every((part: KYCFile) => Boolean(part.data)) &&\n parts.length < MAX_EXTRA_PARTS_COUNT &&\n parts.length > 0;\n\nconst canRemoveExtraPart = (documentType: DocumentType, parts: KYCFile[]): boolean =>\n AVAILABLE_EXTRA_PARTS_DOCUMENTS.includes(documentType) && parts.length > 1;\n\nconst getMimeType = (partData: KYCFileData): string | undefined => partData?.match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)?.[0];\n\nconst isPDF = (partData: KYCFileData): boolean => {\n const mimeType: string | undefined = getMimeType(partData);\n return mimeType === PDF_MIME_TYPE;\n};\n\nconst isHEIC = (partData: KYCFileData): boolean => {\n const mimeType: string | undefined = getMimeType(partData);\n return mimeType === HEIC_MIME_TYPE;\n};\n\nconst isFileUniqueInDocument = (file: KYCFile, parts: KYCFile[]): boolean =>\n parts.every((part: KYCFile) => part.data !== file?.data);\n\nconst getFileBase64 = async (file: File): Promise<string> => {\n const reader: FileReader = new FileReader();\n\n return new Promise<string>((resolve, reject) => {\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n\n reader.readAsDataURL(file);\n });\n};\n\nexport {\n canAddExtraPart,\n canRemoveExtraPart,\n getFileBase64,\n isDocumentExtraPartAvailable,\n isFileUniqueInDocument,\n isHEIC,\n isPDF,\n};\n","import styled from 'styled-components';\nimport {borderRadius, spacing, gray95, white} from '@propellerads/stylevariables';\n\nconst StyledKYCFormItem = styled.div`\n margin-top: ${spacing * 4}px;\n margin-left: ${spacing * 4}px;\n`;\n\nconst StyledKYCFormItemFileTitle = styled.div`\n margin-bottom: ${spacing}px;\n`;\n\nconst StyledKYCFormItemFilePreview = styled.div`\n display: flex;\n align-items: center;\n background-color: ${gray95};\n padding: ${spacing * 2}px;\n border-radius: ${borderRadius}px;\n`;\n\nconst StyledKYCFormItemFilePreviewName = styled.span`\n width: 100%;\n margin-left: ${spacing * 4}px;\n margin-right: ${spacing * 2}px;\n`;\n\nconst StyledKYCFormItemFilePreviewRemove = styled.span`\n cursor: pointer !important;\n margin-right: ${spacing * 2}px;\n`;\n\nconst StyledKYCFormItemFileUploaderContainer = styled.div`\n height: 66px;\n`;\n\nconst StyledKYCFormItemFileExtraPart = styled.div`\n display: flex;\n flex-direction: column;\n margin-top: ${spacing * 4}px;\n margin-left: ${spacing * 4}px;\n`;\n\nconst StyledKYCDocumentPartImgMiniature = styled.img`\n width: auto;\n max-width: 204px;\n height: 50px;\n object-fit: contain;\n border-radius: ${borderRadius}px;\n`;\n\nconst StyledKYCDocumentPartIconMiniature = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 50px;\n height: 50px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n`;\n\nexport {\n StyledKYCFormItem,\n StyledKYCFormItemFilePreview,\n StyledKYCFormItemFilePreviewName,\n StyledKYCFormItemFilePreviewRemove,\n StyledKYCFormItemFileTitle,\n StyledKYCFormItemFileUploaderContainer,\n StyledKYCFormItemFileExtraPart,\n StyledKYCDocumentPartImgMiniature,\n StyledKYCDocumentPartIconMiniature,\n};\n","import {Color, Delete, Insert, Pdf} from '@propellerads/icon';\nimport ImageUploader, {Direction} from '@propellerads/image-uploader';\nimport TextArea from '@propellerads/textarea';\nimport {ACCEPT_FORMATS, MAX_FILE_SIZE} from '../constants';\nimport KYCErrorLabel from '../KYCErrorLabel';\nimport {isHEIC, isPDF} from '../utils';\nimport {\n StyledKYCDocumentPartIconMiniature,\n StyledKYCDocumentPartImgMiniature,\n StyledKYCFormItem,\n StyledKYCFormItemFileExtraPart,\n StyledKYCFormItemFilePreview,\n StyledKYCFormItemFilePreviewName,\n StyledKYCFormItemFilePreviewRemove,\n StyledKYCFormItemFileTitle,\n StyledKYCFormItemFileUploaderContainer,\n} from './style';\nimport {\n KYCDocumentPartMiniatureProps,\n KYCFormItemFileExtraPartProps,\n KYCFormItemFileProps,\n KYCFormItemTextProps,\n} from './types';\n\nconst KYCDocumentPartMiniature = (props: KYCDocumentPartMiniatureProps) => {\n const {data} = props;\n const isPDFPart: boolean = isPDF(data);\n const isHEICPart: boolean = isHEIC(data);\n\n if (isPDFPart || isHEICPart) {\n return (\n <StyledKYCDocumentPartIconMiniature>\n {isPDFPart && <Pdf color={Color.Gray} hoverColor={Color.Gray} />}\n {isHEICPart && <Insert color={Color.Gray} hoverColor={Color.Gray} />}\n </StyledKYCDocumentPartIconMiniature>\n );\n }\n\n return <StyledKYCDocumentPartImgMiniature src={data} />;\n};\n\nconst KYCFormItemFileExtraPart = (props: KYCFormItemFileExtraPartProps) => {\n const {elementId, title, uploaderLabels, onFileAdd} = props;\n const handleDrop = (files: File[]) => {\n const [file] = files;\n\n if (file) {\n onFileAdd(file);\n }\n };\n\n return (\n <StyledKYCFormItemFileExtraPart id={elementId}>\n {title && <StyledKYCFormItemFileTitle>{title}</StyledKYCFormItemFileTitle>}\n\n <StyledKYCFormItemFileUploaderContainer>\n <ImageUploader\n title={uploaderLabels.title}\n action={uploaderLabels.action}\n maxSize={MAX_FILE_SIZE}\n acceptFormats={ACCEPT_FORMATS}\n elementId={`${elementId}_uploader`}\n direction={Direction.Row}\n onDrop={handleDrop}\n />\n </StyledKYCFormItemFileUploaderContainer>\n </StyledKYCFormItemFileExtraPart>\n );\n};\n\nconst KYCFormItemFile = (props: KYCFormItemFileProps) => {\n const {name, title, data, error, elementId, uploaderLabels, onFileChange, onFileRemove} = props;\n const handleDrop = (files: File[]) => {\n const [file] = files;\n\n if (file) {\n onFileChange(file);\n }\n };\n\n return (\n <StyledKYCFormItem id={elementId}>\n {title && <StyledKYCFormItemFileTitle>{title}</StyledKYCFormItemFileTitle>}\n\n {data ? (\n <StyledKYCFormItemFilePreview>\n <KYCDocumentPartMiniature data={data} />\n <StyledKYCFormItemFilePreviewName>{name}</StyledKYCFormItemFilePreviewName>\n <StyledKYCFormItemFilePreviewRemove onClick={onFileRemove}>\n <Delete color={Color.Blue} hoverColor={Color.Blue} />\n </StyledKYCFormItemFilePreviewRemove>\n </StyledKYCFormItemFilePreview>\n ) : (\n <StyledKYCFormItemFileUploaderContainer>\n <ImageUploader\n title={uploaderLabels.title}\n action={uploaderLabels.action}\n maxSize={MAX_FILE_SIZE}\n acceptFormats={ACCEPT_FORMATS}\n elementId={`${elementId}_uploader`}\n direction={Direction.Row}\n onDrop={handleDrop}\n />\n </StyledKYCFormItemFileUploaderContainer>\n )}\n\n {error && <KYCErrorLabel label={error} isDocumentPartError />}\n </StyledKYCFormItem>\n );\n};\n\nconst KYCFormItemText = (props: KYCFormItemTextProps) => {\n const {onFeedbackChange, value = ''} = props;\n\n const handleChange = (newValue: string) => onFeedbackChange(newValue);\n\n return (\n <StyledKYCFormItem>\n <TextArea\n onChange={handleChange}\n onBlur={handleChange}\n value={value}\n errors={[]}\n name=\"kyc-client-comments\"\n elementId=\"kyc-feedback-textarea\"\n />\n </StyledKYCFormItem>\n );\n};\n\nexport default {\n KYCFormItemFileExtraPart,\n KYCFormItemFile,\n KYCFormItemText,\n};\n","import styled from 'styled-components';\nimport {fontNormal, fontSmall, spacing, gray50, black} from '@propellerads/stylevariables';\n\nconst StyledKYCFormItem = styled.div`\n margin-top: ${spacing * 6}px;\n`;\n\nconst StyledKYCFormItemTitle = styled.div`\n font-size: ${fontNormal}px;\n font-weight: bold;\n color: ${black};\n margin-bottom: ${spacing}px;\n`;\n\nconst StyledKYCFormItemDescription = styled.div`\n font-size: ${fontSmall}px;\n color: ${gray50};\n margin-left: ${spacing * 4}px;\n`;\n\nexport {StyledKYCFormItem, StyledKYCFormItemTitle, StyledKYCFormItemDescription};\n","import {useState} from 'react';\nimport {KYCDocument, KYCFile, KYCFileData, PartType} from '../document.types';\nimport KYCDocumentParts from '../KYCDocumentParts';\nimport {PartLabels, PartsLabels} from '../labels.types';\nimport {canAddExtraPart, getFileBase64, isDocumentExtraPartAvailable, isFileUniqueInDocument} from '../utils';\nimport {StyledKYCFormItem, StyledKYCFormItemDescription, StyledKYCFormItemTitle} from './style';\nimport {KYCFormItemProps} from './types';\n\nconst getErrorKey = (documentIndex: number, partIndex: number) => `[${documentIndex}].parts[${partIndex}].data`;\n\nconst KYCFormItem = (props: KYCFormItemProps) => {\n const {type, index, uploaderLabels, documentLabels, elementId, parts, errors, onDocumentChange} = props;\n const [localErrors, setLocalErrors] = useState<Map<string, string>>(new Map<string, string>());\n\n const isAddExtraPartAvailable: boolean = canAddExtraPart(type, parts);\n const documentLabelsParts: PartsLabels | undefined = documentLabels?.parts;\n const firstPart = parts[0];\n const extraPartTitle = firstPart ? documentLabelsParts?.[firstPart.type]?.title : undefined;\n\n const [fileNames, setFileNames] = useState<Map<string, string>>(new Map<string, string>());\n\n const setLocalErrorByPartIndex = (partIndex: number) => {\n const newLocalErrors = new Map<string, string>(localErrors);\n newLocalErrors.set(getErrorKey(index, partIndex), uploaderLabels.oversizeError);\n setLocalErrors(newLocalErrors);\n };\n\n const deleteLocalErrorByPartIndex = (partIndex: number) => {\n const newLocalErrors = new Map<string, string>(localErrors);\n newLocalErrors.delete(getErrorKey(index, partIndex));\n setLocalErrors(newLocalErrors);\n };\n\n const updateDocumentPart = (part: KYCFile, partIndex: number, data?: KYCFileData) => {\n const newPart: KYCFile = {\n ...part,\n data,\n };\n\n const newParts: KYCFile[] = [...parts];\n newParts.splice(partIndex, 1, newPart);\n\n const newDocument: KYCDocument = {\n type,\n parts: newParts,\n };\n\n onDocumentChange(newDocument);\n };\n\n const onFileChange = async (partIndex: number, file: File) => {\n if (!file) {\n setLocalErrorByPartIndex(partIndex);\n return;\n }\n\n const part = parts[partIndex] ?? parts[0];\n\n if (!part) {\n return;\n }\n\n const data: string = await getFileBase64(file);\n\n updateDocumentPart(part, partIndex, data);\n\n const newFileNames = new Map<string, string>(fileNames);\n newFileNames.set(data, file.name);\n setFileNames(newFileNames);\n\n deleteLocalErrorByPartIndex(partIndex);\n };\n\n const onFileRemove = (partIndex: number) => {\n const part = parts[partIndex];\n\n if (!part) {\n return;\n }\n\n updateDocumentPart(part, partIndex);\n\n const removedPart = parts[partIndex];\n const newFileNames = new Map<string, string>(fileNames);\n\n if (removedPart?.data && isFileUniqueInDocument(removedPart, parts)) {\n newFileNames.delete(removedPart?.data);\n }\n\n setFileNames(newFileNames);\n\n deleteLocalErrorByPartIndex(partIndex);\n };\n\n const getFileName = (key: string | undefined): string | undefined => {\n if (!key) {\n return undefined;\n }\n\n return fileNames.get(key);\n };\n\n const onFeedbackChange = (partIndex: number, data: string) => {\n const part = parts[partIndex] ?? parts[0];\n\n if (!part) {\n return;\n }\n\n updateDocumentPart(part, partIndex, data);\n };\n\n return (\n <StyledKYCFormItem id={elementId}>\n <StyledKYCFormItemTitle>{`${index + 1}. ${documentLabels?.title}`}</StyledKYCFormItemTitle>\n\n {documentLabels?.description && (\n <StyledKYCFormItemDescription>{documentLabels?.description}</StyledKYCFormItemDescription>\n )}\n\n {parts.map((part, partIndex) => {\n let itemKey = `kyc-form_item_file_${part.type}`;\n\n const isExtraPartAvailable: boolean = isDocumentExtraPartAvailable(type);\n const partLabels: PartLabels | undefined = documentLabelsParts?.[part.type];\n const partTitle = isExtraPartAvailable ? undefined : partLabels?.title;\n\n if (isDocumentExtraPartAvailable(type) && part.data) {\n itemKey = `${itemKey}_${part.data?.substr(-32)}`;\n\n if (!isFileUniqueInDocument(part, parts)) {\n itemKey = `${itemKey}_${partIndex}`;\n }\n }\n\n const partError = errors?.[getErrorKey(index, partIndex)];\n const localPartError = localErrors.get(getErrorKey(index, partIndex));\n\n if (part.type === PartType.Feedback) {\n return (\n <KYCDocumentParts.KYCFormItemText\n key={itemKey}\n value={part.data}\n onFeedbackChange={(value) => onFeedbackChange(partIndex, value)}\n />\n );\n }\n\n return (\n <KYCDocumentParts.KYCFormItemFile\n title={partTitle}\n data={part.data}\n type={part.type}\n name={getFileName(part.data)}\n uploaderLabels={uploaderLabels}\n error={localPartError || partError}\n key={itemKey}\n elementId={`${elementId}_part_${part.type}_${partIndex}`}\n onFileChange={(file) => onFileChange(partIndex, file)}\n onFileRemove={() => onFileRemove(partIndex)}\n />\n );\n })}\n\n {isAddExtraPartAvailable && firstPart && (\n <KYCDocumentParts.KYCFormItemFileExtraPart\n elementId={`${elementId}_extra`}\n title={extraPartTitle}\n uploaderLabels={uploaderLabels}\n onFileAdd={(file) => onFileChange(parts.length, file)}\n />\n )}\n </StyledKYCFormItem>\n );\n};\n\nexport default KYCFormItem;\n","import styled from 'styled-components';\nimport {spacing, gray50} from '@propellerads/stylevariables';\n\nconst StyledKYCSucessScreen = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nconst StyledKYCSucessScreenItem = styled.span`\n margin-bottom: ${spacing * 8}px;\n`;\n\nconst StyledKYCSucessScreenSuppport = styled.span`\n color: ${gray50};\n`;\n\nconst StyledKYCFailScreen = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nconst StyledKYCFailScreenItem = styled.span`\n margin-bottom: ${spacing * 6}px;\n`;\n\nexport {\n StyledKYCSucessScreen,\n StyledKYCSucessScreenItem,\n StyledKYCSucessScreenSuppport,\n StyledKYCFailScreen,\n StyledKYCFailScreenItem,\n};\n","import SuccessLabel from '@propellerads/success-label';\nimport {\n ACCEPT_FORMATS,\n AVAILABLE_EXTRA_PARTS_DOCUMENTS,\n MAX_EXTRA_PARTS_COUNT,\n MAX_FILE_SIZE,\n PDF_MIME_TYPE,\n} from '../constants';\nimport KYCErrorLabel from '../KYCErrorLabel';\nimport {\n StyledKYCFailScreen,\n StyledKYCFailScreenItem,\n StyledKYCSucessScreen,\n StyledKYCSucessScreenItem,\n StyledKYCSucessScreenSuppport,\n} from './style';\nimport {KYCFailScreenProps, KYCSuccessScreenProps} from './types';\n\nconst KYCSuccessScreen = (props: KYCSuccessScreenProps) => {\n const {elementId, title, description, support} = props;\n\n return (\n <StyledKYCSucessScreen id={elementId}>\n <StyledKYCSucessScreenItem>\n <SuccessLabel show elementId={`${elementId}_success`}>\n {title}\n </SuccessLabel>\n </StyledKYCSucessScreenItem>\n\n {description && <StyledKYCSucessScreenItem>{description}</StyledKYCSucessScreenItem>}\n\n {support && <StyledKYCSucessScreenSuppport>{support}</StyledKYCSucessScreenSuppport>}\n </StyledKYCSucessScreen>\n );\n};\n\nconst KYCFailScreen = (props: KYCFailScreenProps) => {\n const {elementId, title, support} = props;\n\n return (\n <StyledKYCFailScreen id={elementId}>\n <StyledKYCFailScreenItem>\n <KYCErrorLabel label={title} isDocumentPartError={false} />\n </StyledKYCFailScreenItem>\n\n {support}\n </StyledKYCFailScreen>\n );\n};\n\nexport default {\n KYCSuccessScreen,\n KYCFailScreen,\n};\n\nexport {ACCEPT_FORMATS, AVAILABLE_EXTRA_PARTS_DOCUMENTS, MAX_EXTRA_PARTS_COUNT, MAX_FILE_SIZE, PDF_MIME_TYPE};\n","import styled from 'styled-components';\nimport {fontNormal, spacing} from '@propellerads/stylevariables';\n\nconst StyledKYCForm = styled.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n width: 100%;\n`;\n\nconst StyledKYCFormTitle = styled.div`\n font-size: ${fontNormal}px;\n`;\n\nconst StyledKYCFormDocuments = styled.div`\n width: 100%;\n margin-bottom: ${spacing * 6}px;\n`;\n\nconst StyledKYCFormButton = styled.div`\n display: flex;\n justify-content: flex-end;\n width: 100%;\n`;\n\nexport {StyledKYCForm, StyledKYCFormTitle, StyledKYCFormDocuments, StyledKYCFormButton};\n","import Button, {ButtonType} from '@propellerads/button';\nimport {useEffect, useState} from 'react';\nimport {\n ACCEPT_FORMATS,\n AVAILABLE_EXTRA_PARTS_DOCUMENTS,\n MAX_EXTRA_PARTS_COUNT,\n MAX_FILE_SIZE,\n OPTIONAL_DOCUMENT_PARTS,\n PDF_MIME_TYPE,\n} from './constants';\nimport {DocumentType, KYCDocument, PartType} from './document.types';\nimport KYCFormItem from './KYCFormItem';\nimport KYCStatusScreen from './KYCStatusScreen';\nimport {StyledKYCForm, StyledKYCFormButton, StyledKYCFormDocuments, StyledKYCFormTitle} from './style';\nimport {KYCFormProps} from './types';\n\nconst KYCForm = (props: KYCFormProps) => {\n const {\n elementId,\n title,\n uploadButtonLabel,\n uploaderLabels,\n documentsLabels,\n documents,\n errors,\n isLoading,\n validator,\n onUploadClick,\n } = props;\n\n const [userDocuments, setUserDocuments] = useState<KYCDocument[]>(documents);\n const [isButtonDisabled, setButtonDisabled] = useState<boolean>(true);\n\n useEffect(() => {\n setUserDocuments(documents);\n }, [documents]);\n\n useEffect(() => {\n const isValid: boolean = validator(userDocuments);\n setButtonDisabled(!isValid);\n }, [userDocuments, validator]);\n\n const onDocumentChange = (index: number, document: KYCDocument) => {\n const newDocuments: KYCDocument[] = [...userDocuments];\n newDocuments.splice(index, 1, document);\n\n setUserDocuments(newDocuments);\n };\n\n return (\n <StyledKYCForm id={elementId}>\n {title && <StyledKYCFormTitle>{title}</StyledKYCFormTitle>}\n\n <StyledKYCFormDocuments>\n {userDocuments.map((document, index) => {\n const key = `kyc-form_item_${document.type}_${index}`;\n\n return (\n <KYCFormItem\n index={index}\n type={document.type}\n parts={document.parts}\n documentLabels={documentsLabels[document.type]}\n uploaderLabels={uploaderLabels}\n errors={errors}\n elementId={`${elementId}_item_${document.type}`}\n key={key}\n onDocumentChange={(doc) => onDocumentChange(index, doc)}\n />\n );\n })}\n </StyledKYCFormDocuments>\n <StyledKYCFormButton>\n <Button\n elementId={`${elementId}_button`}\n type={ButtonType.Primary}\n isDisabled={isButtonDisabled}\n isLoading={isLoading || false}\n onClick={() => onUploadClick(userDocuments)}\n >\n {uploadButtonLabel}\n </Button>\n </StyledKYCFormButton>\n </StyledKYCForm>\n );\n};\n\nKYCForm.SuccessScreen = KYCStatusScreen.KYCSuccessScreen;\nKYCForm.FailScreen = KYCStatusScreen.KYCFailScreen;\n\nexport default KYCForm;\n\nexport {\n ACCEPT_FORMATS,\n AVAILABLE_EXTRA_PARTS_DOCUMENTS,\n DocumentType,\n MAX_EXTRA_PARTS_COUNT,\n MAX_FILE_SIZE,\n OPTIONAL_DOCUMENT_PARTS,\n PartType,\n PDF_MIME_TYPE,\n};\n"],"names":["DocumentType","PartType","MAX_FILE_SIZE","MAX_EXTRA_PARTS_COUNT","PDF_MIME_TYPE","HEIC_MIME_TYPE","ACCEPT_FORMATS","AVAILABLE_EXTRA_PARTS_DOCUMENTS","OPTIONAL_DOCUMENT_PARTS","StyledKYCErrorLabel","styled","errorColor","spacing","StyledKYCErrorLabelIcon","fontSmall","white","StyledKYCErrorLabelText","KYCErrorLabel","props","jsxs","jsx","Close","Color","Size","isDocumentExtraPartAvailable","documentType","canAddExtraPart","parts","part","getMimeType","partData","isPDF","isHEIC","isFileUniqueInDocument","file","getFileBase64","reader","resolve","reject","error","StyledKYCFormItem","StyledKYCFormItemFileTitle","StyledKYCFormItemFilePreview","gray95","borderRadius","StyledKYCFormItemFilePreviewName","StyledKYCFormItemFilePreviewRemove","StyledKYCFormItemFileUploaderContainer","StyledKYCFormItemFileExtraPart","StyledKYCDocumentPartImgMiniature","StyledKYCDocumentPartIconMiniature","KYCDocumentPartMiniature","data","isPDFPart","isHEICPart","Pdf","Insert","KYCFormItemFileExtraPart","elementId","title","uploaderLabels","onFileAdd","handleDrop","files","ImageUploader","Direction","KYCFormItemFile","name","onFileChange","onFileRemove","Delete","KYCFormItemText","onFeedbackChange","value","handleChange","newValue","TextArea","KYCDocumentParts","StyledKYCFormItemTitle","fontNormal","black","StyledKYCFormItemDescription","gray50","getErrorKey","documentIndex","partIndex","KYCFormItem","type","index","documentLabels","errors","onDocumentChange","localErrors","setLocalErrors","useState","isAddExtraPartAvailable","documentLabelsParts","firstPart","extraPartTitle","fileNames","setFileNames","setLocalErrorByPartIndex","newLocalErrors","deleteLocalErrorByPartIndex","updateDocumentPart","newPart","newParts","newFileNames","removedPart","getFileName","key","itemKey","isExtraPartAvailable","partLabels","partTitle","partError","localPartError","StyledKYCSucessScreen","StyledKYCSucessScreenItem","StyledKYCSucessScreenSuppport","StyledKYCFailScreen","StyledKYCFailScreenItem","KYCSuccessScreen","description","support","SuccessLabel","KYCFailScreen","KYCStatusScreen","StyledKYCForm","StyledKYCFormTitle","StyledKYCFormDocuments","StyledKYCFormButton","KYCForm","uploadButtonLabel","documentsLabels","documents","isLoading","validator","onUploadClick","userDocuments","setUserDocuments","isButtonDisabled","setButtonDisabled","useEffect","isValid","document","newDocuments","doc","Button","ButtonType"],"mappings":";;;;;;;;;AAAO,MAAMA,IAAe;AAAA,EAC1B,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,MAAM;AAAA,EACN,qBAAqB;AAAA,EACrB,wBAAwB;AAAA,EACxB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,yBAAyB;AAAA,EACzB,OAAO;AAAA,EACP,UAAU;AACZ,GAGaC,IAAW;AAAA,E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