@greatapps/common 1.1.257 → 1.1.259
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.
- package/dist/components/account/AccountModals.mjs.map +1 -1
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +2 -2
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -1
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
- package/dist/components/embeds/CrispEmbed.mjs.map +1 -1
- package/dist/components/embeds/FrillEmbed.mjs.map +1 -1
- package/dist/components/handlers/SearchParamsHandler.mjs.map +1 -1
- package/dist/components/layouts/AppMobileNavBar.mjs +1 -1
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
- package/dist/components/layouts/AppNavBar.mjs.map +1 -1
- package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -1
- package/dist/components/layouts/NavBar.mjs.map +1 -1
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
- package/dist/components/modals/ModalManager.mjs.map +1 -1
- package/dist/components/modals/Modals.mjs.map +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/components/navigation/NavItemsContext.mjs.map +1 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
- package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
- package/dist/components/ui/buttons/Button.mjs.map +1 -1
- package/dist/components/ui/buttons/CancelButton.mjs.map +1 -1
- package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
- package/dist/components/ui/data-display/Accordion.mjs.map +1 -1
- package/dist/components/ui/data-display/Badge.mjs.map +1 -1
- package/dist/components/ui/data-display/Card.mjs.map +1 -1
- package/dist/components/ui/data-display/CardBrandIcons.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/Pagination.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
- package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -1
- package/dist/components/ui/data-display/Separator.mjs.map +1 -1
- package/dist/components/ui/data-display/Table.mjs.map +1 -1
- package/dist/components/ui/data-display/Tabs.mjs.map +1 -1
- package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
- package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -1
- package/dist/components/ui/feedback/Progress.mjs.map +1 -1
- package/dist/components/ui/feedback/Skeleton.mjs.map +1 -1
- package/dist/components/ui/feedback/Toast.mjs.map +1 -1
- package/dist/components/ui/form/Calendar.mjs.map +1 -1
- package/dist/components/ui/form/Checkbox.mjs.map +1 -1
- package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
- package/dist/components/ui/form/DatePicker.mjs.map +1 -1
- package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
- package/dist/components/ui/form/FormField.mjs.map +1 -1
- package/dist/components/ui/form/Input.mjs.map +1 -1
- package/dist/components/ui/form/InputOtp.mjs.map +1 -1
- package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
- package/dist/components/ui/form/RadioGroup.mjs.map +1 -1
- package/dist/components/ui/form/Select.mjs +1 -1
- package/dist/components/ui/form/Select.mjs.map +1 -1
- package/dist/components/ui/form/Switch.mjs.map +1 -1
- package/dist/components/ui/form/Textarea.mjs.map +1 -1
- package/dist/components/ui/overlay/Command.mjs.map +1 -1
- package/dist/components/ui/overlay/Dialog.mjs.map +1 -1
- package/dist/components/ui/overlay/Popover.mjs.map +1 -1
- package/dist/components/ui/overlay/Sheet.mjs.map +1 -1
- package/dist/components/ui/overlay/Tooltip.mjs.map +1 -1
- package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -1
- package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -1
- package/dist/hooks/useDebounce.mjs.map +1 -1
- package/dist/hooks/useDebounceState.mjs.map +1 -1
- package/dist/hooks/useDebouncedEffect.mjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/infra/utils/clsx.mjs.map +1 -1
- package/dist/infra/utils/parser.mjs.map +1 -1
- package/dist/infra/utils/percentage.mjs.map +1 -1
- package/dist/middleware.mjs.map +1 -1
- package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -1
- package/dist/modules/accounts/actions/find-current-account.action.mjs.map +1 -1
- package/dist/modules/accounts/actions/list-currencies.action.mjs.map +1 -1
- package/dist/modules/accounts/actions/list-timezones.action.mjs.map +1 -1
- package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -1
- package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -1
- package/dist/modules/accounts/services/account.service.mjs.map +1 -1
- package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -1
- package/dist/modules/auth/hooks/login.hook.mjs.map +1 -1
- package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -1
- package/dist/modules/auth/hooks/register.hook.mjs.map +1 -1
- package/dist/modules/cards/actions/list-cards.action.mjs.map +1 -1
- package/dist/modules/cards/hooks/cards.hook.mjs.map +1 -1
- package/dist/modules/cards/services/cards.service.mjs.map +1 -1
- package/dist/modules/cards/types.mjs.map +1 -1
- package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +1 -1
- package/dist/modules/plans/actions/find-plan-by-id.action.mjs.map +1 -1
- package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs.map +1 -1
- package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs.map +1 -1
- package/dist/modules/plans/services/plans.service.mjs.map +1 -1
- package/dist/modules/plans/types/plan.type.mjs.map +1 -1
- package/dist/modules/projects/actions/add-project-user.action.mjs.map +1 -1
- package/dist/modules/projects/actions/list-all-account-users.action.mjs.map +1 -1
- package/dist/modules/projects/actions/list-available-users.action.mjs.map +1 -1
- package/dist/modules/projects/actions/list-project-users.action.mjs.map +1 -1
- package/dist/modules/projects/actions/remove-project-user.action.mjs.map +1 -1
- package/dist/modules/projects/hooks/add-project-user.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -1
- package/dist/modules/projects/hooks/remove-project-user.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs.map +1 -1
- package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +1 -1
- package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs.map +1 -1
- package/dist/modules/subscriptions/constants/query-keys.constants.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs.map +1 -1
- package/dist/modules/subscriptions/types/calculate-subscription.type.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/build-plan-extras.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs.map +1 -1
- package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -1
- package/dist/modules/users/action/list-messages.action.mjs.map +1 -1
- package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +1 -1
- package/dist/modules/users/action/mark-message-as-read.action.mjs.map +1 -1
- package/dist/modules/users/hooks/messages.hook.mjs.map +1 -1
- package/dist/modules/users/services/messages.service.mjs.map +1 -1
- package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs.map +1 -1
- package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -1
- package/dist/modules/whitelabel/actions/revalidate-whitelabel-styles.action.mjs.map +1 -1
- package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs.map +1 -1
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +1 -1
- package/dist/providers/whitelabel.provider.mjs.map +1 -1
- package/dist/store/useAccountModals.mjs.map +1 -1
- package/dist/store/useBuyCreditsModal.mjs.map +1 -1
- package/dist/store/useModalManager.mjs.map +1 -1
- package/dist/utils/countries.mjs.map +1 -1
- package/dist/utils/safeServerAction.mjs.map +1 -1
- package/dist/utils/withAction.mjs.map +1 -1
- package/package.json +89 -89
- package/src/components/account/AccountModals.tsx +17 -17
- package/src/components/account/ConfigurationsMyAccountModal.tsx +150 -150
- package/src/components/account/ConfirmDeleteAccountModal.tsx +55 -55
- package/src/components/account/ConfirmGlobalPreferencesModal.tsx +66 -66
- package/src/components/account/DeleteAccountModal.tsx +130 -130
- package/src/components/account/DisableTwoFactorAuthModal.tsx +86 -86
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +49 -49
- package/src/components/account/TwoFactorAuthModal.tsx +223 -223
- package/src/components/account/hooks/useChangePhoneForm.tsx +81 -81
- package/src/components/account/hooks/useTwoFactorAuthForm.tsx +101 -101
- package/src/components/account/sections/ChangeEmailModal.tsx +225 -225
- package/src/components/account/sections/ChangePasswordSection.tsx +64 -64
- package/src/components/account/sections/ChangePhoneModal.tsx +231 -231
- package/src/components/account/sections/MyProfileSection.tsx +327 -327
- package/src/components/account/sections/PreferencesSection.tsx +273 -273
- package/src/components/account/sections/SecuritySection.tsx +160 -160
- package/src/components/embeds/CrispEmbed.tsx +101 -101
- package/src/components/embeds/FrillEmbed.tsx +119 -119
- package/src/components/handlers/SearchParamsHandler.tsx +61 -61
- package/src/components/layouts/AppMobileNavBar.tsx +118 -118
- package/src/components/layouts/AppNavBar.tsx +51 -51
- package/src/components/layouts/MdSideBarNavigation.tsx +56 -56
- package/src/components/layouts/NavBar.tsx +120 -120
- package/src/components/layouts/NotificationsPopover.tsx +115 -115
- package/src/components/layouts/ProfilePopover.tsx +164 -164
- package/src/components/layouts/UsersSelectorPopover.tsx +238 -238
- package/src/components/modals/BuyCreditsModal.tsx +301 -301
- package/src/components/modals/ModalManager.tsx +29 -29
- package/src/components/modals/Modals.tsx +26 -26
- package/src/components/navigation/CancelledSubscriptionBanner.tsx +69 -69
- package/src/components/navigation/NavItemsContext.ts +20 -20
- package/src/components/navigation/ProjectSelectorPopover.tsx +157 -157
- package/src/components/navigation/shells/TabsMobileShell.tsx +72 -72
- package/src/components/navigation/subcomponents/ProjectSelector.tsx +156 -156
- package/src/components/pages/notifications/Notifications.tsx +160 -160
- package/src/components/ui/buttons/Button.tsx +57 -57
- package/src/components/ui/buttons/CancelButton.tsx +14 -14
- package/src/components/ui/buttons/CopyButton.tsx +54 -54
- package/src/components/ui/data-display/Accordion.tsx +81 -81
- package/src/components/ui/data-display/Badge.tsx +47 -47
- package/src/components/ui/data-display/Card.tsx +93 -93
- package/src/components/ui/data-display/CardBrandIcons.tsx +336 -336
- package/src/components/ui/data-display/CardItem.tsx +75 -75
- package/src/components/ui/data-display/Pagination.tsx +126 -126
- package/src/components/ui/data-display/PaymentInfoCard.tsx +186 -186
- package/src/components/ui/data-display/ScrollArea.tsx +59 -59
- package/src/components/ui/data-display/Separator.tsx +29 -29
- package/src/components/ui/data-display/Table.tsx +117 -117
- package/src/components/ui/data-display/Tabs.tsx +67 -67
- package/src/components/ui/feedback/CircularProgress.tsx +75 -75
- package/src/components/ui/feedback/DefaultCircularProgress.tsx +61 -61
- package/src/components/ui/feedback/LoadingOverlay.tsx +31 -31
- package/src/components/ui/feedback/Progress.tsx +40 -40
- package/src/components/ui/feedback/Skeleton.tsx +5 -5
- package/src/components/ui/feedback/Toast.tsx +101 -101
- package/src/components/ui/form/Calendar.tsx +228 -228
- package/src/components/ui/form/Checkbox.tsx +31 -31
- package/src/components/ui/form/ComboboxField.tsx +154 -154
- package/src/components/ui/form/DatePicker.tsx +97 -97
- package/src/components/ui/form/DateRangePicker.tsx +108 -108
- package/src/components/ui/form/FormField.tsx +131 -131
- package/src/components/ui/form/Input.tsx +20 -20
- package/src/components/ui/form/InputOtp.tsx +80 -80
- package/src/components/ui/form/PhoneInput.tsx +205 -205
- package/src/components/ui/form/RadioGroup.tsx +45 -45
- package/src/components/ui/form/Select.tsx +200 -200
- package/src/components/ui/form/Switch.tsx +32 -32
- package/src/components/ui/form/Textarea.tsx +19 -19
- package/src/components/ui/overlay/Command.tsx +185 -185
- package/src/components/ui/overlay/Dialog.tsx +151 -151
- package/src/components/ui/overlay/Popover.tsx +49 -49
- package/src/components/ui/overlay/Sheet.tsx +166 -166
- package/src/components/ui/overlay/Tooltip.tsx +62 -62
- package/src/components/widgets/notifications/NotificationCard.tsx +68 -68
- package/src/hooks/copy-to-clipboard.hook.tsx +67 -67
- package/src/hooks/useDebounce.ts +26 -26
- package/src/hooks/useDebounceState.ts +11 -11
- package/src/hooks/useDebouncedEffect.ts +69 -69
- package/src/index.ts +376 -376
- package/src/infra/utils/clsx.ts +6 -6
- package/src/infra/utils/parser.ts +52 -52
- package/src/infra/utils/percentage.ts +42 -42
- package/src/middleware.ts +4 -4
- package/src/modules/accounts/actions/account-management.action.ts +91 -91
- package/src/modules/accounts/actions/find-current-account.action.ts +9 -9
- package/src/modules/accounts/actions/list-currencies.action.ts +8 -8
- package/src/modules/accounts/actions/list-timezones.action.ts +8 -8
- package/src/modules/accounts/hooks/current-account.hook.tsx +22 -22
- package/src/modules/accounts/hooks/useAccountManagement.ts +85 -85
- package/src/modules/accounts/hooks/useCurrencies.ts +15 -15
- package/src/modules/accounts/hooks/useTimezones.ts +15 -15
- package/src/modules/accounts/services/account.service.ts +236 -236
- package/src/modules/accounts/types.ts +214 -214
- package/src/modules/auth/actions/validate-session.action.ts +56 -56
- package/src/modules/auth/hooks/login.hook.tsx +13 -13
- package/src/modules/auth/hooks/logout.hook.tsx +11 -11
- package/src/modules/auth/hooks/register.hook.tsx +11 -11
- package/src/modules/cards/actions/list-cards.action.ts +8 -8
- package/src/modules/cards/hooks/cards.hook.ts +14 -14
- package/src/modules/cards/services/cards.service.ts +32 -32
- package/src/modules/cards/types.ts +32 -32
- package/src/modules/ia-credits/actions/list-ia-credits.action.ts +8 -8
- package/src/modules/plans/actions/find-plan-by-id.action.ts +8 -8
- package/src/modules/plans/hooks/use-has-plan-addon.hook.ts +17 -17
- package/src/modules/plans/hooks/use-plan-by-id.hook.ts +13 -13
- package/src/modules/plans/services/plans.service.ts +36 -36
- package/src/modules/plans/types/plan.type.ts +21 -21
- package/src/modules/projects/actions/add-project-user.action.ts +9 -9
- package/src/modules/projects/actions/list-all-account-users.action.ts +9 -9
- package/src/modules/projects/actions/list-available-users.action.ts +9 -9
- package/src/modules/projects/actions/list-project-users.action.ts +9 -9
- package/src/modules/projects/actions/remove-project-user.action.ts +9 -9
- package/src/modules/projects/hooks/add-project-user.hook.ts +69 -69
- package/src/modules/projects/hooks/list-all-account-users.hook.ts +34 -34
- package/src/modules/projects/hooks/list-available-users.hook.ts +33 -33
- package/src/modules/projects/hooks/list-project-users.hook.ts +33 -33
- package/src/modules/projects/hooks/remove-project-user.hook.ts +69 -69
- package/src/modules/subscriptions/actions/calculate-subscription.action.ts +9 -9
- package/src/modules/subscriptions/actions/list-subscriptions.action.ts +9 -9
- package/src/modules/subscriptions/actions/update-subscription-plan.action.ts +26 -26
- package/src/modules/subscriptions/constants/query-keys.constants.ts +1 -1
- package/src/modules/subscriptions/hooks/calculate-subscription.hook.ts +13 -13
- package/src/modules/subscriptions/hooks/find-active-subscription.hook.ts +19 -19
- package/src/modules/subscriptions/hooks/list-subscriptions.hook.ts +16 -16
- package/src/modules/subscriptions/hooks/update-subscription-plan.hook.ts +25 -25
- package/src/modules/subscriptions/types/billing-period.type.ts +1 -1
- package/src/modules/subscriptions/types/calculate-subscription.type.ts +75 -75
- package/src/modules/subscriptions/utils/build-plan-extras.ts +56 -56
- package/src/modules/subscriptions/utils/periodicity.ts +52 -52
- package/src/modules/subscriptions/utils/resolve-plan-extras-prices.ts +23 -23
- package/src/modules/users/action/find-user-by-id.action.ts +8 -8
- package/src/modules/users/action/list-messages.action.ts +12 -12
- package/src/modules/users/action/mark-all-messages-as-read.action.ts +8 -8
- package/src/modules/users/action/mark-message-as-read.action.ts +8 -8
- package/src/modules/users/hooks/messages.hook.ts +60 -60
- package/src/modules/users/services/messages.service.ts +48 -48
- package/src/modules/whitelabel/actions/find-whitelabel-styles.action.ts +14 -14
- package/src/modules/whitelabel/actions/find-whitelabel.action.ts +23 -23
- package/src/modules/whitelabel/actions/revalidate-whitelabel-styles.action.ts +10 -10
- package/src/modules/whitelabel/actions/revalidate-whitelabel.action.ts +19 -19
- package/src/modules/whitelabel/schema.ts +83 -83
- package/src/modules/whitelabel/services/whitelabel-styles.service.ts +129 -129
- package/src/modules/whitelabel/styles-schema.ts +37 -37
- package/src/providers/whitelabel.provider.tsx +54 -54
- package/src/store/useAccountModals.ts +55 -55
- package/src/store/useBuyCreditsModal.ts +25 -25
- package/src/store/useModalManager.ts +104 -104
- package/src/utils/countries.ts +224 -224
- package/src/utils/safeServerAction.ts +21 -21
- package/src/utils/withAction.ts +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/actions/list-available-users.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/actions/list-available-users.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { projectUsersService } from '../services/project-users.service';\nimport type { ListUsersParams } from '../types';\n\nexport async function listAvailableUsersAction(projectId: number, params: ListUsersParams = {}) {\n return safeServerAction(() => projectUsersService.listNotInProject(projectId, params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAGpC,eAAsB,yBAAyB,WAAmB,SAA0B,CAAC,GAAG;AAC9F,SAAO,iBAAiB,MAAM,oBAAoB,iBAAiB,WAAW,MAAM,CAAC;AACvF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/actions/list-project-users.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/actions/list-project-users.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { projectUsersService } from '../services/project-users.service';\nimport type { ListUsersParams } from '../types';\n\nexport async function listProjectUsersAction(projectId: number, params: ListUsersParams = {}) {\n return safeServerAction(() => projectUsersService.listInProject(projectId, params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAGpC,eAAsB,uBAAuB,WAAmB,SAA0B,CAAC,GAAG;AAC5F,SAAO,iBAAiB,MAAM,oBAAoB,cAAc,WAAW,MAAM,CAAC;AACpF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/actions/remove-project-user.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/actions/remove-project-user.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { projectUsersService } from '../services/project-users.service';\nimport type { AddRemoveProjectUsersParams } from '../types';\n\nexport async function removeProjectUserAction(params: AddRemoveProjectUsersParams) {\n return safeServerAction(() => projectUsersService.removeFromProject(params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAGpC,eAAsB,wBAAwB,QAAqC;AACjF,SAAO,iBAAiB,MAAM,oBAAoB,kBAAkB,MAAM,CAAC;AAC7E;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/hooks/add-project-user.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/hooks/add-project-user.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQueryClient, useMutation, InfiniteData } from '@tanstack/react-query';\nimport { addProjectUserAction } from '../actions/add-project-user.action';\nimport { LIST_PROJECT_USERS_BASE_KEY } from './list-project-users.hook';\nimport { LIST_ALL_ACCOUNT_USERS_BASE_KEY } from './list-all-account-users.hook';\nimport type { UsersPage, AccountUser, ProjectUser } from '../types';\n\nexport function useAddProjectUser(projectId: number) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (userId: number) =>\n addProjectUserAction({ projectId, users: [userId] }),\n\n onMutate: async (userId) => {\n await queryClient.cancelQueries({ queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY() });\n await queryClient.cancelQueries({ queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId) });\n\n const prevAccountUsers = queryClient.getQueriesData<InfiniteData<UsersPage<AccountUser>>>({\n queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY(),\n });\n const prevProjectUsers = queryClient.getQueriesData<InfiniteData<UsersPage<ProjectUser>>>({\n queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId),\n });\n\n queryClient.setQueriesData<InfiniteData<UsersPage<AccountUser>>>(\n { queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY(), exact: false },\n (old) => {\n if (!old) return old;\n return {\n ...old,\n pages: old.pages.map((page) => ({\n ...page,\n data: page.data.map((u) =>\n u.id === userId ? { ...u, in_project: true } : u\n ),\n })),\n };\n }\n );\n\n queryClient.setQueriesData<InfiniteData<UsersPage<ProjectUser>>>(\n { queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId), exact: false },\n (old) => {\n if (!old?.pages.length) return old;\n return {\n ...old,\n pages: old.pages.map((page, i) =>\n i === 0 ? { ...page, total: page.total + 1 } : page\n ),\n };\n }\n );\n\n return { prevAccountUsers, prevProjectUsers };\n },\n\n onError: (_err, _userId, ctx) => {\n ctx?.prevAccountUsers.forEach(([key, data]) => queryClient.setQueryData(key, data));\n ctx?.prevProjectUsers.forEach(([key, data]) => queryClient.setQueryData(key, data));\n },\n\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId) });\n queryClient.invalidateQueries({ queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY() });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB,mBAAiC;AAC1D,SAAS,4BAA4B;AACrC,SAAS,mCAAmC;AAC5C,SAAS,uCAAuC;AAGzC,SAAS,kBAAkB,WAAmB;AACnD,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,WACX,qBAAqB,EAAE,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC;AAAA,IAErD,UAAU,OAAO,WAAW;AAC1B,YAAM,YAAY,cAAc,EAAE,UAAU,gCAAgC,EAAE,CAAC;AAC/E,YAAM,YAAY,cAAc,EAAE,UAAU,4BAA4B,SAAS,EAAE,CAAC;AAEpF,YAAM,mBAAmB,YAAY,eAAqD;AAAA,QACxF,UAAU,gCAAgC;AAAA,MAC5C,CAAC;AACD,YAAM,mBAAmB,YAAY,eAAqD;AAAA,QACxF,UAAU,4BAA4B,SAAS;AAAA,MACjD,CAAC;AAED,kBAAY;AAAA,QACV,EAAE,UAAU,gCAAgC,GAAG,OAAO,MAAM;AAAA,QAC5D,CAAC,QAAQ;AACP,cAAI,CAAC,IAAK,QAAO;AACjB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,OAAO,IAAI,MAAM,IAAI,CAAC,UAAU;AAAA,cAC9B,GAAG;AAAA,cACH,MAAM,KAAK,KAAK;AAAA,gBAAI,CAAC,MACnB,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,YAAY,KAAK,IAAI;AAAA,cACjD;AAAA,YACF,EAAE;AAAA,UACJ;AAAA,QACF;AAAA,MACF;AAEA,kBAAY;AAAA,QACV,EAAE,UAAU,4BAA4B,SAAS,GAAG,OAAO,MAAM;AAAA,QACjE,CAAC,QAAQ;AACP,cAAI,CAAC,KAAK,MAAM,OAAQ,QAAO;AAC/B,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,OAAO,IAAI,MAAM;AAAA,cAAI,CAAC,MAAM,MAC1B,MAAM,IAAI,EAAE,GAAG,MAAM,OAAO,KAAK,QAAQ,EAAE,IAAI;AAAA,YACjD;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,aAAO,EAAE,kBAAkB,iBAAiB;AAAA,IAC9C;AAAA,IAEA,SAAS,CAAC,MAAM,SAAS,QAAQ;AAC/B,WAAK,iBAAiB,QAAQ,CAAC,CAAC,KAAK,IAAI,MAAM,YAAY,aAAa,KAAK,IAAI,CAAC;AAClF,WAAK,iBAAiB,QAAQ,CAAC,CAAC,KAAK,IAAI,MAAM,YAAY,aAAa,KAAK,IAAI,CAAC;AAAA,IACpF;AAAA,IAEA,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,4BAA4B,SAAS,EAAE,CAAC;AAClF,kBAAY,kBAAkB,EAAE,UAAU,gCAAgC,EAAE,CAAC;AAAA,IAC/E;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/hooks/list-all-account-users.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/hooks/list-all-account-users.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery } from '@tanstack/react-query';\nimport { listAllAccountUsersAction } from '../actions/list-all-account-users.action';\nimport { withAction } from '../../../utils/withAction';\n\nconst PAGE_SIZE = 20;\n\nexport const LIST_ALL_ACCOUNT_USERS_BASE_KEY = () => ['account-users', 'all'];\nexport const LIST_ALL_ACCOUNT_USERS_QUERY_KEY = (search: string = '', projectId?: number) => [\n ...LIST_ALL_ACCOUNT_USERS_BASE_KEY(),\n search,\n projectId,\n];\n\nexport function useListAllAccountUsers(search: string = '', projectId?: number) {\n return useInfiniteQuery({\n queryKey: LIST_ALL_ACCOUNT_USERS_QUERY_KEY(search, projectId),\n queryFn: ({ pageParam }) =>\n withAction(() =>\n listAllAccountUsersAction({\n search: search || undefined,\n page: pageParam as number,\n limit: PAGE_SIZE,\n inProject: projectId,\n })\n )(),\n getNextPageParam: (lastPage, allPages) => {\n const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);\n return loaded < lastPage.total ? allPages.length + 1 : undefined;\n },\n initialPageParam: 1,\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,kBAAkB;AAE3B,MAAM,YAAY;AAEX,MAAM,kCAAkC,MAAM,CAAC,iBAAiB,KAAK;AACrE,MAAM,mCAAmC,CAAC,SAAiB,IAAI,cAAuB;AAAA,EAC3F,GAAG,gCAAgC;AAAA,EACnC;AAAA,EACA;AACF;AAEO,SAAS,uBAAuB,SAAiB,IAAI,WAAoB;AAC9E,SAAO,iBAAiB;AAAA,IACtB,UAAU,iCAAiC,QAAQ,SAAS;AAAA,IAC5D,SAAS,CAAC,EAAE,UAAU,MACpB;AAAA,MAAW,MACT,0BAA0B;AAAA,QACxB,QAAQ,UAAU;AAAA,QAClB,MAAM;AAAA,QACN,OAAO;AAAA,QACP,WAAW;AAAA,MACb,CAAC;AAAA,IACH,EAAE;AAAA,IACJ,kBAAkB,CAAC,UAAU,aAAa;AACxC,YAAM,SAAS,SAAS,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ,CAAC;AACjE,aAAO,SAAS,SAAS,QAAQ,SAAS,SAAS,IAAI;AAAA,IACzD;AAAA,IACA,kBAAkB;AAAA,EACpB,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/hooks/list-available-users.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/hooks/list-available-users.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery } from '@tanstack/react-query';\nimport { listAvailableUsersAction } from '../actions/list-available-users.action';\nimport { withAction } from '../../../utils/withAction';\n\nconst PAGE_SIZE = 20;\n\nexport const LIST_AVAILABLE_USERS_BASE_KEY = (projectId: number) => ['project-users', projectId, 'out'];\nexport const LIST_AVAILABLE_USERS_QUERY_KEY = (projectId: number, search: string = '') => [\n ...LIST_AVAILABLE_USERS_BASE_KEY(projectId),\n search,\n];\n\nexport function useListAvailableUsers(projectId: number, search: string = '') {\n return useInfiniteQuery({\n queryKey: LIST_AVAILABLE_USERS_QUERY_KEY(projectId, search),\n queryFn: ({ pageParam }) =>\n withAction(() =>\n listAvailableUsersAction(projectId, {\n search: search || undefined,\n page: pageParam as number,\n limit: PAGE_SIZE,\n })\n )(),\n getNextPageParam: (lastPage, allPages) => {\n const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);\n return loaded < lastPage.total ? allPages.length + 1 : undefined;\n },\n initialPageParam: 1,\n enabled: !!projectId,\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,kBAAkB;AAE3B,MAAM,YAAY;AAEX,MAAM,gCAAgC,CAAC,cAAsB,CAAC,iBAAiB,WAAW,KAAK;AAC/F,MAAM,iCAAiC,CAAC,WAAmB,SAAiB,OAAO;AAAA,EACxF,GAAG,8BAA8B,SAAS;AAAA,EAC1C;AACF;AAEO,SAAS,sBAAsB,WAAmB,SAAiB,IAAI;AAC5E,SAAO,iBAAiB;AAAA,IACtB,UAAU,+BAA+B,WAAW,MAAM;AAAA,IAC1D,SAAS,CAAC,EAAE,UAAU,MACpB;AAAA,MAAW,MACT,yBAAyB,WAAW;AAAA,QAClC,QAAQ,UAAU;AAAA,QAClB,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,IACH,EAAE;AAAA,IACJ,kBAAkB,CAAC,UAAU,aAAa;AACxC,YAAM,SAAS,SAAS,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ,CAAC;AACjE,aAAO,SAAS,SAAS,QAAQ,SAAS,SAAS,IAAI;AAAA,IACzD;AAAA,IACA,kBAAkB;AAAA,IAClB,SAAS,CAAC,CAAC;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/hooks/list-project-users.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/hooks/list-project-users.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery } from '@tanstack/react-query';\nimport { listProjectUsersAction } from '../actions/list-project-users.action';\nimport { withAction } from '../../../utils/withAction';\n\nconst PAGE_SIZE = 20;\n\nexport const LIST_PROJECT_USERS_BASE_KEY = (projectId: number) => ['project-users', projectId, 'in'];\nexport const LIST_PROJECT_USERS_QUERY_KEY = (projectId: number, search: string = '') => [\n ...LIST_PROJECT_USERS_BASE_KEY(projectId),\n search,\n];\n\nexport function useListProjectUsers(projectId: number, search: string = '') {\n return useInfiniteQuery({\n queryKey: LIST_PROJECT_USERS_QUERY_KEY(projectId, search),\n queryFn: ({ pageParam }) =>\n withAction(() =>\n listProjectUsersAction(projectId, {\n search: search || undefined,\n page: pageParam as number,\n limit: PAGE_SIZE,\n })\n )(),\n getNextPageParam: (lastPage, allPages) => {\n const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);\n return loaded < lastPage.total ? allPages.length + 1 : undefined;\n },\n initialPageParam: 1,\n enabled: !!projectId,\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAE3B,MAAM,YAAY;AAEX,MAAM,8BAA8B,CAAC,cAAsB,CAAC,iBAAiB,WAAW,IAAI;AAC5F,MAAM,+BAA+B,CAAC,WAAmB,SAAiB,OAAO;AAAA,EACtF,GAAG,4BAA4B,SAAS;AAAA,EACxC;AACF;AAEO,SAAS,oBAAoB,WAAmB,SAAiB,IAAI;AAC1E,SAAO,iBAAiB;AAAA,IACtB,UAAU,6BAA6B,WAAW,MAAM;AAAA,IACxD,SAAS,CAAC,EAAE,UAAU,MACpB;AAAA,MAAW,MACT,uBAAuB,WAAW;AAAA,QAChC,QAAQ,UAAU;AAAA,QAClB,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,IACH,EAAE;AAAA,IACJ,kBAAkB,CAAC,UAAU,aAAa;AACxC,YAAM,SAAS,SAAS,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ,CAAC;AACjE,aAAO,SAAS,SAAS,QAAQ,SAAS,SAAS,IAAI;AAAA,IACzD;AAAA,IACA,kBAAkB;AAAA,IAClB,SAAS,CAAC,CAAC;AAAA,EACb,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/projects/hooks/remove-project-user.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/projects/hooks/remove-project-user.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQueryClient, useMutation, InfiniteData } from '@tanstack/react-query';\nimport { removeProjectUserAction } from '../actions/remove-project-user.action';\nimport { LIST_PROJECT_USERS_BASE_KEY } from './list-project-users.hook';\nimport { LIST_ALL_ACCOUNT_USERS_BASE_KEY } from './list-all-account-users.hook';\nimport type { UsersPage, AccountUser, ProjectUser } from '../types';\n\nexport function useRemoveProjectUser(projectId: number) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (userId: number) =>\n removeProjectUserAction({ projectId, users: [userId] }),\n\n onMutate: async (userId) => {\n await queryClient.cancelQueries({ queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY() });\n await queryClient.cancelQueries({ queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId) });\n\n const prevAccountUsers = queryClient.getQueriesData<InfiniteData<UsersPage<AccountUser>>>({\n queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY(),\n });\n const prevProjectUsers = queryClient.getQueriesData<InfiniteData<UsersPage<ProjectUser>>>({\n queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId),\n });\n\n queryClient.setQueriesData<InfiniteData<UsersPage<AccountUser>>>(\n { queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY(), exact: false },\n (old) => {\n if (!old) return old;\n return {\n ...old,\n pages: old.pages.map((page) => ({\n ...page,\n data: page.data.map((u) =>\n u.id === userId ? { ...u, in_project: false } : u\n ),\n })),\n };\n }\n );\n\n queryClient.setQueriesData<InfiniteData<UsersPage<ProjectUser>>>(\n { queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId), exact: false },\n (old) => {\n if (!old?.pages.length) return old;\n return {\n ...old,\n pages: old.pages.map((page, i) =>\n i === 0 ? { ...page, total: page.total - 1 } : page\n ),\n };\n }\n );\n\n return { prevAccountUsers, prevProjectUsers };\n },\n\n onError: (_err, _userId, ctx) => {\n ctx?.prevAccountUsers.forEach(([key, data]) => queryClient.setQueryData(key, data));\n ctx?.prevProjectUsers.forEach(([key, data]) => queryClient.setQueryData(key, data));\n },\n\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey: LIST_PROJECT_USERS_BASE_KEY(projectId) });\n queryClient.invalidateQueries({ queryKey: LIST_ALL_ACCOUNT_USERS_BASE_KEY() });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB,mBAAiC;AAC1D,SAAS,+BAA+B;AACxC,SAAS,mCAAmC;AAC5C,SAAS,uCAAuC;AAGzC,SAAS,qBAAqB,WAAmB;AACtD,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,WACX,wBAAwB,EAAE,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC;AAAA,IAExD,UAAU,OAAO,WAAW;AAC1B,YAAM,YAAY,cAAc,EAAE,UAAU,gCAAgC,EAAE,CAAC;AAC/E,YAAM,YAAY,cAAc,EAAE,UAAU,4BAA4B,SAAS,EAAE,CAAC;AAEpF,YAAM,mBAAmB,YAAY,eAAqD;AAAA,QACxF,UAAU,gCAAgC;AAAA,MAC5C,CAAC;AACD,YAAM,mBAAmB,YAAY,eAAqD;AAAA,QACxF,UAAU,4BAA4B,SAAS;AAAA,MACjD,CAAC;AAED,kBAAY;AAAA,QACV,EAAE,UAAU,gCAAgC,GAAG,OAAO,MAAM;AAAA,QAC5D,CAAC,QAAQ;AACP,cAAI,CAAC,IAAK,QAAO;AACjB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,OAAO,IAAI,MAAM,IAAI,CAAC,UAAU;AAAA,cAC9B,GAAG;AAAA,cACH,MAAM,KAAK,KAAK;AAAA,gBAAI,CAAC,MACnB,EAAE,OAAO,SAAS,EAAE,GAAG,GAAG,YAAY,MAAM,IAAI;AAAA,cAClD;AAAA,YACF,EAAE;AAAA,UACJ;AAAA,QACF;AAAA,MACF;AAEA,kBAAY;AAAA,QACV,EAAE,UAAU,4BAA4B,SAAS,GAAG,OAAO,MAAM;AAAA,QACjE,CAAC,QAAQ;AACP,cAAI,CAAC,KAAK,MAAM,OAAQ,QAAO;AAC/B,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,OAAO,IAAI,MAAM;AAAA,cAAI,CAAC,MAAM,MAC1B,MAAM,IAAI,EAAE,GAAG,MAAM,OAAO,KAAK,QAAQ,EAAE,IAAI;AAAA,YACjD;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,aAAO,EAAE,kBAAkB,iBAAiB;AAAA,IAC9C;AAAA,IAEA,SAAS,CAAC,MAAM,SAAS,QAAQ;AAC/B,WAAK,iBAAiB,QAAQ,CAAC,CAAC,KAAK,IAAI,MAAM,YAAY,aAAa,KAAK,IAAI,CAAC;AAClF,WAAK,iBAAiB,QAAQ,CAAC,CAAC,KAAK,IAAI,MAAM,YAAY,aAAa,KAAK,IAAI,CAAC;AAAA,IACpF;AAAA,IAEA,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,4BAA4B,SAAS,EAAE,CAAC;AAClF,kBAAY,kBAAkB,EAAE,UAAU,gCAAgC,EAAE,CAAC;AAAA,IAC/E;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/calculate-subscription.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/calculate-subscription.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport type { CalculateSubscriptionRequest } from '../types/calculate-subscription.type';\nimport { subscriptionsService } from '../services/subscriptions.service';\n\nexport async function calculateSubscriptionAction(data: CalculateSubscriptionRequest) {\n return safeServerAction(() => subscriptionsService.calculateSubscription(data));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,eAAsB,4BAA4B,MAAoC;AACpF,SAAO,iBAAiB,MAAM,qBAAqB,sBAAsB,IAAI,CAAC;AAChF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/list-subscriptions.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/list-subscriptions.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport type { FindSubscriptionsParams } from '../types/subscription.type';\nimport { subscriptionsService } from '../services/subscriptions.service';\n\nexport async function listSubscriptionsAction(params?: Partial<FindSubscriptionsParams>) {\n return safeServerAction(() => subscriptionsService.listSubscriptions(params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,eAAsB,wBAAwB,QAA2C;AACvF,SAAO,iBAAiB,MAAM,qBAAqB,kBAAkB,MAAM,CAAC;AAC9E;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/update-subscription-plan.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/actions/update-subscription-plan.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport type { UpdateSubscriptionPlanRequest } from '../types/calculate-subscription.type';\nimport { subscriptionsService } from '../services/subscriptions.service';\nimport { resolvePlanExtrasPrices } from '../utils/resolve-plan-extras-prices';\n\nexport async function updateSubscriptionPlanAction(\n subscriptionId: number | string,\n data: UpdateSubscriptionPlanRequest\n) {\n return safeServerAction(async () => {\n if (data.plan_extras?.length) {\n const { data: subscriptions } = await subscriptionsService.listSubscriptions({ active: true });\n const subscription =\n subscriptions.find((s) => String(s.id) === String(subscriptionId)) ?? subscriptions[0];\n\n data = {\n ...data,\n plan_extras: resolvePlanExtrasPrices(data.plan_extras, subscription?.items ?? []),\n };\n }\n\n return subscriptionsService.updateSubscriptionPlan(subscriptionId, data);\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AAExC,eAAsB,6BACpB,gBACA,MACA;AACA,SAAO,iBAAiB,YAAY;AAClC,QAAI,KAAK,aAAa,QAAQ;AAC5B,YAAM,EAAE,MAAM,cAAc,IAAI,MAAM,qBAAqB,kBAAkB,EAAE,QAAQ,KAAK,CAAC;AAC7F,YAAM,eACJ,cAAc,KAAK,CAAC,MAAM,OAAO,EAAE,EAAE,MAAM,OAAO,cAAc,CAAC,KAAK,cAAc,CAAC;AAEvF,aAAO;AAAA,QACL,GAAG;AAAA,QACH,aAAa,wBAAwB,KAAK,aAAa,cAAc,SAAS,CAAC,CAAC;AAAA,MAClF;AAAA,IACF;AAEA,WAAO,qBAAqB,uBAAuB,gBAAgB,IAAI;AAAA,EACzE,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/constants/query-keys.constants.ts"],"sourcesContent":["export const SUBSCRIPTIONS_QUERY_KEY = ['subscriptions'];\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/constants/query-keys.constants.ts"],"sourcesContent":["export const SUBSCRIPTIONS_QUERY_KEY = ['subscriptions'];\n"],"mappings":"AAAO,MAAM,0BAA0B,CAAC,eAAe;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/calculate-subscription.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/calculate-subscription.hook.ts"],"sourcesContent":["'use client';\n\nimport { useMutation } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { calculateSubscriptionAction } from '../actions/calculate-subscription.action';\nimport type { CalculateSubscriptionRequest } from '../types/calculate-subscription.type';\n\nexport function useCalculateSubscription() {\n return useMutation({\n mutationFn: (data: CalculateSubscriptionRequest) =>\n withAction(calculateSubscriptionAction)(data),\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,mCAAmC;AAGrC,SAAS,2BAA2B;AACzC,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC,SACX,WAAW,2BAA2B,EAAE,IAAI;AAAA,EAChD,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/find-active-subscription.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/find-active-subscription.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listSubscriptionsAction } from '../actions/list-subscriptions.action';\nimport { parseResult } from '../../../infra/utils/parser';\nimport { SubscriptionSchema } from '../types/subscription.type';\nimport { SUBSCRIPTIONS_QUERY_KEY } from '../constants/query-keys.constants';\nimport { withAction } from '../../../utils/withAction';\n\nexport function useActiveSubscription() {\n return useQuery({\n queryKey: [...SUBSCRIPTIONS_QUERY_KEY, 'active'],\n queryFn: async () =>\n parseResult(\n SubscriptionSchema,\n await withAction(() => listSubscriptionsAction({ active: true }))()\n ),\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,kBAAkB;AAEpB,SAAS,wBAAwB;AACtC,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,GAAG,yBAAyB,QAAQ;AAAA,IAC/C,SAAS,YACP;AAAA,MACE;AAAA,MACA,MAAM,WAAW,MAAM,wBAAwB,EAAE,QAAQ,KAAK,CAAC,CAAC,EAAE;AAAA,IACpE;AAAA,EACJ,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/list-subscriptions.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/list-subscriptions.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listSubscriptionsAction } from '../actions/list-subscriptions.action';\nimport { parseResult } from '../../../infra/utils/parser';\nimport { SubscriptionSchema, type FindSubscriptionsParams } from '../types/subscription.type';\nimport { withAction } from '../../../utils/withAction';\nimport { SUBSCRIPTIONS_QUERY_KEY } from '../constants/query-keys.constants';\n\nexport function useSubscriptions(params?: Partial<FindSubscriptionsParams>) {\n return useQuery({\n queryKey: [...SUBSCRIPTIONS_QUERY_KEY, params],\n queryFn: async () =>\n parseResult(SubscriptionSchema, await withAction(() => listSubscriptionsAction(params))()),\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAC5B,SAAS,0BAAwD;AACjE,SAAS,kBAAkB;AAC3B,SAAS,+BAA+B;AAEjC,SAAS,iBAAiB,QAA2C;AAC1E,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,GAAG,yBAAyB,MAAM;AAAA,IAC7C,SAAS,YACP,YAAY,oBAAoB,MAAM,WAAW,MAAM,wBAAwB,MAAM,CAAC,EAAE,CAAC;AAAA,EAC7F,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/update-subscription-plan.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/hooks/update-subscription-plan.hook.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { withAction } from '../../../utils/withAction';\nimport { updateSubscriptionPlanAction } from '../actions/update-subscription-plan.action';\nimport { SUBSCRIPTIONS_QUERY_KEY } from '../constants/query-keys.constants';\nimport type { UpdateSubscriptionPlanRequest } from '../types/calculate-subscription.type';\n\nexport function useUpdateSubscriptionPlan() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: ({\n subscriptionId,\n data,\n }: {\n subscriptionId: number | string;\n data: UpdateSubscriptionPlanRequest;\n }) => withAction(updateSubscriptionPlanAction)(subscriptionId, data),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: SUBSCRIPTIONS_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: ['charges'] });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,aAAa,sBAAsB;AAC5C,SAAS,kBAAkB;AAC3B,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AAGjC,SAAS,4BAA4B;AAC1C,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,CAAC;AAAA,MACX;AAAA,MACA;AAAA,IACF,MAGM,WAAW,4BAA4B,EAAE,gBAAgB,IAAI;AAAA,IACnE,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AACnE,kBAAY,kBAAkB,EAAE,UAAU,CAAC,SAAS,EAAE,CAAC;AAAA,IACzD;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/types/calculate-subscription.type.ts"],"sourcesContent":["import z from 'zod';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/types/calculate-subscription.type.ts"],"sourcesContent":["import z from 'zod';\n\nexport const CalculateSubscriptionPlanExtraRequestSchema = z.object({\n id_addon: z.number(),\n value: z.number(),\n quantity: z.number(),\n currency: z.string(),\n});\n\nexport const CalculateSubscriptionRequestSchema = z.object({\n id_product: z.number(),\n id_plan: z.number().optional(),\n id_subscription: z.union([z.number(), z.string()]).optional(),\n id_coupon: z.number().optional(),\n plan_extras: z.array(CalculateSubscriptionPlanExtraRequestSchema.partial({ value: true })).optional(),\n});\n\nexport type CalculateSubscriptionRequest = z.infer<typeof CalculateSubscriptionRequestSchema>;\n\nexport const CalculateSubscriptionPlanExtraResponseSchema = z.object({\n id_addon: z.number(),\n value: z.number(),\n value_original: z.number().optional().default(0),\n value_discount: z.number().optional().default(0),\n quantity: z.number(),\n currency: z.string(),\n});\n\nexport const CalculateSubscriptionResponseSchema = z.object({\n name: z.string(),\n month: z.number(),\n month_discount: z.number(),\n month_discount_coupom: z.number().optional().default(0),\n month_original: z.number(),\n month_original_discount: z.number().optional().default(0),\n month_original_discount_cupom: z.number().optional().default(0),\n semmester: z.number(),\n semmester_price: z.number().optional().default(0),\n semmester_discount: z.number(),\n semmester_discount_coupom: z.number().optional().default(0),\n semmester_original: z.number(),\n semmester_original_discount: z.number().optional().default(0),\n semmester_original_discount_cupom: z.number().optional().default(0),\n year: z.number(),\n year_discount: z.number(),\n year_discount_coupom: z.number().optional().default(0),\n year_original: z.number(),\n year_original_discount: z.number().optional().default(0),\n year_original_discount_cupom: z.number().optional().default(0),\n plan_extras: z.array(CalculateSubscriptionPlanExtraResponseSchema),\n});\n\nexport type CalculateSubscriptionResponse = z.infer<typeof CalculateSubscriptionResponseSchema>;\n\nexport const UpdateSubscriptionPlanExtraSchema = z.object({\n id_addon: z.number(),\n value: z.number().optional(),\n quantity: z.number(),\n price: z.string().optional(),\n trial: z.boolean().optional(),\n trial_days: z.number().optional(),\n});\n\nexport const UpdateSubscriptionPlanRequestSchema = z.object({\n id_plan: z.number().optional(),\n id_coupon: z.union([z.number(), z.null()]).optional(),\n date_due: z.string().optional(),\n type: z.string().optional(),\n active: z.boolean().optional(),\n periodicity: z.number().optional(),\n plan_extras: z.array(UpdateSubscriptionPlanExtraSchema).optional(),\n enable_charge: z.boolean().optional(),\n});\n\nexport type UpdateSubscriptionPlanRequest = z.infer<typeof UpdateSubscriptionPlanRequestSchema>;\n"],"mappings":"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","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/build-plan-extras.ts"],"sourcesContent":["import type { SubscriptionItem } from '../types/subscription.type';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/build-plan-extras.ts"],"sourcesContent":["import type { SubscriptionItem } from '../types/subscription.type';\n\nexport interface PlanExtraOverride {\n id_addon: number;\n quantity: number;\n currency: string;\n}\n\nexport interface PlanExtra {\n id_addon: number;\n value?: number;\n quantity: number;\n currency: string;\n}\n\nexport function buildPlanExtras(\n items: SubscriptionItem[],\n overrides: PlanExtraOverride[]\n): PlanExtra[] {\n const overrideMap = new Map(overrides.map((o) => [o.id_addon, o]));\n const seen = new Set<number>();\n\n const extras: PlanExtra[] = [];\n\n for (const item of items) {\n if (item.id_addon == null || seen.has(item.id_addon)) continue;\n seen.add(item.id_addon);\n\n const override = overrideMap.get(item.id_addon);\n if (override) {\n overrideMap.delete(item.id_addon);\n extras.push({\n id_addon: override.id_addon,\n quantity: override.quantity,\n currency: override.currency,\n });\n } else {\n extras.push({\n id_addon: item.id_addon,\n value: item.value,\n quantity: item.quantity,\n currency: item.currency,\n });\n }\n }\n\n for (const override of overrideMap.values()) {\n extras.push({\n id_addon: override.id_addon,\n quantity: override.quantity,\n currency: override.currency,\n });\n }\n\n return extras;\n}\n"],"mappings":"AAeO,SAAS,gBACd,OACA,WACa;AACb,QAAM,cAAc,IAAI,IAAI,UAAU,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AACjE,QAAM,OAAO,oBAAI,IAAY;AAE7B,QAAM,SAAsB,CAAC;AAE7B,aAAW,QAAQ,OAAO;AACxB,QAAI,KAAK,YAAY,QAAQ,KAAK,IAAI,KAAK,QAAQ,EAAG;AACtD,SAAK,IAAI,KAAK,QAAQ;AAEtB,UAAM,WAAW,YAAY,IAAI,KAAK,QAAQ;AAC9C,QAAI,UAAU;AACZ,kBAAY,OAAO,KAAK,QAAQ;AAChC,aAAO,KAAK;AAAA,QACV,UAAU,SAAS;AAAA,QACnB,UAAU,SAAS;AAAA,QACnB,UAAU,SAAS;AAAA,MACrB,CAAC;AAAA,IACH,OAAO;AACL,aAAO,KAAK;AAAA,QACV,UAAU,KAAK;AAAA,QACf,OAAO,KAAK;AAAA,QACZ,UAAU,KAAK;AAAA,QACf,UAAU,KAAK;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,EACF;AAEA,aAAW,YAAY,YAAY,OAAO,GAAG;AAC3C,WAAO,KAAK;AAAA,MACV,UAAU,SAAS;AAAA,MACnB,UAAU,SAAS;AAAA,MACnB,UAAU,SAAS;AAAA,IACrB,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/periodicity.ts"],"sourcesContent":["import type { BillingPeriod } from '../types/billing-period.type';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/periodicity.ts"],"sourcesContent":["import type { BillingPeriod } from '../types/billing-period.type';\nimport type { CalculateSubscriptionResponse } from '../types/calculate-subscription.type';\n\nexport function periodicityToBillingPeriod(\n periodicity: number | string | null | undefined\n): BillingPeriod | null {\n if (periodicity === 30 || periodicity === 1 || periodicity === 'monthly') return 'monthly';\n if (periodicity === 180 || periodicity === 3 || periodicity === 'semiannual') return 'semiannual';\n if (periodicity === 365 || periodicity === 2 || periodicity === 'annual') return 'annual';\n return null;\n}\n\nexport function billingPeriodToNumeric(billingPeriod: BillingPeriod): 30 | 180 | 365 {\n if (billingPeriod === 'semiannual') return 180;\n if (billingPeriod === 'annual') return 365;\n return 30;\n}\n\nexport function getPeriodicityLabel(periodicity: number | string | null | undefined): string {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'semiannual') return 'Semestral';\n if (period === 'annual') return 'Anual';\n return 'Mensal';\n}\n\nexport function getBillingPeriodSuffix(billingPeriod: BillingPeriod): string {\n if (billingPeriod === 'semiannual') return '/semestre';\n if (billingPeriod === 'annual') return '/ano';\n return '/mês';\n}\n\nexport function getBillingPeriodLabel(billingPeriod: BillingPeriod): string {\n if (billingPeriod === 'semiannual') return 'semestral';\n if (billingPeriod === 'annual') return 'anual';\n return 'mensal';\n}\n\nexport function getBillingPeriodMonths(billingPeriod: BillingPeriod): number {\n if (billingPeriod === 'semiannual') return 6;\n if (billingPeriod === 'annual') return 12;\n return 1;\n}\n\nexport function getPriceFromCalculatedData(\n data: CalculateSubscriptionResponse,\n periodicity: number | string | null | undefined\n): number {\n const period = periodicityToBillingPeriod(periodicity);\n if (period === 'annual') return data.year;\n if (period === 'semiannual') return data.semmester;\n return data.month;\n}\n"],"mappings":"AAGO,SAAS,2BACd,aACsB;AACtB,MAAI,gBAAgB,MAAM,gBAAgB,KAAK,gBAAgB,UAAW,QAAO;AACjF,MAAI,gBAAgB,OAAO,gBAAgB,KAAK,gBAAgB,aAAc,QAAO;AACrF,MAAI,gBAAgB,OAAO,gBAAgB,KAAK,gBAAgB,SAAU,QAAO;AACjF,SAAO;AACT;AAEO,SAAS,uBAAuB,eAA8C;AACnF,MAAI,kBAAkB,aAAc,QAAO;AAC3C,MAAI,kBAAkB,SAAU,QAAO;AACvC,SAAO;AACT;AAEO,SAAS,oBAAoB,aAAyD;AAC3F,QAAM,SAAS,2BAA2B,WAAW;AACrD,MAAI,WAAW,aAAc,QAAO;AACpC,MAAI,WAAW,SAAU,QAAO;AAChC,SAAO;AACT;AAEO,SAAS,uBAAuB,eAAsC;AAC3E,MAAI,kBAAkB,aAAc,QAAO;AAC3C,MAAI,kBAAkB,SAAU,QAAO;AACvC,SAAO;AACT;AAEO,SAAS,sBAAsB,eAAsC;AAC1E,MAAI,kBAAkB,aAAc,QAAO;AAC3C,MAAI,kBAAkB,SAAU,QAAO;AACvC,SAAO;AACT;AAEO,SAAS,uBAAuB,eAAsC;AAC3E,MAAI,kBAAkB,aAAc,QAAO;AAC3C,MAAI,kBAAkB,SAAU,QAAO;AACvC,SAAO;AACT;AAEO,SAAS,2BACd,MACA,aACQ;AACR,QAAM,SAAS,2BAA2B,WAAW;AACrD,MAAI,WAAW,SAAU,QAAO,KAAK;AACrC,MAAI,WAAW,aAAc,QAAO,KAAK;AACzC,SAAO,KAAK;AACd;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/resolve-plan-extras-prices.ts"],"sourcesContent":["import 'server-only';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/utils/resolve-plan-extras-prices.ts"],"sourcesContent":["import 'server-only';\n\nimport type { SubscriptionItem } from '../types/subscription.type';\n\ninterface PlanExtraInput {\n id_addon: number;\n value?: number;\n quantity: number;\n [key: string]: unknown;\n}\n\nexport function resolvePlanExtrasPrices<T extends PlanExtraInput>(\n extras: T[],\n subscriptionItems: SubscriptionItem[]\n): T[] {\n return extras.map((extra) => {\n const item = subscriptionItems.find((i) => i.id_addon === extra.id_addon);\n if (item) {\n return { ...extra, value: item.value };\n }\n return { ...extra, value: extra.value ?? 0 };\n });\n}\n"],"mappings":"AAAA,OAAO;AAWA,SAAS,wBACd,QACA,mBACK;AACL,SAAO,OAAO,IAAI,CAAC,UAAU;AAC3B,UAAM,OAAO,kBAAkB,KAAK,CAAC,MAAM,EAAE,aAAa,MAAM,QAAQ;AACxE,QAAI,MAAM;AACR,aAAO,EAAE,GAAG,OAAO,OAAO,KAAK,MAAM;AAAA,IACvC;AACA,WAAO,EAAE,GAAG,OAAO,OAAO,MAAM,SAAS,EAAE;AAAA,EAC7C,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/users/action/find-user-by-id.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/users/action/find-user-by-id.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { userService } from '../services/user.service';\n\nexport async function findUserById() {\n return safeServerAction(() => userService.findById());\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAE5B,eAAsB,eAAe;AACnC,SAAO,iBAAiB,MAAM,YAAY,SAAS,CAAC;AACtD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/users/action/list-messages.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/users/action/list-messages.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { messagesService } from '../services/messages.service';\nimport type { FindMessagesParams } from '../schema/messages.schema';\n\nexport async function listMessagesAction(params?: Partial<FindMessagesParams>) {\n return safeServerAction(async () => {\n const result = await messagesService.listMessages(params);\n return { data: result.data, total: result.total, totalUnread: result.totalUnread };\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAGhC,eAAsB,mBAAmB,QAAsC;AAC7E,SAAO,iBAAiB,YAAY;AAClC,UAAM,SAAS,MAAM,gBAAgB,aAAa,MAAM;AACxD,WAAO,EAAE,MAAM,OAAO,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,YAAY;AAAA,EACnF,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/users/action/mark-all-messages-as-read.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/users/action/mark-all-messages-as-read.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { messagesService } from '../services/messages.service';\n\nexport async function markAllMessagesAsReadAction() {\n return safeServerAction(() => messagesService.markAllAsRead());\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAEhC,eAAsB,8BAA8B;AAClD,SAAO,iBAAiB,MAAM,gBAAgB,cAAc,CAAC;AAC/D;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/users/action/mark-message-as-read.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/users/action/mark-message-as-read.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { messagesService } from '../services/messages.service';\n\nexport async function markMessageAsReadAction(messageId: string) {\n return safeServerAction(() => messagesService.markAsRead(messageId));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAEhC,eAAsB,wBAAwB,WAAmB;AAC/D,SAAO,iBAAiB,MAAM,gBAAgB,WAAW,SAAS,CAAC;AACrE;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/users/hooks/messages.hook.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/users/hooks/messages.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { listMessagesAction } from '../action/list-messages.action';\nimport { markMessageAsReadAction } from '../action/mark-message-as-read.action';\nimport { markAllMessagesAsReadAction } from '../action/mark-all-messages-as-read.action';\nimport { withAction } from '../../../utils/withAction';\nimport type { FindMessagesParams } from '../schema/messages.schema';\n\nexport const MESSAGES_QUERY_KEY = ['messages'];\n\nconst INFINITE_MESSAGES_PAGE_SIZE = 10;\n\nexport function useMessages(params?: Partial<FindMessagesParams>) {\n return useQuery({\n queryKey: [...MESSAGES_QUERY_KEY, params],\n queryFn: withAction(() => listMessagesAction(params)),\n });\n}\n\nexport function useInfiniteMessages(params?: Partial<Omit<FindMessagesParams, 'page' | 'limit'>>) {\n return useInfiniteQuery({\n queryKey: [...MESSAGES_QUERY_KEY, 'infinite', params],\n queryFn: ({ pageParam }) =>\n withAction(() =>\n listMessagesAction({\n ...params,\n page: pageParam as number,\n limit: INFINITE_MESSAGES_PAGE_SIZE,\n })\n )(),\n getNextPageParam: (lastPage, allPages) => {\n const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);\n return loaded < lastPage.total ? allPages.length + 1 : undefined;\n },\n initialPageParam: 1,\n });\n}\n\nexport function useMarkMessageAsRead() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(markMessageAsReadAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEY });\n },\n });\n}\n\nexport function useMarkAllMessagesAsRead() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(markAllMessagesAsReadAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: MESSAGES_QUERY_KEY });\n },\n });\n}\n"],"mappings":";AAEA,SAAS,kBAAkB,aAAa,UAAU,sBAAsB;AACxE,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,mCAAmC;AAC5C,SAAS,kBAAkB;AAGpB,MAAM,qBAAqB,CAAC,UAAU;AAE7C,MAAM,8BAA8B;AAE7B,SAAS,YAAY,QAAsC;AAChE,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,GAAG,oBAAoB,MAAM;AAAA,IACxC,SAAS,WAAW,MAAM,mBAAmB,MAAM,CAAC;AAAA,EACtD,CAAC;AACH;AAEO,SAAS,oBAAoB,QAA8D;AAChG,SAAO,iBAAiB;AAAA,IACtB,UAAU,CAAC,GAAG,oBAAoB,YAAY,MAAM;AAAA,IACpD,SAAS,CAAC,EAAE,UAAU,MACpB;AAAA,MAAW,MACT,mBAAmB;AAAA,QACjB,GAAG;AAAA,QACH,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,IACH,EAAE;AAAA,IACJ,kBAAkB,CAAC,UAAU,aAAa;AACxC,YAAM,SAAS,SAAS,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ,CAAC;AACjE,aAAO,SAAS,SAAS,QAAQ,SAAS,SAAS,IAAI;AAAA,IACzD;AAAA,IACA,kBAAkB;AAAA,EACpB,CAAC;AACH;AAEO,SAAS,uBAAuB;AACrC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,uBAAuB;AAAA,IAC9C,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,mBAAmB,CAAC;AAAA,IAChE;AAAA,EACF,CAAC;AACH;AAEO,SAAS,2BAA2B;AACzC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,2BAA2B;AAAA,IAClD,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,mBAAmB,CAAC;AAAA,IAChE;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/users/services/messages.service.ts"],"sourcesContent":["import 'server-only';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/users/services/messages.service.ts"],"sourcesContent":["import 'server-only';\n\nimport { api } from '../../../infra/api/client';\nimport { buildQueryParams } from '../../../infra/utils/params';\nimport { getUserContext } from '../../auth/utils/get-user-context';\nimport {\n FindMessagesParams,\n ListMessagesApiResponse,\n MarkAsReadApiResponse,\n MarkAllAsReadApiResponse,\n} from '../schema/messages.schema';\n\nclass MessagesService {\n async listMessages(\n params?: Partial<FindMessagesParams>\n ): Promise<ListMessagesApiResponse> {\n const { id_account, id_user } = await getUserContext();\n\n const query = buildQueryParams({\n id_account,\n id_user,\n type: 'notification',\n limit: 20,\n page: 1,\n order: 'desc',\n ...params,\n });\n\n const url = `/accounts/${id_account}/messages${query ? `?${query}` : ''}`;\n return api.apps.get<ListMessagesApiResponse>(url);\n }\n\n async markAsRead(messageId: string): Promise<MarkAsReadApiResponse> {\n const { id_account } = await getUserContext();\n\n const url = `/accounts/${id_account}/messages/${messageId}/action/markAsRead`;\n return api.apps.put<MarkAsReadApiResponse>(url);\n }\n\n async markAllAsRead(): Promise<MarkAllAsReadApiResponse> {\n const { id_account, id_user } = await getUserContext();\n\n const url = `/accounts/${id_account}/messages/action/markAllAsRead`;\n return api.apps.put<MarkAllAsReadApiResponse>(url, { id_user });\n }\n}\n\nexport const messagesService = new MessagesService();\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAQ/B,MAAM,gBAAgB;AAAA,EACpB,MAAM,aACJ,QACkC;AAClC,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AAErD,UAAM,QAAQ,iBAAiB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,MACN,OAAO;AAAA,MACP,GAAG;AAAA,IACL,CAAC;AAED,UAAM,MAAM,aAAa,UAAU,YAAY,QAAQ,IAAI,KAAK,KAAK,EAAE;AACvE,WAAO,IAAI,KAAK,IAA6B,GAAG;AAAA,EAClD;AAAA,EAEA,MAAM,WAAW,WAAmD;AAClE,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,MAAM,aAAa,UAAU,aAAa,SAAS;AACzD,WAAO,IAAI,KAAK,IAA2B,GAAG;AAAA,EAChD;AAAA,EAEA,MAAM,gBAAmD;AACvD,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AAErD,UAAM,MAAM,aAAa,UAAU;AACnC,WAAO,IAAI,KAAK,IAA8B,KAAK,EAAE,QAAQ,CAAC;AAAA,EAChE;AACF;AAEO,MAAM,kBAAkB,IAAI,gBAAgB;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/find-whitelabel-styles.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/find-whitelabel-styles.action.ts"],"sourcesContent":["'use server';\n\nimport { cache } from 'react';\nimport { whitelabelStylesService } from '../services/whitelabel-styles.service';\nimport { WhitelabelStylesData } from '../styles-schema';\n\nexport const findWhitelabelStyles = cache(async (id_wl: number): Promise<WhitelabelStylesData | null> => {\n try {\n return await whitelabelStylesService.getByWlId(id_wl);\n } catch (error) {\n console.error('[findWhitelabelStyles] Error fetching styles:', error);\n return null;\n }\n});\n"],"mappings":";AAEA,SAAS,aAAa;AACtB,SAAS,+BAA+B;AAGjC,MAAM,uBAAuB,MAAM,OAAO,UAAwD;AACvG,MAAI;AACF,WAAO,MAAM,wBAAwB,UAAU,KAAK;AAAA,EACtD,SAAS,OAAO;AACd,YAAQ,MAAM,iDAAiD,KAAK;AACpE,WAAO;AAAA,EACT;AACF,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/find-whitelabel.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/find-whitelabel.action.ts"],"sourcesContent":["'use server';\n\n\nimport { headers } from \"next/headers\";\nimport { whitelabelService } from \"../services/whitelabel.service\";\nimport { ApiError } from \"../../../infra/api/types\";\nimport { cache } from \"react\";\n\nexport const findWhitelabel = cache(async () => {\n const headersList = await headers();\n const host = headersList.get('host');\n\n if (!host) {\n throw new ApiError('Host header not found', 'HOST_NOT_FOUND', 400);\n }\n\n const whitelabel = await whitelabelService.getTokenByDomain(host);\n\n if (!whitelabel) {\n throw new ApiError('Whitelabel not found', 'WL_NOT_FOUND', 404);\n }\n\n return whitelabel;\n});"],"mappings":";AAGA,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAEf,MAAM,iBAAiB,MAAM,YAAY;AAC5C,QAAM,cAAc,MAAM,QAAQ;AAClC,QAAM,OAAO,YAAY,IAAI,MAAM;AAEnC,MAAI,CAAC,MAAM;AACP,UAAM,IAAI,SAAS,yBAAyB,kBAAkB,GAAG;AAAA,EACrE;AAEA,QAAM,aAAa,MAAM,kBAAkB,iBAAiB,IAAI;AAEhE,MAAI,CAAC,YAAY;AACb,UAAM,IAAI,SAAS,wBAAwB,gBAAgB,GAAG;AAAA,EAClE;AAEA,SAAO;AACX,CAAC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/revalidate-whitelabel-styles.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/revalidate-whitelabel-styles.action.ts"],"sourcesContent":["'use server';\n\nimport { whitelabelStylesService } from '../services/whitelabel-styles.service';\nimport { safeServerAction } from '../../../utils/safeServerAction';\n\nexport async function revalidateWhitelabelStylesAction(id_wl: number) {\n return safeServerAction(async () => {\n return whitelabelStylesService.revalidateByWlId(id_wl);\n });\n}\n"],"mappings":";AAEA,SAAS,+BAA+B;AACxC,SAAS,wBAAwB;AAEjC,eAAsB,iCAAiC,OAAe;AACpE,SAAO,iBAAiB,YAAY;AAClC,WAAO,wBAAwB,iBAAiB,KAAK;AAAA,EACvD,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/revalidate-whitelabel.action.ts"],"sourcesContent":["'use server';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/whitelabel/actions/revalidate-whitelabel.action.ts"],"sourcesContent":["'use server';\n\nimport { headers } from 'next/headers';\nimport { whitelabelService } from '../services/whitelabel.service';\nimport { ApiError } from '../../../infra/api/types';\nimport { safeServerAction } from '../../../utils/safeServerAction';\n\nexport async function revalidateWhitelabelAction() {\n return safeServerAction(async () => {\n const headersList = await headers();\n const host = headersList.get('host');\n\n if (!host) {\n throw new ApiError('Host header not found', 'HOST_NOT_FOUND', 400);\n }\n\n return whitelabelService.revalidateByDomain(host);\n });\n}\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AAEjC,eAAsB,6BAA6B;AACjD,SAAO,iBAAiB,YAAY;AAClC,UAAM,cAAc,MAAM,QAAQ;AAClC,UAAM,OAAO,YAAY,IAAI,MAAM;AAEnC,QAAI,CAAC,MAAM;AACT,YAAM,IAAI,SAAS,yBAAyB,kBAAkB,GAAG;AAAA,IACnE;AAEA,WAAO,kBAAkB,mBAAmB,IAAI;AAAA,EAClD,CAAC;AACH;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/whitelabel/services/whitelabel-styles.service.ts"],"sourcesContent":["import greatCache from '@greatapps/cache';\
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/whitelabel/services/whitelabel-styles.service.ts"],"sourcesContent":["import greatCache from '@greatapps/cache';\nimport { ApiError } from '../../../infra/api/types';\nimport { WhitelabelStylesData, GeneralStyleJson } from '../styles-schema';\n\ninterface WithStyleApiResponse {\n status: number;\n data: Record<string, unknown>[];\n}\n\nfunction parseStyleField<T>(value: unknown): T | null {\n if (typeof value === 'string') {\n try { return JSON.parse(value) as T; } catch { return null; }\n }\n if (value && typeof value === 'object') return value as T;\n return null;\n}\n\nfunction mapWithStyleResponse(row: Record<string, unknown>): WhitelabelStylesData {\n const general = parseStyleField<GeneralStyleJson>(row['style_general']);\n\n if (general) {\n if (!general.logo && row['logo']) general.logo = row['logo'] as string;\n if (!general.favicon && row['favicon']) general.favicon = row['favicon'] as string;\n }\n\n return {\n id: row['style_id'] as number,\n id_wl: row['style_id_wl'] as number,\n general,\n signin_page: parseStyleField(row['style_signin_page']),\n signup_page: parseStyleField(row['style_signup_page']),\n dashboard: parseStyleField(row['style_dashboard']),\n };\n}\n\nclass WhitelabelStylesService {\n private getApiUrl(): string {\n const apiUrl = process.env.GAPPS_R3_API_URL;\n if (!apiUrl) throw new ApiError('GAPPS_R3_API_URL not configured', 'CONFIG_ERROR', 500);\n return apiUrl;\n }\n\n private getToken(): string {\n const token = process.env.WHITELABEL_TOKEN_MASTER;\n if (!token) throw new ApiError('WHITELABEL_TOKEN_MASTER not configured', 'CONFIG_ERROR', 500);\n return token;\n }\n\n private createCache() {\n return new greatCache({\n service: 'whitelabel-styles-service',\n version: '1.0',\n domain: 'whitelabel-cache.greatapps.com.br',\n ambient: process.env.NODE_ENV || 'development',\n });\n }\n\n private getCacheKey(id_wl: number): string {\n return `whitelabel-styles-${id_wl}`;\n }\n\n private async fetchFromApi(id_wl: number): Promise<WhitelabelStylesData | null> {\n const apiUrl = this.getApiUrl();\n const token = this.getToken();\n const url = `${apiUrl}/v1/pt-br/1/whitelabels/${id_wl}/with-style`;\n\n console.log('[WhitelabelStylesService] Fetching with-style for id_wl', { id_wl, url });\n\n const response = await fetch(url, {\n method: 'GET',\n headers: { authorization: token },\n });\n\n if (!response.ok) {\n console.error('[WhitelabelStylesService] Failed to fetch with-style', { status: response.status });\n return null;\n }\n\n const result: WithStyleApiResponse = await response.json();\n\n if (result.status !== 1 || !result.data?.length) {\n console.warn('[WhitelabelStylesService] No data in with-style for id_wl', { id_wl });\n return null;\n }\n\n return mapWithStyleResponse(result.data[0]);\n }\n\n async getByWlId(id_wl: number): Promise<WhitelabelStylesData | null> {\n const cache = this.createCache();\n const cacheKey = this.getCacheKey(id_wl);\n\n const cachedData = await cache.select(cacheKey);\n\n if (cachedData.status == 1 && 'data' in cachedData && cachedData.data) {\n console.log('[WhitelabelStylesService] Cache hit for id_wl', { id_wl });\n return JSON.parse(cachedData.data) as WhitelabelStylesData;\n }\n\n const parsed = await this.fetchFromApi(id_wl);\n\n if (parsed?.id) {\n await cache.insert(cacheKey, JSON.stringify(parsed), 300);\n }\n\n return parsed;\n }\n\n async revalidateByWlId(id_wl: number): Promise<WhitelabelStylesData | null> {\n const cache = this.createCache();\n const cacheKey = this.getCacheKey(id_wl);\n\n console.log('[WhitelabelStylesService] Revalidating cache for id_wl', { id_wl });\n\n await cache.delete(cacheKey);\n\n const parsed = await this.fetchFromApi(id_wl);\n\n if (parsed?.id) {\n await cache.insert(cacheKey, JSON.stringify(parsed), 300);\n }\n\n console.log('[WhitelabelStylesService] Cache revalidated for id_wl', { id_wl });\n\n return parsed;\n }\n}\n\nexport const whitelabelStylesService = new WhitelabelStylesService();\n"],"mappings":"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","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/whitelabel.provider.tsx"],"sourcesContent":["\"use client\";\
|
|
1
|
+
{"version":3,"sources":["../../src/providers/whitelabel.provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, ReactNode, useContext } from \"react\";\nimport type { WhitelabelData, GeneralStyleJson, PageStyleJson, DashboardStyleJson } from \"../modules/whitelabel/schema\";\n\ninterface WhitelabelContextProps {\n whitelabel: WhitelabelData | null;\n}\n\nconst WhitelabelContext = createContext<WhitelabelContextProps | undefined>(undefined);\n\ninterface WhitelabelProviderProps {\n children: ReactNode;\n whitelabel: WhitelabelData | null;\n}\n\nexport function WhitelabelProvider({\n children,\n whitelabel,\n}: WhitelabelProviderProps) {\n return (\n <WhitelabelContext.Provider value={{ whitelabel }}>\n {children}\n </WhitelabelContext.Provider>\n );\n}\n\nexport function useWhitelabel(): WhitelabelContextProps {\n const context = useContext(WhitelabelContext);\n if (context === undefined) {\n throw new Error(\"useWhitelabel deve ser usado dentro de um WhitelabelProvider\");\n }\n return context;\n}\n\nexport function useWhitelabelStyles() {\n const { whitelabel } = useWhitelabel();\n return {\n general: whitelabel?.general ?? null,\n signin_page: whitelabel?.signin_page ?? null,\n signup_page: whitelabel?.signup_page ?? null,\n dashboard: whitelabel?.dashboard ?? null,\n };\n}\n\nexport function useWhitelabelUrls() {\n const { whitelabel } = useWhitelabel();\n return {\n editorUrl: whitelabel?.editor_url ?? '',\n pagesUrl: whitelabel?.pages_url ?? '',\n accountsUrl: whitelabel?.accounts_url ?? '',\n previewUrl: whitelabel?.pages_preview_url ?? '',\n };\n}\n"],"mappings":";AAqBI;AAnBJ,SAAS,eAA0B,kBAAkB;AAOrD,MAAM,oBAAoB,cAAkD,MAAS;AAO9E,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAA4B;AAC1B,SACE,oBAAC,kBAAkB,UAAlB,EAA2B,OAAO,EAAE,WAAW,GAC7C,UACH;AAEJ;AAEO,SAAS,gBAAwC;AACtD,QAAM,UAAU,WAAW,iBAAiB;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,8DAA8D;AAAA,EAChF;AACA,SAAO;AACT;AAEO,SAAS,sBAAsB;AACpC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO;AAAA,IACL,SAAS,YAAY,WAAW;AAAA,IAChC,aAAa,YAAY,eAAe;AAAA,IACxC,aAAa,YAAY,eAAe;AAAA,IACxC,WAAW,YAAY,aAAa;AAAA,EACtC;AACF;AAEO,SAAS,oBAAoB;AAClC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO;AAAA,IACL,WAAW,YAAY,cAAc;AAAA,IACrC,UAAU,YAAY,aAAa;AAAA,IACnC,aAAa,YAAY,gBAAgB;AAAA,IACzC,YAAY,YAAY,qBAAqB;AAAA,EAC/C;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { AccountSectionType } from '../enums/AccountSectionType';\n\ntype AccountModalType =\n | 'configurations'\n | 'deleteAccount'\n | 'isntPossibleDelete'\n | 'confirmDelete';\n\nexport interface AccountModalsConfig {\n hasActiveSubscription?: boolean;\n onGoToSubscription?: () => void;\n}\n\ninterface AccountModalsState {\n activeModal: AccountModalType | null;\n config: AccountModalsConfig;\n initialSection?: AccountSectionType;\n pagesCount: number;\n\n /** Called by <AccountModals> to keep app-level config in sync */\n updateConfig: (config: AccountModalsConfig) => void;\n\n openConfigurations: (initialSection?: AccountSectionType) => void;\n openDeleteAccount: (pagesCount?: number) => void;\n openIsntPossibleDelete: () => void;\n openConfirmDelete: (pagesCount?: number) => void;\n close: () => void;\n}\n\nexport const useAccountModals = create<AccountModalsState>((set) => ({\n activeModal: null,\n config: {},\n initialSection: undefined,\n pagesCount: 0,\n\n updateConfig: (config) => set({ config }),\n\n openConfigurations: (initialSection) =>\n set({ activeModal: 'configurations', initialSection }),\n\n openDeleteAccount: (pagesCount = 0) =>\n set({ activeModal: 'deleteAccount', pagesCount }),\n\n openIsntPossibleDelete: () =>\n set({ activeModal: 'isntPossibleDelete' }),\n\n openConfirmDelete: (pagesCount = 0) =>\n set({ activeModal: 'confirmDelete', pagesCount }),\n\n close: () =>\n set({ activeModal: null, initialSection: undefined }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AA8BhB,MAAM,mBAAmB,OAA2B,CAAC,SAAS;AAAA,EACnE,aAAa;AAAA,EACb,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA,EAChB,YAAY;AAAA,EAEZ,cAAc,CAAC,WAAW,IAAI,EAAE,OAAO,CAAC;AAAA,EAExC,oBAAoB,CAAC,mBACnB,IAAI,EAAE,aAAa,kBAAkB,eAAe,CAAC;AAAA,EAEvD,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,wBAAwB,MACtB,IAAI,EAAE,aAAa,qBAAqB,CAAC;AAAA,EAE3C,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,OAAO,MACL,IAAI,EAAE,aAAa,MAAM,gBAAgB,OAAU,CAAC;AACxD,EAAE;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/useBuyCreditsModal.ts"],"sourcesContent":["import { useModalManager } from './useModalManager';\
|
|
1
|
+
{"version":3,"sources":["../../src/store/useBuyCreditsModal.ts"],"sourcesContent":["import { useModalManager } from './useModalManager';\n\ninterface BuyCreditsModalData {\n onConfirm?: (creditAmount: number, price: number) => void;\n initialActiveCardId?: string;\n initialSelectedValue?: number;\n}\n\nexport const useBuyCreditsModal = () => {\n const { activeModal, modalData, openModal, closeModal } = useModalManager();\n\n const isOpen = activeModal === 'buyCreditsModal';\n const data = modalData as BuyCreditsModalData;\n\n return {\n open: isOpen,\n onConfirm: data?.onConfirm,\n initialActiveCardId: data?.initialActiveCardId,\n initialSelectedValue: data?.initialSelectedValue,\n\n openModal: (onConfirm?: (creditAmount: number, price: number) => void) =>\n openModal('buyCreditsModal', { onConfirm }),\n closeModal,\n };\n};\n"],"mappings":"AAAA,SAAS,uBAAuB;AAQzB,MAAM,qBAAqB,MAAM;AACtC,QAAM,EAAE,aAAa,WAAW,WAAW,WAAW,IAAI,gBAAgB;AAE1E,QAAM,SAAS,gBAAgB;AAC/B,QAAM,OAAO;AAEb,SAAO;AAAA,IACL,MAAM;AAAA,IACN,WAAW,MAAM;AAAA,IACjB,qBAAqB,MAAM;AAAA,IAC3B,sBAAsB,MAAM;AAAA,IAE5B,WAAW,CAAC,cACV,UAAU,mBAAmB,EAAE,UAAU,CAAC;AAAA,IAC5C;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/useModalManager.ts"],"sourcesContent":["'use client';\
|
|
1
|
+
{"version":3,"sources":["../../src/store/useModalManager.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ModalData = Record<string, any>;\n\ninterface ModalStackItem {\n key: string;\n data: ModalData;\n}\n\ninterface ModalState {\n modalStack: ModalStackItem[];\n activeModal: string | null;\n modalData: ModalData;\n openModal: (key: string, data?: ModalData) => void;\n /** Closes the top modal in the stack */\n closeModal: () => void;\n /** Closes a specific modal by key */\n closeModalByKey: (key: string) => void;\n updateModalData: (data: ModalData) => void;\n isModalOpen: (key: string) => boolean;\n getModalData: (key: string) => ModalData;\n}\n\nexport const useModalManager = create<ModalState>((set, get) => ({\n modalStack: [],\n activeModal: null,\n modalData: {},\n\n openModal: (key, data = {}) => {\n set((state) => {\n const existingIndex = state.modalStack.findIndex((item) => item.key === key);\n if (existingIndex !== -1) {\n const newStack = [...state.modalStack];\n newStack[existingIndex] = { key, data };\n return {\n modalStack: newStack,\n activeModal: newStack[newStack.length - 1]?.key ?? null,\n modalData: newStack[newStack.length - 1]?.data ?? {},\n };\n }\n\n const newStack = [...state.modalStack, { key, data }];\n return {\n modalStack: newStack,\n activeModal: key,\n modalData: data,\n };\n });\n },\n\n closeModal: () => {\n set((state) => {\n const newStack = state.modalStack.slice(0, -1);\n const topModal = newStack[newStack.length - 1];\n return {\n modalStack: newStack,\n activeModal: topModal?.key ?? null,\n modalData: topModal?.data ?? {},\n };\n });\n },\n\n closeModalByKey: (key: string) => {\n set((state) => {\n const newStack = state.modalStack.filter((item) => item.key !== key);\n const topModal = newStack[newStack.length - 1];\n return {\n modalStack: newStack,\n activeModal: topModal?.key ?? null,\n modalData: topModal?.data ?? {},\n };\n });\n },\n\n updateModalData: (data) => {\n set((state) => {\n if (state.modalStack.length === 0) return state;\n\n const newStack = [...state.modalStack];\n const lastIndex = newStack.length - 1;\n newStack[lastIndex] = {\n ...newStack[lastIndex],\n data: { ...newStack[lastIndex].data, ...data },\n };\n\n return {\n modalStack: newStack,\n modalData: newStack[lastIndex].data,\n };\n });\n },\n\n isModalOpen: (key: string) => {\n return get().modalStack.some((item) => item.key === key);\n },\n\n getModalData: (key: string) => {\n const item = get().modalStack.find((item) => item.key === key);\n return item?.data ?? {};\n },\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAwBhB,MAAM,kBAAkB,OAAmB,CAAC,KAAK,SAAS;AAAA,EAC/D,YAAY,CAAC;AAAA,EACb,aAAa;AAAA,EACb,WAAW,CAAC;AAAA,EAEZ,WAAW,CAAC,KAAK,OAAO,CAAC,MAAM;AAC7B,QAAI,CAAC,UAAU;AACb,YAAM,gBAAgB,MAAM,WAAW,UAAU,CAAC,SAAS,KAAK,QAAQ,GAAG;AAC3E,UAAI,kBAAkB,IAAI;AACxB,cAAMA,YAAW,CAAC,GAAG,MAAM,UAAU;AACrC,QAAAA,UAAS,aAAa,IAAI,EAAE,KAAK,KAAK;AACtC,eAAO;AAAA,UACL,YAAYA;AAAA,UACZ,aAAaA,UAASA,UAAS,SAAS,CAAC,GAAG,OAAO;AAAA,UACnD,WAAWA,UAASA,UAAS,SAAS,CAAC,GAAG,QAAQ,CAAC;AAAA,QACrD;AAAA,MACF;AAEA,YAAM,WAAW,CAAC,GAAG,MAAM,YAAY,EAAE,KAAK,KAAK,CAAC;AACpD,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,aAAa;AAAA,QACb,WAAW;AAAA,MACb;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,YAAY,MAAM;AAChB,QAAI,CAAC,UAAU;AACb,YAAM,WAAW,MAAM,WAAW,MAAM,GAAG,EAAE;AAC7C,YAAM,WAAW,SAAS,SAAS,SAAS,CAAC;AAC7C,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,aAAa,UAAU,OAAO;AAAA,QAC9B,WAAW,UAAU,QAAQ,CAAC;AAAA,MAChC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,iBAAiB,CAAC,QAAgB;AAChC,QAAI,CAAC,UAAU;AACb,YAAM,WAAW,MAAM,WAAW,OAAO,CAAC,SAAS,KAAK,QAAQ,GAAG;AACnE,YAAM,WAAW,SAAS,SAAS,SAAS,CAAC;AAC7C,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,aAAa,UAAU,OAAO;AAAA,QAC9B,WAAW,UAAU,QAAQ,CAAC;AAAA,MAChC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,iBAAiB,CAAC,SAAS;AACzB,QAAI,CAAC,UAAU;AACb,UAAI,MAAM,WAAW,WAAW,EAAG,QAAO;AAE1C,YAAM,WAAW,CAAC,GAAG,MAAM,UAAU;AACrC,YAAM,YAAY,SAAS,SAAS;AACpC,eAAS,SAAS,IAAI;AAAA,QACpB,GAAG,SAAS,SAAS;AAAA,QACrB,MAAM,EAAE,GAAG,SAAS,SAAS,EAAE,MAAM,GAAG,KAAK;AAAA,MAC/C;AAEA,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,WAAW,SAAS,SAAS,EAAE;AAAA,MACjC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,aAAa,CAAC,QAAgB;AAC5B,WAAO,IAAI,EAAE,WAAW,KAAK,CAAC,SAAS,KAAK,QAAQ,GAAG;AAAA,EACzD;AAAA,EAEA,cAAc,CAAC,QAAgB;AAC7B,UAAM,OAAO,IAAI,EAAE,WAAW,KAAK,CAACC,UAASA,MAAK,QAAQ,GAAG;AAC7D,WAAO,MAAM,QAAQ,CAAC;AAAA,EACxB;AACF,EAAE;","names":["newStack","item"]}
|