@propellerads/kyc-form 5.0.1 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import e, { ButtonType as t } from "@propellerads/button";
1
+ import e, { ButtonVariant as t } from "@propellerads/button";
2
2
  import { useEffect as n, useState as r } from "react";
3
3
  import { Close as i, Color as a, Delete as o, Insert as s, Pdf as c, Size as l } from "@propellerads/icon";
4
4
  import u, { Direction as d } from "@propellerads/image-uploader";
@@ -364,8 +364,8 @@ var E = {
364
364
  }, n);
365
365
  }) }),
366
366
  /* @__PURE__ */ C(ve, { children: /* @__PURE__ */ C(e, {
367
- elementId: `${a}_button`,
368
- type: t.Primary,
367
+ id: `${a}_button`,
368
+ variant: t.Primary,
369
369
  isDisabled: _,
370
370
  isLoading: f || !1,
371
371
  onClick: () => m(h),
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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, {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, 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 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};\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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ACzB,kBAAC,IAAD,EAAA,UACE,kBAAC,GAAD;IACE,WAAW,GAAG,EAAU;IACxB,MAAM,EAAW;IACjB,YAAY;IACZ,WAAW,KAAa;IACxB,eAAe,EAAc,EAAc;cAE1C;IACM,CAAA,EACW,CAAA;GACR;;;AAIpB,EAAQ,gBAAgB,EAAgB,kBACxC,EAAQ,aAAa,EAAgB"}
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,IAAgB,mBAChB,IAAiB,cACjB,IAAsD;CACjE,aAAa,CAAC,OAAO;CACrB,cAAc;EAAC;EAAQ;EAAQ;EAAQ;EACtC,IAAgB,CAAC,OAAO;EACxB,IAAiB,CAAC,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;;;GCHhC,KAAW,MAAwB;CACvC,IAAM,EACJ,cACA,UACA,sBACA,mBACA,oBACA,cACA,WACA,cACA,cACA,qBACE,GAEE,CAAC,GAAe,KAAoB,EAAwB,EAAU,EACtE,CAAC,GAAkB,KAAqB,EAAkB,GAAK;CAMrE,AAJA,QAAgB;EACd,EAAiB,EAAU;IAC1B,CAAC,EAAU,CAAC,EAEf,QAAgB;EAEd,EAAkB,CADO,EAAU,EAChB,CAAQ;IAC1B,CAAC,GAAe,EAAU,CAAC;CAE9B,IAAM,KAAoB,GAAe,MAA0B;EACjE,IAAM,IAA8B,CAAC,GAAG,EAAc;EAGtD,AAFA,EAAa,OAAO,GAAO,GAAG,EAAS,EAEvC,EAAiB,EAAa;;CAGhC,OACE,kBAAC,IAAD;EAAe,IAAI;YAAnB;GACG,KAAS,kBAAC,IAAD,EAAA,UAAqB,GAA2B,CAAA;GAE1D,kBAAC,IAAD,EAAA,UACG,EAAc,KAAK,GAAU,MAAU;IACtC,IAAM,IAAM,iBAAiB,EAAS,KAAK,GAAG;IAE9C,OACE,kBAAC,IAAD;KACS;KACP,MAAM,EAAS;KACf,OAAO,EAAS;KAChB,gBAAgB,EAAgB,EAAS;KACzB;KACR;KACR,WAAW,GAAG,EAAU,QAAQ,EAAS;KAEzC,mBAAmB,MAAQ,EAAiB,GAAO,EAAI;KACvD,EAFK,EAEL;KAEJ,EACqB,CAAA;GACzB,kBAAC,IAAD,EAAA,UACE,kBAAC,GAAD;IACE,IAAI,GAAG,EAAU;IACjB,SAAS,EAAc;IACvB,YAAY;IACZ,WAAW,KAAa;IACxB,eAAe,EAAc,EAAc;cAE1C;IACM,CAAA,EACW,CAAA;GACR;;;AAIpB,EAAQ,gBAAgB,EAAgB,kBACxC,EAAQ,aAAa,EAAgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/kyc-form",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -24,7 +24,7 @@
24
24
  "homepage": "https://github.com/propellerads/ui-components#readme",
25
25
  "private": false,
26
26
  "dependencies": {
27
- "@propellerads/button": "^9.0.3",
27
+ "@propellerads/button": "^11.0.0",
28
28
  "@propellerads/icon": "^8.0.0",
29
29
  "@propellerads/image-uploader": "^4.0.0",
30
30
  "@propellerads/stylevariables": "^2.0.2",