@greatapps/common 1.1.795 → 1.1.797

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.
Files changed (28) hide show
  1. package/dist/components/modals/billing/BillingDataForm.mjs +406 -0
  2. package/dist/components/modals/billing/BillingDataForm.mjs.map +1 -0
  3. package/dist/components/modals/billing/RequiredBillingDataModal.mjs +5 -405
  4. package/dist/components/modals/billing/RequiredBillingDataModal.mjs.map +1 -1
  5. package/dist/i18n/resolve-locale.mjs +1 -1
  6. package/dist/i18n/resolve-locale.mjs.map +1 -1
  7. package/dist/index.mjs +4 -0
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/modules/ia-credits/types/ai-credits-offer.type.mjs +1 -0
  10. package/dist/modules/ia-credits/types/ai-credits-offer.type.mjs.map +1 -1
  11. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +1 -5
  12. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -1
  13. package/dist/modules/whitelabel/constants/whitelabel.constants.mjs +9 -0
  14. package/dist/modules/whitelabel/constants/whitelabel.constants.mjs.map +1 -0
  15. package/dist/modules/whitelabel/services/whitelabel.service.mjs +85 -11
  16. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -1
  17. package/dist/testing/msw/session.handlers.mjs +1 -0
  18. package/dist/testing/msw/session.handlers.mjs.map +1 -1
  19. package/package.json +10 -9
  20. package/src/components/modals/billing/BillingDataForm.tsx +489 -0
  21. package/src/components/modals/billing/RequiredBillingDataModal.tsx +3 -475
  22. package/src/i18n/resolve-locale.ts +1 -1
  23. package/src/index.ts +3 -0
  24. package/src/modules/ia-credits/types/ai-credits-offer.type.ts +1 -0
  25. package/src/modules/whitelabel/actions/find-whitelabel.action.ts +1 -7
  26. package/src/modules/whitelabel/constants/whitelabel.constants.ts +5 -0
  27. package/src/modules/whitelabel/services/whitelabel.service.ts +300 -209
  28. package/src/testing/msw/session.handlers.ts +1 -0
