@propellerads/kyc-form 5.0.0 → 5.0.2

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
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## Installation
12
12
 
13
- - `yarn add @propellerads/kyc-form` or `npm install @propellerads/kyc-form -S`
13
+ - `bun add @propellerads/kyc-form` or `npm install @propellerads/kyc-form -S`
14
14
 
15
15
  ### How to use
16
16
 
package/dist/index.d.ts CHANGED
@@ -107,3 +107,4 @@ declare const KYCForm: {
107
107
  };
108
108
 
109
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 };
110
+ export type { KYCDocument, KYCFile };
package/dist/index.js CHANGED
@@ -1,400 +1,381 @@
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`
1
+ import e, { ButtonVariant as t } from "@propellerads/button";
2
+ import { useEffect as n, useState as r } from "react";
3
+ import { Close as i, Color as a, Delete as o, Insert as s, Pdf as c, Size as l } from "@propellerads/icon";
4
+ import u, { Direction as d } from "@propellerads/image-uploader";
5
+ import f from "@propellerads/textarea";
6
+ import p from "styled-components";
7
+ import { black as m, borderRadius as h, errorColor as g, fontNormal as _, fontSmall as v, gray50 as y, gray95 as b, spacing as x, white as S } from "@propellerads/stylevariables";
8
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
9
+ import T from "@propellerads/success-label";
10
+ //#region src/document.types.ts
11
+ var E = {
12
+ Id: "id",
13
+ Ub: "ub",
14
+ IdExtra: "id_extra",
15
+ Card: "bank_card",
16
+ PaymentSystemScreen: "payment_system_screen",
17
+ OnlineBankingStatement: "online_banking_statement",
18
+ CompanyRegistrationDocument: "company_registration_document",
19
+ SelfieWithIdCard: "selfie_with_id_card_or_bank_card",
20
+ PaypalDetailsPage: "pay_pal_details_page",
21
+ BankWireDetails: "bank_wire_details",
22
+ TransactionConfirmation: "transaction_confirmation",
23
+ Other: "other",
24
+ Feedback: "feedback"
25
+ }, D = {
26
+ IdFront: "id_front",
27
+ IdBack: "id_back",
28
+ Ub: "ub_item",
29
+ Card: "card_item",
30
+ PaymentSystemScreen: "screen_item",
31
+ OnlineBankingStatement: "obs_item",
32
+ CompanyRegistrationDocument: "crd_item",
33
+ SelfieWithIdCard: "selfie_item",
34
+ PaypalDetailsPageImage: "pay_pal_details_page_image",
35
+ BankWireDetailsPage: "bank_wire_details_image",
36
+ TransactionConfirmationImage: "transaction_confirmation_image",
37
+ OtherImage: "other_image",
38
+ Feedback: "feedback"
39
+ }, O = 5242880, ee = 3, k = "application/pdf", A = "image/heic", j = {
40
+ "image/png": [".png"],
41
+ "image/jpeg": [
42
+ ".jpg",
43
+ ".jpe",
44
+ ".jpeg"
45
+ ],
46
+ [k]: [".pdf"],
47
+ [A]: [".heic"]
48
+ }, M = [
49
+ E.Card,
50
+ E.Card,
51
+ E.PaypalDetailsPage,
52
+ E.BankWireDetails,
53
+ E.TransactionConfirmation,
54
+ E.SelfieWithIdCard,
55
+ E.PaymentSystemScreen,
56
+ E.Other
57
+ ], te = {
58
+ [E.Id]: { parts: [D.IdBack] },
59
+ [E.IdExtra]: { parts: [D.IdBack] }
60
+ }, N = p.div`
60
61
  display: flex;
61
62
  align-items: center;
62
- color: ${W};
63
- margin-top: ${m * 2}px;
64
- margin-bottom: ${m * 4}px;
65
- `, Ie = c.span`
63
+ color: ${g};
64
+ margin-top: ${x * 2}px;
65
+ margin-bottom: ${x * 4}px;
66
+ `, P = p.span`
66
67
  display: flex;
67
68
  align-items: center;
68
69
  justify-content: center;
69
70
  width: 14px;
70
71
  height: 14px;
71
72
  border-radius: 100%;
72
- background-color: ${W};
73
+ background-color: ${g};
73
74
 
