@greatapps/common 1.1.332 → 1.1.334

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.
@@ -1,62 +1,30 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { IconLock, IconSettings2, IconUser, IconX } from "@tabler/icons-react";
3
+ import { IconX } from "@tabler/icons-react";
4
4
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
5
- import { Tabs, TabsList, TabsTrigger, TabsContent } from "../ui/data-display/Tabs";
6
5
  import { cn } from "../../infra/utils/clsx";
7
- import { AccountSectionType } from "../../enums/AccountSectionType";
8
- import { MyProfileSection } from "./sections/MyProfileSection";
9
6
  import { PreferencesSection } from "./sections/PreferencesSection";
10
- import { ChangePasswordSection } from "./sections/ChangePasswordSection";
11
- import { SecuritySection } from "./sections/SecuritySection";
12
- import useConfigurationsModal from "./hooks/useConfigurationsModal";
13
7
  import useIsMobile from "../../hooks/useIsMobile";
14
8
  import { useAccountModals } from "../../store/useAccountModals";
15
9
  function ConfigurationsMyAccountModal() {
16
- const {
17
- activeModal,
18
- config,
19
- initialSection,
20
- openDeleteAccount,
21
- openIsntPossibleDelete,
22
- close
23
- } = useAccountModals();
10
+ const { activeModal, close } = useAccountModals();
24
11
  const open = activeModal === "configurations";
25
- const { hasActiveSubscription } = config;
26
12
  const isMobile = useIsMobile();
27
- const { activeSection, setActiveSection } = useConfigurationsModal({
28
- isOpen: open,
29
- initialSection
30
- });
31
- const handleDeleteAccount = () => {
32
- close();
33
- if (hasActiveSubscription) {
34
- openIsntPossibleDelete();
35
- } else {
36
- openDeleteAccount();
37
- }
38
- };
39
- const tabTriggerClasses = cn(
40
- "border-0! px-0 py-0",
41
- "lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full",
42
- "lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0",
43
- "lg:data-[state=active]:bg-gray-50",
44
- "flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap",
45
- "border-b-2 border-transparent",
46
- "data-[state=active]:bg-gray-50 rounded-lg",
47
- "text-gray-500 data-[state=active]:text-gray-950",
48
- "hover:text-gray-900 transition-colors"
49
- );
50
13
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs(
51
14
  DialogContent,
52
15
  {
53
16
  showCloseButton: !isMobile,
54
17
  overlayClassName: "bg-black/20 lg:bg-black/50",
55
- className: "\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]",
18
+ className: cn(
19
+ "flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0",
20
+ "rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0",
21
+ "lg:w-[700px] lg:max-w-[700px] lg:h-auto lg:rounded-lg lg:border",
22
+ "lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]"
23
+ ),
56
24
  children: [
57
- /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Configura\xE7\xF5es" }) }),
25
+ /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Prefer\xEAncias" }) }),
58
26
  /* @__PURE__ */ jsxs("div", { className: "md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200", children: [
59
- /* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: "Configura\xE7\xF5es" }),
27
+ /* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: "Prefer\xEAncias" }),
60
28
  /* @__PURE__ */ jsx(
61
29
  "button",
62
30
  {
@@ -67,60 +35,7 @@ function ConfigurationsMyAccountModal() {
67
35
  }
68
36
  )
69
37
  ] }),
70
- /* @__PURE__ */ jsxs(
71
- Tabs,
72
- {
73
- value: activeSection,
74
- onValueChange: (value) => setActiveSection(value),
75
- orientation: "vertical",
76
- className: "flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0",
77
- children: [
78
- /* @__PURE__ */ jsxs(
79
- TabsList,
80
- {
81
- className: cn(
82
- "flex gap-0 bg-transparent border-b-0",
83
- "lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60",
84
- "lg:border-r lg:border-gray-200 lg:pl-5 lg:pr-5 lg:pt-5 lg:gap-5 lg:overflow-x-visible lg:self-stretch",
85
- "flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0",
86
- "px-4 py-3",
87
- "[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]"
88
- ),
89
- children: [
90
- /* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children: "Configura\xE7\xF5es" }),
91
- /* @__PURE__ */ jsxs("div", { className: "lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full", children: [
92
- /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.MY_PROFILE, className: tabTriggerClasses, children: [
93
- /* @__PURE__ */ jsx(IconUser, { size: 20, className: "shrink-0" }),
94
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Meu perfil" })
95
- ] }),
96
- /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.PREFERENCES, className: tabTriggerClasses, children: [
97
- /* @__PURE__ */ jsx(IconSettings2, { size: 20, className: "shrink-0" }),
98
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Prefer\xEAncias" })
99
- ] }),
100
- /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.SECURITY, className: tabTriggerClasses, children: [
101
- /* @__PURE__ */ jsx(IconLock, { size: 20, className: "shrink-0" }),
102
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Seguran\xE7a" })
103
- ] })
104
- ] })
105
- ]
106
- }
107
- ),
108
- /* @__PURE__ */ jsxs("div", { className: "w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative flex flex-col", children: [
109
- /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.MY_PROFILE, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(MyProfileSection, { onClose: close }) }),
110
- /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.SECURITY, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(
111
- SecuritySection,
112
- {
113
- setActiveSection,
114
- onClose: close,
115
- onDeleteAccount: handleDeleteAccount
116
- }
117
- ) }),
118
- /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.CHANGE_PASSWORD, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(ChangePasswordSection, { onBack: () => setActiveSection(AccountSectionType.SECURITY) }) }),
119
- /* @__PURE__ */ jsx(TabsContent, { value: AccountSectionType.PREFERENCES, className: "h-full! relative overflow-hidden", children: /* @__PURE__ */ jsx(PreferencesSection, { onClose: close }) })
120
- ] })
121
- ]
122
- }
123
- )
38
+ /* @__PURE__ */ jsx(PreferencesSection, { onClose: close })
124
39
  ]