@@ -0,0 +1,406 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useMemo, useRef } from "react";
4
+ import { Controller, useForm } from "react-hook-form";
5
+ import { zodResolver } from "@hookform/resolvers/zod";
6
+ import { useTranslations } from "next-intl";
7
+ import { toast } from "sonner";
8
+ import z from "zod";
9
+ import { Button } from "../../ui/buttons/Button";
10
+ import { FormField } from "../../ui/form/FormField";
11
+ import { SelectField } from "../../ui/form/SelectField";
12
+ import { Toast } from "../../ui/feedback/Toast";
13
+ import { useAuth } from "../../../providers/auth.provider";
14
+ import { useViaCep } from "../../../modules/accounts/hooks/useViaCep";
15
+ import { useUpdateBillingData } from "../../../modules/accounts/hooks/useAccountManagement";
16
+ import { COUNTRIES } from "../../../utils/countries";
17
+ import { readGeoCountry } from "../../../utils/geo-country";
18
+ import { BR_STATE_OPTIONS } from "../../../utils/constants/br-states";
19
+ import { formatCNPJ, formatCPF, formatPostalCode } from "../../../utils/format/masks";
20
+ import { isValidCNPJ, isValidCPF } from "../../../utils/validators/common";
21
+ const COUNTRY_OPTIONS = COUNTRIES.map((country) => ({
22
+ value: country.iso,
23
+ label: country.name
24
+ }));
25
+ const BR_REQUIRED_ADDRESS_FIELDS = [
26
+ "street",
27
+ "streetNumber",
28
+ "neighborhood",
29
+ "city",
30
+ "state"
31
+ ];
32
+ function buildBillingDataSchema(translate) {
33
+ const base = z.object({
34
+ personType: z.enum(["pf", "pj"]),
35
+ document: z.string().trim(),
36
+ financialName: z.string().trim().min(1, translate("common.billing.requiredData.requiredField")),
37
+ financialEmail: z.string().trim().min(1, translate("common.billing.requiredData.requiredField")).email(translate("common.billing.requiredData.invalidEmail")),
38
+ cep: z.string().trim(),
39
+ street: z.string().trim(),
40
+ streetNumber: z.string().trim(),
41
+ complement: z.string().trim().optional(),
42
+ neighborhood: z.string().trim(),
43
+ city: z.string().trim(),
44
+ state: z.string().trim(),
45
+ country: z.string().trim().min(1, translate("common.billing.requiredData.requiredField"))
46
+ });
47
+ return base.superRefine((data, ctx) => {
48
+ if (data.country !== "BR") return;
49
+ for (const field of BR_REQUIRED_ADDRESS_FIELDS) {
50
+ if (!data[field]) {
51
+ ctx.addIssue({
52
+ code: "custom",
53
+ path: [field],
54
+ message: translate("common.billing.requiredData.requiredField")
55
+ });
56
+ }
57
+ }
58
+ if (data.cep.replace(/\D/g, "").length !== 8) {
59
+ ctx.addIssue({
60
+ code: "custom",
61
+ path: ["cep"],
62
+ message: translate("common.billing.requiredData.invalidCep")
63
+ });
64
+ }
65
+ const isCompany = data.personType === "pj";
66
+ const digits = data.document.replace(/\D/g, "");
67
+ if (digits.length !== (isCompany ? 14 : 11)) {
68
+ ctx.addIssue({
69
+ code: "custom",
70
+ path: ["document"],
71
+ message: isCompany ? translate("common.billing.requiredData.invalidCnpj") : translate("common.billing.requiredData.invalidCpf")
72
+ });
73
+ return;
74
+ }
75
+ const isValid = isCompany ? isValidCNPJ(digits) : isValidCPF(digits);
76
+ if (!isValid) {
77
+ ctx.addIssue({
78
+ code: "custom",
79
+ path: ["document"],
80
+ message: isCompany ? translate("common.billing.requiredData.invalidCnpjChecksum") : translate("common.billing.requiredData.invalidCpfChecksum")
81
+ });
82
+ }
83
+ });
84
+ }
85
+ function formatDocument(document, isCompany) {
86
+ if (!document) return "";
87
+ return isCompany ? formatCNPJ(document) : formatCPF(document);
88
+ }
89
+ function BillingDataForm({ account, onSaved, country, submitLabel }) {
90
+ const translate = useTranslations();
91
+ const { user } = useAuth();
92
+ const { mutateAsync: updateBillingData } = useUpdateBillingData();
93
+ const { mutateAsync: lookupCep } = useViaCep();
94
+ const isPrefilled = useRef(false);
95
+ const schema = useMemo(
96
+ () => buildBillingDataSchema(translate),
97
+ [translate]
98
+ );
99
+ const form = useForm({
100
+ resolver: zodResolver(schema),
101
+ mode: "onChange",
102
+ defaultValues: {
103
+ personType: "pf",
104
+ document: "",
105
+ financialName: "",
106
+ financialEmail: "",
107
+ cep: "",
108
+ street: "",
109
+ streetNumber: "",
110
+ complement: "",
111
+ neighborhood: "",
112
+ city: "",
113
+ state: "",
114
+ country: country ?? "BR"
115
+ }
116
+ });
117
+ const {
118
+ register,
119
+ control,
120
+ handleSubmit,
121
+ reset,
122
+ setValue,
123
+ watch,
124
+ formState: { errors, isSubmitting, isValid }
125
+ } = form;
126
+ const personType = watch("personType");
127
+ const isCompany = personType === "pj";
128
+ const isBrazil = watch("country") === "BR";
129
+ useEffect(() => {
130
+ if (!account || isPrefilled.current) return;
131
+ isPrefilled.current = true;
132
+ const accountIsCompany = account.financial_document_type === 2;
133
+ reset({
134
+ personType: accountIsCompany ? "pj" : "pf",
135
+ document: formatDocument(account.financial_document, accountIsCompany),
136
+ financialName: account.financial_name ?? "",
137
+ financialEmail: account.financial_email || user?.email || "",
138
+ cep: account.zipcode ?? "",
139
+ street: account.address ?? "",
140
+ streetNumber: account.address_number ?? "",
141
+ complement: account.address_complement ?? "",
142
+ neighborhood: account.neighborhood ?? "",
143
+ city: account.city ?? "",
144
+ state: account.state ?? "",
145
+ country: country ?? (account.country || readGeoCountry() || "BR")
146
+ });
147
+ }, [account, country, reset, user?.email]);
148
+ const handleDocumentChange = (rawValue) => {
149
+ setValue("document", isCompany ? formatCNPJ(rawValue) : formatCPF(rawValue), {
150
+ shouldValidate: true
151
+ });
152
+ };
153
+ const handlePersonTypeChange = (value) => {
154
+ if (value === personType) return;
155
+ setValue("document", "");
156
+ setValue("personType", value, { shouldValidate: true });
157
+ };
158
+ const handleCepChange = (rawValue) => {
159
+ setValue("cep", formatPostalCode(rawValue), { shouldValidate: true });
160
+ const digits = rawValue.replace(/\D/g, "");
161
+ if (digits.length !== 8) return;
162
+ lookupCep(digits).then((data) => {
163
+ setValue("street", data.logradouro, { shouldValidate: true });
164
+ setValue("neighborhood", data.bairro, { shouldValidate: true });
165
+ setValue("city", data.localidade, { shouldValidate: true });
166
+ setValue("state", data.uf, { shouldValidate: true });
167
+ }).catch(() => {
168
+ });
169
+ };
170
+ async function onSubmit(data) {
171
+ const payload = data.country === "BR" ? {
172
+ financial_document_type: data.personType === "pf" ? 1 : 2,
173
+ financial_document: data.document,
174
+ financial_name: data.financialName,
175
+ financial_email: data.financialEmail,
176
+ zipcode: data.cep,
177
+ address: data.street,
178
+ address_number: data.streetNumber,
179
+ address_complement: data.complement ?? "",
180
+ neighborhood: data.neighborhood,
181
+ city: data.city,
182
+ state: data.state,
183
+ country: data.country
184
+ } : {
185
+ financial_name: data.financialName,
186
+ financial_email: data.financialEmail,
187
+ country: data.country
188
+ };
189
+ try {
190
+ await updateBillingData(payload);
191
+ toast.custom(
192
+ (t) => /* @__PURE__ */ jsx(
193
+ Toast,
194
+ {
195
+ variant: "success",
196
+ message: translate("common.billing.requiredData.successToast"),
197
+ toastId: t
198
+ }
199
+ ),
200
+ { duration: 5e3 }
201
+ );
202
+ onSaved();
203
+ } catch (error) {
204
+ const message = error instanceof Error && error.message ? error.message : translate("common.billing.requiredData.errorToast");
205
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message, toastId: t }), {
206
+ duration: 5e3
207
+ });
208
+ }
209
+ }
210
+ return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "flex flex-col flex-1 min-h-0", noValidate: true, children: [
211
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-4 lg:p-5 flex-1 overflow-y-auto", children: [
212
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
213
+ !country && /* @__PURE__ */ jsxs(Fragment, { children: [
214
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-zinc-600", children: isBrazil ? translate("common.billing.requiredData.description") : translate("common.billing.requiredData.descriptionInternational") }),
215
+ /* @__PURE__ */ jsx(
216
+ Controller,
217
+ {
218
+ name: "country",
219
+ control,
220
+ render: ({ field }) => /* @__PURE__ */ jsx(
221
+ SelectField,
222
+ {
223
+ label: translate("common.billing.requiredData.country"),
224
+ placeholder: translate("common.billing.requiredData.select"),
225
+ value: field.value || void 0,
226
+ onChange: (value) => setValue("country", String(value), { shouldValidate: true }),
227
+ options: COUNTRY_OPTIONS,
228
+ error: !!errors.country,
229
+ errorMessage: errors.country?.message
230
+ }
231
+ )
232
+ }
233
+ )
234
+ ] }),
235
+ isBrazil && /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
236
+ /* @__PURE__ */ jsx(
237
+ Controller,
238
+ {
239
+ name: "personType",
240
+ control,
241
+ render: ({ field }) => /* @__PURE__ */ jsx(
242
+ SelectField,
243
+ {
244
+ label: translate("common.billing.requiredData.personType"),
245
+ placeholder: translate("common.billing.requiredData.select"),
246
+ value: field.value,
247
+ onChange: (value) => handlePersonTypeChange(value),
248
+ options: [
249
+ {
250
+ value: "pf",
251
+ label: translate("common.billing.requiredData.personTypePf")
252
+ },
253
+ {
254
+ value: "pj",
255
+ label: translate("common.billing.requiredData.personTypePj")
256
+ }
257
+ ],
258
+ containerClassName: "flex-1"
259
+ }
260
+ )
261
+ }
262
+ ),
263
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
264
+ FormField,
265
+ {
266
+ label: isCompany ? translate("common.billing.requiredData.cnpj") : translate("common.billing.requiredData.cpf"),
267
+ placeholder: isCompany ? "__.___.___/____-__" : "___.___.___-__",
268
+ error: !!errors.document,
269
+ errorMessage: errors.document?.message,
270
+ ...register("document", {
271
+ onChange: (event) => handleDocumentChange(event.target.value)
272
+ })
273
+ }
274
+ ) })
275
+ ] }),
276
+ /* @__PURE__ */ jsx(
277
+ FormField,
278
+ {
279
+ label: isBrazil && isCompany ? translate("common.billing.requiredData.companyName") : translate("common.billing.requiredData.fullName"),
280
+ placeholder: translate("common.billing.requiredData.typeHere"),
281
+ error: !!errors.financialName,
282
+ errorMessage: errors.financialName?.message,
283
+ ...register("financialName")
284
+ }
285
+ ),
286
+ /* @__PURE__ */ jsx(
287
+ FormField,
288
+ {
289
+ label: translate("common.billing.requiredData.financialEmail"),
290
+ placeholder: translate("common.billing.requiredData.financialEmailPlaceholder"),
291
+ type: "email",
292
+ error: !!errors.financialEmail,
293
+ errorMessage: errors.financialEmail?.message,
294
+ ...register("financialEmail")
295
+ }
296
+ )
297
+ ] }),
298
+ isBrazil && /* @__PURE__ */ jsxs(Fragment, { children: [
299
+ /* @__PURE__ */ jsx("div", { className: "h-px bg-zinc-200" }),
300
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
301
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950", children: translate("common.billing.requiredData.addressHeading") }),
302
+ /* @__PURE__ */ jsx(
303
+ FormField,
304
+ {
305
+ label: translate("common.billing.requiredData.cep"),
306
+ placeholder: "_____-___",
307
+ error: !!errors.cep,
308
+ errorMessage: errors.cep?.message,
309
+ ...register("cep", {
310
+ onChange: (event) => handleCepChange(event.target.value)
311
+ })
312
+ }
313
+ ),
314
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
315
+ /* @__PURE__ */ jsx("div", { className: "flex-[3]", children: /* @__PURE__ */ jsx(
316
+ FormField,
317
+ {
318
+ label: translate("common.billing.requiredData.street"),
319
+ placeholder: translate("common.billing.requiredData.typeHere"),
320
+ error: !!errors.street,
321
+ errorMessage: errors.street?.message,
322
+ ...register("street")
323
+ }
324
+ ) }),
325
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
326
+ FormField,
327
+ {
328
+ label: translate("common.billing.requiredData.streetNumber"),
329
+ placeholder: "000",
330
+ error: !!errors.streetNumber,
331
+ errorMessage: errors.streetNumber?.message,
332
+ ...register("streetNumber")
333
+ }
334
+ ) })
335
+ ] }),
336
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
337
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
338
+ FormField,
339
+ {
340
+ label: translate("common.billing.requiredData.neighborhood"),
341
+ placeholder: translate("common.billing.requiredData.typeHere"),
342
+ error: !!errors.neighborhood,
343
+ errorMessage: errors.neighborhood?.message,
344
+ ...register("neighborhood")
345
+ }
346
+ ) }),
347
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
348
+ FormField,
349
+ {
350
+ label: translate("common.billing.requiredData.complement"),
351
+ optional: true,
352
+ placeholder: translate("common.billing.requiredData.typeHere"),
353
+ ...register("complement")
354
+ }
355
+ ) })
356
+ ] }),
357
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
358
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
359
+ FormField,
360
+ {
361
+ label: translate("common.billing.requiredData.city"),
362
+ placeholder: translate("common.billing.requiredData.typeHere"),
363
+ error: !!errors.city,
364
+ errorMessage: errors.city?.message,
365
+ ...register("city")
366
+ }
367
+ ) }),
368
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
369
+ Controller,
370
+ {
371
+ name: "state",
372
+ control,
373
+ render: ({ field }) => /* @__PURE__ */ jsx(
374
+ SelectField,
375
+ {
376
+ label: translate("common.billing.requiredData.state"),
377
+ placeholder: translate("common.billing.requiredData.select"),
378
+ value: field.value || void 0,
379
+ onChange: (value) => setValue("state", String(value), { shouldValidate: true }),
380
+ options: BR_STATE_OPTIONS,
381
+ error: !!errors.state,
382
+ errorMessage: errors.state?.message
383
+ }
384
+ )
385
+ }
386
+ ) })
387
+ ] })
388
+ ] })
389
+ ] })
390
+ ] }),
391
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end p-4 lg:p-5 border-t border-zinc-200 shrink-0", children: /* @__PURE__ */ jsx(
392
+ Button,
393
+ {
394
+ type: "submit",
395
+ className: "h-10! w-full lg:w-fit",
396
+ disabled: !isValid || isSubmitting,
397
+ loading: isSubmitting,
398
+ children: isSubmitting ? translate("common.billing.requiredData.submitting") : submitLabel ?? translate("common.billing.requiredData.submit")
399
+ }
400
+ ) })
401
+ ] });
402
+ }
403
+ export {
404
+ BillingDataForm
405
+ };
406
+ //# sourceMappingURL=BillingDataForm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/modals/billing/BillingDataForm.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any -- o generic Translator do next-intl não é\n expressável estruturalmente; o `any` do TranslateFn é intencional e está contido neste arquivo\n (mesmo padrão de modules/plans/utils/map-api-plan-to-ui.ts). */\n'use client';\n\nimport { useEffect, useMemo, useRef } 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';\n\nimport { Button } from '../../ui/buttons/Button';\nimport { FormField } from '../../ui/form/FormField';\nimport { SelectField } from '../../ui/form/SelectField';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { useAuth } from '../../../providers/auth.provider';\nimport { useViaCep } from '../../../modules/accounts/hooks/useViaCep';\nimport { useUpdateBillingData } from '../../../modules/accounts/hooks/useAccountManagement';\nimport { COUNTRIES } from '../../../utils/countries';\nimport { readGeoCountry } from '../../../utils/geo-country';\nimport { BR_STATE_OPTIONS } from '../../../utils/constants/br-states';\nimport { formatCNPJ, formatCPF, formatPostalCode } from '../../../utils/format/masks';\nimport { isValidCNPJ, isValidCPF } from '../../../utils/validators/common';\nimport type { Account } from '../../../modules/accounts/types';\nimport type { UpdateBillingDataRequest } from '../../../modules/accounts/types';\n\ntype TranslateFn = (key: any, values?: Record<string, string | number>) => string;\n\ntype BillingDataFormValues = {\n personType: 'pf' | 'pj';\n document: string;\n financialName: string;\n financialEmail: string;\n cep: string;\n street: string;\n streetNumber: string;\n complement?: string;\n neighborhood: string;\n city: string;\n state: string;\n country: string;\n};\n\nconst COUNTRY_OPTIONS = COUNTRIES.map((country: { iso: string; name: string }) => ({\n value: country.iso,\n label: country.name,\n}));\n\nconst BR_REQUIRED_ADDRESS_FIELDS: readonly (keyof BillingDataFormValues)[] = [\n 'street',\n 'streetNumber',\n 'neighborhood',\n 'city',\n 'state',\n];\n\nfunction buildBillingDataSchema(translate: TranslateFn) {\n const base = z.object({\n personType: z.enum(['pf', 'pj']),\n document: z.string().trim(),\n financialName: z\n .string()\n .trim()\n .min(1, translate('common.billing.requiredData.requiredField')),\n financialEmail: z\n .string()\n .trim()\n .min(1, translate('common.billing.requiredData.requiredField'))\n .email(translate('common.billing.requiredData.invalidEmail')),\n cep: z.string().trim(),\n street: z.string().trim(),\n streetNumber: z.string().trim(),\n complement: z.string().trim().optional(),\n neighborhood: z.string().trim(),\n city: z.string().trim(),\n state: z.string().trim(),\n country: z.string().trim().min(1, translate('common.billing.requiredData.requiredField')),\n });\n\n return base.superRefine((data, ctx) => {\n if (data.country !== 'BR') return;\n\n for (const field of BR_REQUIRED_ADDRESS_FIELDS) {\n if (!data[field]) {\n ctx.addIssue({\n code: 'custom',\n path: [field],\n message: translate('common.billing.requiredData.requiredField'),\n });\n }\n }\n\n if (data.cep.replace(/\\D/g, '').length !== 8) {\n ctx.addIssue({\n code: 'custom',\n path: ['cep'],\n message: translate('common.billing.requiredData.invalidCep'),\n });\n }\n\n const isCompany = data.personType === 'pj';\n const digits = data.document.replace(/\\D/g, '');\n\n if (digits.length !== (isCompany ? 14 : 11)) {\n ctx.addIssue({\n code: 'custom',\n path: ['document'],\n message: isCompany\n ? translate('common.billing.requiredData.invalidCnpj')\n : translate('common.billing.requiredData.invalidCpf'),\n });\n return;\n }\n\n const isValid = isCompany ? isValidCNPJ(digits) : isValidCPF(digits);\n if (!isValid) {\n ctx.addIssue({\n code: 'custom',\n path: ['document'],\n message: isCompany\n ? translate('common.billing.requiredData.invalidCnpjChecksum')\n : translate('common.billing.requiredData.invalidCpfChecksum'),\n });\n }\n });\n}\n\nfunction formatDocument(document: string | null | undefined, isCompany: boolean) {\n if (!document) return '';\n return isCompany ? formatCNPJ(document) : formatCPF(document);\n}\n\nexport interface BillingDataFormProps {\n account: Account | undefined;\n onSaved: () => void;\n country?: 'BR';\n submitLabel?: string;\n}\n\nexport function BillingDataForm({ account, onSaved, country, submitLabel }: BillingDataFormProps) {\n const translate = useTranslations();\n const { user } = useAuth();\n const { mutateAsync: updateBillingData } = useUpdateBillingData();\n const { mutateAsync: lookupCep } = useViaCep();\n\n const isPrefilled = useRef(false);\n\n const schema = useMemo(\n () => buildBillingDataSchema(translate),\n [translate],\n );\n\n const form = useForm<BillingDataFormValues>({\n resolver: zodResolver(schema),\n mode: 'onChange',\n defaultValues: {\n personType: 'pf',\n document: '',\n financialName: '',\n financialEmail: '',\n cep: '',\n street: '',\n streetNumber: '',\n complement: '',\n neighborhood: '',\n city: '',\n state: '',\n country: country ?? 'BR',\n },\n });\n\n const {\n register,\n control,\n handleSubmit,\n reset,\n setValue,\n watch,\n formState: { errors, isSubmitting, isValid },\n } = form;\n\n const personType = watch('personType');\n const isCompany = personType === 'pj';\n const isBrazil = watch('country') === 'BR';\n\n useEffect(() => {\n if (!account || isPrefilled.current) return;\n isPrefilled.current = true;\n\n const accountIsCompany = account.financial_document_type === 2;\n reset({\n personType: accountIsCompany ? 'pj' : 'pf',\n document: formatDocument(account.financial_document, accountIsCompany),\n financialName: account.financial_name ?? '',\n financialEmail: account.financial_email || user?.email || '',\n cep: account.zipcode ?? '',\n street: account.address ?? '',\n streetNumber: account.address_number ?? '',\n complement: account.address_complement ?? '',\n neighborhood: account.neighborhood ?? '',\n city: account.city ?? '',\n state: account.state ?? '',\n country: country ?? (account.country || readGeoCountry() || 'BR'),\n });\n }, [account, country, reset, user?.email]);\n\n const handleDocumentChange = (rawValue: string) => {\n setValue('document', isCompany ? formatCNPJ(rawValue) : formatCPF(rawValue), {\n shouldValidate: true,\n });\n };\n\n const handlePersonTypeChange = (value: 'pf' | 'pj') => {\n if (value === personType) return;\n setValue('document', '');\n setValue('personType', value, { shouldValidate: true });\n };\n\n const handleCepChange = (rawValue: string) => {\n setValue('cep', formatPostalCode(rawValue), { shouldValidate: true });\n\n const digits = rawValue.replace(/\\D/g, '');\n if (digits.length !== 8) return;\n\n lookupCep(digits)\n .then((data) => {\n setValue('street', data.logradouro, { shouldValidate: true });\n setValue('neighborhood', data.bairro, { shouldValidate: true });\n setValue('city', data.localidade, { shouldValidate: true });\n setValue('state', data.uf, { shouldValidate: true });\n })\n .catch(() => {});\n };\n\n async function onSubmit(data: BillingDataFormValues) {\n const payload: UpdateBillingDataRequest =\n data.country === 'BR'\n ? {\n financial_document_type: data.personType === 'pf' ? 1 : 2,\n financial_document: data.document,\n financial_name: data.financialName,\n financial_email: data.financialEmail,\n zipcode: data.cep,\n address: data.street,\n address_number: data.streetNumber,\n address_complement: data.complement ?? '',\n neighborhood: data.neighborhood,\n city: data.city,\n state: data.state,\n country: data.country,\n }\n : {\n financial_name: data.financialName,\n financial_email: data.financialEmail,\n country: data.country,\n };\n\n try {\n await updateBillingData(payload);\n toast.custom(\n (t) => (\n <Toast\n variant=\"success\"\n message={translate('common.billing.requiredData.successToast')}\n toastId={t}\n />\n ),\n { duration: 5000 },\n );\n onSaved();\n } catch (error) {\n const message =\n error instanceof Error && error.message\n ? error.message\n : translate('common.billing.requiredData.errorToast');\n toast.custom((t) => <Toast variant=\"error\" message={message} toastId={t} />, {\n duration: 5000,\n });\n }\n }\n\n return (\n <form onSubmit={handleSubmit(onSubmit)} className=\"flex flex-col flex-1 min-h-0\" noValidate>\n <div className=\"flex flex-col gap-6 p-4 lg:p-5 flex-1 overflow-y-auto\">\n <div className=\"flex flex-col gap-5\">\n {!country && (\n <>\n <span className=\"paragraph-small-regular text-zinc-600\">\n {isBrazil\n ? translate('common.billing.requiredData.description')\n : translate('common.billing.requiredData.descriptionInternational')}\n </span>\n\n <Controller\n name=\"country\"\n control={control}\n render={({ field }) => (\n <SelectField\n label={translate('common.billing.requiredData.country')}\n placeholder={translate('common.billing.requiredData.select')}\n value={field.value || undefined}\n onChange={(value) =>\n setValue('country', String(value), { shouldValidate: true })\n }\n options={COUNTRY_OPTIONS}\n error={!!errors.country}\n errorMessage={errors.country?.message}\n />\n )}\n />\n </>\n )}\n\n {isBrazil && (\n <div className=\"flex gap-4\">\n <Controller\n name=\"personType\"\n control={control}\n render={({ field }) => (\n <SelectField\n label={translate('common.billing.requiredData.personType')}\n placeholder={translate('common.billing.requiredData.select')}\n value={field.value}\n onChange={(value) => handlePersonTypeChange(value as 'pf' | 'pj')}\n options={[\n {\n value: 'pf',\n label: translate('common.billing.requiredData.personTypePf'),\n },\n {\n value: 'pj',\n label: translate('common.billing.requiredData.personTypePj'),\n },\n ]}\n containerClassName=\"flex-1\"\n />\n )}\n />\n <div className=\"flex-1\">\n <FormField\n label={\n isCompany\n ? translate('common.billing.requiredData.cnpj')\n : translate('common.billing.requiredData.cpf')\n }\n placeholder={isCompany ? '__.___.___/____-__' : '___.___.___-__'}\n error={!!errors.document}\n errorMessage={errors.document?.message}\n {...register('document', {\n onChange: (event) => handleDocumentChange(event.target.value),\n })}\n />\n </div>\n </div>\n )}\n\n <FormField\n label={\n isBrazil && isCompany\n ? translate('common.billing.requiredData.companyName')\n : translate('common.billing.requiredData.fullName')\n }\n placeholder={translate('common.billing.requiredData.typeHere')}\n error={!!errors.financialName}\n errorMessage={errors.financialName?.message}\n {...register('financialName')}\n />\n\n <FormField\n label={translate('common.billing.requiredData.financialEmail')}\n placeholder={translate('common.billing.requiredData.financialEmailPlaceholder')}\n type=\"email\"\n error={!!errors.financialEmail}\n errorMessage={errors.financialEmail?.message}\n {...register('financialEmail')}\n />\n </div>\n\n {isBrazil && (\n <>\n <div className=\"h-px bg-zinc-200\" />\n\n <div className=\"flex flex-col gap-5\">\n <span className=\"paragraph-small-semibold text-zinc-950\">\n {translate('common.billing.requiredData.addressHeading')}\n </span>\n\n <FormField\n label={translate('common.billing.requiredData.cep')}\n placeholder=\"_____-___\"\n error={!!errors.cep}\n errorMessage={errors.cep?.message}\n {...register('cep', {\n onChange: (event) => handleCepChange(event.target.value),\n })}\n />\n\n <div className=\"flex gap-4\">\n <div className=\"flex-[3]\">\n <FormField\n label={translate('common.billing.requiredData.street')}\n placeholder={translate('common.billing.requiredData.typeHere')}\n error={!!errors.street}\n errorMessage={errors.street?.message}\n {...register('street')}\n />\n </div>\n <div className=\"flex-1\">\n <FormField\n label={translate('common.billing.requiredData.streetNumber')}\n placeholder=\"000\"\n error={!!errors.streetNumber}\n errorMessage={errors.streetNumber?.message}\n {...register('streetNumber')}\n />\n </div>\n </div>\n\n <div className=\"flex gap-4\">\n <div className=\"flex-1\">\n <FormField\n label={translate('common.billing.requiredData.neighborhood')}\n placeholder={translate('common.billing.requiredData.typeHere')}\n error={!!errors.neighborhood}\n errorMessage={errors.neighborhood?.message}\n {...register('neighborhood')}\n />\n </div>\n <div className=\"flex-1\">\n <FormField\n label={translate('common.billing.requiredData.complement')}\n optional\n placeholder={translate('common.billing.requiredData.typeHere')}\n {...register('complement')}\n />\n </div>\n </div>\n\n <div className=\"flex gap-4\">\n <div className=\"flex-1\">\n <FormField\n label={translate('common.billing.requiredData.city')}\n placeholder={translate('common.billing.requiredData.typeHere')}\n error={!!errors.city}\n errorMessage={errors.city?.message}\n {...register('city')}\n />\n </div>\n <div className=\"flex-1\">\n <Controller\n name=\"state\"\n control={control}\n render={({ field }) => (\n <SelectField\n label={translate('common.billing.requiredData.state')}\n placeholder={translate('common.billing.requiredData.select')}\n value={field.value || undefined}\n onChange={(value) =>\n setValue('state', String(value), { shouldValidate: true })\n }\n options={BR_STATE_OPTIONS}\n error={!!errors.state}\n errorMessage={errors.state?.message}\n />\n )}\n />\n </div>\n </div>\n </div>\n </>\n )}\n </div>\n\n <div className=\"flex items-center justify-end p-4 lg:p-5 border-t border-zinc-200 shrink-0\">\n <Button\n type=\"submit\"\n className=\"h-10! w-full lg:w-fit\"\n disabled={!isValid || isSubmitting}\n loading={isSubmitting}\n >\n {isSubmitting\n ? translate('common.billing.requiredData.submitting')\n : submitLabel ?? translate('common.billing.requiredData.submit')}\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":";AAsQU,SAyBE,UAzBF,KA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