74
75
  &:before {
75
- font-size: ${G};
76
- color: ${X};
76
+ font-size: ${v};
77
+ color: ${S};
77
78
  content: '!';
78
79
  }
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`
80
+ `, F = p.span`
81
+ margin-left: ${x * 2}px;
82
+ `, I = (e) => /* @__PURE__ */ w(N, { children: [e.isDocumentPartError ? /* @__PURE__ */ C(P, {}) : /* @__PURE__ */ C(i, {
83
+ color: a.Error,
84
+ hoverColor: a.Error,
85
+ size: l.Small
86
+ }), /* @__PURE__ */ C(F, { children: e.label })] }), L = (e) => M.includes(e), ne = (e, t) => L(e) && t.every((e) => !!e.data) && t.length < 3 && t.length > 0, R = (e) => e?.match(/[^:]\w+\/[\w-+\d.]+(?=;|,)/)?.[0], z = (e) => R(e) === k, re = (e) => R(e) === A, B = (e, t) => t.every((t) => t.data !== e?.data), ie = async (e) => {
87
+ let t = new FileReader();
88
+ return new Promise((n, r) => {
89
+ t.onload = () => n(t.result), t.onerror = (e) => r(e), t.readAsDataURL(e);
90
+ });
91
+ }, V = p.div`
92
+ margin-top: ${x * 4}px;
93
+ margin-left: ${x * 4}px;
94
+ `, H = p.div`
95
+ margin-bottom: ${x}px;
96
+ `, U = p.div`
95
97
  display: flex;
96
98
  align-items: center;
97
- background-color: ${Se};
98
- padding: ${m * 2}px;
99
- border-radius: ${B}px;
100
- `, ke = c.span`
99
+ background-color: ${b};
100
+ padding: ${x * 2}px;
101
+ border-radius: ${h}px;
102
+ `, W = p.span`
101
103
  width: 100%;
102
- margin-left: ${m * 4}px;
103
- margin-right: ${m * 2}px;
104
- `, Te = c.span`
104
+ margin-left: ${x * 4}px;
105
+ margin-right: ${x * 2}px;
106
+ `, G = p.span`
105
107
  cursor: pointer !important;
106
- margin-right: ${m * 2}px;
107
- `, oe = c.div`
108
+ margin-right: ${x * 2}px;
109
+ `, K = p.div`
108
110
  height: 66px;
109
- `, Le = c.div`
111
+ `, q = p.div`
110
112
  display: flex;
111
113
  flex-direction: column;
112
- margin-top: ${m * 4}px;
113
- margin-left: ${m * 4}px;
114
- `, Ae = c.img`
114
+ margin-top: ${x * 4}px;
115
+ margin-left: ${x * 4}px;
116
+ `, J = p.img`
115
117
  width: auto;
116
118
  max-width: 204px;
117
119
  height: 50px;
118
120
  object-fit: contain;
119
- border-radius: ${B}px;
120
- `, Be = c.div`
121
+ border-radius: ${h}px;
122
+ `, ae = p.div`
121
123
  display: flex;
122
124
  align-items: center;
123
125
  justify-content: center;
124
126
  min-width: 50px;
125
127
  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;
128
+ border-radius: ${h}px;
129
+ background-color: ${S};
130
+ `, oe = (e) => {
131
+ let { data: t } = e, n = z(t), r = re(t);
132
+ return n || r ? /* @__PURE__ */ w(ae, { children: [n && /* @__PURE__ */ C(c, {
133
+ color: a.Gray,
134
+ hoverColor: a.Gray
135
+ }), r && /* @__PURE__ */ C(s, {
136
+ color: a.Gray,
137
+ hoverColor: a.Gray
138
+ })] }) : /* @__PURE__ */ C(J, { src: t });
139
+ }, Y = {
140
+ KYCFormItemFileExtraPart: (e) => {
141
+ let { elementId: t, title: n, uploaderLabels: r, onFileAdd: i } = e;
142
+ return /* @__PURE__ */ w(q, {
143
+ id: t,
144
+ children: [n && /* @__PURE__ */ C(H, { children: n }), /* @__PURE__ */ C(K, { children: /* @__PURE__ */ C(u, {
145
+ title: r.title,
146
+ action: r.action,
147
+ maxSize: O,
148
+ acceptFormats: j,
149
+ elementId: `${t}_uploader`,
150
+ direction: d.Row,
151
+ onDrop: (e) => {
152
+ let [t] = e;
153
+ t && i(t);
154
+ }
155
+ }) })]
156
+ });
157
+ },
158
+ KYCFormItemFile: (e) => {
159
+ let { name: t, title: n, data: r, error: i, elementId: s, uploaderLabels: c, onFileChange: l, onFileRemove: f } = e;
160
+ return /* @__PURE__ */ w(V, {
161
+ id: s,
162
+ children: [
163
+ n && /* @__PURE__ */ C(H, { children: n }),
164
+ r ? /* @__PURE__ */ w(U, { children: [
165
+ /* @__PURE__ */ C(oe, { data: r }),
166
+ /* @__PURE__ */ C(W, { children: t }),
167
+ /* @__PURE__ */ C(G, {
168
+ onClick: f,
169
+ children: /* @__PURE__ */ C(o, {
170
+ color: a.Blue,
171
+ hoverColor: a.Blue
172
+ })
173
+ })
174
+ ] }) : /* @__PURE__ */ C(K, { children: /* @__PURE__ */ C(u, {
175
+ title: c.title,
176
+ action: c.action,
177
+ maxSize: O,
178
+ acceptFormats: j,
179
+ elementId: `${s}_uploader`,
180
+ direction: d.Row,
181
+ onDrop: (e) => {
182
+ let [t] = e;
183
+ t && l(t);
184
+ }
185
+ }) }),
186
+ i && /* @__PURE__ */ C(I, {
187
+ label: i,
188
+ isDocumentPartError: !0
189
+ })
190
+ ]
191
+ });
192
+ },
193
+ KYCFormItemText: (e) => {
194
+ let { onFeedbackChange: t, value: n = "" } = e, r = (e) => t(e);
195
+ return /* @__PURE__ */ C(V, { children: /* @__PURE__ */ C(f, {
196
+ onChange: r,
197
+ onBlur: r,
198
+ value: n,
199
+ errors: [],
200
+ name: "kyc-client-comments",
201
+ elementId: "kyc-feedback-textarea"
202
+ }) });
203
+ }
204
+ }, se = p.div`
205
+ margin-top: ${x * 6}px;
206
+ `, ce = p.div`
207
+ font-size: ${_}px;
200
208
  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`