125
40
  }
126
41
  ) });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconLock, IconSettings2, IconUser, IconX } from '@tabler/icons-react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/data-display/Tabs';\nimport { Button } from '../ui/buttons/Button';\nimport { cn } from '../../infra/utils/clsx';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\nimport { MyProfileSection } from './sections/MyProfileSection';\nimport { PreferencesSection } from './sections/PreferencesSection';\nimport { ChangePasswordSection } from './sections/ChangePasswordSection';\nimport { SecuritySection } from './sections/SecuritySection';\nimport useConfigurationsModal from './hooks/useConfigurationsModal';\nimport useIsMobile from '../../hooks/useIsMobile';\nimport { useAccountModals } from '../../store/useAccountModals';\n\nexport default function ConfigurationsMyAccountModal() {\n const {\n activeModal,\n config,\n initialSection,\n openDeleteAccount,\n openIsntPossibleDelete,\n close,\n } = useAccountModals();\n\n const open = activeModal === 'configurations';\n const { hasActiveSubscription } = config;\n\n const isMobile = useIsMobile();\n const { activeSection, setActiveSection } = useConfigurationsModal({\n isOpen: open,\n initialSection,\n });\n\n const handleDeleteAccount = () => {\n close();\n if (hasActiveSubscription) {\n openIsntPossibleDelete();\n } else {\n openDeleteAccount();\n }\n };\n\n const tabTriggerClasses = cn(\n 'border-0! px-0 py-0',\n\n 'lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full',\n 'lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0',\n 'lg:data-[state=active]:bg-gray-50',\n\n 'flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap',\n 'border-b-2 border-transparent',\n 'data-[state=active]:bg-gray-50 rounded-lg',\n\n 'text-gray-500 data-[state=active]:text-gray-950',\n 'hover:text-gray-900 transition-colors'\n );\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent\n showCloseButton={!isMobile}\n overlayClassName=\"bg-black/20 lg:bg-black/50\"\n className=\"\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Configurações</DialogTitle>\n </DialogHeader>\n <div className=\"md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200\">\n <span className=\"text-gray-950 paragraph-medium-semibold\">Configurações</span>\n <button\n type=\"button\"\n className=\"size-8 flex items-center justify-center text-gray-500 cursor-pointer\"\n onClick={close}\n >\n <IconX size={18} />\n </button>\n </div>\n <Tabs\n value={activeSection}\n onValueChange={(value) => setActiveSection(value as AccountSectionType)}\n orientation=\"vertical\"\n className=\"flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0\"\n >\n <TabsList\n className={cn(\n 'flex gap-0 bg-transparent border-b-0',\n\n 'lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60',\n 'lg:border-r lg:border-gray-200 lg:pl-5 lg:pr-5 lg:pt-5 lg:gap-5 lg:overflow-x-visible lg:self-stretch',\n\n 'flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0',\n 'px-4 py-3',\n '[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]'\n )}\n >\n <span className=\"hidden lg:block paragraph-medium-semibold text-gray-950 mb-0\">\n Configurações\n </span>\n\n <div className=\"lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full\">\n <TabsTrigger value={AccountSectionType.MY_PROFILE} className={tabTriggerClasses}>\n <IconUser size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Meu perfil</span>\n </TabsTrigger>\n\n <TabsTrigger value={AccountSectionType.PREFERENCES} className={tabTriggerClasses}>\n <IconSettings2 size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Preferências</span>\n </TabsTrigger>\n\n <TabsTrigger value={AccountSectionType.SECURITY} className={tabTriggerClasses}>\n <IconLock size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Segurança</span>\n </TabsTrigger>\n </div>\n </TabsList>\n\n <div className=\"w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative flex flex-col\">\n <TabsContent value={AccountSectionType.MY_PROFILE} className=\"h-full! relative overflow-hidden\">\n <MyProfileSection onClose={close} />\n </TabsContent>\n\n <TabsContent value={AccountSectionType.SECURITY} className=\"h-full! relative overflow-hidden\">\n <SecuritySection\n setActiveSection={setActiveSection}\n onClose={close}\n onDeleteAccount={handleDeleteAccount}\n />\n </TabsContent>\n\n <TabsContent value={AccountSectionType.CHANGE_PASSWORD} className=\"h-full! relative overflow-hidden\">\n <ChangePasswordSection onBack={() => setActiveSection(AccountSectionType.SECURITY)} />\n </TabsContent>\n\n <TabsContent value={AccountSectionType.PREFERENCES} className=\"h-full! relative overflow-hidden\">\n <PreferencesSection onClose={close} />\n </TabsContent>\n </div>\n </Tabs>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAuEU,cAEF,YAFE;AArEV,SAAS,UAAU,eAAe,UAAU,aAAa;AACzD,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,MAAM,UAAU,aAAa,mBAAmB;AAEzD,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,OAAO,4BAA4B;AACnC,OAAO,iBAAiB;AACxB,SAAS,wBAAwB;AAElB,SAAR,+BAAgD;AACrD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AAErB,QAAM,OAAO,gBAAgB;AAC7B,QAAM,EAAE,sBAAsB,IAAI;AAElC,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,eAAe,iBAAiB,IAAI,u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wBAAU;AAAA,yBACrD;AAAA,sBAEA,qBAAC,eAAY,OAAO,mBAAmB,aAAa,WAAW,mBAC7D;AAAA,4CAAC,iBAAc,MAAM,IAAI,WAAU,YAAW;AAAA,wBAC9C,oBAAC,UAAK,WAAU,0BAAyB,6BAAY;AAAA,yBACvD;AAAA,sBAEA,qBAAC,eAAY,OAAO,mBAAmB,UAAU,WAAW,mBAC1D;AAAA,4CAAC,YAAS,MAAM,IAAI,WAAU,YAAW;AAAA,wBACzC,oBAAC,UAAK,WAAU,0BAAyB,0BAAS;AAAA,yBACpD;AAAA,uBACF;AAAA;AAAA;AAAA,cACF;AAAA,cAEA,qBAAC,SAAI,WAAU,8FACb;AAAA,oCAAC,eAAY,OAAO,mBAAmB,YAAY,WAAU,oCAC3D,8BAAC,oBAAiB,SAAS,OAAO,GACpC;AAAA,gBAEA,oBAAC,eAAY,OAAO,mBAAmB,UAAU,WAAU,oCACzD;AAAA,kBAAC;AAAA;AAAA,oBACC;AAAA,oBACA,SAAS;AAAA,oBACT,iBAAiB;AAAA;AAAA,gBACnB,GACF;AAAA,gBAEA,oBAAC,eAAY,OAAO,mBAAmB,iBAAiB,WAAU,oCAChE,8BAAC,yBAAsB,QAAQ,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG,GACtF;AAAA,gBAEA,oBAAC,eAAY,OAAO,mBAAmB,aAAa,WAAU,oCAC5D,8BAAC,sBAAmB,SAAS,OAAO,GACtC;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconX } from '@tabler/icons-react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { cn } from '../../infra/utils/clsx';\nimport { PreferencesSection } from './sections/PreferencesSection';\nimport useIsMobile from '../../hooks/useIsMobile';\nimport { useAccountModals } from '../../store/useAccountModals';\n\nexport default function ConfigurationsMyAccountModal() {\n const { activeModal, close } = useAccountModals();\n\n const open = activeModal === 'configurations';\n const isMobile = useIsMobile();\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent\n showCloseButton={!isMobile}\n overlayClassName=\"bg-black/20 lg:bg-black/50\"\n className={cn(\n \"flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\",\n \"rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\",\n \"lg:w-[700px] lg:max-w-[700px] lg:h-auto lg:rounded-lg lg:border\",\n \"lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n )}\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Preferências</DialogTitle>\n </DialogHeader>\n <div className=\"md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200\">\n <span className=\"text-gray-950 paragraph-medium-semibold\">Preferências</span>\n <button\n type=\"button\"\n className=\"size-8 flex items-center justify-center text-gray-500 cursor-pointer\"\n onClick={close}\n >\n <IconX size={18} />\n </button>\n </div>\n <PreferencesSection onClose={close} />\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA4BU,cAEF,YAFE;AA1BV,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,OAAO,iBAAiB;AACxB,SAAS,wBAAwB;AAElB,SAAR,+BAAgD;AACrD,QAAM,EAAE,aAAa,MAAM,IAAI,iBAAiB;AAEhD,QAAM,OAAO,gBAAgB;AAC7B,QAAM,WAAW,YAAY;AAE7B,SACE,oBAAC,UAAO,MAAY,cAAc,OAChC;AAAA,IAAC;AAAA;AAAA,MACC,iBAAiB,CAAC;AAAA,MAClB,kBAAiB;AAAA,MACjB,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,4BAAC,gBAAa,WAAU,WACtB,8BAAC,eAAY,6BAAY,GAC3B;AAAA,QACA,qBAAC,SAAI,WAAU,kFACb;AAAA,8BAAC,UAAK,WAAU,2CAA0C,6BAAY;AAAA,UACtE;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,cAET,8BAAC,SAAM,MAAM,IAAI;AAAA;AAAA,UACnB;AAAA,WACF;AAAA,QACA,oBAAC,sBAAmB,SAAS,OAAO;AAAA;AAAA;AAAA,EACtC,GACF;AAEJ;","names":[]}
