@greatapps/common 1.1.806 → 1.1.807
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/components/account/sections/affiliates/ReceivingAccountModal.mjs +52 -18
- package/dist/components/account/sections/affiliates/ReceivingAccountModal.mjs.map +1 -1
- package/dist/i18n/messages/en-us.mjs +5 -0
- package/dist/i18n/messages/en-us.mjs.map +1 -1
- package/dist/i18n/messages/es-es.mjs +5 -0
- package/dist/i18n/messages/es-es.mjs.map +1 -1
- package/dist/i18n/messages/pt-br.mjs +5 -0
- package/dist/i18n/messages/pt-br.mjs.map +1 -1
- package/dist/index.mjs +6 -1
- package/dist/index.mjs.map +1 -1
- package/dist/testing/factories/affiliate.factory.mjs +24 -0
- package/dist/testing/factories/affiliate.factory.mjs.map +1 -0
- package/dist/testing/factories/index.mjs +2 -0
- package/dist/testing/factories/index.mjs.map +1 -1
- package/dist/utils/format/masks.mjs +6 -1
- package/dist/utils/format/masks.mjs.map +1 -1
- package/dist/utils/validators/pix-key.mjs +27 -0
- package/dist/utils/validators/pix-key.mjs.map +1 -0
- package/package.json +10 -9
- package/src/components/account/sections/affiliates/ReceivingAccountModal.tsx +71 -20
- package/src/i18n/messages/en-us.ts +6 -0
- package/src/i18n/messages/es-es.ts +6 -0
- package/src/i18n/messages/pt-br.ts +6 -0
- package/src/index.ts +2 -0
- package/src/testing/factories/affiliate.factory.ts +22 -0
- package/src/testing/factories/index.ts +1 -0
- package/src/utils/format/masks.ts +6 -2
- package/src/utils/validators/pix-key.ts +25 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useMemo } from "react";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { Controller, useForm } from "react-hook-form";
|
|
5
5
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
6
6
|
import { useTranslations } from "next-intl";
|
|
@@ -12,12 +12,15 @@ import { FormField } from "../../../ui/form/FormField";
|
|
|
12
12
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../../../ui/overlay/Dialog";
|
|
13
13
|
import { useCurrentAffiliate } from "../../../../modules/affiliates/hooks/use-current-affiliate.hook";
|
|
14
14
|
import { useUpdateAffiliate } from "../../../../modules/affiliates/hooks/use-update-affiliate.hook";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
formatCPFCNPJ,
|
|
17
|
+
formatDocument,
|
|
18
|
+
formatPixKey,
|
|
19
|
+
normalizeCpfCnpjForStorage
|
|
20
|
+
} from "../../../../utils/format/masks";
|
|
16
21
|
import { isValidCNPJ, isValidCPF } from "../../../../utils/validators/common";
|
|
22
|
+
import { AMBIGUOUS_PIX_KEY, normalizePixKeyForStorage } from "../../../../utils/validators/pix-key";
|
|
17
23
|
import { useAffiliateFlows } from "../../../../store/useAffiliateFlows";
|
|
18
|
-
const EMAIL_KEY = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
19
|
-
const RANDOM_KEY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
20
|
-
const PHONE_KEY = /^\+\d{11,14}$/;
|
|
21
24
|
function ReceivingAccountModal() {
|
|
22
25
|
const translate = useTranslations();
|
|
23
26
|
const translateModal = useTranslations("common.account.workspace.affiliates.bankAccount");
|
|
@@ -28,10 +31,25 @@ function ReceivingAccountModal() {
|
|
|
28
31
|
const updateAffiliate = useUpdateAffiliate();
|
|
29
32
|
const schema = useMemo(
|
|
30
33
|
() => z.object({
|
|
31
|
-
pix: z.string().min(1, translateModal("validationPix")),
|
|
34
|
+
pix: z.string().trim().min(1, translateModal("validationPix")),
|
|
32
35
|
holder_name: z.string().min(1, translateModal("validationHolder")),
|
|
33
36
|
holder_document: z.string().min(1, translateModal("validationDocument"))
|
|
34
37
|
}).superRefine((data, ctx) => {
|
|
38
|
+
const pix = normalizePixKeyForStorage(data.pix, data.holder_document);
|
|
39
|
+
if (data.pix && pix === null) {
|
|
40
|
+
ctx.addIssue({
|
|
41
|
+
code: z.ZodIssueCode.custom,
|
|
42
|
+
path: ["pix"],
|
|
43
|
+
message: translateModal("validationPixInvalid")
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (pix === AMBIGUOUS_PIX_KEY) {
|
|
47
|
+
ctx.addIssue({
|
|
48
|
+
code: z.ZodIssueCode.custom,
|
|
49
|
+
path: ["pix"],
|
|
50
|
+
message: translateModal("pixAmbiguousQuestion")
|
|
51
|
+
});
|
|
52
|
+
}
|
|
35
53
|
const digits = data.holder_document.replace(/\D/g, "");
|
|
36
54
|
if (!digits) return;
|
|
37
55
|
if (digits.length !== 11 && digits.length !== 14) {
|
|
@@ -51,14 +69,7 @@ function ReceivingAccountModal() {
|
|
|
51
69
|
});
|
|
52
70
|
return;
|
|
53
71
|
}
|
|
54
|
-
|
|
55
|
-
if (EMAIL_KEY.test(pix) || RANDOM_KEY.test(pix) || PHONE_KEY.test(pix.replace(/[\s().-]/g, ""))) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const pixDigits = pix.replace(/\D/g, "");
|
|
59
|
-
const pixIsCnpj = pixDigits.length === 14 && isValidCNPJ(pixDigits);
|
|
60
|
-
const pixIsCpf = pixDigits.length === 11 && isValidCPF(pixDigits);
|
|
61
|
-
if ((pixIsCnpj || pixIsCpf) && pixDigits !== digits) {
|
|
72
|
+
if (typeof pix === "string" && /^\d+$/.test(pix) && pix !== digits) {
|
|
62
73
|
ctx.addIssue({
|
|
63
74
|
code: z.ZodIssueCode.custom,
|
|
64
75
|
path: ["pix"],
|
|
@@ -73,6 +84,7 @@ function ReceivingAccountModal() {
|
|
|
73
84
|
mode: "onChange",
|
|
74
85
|
defaultValues: { pix: "", holder_name: "", holder_document: "" }
|
|
75
86
|
});
|
|
87
|
+
const [declaredCpfPix, setDeclaredCpfPix] = useState(null);
|
|
76
88
|
const resetForm = form.reset;
|
|
77
89
|
useEffect(() => {
|
|
78
90
|
if (!isOpen || !affiliate) return;
|
|
@@ -84,15 +96,17 @@ function ReceivingAccountModal() {
|
|
|
84
96
|
}, [isOpen, affiliate, resetForm]);
|
|
85
97
|
const handleClose = () => {
|
|
86
98
|
form.reset();
|
|
99
|
+
setDeclaredCpfPix(null);
|
|
87
100
|
close();
|
|
88
101
|
};
|
|
89
102
|
const onSubmit = async (data) => {
|
|
90
|
-
|
|
103
|
+
const pix = normalizePixKeyForStorage(data.pix, data.holder_document);
|
|
104
|
+
if (!affiliate || typeof pix !== "string") return;
|
|
91
105
|
try {
|
|
92
106
|
await updateAffiliate.mutateAsync({
|
|
93
107
|
...data,
|
|
94
108
|
holder_document: normalizeCpfCnpjForStorage(data.holder_document),
|
|
95
|
-
pix
|
|
109
|
+
pix,
|
|
96
110
|
bank: "",
|
|
97
111
|
agency: "",
|
|
98
112
|
account: ""
|
|
@@ -104,7 +118,21 @@ function ReceivingAccountModal() {
|
|
|
104
118
|
toast.custom((toastId) => /* @__PURE__ */ jsx(Toast, { variant: "error", message, toastId }));
|
|
105
119
|
}
|
|
106
120
|
};
|
|
107
|
-
const
|
|
121
|
+
const holderDocument = form.watch("holder_document");
|
|
122
|
+
const pixValue = form.watch("pix");
|
|
123
|
+
const isCnpjHolder = holderDocument.replace(/\D/g, "").length === 14;
|
|
124
|
+
const pixPreview = normalizePixKeyForStorage(pixValue, holderDocument);
|
|
125
|
+
const isPixAmbiguous = pixPreview === AMBIGUOUS_PIX_KEY;
|
|
126
|
+
const isPixDeclaredCpf = isPixAmbiguous && declaredCpfPix === pixValue;
|
|
127
|
+
const handleConfirmMobile = () => {
|
|
128
|
+
form.setValue("pix", formatPixKey(`+55${pixValue.replace(/\D/g, "")}`), {
|
|
129
|
+
shouldValidate: true,
|
|
130
|
+
shouldDirty: true
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const handleConfirmCpf = () => {
|
|
134
|
+
setDeclaredCpfPix(pixValue);
|
|
135
|
+
};
|
|
108
136
|
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (nextOpen) => !nextOpen && handleClose(), children: /* @__PURE__ */ jsxs(
|
|
109
137
|
DialogContent,
|
|
110
138
|
{
|
|
@@ -121,10 +149,15 @@ function ReceivingAccountModal() {
|
|
|
121
149
|
placeholder: translateModal("pixKeyPlaceholder"),
|
|
122
150
|
required: true,
|
|
123
151
|
error: !!form.formState.errors.pix,
|
|
124
|
-
errorMessage: form.formState.errors.pix?.message,
|
|
152
|
+
errorMessage: isPixDeclaredCpf ? translateModal("validationPixDocumentMismatch") : form.formState.errors.pix?.message,
|
|
153
|
+
hintMessage: typeof pixPreview === "string" ? translateModal("pixKeyPreview", { value: formatPixKey(pixPreview) }) : void 0,
|
|
125
154
|
...form.register("pix")
|
|
126
155
|
}
|
|
127
156
|
),
|
|
157
|
+
isPixAmbiguous && !isPixDeclaredCpf && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 -mt-3", children: [
|
|
158
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", size: "sm", onClick: handleConfirmMobile, children: translateModal("pixAmbiguousMobile") }),
|
|
159
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", size: "sm", onClick: handleConfirmCpf, children: translateModal("pixAmbiguousCpf") })
|
|
160
|
+
] }),
|
|
128
161
|
/* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-medium text-zinc-500 -mt-3", children: translateModal("pixKeyHint") }),
|
|
129
162
|
isCnpjHolder && /* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-medium text-zinc-500 -mt-3", children: translateModal("pixCnpjInvoiceNotice") }),
|
|
130
163
|
/* @__PURE__ */ jsx(
|
|
@@ -143,6 +176,7 @@ function ReceivingAccountModal() {
|
|
|
143
176
|
{
|
|
144
177
|
name: "holder_document",
|
|
145
178
|
control: form.control,
|
|
179
|
+
rules: { deps: ["pix"] },
|
|
146
180
|
render: ({ field, fieldState }) => /* @__PURE__ */ jsx(
|
|
147
181
|
FormField,
|
|
148
182
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/account/sections/affiliates/ReceivingAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo } from 'react';\nimport { Controller, useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { useTranslations } from 'next-intl';\nimport { toast } from 'sonner';\nimport z from 'zod';\nimport { Button } from '../../../ui/buttons/Button';\nimport { Toast } from '../../../ui/feedback/Toast';\nimport { FormField } from '../../../ui/form/FormField';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../../ui/overlay/Dialog';\nimport { useCurrentAffiliate } from '../../../../modules/affiliates/hooks/use-current-affiliate.hook';\nimport { useUpdateAffiliate } from '../../../../modules/affiliates/hooks/use-update-affiliate.hook';\nimport { formatCPFCNPJ, formatDocument, normalizeCpfCnpjForStorage } from '../../../../utils/format/masks';\nimport { isValidCNPJ, isValidCPF } from '../../../../utils/validators/common';\nimport { useAffiliateFlows } from '../../../../store/useAffiliateFlows';\n\ntype ReceivingAccountFormData = {\n pix: string;\n holder_name: string;\n holder_document: string;\n};\n\nconst EMAIL_KEY = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst RANDOM_KEY = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nconst PHONE_KEY = /^\\+\\d{11,14}$/;\n\n/** Cadastro da conta de recebimento do afiliado: chave PIX e titular. */\nexport function ReceivingAccountModal() {\n const translate = useTranslations();\n const translateModal = useTranslations('common.account.workspace.affiliates.bankAccount');\n const isOpen = useAffiliateFlows((state) => state.isReceivingAccountOpen);\n const close = useAffiliateFlows((state) => state.closeReceivingAccount);\n const { data: affiliateData } = useCurrentAffiliate();\n const affiliate = affiliateData?.data;\n const updateAffiliate = useUpdateAffiliate();\n\n const schema = useMemo(\n () =>\n z\n .object({\n pix: z.string().min(1, translateModal('validationPix')),\n holder_name: z.string().min(1, translateModal('validationHolder')),\n holder_document: z.string().min(1, translateModal('validationDocument')),\n })\n .superRefine((data, ctx) => {\n // O documento do titular decide PF x PJ pela contagem de dígitos, e é ele que vai para a\n // instituição no saque — tamanho certo com dígito verificador errado passa aqui e só\n // falha no pagamento.\n const digits = data.holder_document.replace(/\\D/g, '');\n if (!digits) return;\n\n if (digits.length !== 11 && digits.length !== 14) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['holder_document'],\n message: translateModal('validationDocumentLength'),\n });\n return;\n }\n\n const isValid = digits.length === 14 ? isValidCNPJ(digits) : isValidCPF(digits);\n if (!isValid) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['holder_document'],\n message:\n digits.length === 14\n ? translateModal('validationCnpjChecksum')\n : translateModal('validationCpfChecksum'),\n });\n return;\n }\n\n const pix = data.pix.trim();\n if (EMAIL_KEY.test(pix) || RANDOM_KEY.test(pix) || PHONE_KEY.test(pix.replace(/[\\s().-]/g, ''))) {\n return;\n }\n\n const pixDigits = pix.replace(/\\D/g, '');\n const pixIsCnpj = pixDigits.length === 14 && isValidCNPJ(pixDigits);\n const pixIsCpf = pixDigits.length === 11 && isValidCPF(pixDigits);\n if ((pixIsCnpj || pixIsCpf) && pixDigits !== digits) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['pix'],\n message: translateModal('validationPixDocumentMismatch'),\n });\n }\n }),\n [translateModal]\n );\n\n const form = useForm<ReceivingAccountFormData>({\n resolver: zodResolver(schema),\n mode: 'onChange',\n defaultValues: { pix: '', holder_name: '', holder_document: '' },\n });\n\n const resetForm = form.reset;\n\n useEffect(() => {\n if (!isOpen || !affiliate) return;\n resetForm({\n pix: affiliate.pix ?? '',\n holder_name: affiliate.holder_name ?? '',\n holder_document: affiliate.holder_document ? formatDocument(affiliate.holder_document) : '',\n });\n }, [isOpen, affiliate, resetForm]);\n\n const handleClose = () => {\n form.reset();\n close();\n };\n\n const onSubmit = async (data: ReceivingAccountFormData) => {\n if (!affiliate) return;\n\n try {\n await updateAffiliate.mutateAsync({\n ...data,\n holder_document: normalizeCpfCnpjForStorage(data.holder_document),\n pix: normalizeCpfCnpjForStorage(data.pix),\n bank: '',\n agency: '',\n account: '',\n });\n toast.custom((toastId) => (\n <Toast variant=\"success\" message={translateModal('saveSuccess')} toastId={toastId} />\n ));\n handleClose();\n } catch (error) {\n const message = error instanceof Error ? error.message : translateModal('saveError');\n toast.custom((toastId) => <Toast variant=\"error\" message={message} toastId={toastId} />);\n }\n };\n\n const isCnpjHolder = form.watch('holder_document').replace(/\\D/g, '').length === 14;\n\n return (\n <Dialog open={isOpen} onOpenChange={(nextOpen) => !nextOpen && handleClose()}>\n <DialogContent\n onOpenAutoFocus={(event) => event.preventDefault()}\n className=\"flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-lg lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%] overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300\"\n >\n <DialogHeader className=\"h-16 flex items-center justify-center px-5 border-b border-zinc-200 lg:border-b-0\">\n <DialogTitle className=\"text-center paragraph-medium-semibold\">\n {translateModal('dialogTitle')}\n </DialogTitle>\n </DialogHeader>\n\n <form onSubmit={form.handleSubmit(onSubmit)} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"px-4 lg:px-5 pb-4 lg:pb-5 mt-4 lg:mt-5 flex-1 lg:flex-none flex flex-col gap-5\">\n <FormField\n label={translateModal('pixKeyLabel')}\n placeholder={translateModal('pixKeyPlaceholder')}\n required\n error={!!form.formState.errors.pix}\n errorMessage={form.formState.errors.pix?.message}\n {...form.register('pix')}\n />\n <p className=\"paragraph-xsmall-medium text-zinc-500 -mt-3\">{translateModal('pixKeyHint')}</p>\n {isCnpjHolder && (\n <p className=\"paragraph-xsmall-medium text-zinc-500 -mt-3\">\n {translateModal('pixCnpjInvoiceNotice')}\n </p>\n )}\n <FormField\n label={translateModal('holderNameLabel')}\n placeholder={translateModal('holderNamePlaceholder')}\n required\n error={!!form.formState.errors.holder_name}\n errorMessage={form.formState.errors.holder_name?.message}\n {...form.register('holder_name')}\n />\n <Controller\n name=\"holder_document\"\n control={form.control}\n render={({ field, fieldState }) => (\n <FormField\n label={translateModal('holderDocumentLabel')}\n placeholder={translateModal('holderDocumentPlaceholder')}\n required\n error={!!fieldState.error}\n errorMessage={fieldState.error?.message}\n value={field.value}\n onChange={(event) => field.onChange(formatCPFCNPJ(event.target.value))}\n />\n )}\n />\n </div>\n\n <div className=\"flex justify-between gap-2 p-4 lg:p-5 border-t border-zinc-200 mt-auto lg:mt-0\">\n <Button variant=\"secondary\" type=\"button\" onClick={handleClose} className=\"h-10!\">\n {translate('common.actions.cancel')}\n </Button>\n <Button\n type=\"submit\"\n className=\"h-10!\"\n disabled={!form.formState.isValid}\n loading={form.formState.isSubmitting}\n >\n {form.formState.isSubmitting\n ? translate('common.actions.saving')\n : translate('common.actions.save')}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAiIQ,cAwBE,YAxBF;AA/HR,SAAS,WAAW,eAAe;AACnC,SAAS,YAAY,eAAe;AACpC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,OAAO,OAAO;AACd,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,2BAA2B;AACpC,SAAS,0BAA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A,gBACC,OAAO,eAAe,iBAAiB;AAAA,gBACvC,aAAa,eAAe,uBAAuB;AAAA,gBACnD,UAAQ;AAAA,gBACR,OAAO,CAAC,CAAC,KAAK,UAAU,OAAO;AAAA,gBAC/B,cAAc,KAAK,UAAU,OAAO,aAAa;AAAA,gBAChD,GAAG,KAAK,SAAS,aAAa;AAAA;AAAA,YACjC;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS,KAAK;AAAA,gBACd,QAAQ,CAAC,EAAE,OAAO,WAAW,MAC3B;AAAA,kBAAC;AAAA;AAAA,oBACC,OAAO,eAAe,qBAAqB;AAAA,oBAC3C,aAAa,eAAe,2BAA2B;AAAA,oBACvD,UAAQ;AAAA,oBACR,OAAO,CAAC,CAAC,WAAW;AAAA,oBACpB,cAAc,WAAW,OAAO;AAAA,oBAChC,OAAO,MAAM;AAAA,oBACb,UAAU,CAAC,UAAU,MAAM,SAAS,cAAc,MAAM,OAAO,KAAK,CAAC;AAAA;AAAA,gBACvE;AAAA;AAAA,YAEJ;AAAA,aACF;AAAA,UAEA,qBAAC,SAAI,WAAU,kFACb;AAAA,gCAAC,UAAO,SAAQ,aAAY,MAAK,UAAS,SAAS,aAAa,WAAU,SACvE,oBAAU,uBAAuB,GACpC;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,WAAU;AAAA,gBACV,UAAU,CAAC,KAAK,UAAU;AAAA,gBAC1B,SAAS,KAAK,UAAU;AAAA,gBAEvB,eAAK,UAAU,eACZ,UAAU,uBAAuB,IACjC,UAAU,qBAAqB;AAAA;AAAA,YACrC;AAAA,aACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/account/sections/affiliates/ReceivingAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useState } from 'react';\nimport { Controller, useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { useTranslations } from 'next-intl';\nimport { toast } from 'sonner';\nimport z from 'zod';\nimport { Button } from '../../../ui/buttons/Button';\nimport { Toast } from '../../../ui/feedback/Toast';\nimport { FormField } from '../../../ui/form/FormField';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../../ui/overlay/Dialog';\nimport { useCurrentAffiliate } from '../../../../modules/affiliates/hooks/use-current-affiliate.hook';\nimport { useUpdateAffiliate } from '../../../../modules/affiliates/hooks/use-update-affiliate.hook';\nimport {\n formatCPFCNPJ,\n formatDocument,\n formatPixKey,\n normalizeCpfCnpjForStorage,\n} from '../../../../utils/format/masks';\nimport { isValidCNPJ, isValidCPF } from '../../../../utils/validators/common';\nimport { AMBIGUOUS_PIX_KEY, normalizePixKeyForStorage } from '../../../../utils/validators/pix-key';\nimport { useAffiliateFlows } from '../../../../store/useAffiliateFlows';\n\ntype ReceivingAccountFormData = {\n pix: string;\n holder_name: string;\n holder_document: string;\n};\n\n/** Cadastro da conta de recebimento do afiliado: chave PIX e titular. */\nexport function ReceivingAccountModal() {\n const translate = useTranslations();\n const translateModal = useTranslations('common.account.workspace.affiliates.bankAccount');\n const isOpen = useAffiliateFlows((state) => state.isReceivingAccountOpen);\n const close = useAffiliateFlows((state) => state.closeReceivingAccount);\n const { data: affiliateData } = useCurrentAffiliate();\n const affiliate = affiliateData?.data;\n const updateAffiliate = useUpdateAffiliate();\n\n const schema = useMemo(\n () =>\n z\n .object({\n pix: z.string().trim().min(1, translateModal('validationPix')),\n holder_name: z.string().min(1, translateModal('validationHolder')),\n holder_document: z.string().min(1, translateModal('validationDocument')),\n })\n .superRefine((data, ctx) => {\n const pix = normalizePixKeyForStorage(data.pix, data.holder_document);\n if (data.pix && pix === null) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['pix'],\n message: translateModal('validationPixInvalid'),\n });\n }\n\n if (pix === AMBIGUOUS_PIX_KEY) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['pix'],\n message: translateModal('pixAmbiguousQuestion'),\n });\n }\n\n // O documento do titular decide PF x PJ pela contagem de dígitos, e é ele que vai para a\n // instituição no saque — tamanho certo com dígito verificador errado passa aqui e só\n // falha no pagamento.\n const digits = data.holder_document.replace(/\\D/g, '');\n if (!digits) return;\n\n if (digits.length !== 11 && digits.length !== 14) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['holder_document'],\n message: translateModal('validationDocumentLength'),\n });\n return;\n }\n\n const isValid = digits.length === 14 ? isValidCNPJ(digits) : isValidCPF(digits);\n if (!isValid) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['holder_document'],\n message:\n digits.length === 14\n ? translateModal('validationCnpjChecksum')\n : translateModal('validationCpfChecksum'),\n });\n return;\n }\n\n if (typeof pix === 'string' && /^\\d+$/.test(pix) && pix !== digits) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['pix'],\n message: translateModal('validationPixDocumentMismatch'),\n });\n }\n }),\n [translateModal]\n );\n\n const form = useForm<ReceivingAccountFormData>({\n resolver: zodResolver(schema),\n mode: 'onChange',\n defaultValues: { pix: '', holder_name: '', holder_document: '' },\n });\n\n const [declaredCpfPix, setDeclaredCpfPix] = useState<string | null>(null);\n\n const resetForm = form.reset;\n\n useEffect(() => {\n if (!isOpen || !affiliate) return;\n resetForm({\n pix: affiliate.pix ?? '',\n holder_name: affiliate.holder_name ?? '',\n holder_document: affiliate.holder_document ? formatDocument(affiliate.holder_document) : '',\n });\n }, [isOpen, affiliate, resetForm]);\n\n const handleClose = () => {\n form.reset();\n setDeclaredCpfPix(null);\n close();\n };\n\n const onSubmit = async (data: ReceivingAccountFormData) => {\n const pix = normalizePixKeyForStorage(data.pix, data.holder_document);\n if (!affiliate || typeof pix !== 'string') return;\n\n try {\n await updateAffiliate.mutateAsync({\n ...data,\n holder_document: normalizeCpfCnpjForStorage(data.holder_document),\n pix,\n bank: '',\n agency: '',\n account: '',\n });\n toast.custom((toastId) => (\n <Toast variant=\"success\" message={translateModal('saveSuccess')} toastId={toastId} />\n ));\n handleClose();\n } catch (error) {\n const message = error instanceof Error ? error.message : translateModal('saveError');\n toast.custom((toastId) => <Toast variant=\"error\" message={message} toastId={toastId} />);\n }\n };\n\n const holderDocument = form.watch('holder_document');\n const pixValue = form.watch('pix');\n const isCnpjHolder = holderDocument.replace(/\\D/g, '').length === 14;\n const pixPreview = normalizePixKeyForStorage(pixValue, holderDocument);\n const isPixAmbiguous = pixPreview === AMBIGUOUS_PIX_KEY;\n const isPixDeclaredCpf = isPixAmbiguous && declaredCpfPix === pixValue;\n\n const handleConfirmMobile = () => {\n form.setValue('pix', formatPixKey(`+55${pixValue.replace(/\\D/g, '')}`), {\n shouldValidate: true,\n shouldDirty: true,\n });\n };\n\n const handleConfirmCpf = () => {\n setDeclaredCpfPix(pixValue);\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={(nextOpen) => !nextOpen && handleClose()}>\n <DialogContent\n onOpenAutoFocus={(event) => event.preventDefault()}\n className=\"flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-lg lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%] overflow-y-auto [scrollbar-width:auto] [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-zinc-300\"\n >\n <DialogHeader className=\"h-16 flex items-center justify-center px-5 border-b border-zinc-200 lg:border-b-0\">\n <DialogTitle className=\"text-center paragraph-medium-semibold\">\n {translateModal('dialogTitle')}\n </DialogTitle>\n </DialogHeader>\n\n <form onSubmit={form.handleSubmit(onSubmit)} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"px-4 lg:px-5 pb-4 lg:pb-5 mt-4 lg:mt-5 flex-1 lg:flex-none flex flex-col gap-5\">\n <FormField\n label={translateModal('pixKeyLabel')}\n placeholder={translateModal('pixKeyPlaceholder')}\n required\n error={!!form.formState.errors.pix}\n errorMessage={\n isPixDeclaredCpf\n ? translateModal('validationPixDocumentMismatch')\n : form.formState.errors.pix?.message\n }\n hintMessage={\n typeof pixPreview === 'string'\n ? translateModal('pixKeyPreview', { value: formatPixKey(pixPreview) })\n : undefined\n }\n {...form.register('pix')}\n />\n {isPixAmbiguous && !isPixDeclaredCpf && (\n <div className=\"flex gap-2 -mt-3\">\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onClick={handleConfirmMobile}>\n {translateModal('pixAmbiguousMobile')}\n </Button>\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onClick={handleConfirmCpf}>\n {translateModal('pixAmbiguousCpf')}\n </Button>\n </div>\n )}\n <p className=\"paragraph-xsmall-medium text-zinc-500 -mt-3\">{translateModal('pixKeyHint')}</p>\n {isCnpjHolder && (\n <p className=\"paragraph-xsmall-medium text-zinc-500 -mt-3\">\n {translateModal('pixCnpjInvoiceNotice')}\n </p>\n )}\n <FormField\n label={translateModal('holderNameLabel')}\n placeholder={translateModal('holderNamePlaceholder')}\n required\n error={!!form.formState.errors.holder_name}\n errorMessage={form.formState.errors.holder_name?.message}\n {...form.register('holder_name')}\n />\n <Controller\n name=\"holder_document\"\n control={form.control}\n rules={{ deps: ['pix'] }}\n render={({ field, fieldState }) => (\n <FormField\n label={translateModal('holderDocumentLabel')}\n placeholder={translateModal('holderDocumentPlaceholder')}\n required\n error={!!fieldState.error}\n errorMessage={fieldState.error?.message}\n value={field.value}\n onChange={(event) => field.onChange(formatCPFCNPJ(event.target.value))}\n />\n )}\n />\n </div>\n\n <div className=\"flex justify-between gap-2 p-4 lg:p-5 border-t border-zinc-200 mt-auto lg:mt-0\">\n <Button variant=\"secondary\" type=\"button\" onClick={handleClose} className=\"h-10!\">\n {translate('common.actions.cancel')}\n </Button>\n <Button\n type=\"submit\"\n className=\"h-10!\"\n disabled={!form.formState.isValid}\n loading={form.formState.isSubmitting}\n >\n {form.formState.isSubmitting\n ? translate('common.actions.saving')\n : translate('common.actions.save')}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAgJQ,cA2DM,YA3DN;AA9IR,SAAS,WAAW,SAAS,gBAAgB;AAC7C,SAAS,YAAY,eAAe;AACpC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,OAAO,OAAO;AACd,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,kBAAkB;AACxC,SAAS,mBAAmB,iCAAiC;AAC7D,SAAS,yBAAyB;AAS3B,SAAS,wBAAwB;AACtC,QAAM,YAAY,gBAAgB;AAClC,QAAM,iBAAiB,gBAAgB,iDAAiD;AACxF,QAAM,SAAS,kBAAkB,CAAC,UAAU,MAAM,sBAAsB;AACxE,QAAM,QAAQ,kBAAkB,CAAC,UAAU,MAAM,qBAAqB;AACtE,QAAM,EAAE,MAAM,cAAc,IAAI,oBAAoB;AACpD,QAAM,YAAY,eAAe;AACjC,QAAM,kBAAkB,mBAAmB;AAE3C,QAAM,SAAS;AAAA,IACb,MACE,EACG,OAAO;AAAA,MACN,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,eAAe,eAAe,CAAC;AAAA,MAC7D,aAAa,EAAE,OAAO,EAAE,IAAI,GAAG,eAAe,kBAAkB,CAAC;AAAA,MACjE,iBAAiB,EAAE,OAAO,EAAE,IAAI,GAAG,eAAe,oBAAoB,CAAC;AAAA,IACzE,CAAC,EACA,YAAY,CAAC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,CAAC,KAAK,UAAU;AAAA,gBAC1B,SAAS,KAAK,UAAU;AAAA,gBAEvB,eAAK,UAAU,eACZ,UAAU,uBAAuB,IACjC,UAAU,qBAAqB;AAAA;AAAA,YACrC;AAAA,aACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
|
@@ -529,6 +529,11 @@ const messages = {
|
|
|
529
529
|
validationCpfChecksum: "Invalid CPF \u2014 check the verification digits",
|
|
530
530
|
validationCnpjChecksum: "Invalid CNPJ \u2014 check the verification digits",
|
|
531
531
|
validationPixDocumentMismatch: "The Pix key is a tax ID that differs from the account holder document. Use a key for the same document or fix the holder tax ID.",
|
|
532
|
+
validationPixInvalid: "Invalid Pix key. Use a CPF, CNPJ, mobile number with area code, email or random key.",
|
|
533
|
+
pixKeyPreview: "Will be saved as: {value}",
|
|
534
|
+
pixAmbiguousQuestion: "Is this number a mobile phone or a CPF?",
|
|
535
|
+
pixAmbiguousMobile: "Mobile",
|
|
536
|
+
pixAmbiguousCpf: "CPF",
|
|
532
537
|
pixCnpjInvoiceNotice: "Company account: withdrawals require a PDF invoice and do not use the individual monthly limit."
|
|
533
538
|
},
|
|
534
539
|
noBankAccount: {
|