@greatapps/common 1.1.428 → 1.1.429

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (477) hide show
  1. package/package.json +1 -1
  2. package/dist/components/account/AccountModals.mjs +0 -18
  3. package/dist/components/account/AccountModals.mjs.map +0 -1
  4. package/dist/components/account/ConfigurationsMyAccountModal.mjs +0 -129
  5. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +0 -1
  6. package/dist/components/account/ConfirmDeleteAccountModal.mjs +0 -45
  7. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +0 -1
  8. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +0 -45
  9. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +0 -1
  10. package/dist/components/account/DeleteAccountModal.mjs +0 -123
  11. package/dist/components/account/DeleteAccountModal.mjs.map +0 -1
  12. package/dist/components/account/DisableTwoFactorAuthModal.mjs +0 -67
  13. package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +0 -1
  14. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +0 -42
  15. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +0 -1
  16. package/dist/components/account/TwoFactorAuthModal.mjs +0 -182
  17. package/dist/components/account/TwoFactorAuthModal.mjs.map +0 -1
  18. package/dist/components/account/constants.mjs +0 -29
  19. package/dist/components/account/constants.mjs.map +0 -1
  20. package/dist/components/account/hooks/useChangeEmailForm.mjs +0 -53
  21. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +0 -1
  22. package/dist/components/account/hooks/useChangePasswordForm.mjs +0 -47
  23. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +0 -1
  24. package/dist/components/account/hooks/useChangePhoneForm.mjs +0 -91
  25. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +0 -1
  26. package/dist/components/account/hooks/useConfigurationsModal.mjs +0 -34
  27. package/dist/components/account/hooks/useConfigurationsModal.mjs.map +0 -1
  28. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +0 -54
  29. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +0 -1
  30. package/dist/components/account/hooks/useOtpVerification.mjs +0 -94
  31. package/dist/components/account/hooks/useOtpVerification.mjs.map +0 -1
  32. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +0 -80
  33. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +0 -1
  34. package/dist/components/account/sections/ChangeEmailModal.mjs +0 -181
  35. package/dist/components/account/sections/ChangeEmailModal.mjs.map +0 -1
  36. package/dist/components/account/sections/ChangePasswordSection.mjs +0 -64
  37. package/dist/components/account/sections/ChangePasswordSection.mjs.map +0 -1
  38. package/dist/components/account/sections/ChangePhoneModal.mjs +0 -192
  39. package/dist/components/account/sections/ChangePhoneModal.mjs.map +0 -1
  40. package/dist/components/account/sections/MyProfileSection.mjs +0 -317
  41. package/dist/components/account/sections/MyProfileSection.mjs.map +0 -1
  42. package/dist/components/account/sections/PreferencesSection.mjs +0 -227
  43. package/dist/components/account/sections/PreferencesSection.mjs.map +0 -1
  44. package/dist/components/account/sections/SecuritySection.mjs +0 -31
  45. package/dist/components/account/sections/SecuritySection.mjs.map +0 -1
  46. package/dist/components/embeds/CrispEmbed.mjs +0 -89
  47. package/dist/components/embeds/CrispEmbed.mjs.map +0 -1
  48. package/dist/components/embeds/FrillEmbed.mjs +0 -107
  49. package/dist/components/embeds/FrillEmbed.mjs.map +0 -1
  50. package/dist/components/handlers/SearchParamsHandler.mjs +0 -24
  51. package/dist/components/handlers/SearchParamsHandler.mjs.map +0 -1
  52. package/dist/components/layouts/AppMobileNavBar.mjs +0 -60
  53. package/dist/components/layouts/AppMobileNavBar.mjs.map +0 -1
  54. package/dist/components/layouts/AppNavBar.mjs +0 -37
  55. package/dist/components/layouts/AppNavBar.mjs.map +0 -1
  56. package/dist/components/layouts/CollapsibleSidebar.mjs +0 -65
  57. package/dist/components/layouts/CollapsibleSidebar.mjs.map +0 -1
  58. package/dist/components/layouts/MainLayout.mjs +0 -60
  59. package/dist/components/layouts/MainLayout.mjs.map +0 -1
  60. package/dist/components/layouts/MdSideBarNavigation.mjs +0 -54
  61. package/dist/components/layouts/MdSideBarNavigation.mjs.map +0 -1
  62. package/dist/components/layouts/NavBar.mjs +0 -152
  63. package/dist/components/layouts/NavBar.mjs.map +0 -1
  64. package/dist/components/layouts/NavBarItem.mjs +0 -23
  65. package/dist/components/layouts/NavBarItem.mjs.map +0 -1
  66. package/dist/components/layouts/NotificationsPopover.mjs +0 -97
  67. package/dist/components/layouts/NotificationsPopover.mjs.map +0 -1
  68. package/dist/components/layouts/ProfilePopover.mjs +0 -152
  69. package/dist/components/layouts/ProfilePopover.mjs.map +0 -1
  70. package/dist/components/layouts/SideBarNavigation.mjs +0 -63
  71. package/dist/components/layouts/SideBarNavigation.mjs.map +0 -1
  72. package/dist/components/layouts/UsersSelectorPopover.mjs +0 -210
  73. package/dist/components/layouts/UsersSelectorPopover.mjs.map +0 -1
  74. package/dist/components/layouts/WhitelabelCodes.mjs +0 -50
  75. package/dist/components/layouts/WhitelabelCodes.mjs.map +0 -1
  76. package/dist/components/modals/BuyCreditsModal.mjs +0 -281
  77. package/dist/components/modals/BuyCreditsModal.mjs.map +0 -1
  78. package/dist/components/modals/ModalManager.mjs +0 -19
  79. package/dist/components/modals/ModalManager.mjs.map +0 -1
  80. package/dist/components/modals/Modals.mjs +0 -20
  81. package/dist/components/modals/Modals.mjs.map +0 -1
  82. package/dist/components/modals/PaidPlanRequiredModal.mjs +0 -46
  83. package/dist/components/modals/PaidPlanRequiredModal.mjs.map +0 -1
  84. package/dist/components/modals/cards/AddCardModal.mjs +0 -215
  85. package/dist/components/modals/cards/AddCardModal.mjs.map +0 -1
  86. package/dist/components/modals/cards/CardFormFields.mjs +0 -268
  87. package/dist/components/modals/cards/CardFormFields.mjs.map +0 -1
  88. package/dist/components/navigation/AppNavigation.mjs +0 -33
  89. package/dist/components/navigation/AppNavigation.mjs.map +0 -1
  90. package/dist/components/navigation/AppNavigationContext.mjs +0 -13
  91. package/dist/components/navigation/AppNavigationContext.mjs.map +0 -1
  92. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +0 -52
  93. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +0 -1
  94. package/dist/components/navigation/NavItem.mjs +0 -41
  95. package/dist/components/navigation/NavItem.mjs.map +0 -1
  96. package/dist/components/navigation/NavItemsContext.mjs +0 -16
  97. package/dist/components/navigation/NavItemsContext.mjs.map +0 -1
  98. package/dist/components/navigation/ProjectSelectorPopover.mjs +0 -147
  99. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +0 -1
  100. package/dist/components/navigation/shells/DesktopShell.mjs +0 -11
  101. package/dist/components/navigation/shells/DesktopShell.mjs.map +0 -1
  102. package/dist/components/navigation/shells/MdShell.mjs +0 -11
  103. package/dist/components/navigation/shells/MdShell.mjs.map +0 -1
  104. package/dist/components/navigation/shells/MobileShell.mjs +0 -27
  105. package/dist/components/navigation/shells/MobileShell.mjs.map +0 -1
  106. package/dist/components/navigation/shells/TabsMobileShell.mjs +0 -61
  107. package/dist/components/navigation/shells/TabsMobileShell.mjs.map +0 -1
  108. package/dist/components/navigation/subcomponents/BottomLinks.mjs +0 -35
  109. package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +0 -1
  110. package/dist/components/navigation/subcomponents/CreditsCard.mjs +0 -33
  111. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +0 -1
  112. package/dist/components/navigation/subcomponents/NavItems.mjs +0 -25
  113. package/dist/components/navigation/subcomponents/NavItems.mjs.map +0 -1
  114. package/dist/components/navigation/subcomponents/PlanCard.mjs +0 -25
  115. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +0 -1
  116. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +0 -145
  117. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +0 -1
  118. package/dist/components/navigation/types.mjs +0 -1
  119. package/dist/components/navigation/types.mjs.map +0 -1
  120. package/dist/components/pages/NotFoundPage.mjs +0 -47
  121. package/dist/components/pages/NotFoundPage.mjs.map +0 -1
  122. package/dist/components/pages/notifications/Notifications.mjs +0 -156
  123. package/dist/components/pages/notifications/Notifications.mjs.map +0 -1
  124. package/dist/components/ui/buttons/Button.mjs +0 -52
  125. package/dist/components/ui/buttons/Button.mjs.map +0 -1
  126. package/dist/components/ui/buttons/CancelButton.mjs +0 -17
  127. package/dist/components/ui/buttons/CancelButton.mjs.map +0 -1
  128. package/dist/components/ui/buttons/CopyButton.mjs +0 -42
  129. package/dist/components/ui/buttons/CopyButton.mjs.map +0 -1
  130. package/dist/components/ui/data-display/Accordion.mjs +0 -76
  131. package/dist/components/ui/data-display/Accordion.mjs.map +0 -1
  132. package/dist/components/ui/data-display/Badge.mjs +0 -42
  133. package/dist/components/ui/data-display/Badge.mjs.map +0 -1
  134. package/dist/components/ui/data-display/Card.mjs +0 -92
  135. package/dist/components/ui/data-display/Card.mjs.map +0 -1
  136. package/dist/components/ui/data-display/CardBrandIcons.mjs +0 -484
  137. package/dist/components/ui/data-display/CardBrandIcons.mjs.map +0 -1
  138. package/dist/components/ui/data-display/CardItem.mjs +0 -67
  139. package/dist/components/ui/data-display/CardItem.mjs.map +0 -1
  140. package/dist/components/ui/data-display/Pagination.mjs +0 -118
  141. package/dist/components/ui/data-display/Pagination.mjs.map +0 -1
  142. package/dist/components/ui/data-display/PaymentInfoCard.mjs +0 -161
  143. package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +0 -1
  144. package/dist/components/ui/data-display/ScrollArea.mjs +0 -62
  145. package/dist/components/ui/data-display/ScrollArea.mjs.map +0 -1
  146. package/dist/components/ui/data-display/Separator.mjs +0 -28
  147. package/dist/components/ui/data-display/Separator.mjs.map +0 -1
  148. package/dist/components/ui/data-display/Table.mjs +0 -116
  149. package/dist/components/ui/data-display/Table.mjs.map +0 -1
  150. package/dist/components/ui/data-display/Tabs.mjs +0 -69
  151. package/dist/components/ui/data-display/Tabs.mjs.map +0 -1
  152. package/dist/components/ui/data-display/UserAvatar.mjs +0 -49
  153. package/dist/components/ui/data-display/UserAvatar.mjs.map +0 -1
  154. package/dist/components/ui/feedback/CircularProgress.mjs +0 -71
  155. package/dist/components/ui/feedback/CircularProgress.mjs.map +0 -1
  156. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +0 -63
  157. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +0 -1
  158. package/dist/components/ui/feedback/LoadingOverlay.mjs +0 -19
  159. package/dist/components/ui/feedback/LoadingOverlay.mjs.map +0 -1
  160. package/dist/components/ui/feedback/Progress.mjs +0 -37
  161. package/dist/components/ui/feedback/Progress.mjs.map +0 -1
  162. package/dist/components/ui/feedback/Skeleton.mjs +0 -9
  163. package/dist/components/ui/feedback/Skeleton.mjs.map +0 -1
  164. package/dist/components/ui/feedback/Toast.mjs +0 -77
  165. package/dist/components/ui/feedback/Toast.mjs.map +0 -1
  166. package/dist/components/ui/form/Calendar.mjs +0 -204
  167. package/dist/components/ui/form/Calendar.mjs.map +0 -1
  168. package/dist/components/ui/form/Checkbox.mjs +0 -33
  169. package/dist/components/ui/form/Checkbox.mjs.map +0 -1
  170. package/dist/components/ui/form/ComboboxField.mjs +0 -130
  171. package/dist/components/ui/form/ComboboxField.mjs.map +0 -1
  172. package/dist/components/ui/form/DatePicker.mjs +0 -82
  173. package/dist/components/ui/form/DatePicker.mjs.map +0 -1
  174. package/dist/components/ui/form/DateRangePicker.mjs +0 -92
  175. package/dist/components/ui/form/DateRangePicker.mjs.map +0 -1
  176. package/dist/components/ui/form/FormField.mjs +0 -103
  177. package/dist/components/ui/form/FormField.mjs.map +0 -1
  178. package/dist/components/ui/form/Input.mjs +0 -21
  179. package/dist/components/ui/form/Input.mjs.map +0 -1
  180. package/dist/components/ui/form/InputOtp.mjs +0 -70
  181. package/dist/components/ui/form/InputOtp.mjs.map +0 -1
  182. package/dist/components/ui/form/PhoneInput.mjs +0 -176
  183. package/dist/components/ui/form/PhoneInput.mjs.map +0 -1
  184. package/dist/components/ui/form/RadioGroup.mjs +0 -37
  185. package/dist/components/ui/form/RadioGroup.mjs.map +0 -1
  186. package/dist/components/ui/form/Select.mjs +0 -179
  187. package/dist/components/ui/form/Select.mjs.map +0 -1
  188. package/dist/components/ui/form/SelectField.mjs +0 -80
  189. package/dist/components/ui/form/SelectField.mjs.map +0 -1
  190. package/dist/components/ui/form/Switch.mjs +0 -33
  191. package/dist/components/ui/form/Switch.mjs.map +0 -1
  192. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +0 -40
  193. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +0 -1
  194. package/dist/components/ui/form/TextAreaField.mjs +0 -56
  195. package/dist/components/ui/form/TextAreaField.mjs.map +0 -1
  196. package/dist/components/ui/form/Textarea.mjs +0 -20
  197. package/dist/components/ui/form/Textarea.mjs.map +0 -1
  198. package/dist/components/ui/overlay/Command.mjs +0 -178
  199. package/dist/components/ui/overlay/Command.mjs.map +0 -1
  200. package/dist/components/ui/overlay/Dialog.mjs +0 -142
  201. package/dist/components/ui/overlay/Dialog.mjs.map +0 -1
  202. package/dist/components/ui/overlay/Popover.mjs +0 -46
  203. package/dist/components/ui/overlay/Popover.mjs.map +0 -1
  204. package/dist/components/ui/overlay/Sheet.mjs +0 -149
  205. package/dist/components/ui/overlay/Sheet.mjs.map +0 -1
  206. package/dist/components/ui/overlay/Tooltip.mjs +0 -57
  207. package/dist/components/ui/overlay/Tooltip.mjs.map +0 -1
  208. package/dist/components/widgets/notifications/NotificationCard.mjs +0 -54
  209. package/dist/components/widgets/notifications/NotificationCard.mjs.map +0 -1
  210. package/dist/enums/AccountSectionType.mjs +0 -11
  211. package/dist/enums/AccountSectionType.mjs.map +0 -1
  212. package/dist/hooks/copy-to-clipboard.hook.mjs +0 -52
  213. package/dist/hooks/copy-to-clipboard.hook.mjs.map +0 -1
  214. package/dist/hooks/useCountdownTimer.mjs +0 -29
  215. package/dist/hooks/useCountdownTimer.mjs.map +0 -1
  216. package/dist/hooks/useDebounce.mjs +0 -19
  217. package/dist/hooks/useDebounce.mjs.map +0 -1
  218. package/dist/hooks/useDebounceState.mjs +0 -12
  219. package/dist/hooks/useDebounceState.mjs.map +0 -1
  220. package/dist/hooks/useDebouncedEffect.mjs +0 -44
  221. package/dist/hooks/useDebouncedEffect.mjs.map +0 -1
  222. package/dist/hooks/useIsMobile.mjs +0 -18
  223. package/dist/hooks/useIsMobile.mjs.map +0 -1
  224. package/dist/hooks/usePasswordVisibility.mjs +0 -13
  225. package/dist/hooks/usePasswordVisibility.mjs.map +0 -1
  226. package/dist/index.mjs +0 -528
  227. package/dist/index.mjs.map +0 -1
  228. package/dist/infra/api/client.mjs +0 -162
  229. package/dist/infra/api/client.mjs.map +0 -1
  230. package/dist/infra/api/types.mjs +0 -31
  231. package/dist/infra/api/types.mjs.map +0 -1
  232. package/dist/infra/utils/client-info.mjs +0 -27
  233. package/dist/infra/utils/client-info.mjs.map +0 -1
  234. package/dist/infra/utils/clsx.mjs +0 -9
  235. package/dist/infra/utils/clsx.mjs.map +0 -1
  236. package/dist/infra/utils/date.mjs +0 -11
  237. package/dist/infra/utils/date.mjs.map +0 -1
  238. package/dist/infra/utils/params.mjs +0 -21
  239. package/dist/infra/utils/params.mjs.map +0 -1
  240. package/dist/infra/utils/parser.mjs +0 -24
  241. package/dist/infra/utils/parser.mjs.map +0 -1
  242. package/dist/infra/utils/percentage.mjs +0 -20
  243. package/dist/infra/utils/percentage.mjs.map +0 -1
  244. package/dist/middleware.mjs +0 -10
  245. package/dist/middleware.mjs.map +0 -1
  246. package/dist/middlewares/chain.mjs +0 -37
  247. package/dist/middlewares/chain.mjs.map +0 -1
  248. package/dist/middlewares/create-auth-middleware.mjs +0 -32
  249. package/dist/middlewares/create-auth-middleware.mjs.map +0 -1
  250. package/dist/middlewares/types.mjs +0 -11
  251. package/dist/middlewares/types.mjs.map +0 -1
  252. package/dist/modules/accounts/actions/account-management.action.mjs +0 -98
  253. package/dist/modules/accounts/actions/account-management.action.mjs.map +0 -1
  254. package/dist/modules/accounts/actions/find-current-account.action.mjs +0 -10
  255. package/dist/modules/accounts/actions/find-current-account.action.mjs.map +0 -1
  256. package/dist/modules/accounts/actions/list-currencies.action.mjs +0 -10
  257. package/dist/modules/accounts/actions/list-currencies.action.mjs.map +0 -1
  258. package/dist/modules/accounts/actions/list-timezones.action.mjs +0 -10
  259. package/dist/modules/accounts/actions/list-timezones.action.mjs.map +0 -1
  260. package/dist/modules/accounts/hooks/current-account.hook.mjs +0 -24
  261. package/dist/modules/accounts/hooks/current-account.hook.mjs.map +0 -1
  262. package/dist/modules/accounts/hooks/useAccountManagement.mjs +0 -71
  263. package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +0 -1
  264. package/dist/modules/accounts/hooks/useCurrencies.mjs +0 -17
  265. package/dist/modules/accounts/hooks/useCurrencies.mjs.map +0 -1
  266. package/dist/modules/accounts/hooks/useTimezones.mjs +0 -17
  267. package/dist/modules/accounts/hooks/useTimezones.mjs.map +0 -1
  268. package/dist/modules/accounts/hooks/useViaCep.mjs +0 -19
  269. package/dist/modules/accounts/hooks/useViaCep.mjs.map +0 -1
  270. package/dist/modules/accounts/services/account.service.mjs +0 -182
  271. package/dist/modules/accounts/services/account.service.mjs.map +0 -1
  272. package/dist/modules/accounts/services/currency.service.mjs +0 -24
  273. package/dist/modules/accounts/services/currency.service.mjs.map +0 -1
  274. package/dist/modules/accounts/services/timezone.service.mjs +0 -65
  275. package/dist/modules/accounts/services/timezone.service.mjs.map +0 -1
  276. package/dist/modules/accounts/services/two-factor.service.mjs +0 -78
  277. package/dist/modules/accounts/services/two-factor.service.mjs.map +0 -1
  278. package/dist/modules/accounts/types.mjs +0 -1
  279. package/dist/modules/accounts/types.mjs.map +0 -1
  280. package/dist/modules/auth/actions/login.action.mjs +0 -14
  281. package/dist/modules/auth/actions/login.action.mjs.map +0 -1
  282. package/dist/modules/auth/actions/logout.action.mjs +0 -14
  283. package/dist/modules/auth/actions/logout.action.mjs.map +0 -1
  284. package/dist/modules/auth/actions/register.action.mjs +0 -14
  285. package/dist/modules/auth/actions/register.action.mjs.map +0 -1
  286. package/dist/modules/auth/actions/validate-session.action.mjs +0 -48
  287. package/dist/modules/auth/actions/validate-session.action.mjs.map +0 -1
  288. package/dist/modules/auth/actions/verify-two-factor.action.mjs +0 -17
  289. package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +0 -1
  290. package/dist/modules/auth/hooks/login.hook.mjs +0 -13
  291. package/dist/modules/auth/hooks/login.hook.mjs.map +0 -1
  292. package/dist/modules/auth/hooks/logout.hook.mjs +0 -13
  293. package/dist/modules/auth/hooks/logout.hook.mjs.map +0 -1
  294. package/dist/modules/auth/hooks/register.hook.mjs +0 -13
  295. package/dist/modules/auth/hooks/register.hook.mjs.map +0 -1
  296. package/dist/modules/auth/hooks/useManagementPermissions.mjs +0 -41
  297. package/dist/modules/auth/hooks/useManagementPermissions.mjs.map +0 -1
  298. package/dist/modules/auth/hooks/useUserQuery.mjs +0 -63
  299. package/dist/modules/auth/hooks/useUserQuery.mjs.map +0 -1
  300. package/dist/modules/auth/schema.mjs +0 -1
  301. package/dist/modules/auth/schema.mjs.map +0 -1
  302. package/dist/modules/auth/services/auth.service.mjs +0 -342
  303. package/dist/modules/auth/services/auth.service.mjs.map +0 -1
  304. package/dist/modules/auth/types/management-permission.type.mjs +0 -1
  305. package/dist/modules/auth/types/management-permission.type.mjs.map +0 -1
  306. package/dist/modules/auth/utils/assert-management-permission.mjs +0 -42
  307. package/dist/modules/auth/utils/assert-management-permission.mjs.map +0 -1
  308. package/dist/modules/auth/utils/assert-management-subscription.mjs +0 -33
  309. package/dist/modules/auth/utils/assert-management-subscription.mjs.map +0 -1
  310. package/dist/modules/auth/utils/assert-paid-subscription.mjs +0 -40
  311. package/dist/modules/auth/utils/assert-paid-subscription.mjs.map +0 -1
  312. package/dist/modules/auth/utils/assert-subscription-addon.mjs +0 -35
  313. package/dist/modules/auth/utils/assert-subscription-addon.mjs.map +0 -1
  314. package/dist/modules/auth/utils/build-wl-override.mjs +0 -27
  315. package/dist/modules/auth/utils/build-wl-override.mjs.map +0 -1
  316. package/dist/modules/auth/utils/get-user-context.mjs +0 -25
  317. package/dist/modules/auth/utils/get-user-context.mjs.map +0 -1
  318. package/dist/modules/cards/actions/create-card.action.mjs +0 -10
  319. package/dist/modules/cards/actions/create-card.action.mjs.map +0 -1
  320. package/dist/modules/cards/actions/list-cards.action.mjs +0 -10
  321. package/dist/modules/cards/actions/list-cards.action.mjs.map +0 -1
  322. package/dist/modules/cards/hooks/cards.hook.mjs +0 -16
  323. package/dist/modules/cards/hooks/cards.hook.mjs.map +0 -1
  324. package/dist/modules/cards/hooks/create-card.hook.mjs +0 -18
  325. package/dist/modules/cards/hooks/create-card.hook.mjs.map +0 -1
  326. package/dist/modules/cards/services/cards.service.mjs +0 -44
  327. package/dist/modules/cards/services/cards.service.mjs.map +0 -1
  328. package/dist/modules/cards/types.mjs +0 -27
  329. package/dist/modules/cards/types.mjs.map +0 -1
  330. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +0 -10
  331. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +0 -1
  332. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +0 -76
  333. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +0 -1
  334. package/dist/modules/ia-credits/services/ia-credits.service.mjs +0 -31
  335. package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +0 -1
  336. package/dist/modules/ia-credits/types.mjs +0 -25
  337. package/dist/modules/ia-credits/types.mjs.map +0 -1
  338. package/dist/modules/plans/actions/find-plan-by-id.action.mjs +0 -10
  339. package/dist/modules/plans/actions/find-plan-by-id.action.mjs.map +0 -1
  340. package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs +0 -13
  341. package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs.map +0 -1
  342. package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs +0 -15
  343. package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs.map +0 -1
  344. package/dist/modules/plans/services/plans.service.mjs +0 -34
  345. package/dist/modules/plans/services/plans.service.mjs.map +0 -1
  346. package/dist/modules/plans/types/plan.type.mjs +0 -20
  347. package/dist/modules/plans/types/plan.type.mjs.map +0 -1
  348. package/dist/modules/projects/actions/add-project-user.action.mjs +0 -10
  349. package/dist/modules/projects/actions/add-project-user.action.mjs.map +0 -1
  350. package/dist/modules/projects/actions/list-all-account-users.action.mjs +0 -10
  351. package/dist/modules/projects/actions/list-all-account-users.action.mjs.map +0 -1
  352. package/dist/modules/projects/actions/list-available-users.action.mjs +0 -10
  353. package/dist/modules/projects/actions/list-available-users.action.mjs.map +0 -1
  354. package/dist/modules/projects/actions/list-project-users.action.mjs +0 -10
  355. package/dist/modules/projects/actions/list-project-users.action.mjs.map +0 -1
  356. package/dist/modules/projects/actions/remove-project-user.action.mjs +0 -10
  357. package/dist/modules/projects/actions/remove-project-user.action.mjs.map +0 -1
  358. package/dist/modules/projects/hooks/add-project-user.hook.mjs +0 -61
  359. package/dist/modules/projects/hooks/add-project-user.hook.mjs.map +0 -1
  360. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +0 -35
  361. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +0 -1
  362. package/dist/modules/projects/hooks/list-available-users.hook.mjs +0 -34
  363. package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +0 -1
  364. package/dist/modules/projects/hooks/list-project-users.hook.mjs +0 -34
  365. package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +0 -1
  366. package/dist/modules/projects/hooks/remove-project-user.hook.mjs +0 -61
  367. package/dist/modules/projects/hooks/remove-project-user.hook.mjs.map +0 -1
  368. package/dist/modules/projects/services/project-users.service.mjs +0 -96
  369. package/dist/modules/projects/services/project-users.service.mjs.map +0 -1
  370. package/dist/modules/projects/types.mjs +0 -23
  371. package/dist/modules/projects/types.mjs.map +0 -1
  372. package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs +0 -10
  373. package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs.map +0 -1
  374. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +0 -10
  375. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +0 -1
  376. package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs +0 -12
  377. package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs.map +0 -1
  378. package/dist/modules/subscriptions/constants/addons.constants.mjs +0 -24
  379. package/dist/modules/subscriptions/constants/addons.constants.mjs.map +0 -1
  380. package/dist/modules/subscriptions/constants/query-keys.constants.mjs +0 -5
  381. package/dist/modules/subscriptions/constants/query-keys.constants.mjs.map +0 -1
  382. package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs +0 -13
  383. package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs.map +0 -1
  384. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +0 -17
  385. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +0 -1
  386. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +0 -17
  387. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +0 -1
  388. package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs +0 -22
  389. package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs.map +0 -1
  390. package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs +0 -37
  391. package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs.map +0 -1
  392. package/dist/modules/subscriptions/services/subscriptions.service.mjs +0 -75
  393. package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +0 -1
  394. package/dist/modules/subscriptions/types/billing-period.type.mjs +0 -1
  395. package/dist/modules/subscriptions/types/billing-period.type.mjs.map +0 -1
  396. package/dist/modules/subscriptions/types/calculate-subscription.type.mjs +0 -72
  397. package/dist/modules/subscriptions/types/calculate-subscription.type.mjs.map +0 -1
  398. package/dist/modules/subscriptions/types/subscription.type.mjs +0 -57
  399. package/dist/modules/subscriptions/types/subscription.type.mjs.map +0 -1
  400. package/dist/modules/subscriptions/utils/build-plan-extras.mjs +0 -37
  401. package/dist/modules/subscriptions/utils/build-plan-extras.mjs.map +0 -1
  402. package/dist/modules/subscriptions/utils/has-subscription-expired.mjs +0 -10
  403. package/dist/modules/subscriptions/utils/has-subscription-expired.mjs.map +0 -1
  404. package/dist/modules/subscriptions/utils/periodicity.mjs +0 -48
  405. package/dist/modules/subscriptions/utils/periodicity.mjs.map +0 -1
  406. package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs +0 -14
  407. package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs.map +0 -1
  408. package/dist/modules/users/action/find-user-by-id.action.mjs +0 -10
  409. package/dist/modules/users/action/find-user-by-id.action.mjs.map +0 -1
  410. package/dist/modules/users/action/list-messages.action.mjs +0 -13
  411. package/dist/modules/users/action/list-messages.action.mjs.map +0 -1
  412. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +0 -10
  413. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +0 -1
  414. package/dist/modules/users/action/mark-message-as-read.action.mjs +0 -10
  415. package/dist/modules/users/action/mark-message-as-read.action.mjs.map +0 -1
  416. package/dist/modules/users/hooks/messages.hook.mjs +0 -57
  417. package/dist/modules/users/hooks/messages.hook.mjs.map +0 -1
  418. package/dist/modules/users/schema/messages.schema.mjs +0 -21
  419. package/dist/modules/users/schema/messages.schema.mjs.map +0 -1
  420. package/dist/modules/users/schema.mjs +0 -11
  421. package/dist/modules/users/schema.mjs.map +0 -1
  422. package/dist/modules/users/services/messages.service.mjs +0 -35
  423. package/dist/modules/users/services/messages.service.mjs.map +0 -1
  424. package/dist/modules/users/services/user.service.mjs +0 -52
  425. package/dist/modules/users/services/user.service.mjs.map +0 -1
  426. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +0 -21
  427. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +0 -1
  428. package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs +0 -19
  429. package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs.map +0 -1
  430. package/dist/modules/whitelabel/schema.mjs +0 -1
  431. package/dist/modules/whitelabel/schema.mjs.map +0 -1
  432. package/dist/modules/whitelabel/services/whitelabel.service.mjs +0 -146
  433. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +0 -1
  434. package/dist/modules/whitelabel/utils/normalize-hostname.mjs +0 -35
  435. package/dist/modules/whitelabel/utils/normalize-hostname.mjs.map +0 -1
  436. package/dist/providers/auth.provider.mjs +0 -114
  437. package/dist/providers/auth.provider.mjs.map +0 -1
  438. package/dist/providers/query.provider.mjs +0 -99
  439. package/dist/providers/query.provider.mjs.map +0 -1
  440. package/dist/providers/whitelabel.provider.mjs +0 -42
  441. package/dist/providers/whitelabel.provider.mjs.map +0 -1
  442. package/dist/server.mjs +0 -111
  443. package/dist/server.mjs.map +0 -1
  444. package/dist/store/useAccountModals.mjs +0 -18
  445. package/dist/store/useAccountModals.mjs.map +0 -1
  446. package/dist/store/useBuyCreditsModal.mjs +0 -16
  447. package/dist/store/useBuyCreditsModal.mjs.map +0 -1
  448. package/dist/store/useDesktopSidebarStore.mjs +0 -39
  449. package/dist/store/useDesktopSidebarStore.mjs.map +0 -1
  450. package/dist/store/useMdSidebarStore.mjs +0 -28
  451. package/dist/store/useMdSidebarStore.mjs.map +0 -1
  452. package/dist/store/useMobileNavbarSheet.mjs +0 -14
  453. package/dist/store/useMobileNavbarSheet.mjs.map +0 -1
  454. package/dist/store/useModalManager.mjs +0 -75
  455. package/dist/store/useModalManager.mjs.map +0 -1
  456. package/dist/store/usePaidPlanRequiredModal.mjs +0 -14
  457. package/dist/store/usePaidPlanRequiredModal.mjs.map +0 -1
  458. package/dist/utils/browser/clipboard.mjs +0 -36
  459. package/dist/utils/browser/clipboard.mjs.map +0 -1
  460. package/dist/utils/constants/br-states.mjs +0 -33
  461. package/dist/utils/constants/br-states.mjs.map +0 -1
  462. package/dist/utils/countries.mjs +0 -219
  463. package/dist/utils/countries.mjs.map +0 -1
  464. package/dist/utils/file/index.mjs +0 -9
  465. package/dist/utils/file/index.mjs.map +0 -1
  466. package/dist/utils/format/masks.mjs +0 -67
  467. package/dist/utils/format/masks.mjs.map +0 -1
  468. package/dist/utils/intl/locales.mjs +0 -12
  469. package/dist/utils/intl/locales.mjs.map +0 -1
  470. package/dist/utils/safeServerAction.mjs +0 -16
  471. package/dist/utils/safeServerAction.mjs.map +0 -1
  472. package/dist/utils/validators/account.mjs +0 -27
  473. package/dist/utils/validators/account.mjs.map +0 -1
  474. package/dist/utils/validators/common.mjs +0 -47
  475. package/dist/utils/validators/common.mjs.map +0 -1
  476. package/dist/utils/withAction.mjs +0 -13
  477. package/dist/utils/withAction.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/actions/login.action.ts"],"sourcesContent":["\"use server\";\r\n\r\nimport { safeServerAction } from \"../../../utils/safeServerAction\";\r\nimport { authService } from \"../services/auth.service\";\r\nimport { LoginRequest } from \"../schema\";\r\nimport { getClientInfoFromRequest } from \"../../../infra/utils/client-info\";\r\n\r\nexport async function loginAction(credentials: LoginRequest) {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.login(credentials, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAE5B,SAAS,gCAAgC;AAEzC,eAAsB,YAAY,aAA2B;AAC3D,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,MAAM,aAAa,UAAU;AAAA,EAClD,CAAC;AACH;","names":[]}