@@ -3,13 +3,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState, useEffect } from "react";
4
4
  import { useForm } from "react-hook-form";
5
5
  import { toast } from "sonner";
6
- import { IconLock, IconMail, IconMessageCircle } from "@tabler/icons-react";
6
+ import { IconLock } from "@tabler/icons-react";
7
7
  import { Button } from "../../ui/buttons/Button";
8
8
  import { Separator } from "../../ui/data-display/Separator";
9
9
  import { Toast } from "../../ui/feedback/Toast";
10
10
  import { ComboboxField } from "../../ui/form/ComboboxField";
11
11
  import { SelectField } from "../../ui/form/SelectField";
12
- import SwitchOptionFieldWithIcon from "../../ui/form/SwitchOptionFieldWithIcon";
13
12
  import ConfirmGlobalPreferencesModal from "../ConfirmGlobalPreferencesModal";
14
13
  import { useAuth } from "../../../providers/auth.provider";
15
14
  import { UserProfile } from "../../../modules/users/schema";
@@ -19,8 +18,7 @@ import {
19
18
  } from "../../../modules/accounts/hooks/useAccountManagement";
20
19
  import {
21
20
  LANGUAGE_OPTIONS,
22
- TIME_FORMAT_OPTIONS,
23
- NOTIFICATION_TYPES
21
+ TIME_FORMAT_OPTIONS
24
22
  } from "../constants";