209
+ color: ${m};
210
+ margin-bottom: ${x}px;
211
+ `, le = p.div`
212
+ font-size: ${v}px;
213
+ color: ${y};
214
+ margin-left: ${x * 4}px;
215
+ `, X = (e, t) => `[${e}].parts[${t}].data`, ue = (e) => {
216
+ let { type: t, index: n, uploaderLabels: i, documentLabels: a, elementId: o, parts: s, errors: c, onDocumentChange: l } = e, [u, d] = r(/* @__PURE__ */ new Map()), f = ne(t, s), p = a?.parts, m = s[0], h = m ? p?.[m.type]?.title : void 0, [g, _] = r(/* @__PURE__ */ new Map()), v = (e) => {
217
+ let t = new Map(u);
218
+ t.set(X(n, e), i.oversizeError), d(t);
219
+ }, y = (e) => {
220
+ let t = new Map(u);
221
+ t.delete(X(n, e)), d(t);
222
+ }, b = (e, n, r) => {
223
+ let i = {
224
+ ...e,
225
+ data: r
226
+ }, a = [...s];
227
+ a.splice(n, 1, i), l({
228
+ type: t,
229
+ parts: a
230
+ });
231
+ }, x = async (e, t) => {
232
+ if (!t) {
233
+ v(e);
234
+ return;
235
+ }
236
+ let n = s[e] ?? s[0];
237
+ if (!n) return;
238
+ let r = await ie(t);
239
+ b(n, e, r);
240
+ let i = new Map(g);
241
+ i.set(r, t.name), _(i), y(e);
242
+ }, S = (e) => {
243
+ let t = s[e];
244
+ if (!t) return;
245
+ b(t, e);
246
+ let n = s[e], r = new Map(g);
247
+ n?.data && B(n, s) && r.delete(n?.data), _(r), y(e);
248
+ }, T = (e) => {
249
+ if (e) return g.get(e);
250
+ }, E = (e, t) => {
251
+ let n = s[e] ?? s[0];
252
+ n && b(n, e, t);
253
+ };
254
+ return /* @__PURE__ */ w(se, {
255
+ id: o,
256
+ children: [
257
+ /* @__PURE__ */ C(ce, { children: `${n + 1}. ${a?.title}` }),
258
+ a?.description && /* @__PURE__ */ C(le, { children: a?.description }),
259
+ s.map((e, r) => {
260
+ let a = `kyc-form_item_file_${e.type}`, l = L(t), d = p?.[e.type], f = l ? void 0 : d?.title;
261
+ L(t) && e.data && (a = `${a}_${e.data?.substr(-32)}`, B(e, s) || (a = `${a}_${r}`));
262
+ let m = c?.[X(n, r)], h = u.get(X(n, r));
263
+ return e.type === D.Feedback ? /* @__PURE__ */ C(Y.KYCFormItemText, {
264
+ value: e.data,
265
+ onFeedbackChange: (e) => E(r, e)
266
+ }, a) : /* @__PURE__ */ C(Y.KYCFormItemFile, {
267
+ title: f,
268
+ data: e.data,
269
+ type: e.type,
270
+ name: T(e.data),
271
+ uploaderLabels: i,
272
+ error: h || m,
273
+ elementId: `${o}_part_${e.type}_${r}`,
274
+ onFileChange: (e) => x(r, e),
275
+ onFileRemove: () => S(r)
276
+ }, a);
277
+ }),
278
+ f && m && /* @__PURE__ */ C(Y.KYCFormItemFileExtraPart, {
279
+ elementId: `${o}_extra`,
280
+ title: h,
281
+ uploaderLabels: i,
282
+ onFileAdd: (e) => x(s.length, e)
283
+ })
284
+ ]
285
+ });
286
+ }, de = p.div`
291
287
  display: flex;
