@greatapps/common 1.1.274 → 1.1.276

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.
@@ -10,7 +10,7 @@ function WhitelabelCodes() {
10
10
  const { whitelabel } = useWhitelabel();
11
11
  useEffect(() => {
12
12
  const codes = whitelabel?.codes;
13
- const rawCodes = typeof codes === "string" ? codes.trim() : "";
13
+ const rawCodes = codes ? codes.trim() : "";
14
14
  if (!rawCodes) {
15
15
  return;
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/layouts/WhitelabelCodes.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport { useWhitelabel } from '../../providers/whitelabel.provider';\n\nfunction copyAttributes(source: Element, target: HTMLElement) {\n Array.from(source.attributes).forEach((attribute) => {\n target.setAttribute(attribute.name, attribute.value);\n });\n}\n\nexport default function WhitelabelCodes() {\n const { whitelabel } = useWhitelabel();\n\n useEffect(() => {\n const codes = whitelabel?.codes;\n const rawCodes = typeof codes === 'string' ? codes.trim() : '';\n\n if (!rawCodes) {\n return;\n }\n\n const template = document.createElement('template');\n template.innerHTML = rawCodes;\n\n const appendedNodes: HTMLElement[] = [];\n\n Array.from(template.content.children).forEach((node) => {\n const tagName = node.tagName.toLowerCase();\n\n if (tagName !== 'style' && tagName !== 'script') {\n return;\n }\n\n if (tagName === 'style') {\n const style = document.createElement('style');\n copyAttributes(node, style);\n style.textContent = node.textContent;\n style.dataset.whitelabelCodes = 'true';\n document.head.appendChild(style);\n appendedNodes.push(style);\n return;\n }\n\n const script = document.createElement('script');\n copyAttributes(node, script);\n script.textContent = node.textContent;\n script.dataset.whitelabelCodes = 'true';\n document.head.appendChild(script);\n appendedNodes.push(script);\n });\n\n return () => {\n appendedNodes.forEach((node) => node.remove());\n };\n }, [whitelabel?.codes]);\n\n return null;\n}\n"],"mappings":";AAEA,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAE9B,SAAS,eAAe,QAAiB,QAAqB;AAC5D,QAAM,KAAK,OAAO,UAAU,EAAE,QAAQ,CAAC,cAAc;AACnD,WAAO,aAAa,UAAU,MAAM,UAAU,KAAK;AAAA,EACrD,CAAC;AACH;AAEe,SAAR,kBAAmC;AACxC,QAAM,EAAE,WAAW,IAAI,cAAc;AAErC,YAAU,MAAM;AACd,UAAM,QAAQ,YAAY;AAC1B,UAAM,WAAW,OAAO,UAAU,WAAW,MAAM,KAAK,IAAI;AAE5D,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,UAAM,WAAW,SAAS,cAAc,UAAU;AAClD,aAAS,YAAY;AAErB,UAAM,gBAA+B,CAAC;AAEtC,UAAM,KAAK,SAAS,QAAQ,QAAQ,EAAE,QAAQ,CAAC,SAAS;AACtD,YAAM,UAAU,KAAK,QAAQ,YAAY;AAEzC,UAAI,YAAY,WAAW,YAAY,UAAU;AAC/C;AAAA,MACF;AAEA,UAAI,YAAY,SAAS;AACvB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,uBAAe,MAAM,KAAK;AAC1B,cAAM,cAAc,KAAK;AACzB,cAAM,QAAQ,kBAAkB;AAChC,iBAAS,KAAK,YAAY,KAAK;AAC/B,sBAAc,KAAK,KAAK;AACxB;AAAA,MACF;AAEA,YAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,qBAAe,MAAM,MAAM;AAC3B,aAAO,cAAc,KAAK;AAC1B,aAAO,QAAQ,kBAAkB;AACjC,eAAS,KAAK,YAAY,MAAM;AAChC,oBAAc,KAAK,MAAM;AAAA,IAC3B,CAAC;AAED,WAAO,MAAM;AACX,oBAAc,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAAA,IAC/C;AAAA,EACF,GAAG,CAAC,YAAY,KAAK,CAAC;AAEtB,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/layouts/WhitelabelCodes.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useWhitelabel } from \"../../providers/whitelabel.provider\";\n\nfunction copyAttributes(source: Element, target: HTMLElement) {\n Array.from(source.attributes).forEach((attribute) => {\n target.setAttribute(attribute.name, attribute.value);\n });\n}\n\nexport default function WhitelabelCodes() {\n const { whitelabel } = useWhitelabel();\n\n useEffect(() => {\n const codes = whitelabel?.codes;\n const rawCodes = codes ? codes.trim() : \"\";\n\n if (!rawCodes) {\n return;\n }\n\n const template = document.createElement(\"template\");\n template.innerHTML = rawCodes;\n\n const appendedNodes: HTMLElement[] = [];\n\n Array.from(template.content.children).forEach((node) => {\n const tagName = node.tagName.toLowerCase();\n\n if (tagName !== \"style\" && tagName !== \"script\") {\n return;\n }\n\n if (tagName === \"style\") {\n const style = document.createElement(\"style\");\n copyAttributes(node, style);\n style.textContent = node.textContent;\n style.dataset.whitelabelCodes = \"true\";\n document.head.appendChild(style);\n appendedNodes.push(style);\n return;\n }\n\n const script = document.createElement(\"script\");\n copyAttributes(node, script);\n script.textContent = node.textContent;\n script.dataset.whitelabelCodes = \"true\";\n document.head.appendChild(script);\n appendedNodes.push(script);\n });\n\n return () => {\n appendedNodes.forEach((node) => node.remove());\n };\n }, [whitelabel?.codes]);\n\n return null;\n}\n"],"mappings":";AAEA,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAE9B,SAAS,eAAe,QAAiB,QAAqB;AAC5D,QAAM,KAAK,OAAO,UAAU,EAAE,QAAQ,CAAC,cAAc;AACnD,WAAO,aAAa,UAAU,MAAM,UAAU,KAAK;AAAA,EACrD,CAAC;AACH;AAEe,SAAR,kBAAmC;AACxC,QAAM,EAAE,WAAW,IAAI,cAAc;AAErC,YAAU,MAAM;AACd,UAAM,QAAQ,YAAY;AAC1B,UAAM,WAAW,QAAQ,MAAM,KAAK,IAAI;AAExC,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,UAAM,WAAW,SAAS,cAAc,UAAU;AAClD,aAAS,YAAY;AAErB,UAAM,gBAA+B,CAAC;AAEtC,UAAM,KAAK,SAAS,QAAQ,QAAQ,EAAE,QAAQ,CAAC,SAAS;AACtD,YAAM,UAAU,KAAK,QAAQ,YAAY;AAEzC,UAAI,YAAY,WAAW,YAAY,UAAU;AAC/C;AAAA,MACF;AAEA,UAAI,YAAY,SAAS;AACvB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,uBAAe,MAAM,KAAK;AAC1B,cAAM,cAAc,KAAK;AACzB,cAAM,QAAQ,kBAAkB;AAChC,iBAAS,KAAK,YAAY,KAAK;AAC/B,sBAAc,KAAK,KAAK;AACxB;AAAA,MACF;AAEA,YAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,qBAAe,MAAM,MAAM;AAC3B,aAAO,cAAc,KAAK;AAC1B,aAAO,QAAQ,kBAAkB;AACjC,eAAS,KAAK,YAAY,MAAM;AAChC,oBAAc,KAAK,MAAM;AAAA,IAC3B,CAAC;AAED,WAAO,MAAM;AACX,oBAAc,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAAA,IAC/C;AAAA,EACF,GAAG,CAAC,YAAY,KAAK,CAAC;AAEtB,SAAO;AACT;","names":[]}
@@ -0,0 +1,133 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useCallback } from "react";
4
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../../ui/overlay/Dialog";
5
+ import { Button } from "../../ui/buttons/Button";
6
+ import { Toast } from "../../ui/feedback/Toast";
7
+ import { useModalManager } from "../../../store/useModalManager";
8
+ import { useCreateCard } from "../../../modules/cards/hooks/create-card.hook";
9
+ import { CardFormFields, cardFormSchema } from "./CardFormFields";
10
+ import { IconX } from "@tabler/icons-react";
11
+ import { useForm } from "react-hook-form";
12
+ import { zodResolver } from "@hookform/resolvers/zod";
13
+ import { CardNumberElement, useElements, useStripe } from "@stripe/react-stripe-js";
14
+ import { toast } from "sonner";
15
+ function AddCardModal() {
16
+ const { activeModal, modalData, closeModal } = useModalManager();
17
+ const isOpen = activeModal === "addCardModal";
18
+ const onCardAdded = modalData.onCardAdded;
19
+ const createCardMutation = useCreateCard();
20
+ const elements = useElements();
21
+ const stripe = useStripe();
22
+ const form = useForm({
23
+ resolver: zodResolver(cardFormSchema),
24
+ mode: "onSubmit",
25
+ reValidateMode: "onChange",
26
+ defaultValues: {
27
+ country: "BR"
28
+ }
29
+ });
30
+ const handleClose = useCallback(() => {
31
+ form.reset();
32
+ closeModal();
33
+ }, [form, closeModal]);
34
+ async function handleSubmit(data) {
35
+ if (!stripe || !elements) return;
36
+ const cardElement = elements.getElement(CardNumberElement);
37
+ if (!cardElement) return;
38
+ const { error, paymentMethod } = await stripe.createPaymentMethod({
39
+ type: "card",
40
+ card: cardElement,
41
+ billing_details: {
42
+ name: data.name,
43
+ address: {
44
+ country: data.country,
45
+ postal_code: data.postalCode
46
+ }
47
+ }
48
+ });
49
+ if (error) {
50
+ toast.custom(
51
+ (t) => /* @__PURE__ */ jsx(
52
+ Toast,
53
+ {
54
+ variant: "error",
55
+ message: "N\xE3o foi poss\xEDvel adicionar o cart\xE3o na Stripe, tente novamente.",
56
+ toastId: t
57
+ }
58
+ ),
59
+ { duration: 5e3 }
60
+ );
61
+ return;
62
+ }
63
+ const result = await createCardMutation.mutateAsync(
64
+ { payment_method_id: paymentMethod.id },
65
+ {
66
+ onError: () => {
67
+ handleClose();
68
+ toast.custom(
69
+ (t) => /* @__PURE__ */ jsx(
70
+ Toast,
71
+ {
72
+ variant: "error",
73
+ message: "N\xE3o foi poss\xEDvel salvar o seu novo cart\xE3o, tente novamente.",
74
+ toastId: t
75
+ }
76
+ ),
77
+ { duration: 5e3 }
78
+ );
79
+ }
80
+ }
81
+ );
82
+ if (result.success && result.data?.id != null) {
83
+ onCardAdded?.(result.data.id.toString());
84
+ }
85
+ toast.custom(
86
+ (t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Cart\xE3o adicionado com sucesso.", toastId: t }),
87
+ { duration: 5e3 }
88
+ );
89
+ handleClose();
90
+ }
91
+ const isSubmitting = createCardMutation.isPending || form.formState.isSubmitting;
92
+ const isValid = form.formState.isValid;
93
+ return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
94
+ DialogContent,
95
+ {
96
+ showCloseButton: false,
97
+ 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-[470px] 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",
98
+ children: [
99
+ /* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center px-4 py-3 relative border-b border-zinc-200 lg:border-b-0", children: [
100
+ /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-zinc-950 text-center", children: "Adicionar cart\xE3o" }),
101
+ /* @__PURE__ */ jsx(
102
+ Button,
103
+ {
104
+ type: "button",
105
+ variant: "ghost",
106
+ className: "size-8! p-0 absolute right-4",
107
+ onClick: handleClose,
108
+ children: /* @__PURE__ */ jsx(IconX, { size: 18 })
109
+ }
110
+ )
111
+ ] }) }),
112
+ /* @__PURE__ */ jsxs(
113
+ "form",
114
+ {
115
+ onSubmit: form.handleSubmit(handleSubmit),
116
+ className: "flex flex-col flex-1 lg:flex-none",
117
+ children: [
118
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none", children: /* @__PURE__ */ jsx(CardFormFields, { form }) }),
119
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-4 lg:p-5 border-t border-zinc-200 gap-2 mt-auto lg:mt-0", children: [
120
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", type: "button", onClick: handleClose, className: "h-10!", children: "Cancelar" }),
121
+ /* @__PURE__ */ jsx(Button, { type: "submit", className: "h-10!", disabled: isSubmitting || !isValid, children: isSubmitting ? "Adicionando cart\xE3o..." : "Adicionar cart\xE3o" })
122
+ ] })
123
+ ]
124
+ }
125
+ )
126
+ ]
127
+ }
128
+ ) });
129
+ }
130
+ export {
131
+ AddCardModal as default
132
+ };
133
+ //# sourceMappingURL=AddCardModal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/modals/cards/AddCardModal.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback } from 'react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../ui/overlay/Dialog';\nimport { Button } from '../../ui/buttons/Button';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { useModalManager } from '../../../store/useModalManager';\nimport { useCreateCard } from '../../../modules/cards/hooks/create-card.hook';\nimport { CardFormFields, cardFormSchema } from './CardFormFields';\nimport type { CardFormData } from './CardFormFields';\nimport { IconX } from '@tabler/icons-react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { CardNumberElement, useElements, useStripe } from '@stripe/react-stripe-js';\nimport { toast } from 'sonner';\n\nexport default function AddCardModal() {\n const { activeModal, modalData, closeModal } = useModalManager();\n const isOpen = activeModal === 'addCardModal';\n\n const onCardAdded = modalData.onCardAdded as ((cardId: string) => void) | undefined;\n\n const createCardMutation = useCreateCard();\n const elements = useElements();\n const stripe = useStripe();\n\n const form = useForm<CardFormData>({\n resolver: zodResolver(cardFormSchema),\n mode: 'onSubmit',\n reValidateMode: 'onChange',\n defaultValues: {\n country: 'BR',\n },\n });\n\n const handleClose = useCallback(() => {\n form.reset();\n closeModal();\n }, [form, closeModal]);\n\n async function handleSubmit(data: CardFormData) {\n if (!stripe || !elements) return;\n\n const cardElement = elements.getElement(CardNumberElement);\n if (!cardElement) return;\n\n const { error, paymentMethod } = await stripe.createPaymentMethod({\n type: 'card',\n card: cardElement,\n billing_details: {\n name: data.name,\n address: {\n country: data.country,\n postal_code: data.postalCode,\n },\n },\n });\n\n if (error) {\n toast.custom(\n (t) => (\n <Toast\n variant=\"error\"\n message=\"Não foi possível adicionar o cartão na Stripe, tente novamente.\"\n toastId={t}\n />\n ),\n { duration: 5000 }\n );\n return;\n }\n\n const result = await createCardMutation.mutateAsync(\n { payment_method_id: paymentMethod.id },\n {\n onError: () => {\n handleClose();\n toast.custom(\n (t) => (\n <Toast\n variant=\"error\"\n message=\"Não foi possível salvar o seu novo cartão, tente novamente.\"\n toastId={t}\n />\n ),\n { duration: 5000 }\n );\n },\n }\n );\n\n if (result.success && result.data?.id != null) {\n onCardAdded?.(result.data.id.toString());\n }\n\n toast.custom(\n (t) => <Toast variant=\"success\" message=\"Cartão adicionado com sucesso.\" toastId={t} />,\n { duration: 5000 }\n );\n handleClose();\n }\n\n const isSubmitting = createCardMutation.isPending || form.formState.isSubmitting;\n const isValid = form.formState.isValid;\n\n return (\n <Dialog open={isOpen} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\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-[470px] 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\"\n >\n <DialogHeader className=\"p-0\">\n <div className=\"flex items-center justify-center px-4 py-3 relative border-b border-zinc-200 lg:border-b-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950 text-center\">\n Adicionar cartão\n </DialogTitle>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n </DialogHeader>\n\n <form\n onSubmit={form.handleSubmit(handleSubmit)}\n className=\"flex flex-col flex-1 lg:flex-none\"\n >\n <div className=\"flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none\">\n <CardFormFields form={form} />\n </div>\n\n <div className=\"flex justify-between items-center p-4 lg:p-5 border-t border-zinc-200 gap-2 mt-auto lg:mt-0\">\n <Button variant=\"secondary\" type=\"button\" onClick={handleClose} className=\"h-10!\">\n Cancelar\n </Button>\n <Button type=\"submit\" className=\"h-10!\" disabled={isSubmitting || !isValid}>\n {isSubmitting ? 'Adicionando cartão...' : 'Adicionar cartão'}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA6DU,cAmDA,YAnDA;AA3DV,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,sBAAsB;AAE/C,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB,aAAa,iBAAiB;AAC1D,SAAS,aAAa;AAEP,SAAR,eAAgC;AACrC,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAC/D,QAAM,SAAS,gBAAgB;AAE/B,QAAM,cAAc,UAAU;AAE9B,QAAM,qBAAqB,cAAc;AACzC,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS,UAAU;AAEzB,QAAM,OAAO,QAAsB;AAAA,IACjC,UAAU,YAAY,cAAc;AAAA,IACpC,MAAM;AAAA,IACN,gBAAgB;AAAA,IAChB,eAAe;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AAED,QAAM,cAAc,YAAY,MAAM;AACpC,SAAK,MAAM;AACX,eAAW;AAAA,EACb,GAAG,CAAC,MAAM,UAAU,CAAC;AAErB,iBAAe,aAAa,MAAoB;AAC9C,QAAI,CAAC,UAAU,CAAC,SAAU;AAE1B,UAAM,cAAc,SAAS,WAAW,iBAAiB;AACzD,QAAI,CAAC,YAAa;A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tB,+BAAC,SAAI,WAAU,8FACb;AAAA,8BAAC,eAAY,WAAU,uDAAsD,iCAE7E;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,SAAS;AAAA,cAET,8BAAC,SAAM,MAAM,IAAI;AAAA;AAAA,UACnB;AAAA,WACF,GACF;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,KAAK,aAAa,YAAY;AAAA,YACxC,WAAU;AAAA,YAEV;AAAA,kCAAC,SAAI,WAAU,+DACb,8BAAC,kBAAe,MAAY,GAC9B;AAAA,cAEA,qBAAC,SAAI,WAAU,+FACb;AAAA,oCAAC,UAAO,SAAQ,aAAY,MAAK,UAAS,SAAS,aAAa,WAAU,SAAQ,sBAElF;AAAA,gBACA,oBAAC,UAAO,MAAK,UAAS,WAAU,SAAQ,UAAU,gBAAgB,CAAC,SAChE,yBAAe,6BAA0B,uBAC5C;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
@@ -0,0 +1,134 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { FormField } from "../../ui/form/FormField";
4
+ import { SelectField } from "../../ui/form/SelectField";
5
+ import { formatCPF, formatPostalCode } from "../../../utils/format/masks";
6
+ import z from "zod";
7
+ import { CardCvcElement, CardExpiryElement, CardNumberElement } from "@stripe/react-stripe-js";
8
+ const stripeElementOptions = {
9
+ style: {
10
+ base: {
11
+ fontSize: "16px",
12
+ color: "#030712",
13
+ fontFamily: "Inter, sans-serif",
14
+ "::placeholder": {
15
+ color: "#9ca3af"
16
+ }
17
+ }
18
+ }
19
+ };
20
+ const cardFormSchema = z.object({
21
+ name: z.string().min(1, "Nome \xE9 obrigat\xF3rio"),
22
+ number: z.string().min(1, "N\xFAmero do cart\xE3o \xE9 obrigat\xF3rio"),
23
+ expiry: z.string().min(1, "Data de validade \xE9 obrigat\xF3ria"),
24
+ cvv: z.string().min(1, "C\xF3digo de seguran\xE7a \xE9 obrigat\xF3rio"),
25
+ country: z.string().min(1, "Pa\xEDs \xE9 obrigat\xF3rio"),
26
+ postalCode: z.string().optional(),
27
+ cpf: z.string().min(14, "CPF \xE9 obrigat\xF3rio")
28
+ });
29
+ function CardFormFields({ form }) {
30
+ const {
31
+ register,
32
+ watch,
33
+ setValue,
34
+ formState: { errors }
35
+ } = form;
36
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
37
+ /* @__PURE__ */ jsx(
38
+ FormField,
39
+ {
40
+ label: "Nome impresso no cart\xE3o",
41
+ placeholder: "Digite aqui",
42
+ ...register("name"),
43
+ error: !!errors.name,
44
+ errorMessage: errors.name?.message
45
+ }
46
+ ),
47
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
48
+ /* @__PURE__ */ jsx("label", { className: "paragraph-xsmall-semibold text-zinc-600", children: "N\xFAmero do cart\xE3o" }),
49
+ /* @__PURE__ */ jsx("div", { className: "h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400 relative", children: /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
50
+ CardNumberElement,
51
+ {
52
+ options: { ...stripeElementOptions, showIcon: true },
53
+ onChange: (e) => setValue("number", e.complete ? "complete" : "", { shouldValidate: true })
54
+ }
55
+ ) }) }),
56
+ errors.number && /* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-semibold text-red-600", children: errors.number.message })
57
+ ] }),
58
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
59
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-1.5", children: [
60
+ /* @__PURE__ */ jsx("label", { className: "paragraph-xsmall-semibold text-zinc-600", children: "Data de validade" }),
61
+ /* @__PURE__ */ jsx("div", { className: "h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400", children: /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
62
+ CardExpiryElement,
63
+ {
64
+ options: stripeElementOptions,
65
+ onChange: (e) => setValue("expiry", e.complete ? "complete" : "", { shouldValidate: true })
66
+ }
67
+ ) }) }),
68
+ errors.expiry && /* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-semibold text-red-600", children: errors.expiry.message })
69
+ ] }),
70
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-1.5", children: [
71
+ /* @__PURE__ */ jsx("label", { className: "paragraph-xsmall-semibold text-zinc-600", children: "CVC" }),
72
+ /* @__PURE__ */ jsx("div", { className: "h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400", children: /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsx(
73
+ CardCvcElement,
74
+ {
75
+ options: stripeElementOptions,
76
+ onChange: (e) => setValue("cvv", e.complete ? "complete" : "", { shouldValidate: true })
77
+ }
78
+ ) }) }),
79
+ errors.cvv && /* @__PURE__ */ jsx("p", { className: "paragraph-xsmall-semibold text-red-600", children: errors.cvv.message })
80
+ ] })
81
+ ] }),
82
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
83
+ /* @__PURE__ */ jsx(
84
+ SelectField,
85
+ {
86
+ label: "Pa\xEDs",
87
+ placeholder: "Selecione",
88
+ value: watch("country"),
89
+ onChange: (value) => setValue("country", value),
90
+ options: [
91
+ { value: "BR", label: "Brasil" },
92
+ { value: "ES", label: "Espanha" },
93
+ { value: "US", label: "Estados Unidos" }
94
+ ],
95
+ containerClassName: "flex-1"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
99
+ FormField,
100
+ {
101
+ label: "C\xF3digo postal",
102
+ optional: true,
103
+ placeholder: "",
104
+ ...register("postalCode", {
105
+ onChange: (e) => {
106
+ setValue("postalCode", formatPostalCode(e.target.value));
107
+ }
108
+ }),
109
+ error: !!errors.postalCode,
110
+ errorMessage: errors.postalCode?.message
111
+ }
112
+ ) })
113
+ ] }),
114
+ /* @__PURE__ */ jsx(
115
+ FormField,
116
+ {
117
+ label: "CPF",
118
+ placeholder: "___.___.___-__",
119
+ ...register("cpf", {
120
+ onChange: (e) => {
121
+ setValue("cpf", formatCPF(e.target.value));
122
+ }
123
+ }),
124
+ error: !!errors.cpf,
125
+ errorMessage: errors.cpf?.message
126
+ }
127
+ )
128
+ ] });
129
+ }
130
+ export {
131
+ CardFormFields,
132
+ cardFormSchema
133
+ };
134
+ //# sourceMappingURL=CardFormFields.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/modals/cards/CardFormFields.tsx"],"sourcesContent":["'use client';\n\nimport { UseFormReturn } from 'react-hook-form';\nimport { FormField } from '../../ui/form/FormField';\nimport { SelectField } from '../../ui/form/SelectField';\nimport { formatCPF, formatPostalCode } from '../../../utils/format/masks';\nimport z from 'zod';\nimport { CardCvcElement, CardExpiryElement, CardNumberElement } from '@stripe/react-stripe-js';\n\nconst stripeElementOptions = {\n style: {\n base: {\n fontSize: '16px',\n color: '#030712',\n fontFamily: 'Inter, sans-serif',\n '::placeholder': {\n color: '#9ca3af',\n },\n },\n },\n};\n\nexport const cardFormSchema = z.object({\n name: z.string().min(1, 'Nome é obrigatório'),\n number: z.string().min(1, 'Número do cartão é obrigatório'),\n expiry: z.string().min(1, 'Data de validade é obrigatória'),\n cvv: z.string().min(1, 'Código de segurança é obrigatório'),\n country: z.string().min(1, 'País é obrigatório'),\n postalCode: z.string().optional(),\n cpf: z.string().min(14, 'CPF é obrigatório'),\n});\n\nexport type CardFormData = z.infer<typeof cardFormSchema>;\n\ntype CardFormFieldsProps = {\n readonly form: UseFormReturn<CardFormData>;\n};\n\nexport function CardFormFields({ form }: CardFormFieldsProps) {\n const {\n register,\n watch,\n setValue,\n formState: { errors },\n } = form;\n\n return (\n <div className=\"flex flex-col gap-5\">\n <FormField\n label=\"Nome impresso no cartão\"\n placeholder=\"Digite aqui\"\n {...register('name')}\n error={!!errors.name}\n errorMessage={errors.name?.message}\n />\n\n <div className=\"flex flex-col gap-1.5\">\n <label className=\"paragraph-xsmall-semibold text-zinc-600\">\n Número do cartão\n </label>\n <div className=\"h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400 relative\">\n <div className=\"w-full\">\n <CardNumberElement\n options={{ ...stripeElementOptions, showIcon: true }}\n onChange={(e) =>\n setValue('number', e.complete ? 'complete' : '', { shouldValidate: true })\n }\n />\n </div>\n </div>\n {errors.number && (\n <p className=\"paragraph-xsmall-semibold text-red-600\">{errors.number.message}</p>\n )}\n </div>\n\n <div className=\"flex gap-4\">\n <div className=\"flex-1 flex flex-col gap-1.5\">\n <label className=\"paragraph-xsmall-semibold text-zinc-600\">\n Data de validade\n </label>\n <div className=\"h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400\">\n <div className=\"w-full\">\n <CardExpiryElement\n options={stripeElementOptions}\n onChange={(e) =>\n setValue('expiry', e.complete ? 'complete' : '', { shouldValidate: true })\n }\n />\n </div>\n </div>\n {errors.expiry && (\n <p className=\"paragraph-xsmall-semibold text-red-600\">{errors.expiry.message}</p>\n )}\n </div>\n\n <div className=\"flex-1 flex flex-col gap-1.5\">\n <label className=\"paragraph-xsmall-semibold text-zinc-600\">\n CVC\n </label>\n <div className=\"h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400\">\n <div className=\"w-full\">\n <CardCvcElement\n options={stripeElementOptions}\n onChange={(e) =>\n setValue('cvv', e.complete ? 'complete' : '', { shouldValidate: true })\n }\n />\n </div>\n </div>\n {errors.cvv && (\n <p className=\"paragraph-xsmall-semibold text-red-600\">{errors.cvv.message}</p>\n )}\n </div>\n </div>\n\n <div className=\"flex gap-4\">\n <SelectField\n label=\"País\"\n placeholder=\"Selecione\"\n value={watch('country')}\n onChange={(value) => setValue('country', value as string)}\n options={[\n { value: 'BR', label: 'Brasil' },\n { value: 'ES', label: 'Espanha' },\n { value: 'US', label: 'Estados Unidos' },\n ]}\n containerClassName=\"flex-1\"\n />\n <div className=\"flex-1\">\n <FormField\n label=\"Código postal\"\n optional\n placeholder=\"\"\n {...register('postalCode', {\n onChange: (e) => {\n setValue('postalCode', formatPostalCode(e.target.value));\n },\n })}\n error={!!errors.postalCode}\n errorMessage={errors.postalCode?.message}\n />\n </div>\n </div>\n\n <FormField\n label=\"CPF\"\n placeholder=\"___.___.___-__\"\n {...register('cpf', {\n onChange: (e) => {\n setValue('cpf', formatCPF(e.target.value));\n },\n })}\n error={!!errors.cpf}\n errorMessage={errors.cpf?.message}\n />\n </div>\n );\n}\n"],"mappings":";AAgDM,cAQA,YARA;AA7CN,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,WAAW,wBAAwB;AAC5C,OAAO,OAAO;AACd,SAAS,gBAAgB,mBAAmB,yBAAyB;AAErE,MAAM,uBAAuB;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,iBAAiB;AAAA,QACf,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,0BAAoB;AAAA,EAC5C,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,4CAAgC;AAAA,EAC1D,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,sCAAgC;AAAA,EAC1D,KAAK,EAAE,OAAO,EAAE,IAAI,GAAG,+CAAmC;AAAA,EAC1D,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,6BAAoB;AAAA,EAC/C,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,K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OAAO,KAAK,CAAC;AAAA,UAC3C;AAAA,QACF,CAAC;AAAA,QACD,OAAO,CAAC,CAAC,OAAO;AAAA,QAChB,cAAc,OAAO,KAAK;AAAA;AAAA,IAC5B;AAAA,KACF;AAEJ;","names":[]}
package/dist/index.mjs CHANGED
@@ -31,6 +31,7 @@ import { useHasPlanAddon } from "./modules/plans/hooks/use-has-plan-addon.hook";
31
31
  import { useCalculateSubscription } from "./modules/subscriptions/hooks/calculate-subscription.hook";