@@ -1,14 +0,0 @@
1
- "use server";
2
- import { safeServerAction } from "../../../utils/safeServerAction";
3
- import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
4
- import { authService } from "../services/auth.service";
5
- async function logoutAction() {
6
- return safeServerAction(async () => {
7
- const clientInfo = await getClientInfoFromRequest();
8
- return authService.logout(clientInfo);
9
- });
10
- }
11
- export {
12
- logoutAction
13
- };
14
- //# sourceMappingURL=logout.action.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/actions/logout.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\nimport { authService } from '../services/auth.service';\r\n\r\nexport async function logoutAction() {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.logout(clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,mBAAmB;AAE5B,eAAsB,eAAe;AACnC,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,OAAO,UAAU;AAAA,EACtC,CAAC;AACH;","names":[]}
@@ -1,14 +0,0 @@
1
- "use server";
2
- import { safeServerAction } from "../../../utils/safeServerAction";
3
- import { authService } from "../services/auth.service";
4
- import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
5
- async function registerAction(data) {
6
- return safeServerAction(async () => {
7
- const clientInfo = await getClientInfoFromRequest();
8
- return authService.register(data, clientInfo);
9
- });
10
- }
11
- export {
12
- registerAction
13
- };
14
- //# sourceMappingURL=register.action.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/actions/register.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { RegisterRequest } from '../schema';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nexport async function registerAction(data: RegisterRequest) {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.register(data, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAsB,eAAe,MAAuB;AAC1D,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,SAAS,MAAM,UAAU;AAAA,EAC9C,CAAC;AACH;","names":[]}
@@ -1,48 +0,0 @@
1
- "use server";
2
- import { redirect } from "next/navigation";
3
- import { cookies, headers } from "next/headers";
4
- import { authService } from "../services/auth.service";
5
- import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
6
- async function redirectToLogin() {
7
- const h = await headers();
8
- const referer = h.get("referer");
9
- if (!referer) {
10
- redirect("/login");
11
- return;
12
- }
13
- const url = new URL(referer);
14
- if (["/login", "/register", "/forgot-password"].includes(url.pathname)) {
15
- return;
16
- }
17
- const loginUrl = new URL("/login", url.origin);
18
- loginUrl.searchParams.set("redirect", url.pathname + url.search);
19
- redirect(loginUrl.toString());
20
- }
21
- async function validateSessionAction() {
22
- if (process.env.DUMMY_AUTH_TOKEN) return true;
23
- const cookieStore = await cookies();
24
- const cookie = cookieStore.get("greatapps")?.value;
25
- if (!cookie) {
26
- await redirectToLogin();
27
- return false;
28
- }
29
- try {
30
- const clientInfo = await getClientInfoFromRequest();
31
- const isValid = await authService.validateSession(clientInfo);
32
- if (!isValid) {
33
- await authService.removeAuthCookie();
34
- await redirectToLogin();
35
- return false;
36
- }
37
- return true;
38
- } catch (error) {
39
- console.error("[validateSessionAction] Error:", error);
40
- await authService.removeAuthCookie();
41
- await redirectToLogin();
42
- return false;
43
- }
44
- }
45
- export {
46
- validateSessionAction
47
- };
48
- //# sourceMappingURL=validate-session.action.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/actions/validate-session.action.ts"],"sourcesContent":["'use server';\n\nimport { redirect } from 'next/navigation';\nimport { cookies, headers } from 'next/headers';\nimport { authService } from '../services/auth.service';\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\n\nasync function redirectToLogin() {\n const h = await headers();\n const referer = h.get('referer');\n\n if (!referer) {\n redirect('/login');\n return;\n }\n\n const url = new URL(referer);\n\n if (['/login', '/register', '/forgot-password'].includes(url.pathname)) {\n return;\n }\n\n const loginUrl = new URL('/login', url.origin);\n loginUrl.searchParams.set('redirect', url.pathname + url.search);\n redirect(loginUrl.toString());\n}\n\nexport async function validateSessionAction(): Promise<boolean> {\n if (process.env.DUMMY_AUTH_TOKEN) return true;\n\n const cookieStore = await cookies();\n const cookie = cookieStore.get('greatapps')?.value;\n\n if (!cookie) {\n await redirectToLogin();\n return false;\n }\n\n try {\n const clientInfo = await getClientInfoFromRequest();\n const isValid = await authService.validateSession(clientInfo);\n\n if (!isValid) {\n await authService.removeAuthCookie();\n await redirectToLogin();\n return false;\n }\n\n return true;\n } catch (error) {\n console.error('[validateSessionAction] Error:', error);\n await authService.removeAuthCookie();\n await redirectToLogin();\n return false;\n }\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,SAAS,eAAe;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAe,kBAAkB;AAC/B,QAAM,IAAI,MAAM,QAAQ;AACxB,QAAM,UAAU,EAAE,IAAI,SAAS;AAE/B,MAAI,CAAC,SAAS;AACZ,aAAS,QAAQ;AACjB;AAAA,EACF;AAEA,QAAM,MAAM,IAAI,IAAI,OAAO;AAE3B,MAAI,CAAC,UAAU,aAAa,kBAAkB,EAAE,SAAS,IAAI,QAAQ,GAAG;AACtE;AAAA,EACF;AAEA,QAAM,WAAW,IAAI,IAAI,UAAU,IAAI,MAAM;AAC7C,WAAS,aAAa,IAAI,YAAY,IAAI,WAAW,IAAI,MAAM;AAC/D,WAAS,SAAS,SAAS,CAAC;AAC9B;AAEA,eAAsB,wBAA0C;AAC9D,MAAI,QAAQ,IAAI,iBAAkB,QAAO;AAEzC,QAAM,cAAc,MAAM,QAAQ;AAClC,QAAM,SAAS,YAAY,IAAI,WAAW,GAAG;AAE7C,MAAI,CAAC,QAAQ;AACX,UAAM,gBAAgB;AACtB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,aAAa,MAAM,yBAAyB;AAClD,UAAM,UAAU,MAAM,YAAY,gBAAgB,UAAU;AAE5D,QAAI,CAAC,SAAS;AACZ,YAAM,YAAY,iBAAiB;AACnC,YAAM,gBAAgB;AACtB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,kCAAkC,KAAK;AACrD,UAAM,YAAY,iBAAiB;AACnC,UAAM,gBAAgB;AACtB,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,17 +0,0 @@
1
- "use server";
2
- import { safeServerAction } from "../../../utils/safeServerAction";
3
- import { authService } from "../services/auth.service";
4
- import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
5
- async function verifyTwoFactorAction(cookie, code, window) {
6
- return safeServerAction(async () => {
7
- if (!/^\d{6}$/.test(code)) {
8
- throw new Error("Formato inv\xE1lido");
9
- }
10
- const clientInfo = await getClientInfoFromRequest();
11
- await authService.verifyTwoFactor(cookie, code, clientInfo, window !== void 0 ? { window } : void 0);
12
- });
13
- }
14
- export {
15
- verifyTwoFactorAction
16
- };
17
- //# sourceMappingURL=verify-two-factor.action.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/actions/verify-two-factor.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nexport async function verifyTwoFactorAction(cookie: string, code: string, window?: number) {\r\n return safeServerAction(async () => {\r\n if (!/^\\d{6}$/.test(code)) {\r\n throw new Error('Formato inválido');\r\n }\r\n const clientInfo = await getClientInfoFromRequest();\r\n await authService.verifyTwoFactor(cookie, code, clientInfo, window !== undefined ? { window } : undefined);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAsB,sBAAsB,QAAgB,MAAc,QAAiB;AACzF,SAAO,iBAAiB,YAAY;AAClC,QAAI,CAAC,UAAU,KAAK,IAAI,GAAG;AACzB,YAAM,IAAI,MAAM,qBAAkB;AAAA,IACpC;AACA,UAAM,aAAa,MAAM,yBAAyB;AAClD,UAAM,YAAY,gBAAgB,QAAQ,MAAM,YAAY,WAAW,SAAY,EAAE,OAAO,IAAI,MAAS;AAAA,EAC3G,CAAC;AACH;","names":[]}
@@ -1,13 +0,0 @@
1
- "use client";
2
- import { useMutation } from "@tanstack/react-query";
3
- import { loginAction } from "../actions/login.action";
4
- import { withAction } from "../../../utils/withAction";
5
- function useLogin() {
6
- return useMutation({
7
- mutationFn: (credentials) => withAction(loginAction)(credentials)
8
- });
9
- }
10
- export {
11
- useLogin
12
- };
13
- //# sourceMappingURL=login.hook.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/hooks/login.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { loginAction } from \"../actions/login.action\";\nimport { LoginRequest, LoginSuccessResponse } from \"../schema\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useLogin() {\n return useMutation({\n mutationFn: (credentials: LoginRequest) =>\n withAction(loginAction)(credentials) as Promise<LoginSuccessResponse>,\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAE5B,SAAS,kBAAkB;AAEpB,SAAS,WAAW;AACzB,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,gBACX,WAAW,WAAW,EAAE,WAAW;AAAA,EACvC,CAAC;AACH;","names":[]}
@@ -1,13 +0,0 @@
1
- "use client";
2
- import { useMutation } from "@tanstack/react-query";
3
- import { logoutAction } from "../actions/logout.action";
4
- import { withAction } from "../../../utils/withAction";
5
- function useLogout() {
6
- return useMutation({
7
- mutationFn: withAction(logoutAction)
8
- });
9
- }
10
- export {
11
- useLogout
12
- };
13
- //# sourceMappingURL=logout.hook.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/hooks/logout.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { logoutAction } from \"../actions/logout.action\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useLogout() {\n return useMutation({\n mutationFn: withAction(logoutAction),\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,SAAS,YAAY;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,YAAY;AAAA,EACrC,CAAC;AACH;","names":[]}
@@ -1,13 +0,0 @@
1
- "use client";
2
- import { useMutation } from "@tanstack/react-query";
3
- import { registerAction } from "../actions/register.action";
4
- import { withAction } from "../../../utils/withAction";
5
- function useRegister() {
6
- return useMutation({
7
- mutationFn: withAction(registerAction)
8
- });
9
- }
10
- export {
11
- useRegister
12
- };
13
- //# sourceMappingURL=register.hook.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/hooks/register.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { registerAction } from \"../actions/register.action\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useRegister() {\n return useMutation({\n mutationFn: withAction(registerAction),\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAEpB,SAAS,cAAc;AAC5B,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,cAAc;AAAA,EACvC,CAAC;AACH;","names":[]}
@@ -1,41 +0,0 @@
1
- "use client";
2
- import { UserProfile } from "../../users/schema";
3
- import { useAuth } from "../../../providers/auth.provider";
4
- function useManagementPermissions() {
5
- const { user } = useAuth();
6
- const profile = user?.profile;
7
- const isAdmin = profile === UserProfile.admin;
8
- const isOwner = profile === UserProfile.owner;
9
- const isOwnerOrAdmin = isOwner || isAdmin;
10
- const isViewer = profile === UserProfile.viewer;
11
- const isCollaborator = profile === UserProfile.collaborator;
12
- const canManage = !isViewer;
13
- const hasPermission = (permission) => {
14
- switch (permission) {
15
- case "manage_pages":
16
- case "manage_redirects":
17
- case "manage_ab_tests":
18
- case "restore_pages":
19
- return !isViewer;
20
- case "manage_domains":
21
- case "manage_projects":
22
- return isOwnerOrAdmin;
23
- default:
24
- return false;
25
- }
26
- };
27
- return {
28
- profile,
29
- isAdmin,
30
- isOwner,
31
- isOwnerOrAdmin,
32
- isViewer,
33
- isCollaborator,
34
- canManage,
35
- hasPermission
36
- };
37
- }
38
- export {
39
- useManagementPermissions
40
- };
41
- //# sourceMappingURL=useManagementPermissions.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/hooks/useManagementPermissions.ts"],"sourcesContent":["'use client';\n\nimport { UserProfile } from '../../users/schema';\nimport { useAuth } from '../../../providers/auth.provider';\nimport type { ManagementPermission } from '../types/management-permission.type';\n\nexport { type ManagementPermission } from '../types/management-permission.type';\n\nexport function useManagementPermissions() {\n const { user } = useAuth();\n const profile = user?.profile;\n\n const isAdmin = profile === UserProfile.admin;\n const isOwner = profile === UserProfile.owner;\n const isOwnerOrAdmin = isOwner || isAdmin;\n const isViewer = profile === UserProfile.viewer;\n const isCollaborator = profile === UserProfile.collaborator;\n const canManage = !isViewer;\n\n const hasPermission = (permission: ManagementPermission) => {\n switch (permission) {\n case 'manage_pages':\n case 'manage_redirects':\n case 'manage_ab_tests':\n case 'restore_pages':\n return !isViewer;\n case 'manage_domains':\n case 'manage_projects':\n return isOwnerOrAdmin;\n default:\n return false;\n }\n };\n\n return {\n profile,\n isAdmin,\n isOwner,\n isOwnerOrAdmin,\n isViewer,\n isCollaborator,\n canManage,\n hasPermission,\n };\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAKjB,SAAS,2BAA2B;AACzC,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,UAAU,MAAM;AAEtB,QAAM,UAAU,YAAY,YAAY;AACxC,QAAM,UAAU,YAAY,YAAY;AACxC,QAAM,iBAAiB,WAAW;AAClC,QAAM,WAAW,YAAY,YAAY;AACzC,QAAM,iBAAiB,YAAY,YAAY;AAC/C,QAAM,YAAY,CAAC;AAEnB,QAAM,gBAAgB,CAAC,eAAqC;AAC1D,YAAQ,YAAY;AAAA,MAClB,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO,CAAC;AAAA,MACV,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,63 +0,0 @@
1
- "use client";
2
- import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
- import { withAction } from "../../../utils/withAction";
4
- const USER_QUERY_KEY = ["user"];
5
- async function fetchUser() {
6
- const { findUserById: getUserDataAction } = await import("../../users/action/find-user-by-id.action");
7
- const result = await getUserDataAction();
8
- return result.success && result.data ? result.data : null;
9
- }
10
- async function validateUserSession() {
11
- const { validateSessionAction } = await import("../actions/validate-session.action");
12
- return await validateSessionAction();
13
- }
14
- function useUserQuery() {
15
- return useQuery({
16
- queryKey: USER_QUERY_KEY,
17
- queryFn: fetchUser,
18
- staleTime: 5 * 60 * 1e3,
19
- gcTime: 10 * 60 * 1e3,
20
- retry: false
21
- });
22
- }
23
- function useUserValidateSession(options) {
24
- return useQuery({
25
- queryKey: ["user-validate-session"],
26
- queryFn: validateUserSession,
27
- retry: false,
28
- staleTime: 5 * 60 * 1e3,
29
- ...options,
30
- refetchOnMount: "always",
31
- refetchOnWindowFocus: true
32
- });
33
- }
34
- function useTwoFactorVerify() {
35
- const queryClient = useQueryClient();
36
- return useMutation({
37
- mutationFn: async ({ cookie, code, window }) => {
38
- const { verifyTwoFactorAction } = await import("../actions/verify-two-factor.action");
39
- return withAction(() => verifyTwoFactorAction(cookie, code, window))();
40
- },
41
- onSuccess: () => {
42
- queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
43
- queryClient.invalidateQueries({ queryKey: ["two-factor-pending"] });
44
- }
45
- });
46
- }
47
- function useInvalidateUser() {
48
- const queryClient = useQueryClient();
49
- return () => queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
50
- }
51
- function useSetUserData() {
52
- const queryClient = useQueryClient();
53
- return (user) => queryClient.setQueryData(USER_QUERY_KEY, user);
54
- }
55
- export {
56
- USER_QUERY_KEY,
57
- useInvalidateUser,
58
- useSetUserData,
59
- useTwoFactorVerify,
60
- useUserQuery,
61
- useUserValidateSession
62
- };
63
- //# sourceMappingURL=useUserQuery.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/modules/auth/hooks/useUserQuery.ts"],"sourcesContent":["'use client';\r\n\r\nimport { useMutation, useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query';\r\nimport { User } from '../../users/schema';\r\nimport { withAction } from '../../../utils/withAction';\r\n\r\nexport const USER_QUERY_KEY = ['user'];\r\n\r\nasync function fetchUser(): Promise<User | null> {\r\n const { findUserById: getUserDataAction } = await import('../../users/action/find-user-by-id.action');\r\n const result = await getUserDataAction();\r\n return result.success && result.data ? result.data : null;\r\n}\r\n\r\nasync function validateUserSession(): Promise<boolean> {\r\n const { validateSessionAction } = await import('../actions/validate-session.action');\r\n return await validateSessionAction();\r\n}\r\n\r\nexport function useUserQuery() {\r\n return useQuery({\r\n queryKey: USER_QUERY_KEY,\r\n queryFn: fetchUser,\r\n staleTime: 5 * 60 * 1000,\r\n gcTime: 10 * 60 * 1000,\r\n retry: false,\r\n });\r\n}\r\n\r\nexport function useUserValidateSession(options?: UseQueryOptions) {\r\n return useQuery({\r\n queryKey: ['user-validate-session'],\r\n queryFn: validateUserSession,\r\n retry: false,\r\n staleTime: 5 * 60 * 1000,\r\n ...options,\r\n refetchOnMount: 'always',\r\n refetchOnWindowFocus: true,\r\n });\r\n}\r\n\r\nexport function useTwoFactorVerify() {\r\n const queryClient = useQueryClient();\r\n\r\n return useMutation({\r\n mutationFn: async ({ cookie, code, window }: { cookie: string; code: string; window?: number }) => {\r\n const { verifyTwoFactorAction } = await import('../actions/verify-two-factor.action');\r\n return withAction(() => verifyTwoFactorAction(cookie, code, window))();\r\n },\r\n onSuccess: () => {\r\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\r\n queryClient.invalidateQueries({ queryKey: ['two-factor-pending'] });\r\n },\r\n });\r\n}\r\n\r\nexport function useInvalidateUser() {\r\n const queryClient = useQueryClient();\r\n return () => queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\r\n}\r\n\r\nexport function useSetUserData() {\r\n const queryClient = useQueryClient();\r\n return (user: User | null) => queryClient.setQueryData(USER_QUERY_KEY, user);\r\n}\r\n"],"mappings":";AAEA,SAAS,aAAa,UAAU,sBAAuC;AAEvE,SAAS,kBAAkB;AAEpB,MAAM,iBAAiB,CAAC,MAAM;AAErC,eAAe,YAAkC;AAC/C,QAAM,EAAE,cAAc,kBAAkB,IAAI,MAAM,OAAO,2CAA2C;AACpG,QAAM,SAAS,MAAM,kBAAkB;AACvC,SAAO,OAAO,WAAW,OAAO,OAAO,OAAO,OAAO;AACvD;AAEA,eAAe,sBAAwC;AACrD,QAAM,EAAE,sBAAsB,IAAI,MAAM,OAAO,oCAAoC;AACnF,SAAO,MAAM,sBAAsB;AACrC;AAEO,SAAS,eAAe;AAC7B,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS;AAAA,IACT,WAAW,IAAI,KAAK;AAAA,IACpB,QAAQ,KAAK,KAAK;AAAA,IAClB,OAAO;AAAA,EACT,CAAC;AACH;AAEO,SAAS,uBAAuB,SAA2B;AAChE,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,uBAAuB;AAAA,IAClC,SAAS;AAAA,IACT,OAAO;AAAA,IACP,WAAW,IAAI,KAAK;AAAA,IACpB,GAAG;AAAA,IACH,gBAAgB;AAAA,IAChB,sBAAsB;AAAA,EACxB,CAAC;AACH;AAEO,SAAS,qBAAqB;AACnC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,OAAO,EAAE,QAAQ,MAAM,OAAO,MAAyD;AACjG,YAAM,EAAE,sBAAsB,IAAI,MAAM,OAAO,qCAAqC;AACpF,aAAO,WAAW,MAAM,sBAAsB,QAAQ,MAAM,MAAM,CAAC,EAAE;AAAA,IACvE;AAAA,IACA,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,eAAe,CAAC;AAC1D,kBAAY,kBAAkB,EAAE,UAAU,CAAC,oBAAoB,EAAE,CAAC;AAAA,IACpE;AAAA,EACF,CAAC;AACH;AAEO,SAAS,oBAAoB;AAClC,QAAM,cAAc,eAAe;AACnC,SAAO,MAAM,YAAY,kBAAkB,EAAE,UAAU,eAAe,CAAC;AACzE;AAEO,SAAS,iBAAiB;AAC/B,QAAM,cAAc,eAAe;AACnC,SAAO,CAAC,SAAsB,YAAY,aAAa,gBAAgB,IAAI;AAC7E;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=schema.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,342 +0,0 @@
1
- import { cookies } from "next/headers";
2
- import { api } from "../../../infra/api/client";
3
- import { ApiError } from "../../../infra/api/types";
4
- import { whitelabelService } from "../../whitelabel/services/whitelabel.service";
5
- import { buildWlOverrideFromJwt } from "../utils/build-wl-override";
6
- import { findWhitelabel } from "../../../server";
7
- const AUTH_COOKIE_NAME = "greatapps";
8
- const COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
9
- const COOKIE_OPTIONS = {
10
- httpOnly: true,
11
- secure: process.env.NODE_ENV === "production",
12
- sameSite: "lax",
13
- path: "/",
14
- domain: process.env.NEXT_PUBLIC_DOMAIN_COOKIE
15
- };
16
- class AuthService {
17
- async login(credentials, clientInfo) {
18
- let requestConfig;
19
- if (credentials.id_wl) {
20
- const wlToken = await whitelabelService.getTokenByWhitelabelId(
21
- credentials.id_wl
22
- );
23
- requestConfig = { whiteLabelId: credentials.id_wl, authToken: wlToken };
24
- }
25
- const response = await api.apps.post(
26
- "/auth/login",
27
- {
28
- email: credentials.email,
29
- password: credentials.password,
30
- source: credentials?.source,
31
- location: clientInfo.location,
32
- ip: clientInfo.ip,
33
- timezone: clientInfo.timezone,
34
- agent: clientInfo.agent
35
- },
36
- requestConfig
37
- );
38
- if (response.status === 0) {
39
- throw new ApiError(
40
- response.message || "E-mail ou senha incorretos",
41
- response.code || "LOGIN_FAILED",
42
- 401
43
- );
44
- }
45
- if (!response.cookie) {
46
- throw new ApiError(
47
- "Resposta de autentica\xE7\xE3o inv\xE1lida",
48
- "INVALID_RESPONSE",
49
- 500
50
- );
51
- }
52
- if (response.two_factor_required) {
53
- return { result: "two_factor_required", cookie: response.cookie, twoFactorMode: response.two_factor_required };
54
- }
55
- await this.setAuthCookie(response.cookie);
56
- const [{ userService }, { accountService }] = await Promise.all([
57
- import("../../users/services/user.service"),
58
- import("../../accounts/services/account.service")
59
- ]);
60
- const [user, account] = await Promise.all([
61
- userService.findById(
62
- requestConfig ? { authToken: requestConfig.authToken } : void 0
63
- ),
64
- accountService.findCurrentAccount(requestConfig)
65
- ]);
66
- return {
67
- result: "success",
68
- user,
69
- account,
70
- accessToken: response.cookie,
71
- refreshToken: "",
72
- expiresAt: new Date(Date.now() + COOKIE_MAX_AGE * 1e3).toISOString()
73
- };
74
- }
75
- async verifyTwoFactor(cookie, code, clientInfo, options) {
76
- const payload = {
77
- location: clientInfo.location,
78
- ip: clientInfo.ip,
79
- timezone: clientInfo.timezone,
80
- agent: clientInfo.agent,
81
- cookie,
82
- code
83
- };
84
- const endpoint = options?.window !== void 0 ? `/auth/code?window=${options.window}` : "/auth/code";
85
- const response = await api.apps.post(
86
- endpoint,
87
- payload
88
- );
89
- if (response.status === 0) {
90
- throw new ApiError("C\xF3digo 2FA inv\xE1lido", "TWO_FACTOR_FAILED", 401);
91
- }
92
- if (!response?.data?.cookie) {
93
- throw new ApiError(
94
- "Resposta de autentica\xE7\xE3o inv\xE1lida ap\xF3s 2FA",
95
- "INVALID_RESPONSE",
96
- 500
97
- );
98
- }
99
- await this.setAuthCookie(response.data.cookie);
100
- return { status: 1 };
101
- }
102
- async register(data, clientInfo) {
103
- const today = /* @__PURE__ */ new Date();
104
- const trialEndDate = new Date(today);
105
- trialEndDate.setDate(today.getDate() + 7);
106
- const idPlan = await this.resolvePlanId(data.idPlan);
107
- const payload = {
108
- name: data.accountName,
109
- bussiness_type: data.businessType ?? 0,
110
- language: "pt-br",
111
- timezone: "America/Sao_Paulo",
112
- currency: "BRL",
113
- location: clientInfo.location,
114
- ip: clientInfo.ip,
115
- agent: clientInfo.agent,
116
- user: {
117
- id_api: "",
118
- name: data.name,
119
- last_name: data.lastName || "",
120
- rg: data.rg || "",
121
- cpf: data.cpf || "",
122
- gender: data.gender,
123
- email: data.email,
124
- phone: data.phone,
125
- password: data.password,
126
- profile: "owner",
127
- language: "pt-br"
128
- },
129
- subscription: idPlan == -1 ? {
130
- type: "free",
131
- id_cupom: data.couponCode || "",
132
- id_plan: 5,
133
- // Plano Free (ID fixo)
134
- id_product: 1
135
- } : {
136
- type: "trial",
137
- id_cupom: data.couponCode || "",
138
- id_plan: idPlan,
139
- due_date: trialEndDate.toISOString().split("T")[0],
140
- id_product: 1
141
- }
142
- };
143
- const response = await api.apps.post(
144
- "/accounts",
145
- payload
146
- );
147
- if (response.status === 0) {
148
- throw new ApiError(
149
- response.message || "Erro ao criar conta",
150
- "REGISTER_FAILED",
151
- 400
152
- );
153
- }
154
- if (!response.data || response.data.length === 0) {
155
- throw new ApiError(
156
- "Resposta de registro inv\xE1lida",
157
- "INVALID_RESPONSE",
158
- 500
159
- );
160
- }
161
- if (!response.cookie) {
162
- throw new ApiError(
163
- "Resposta de autentica\xE7\xE3o inv\xE1lida",
164
- "INVALID_RESPONSE",
165
- 500
166
- );
167
- }
168
- const accountData = response.data[0];
169
- await this.setAuthCookie(response.cookie);
170
- const [{ userService }, { accountService }] = await Promise.all([
171
- import("../../users/services/user.service"),
172
- import("../../accounts/services/account.service")
173
- ]);
174
- const [user, account] = await Promise.all([
175
- userService.findById(),
176
- accountService.findCurrentAccount()
177
- ]);
178
- return {
179
- user,
180
- account,
181
- accessToken: response.cookie,
182
- refreshToken: "",
183
- expiresAt: new Date(Date.now() + COOKIE_MAX_AGE * 1e3).toISOString(),
184
- requiresEmailVerification: !accountData.verified
185
- };
186
- }
187
- async logout(clientInfo) {
188
- const cookie = await this.getToken();
189
- if (!cookie) {
190
- throw new ApiError(
191
- "Usu\xE1rio n\xE3o autenticado",
192
- "NOT_AUTHENTICATED_LOGOUT",
193
- 401
194
- );
195
- }
196
- const payload = {
197
- location: clientInfo.location,
198
- ip: clientInfo.ip,
199
- timezone: clientInfo.timezone,
200
- agent: clientInfo.agent,
201
- cookie
202
- };
203
- try {
204
- const response = await api.apps.post(
205
- "/auth/logout",
206
- payload
207
- );
208
- if (response.status === 0) {
209
- throw new ApiError(
210
- response.message || "Erro ao realizar logout",
211
- response.code || "LOGOUT_FAILED",
212
- 400
213
- );
214
- }
215
- } finally {
216
- await this.removeAuthCookie();
217
- }
218
- return {
219
- success: true
220
- };
221
- }
222
- async forgotPassword(_data) {
223
- throw new ApiError(
224
- "Recupera\xE7\xE3o de senha n\xE3o implementada",
225
- "NOT_IMPLEMENTED",
226
- 501
227
- );
228
- }
229
- async resetPassword(_data) {
230
- throw new ApiError(
231
- "Redefini\xE7\xE3o de senha n\xE3o implementada",
232
- "NOT_IMPLEMENTED",
233
- 501
234
- );
235
- }
236
- async verifyEmail(_data) {
237
- throw new ApiError(
238
- "Verifica\xE7\xE3o de email n\xE3o implementada",
239
- "NOT_IMPLEMENTED",
240
- 501
241
- );
242
- }
243
- async resendVerification(_data) {
244
- throw new ApiError(
245
- "Reenvio de verifica\xE7\xE3o n\xE3o implementado",
246
- "NOT_IMPLEMENTED",
247
- 501
248
- );
249
- }
250
- async validateSession(clientInfo) {
251
- const cookie = await this.getToken();
252
- if (!cookie) {
253
- return false;
254
- }
255
- try {
256
- const requestConfig = await buildWlOverrideFromJwt(cookie);
257
- const payload = {
258
- location: clientInfo.location,
259
- ip: clientInfo.ip,
260
- timezone: clientInfo.timezone,
261
- agent: clientInfo.agent,
262
- cookie
263
- };
264
- const response = await api.apps.post(
265
- "/auth/keep",
266
- payload,
267
- requestConfig
268
- );
269
- return response.status === 1;
270
- } catch (error) {
271
- console.error("[AuthService] validateSession error", error);
272
- return false;
273
- }
274
- }
275
- async isAuthenticated() {
276
- const token = await this.getToken();
277
- return !!token;
278
- }
279
- async getToken() {
280
- if (process.env.DUMMY_AUTH_TOKEN) return process.env.DUMMY_AUTH_TOKEN;
281
- const cookieStore = await cookies();
282
- return cookieStore.get(AUTH_COOKIE_NAME)?.value;
283
- }
284
- async resolvePlanId(idPlan) {
285
- if (typeof idPlan === "number" || Number(idPlan)) return Number(idPlan);
286
- if (typeof idPlan === "string") {
287
- const response = await api.apps.get(
288
- `/plans?search=${encodeURIComponent(idPlan)}`
289
- );
290
- if (response.status === 1 && response.data?.length) {
291
- return response.data[0].id;
292
- }
293
- throw new ApiError(
294
- `Plano "${idPlan}" n\xE3o encontrado`,
295
- "PLAN_NOT_FOUND",
296
- 404
297
- );
298
- }
299
- return -1;
300
- }
301
- async setAuthCookie(token) {
302
- const cookieStore = await cookies();
303
- const whitelabel = await findWhitelabel().catch(() => null);
304
- const cookieDomain = this.normalizeCookieDomain(whitelabel?.domain) ?? this.normalizeCookieDomain(process.env.NEXT_PUBLIC_DOMAIN_COOKIE);
305
- cookieStore.set(AUTH_COOKIE_NAME, token, {
306
- ...COOKIE_OPTIONS,
307
- ...cookieDomain ? { domain: cookieDomain } : {},
308
- maxAge: COOKIE_MAX_AGE
309
- });
310
- }
311
- async removeAuthCookie() {
312
- const cookieStore = await cookies();
313
- const whitelabel = await findWhitelabel().catch(() => null);
314
- const cookieDomain = this.normalizeCookieDomain(whitelabel?.domain) ?? this.normalizeCookieDomain(process.env.NEXT_PUBLIC_DOMAIN_COOKIE);
315
- cookieStore.delete({
316
- name: AUTH_COOKIE_NAME,
317
- ...COOKIE_OPTIONS,
318
- ...cookieDomain ? { domain: cookieDomain } : {}
319
- });
320
- }
321
- normalizeCookieDomain(domain) {
322
- if (!domain) return void 0;
323
- const normalized = domain.trim();
324
- if (!normalized) return void 0;
325
- const rawHost = (() => {
326
- try {
327
- return new URL(normalized).hostname;
328
- } catch {
329
- return normalized.replace(/^https?:\/\//i, "").replace(/^www\./i, "").split("/")[0].split(":")[0];
330
- }
331
- })();
332
- if (!rawHost || rawHost === "localhost") {
333
- return void 0;
334
- }
335
- return rawHost.startsWith(".") ? rawHost : `.${rawHost}`;
336
- }
337
- }
338
- const authService = new AuthService();
339
- export {
340
- authService
341
- };
342
- //# sourceMappingURL=auth.service.mjs.map