292
288
  flex-direction: column;
293
- `, U = c.span`
294
- margin-bottom: ${m * 8}px;
295
- `, Xe = c.span`
296
- color: ${V};
297
- `, He = c.div`
289
+ `, Z = p.span`
290
+ margin-bottom: ${x * 8}px;
291
+ `, fe = p.span`
292
+ color: ${y};
293
+ `, pe = p.div`
298
294
  display: flex;
299
295
  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`
296
+ `, me = p.span`
297
+ margin-bottom: ${x * 6}px;
298
+ `, Q = {
299
+ KYCSuccessScreen: (e) => {
300
+ let { elementId: t, title: n, description: r, support: i } = e;
301
+ return /* @__PURE__ */ w(de, {
302
+ id: t,
303
+ children: [
304
+ /* @__PURE__ */ C(Z, { children: /* @__PURE__ */ C(T, {
305
+ show: !0,
306
+ elementId: `${t}_success`,
307
+ children: n
308
+ }) }),
309
+ r && /* @__PURE__ */ C(Z, { children: r }),
310
+ i && /* @__PURE__ */ C(fe, { children: i })
311
+ ]
312
+ });
313
+ },
314
+ KYCFailScreen: (e) => {
315
+ let { elementId: t, title: n, support: r } = e;
316
+ return /* @__PURE__ */ w(pe, {
317
+ id: t,
318
+ children: [/* @__PURE__ */ C(me, { children: /* @__PURE__ */ C(I, {
319
+ label: n,
320
+ isDocumentPartError: !1
321
+ }) }), r]
322
+ });
323
+ }
324
+ }, he = p.div`
319
325
  display: flex;
320
326
  flex-direction: column;
321
327
  align-items: flex-start;
322
328
  width: 100%;
323
- `, Qe = c.div`
324
- font-size: ${H}px;
325
- `, et = c.div`
329
+ `, ge = p.div`
330
+ font-size: ${_}px;
331
+ `, _e = p.div`
326
332
  width: 100%;
327
- margin-bottom: ${m * 6}px;
328
- `, tt = c.div`
333
+ margin-bottom: ${x * 6}px;
334
+ `, ve = p.div`
329
335
  display: flex;
330
336
  justify-content: flex-end;
331
337
  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
338
+ `, $ = (i) => {
339
+ let { elementId: a, title: o, uploadButtonLabel: s, uploaderLabels: c, documentsLabels: l, documents: u, errors: d, isLoading: f, validator: p, onUploadClick: m } = i, [h, g] = r(u), [_, v] = r(!0);
340
+ n(() => {
341
+ g(u);
342
+ }, [u]), n(() => {
343
+ v(!p(h));
344
+ }, [h, p]);
345
+ let y = (e, t) => {
346
+ let n = [...h];
347
+ n.splice(e, 1, t), g(n);
348
+ };
349
+ return /* @__PURE__ */ w(he, {
350
+ id: a,
351
+ children: [
352
+ o && /* @__PURE__ */ C(ge, { children: o }),
353
+ /* @__PURE__ */ C(_e, { children: h.map((e, t) => {
354
+ let n = `kyc-form_item_${e.type}_${t}`;
355
+ return /* @__PURE__ */ C(ue, {
356
+ index: t,
357
+ type: e.type,
358
+ parts: e.parts,
359
+ documentLabels: l[e.type],
360
+ uploaderLabels: c,
361
+ errors: d,
362
+ elementId: `${a}_item_${e.type}`,
363
+ onDocumentChange: (e) => y(t, e)
364
+ }, n);
365
+ }) }),
366
+ /* @__PURE__ */ C(ve, { children: /* @__PURE__ */ C(e, {
367
+ id: `${a}_button`,
368
+ variant: t.Primary,
369
+ isDisabled: _,
370
+ isLoading: f || !1,
371
+ onClick: () => m(h),
372
+ children: s
373
+ }) })
374
+ ]
375
+ });
399
376
  };
