@greatapps/common 1.1.41 → 1.1.43

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,4 +1,3 @@
1
- import { buildTimezoneOptions } from "../../utils/intl/timezones";
2
1
  import { buildLocaleOptions } from "../../utils/intl/locales";
3
2
  const GENDER_OPTIONS = [
4
3
  { value: "masculino", label: "Masculino", apiValue: 1 },
@@ -10,7 +9,6 @@ const CURRENCY_OPTIONS = [
10
9
  { value: "USD", label: "USD ($)", displayValue: "USD ($)" },
11
10
  { value: "EUR", label: "EUR (\u20AC)", displayValue: "EUR (\u20AC)" }
12
11
  ];
13
- const TIMEZONE_OPTIONS = buildTimezoneOptions();
14
12
  const TIME_FORMAT_OPTIONS = [
15
13
  { value: "24h", label: "24 horas", displayValue: "24 horas" },
16
14
  { value: "12h", label: "12 horas (AM/PM)", displayValue: "12 horas (AM/PM)" }
@@ -26,7 +24,6 @@ export {
26
24
  GENDER_OPTIONS,
27
25
  LANGUAGE_OPTIONS,
28
26
  NOTIFICATION_TYPES,
29
- TIMEZONE_OPTIONS,
30
27
  TIME_FORMAT_OPTIONS
31
28
  };
32
29
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/constants.ts"],"sourcesContent":["import { buildTimezoneOptions } from '../../utils/intl/timezones';\r\nimport { buildLocaleOptions } from '../../utils/intl/locales';\r\n\r\nexport const GENDER_OPTIONS = [\r\n { value: 'masculino', label: 'Masculino', apiValue: 1 },\r\n { value: 'feminino', label: 'Feminino', apiValue: 0 },\r\n];\r\n\r\nexport const LANGUAGE_OPTIONS = buildLocaleOptions();\r\n\r\nexport const CURRENCY_OPTIONS = [\r\n { value: 'BRL', label: 'BRL (R$)', displayValue: 'BRL (R$)' },\r\n { value: 'USD', label: 'USD ($)', displayValue: 'USD ($)' },\r\n { value: 'EUR', label: 'EUR (€)', displayValue: 'EUR (€)' },\r\n];\r\n\r\nexport const TIMEZONE_OPTIONS = buildTimezoneOptions();\r\n\r\nexport const TIME_FORMAT_OPTIONS = [\r\n { value: '24h', label: '24 horas', displayValue: '24 horas' },\r\n { value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },\r\n];\r\n\r\nexport const NOTIFICATION_TYPES = [\r\n 'Atualizações de projetos',\r\n 'Alertas de segurança',\r\n 'Mudanças no plano ou faturamento',\r\n 'Manutenções programadas',\r\n];\r\n"],"mappings":"AAAA,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AAE5B,MAAM,iBAAiB;AAAA,EAC5B,EAAE,OAAO,aAAa,OAAO,aAAa,UAAU,EAAE;AAAA,EACtD,EAAE,OAAO,YAAY,OAAO,YAAY,UAAU,EAAE;AACtD;AAEO,MAAM,mBAAmB,mBAAmB;AAE5C,MAAM,mBAAmB;AAAA,EAC9B,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,WAAW,cAAc,UAAU;AAAA,EAC1D,EAAE,OAAO,OAAO,OAAO,gBAAW,cAAc,eAAU;AAC5D;AAEO,MAAM,mBAAmB,qBAAqB;AAE9C,MAAM,sBAAsB;AAAA,EACjC,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,oBAAoB,cAAc,mBAAmB;AAC9E;AAEO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/account/constants.ts"],"sourcesContent":["import { buildLocaleOptions } from '../../utils/intl/locales';\r\n\r\nexport const GENDER_OPTIONS = [\r\n { value: 'masculino', label: 'Masculino', apiValue: 1 },\r\n { value: 'feminino', label: 'Feminino', apiValue: 0 },\r\n];\r\n\r\nexport const LANGUAGE_OPTIONS = buildLocaleOptions();\r\n\r\nexport const CURRENCY_OPTIONS = [\r\n { value: 'BRL', label: 'BRL (R$)', displayValue: 'BRL (R$)' },\r\n { value: 'USD', label: 'USD ($)', displayValue: 'USD ($)' },\r\n { value: 'EUR', label: 'EUR (€)', displayValue: 'EUR (€)' },\r\n];\r\n\r\nexport const TIME_FORMAT_OPTIONS = [\r\n { value: '24h', label: '24 horas', displayValue: '24 horas' },\r\n { value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },\r\n];\r\n\r\nexport const NOTIFICATION_TYPES = [\r\n 'Atualizações de projetos',\r\n 'Alertas de segurança',\r\n 'Mudanças no plano ou faturamento',\r\n 'Manutenções programadas',\r\n];\r\n"],"mappings":"AAAA,SAAS,0BAA0B;AAE5B,MAAM,iBAAiB;AAAA,EAC5B,EAAE,OAAO,aAAa,OAAO,aAAa,UAAU,EAAE;AAAA,EACtD,EAAE,OAAO,YAAY,OAAO,YAAY,UAAU,EAAE;AACtD;AAEO,MAAM,mBAAmB,mBAAmB;AAE5C,MAAM,mBAAmB;AAAA,EAC9B,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,WAAW,cAAc,UAAU;AAAA,EAC1D,EAAE,OAAO,OAAO,OAAO,gBAAW,cAAc,eAAU;AAC5D;AAEO,MAAM,sBAAsB;AAAA,EACjC,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,oBAAoB,cAAc,mBAAmB;AAC9E;AAEO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
package/dist/index.mjs CHANGED
@@ -68,7 +68,7 @@ import { default as default5 } from "./hooks/usePasswordVisibility";
68
68
  import { default as default6 } from "./hooks/useCountdownTimer";
69
69
  import { default as default7 } from "./hooks/useIsMobile";
70
70
  import { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from "./utils/format/masks";
71
- import { buildTimezoneOptions, fetchTimezoneOptions } from "./utils/intl/timezones";
71
+ import { timezoneService } from "./modules/accounts/services/timezone.service";
72
72
  import { buildLocaleOptions, LANGUAGE_OPTIONS } from "./utils/intl/locales";
73
73
  import { copyToClipboard, readFromClipboard } from "./utils/browser/clipboard";
74
74
  import { FormField } from "./components/ui/form/FormField";
@@ -100,7 +100,6 @@ import { ChangePhoneModal } from "./components/account/sections/ChangePhoneModal
100
100
  import {
101
101
  GENDER_OPTIONS,
102
102
  CURRENCY_OPTIONS,
103
- TIMEZONE_OPTIONS,
104
103
  TIME_FORMAT_OPTIONS,
105
104
  NOTIFICATION_TYPES,
106
105
  LANGUAGE_OPTIONS as LANGUAGE_OPTIONS2
@@ -229,7 +228,6 @@ export {
229
228
  SubscriptionSchema,
230
229
  Switch,
231
230
  default9 as SwitchOptionFieldWithIcon,
232
- TIMEZONE_OPTIONS,
233
231
  TIME_FORMAT_OPTIONS,
234
232
  Table,
235
233
  TableBody,
@@ -257,14 +255,12 @@ export {
257
255
  badgeVariants,
258
256
  buildLocaleOptions,
259
257
  buildQueryParams,
260
- buildTimezoneOptions,
261
258
  buttonVariants,
262
259
  cn,
263
260
  continueChain,
264
261
  copyToClipboard,
265
262
  createAuthMiddleware,
266
263
  createMiddlewareChain,
267
- fetchTimezoneOptions,
268
264
  formatCPF,
269
265
  formatCardNumber,
270
266
  formatFullName,
@@ -274,6 +270,7 @@ export {
274
270
  parseSchema,
275
271
  readFromClipboard,
276
272
  stopChain,
273
+ timezoneService,
277
274
  toastIconContainerVariants,
278
275
  toastVariants,
279
276
  useAccountModals,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from './modules/auth/schema';\nexport * from './modules/users/schema';\nexport * from './modules/whitelabel/schema';\nexport * from './infra/api/types';\n\n// Contexts\nexport * from './providers/query.provider';\nexport * from './providers/auth.provider';\nexport * from './providers/whitelabel.provider';\n\n// Hooks\nexport { useUserQuery, useUserValidateSession, useInvalidateUser, useSetUserData, USER_QUERY_KEY } from './modules/auth/hooks/useUserQuery';\nexport { useSubscriptions, SUBSCRIPTIONS_QUERY_KEY } from './modules/subscriptions/hooks/list-subscriptions.hook';\nexport { useActiveSubscription } from './modules/subscriptions/hooks/find-active-subscription.hook';\nexport { useIaCredits } from './modules/ia-credits/hooks/ia-credits.hook';\nexport type { IaCreditsSummary, IaCreditOperation } from './modules/ia-credits/types';\nexport type { Subscription, SubscriptionItem, FindSubscriptionsParams } from './modules/subscriptions/types';\nexport { SubscriptionSchema, SubscriptionItemSchema } from './modules/subscriptions/types';\nexport { ADDON_IDS } from './modules/subscriptions/constants/addons.constants';\nexport type { AddonKindEnum } from './modules/subscriptions/constants/addons.constants';\n\n// Providers\nexport { QueryProvider } from './providers/query.provider';\n\n// Middleware\nexport { createAuthMiddleware } from './middlewares/create-auth-middleware';\nexport { createMiddlewareChain } from './middlewares/chain';\nexport { continueChain, stopChain } from './middlewares/types';\nexport type { MiddlewareFunction, MiddlewareConfig, MiddlewareResult } from './middlewares/types';\n\n// Utils\nexport { cn } from './infra/utils/clsx';\nexport { buildQueryParams } from './infra/utils/params';\nexport { parseSchema, parseResult } from './infra/utils/parser';\n\n// Layout\nexport { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from './components/layouts/MainLayout';\nexport { NavBar } from './components/layouts/NavBar';\nexport type { NavBarProps } from './components/layouts/NavBar';\nexport { AppNavBar } from './components/layouts/AppNavBar';\nexport type { AppNavBarProps } from './components/layouts/AppNavBar';\nexport { AppMobileNavBar } from './components/layouts/AppMobileNavBar';\nexport type { AppMobileNavBarProps } from './components/layouts/AppMobileNavBar';\nexport { SideBarNavigation } from './components/layouts/SideBarNavigation';\nexport { MdSideBarNavigation } from './components/layouts/MdSideBarNavigation';\nexport { NotificationItem } from './components/layouts/NotificationItem';\nexport type { NotificationItemProps } from './components/layouts/NotificationItem';\nexport { NotificationsPopover } from './components/layouts/NotificationsPopover';\nexport type { NotificationsPopoverProps, NotificationData } from './components/layouts/NotificationsPopover';\nexport { UsersSelectorPopover } from './components/layouts/UsersSelectorPopover';\nexport type { UsersSelectorPopoverProps, UserSelectorItem } from './components/layouts/UsersSelectorPopover';\nexport { ProfilePopover } from './components/layouts/ProfilePopover';\nexport type { ProfilePopoverProps, ProfileMenuItem } from './components/layouts/ProfilePopover';\nexport { NavBarItem } from './components/layouts/NavBarItem';\nexport type { NavBarItemProps } from './components/layouts/NavBarItem';\n\n// UI - Buttons\nexport { Button, buttonVariants } from './components/ui/buttons/Button';\nexport { CopyButton } from './components/ui/buttons/CopyButton';\nexport { default as CancelButton } from './components/ui/buttons/CancelButton';\n\n// UI - Data Display\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/ui/data-display/Accordion';\nexport { Badge, badgeVariants } from './components/ui/data-display/Badge';\nexport { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './components/ui/data-display/Card';\nexport { Pagination, PaginationContent, PaginationLink, PaginationItem, PaginationPrevious, PaginationNext, PaginationEllipsis } from './components/ui/data-display/Pagination';\nexport { ScrollArea, ScrollBar } from './components/ui/data-display/ScrollArea';\nexport { Separator } from './components/ui/data-display/Separator';\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from './components/ui/data-display/Table';\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/ui/data-display/Tabs';\nexport { UserAvatar } from './components/ui/data-display/UserAvatar';\nexport type { UserAvatarProps } from './components/ui/data-display/UserAvatar';\n\n// UI - Feedback\nexport { default as CircularProgress } from './components/ui/feedback/CircularProgress';\nexport { default as DefaultCircularProgress } from './components/ui/feedback/DefaultCircularProgress';\nexport { Progress } from './components/ui/feedback/Progress';\nexport { LoadingOverlay } from './components/ui/feedback/LoadingOverlay';\nexport { Toast, toastVariants, toastIconContainerVariants } from './components/ui/feedback/Toast';\nexport type { ToastProps } from './components/ui/feedback/Toast';\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from './components/ui/form/Calendar';\nexport { Checkbox } from './components/ui/form/Checkbox';\nexport { DatePicker } from './components/ui/form/DatePicker';\nexport { DateRangePicker } from './components/ui/form/DateRangePicker';\nexport { Input } from './components/ui/form/Input';\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from './components/ui/form/InputOtp';\nexport { RadioGroup, RadioGroupItem } from './components/ui/form/RadioGroup';\nexport { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/form/Select';\nexport { Switch } from './components/ui/form/Switch';\nexport { Textarea } from './components/ui/form/Textarea';\n\n// UI - Overlay\nexport { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './components/ui/overlay/Command';\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/ui/overlay/Dialog';\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './components/ui/overlay/Popover';\nexport { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from './components/ui/overlay/Sheet';\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/ui/overlay/Tooltip';\n\n// Store\nexport { useMdSidebarStore } from './store/useMdSidebarStore';\nexport { useModalManager } from './store/useModalManager';\nexport type { ModalData } from './store/useModalManager';\n\n// Enums\nexport { AccountSectionType } from './enums/AccountSectionType';\n\n// Hooks\nexport { default as usePasswordVisibility } from './hooks/usePasswordVisibility';\nexport { default as useCountdownTimer } from './hooks/useCountdownTimer';\nexport { default as useIsMobile } from './hooks/useIsMobile';\n\n// Utils\nexport { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from './utils/format/masks';\nexport { buildTimezoneOptions, fetchTimezoneOptions } from './utils/intl/timezones';\nexport type { TimezoneOption } from './utils/intl/timezones';\nexport { buildLocaleOptions, LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS } from './utils/intl/locales';\nexport type { LocaleOption } from './utils/intl/locales';\nexport { copyToClipboard, readFromClipboard } from './utils/browser/clipboard';\n\n// UI - Form (new widgets)\nexport { FormField } from './components/ui/form/FormField';\nexport { SelectField } from './components/ui/form/SelectField';\nexport { ComboboxField } from './components/ui/form/ComboboxField';\nexport type { ComboboxOption } from './components/ui/form/ComboboxField';\nexport { default as PhoneInput } from './components/ui/form/PhoneInput';\nexport { default as SwitchOptionFieldWithIcon } from './components/ui/form/SwitchOptionFieldWithIcon';\nexport { TextAreaField } from './components/ui/form/TextAreaField';\n\n// Account Module - Hooks\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from './modules/accounts/hooks/useAccountManagement';\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from './modules/accounts/types';\n\nexport { default as AccountModals } from './components/account/AccountModals';\nexport { useAccountModals } from './store/useAccountModals';\nexport type { AccountModalsConfig } from './store/useAccountModals';\n\nexport { ModalManager } from './components/modals/ModalManager';\nexport { Modals } from './components/modals/Modals';\n\nexport { default as TwoFactorAuthModal } from './components/account/TwoFactorAuthModal';\nexport { default as DisableTwoFactorAuthModal } from './components/account/DisableTwoFactorAuthModal';\nexport { default as ConfirmGlobalPreferencesModal } from './components/account/ConfirmGlobalPreferencesModal';\nexport { MyProfileSection } from './components/account/sections/MyProfileSection';\nexport { PreferencesSection } from './components/account/sections/PreferencesSection';\nexport { SecuritySection } from './components/account/sections/SecuritySection';\nexport { ChangePasswordSection } from './components/account/sections/ChangePasswordSection';\nexport { ChangeEmailModal } from './components/account/sections/ChangeEmailModal';\nexport { ChangePhoneModal } from './components/account/sections/ChangePhoneModal';\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIMEZONE_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from './components/account/constants';\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,cAAc,wBAAwB,mBAAmB,gBAAgB,sBAAsB;AACxG,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAG7B,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,iBAAiB;AAI1B,SAAS,qBAAqB;AAG9B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe,iBAAiB;AAIzC,SAAS,UAAU;AACnB,SAAS,wBAAwB;AACjC,SAAS,aAAa,mBAAmB;AAGzC,SAAS,YAAY,mBAAmB,kBAAkB,sBAAsB;AAChF,SAAS,cAAc;AAEvB,SAAS,iBAAiB;AAE1B,SAAS,uBAAuB;AAEhC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,SAAS,4BAA4B;AAErC,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB;AAI3B,SAAS,QAAQ,sBAAsB;AACvC,SAAS,kBAAkB;AAC3B,SAAoB,WAAXA,gBAA+B;AAGxC,SAAS,WAAW,eAAe,kBAAkB,wBAAwB;AAC7E,SAAS,OAAO,qBAAqB;AACrC,SAAS,MAAM,YAAY,YAAY,WAAW,YAAY,iBAAiB,mBAAmB;AAClG,SAAS,YAAY,mBAAmB,gBAAgB,gBAAgB,oBAAoB,gBAAgB,0BAA0B;AACtI,SAAS,YAAY,iBAAiB;AACtC,SAAS,iBAAiB;AAC1B,SAAS,OAAO,aAAa,WAAW,aAAa,WAAW,UAAU,WAAW,oBAAoB;AACzG,SAAS,MA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AAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAoB,WAAXA,iBAAgC;AACzC,SAAS,wBAAwB;AAGjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from './modules/auth/schema';\nexport * from './modules/users/schema';\nexport * from './modules/whitelabel/schema';\nexport * from './infra/api/types';\n\n// Contexts\nexport * from './providers/query.provider';\nexport * from './providers/auth.provider';\nexport * from './providers/whitelabel.provider';\n\n// Hooks\nexport { useUserQuery, useUserValidateSession, useInvalidateUser, useSetUserData, USER_QUERY_KEY } from './modules/auth/hooks/useUserQuery';\nexport { useSubscriptions, SUBSCRIPTIONS_QUERY_KEY } from './modules/subscriptions/hooks/list-subscriptions.hook';\nexport { useActiveSubscription } from './modules/subscriptions/hooks/find-active-subscription.hook';\nexport { useIaCredits } from './modules/ia-credits/hooks/ia-credits.hook';\nexport type { IaCreditsSummary, IaCreditOperation } from './modules/ia-credits/types';\nexport type { Subscription, SubscriptionItem, FindSubscriptionsParams } from './modules/subscriptions/types';\nexport { SubscriptionSchema, SubscriptionItemSchema } from './modules/subscriptions/types';\nexport { ADDON_IDS } from './modules/subscriptions/constants/addons.constants';\nexport type { AddonKindEnum } from './modules/subscriptions/constants/addons.constants';\n\n// Providers\nexport { QueryProvider } from './providers/query.provider';\n\n// Middleware\nexport { createAuthMiddleware } from './middlewares/create-auth-middleware';\nexport { createMiddlewareChain } from './middlewares/chain';\nexport { continueChain, stopChain } from './middlewares/types';\nexport type { MiddlewareFunction, MiddlewareConfig, MiddlewareResult } from './middlewares/types';\n\n// Utils\nexport { cn } from './infra/utils/clsx';\nexport { buildQueryParams } from './infra/utils/params';\nexport { parseSchema, parseResult } from './infra/utils/parser';\n\n// Layout\nexport { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from './components/layouts/MainLayout';\nexport { NavBar } from './components/layouts/NavBar';\nexport type { NavBarProps } from './components/layouts/NavBar';\nexport { AppNavBar } from './components/layouts/AppNavBar';\nexport type { AppNavBarProps } from './components/layouts/AppNavBar';\nexport { AppMobileNavBar } from './components/layouts/AppMobileNavBar';\nexport type { AppMobileNavBarProps } from './components/layouts/AppMobileNavBar';\nexport { SideBarNavigation } from './components/layouts/SideBarNavigation';\nexport { MdSideBarNavigation } from './components/layouts/MdSideBarNavigation';\nexport { NotificationItem } from './components/layouts/NotificationItem';\nexport type { NotificationItemProps } from './components/layouts/NotificationItem';\nexport { NotificationsPopover } from './components/layouts/NotificationsPopover';\nexport type { NotificationsPopoverProps, NotificationData } from './components/layouts/NotificationsPopover';\nexport { UsersSelectorPopover } from './components/layouts/UsersSelectorPopover';\nexport type { UsersSelectorPopoverProps, UserSelectorItem } from './components/layouts/UsersSelectorPopover';\nexport { ProfilePopover } from './components/layouts/ProfilePopover';\nexport type { ProfilePopoverProps, ProfileMenuItem } from './components/layouts/ProfilePopover';\nexport { NavBarItem } from './components/layouts/NavBarItem';\nexport type { NavBarItemProps } from './components/layouts/NavBarItem';\n\n// UI - Buttons\nexport { Button, buttonVariants } from './components/ui/buttons/Button';\nexport { CopyButton } from './components/ui/buttons/CopyButton';\nexport { default as CancelButton } from './components/ui/buttons/CancelButton';\n\n// UI - Data Display\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/ui/data-display/Accordion';\nexport { Badge, badgeVariants } from './components/ui/data-display/Badge';\nexport { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './components/ui/data-display/Card';\nexport { Pagination, PaginationContent, PaginationLink, PaginationItem, PaginationPrevious, PaginationNext, PaginationEllipsis } from './components/ui/data-display/Pagination';\nexport { ScrollArea, ScrollBar } from './components/ui/data-display/ScrollArea';\nexport { Separator } from './components/ui/data-display/Separator';\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from './components/ui/data-display/Table';\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/ui/data-display/Tabs';\nexport { UserAvatar } from './components/ui/data-display/UserAvatar';\nexport type { UserAvatarProps } from './components/ui/data-display/UserAvatar';\n\n// UI - Feedback\nexport { default as CircularProgress } from './components/ui/feedback/CircularProgress';\nexport { default as DefaultCircularProgress } from './components/ui/feedback/DefaultCircularProgress';\nexport { Progress } from './components/ui/feedback/Progress';\nexport { LoadingOverlay } from './components/ui/feedback/LoadingOverlay';\nexport { Toast, toastVariants, toastIconContainerVariants } from './components/ui/feedback/Toast';\nexport type { ToastProps } from './components/ui/feedback/Toast';\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from './components/ui/form/Calendar';\nexport { Checkbox } from './components/ui/form/Checkbox';\nexport { DatePicker } from './components/ui/form/DatePicker';\nexport { DateRangePicker } from './components/ui/form/DateRangePicker';\nexport { Input } from './components/ui/form/Input';\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from './components/ui/form/InputOtp';\nexport { RadioGroup, RadioGroupItem } from './components/ui/form/RadioGroup';\nexport { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/form/Select';\nexport { Switch } from './components/ui/form/Switch';\nexport { Textarea } from './components/ui/form/Textarea';\n\n// UI - Overlay\nexport { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './components/ui/overlay/Command';\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/ui/overlay/Dialog';\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './components/ui/overlay/Popover';\nexport { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from './components/ui/overlay/Sheet';\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/ui/overlay/Tooltip';\n\n// Store\nexport { useMdSidebarStore } from './store/useMdSidebarStore';\nexport { useModalManager } from './store/useModalManager';\nexport type { ModalData } from './store/useModalManager';\n\n// Enums\nexport { AccountSectionType } from './enums/AccountSectionType';\n\n// Hooks\nexport { default as usePasswordVisibility } from './hooks/usePasswordVisibility';\nexport { default as useCountdownTimer } from './hooks/useCountdownTimer';\nexport { default as useIsMobile } from './hooks/useIsMobile';\n\n// Utils\nexport { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from './utils/format/masks';\nexport { timezoneService } from './modules/accounts/services/timezone.service';\nexport type { TimezoneOption } from './modules/accounts/services/timezone.service';\nexport { buildLocaleOptions, LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS } from './utils/intl/locales';\nexport type { LocaleOption } from './utils/intl/locales';\nexport { copyToClipboard, readFromClipboard } from './utils/browser/clipboard';\n\n// UI - Form (new widgets)\nexport { FormField } from './components/ui/form/FormField';\nexport { SelectField } from './components/ui/form/SelectField';\nexport { ComboboxField } from './components/ui/form/ComboboxField';\nexport type { ComboboxOption } from './components/ui/form/ComboboxField';\nexport { default as PhoneInput } from './components/ui/form/PhoneInput';\nexport { default as SwitchOptionFieldWithIcon } from './components/ui/form/SwitchOptionFieldWithIcon';\nexport { TextAreaField } from './components/ui/form/TextAreaField';\n\n// Account Module - Hooks\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from './modules/accounts/hooks/useAccountManagement';\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from './modules/accounts/types';\n\nexport { default as AccountModals } from './components/account/AccountModals';\nexport { useAccountModals } from './store/useAccountModals';\nexport type { AccountModalsConfig } from './store/useAccountModals';\n\nexport { ModalManager } from './components/modals/ModalManager';\nexport { Modals } from './components/modals/Modals';\n\nexport { default as TwoFactorAuthModal } from './components/account/TwoFactorAuthModal';\nexport { default as DisableTwoFactorAuthModal } from './components/account/DisableTwoFactorAuthModal';\nexport { default as ConfirmGlobalPreferencesModal } from './components/account/ConfirmGlobalPreferencesModal';\nexport { MyProfileSection } from './components/account/sections/MyProfileSection';\nexport { PreferencesSection } from './components/account/sections/PreferencesSection';\nexport { SecuritySection } from './components/account/sections/SecuritySection';\nexport { ChangePasswordSection } from './components/account/sections/ChangePasswordSection';\nexport { ChangeEmailModal } from './components/account/sections/ChangeEmailModal';\nexport { ChangePhoneModal } from './components/account/sections/ChangePhoneModal';\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from './components/account/constants';\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,cAAc,wBAAwB,mBAAmB,gBAAgB,sBAAsB;AACxG,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAG7B,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,iBAAiB;AAI1B,SAAS,qBAAqB;AAG9B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe,iBAAiB;AAIzC,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intl/currencies";
2
+ import { currencyService } from "../services/currency.service";
3
3
  async function listCurrenciesAction() {
4
- return fetchCurrencyOptions();
4
+ return currencyService.fetchOptions();
5
5
  }
6
6
  export {
7
7
  listCurrenciesAction
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/modules/accounts/actions/list-currencies.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { fetchCurrencyOptions } from '../../../utils/intl/currencies';\r\n\r\nexport async function listCurrenciesAction() {\r\n return fetchCurrencyOptions();\r\n}\r\n"],"mappings":";AAEA,SAAS,4BAA4B;AAErC,eAAsB,uBAAuB;AAC3C,SAAO,qBAAqB;AAC9B;","names":[]}
1
+ {"version":3,"sources":["../../../../src/modules/accounts/actions/list-currencies.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { currencyService } from '../services/currency.service';\r\n\r\nexport async function listCurrenciesAction() {\r\n return currencyService.fetchOptions();\r\n}\r\n"],"mappings":";AAEA,SAAS,uBAAuB;AAEhC,eAAsB,uBAAuB;AAC3C,SAAO,gBAAgB,aAAa;AACtC;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use server";
2
- import { fetchTimezoneOptions } from "../../../utils/intl/timezones";
2
+ import { timezoneService } from "../services/timezone.service";
3
3
  async function listTimezonesAction() {
4
- return fetchTimezoneOptions();
4
+ return timezoneService.fetchOptions();
5
5
  }
6
6
  export {
7
7
  listTimezonesAction
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/modules/accounts/actions/list-timezones.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { fetchTimezoneOptions } from '../../../utils/intl/timezones';\r\n\r\nexport async function listTimezonesAction() {\r\n return fetchTimezoneOptions();\r\n}\r\n"],"mappings":";AAEA,SAAS,4BAA4B;AAErC,eAAsB,sBAAsB;AAC1C,SAAO,qBAAqB;AAC9B;","names":[]}
1
+ {"version":3,"sources":["../../../../src/modules/accounts/actions/list-timezones.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { timezoneService } from '../services/timezone.service';\r\n\r\nexport async function listTimezonesAction() {\r\n return timezoneService.fetchOptions();\r\n}\r\n"],"mappings":";AAEA,SAAS,uBAAuB;AAEhC,eAAsB,sBAAsB;AAC1C,SAAO,gBAAgB,aAAa;AACtC;","names":[]}
@@ -0,0 +1,24 @@
1
+ import { api } from "../../../infra/api/client";
2
+ const FALLBACK_CURRENCIES = [
3
+ { value: "BRL", label: "Real (R$)" },
4
+ { value: "USD", label: "D\xF3lar Americano (US$)" },
5
+ { value: "EUR", label: "Euro (\u20AC)" }
6
+ ];
7
+ class CurrencyService {
8
+ async fetchOptions() {
9
+ try {
10
+ const response = await api.apps.get("/accounts/action/currencies");
11
+ return response.data.map((item) => ({
12
+ value: item.value,
13
+ label: item.title["pt-br"] || item.title["en-us"] || item.value
14
+ }));
15
+ } catch {
16
+ return FALLBACK_CURRENCIES;
17
+ }
18
+ }
19
+ }
20
+ const currencyService = new CurrencyService();
21
+ export {
22
+ currencyService
23
+ };
24
+ //# sourceMappingURL=currency.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/services/currency.service.ts"],"sourcesContent":["import { api } from '../../../infra/api/client';\r\nimport type { ComboboxOption } from '../../../components/ui/form/ComboboxField';\r\n\r\ntype CurrencyApiItem = {\r\n value: string;\r\n icon: string;\r\n title: { 'pt-br': string; 'en-us': string };\r\n description: string;\r\n};\r\n\r\ntype CurrencyApiResponse = {\r\n status: number;\r\n message: string;\r\n data: CurrencyApiItem[];\r\n};\r\n\r\nconst FALLBACK_CURRENCIES: ComboboxOption[] = [\r\n { value: 'BRL', label: 'Real (R$)' },\r\n { value: 'USD', label: 'Dólar Americano (US$)' },\r\n { value: 'EUR', label: 'Euro (€)' },\r\n];\r\n\r\nclass CurrencyService {\r\n async fetchOptions(): Promise<ComboboxOption[]> {\r\n try {\r\n const response = await api.apps.get<CurrencyApiResponse>('/accounts/action/currencies');\r\n\r\n return response.data.map((item) => ({\r\n value: item.value,\r\n label: item.title['pt-br'] || item.title['en-us'] || item.value,\r\n }));\r\n } catch {\r\n return FALLBACK_CURRENCIES;\r\n }\r\n }\r\n}\r\n\r\nexport const currencyService = new CurrencyService();\r\n"],"mappings":"AAAA,SAAS,WAAW;AAgBpB,MAAM,sBAAwC;AAAA,EAC5C,EAAE,OAAO,OAAO,OAAO,YAAY;AAAA,EACnC,EAAE,OAAO,OAAO,OAAO,2BAAwB;AAAA,EAC/C,EAAE,OAAO,OAAO,OAAO,gBAAW;AACpC;AAEA,MAAM,gBAAgB;AAAA,EACpB,MAAM,eAA0C;AAC9C,QAAI;AACF,YAAM,WAAW,MAAM,IAAI,KAAK,IAAyB,6BAA6B;AAEtF,aAAO,SAAS,KAAK,IAAI,CAAC,UAAU;AAAA,QAClC,OAAO,KAAK;AAAA,QACZ,OAAO,KAAK,MAAM,OAAO,KAAK,KAAK,MAAM,OAAO,KAAK,KAAK;AAAA,MAC5D,EAAE;AAAA,IACJ,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,IAAI,gBAAgB;","names":[]}
@@ -0,0 +1,65 @@
1
+ import { api } from "../../../infra/api/client";
2
+ function parseOffsetMinutes(offsetStr) {
3
+ const match = offsetStr.match(/GMT([+-])(\d+)(?::(\d+))?/);
4
+ if (!match) return 0;
5
+ const sign = match[1] === "+" ? 1 : -1;
6
+ return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? "0", 10));
7
+ }
8
+ const FALLBACK_TIMEZONES = [
9
+ { value: "America/Noronha", label: "(GMT-2) America/Noronha", displayValue: "(GMT-2) Noronha" },
10
+ { value: "America/Sao_Paulo", label: "(GMT-3) America/Sao Paulo", displayValue: "(GMT-3) Sao Paulo" },
11
+ { value: "America/Manaus", label: "(GMT-4) America/Manaus", displayValue: "(GMT-4) Manaus" },
12
+ { value: "America/Rio_Branco", label: "(GMT-5) America/Rio Branco", displayValue: "(GMT-5) Rio Branco" },
13
+ { value: "America/New_York", label: "(GMT-5) America/New York", displayValue: "(GMT-5) New York" },
14
+ { value: "America/Los_Angeles", label: "(GMT-8) America/Los Angeles", displayValue: "(GMT-8) Los Angeles" },
15
+ { value: "Europe/London", label: "(GMT+0) Europe/London", displayValue: "(GMT+0) London" },
16
+ { value: "Europe/Paris", label: "(GMT+1) Europe/Paris", displayValue: "(GMT+1) Paris" },
17
+ { value: "Asia/Tokyo", label: "(GMT+9) Asia/Tokyo", displayValue: "(GMT+9) Tokyo" }
18
+ ];
19
+ class TimezoneService {
20
+ async fetchOptions() {
21
+ try {
22
+ const response = await api.apps.get("/accounts/action/timezones");
23
+ const now = /* @__PURE__ */ new Date();
24
+ const items = response.data.map((item) => {
25
+ const offsetStr = new Intl.DateTimeFormat("en", { timeZone: item.value, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
26
+ const city = item.value.split("/").slice(1).join("/").replace(/_/g, " ") || item.value;
27
+ return {
28
+ value: item.value,
29
+ label: `(${offsetStr}) ${item.value.replace(/_/g, " ")}`,
30
+ displayValue: `(${offsetStr}) ${city}`,
31
+ sort: parseOffsetMinutes(offsetStr)
32
+ };
33
+ });
34
+ items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
35
+ return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
36
+ } catch {
37
+ return FALLBACK_TIMEZONES;
38
+ }
39
+ }
40
+ buildOptions() {
41
+ try {
42
+ const zones = Intl.supportedValuesOf("timeZone");
43
+ const now = /* @__PURE__ */ new Date();
44
+ const items = zones.map((tz) => {
45
+ const offsetStr = new Intl.DateTimeFormat("en", { timeZone: tz, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
46
+ const city = tz.split("/").slice(1).join("/").replace(/_/g, " ") || tz;
47
+ return {
48
+ value: tz,
49
+ label: `(${offsetStr}) ${tz.replace(/_/g, " ")}`,
50
+ displayValue: `(${offsetStr}) ${city}`,
51
+ sort: parseOffsetMinutes(offsetStr)
52
+ };
53
+ });
54
+ items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
55
+ return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
56
+ } catch {
57
+ return FALLBACK_TIMEZONES;
58
+ }
59
+ }
60
+ }
61
+ const timezoneService = new TimezoneService();
62
+ export {
63
+ timezoneService
64
+ };
65
+ //# sourceMappingURL=timezone.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/services/timezone.service.ts"],"sourcesContent":["import { api } from '../../../infra/api/client';\r\n\r\nexport type TimezoneOption = {\r\n value: string;\r\n label: string;\r\n displayValue: string;\r\n};\r\n\r\ntype TimezoneApiResponse = {\r\n message: string;\r\n data: { value: string; title: string }[];\r\n};\r\n\r\nfunction parseOffsetMinutes(offsetStr: string): number {\r\n const match = offsetStr.match(/GMT([+-])(\\d+)(?::(\\d+))?/);\r\n if (!match) return 0;\r\n const sign = match[1] === '+' ? 1 : -1;\r\n return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? '0', 10));\r\n}\r\n\r\nconst FALLBACK_TIMEZONES: TimezoneOption[] = [\r\n { value: 'America/Noronha', label: '(GMT-2) America/Noronha', displayValue: '(GMT-2) Noronha' },\r\n { value: 'America/Sao_Paulo', label: '(GMT-3) America/Sao Paulo', displayValue: '(GMT-3) Sao Paulo' },\r\n { value: 'America/Manaus', label: '(GMT-4) America/Manaus', displayValue: '(GMT-4) Manaus' },\r\n { value: 'America/Rio_Branco', label: '(GMT-5) America/Rio Branco', displayValue: '(GMT-5) Rio Branco' },\r\n { value: 'America/New_York', label: '(GMT-5) America/New York', displayValue: '(GMT-5) New York' },\r\n { value: 'America/Los_Angeles', label: '(GMT-8) America/Los Angeles', displayValue: '(GMT-8) Los Angeles' },\r\n { value: 'Europe/London', label: '(GMT+0) Europe/London', displayValue: '(GMT+0) London' },\r\n { value: 'Europe/Paris', label: '(GMT+1) Europe/Paris', displayValue: '(GMT+1) Paris' },\r\n { value: 'Asia/Tokyo', label: '(GMT+9) Asia/Tokyo', displayValue: '(GMT+9) Tokyo' },\r\n];\r\n\r\nclass TimezoneService {\r\n async fetchOptions(): Promise<TimezoneOption[]> {\r\n try {\r\n const response = await api.apps.get<TimezoneApiResponse>('/accounts/action/timezones');\r\n const now = new Date();\r\n\r\n const items = response.data.map((item) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: item.value, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = item.value.split('/').slice(1).join('/').replace(/_/g, ' ') || item.value;\r\n\r\n return {\r\n value: item.value,\r\n label: `(${offsetStr}) ${item.value.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIMEZONES;\r\n }\r\n }\r\n\r\n buildOptions(): TimezoneOption[] {\r\n try {\r\n const zones = Intl.supportedValuesOf('timeZone');\r\n const now = new Date();\r\n\r\n const items = zones.map((tz) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: tz, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = tz.split('/').slice(1).join('/').replace(/_/g, ' ') || tz;\r\n\r\n return {\r\n value: tz,\r\n label: `(${offsetStr}) ${tz.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIME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,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,EAAE,KAAK,CAAC;AAEtE,aAAO,MAAM,IAAI,CAAC,EAAE,OAAO,OAAO,aAAa,OAAO,EAAE,OAAO,OAAO,aAAa,EAAE;AAAA,IACvF,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,IAAI,gBAAgB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/common",
3
- "version": "1.1.41",
3
+ "version": "1.1.43",
4
4
  "description": "Shared library for GreatApps frontend applications",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -1,4 +1,3 @@
1
- import { buildTimezoneOptions } from '../../utils/intl/timezones';
2
1
  import { buildLocaleOptions } from '../../utils/intl/locales';
3
2
 
4
3
  export const GENDER_OPTIONS = [
@@ -14,8 +13,6 @@ export const CURRENCY_OPTIONS = [
14
13
  { value: 'EUR', label: 'EUR (€)', displayValue: 'EUR (€)' },
15
14
  ];
16
15
 
17
- export const TIMEZONE_OPTIONS = buildTimezoneOptions();
18
-
19
16
  export const TIME_FORMAT_OPTIONS = [
20
17
  { value: '24h', label: '24 horas', displayValue: '24 horas' },
21
18
  { value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },
package/src/index.ts CHANGED
@@ -114,8 +114,8 @@ export { default as useIsMobile } from './hooks/useIsMobile';
114
114
 
115
115
  // Utils
116
116
  export { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from './utils/format/masks';
117
- export { buildTimezoneOptions, fetchTimezoneOptions } from './utils/intl/timezones';
118
- export type { TimezoneOption } from './utils/intl/timezones';
117
+ export { timezoneService } from './modules/accounts/services/timezone.service';
118
+ export type { TimezoneOption } from './modules/accounts/services/timezone.service';
119
119
  export { buildLocaleOptions, LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS } from './utils/intl/locales';
120
120
  export type { LocaleOption } from './utils/intl/locales';
121
121
  export { copyToClipboard, readFromClipboard } from './utils/browser/clipboard';
@@ -173,7 +173,6 @@ export { ChangePhoneModal } from './components/account/sections/ChangePhoneModal
173
173
  export {
174
174
  GENDER_OPTIONS,
175
175
  CURRENCY_OPTIONS,
176
- TIMEZONE_OPTIONS,
177
176
  TIME_FORMAT_OPTIONS,
178
177
  NOTIFICATION_TYPES,
179
178
  LANGUAGE_OPTIONS,
@@ -1,7 +1,7 @@
1
1
  'use server';
2
2
 
3
- import { fetchCurrencyOptions } from '../../../utils/intl/currencies';
3
+ import { currencyService } from '../services/currency.service';
4
4
 
5
5
  export async function listCurrenciesAction() {
6
- return fetchCurrencyOptions();
6
+ return currencyService.fetchOptions();
7
7
  }
@@ -1,7 +1,7 @@
1
1
  'use server';
2
2
 
3
- import { fetchTimezoneOptions } from '../../../utils/intl/timezones';
3
+ import { timezoneService } from '../services/timezone.service';
4
4
 
5
5
  export async function listTimezonesAction() {
6
- return fetchTimezoneOptions();
6
+ return timezoneService.fetchOptions();
7
7
  }
@@ -0,0 +1,38 @@
1
+ import { api } from '../../../infra/api/client';
2
+ import type { ComboboxOption } from '../../../components/ui/form/ComboboxField';
3
+
4
+ type CurrencyApiItem = {
5
+ value: string;
6
+ icon: string;
7
+ title: { 'pt-br': string; 'en-us': string };
8
+ description: string;
9
+ };
10
+
11
+ type CurrencyApiResponse = {
12
+ status: number;
13
+ message: string;
14
+ data: CurrencyApiItem[];
15
+ };
16
+
17
+ const FALLBACK_CURRENCIES: ComboboxOption[] = [
18
+ { value: 'BRL', label: 'Real (R$)' },
19
+ { value: 'USD', label: 'Dólar Americano (US$)' },
20
+ { value: 'EUR', label: 'Euro (€)' },
21
+ ];
22
+
23
+ class CurrencyService {
24
+ async fetchOptions(): Promise<ComboboxOption[]> {
25
+ try {
26
+ const response = await api.apps.get<CurrencyApiResponse>('/accounts/action/currencies');
27
+
28
+ return response.data.map((item) => ({
29
+ value: item.value,
30
+ label: item.title['pt-br'] || item.title['en-us'] || item.value,
31
+ }));
32
+ } catch {
33
+ return FALLBACK_CURRENCIES;
34
+ }
35
+ }
36
+ }
37
+
38
+ export const currencyService = new CurrencyService();
@@ -0,0 +1,93 @@
1
+ import { api } from '../../../infra/api/client';
2
+
3
+ export type TimezoneOption = {
4
+ value: string;
5
+ label: string;
6
+ displayValue: string;
7
+ };
8
+
9
+ type TimezoneApiResponse = {
10
+ message: string;
11
+ data: { value: string; title: string }[];
12
+ };
13
+
14
+ function parseOffsetMinutes(offsetStr: string): number {
15
+ const match = offsetStr.match(/GMT([+-])(\d+)(?::(\d+))?/);
16
+ if (!match) return 0;
17
+ const sign = match[1] === '+' ? 1 : -1;
18
+ return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? '0', 10));
19
+ }
20
+
21
+ const FALLBACK_TIMEZONES: TimezoneOption[] = [
22
+ { value: 'America/Noronha', label: '(GMT-2) America/Noronha', displayValue: '(GMT-2) Noronha' },
23
+ { value: 'America/Sao_Paulo', label: '(GMT-3) America/Sao Paulo', displayValue: '(GMT-3) Sao Paulo' },
24
+ { value: 'America/Manaus', label: '(GMT-4) America/Manaus', displayValue: '(GMT-4) Manaus' },
25
+ { value: 'America/Rio_Branco', label: '(GMT-5) America/Rio Branco', displayValue: '(GMT-5) Rio Branco' },
26
+ { value: 'America/New_York', label: '(GMT-5) America/New York', displayValue: '(GMT-5) New York' },
27
+ { value: 'America/Los_Angeles', label: '(GMT-8) America/Los Angeles', displayValue: '(GMT-8) Los Angeles' },
28
+ { value: 'Europe/London', label: '(GMT+0) Europe/London', displayValue: '(GMT+0) London' },
29
+ { value: 'Europe/Paris', label: '(GMT+1) Europe/Paris', displayValue: '(GMT+1) Paris' },
30
+ { value: 'Asia/Tokyo', label: '(GMT+9) Asia/Tokyo', displayValue: '(GMT+9) Tokyo' },
31
+ ];
32
+
33
+ class TimezoneService {
34
+ async fetchOptions(): Promise<TimezoneOption[]> {
35
+ try {
36
+ const response = await api.apps.get<TimezoneApiResponse>('/accounts/action/timezones');
37
+ const now = new Date();
38
+
39
+ const items = response.data.map((item) => {
40
+ const offsetStr =
41
+ new Intl.DateTimeFormat('en', { timeZone: item.value, timeZoneName: 'shortOffset' })
42
+ .formatToParts(now)
43
+ .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';
44
+
45
+ const city = item.value.split('/').slice(1).join('/').replace(/_/g, ' ') || item.value;
46
+
47
+ return {
48
+ value: item.value,
49
+ label: `(${offsetStr}) ${item.value.replace(/_/g, ' ')}`,
50
+ displayValue: `(${offsetStr}) ${city}`,
51
+ sort: parseOffsetMinutes(offsetStr),
52
+ };
53
+ });
54
+
55
+ items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
56
+
57
+ return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
58
+ } catch {
59
+ return FALLBACK_TIMEZONES;
60
+ }
61
+ }
62
+
63
+ buildOptions(): TimezoneOption[] {
64
+ try {
65
+ const zones = Intl.supportedValuesOf('timeZone');
66
+ const now = new Date();
67
+
68
+ const items = zones.map((tz) => {
69
+ const offsetStr =
70
+ new Intl.DateTimeFormat('en', { timeZone: tz, timeZoneName: 'shortOffset' })
71
+ .formatToParts(now)
72
+ .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';
73
+
74
+ const city = tz.split('/').slice(1).join('/').replace(/_/g, ' ') || tz;
75
+
76
+ return {
77
+ value: tz,
78
+ label: `(${offsetStr}) ${tz.replace(/_/g, ' ')}`,
79
+ displayValue: `(${offsetStr}) ${city}`,
80
+ sort: parseOffsetMinutes(offsetStr),
81
+ };
82
+ });
83
+
84
+ items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
85
+
86
+ return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
87
+ } catch {
88
+ return FALLBACK_TIMEZONES;
89
+ }
90
+ }
91
+ }
92
+
93
+ export const timezoneService = new TimezoneService();
@@ -1,21 +0,0 @@
1
- import { api } from "../../infra/api/client";
2
- const FALLBACK_CURRENCIES = [
3
- { value: "BRL", label: "Real (R$)" },
4
- { value: "USD", label: "D\xF3lar Americano (US$)" },
5
- { value: "EUR", label: "Euro (\u20AC)" }
6
- ];
7
- async function fetchCurrencyOptions() {
8
- try {
9
- const response = await api.apps.get("/accounts/action/currencies");
10
- return response.data.map((item) => ({
11
- value: item.value,
12
- label: item.title["pt-br"] || item.title["en-us"] || item.value
13
- }));
14
- } catch {
15
- return FALLBACK_CURRENCIES;
16
- }
17
- }
18
- export {
19
- fetchCurrencyOptions
20
- };
21
- //# sourceMappingURL=currencies.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/intl/currencies.ts"],"sourcesContent":["import { api } from '../../infra/api/client';\r\nimport type { ComboboxOption } from '../../components/ui/form/ComboboxField';\r\n\r\ntype CurrencyApiItem = {\r\n value: string;\r\n icon: string;\r\n title: { 'pt-br': string; 'en-us': string };\r\n description: string;\r\n};\r\n\r\ntype CurrencyApiResponse = {\r\n status: number;\r\n message: string;\r\n data: CurrencyApiItem[];\r\n};\r\n\r\nconst FALLBACK_CURRENCIES: ComboboxOption[] = [\r\n { value: 'BRL', label: 'Real (R$)' },\r\n { value: 'USD', label: 'Dólar Americano (US$)' },\r\n { value: 'EUR', label: 'Euro (€)' },\r\n];\r\n\r\nexport async function fetchCurrencyOptions(): Promise<ComboboxOption[]> {\r\n try {\r\n const response = await api.apps.get<CurrencyApiResponse>('/accounts/action/currencies');\r\n\r\n return response.data.map((item) => ({\r\n value: item.value,\r\n label: item.title['pt-br'] || item.title['en-us'] || item.value,\r\n }));\r\n } catch {\r\n return FALLBACK_CURRENCIES;\r\n }\r\n}\r\n"],"mappings":"AAAA,SAAS,WAAW;AAgBpB,MAAM,sBAAwC;AAAA,EAC5C,EAAE,OAAO,OAAO,OAAO,YAAY;AAAA,EACnC,EAAE,OAAO,OAAO,OAAO,2BAAwB;AAAA,EAC/C,EAAE,OAAO,OAAO,OAAO,gBAAW;AACpC;AAEA,eAAsB,uBAAkD;AACtE,MAAI;AACF,UAAM,WAAW,MAAM,IAAI,KAAK,IAAyB,6BAA6B;AAEtF,WAAO,SAAS,KAAK,IAAI,CAAC,UAAU;AAAA,MAClC,OAAO,KAAK;AAAA,MACZ,OAAO,KAAK,MAAM,OAAO,KAAK,KAAK,MAAM,OAAO,KAAK,KAAK;AAAA,IAC5D,EAAE;AAAA,EACJ,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,63 +0,0 @@
1
- import { api } from "../../infra/api/client";
2
- function parseOffsetMinutes(offsetStr) {
3
- const match = offsetStr.match(/GMT([+-])(\d+)(?::(\d+))?/);
4
- if (!match) return 0;
5
- const sign = match[1] === "+" ? 1 : -1;
6
- return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? "0", 10));
7
- }
8
- const FALLBACK_TIMEZONES = [
9
- { value: "America/Noronha", label: "(GMT-2) America/Noronha", displayValue: "(GMT-2) Noronha" },
10
- { value: "America/Sao_Paulo", label: "(GMT-3) America/Sao Paulo", displayValue: "(GMT-3) Sao Paulo" },
11
- { value: "America/Manaus", label: "(GMT-4) America/Manaus", displayValue: "(GMT-4) Manaus" },
12
- { value: "America/Rio_Branco", label: "(GMT-5) America/Rio Branco", displayValue: "(GMT-5) Rio Branco" },
13
- { value: "America/New_York", label: "(GMT-5) America/New York", displayValue: "(GMT-5) New York" },
14
- { value: "America/Los_Angeles", label: "(GMT-8) America/Los Angeles", displayValue: "(GMT-8) Los Angeles" },
15
- { value: "Europe/London", label: "(GMT+0) Europe/London", displayValue: "(GMT+0) London" },
16
- { value: "Europe/Paris", label: "(GMT+1) Europe/Paris", displayValue: "(GMT+1) Paris" },
17
- { value: "Asia/Tokyo", label: "(GMT+9) Asia/Tokyo", displayValue: "(GMT+9) Tokyo" }
18
- ];
19
- async function fetchTimezoneOptions() {
20
- try {
21
- const response = await api.apps.get("/accounts/action/timezones");
22
- const now = /* @__PURE__ */ new Date();
23
- const items = response.data.map((item) => {
24
- const offsetStr = new Intl.DateTimeFormat("en", { timeZone: item.value, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
25
- const city = item.value.split("/").slice(1).join("/").replace(/_/g, " ") || item.value;
26
- return {
27
- value: item.value,
28
- label: `(${offsetStr}) ${item.value.replace(/_/g, " ")}`,
29
- displayValue: `(${offsetStr}) ${city}`,
30
- sort: parseOffsetMinutes(offsetStr)
31
- };
32
- });
33
- items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
34
- return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
35
- } catch {
36
- return FALLBACK_TIMEZONES;
37
- }
38
- }
39
- function buildTimezoneOptions() {
40
- try {
41
- const zones = Intl.supportedValuesOf("timeZone");
42
- const now = /* @__PURE__ */ new Date();
43
- const items = zones.map((tz) => {
44
- const offsetStr = new Intl.DateTimeFormat("en", { timeZone: tz, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
45
- const city = tz.split("/").slice(1).join("/").replace(/_/g, " ") || tz;
46
- return {
47
- value: tz,
48
- label: `(${offsetStr}) ${tz.replace(/_/g, " ")}`,
49
- displayValue: `(${offsetStr}) ${city}`,
50
- sort: parseOffsetMinutes(offsetStr)
51
- };
52
- });
53
- items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
54
- return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
55
- } catch {
56
- return FALLBACK_TIMEZONES;
57
- }
58
- }
59
- export {
60
- buildTimezoneOptions,
61
- fetchTimezoneOptions
62
- };
63
- //# sourceMappingURL=timezones.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/intl/timezones.ts"],"sourcesContent":["import { api } from '../../infra/api/client';\r\n\r\nexport type TimezoneOption = {\r\n value: string;\r\n label: string;\r\n displayValue: string;\r\n};\r\n\r\ntype TimezoneApiResponse = {\r\n message: string;\r\n data: { value: string; title: string }[];\r\n};\r\n\r\nfunction parseOffsetMinutes(offsetStr: string): number {\r\n const match = offsetStr.match(/GMT([+-])(\\d+)(?::(\\d+))?/);\r\n if (!match) return 0;\r\n const sign = match[1] === '+' ? 1 : -1;\r\n return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? '0', 10));\r\n}\r\n\r\nconst FALLBACK_TIMEZONES: TimezoneOption[] = [\r\n { value: 'America/Noronha', label: '(GMT-2) America/Noronha', displayValue: '(GMT-2) Noronha' },\r\n { value: 'America/Sao_Paulo', label: '(GMT-3) America/Sao Paulo', displayValue: '(GMT-3) Sao Paulo' },\r\n { value: 'America/Manaus', label: '(GMT-4) America/Manaus', displayValue: '(GMT-4) Manaus' },\r\n { value: 'America/Rio_Branco', label: '(GMT-5) America/Rio Branco', displayValue: '(GMT-5) Rio Branco' },\r\n { value: 'America/New_York', label: '(GMT-5) America/New York', displayValue: '(GMT-5) New York' },\r\n { value: 'America/Los_Angeles', label: '(GMT-8) America/Los Angeles', displayValue: '(GMT-8) Los Angeles' },\r\n { value: 'Europe/London', label: '(GMT+0) Europe/London', displayValue: '(GMT+0) London' },\r\n { value: 'Europe/Paris', label: '(GMT+1) Europe/Paris', displayValue: '(GMT+1) Paris' },\r\n { value: 'Asia/Tokyo', label: '(GMT+9) Asia/Tokyo', displayValue: '(GMT+9) Tokyo' },\r\n];\r\n\r\nexport async function fetchTimezoneOptions(): Promise<TimezoneOption[]> {\r\n try {\r\n const response = await api.apps.get<TimezoneApiResponse>('/accounts/action/timezones');\r\n const now = new Date();\r\n\r\n const items = response.data.map((item) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: item.value, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = item.value.split('/').slice(1).join('/').replace(/_/g, ' ') || item.value;\r\n\r\n return {\r\n value: item.value,\r\n label: `(${offsetStr}) ${item.value.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIMEZONES;\r\n }\r\n}\r\n\r\nexport function buildTimezoneOptions(): TimezoneOption[] {\r\n try {\r\n const zones = Intl.supportedValuesOf('timeZone');\r\n const now = new Date();\r\n\r\n const items = zones.map((tz) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: tz, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = tz.split('/').slice(1).join('/').replace(/_/g, ' ') || tz;\r\n\r\n return {\r\n value: tz,\r\n label: `(${offsetStr}) ${tz.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIMEZONES;\r\n }\r\n}\r\n"],"mappings":"AAAA,SAAS,WAAW;AAapB,SAAS,mBAAmB,WAA2B;AACrD,QAAM,QAAQ,UAAU,MAAM,2BAA2B;AACzD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,OAAO,MAAM,CAAC,MAAM,MAAM,IAAI;AACpC,SAAO,QAAQ,SAAS,MAAM,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,MAAM,CAAC,KAAK,KAAK,EAAE;AAC3E;AAEA,MAAM,qBAAuC;AAAA,EAC3C,EAAE,OAAO,mBAAmB,OAAO,2BAA2B,cAAc,kBAAkB;AAAA,EAC9F,EAAE,OAAO,qBAAqB,OAAO,6BAA6B,cAAc,oBAAoB;AAAA,EACpG,EAAE,OAAO,kBAAkB,OAAO,0BAA0B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A,EACvF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,uBAAyC;AACvD,MAAI;AACF,UAAM,QAAQ,KAAK,kBAAkB,UAAU;AAC/C,UAAM,MAAM,oBAAI,KAAK;AAErB,UAAM,QAAQ,MAAM,IAAI,CAAC,OAAO;AAC9B,YAAM,YACJ,IAAI,KAAK,eAAe,MAAM,EAAE,UAAU,IAAI,cAAc,cAAc,CAAC,EACxE,cAAc,GAAG,EACjB,KAAK,CAAC,MAAM,EAAE,SAAS,cAAc,GAAG,SAAS;AAEtD,YAAM,OAAO,GAAG,MAAM,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,QAAQ,MAAM,GAAG,KAAK;AAEpE,aAAO;AAAA,QACL,OAAO;AAAA,QACP,OAAO,IAAI,SAAS,KAAK,GAAG,QAAQ,MAAM,GAAG,CAAC;AAAA,QAC9C,cAAc,IAAI,SAAS,KAAK,IAAI;AAAA,QACpC,MAAM,mBAAmB,SAAS;AAAA,MACpC;AAAA,IACF,CAAC;AAED,UAAM,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,EAAE,KAAK,CAAC;AAEtE,WAAO,MAAM,IAAI,CAAC,EAAE,OAAO,OAAO,aAAa,OAAO,EAAE,OAAO,OAAO,aAAa,EAAE;AAAA,EACvF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,34 +0,0 @@
1
- import { api } from '../../infra/api/client';
2
- import type { ComboboxOption } from '../../components/ui/form/ComboboxField';
3
-
4
- type CurrencyApiItem = {
5
- value: string;
6
- icon: string;
7
- title: { 'pt-br': string; 'en-us': string };
8
- description: string;
9
- };
10
-
11
- type CurrencyApiResponse = {
12
- status: number;
13
- message: string;
14
- data: CurrencyApiItem[];
15
- };
16
-
17
- const FALLBACK_CURRENCIES: ComboboxOption[] = [
18
- { value: 'BRL', label: 'Real (R$)' },
19
- { value: 'USD', label: 'Dólar Americano (US$)' },
20
- { value: 'EUR', label: 'Euro (€)' },
21
- ];
22
-
23
- export async function fetchCurrencyOptions(): Promise<ComboboxOption[]> {
24
- try {
25
- const response = await api.apps.get<CurrencyApiResponse>('/accounts/action/currencies');
26
-
27
- return response.data.map((item) => ({
28
- value: item.value,
29
- label: item.title['pt-br'] || item.title['en-us'] || item.value,
30
- }));
31
- } catch {
32
- return FALLBACK_CURRENCIES;
33
- }
34
- }
@@ -1,89 +0,0 @@
1
- import { api } from '../../infra/api/client';
2
-
3
- export type TimezoneOption = {
4
- value: string;
5
- label: string;
6
- displayValue: string;
7
- };
8
-
9
- type TimezoneApiResponse = {
10
- message: string;
11
- data: { value: string; title: string }[];
12
- };
13
-
14
- function parseOffsetMinutes(offsetStr: string): number {
15
- const match = offsetStr.match(/GMT([+-])(\d+)(?::(\d+))?/);
16
- if (!match) return 0;
17
- const sign = match[1] === '+' ? 1 : -1;
18
- return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? '0', 10));
19
- }
20
-
21
- const FALLBACK_TIMEZONES: TimezoneOption[] = [
22
- { value: 'America/Noronha', label: '(GMT-2) America/Noronha', displayValue: '(GMT-2) Noronha' },
23
- { value: 'America/Sao_Paulo', label: '(GMT-3) America/Sao Paulo', displayValue: '(GMT-3) Sao Paulo' },
24
- { value: 'America/Manaus', label: '(GMT-4) America/Manaus', displayValue: '(GMT-4) Manaus' },
25
- { value: 'America/Rio_Branco', label: '(GMT-5) America/Rio Branco', displayValue: '(GMT-5) Rio Branco' },
26
- { value: 'America/New_York', label: '(GMT-5) America/New York', displayValue: '(GMT-5) New York' },
27
- { value: 'America/Los_Angeles', label: '(GMT-8) America/Los Angeles', displayValue: '(GMT-8) Los Angeles' },
28
- { value: 'Europe/London', label: '(GMT+0) Europe/London', displayValue: '(GMT+0) London' },
29
- { value: 'Europe/Paris', label: '(GMT+1) Europe/Paris', displayValue: '(GMT+1) Paris' },
30
- { value: 'Asia/Tokyo', label: '(GMT+9) Asia/Tokyo', displayValue: '(GMT+9) Tokyo' },
31
- ];
32
-
33
- export async function fetchTimezoneOptions(): Promise<TimezoneOption[]> {
34
- try {
35
- const response = await api.apps.get<TimezoneApiResponse>('/accounts/action/timezones');
36
- const now = new Date();
37
-
38
- const items = response.data.map((item) => {
39
- const offsetStr =
40
- new Intl.DateTimeFormat('en', { timeZone: item.value, timeZoneName: 'shortOffset' })
41
- .formatToParts(now)
42
- .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';
43
-
44
- const city = item.value.split('/').slice(1).join('/').replace(/_/g, ' ') || item.value;
45
-
46
- return {
47
- value: item.value,
48
- label: `(${offsetStr}) ${item.value.replace(/_/g, ' ')}`,
49
- displayValue: `(${offsetStr}) ${city}`,
50
- sort: parseOffsetMinutes(offsetStr),
51
- };
52
- });
53
-
54
- items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
55
-
56
- return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
57
- } catch {
58
- return FALLBACK_TIMEZONES;
59
- }
60
- }
61
-
62
- export function buildTimezoneOptions(): TimezoneOption[] {
63
- try {
64
- const zones = Intl.supportedValuesOf('timeZone');
65
- const now = new Date();
66
-
67
- const items = zones.map((tz) => {
68
- const offsetStr =
69
- new Intl.DateTimeFormat('en', { timeZone: tz, timeZoneName: 'shortOffset' })
70
- .formatToParts(now)
71
- .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';
72
-
73
- const city = tz.split('/').slice(1).join('/').replace(/_/g, ' ') || tz;
74
-
75
- return {
76
- value: tz,
77
- label: `(${offsetStr}) ${tz.replace(/_/g, ' ')}`,
78
- displayValue: `(${offsetStr}) ${city}`,
79
- sort: parseOffsetMinutes(offsetStr),
80
- };
81
- });
82
-
83
- items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
84
-
85
- return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
86
- } catch {
87
- return FALLBACK_TIMEZONES;
88
- }
89
- }