25
23
  import { useTimezones } from "../../../modules/accounts/hooks/useTimezones";
26
24
  import { useCurrencies } from "../../../modules/accounts/hooks/useCurrencies";
@@ -57,8 +55,6 @@ function PreferencesSection({ onClose }) {
57
55
  receive_email: user.receive_email ?? false
58
56
  });
59
57
  }, [user, account, reset]);
60
- const receiveSms = watch("receive_sms");
61
- const receiveEmail = watch("receive_email");
62
58
  const doSave = async (data, accountFields) => {
63
59
  setIsSaving(true);
64
60
  try {
@@ -112,8 +108,8 @@ function PreferencesSection({ onClose }) {
112
108
  setPendingSubmit(null);
113
109
  };
114
110
  return /* @__PURE__ */ jsxs(Fragment, { children: [
115
- /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "lg:h-full lg:flex lg:flex-col", children: [
116
- /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 overflow-y-auto overscroll-contain px-4 pb-36 lg:p-5 lg:static lg:flex-1 lg:min-h-0 lg:overscroll-auto flex flex-col gap-5 lg:gap-6", children: [
111
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "flex flex-col", children: [
112
+ /* @__PURE__ */ jsxs("div", { className: "overflow-y-auto overscroll-contain px-4 pb-4 lg:p-5 flex flex-col gap-5 lg:gap-6", children: [
117
113
  /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "Prefer\xEAncias" }),
118
114
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", children: [
119
115
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row items-center gap-3", children: [
@@ -177,46 +173,10 @@ function PreferencesSection({ onClose }) {
177
173
  }
178
174
  )
179
175
  ] })
180
- ] }),
181
- /* @__PURE__ */ jsx(Separator, {}),
182
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
183
- /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-600", children: "Notifica\xE7\xF5es" }),
184
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
185
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col border border-gray-200 rounded-lg", children: [
186
- /* @__PURE__ */ jsx(
187
- SwitchOptionFieldWithIcon,
188
- {
189
- icon: IconMessageCircle,
190
- label: "WhatsApp",
191
- description: "Receber notifica\xE7\xF5es importantes por WhatsApp",
192
- checked: receiveSms,
193
- onCheckedChange: (val) => setValue("receive_sms", val, { shouldDirty: true })
194
- }
195
- ),
196
- /* @__PURE__ */ jsx(
197
- SwitchOptionFieldWithIcon,
198
- {
199
- icon: IconMail,
200
- label: "E-mail",
201
- description: "Receber notifica\xE7\xF5es e atualiza\xE7\xF5es por email",
202
- checked: receiveEmail,
203
- onCheckedChange: (val) => setValue("receive_email", val, { shouldDirty: true }),
204
- hideBorderBottom: true
205
- }
206
- )
207
- ] }),
208
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 p-5 pb-6 rounded-lg bg-gray-50", children: [
209
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: "Tipos de notifica\xE7\xF5es incluem:" }),
210
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: NOTIFICATION_TYPES.map((type) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
211
- /* @__PURE__ */ jsx("div", { className: "size-1 rounded-full bg-gray-600" }),
212
- /* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-600", children: type })
213
- ] }, type)) })
214
- ] })
215
- ] })
216
176
  ] })
217
177
  ] })
218
178
  ] }),
219
- /* @__PURE__ */ jsxs("div", { className: "fixed bottom-0 left-0 right-0 lg:static flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white z-10", children: [
179
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white", children: [
220
180
  /* @__PURE__ */ jsx(
221
181
  Button,
222
182
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/account/sections/PreferencesSection.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { toast } from 'sonner';\nimport { IconLock, IconMail, IconMessageCircle } from '@tabler/icons-react';\nimport { Button } from '../../ui/buttons/Button';\nimport { Separator } from '../../ui/data-display/Separator';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { ComboboxField } from '../../ui/form/ComboboxField';\nimport { SelectField } from '../../ui/form/SelectField';\nimport SwitchOptionFieldWithIcon from '../../ui/form/SwitchOptionFieldWithIcon';\nimport ConfirmGlobalPreferencesModal from '../ConfirmGlobalPreferencesModal';\nimport { useAuth } from '../../../providers/auth.provider';\nimport { UserProfile } from '../../../modules/users/schema';\nimport type { UpdateAccountRequest } from '../../../modules/accounts/types';\nimport {\n useUpdateAccountUser,\n useUpdateAccount,\n} from '../../../modules/accounts/hooks/useAccountManagement';\nimport {\n LANGUAGE_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n} from '../constants';\nimport { useTimezones } from '../../../modules/accounts/hooks/useTimezones';\nimport { useCurrencies } from '../../../modules/accounts/hooks/useCurrencies';\n\ninterface PreferencesFormValues {\n language: string;\n currency: string;\n timezone: string;\n timeFormat: string;\n receive_sms: boolean;\n receive_email: boolean;\n}\n\ninterface PreferencesSectionProps {\n onClose: () => void;\n}\n\nexport function PreferencesSection({ onClose }: PreferencesSectionProps) {\n const { data: timezones = [] } = useTimezones();\n const { data: currencies = [] } = useCurrencies();\n const { user, account } = useAuth();\n const canEditPreferences =\n user?.profile === UserProfile.owner || user?.profile === UserProfile.admin;\n const updateAccountUser = useUpdateAccountUser();\n const updateAccount = useUpdateAccount();\n const [confirmGlobalOpen, setConfirmGlobalOpen] = useState(false);\n const [pendingSubmit, setPendingSubmit] = useState<{\n data: PreferencesFormValues;\n accountFields: UpdateAccountRequest;\n } | null>(null);\n const [isSaving, setIsSaving] = useState(false);\n\n const { watch, setValue, handleSubmit, reset, formState: { dirtyFields } } =\n useForm<PreferencesFormValues>({\n defaultValues: {\n language: '',\n currency: '',\n timezone: '',\n timeFormat: '24h',\n receive_sms: false,\n receive_email: false,\n },\n });\n\n useEffect(() => {\n if (!user || !account) return;\n reset({\n language: LANGUAGE_OPTIONS.find(\n (o) => o.apiValue === user.language?.toLowerCase()\n )?.value ?? 'pt-BR',\n currency: account.currency,\n timezone: account.timezone,\n timeFormat: '24h',\n receive_sms: user.receive_sms ?? false,\n receive_email: user.receive_email ?? false,\n });\n }, [user, account, reset]);\n\n const receiveSms = watch('receive_sms');\n const receiveEmail = watch('receive_email');\n\n const doSave = async (data: PreferencesFormValues, accountFields: UpdateAccountRequest) => {\n setIsSaving(true);\n try {\n const apiLanguage = LANGUAGE_OPTIONS.find((o) => o.value === data.language)?.apiValue ?? data.language.toLowerCase();\n await updateAccountUser.mutateAsync({\n language: apiLanguage,\n receive_sms: data.receive_sms,\n receive_email: data.receive_email,\n });\n\n if (canEditPreferences && Object.keys(accountFields).length > 0) {\n await updateAccount.mutateAsync(accountFields);\n }\n\n reset(data);\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Preferências salvas com sucesso\" toastId={t} />\n ));\n onClose();\n } catch (error) {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={error instanceof Error ? error.message : 'Erro ao salvar preferências'}\n toastId={t}\n />\n ));\n } finally {\n setIsSaving(false);\n }\n };\n\n const onSubmit = (data: PreferencesFormValues) => {\n const accountFields: UpdateAccountRequest = {\n ...(canEditPreferences && dirtyFields.currency && { currency: data.currency }),\n ...(canEditPreferences && dirtyFields.timezone && { timezone: data.timezone }),\n };\n const globalFieldChanged = Object.keys(accountFields).length > 0;\n\n if (globalFieldChanged) {\n setPendingSubmit({ data, accountFields });\n setConfirmGlobalOpen(true);\n } else {\n doSave(data, accountFields);\n }\n };\n\n const handleConfirmGlobal = () => {\n setConfirmGlobalOpen(false);\n if (pendingSubmit) {\n doSave(pendingSubmit.data, pendingSubmit.accountFields);\n setPendingSubmit(null);\n }\n };\n\n const handleCancelGlobal = () => {\n setConfirmGlobalOpen(false);\n setPendingSubmit(null);\n };\n\n return (\n <>\n <form onSubmit={handleSubmit(onSubmit)} className=\"lg:h-full lg:flex lg:flex-col\">\n <div className=\"absolute inset-0 overflow-y-auto overscroll-contain px-4 pb-36 lg:p-5 lg:static lg:flex-1 lg:min-h-0 lg:overscroll-auto flex flex-col gap-5 lg:gap-6\">\n <span className=\"paragraph-medium-semibold text-gray-950\">Preferências</span>\n <div className=\"flex flex-col gap-8\">\n <div className=\"flex flex-col lg:flex-row items-center gap-3\">\n <ComboboxField\n label=\"Idioma\"\n placeholder=\"Selecione o idioma\"\n searchPlaceholder=\"Buscar idioma...\"\n containerClassName=\"w-full\"\n options={LANGUAGE_OPTIONS}\n value={watch('language')}\n onChange={(value) => setValue('language', value, { shouldDirty: true })}\n />\n <ComboboxField\n label=\"Moeda\"\n placeholder=\"Selecione a moeda\"\n searchPlaceholder=\"Buscar moeda...\"\n containerClassName=\"w-full\"\n options={currencies}\n value={watch('currency')}\n onChange={(value) => setValue('currency', value, { shouldDirty: true })}\n icon={!canEditPreferences ? <IconLock className=\"size-4 text-gray-400\" /> : undefined}\n disabled={!canEditPreferences}\n />\n </div>\n\n <Separator />\n\n <div className=\"flex flex-col gap-4\">\n <span className=\"paragraph-medium-semibold text-gray-600\">Exibição hora</span>\n <div className=\"flex flex-col lg:flex-row items-center gap-3\">\n <ComboboxField\n label=\"Fuso horário\"\n placeholder=\"Selecione o fuso horário\"\n searchPlaceholder=\"Buscar fuso horário...\"\n containerClassName=\"w-full\"\n options={timezones}\n value={watch('timezone')}\n onChange={(value) => setValue('timezone', value, { shouldDirty: true })}\n icon={!canEditPreferences ? <IconLock className=\"size-4 text-gray-400\" /> : undefined}\n disabled={!canEditPreferences}\n />\n <SelectField\n label=\"Formato hora\"\n placeholder=\"Selecione o formato\"\n className=\"h-10!\"\n containerClassName=\"w-full\"\n options={TIME_FORMAT_OPTIONS}\n value={watch('timeFormat')}\n onChange={(value) =>\n setValue('timeFormat', value as string, { shouldDirty: true })\n }\n icon={<IconLock className=\"size-4 text-gray-400\" />}\n disabled\n />\n </div>\n </div>\n\n <Separator />\n\n <div className=\"flex flex-col gap-4\">\n <span className=\"paragraph-medium-semibold text-gray-600\">Notificações</span>\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex flex-col border border-gray-200 rounded-lg\">\n <SwitchOptionFieldWithIcon\n icon={IconMessageCircle}\n label=\"WhatsApp\"\n description=\"Receber notificações importantes por WhatsApp\"\n checked={receiveSms}\n onCheckedChange={(val: boolean) => setValue('receive_sms', val, { shouldDirty: true })}\n />\n <SwitchOptionFieldWithIcon\n icon={IconMail}\n label=\"E-mail\"\n description=\"Receber notificações e atualizações por email\"\n checked={receiveEmail}\n onCheckedChange={(val: boolean) => setValue('receive_email', val, { shouldDirty: true })}\n hideBorderBottom={true}\n />\n </div>\n <div className=\"flex flex-col gap-4 p-5 pb-6 rounded-lg bg-gray-50\">\n <span className=\"paragraph-small-semibold text-gray-950\">\n Tipos de notificações incluem:\n </span>\n <div className=\"flex flex-col\">\n {NOTIFICATION_TYPES.map((type) => (\n <div key={type} className=\"flex items-center gap-2\">\n <div className=\"size-1 rounded-full bg-gray-600\" />\n <span className=\"paragraph-small-medium text-gray-600\">{type}</span>\n </div>\n ))}\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"fixed bottom-0 left-0 right-0 lg:static flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white z-10\">\n <Button\n variant=\"secondary\"\n className=\"h-10!\"\n type=\"button\"\n disabled={isSaving}\n onClick={() => {\n reset();\n onClose();\n }}\n >\n Cancelar\n </Button>\n <Button className=\"h-10!\" type=\"submit\" disabled={isSaving}>\n {isSaving ? 'Salvando...' : 'Salvar alterações'}\n </Button>\n </div>\n </form>\n\n <ConfirmGlobalPreferencesModal\n open={confirmGlobalOpen}\n onConfirm={handleConfirmGlobal}\n onCancel={handleCancelGlobal}\n />\n </>\n );\n}\n"],"mappings":";AAqGQ,SA6CJ,UA7CI,KAkDI,YAlDJ;AAnGR,SAAS,UAAU,iBAAiB;AACpC,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,U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iB,SAAS,iBAAiB,KAAK,EAAE,aAAa,KAAK,CAAC;AAAA,oBACvF,kBAAkB;AAAA;AAAA,gBACpB;AAAA,iBACF;AAAA,cACA,qBAAC,SAAI,WAAU,sDACb;AAAA,oCAAC,UAAK,WAAU,0CAAyC,kDAEzD;AAAA,gBACA,oBAAC,SAAI,WAAU,iBACZ,6BAAmB,IAAI,CAAC,SACvB,qBAAC,SAAe,WAAU,2BACxB;AAAA,sCAAC,SAAI,WAAU,mCAAkC;AAAA,kBACjD,oBAAC,UAAK,WAAU,wCAAwC,gBAAK;AAAA,qBAFrD,IAGV,CACD,GACH;AAAA,iBACF;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,MAEA,qBAAC,SAAI,WAAU,sIACb;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,MAAK;AAAA,YACL,UAAU;AAAA,YACV,SAAS,MAAM;AACb,oBAAM;AACN,sBAAQ;AAAA,YACV;AAAA,YACD;AAAA;AAAA,QAED;AAAA,QACA,oBAAC,UAAO,WAAU,SAAQ,MAAK,UAAS,UAAU,UAC/C,qBAAW,gBAAgB,2BAC9B;AAAA,SACF;AAAA,OACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,WAAW;AAAA,QACX,UAAU;AAAA;AAAA,IACZ;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/account/sections/PreferencesSection.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { toast } from 'sonner';\nimport { IconLock } from '@tabler/icons-react';\nimport { Button } from '../../ui/buttons/Button';\nimport { Separator } from '../../ui/data-display/Separator';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { ComboboxField } from '../../ui/form/ComboboxField';\nimport { SelectField } from '../../ui/form/SelectField';\nimport ConfirmGlobalPreferencesModal from '../ConfirmGlobalPreferencesModal';\nimport { useAuth } from '../../../providers/auth.provider';\nimport { UserProfile } from '../../../modules/users/schema';\nimport type { UpdateAccountRequest } from '../../../modules/accounts/types';\nimport {\n useUpdateAccountUser,\n useUpdateAccount,\n} from '../../../modules/accounts/hooks/useAccountManagement';\nimport {\n LANGUAGE_OPTIONS,\n TIME_FORMAT_OPTIONS,\n} from '../constants';\nimport { useTimezones } from '../../../modules/accounts/hooks/useTimezones';\nimport { useCurrencies } from '../../../modules/accounts/hooks/useCurrencies';\n\ninterface PreferencesFormValues {\n language: string;\n currency: string;\n timezone: string;\n timeFormat: string;\n receive_sms: boolean;\n receive_email: boolean;\n}\n\ninterface PreferencesSectionProps {\n onClose: () => void;\n}\n\nexport function PreferencesSection({ onClose }: PreferencesSectionProps) {\n const { data: timezones = [] } = useTimezones();\n const { data: currencies = [] } = useCurrencies();\n const { user, account } = useAuth();\n const canEditPreferences =\n user?.profile === UserProfile.owner || user?.profile === UserProfile.admin;\n const updateAccountUser = useUpdateAccountUser();\n const updateAccount = useUpdateAccount();\n const [confirmGlobalOpen, setConfirmGlobalOpen] = useState(false);\n const [pendingSubmit, setPendingSubmit] = useState<{\n data: PreferencesFormValues;\n accountFields: UpdateAccountRequest;\n } | null>(null);\n const [isSaving, setIsSaving] = useState(false);\n\n const { watch, setValue, handleSubmit, reset, formState: { dirtyFields } } =\n useForm<PreferencesFormValues>({\n defaultValues: {\n language: '',\n currency: '',\n timezone: '',\n timeFormat: '24h',\n receive_sms: false,\n receive_email: false,\n },\n });\n\n useEffect(() => {\n if (!user || !account) return;\n reset({\n language: LANGUAGE_OPTIONS.find(\n (o) => o.apiValue === user.language?.toLowerCase()\n )?.value ?? 'pt-BR',\n currency: account.currency,\n timezone: account.timezone,\n timeFormat: '24h',\n receive_sms: user.receive_sms ?? false,\n receive_email: user.receive_email ?? false,\n });\n }, [user, account, reset]);\n\n const doSave = async (data: PreferencesFormValues, accountFields: UpdateAccountRequest) => {\n setIsSaving(true);\n try {\n const apiLanguage = LANGUAGE_OPTIONS.find((o) => o.value === data.language)?.apiValue ?? data.language.toLowerCase();\n await updateAccountUser.mutateAsync({\n language: apiLanguage,\n receive_sms: data.receive_sms,\n receive_email: data.receive_email,\n });\n\n if (canEditPreferences && Object.keys(accountFields).length > 0) {\n await updateAccount.mutateAsync(accountFields);\n }\n\n reset(data);\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Preferências salvas com sucesso\" toastId={t} />\n ));\n onClose();\n } catch (error) {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={error instanceof Error ? error.message : 'Erro ao salvar preferências'}\n toastId={t}\n />\n ));\n } finally {\n setIsSaving(false);\n }\n };\n\n const onSubmit = (data: PreferencesFormValues) => {\n const accountFields: UpdateAccountRequest = {\n ...(canEditPreferences && dirtyFields.currency && { currency: data.currency }),\n ...(canEditPreferences && dirtyFields.timezone && { timezone: data.timezone }),\n };\n const globalFieldChanged = Object.keys(accountFields).length > 0;\n\n if (globalFieldChanged) {\n setPendingSubmit({ data, accountFields });\n setConfirmGlobalOpen(true);\n } else {\n doSave(data, accountFields);\n }\n };\n\n const handleConfirmGlobal = () => {\n setConfirmGlobalOpen(false);\n if (pendingSubmit) {\n doSave(pendingSubmit.data, pendingSubmit.accountFields);\n setPendingSubmit(null);\n }\n };\n\n const handleCancelGlobal = () => {\n setConfirmGlobalOpen(false);\n setPendingSubmit(null);\n };\n\n return (\n <>\n <form onSubmit={handleSubmit(onSubmit)} className=\"flex flex-col\">\n <div className=\"overflow-y-auto overscroll-contain px-4 pb-4 lg:p-5 flex flex-col gap-5 lg:gap-6\">\n <span className=\"paragraph-medium-semibold text-gray-950\">Preferências</span>\n <div className=\"flex flex-col gap-8\">\n <div className=\"flex flex-col lg:flex-row items-center gap-3\">\n <ComboboxField\n label=\"Idioma\"\n placeholder=\"Selecione o idioma\"\n searchPlaceholder=\"Buscar idioma...\"\n containerClassName=\"w-full\"\n options={LANGUAGE_OPTIONS}\n value={watch('language')}\n onChange={(value) => setValue('language', value, { shouldDirty: true })}\n />\n <ComboboxField\n label=\"Moeda\"\n placeholder=\"Selecione a moeda\"\n searchPlaceholder=\"Buscar moeda...\"\n containerClassName=\"w-full\"\n options={currencies}\n value={watch('currency')}\n onChange={(value) => setValue('currency', value, { shouldDirty: true })}\n icon={!canEditPreferences ? <IconLock className=\"size-4 text-gray-400\" /> : undefined}\n disabled={!canEditPreferences}\n />\n </div>\n\n <Separator />\n\n <div className=\"flex flex-col gap-4\">\n <span className=\"paragraph-medium-semibold text-gray-600\">Exibição hora</span>\n <div className=\"flex flex-col lg:flex-row items-center gap-3\">\n <ComboboxField\n label=\"Fuso horário\"\n placeholder=\"Selecione o fuso horário\"\n searchPlaceholder=\"Buscar fuso horário...\"\n containerClassName=\"w-full\"\n options={timezones}\n value={watch('timezone')}\n onChange={(value) => setValue('timezone', value, { shouldDirty: true })}\n icon={!canEditPreferences ? <IconLock className=\"size-4 text-gray-400\" /> : undefined}\n disabled={!canEditPreferences}\n />\n <SelectField\n label=\"Formato hora\"\n placeholder=\"Selecione o formato\"\n className=\"h-10!\"\n containerClassName=\"w-full\"\n options={TIME_FORMAT_OPTIONS}\n value={watch('timeFormat')}\n onChange={(value) =>\n setValue('timeFormat', value as string, { shouldDirty: true })\n }\n icon={<IconLock className=\"size-4 text-gray-400\" />}\n disabled\n />\n </div>\n </div>\n\n </div>\n </div>\n\n <div className=\"flex items-center h-20 px-4 lg:px-5 border-t border-gray-200 justify-between bg-white\">\n <Button\n variant=\"secondary\"\n className=\"h-10!\"\n type=\"button\"\n disabled={isSaving}\n onClick={() => {\n reset();\n onClose();\n }}\n >\n Cancelar\n </Button>\n <Button className=\"h-10!\" type=\"submit\" disabled={isSaving}>\n {isSaving ? 'Salvando...' : 'Salvar alterações'}\n </Button>\n </div>\n </form>\n\n <ConfirmGlobalPreferencesModal\n open={confirmGlobalOpen}\n onConfirm={handleConfirmGlobal}\n onCancel={handleCancelGlobal}\n />\n </>\n );\n}\n"],"mappings":";AAgGQ,SA6CJ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@
1
1
  {
2
2
  "name": "@greatapps/common",
3
- "version": "1.1.332",
3
+ "version": "1.1.334",
4
4
  "description": "Shared library for GreatApps frontend applications",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -21,7 +21,7 @@ export default function ConfigurationsMyAccountModal() {
21
21
  className={cn(
22
22
  "flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0",
23
23
  "rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0",
24
- "lg:w-[700px] lg:max-w-[700px] lg:h-auto lg:rounded-lg lg:border",
24
+ "lg:w-[650px] lg:max-w-[650px] lg:h-auto lg:rounded-lg lg:border",
25
25
  "lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]"
26
26
  )}
27
27
  >
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { useState } from "react";
4
4
  import * as PopoverPrimitive from "@radix-ui/react-popover";
5
+ import { IconSettings2 } from "@tabler/icons-react";
5
6
  import { Popover } from "../ui/overlay/Popover";
6
7
  import { Progress } from "../ui/feedback/Progress";
7
8
  import { Separator } from "../ui/data-display/Separator";
@@ -12,6 +13,7 @@ import { useAuth } from "../../providers/auth.provider";
12
13
  import { cn } from "../../infra/utils/clsx";
13
14
  import { useIaCredits } from "../../modules/ia-credits/hooks/ia-credits.hook";
14
15
  import { useBuyCreditsModal } from "../../store/useBuyCreditsModal";
16
+ import { useAccountModals } from "../../store/useAccountModals";
15
17
 
16
18
  export interface ProfileMenuItem {
17
19
  icon?: React.ReactNode;
@@ -39,6 +41,7 @@ function ProfilePopover({
39
41
  const { summary, subscription, isSubscriptionLoading, isCreditsLoading } =
40
42
  useIaCredits();
41
43
  const { openModal: openBuyCreditsModal } = useBuyCreditsModal();
44
+ const { openConfigurations } = useAccountModals();
42
45
 
43
46
  const handleLogout = async () => {
44
47
  try {
@@ -133,18 +136,24 @@ function ProfilePopover({
133
136
  )}
134
137
 
135
138
  <div className="flex flex-col gap-2">
136
- {menuItems.length > 0 && (
137
- <div className="flex flex-col">
138
- {menuItems.map((item, index) => (
139
- <NavBarItem
140
- key={index}
141
- icon={item.icon}
142
- label={item.label}
143
- onClick={item.onClick}
144
- />
145
- ))}
146
- </div>
147
- )}
139
+ <div className="flex flex-col">
140
+ <NavBarItem
141
+ icon={<IconSettings2 size={20} />}
142
+ label="Preferências"
143
+ onClick={() => {
144
+ setPopoverOpen(false);
145
+ openConfigurations();
146
+ }}
147
+ />
148
+ {menuItems.map((item, index) => (
149
+ <NavBarItem
150
+ key={index}
151
+ icon={item.icon}
152
+ label={item.label}
153
+ onClick={item.onClick}
154
+ />
155
+ ))}
156
+ </div>
148
157
  <Separator />
149
158
  <NavBarItem label="Sair" onClick={handleLogout} />
150
159
  </div>