400
- //# sourceMappingURL=index.js.map
377
+ $.SuccessScreen = Q.KYCSuccessScreen, $.FailScreen = Q.KYCFailScreen;
378
+ //#endregion
379
+ export { j as ACCEPT_FORMATS, M as AVAILABLE_EXTRA_PARTS_DOCUMENTS, E as DocumentType, ee as MAX_EXTRA_PARTS_COUNT, O as MAX_FILE_SIZE, te as OPTIONAL_DOCUMENT_PARTS, k as PDF_MIME_TYPE, D as PartType, $ as default };
380
+
381
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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;AA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A,IAIX,CAAC,EAAA,CACH;AAAA,sBACCqB,IAAA,EACC,UAAA,gBAAA/G;AAAA,MAACgI;AAAA,MAAA;AAAA,QACC,WAAW,GAAG1F,CAAS;AAAA,QACvB,MAAM2F,GAAW;AAAA,QACjB,YAAYR;AAAA,QACZ,WAAWL,KAAa;AAAA,QACxB,SAAS,MAAME,EAAcC,CAAa;AAAA,QAEzC,UAAAN;AAAA,MAAA;AAAA,IAAA,EACH,CACF;AAAA,EAAA,GACF;AAEJ;AAEAD,GAAQ,gBAAgBL,GAAgB;AACxCK,GAAQ,aAAaL,GAAgB;"}
1
+ {"version":3,"file":"index.js","names":[],"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, {ButtonVariant} 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, KYCFile} 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 id={`${elementId}_button`}\n variant={ButtonVariant.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};\nexport type {KYCDocument, KYCFile};\n"],"mappings":";;;;;;;;;;AAAA,IAAa,IAAe;CAC1B,IAAI;CACJ,IAAI;CACJ,SAAS;CACT,MAAM;CACN,qBAAqB;CACrB,wBAAwB;CACxB,6BAA6B;CAC7B,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CACjB,yBAAyB;CACzB,OAAO;CACP,UAAU;CACX,EAGY,IAAW;CACtB,SAAS;CACT,QAAQ;CACR,IAAI;CACJ,MAAM;CACN,qBAAqB;CACrB,wBAAwB;CACxB,6BAA6B;CAC7B,kBAAkB;CAClB,wBAAwB;CACxB,qBAAqB;CACrB,8BAA8B;CAC9B,YAAY;CACZ,UAAU;CACX,EC5BY,IAAgB,SAEhB,KAAwB,GAExB,IAA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EAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/kyc-form",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -19,17 +19,17 @@
19
19
  "url": "https://github.com/propellerads/ui-components/issues"
20
20
  },
21
21
  "scripts": {
22
- "build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
22
+ "build": "tsc && vite build && bunx rollup -c rollup.dts.config.mjs"
23
23
  },
24
24
  "homepage": "https://github.com/propellerads/ui-components#readme",
25
25
  "private": false,
26
26
  "dependencies": {
27
- "@propellerads/button": "^9.0.3",
28
- "@propellerads/icon": "^7.2.1",
27
+ "@propellerads/button": "^10.0.0",
28
+ "@propellerads/icon": "^8.0.0",
29
29
  "@propellerads/image-uploader": "^4.0.0",
30
30
  "@propellerads/stylevariables": "^2.0.2",
31
- "@propellerads/success-label": "4.0.0",
32
- "@propellerads/textarea": "^5.0.1"
31
+ "@propellerads/success-label": "^4.0.1",
32
+ "@propellerads/textarea": "^5.0.3"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^18.0.0 || ^19.0.0",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/react": "^19.2.14",
40
- "@vitejs/plugin-react": "^5.1.4",
41
- "rollup": "^4.58.0",
42
- "rollup-plugin-dts": "^6.3.0",
43
- "typescript": "^5.9.3",
44
- "vite": "^7.3.1"
40
+ "@vitejs/plugin-react": "^6.0.1",
41
+ "rollup": "^4.60.3",
42
+ "rollup-plugin-dts": "^6.4.1",
43
+ "typescript": "^6.0.3",
44
+ "vite": "^8.0.10"
45
45
  }
46
46
  }