32
32
  import { useUpdateSubscriptionPlan } from "./modules/subscriptions/hooks/update-subscription-plan.hook";
33
33
  import { useCards, CARDS_QUERY_KEY } from "./modules/cards/hooks/cards.hook";
34
+ import { useCreateCard } from "./modules/cards/hooks/create-card.hook";
34
35
  import { useIaCredits } from "./modules/ia-credits/hooks/ia-credits.hook";
35
36
  import {
36
37
  SubscriptionSchema,
@@ -38,11 +39,13 @@ import {
38
39
  } from "./modules/subscriptions/types/subscription.type";
39
40
  import { ADDON_IDS, AI_CREDIT_OPTIONS, AI_CREDIT_VALUES } from "./modules/subscriptions/constants/addons.constants";
40
41
  import { PlanSchema, PlanItemSchema } from "./modules/plans/types/plan.type";
41
- import { CardSchema } from "./modules/cards/types";
42
+ import { CardSchema, CreateCardRequestSchema } from "./modules/cards/types";
42
43
  import { buildPlanExtras } from "./modules/subscriptions/utils/build-plan-extras";
43
44
  import { getPriceFromCalculatedData, periodicityToBillingPeriod } from "./modules/subscriptions/utils/periodicity";
44
45
  import { useBuyCreditsModal } from "./store/useBuyCreditsModal";
45
46
  import { default as default2 } from "./components/modals/BuyCreditsModal";
47
+ import { default as default3 } from "./components/modals/cards/AddCardModal";
48
+ import { CardFormFields, cardFormSchema } from "./components/modals/cards/CardFormFields";
46
49
  import { Skeleton } from "./components/ui/feedback/Skeleton";
47
50
  import { PaymentInfoCard } from "./components/ui/data-display/PaymentInfoCard";
48
51
  import { CardBrandIcon } from "./components/ui/data-display/CardBrandIcons";
@@ -66,20 +69,20 @@ import { AppNavBar } from "./components/layouts/AppNavBar";
66
69
  import { AppMobileNavBar } from "./components/layouts/AppMobileNavBar";
67
70
  import { SideBarNavigation } from "./components/layouts/SideBarNavigation";
68
71
  import { MdSideBarNavigation } from "./components/layouts/MdSideBarNavigation";
69
- import { default as default3 } from "./components/widgets/notifications/NotificationCard";
72
+ import { default as default4 } from "./components/widgets/notifications/NotificationCard";
70
73
  import { NotificationsPopover } from "./components/layouts/NotificationsPopover";
71
74
  import { NotificationPageContent } from "./components/pages/notifications/Notifications";
72
75
  import { UsersSelectorPopover } from "./components/layouts/UsersSelectorPopover";
73
76
  import { ProfilePopover } from "./components/layouts/ProfilePopover";
74
- import { default as default4 } from "./components/layouts/WhitelabelCodes";
77
+ import { default as default5 } from "./components/layouts/WhitelabelCodes";
75
78
  import { NavBarItem } from "./components/layouts/NavBarItem";
76
79
  import { AppNavigation } from "./components/navigation/AppNavigation";
77
80
  import { CancelledSubscriptionBanner } from "./components/navigation/CancelledSubscriptionBanner";
78
81
  import { useMobileNavbarSheet } from "./store/useMobileNavbarSheet";
79
- import { default as default5 } from "./hooks/copy-to-clipboard.hook";
82
+ import { default as default6 } from "./hooks/copy-to-clipboard.hook";
80
83
  import { Button, buttonVariants } from "./components/ui/buttons/Button";
81
84
  import { CopyButton } from "./components/ui/buttons/CopyButton";
82
- import { default as default6 } from "./components/ui/buttons/CancelButton";
85
+ import { default as default7 } from "./components/ui/buttons/CancelButton";
83
86
  import {
84
87
  Accordion,
85
88
  AccordionItem,
@@ -124,8 +127,8 @@ import {
124
127
  TabsContent
125
128
  } from "./components/ui/data-display/Tabs";
126
129
  import { UserAvatar } from "./components/ui/data-display/UserAvatar";
127
- import { default as default7 } from "./components/ui/feedback/CircularProgress";
128
- import { default as default8 } from "./components/ui/feedback/DefaultCircularProgress";
130
+ import { default as default8 } from "./components/ui/feedback/CircularProgress";
131
+ import { default as default9 } from "./components/ui/feedback/DefaultCircularProgress";
129
132
  import { Progress } from "./components/ui/feedback/Progress";
130
133
  import { LoadingOverlay } from "./components/ui/feedback/LoadingOverlay";
131
134
  import {
@@ -209,9 +212,9 @@ import { CrispEmbed, openCrispHelpdesk, hideCrisp, showCrisp } from "./component
209
212
  import { useMdSidebarStore } from "./store/useMdSidebarStore";
210
213
  import { useModalManager } from "./store/useModalManager";
211
214
  import { AccountSectionType } from "./enums/AccountSectionType";
212
- import { default as default9 } from "./hooks/usePasswordVisibility";
213
- import { default as default10 } from "./hooks/useCountdownTimer";
214
- import { default as default11 } from "./hooks/useIsMobile";
215
+ import { default as default10 } from "./hooks/usePasswordVisibility";
216
+ import { default as default11 } from "./hooks/useCountdownTimer";
217
+ import { default as default12 } from "./hooks/useIsMobile";
215
218
  import { useDebounce } from "./hooks/useDebounce";
216
219
  import { useDebouncedEffect } from "./hooks/useDebouncedEffect";
217
220
  import { useDebounceState } from "./hooks/useDebounceState";
@@ -230,8 +233,8 @@ import { copyToClipboard, readFromClipboard } from "./utils/browser/clipboard";
230
233
  import { FormField } from "./components/ui/form/FormField";
231
234
  import { SelectField } from "./components/ui/form/SelectField";
232
235
  import { ComboboxField } from "./components/ui/form/ComboboxField";
233
- import { default as default12 } from "./components/ui/form/PhoneInput";
234
- import { default as default13 } from "./components/ui/form/SwitchOptionFieldWithIcon";
236
+ import { default as default13 } from "./components/ui/form/PhoneInput";
237
+ import { default as default14 } from "./components/ui/form/SwitchOptionFieldWithIcon";
235
238
  import { TextAreaField } from "./components/ui/form/TextAreaField";
236
239
  import {
237
240
  useCurrentAccount,
@@ -244,13 +247,13 @@ import {
244
247
  useDeleteAccountUser,
245
248
  useDeleteAccount
246
249
  } from "./modules/accounts/hooks/useAccountManagement";
247
- import { default as default14 } from "./components/account/AccountModals";
250
+ import { default as default15 } from "./components/account/AccountModals";
248
251
  import { useAccountModals } from "./store/useAccountModals";
249
252
  import { ModalManager } from "./components/modals/ModalManager";
250
253
  import { Modals } from "./components/modals/Modals";
251
- import { default as default15 } from "./components/account/TwoFactorAuthModal";
252
- import { default as default16 } from "./components/account/DisableTwoFactorAuthModal";
253
- import { default as default17 } from "./components/account/ConfirmGlobalPreferencesModal";
254
+ import { default as default16 } from "./components/account/TwoFactorAuthModal";
255
+ import { default as default17 } from "./components/account/DisableTwoFactorAuthModal";
256
+ import { default as default18 } from "./components/account/ConfirmGlobalPreferencesModal";
254
257
  import { MyProfileSection } from "./components/account/sections/MyProfileSection";
255
258
  import { PreferencesSection } from "./components/account/sections/PreferencesSection";
256
259
  import { SecuritySection } from "./components/account/sections/SecuritySection";
@@ -273,8 +276,9 @@ export {
273
276
  AccordionContent,
274
277
  AccordionItem,
275
278
  AccordionTrigger,
276
- default14 as AccountModals,
279
+ default15 as AccountModals,
277
280
  AccountSectionType,
281
+ default3 as AddCardModal,
278
282
  AppMobileNavBar,
279
283
  AppNavBar,
280
284
  AppNavigation,
@@ -285,7 +289,7 @@ export {
285
289
  CURRENCY_OPTIONS,
286
290
  Calendar,
287
291
  CalendarDayButton,
288
- default6 as CancelButton,
292
+ default7 as CancelButton,
289
293
  CancelledSubscriptionBanner,
290
294
  Card,
291
295
  CardAction,
@@ -293,6 +297,7 @@ export {
293
297
  CardContent,
294
298
  CardDescription,
295
299
  CardFooter,
300
+ CardFormFields,
296
301
  CardHeader,
297
302
  CardItem,
298
303
  CardTitle,
@@ -300,7 +305,7 @@ export {
300
305
  ChangePasswordSection,
301
306
  ChangePhoneModal,
302
307
  Checkbox,
303
- default7 as CircularProgress,
308
+ default8 as CircularProgress,
304
309
  ComboboxField,
305
310
  Command,
306
311
  CommandDialog,
@@ -311,12 +316,13 @@ export {
311
316
  CommandList,
312
317
  CommandSeparator,
313
318
  CommandShortcut,
314
- default17 as ConfirmGlobalPreferencesModal,
319
+ default18 as ConfirmGlobalPreferencesModal,
315
320
  CopyButton,
321
+ CreateCardRequestSchema,
316
322
  CrispEmbed,
317
323
  DatePicker,
318
324
  DateRangePicker,
319
- default8 as DefaultCircularProgress,
325
+ default9 as DefaultCircularProgress,
320
326
  Dialog,
321
327
  DialogClose,
322
328
  DialogContent,
@@ -327,7 +333,7 @@ export {
327
333
  DialogPortal,
328
334
  DialogTitle,
329
335
  DialogTrigger,
330
- default16 as DisableTwoFactorAuthModal,
336
+ default17 as DisableTwoFactorAuthModal,
331
337
  FormField,
332
338
  FrillEmbed,
333
339
  GENDER_OPTIONS,
@@ -354,7 +360,7 @@ export {
354
360
  NOTIFICATION_TYPES,
355
361
  NavBar,
356
362
  NavBarItem,
357
- default3 as NotificationCard,
363
+ default4 as NotificationCard,
358
364
  NotificationPageContent,
359
365
  NotificationsPopover,
360
366
  Pagination,
@@ -366,7 +372,7 @@ export {
366
372
  PaginationPrevious,
367
373
  CardSchema as PaymentCardSchema,
368
374
  PaymentInfoCard,
369
- default12 as PhoneInput,
375
+ default13 as PhoneInput,
370
376
  PlanItemSchema,
371
377
  PlanSchema,
372
378
  Popover,
@@ -408,7 +414,7 @@ export {
408
414
  SubscriptionItemSchema,
409
415
  SubscriptionSchema,
410
416
  Switch,
411
- default13 as SwitchOptionFieldWithIcon,
417
+ default14 as SwitchOptionFieldWithIcon,
412
418
  TIME_FORMAT_OPTIONS,
413
419
  Table,
414
420
  TableBody,
@@ -429,16 +435,17 @@ export {
429
435
  TooltipContent,
430
436
  TooltipProvider,
431
437
  TooltipTrigger,
432
- default15 as TwoFactorAuthModal,
438
+ default16 as TwoFactorAuthModal,
433
439
  USER_QUERY_KEY,
434
440
  UserAvatar,
435
441
  UsersSelectorPopover,
436
- default4 as WhitelabelCodes,
442
+ default5 as WhitelabelCodes,
437
443
  badgeVariants,
438
444
  buildLocaleOptions,
439
445
  buildPlanExtras,
440
446
  buildQueryParams,
441
447
  buttonVariants,
448
+ cardFormSchema,
442
449
  cn,
443
450
  continueChain,
444
451
  copyToClipboard,
@@ -465,8 +472,9 @@ export {
465
472
  useBuyCreditsModal,
466
473
  useCalculateSubscription,
467
474
  useCards,
468
- default5 as useCopyToClipboard,
469
- default10 as useCountdownTimer,
475
+ default6 as useCopyToClipboard,
476
+ default11 as useCountdownTimer,
477
+ useCreateCard,
470
478
  useCurrentAccount,
471
479
  useDebounce,
472
480
  useDebounceState,
@@ -476,13 +484,13 @@ export {
476
484
  useHasPlanAddon,
477
485
  useIaCredits,
478
486
  useInvalidateUser,
479
- default11 as useIsMobile,
487
+ default12 as useIsMobile,
480
488
  useListAvailableUsers,
481
489
  useListProjectUsers,
482
490
  useMdSidebarStore,
483
491
  useMobileNavbarSheet,
484
492
  useModalManager,
485
- default9 as usePasswordVisibility,
493
+ default10 as usePasswordVisibility,
486
494
  usePlanById,
487
495
  useSetUserData,
488
496
  useSubscriptions,