@greatapps/common 1.1.249 → 1.1.251
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/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/modules/subscriptions/types/subscription.type.mjs +1 -1
- package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -1
- package/dist/modules/whitelabel/actions/revalidate-whitelabel-styles.action.mjs +12 -0
- package/dist/modules/whitelabel/actions/revalidate-whitelabel-styles.action.mjs.map +1 -0
- package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs +19 -0
- package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs.map +1 -0
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs +35 -14
- package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +1 -1
- package/dist/modules/whitelabel/services/whitelabel.service.mjs +35 -13
- package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -1
- package/dist/providers/whitelabel.provider.mjs +9 -8
- package/dist/providers/whitelabel.provider.mjs.map +1 -1
- package/dist/server.mjs +3 -5
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/modules/subscriptions/types/subscription.type.ts +1 -1
- package/src/modules/whitelabel/actions/revalidate-whitelabel-styles.action.ts +10 -0
- package/src/modules/whitelabel/actions/revalidate-whitelabel.action.ts +19 -0
- package/src/modules/whitelabel/schema.ts +77 -49
- package/src/modules/whitelabel/services/whitelabel-styles.service.ts +47 -16
- package/src/modules/whitelabel/services/whitelabel.service.ts +50 -18
- package/src/providers/whitelabel.provider.tsx +10 -12
- package/src/server.ts +1 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./modules/auth/schema";
|
|
2
2
|
export * from "./modules/users/schema";
|
|
3
3
|
export * from "./modules/whitelabel/schema";
|
|
4
|
-
export * from "./modules/whitelabel/styles-schema";
|
|
5
4
|
export * from "./infra/api/types";
|
|
6
5
|
export * from "./providers/query.provider";
|
|
7
6
|
export * from "./providers/auth.provider";
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from \"./modules/auth/schema\";\nexport * from \"./modules/users/schema\";\nexport * from \"./modules/whitelabel/schema\";\nexport * from \"./modules/whitelabel/styles-schema\";\nexport * from \"./infra/api/types\";\n\n// Contexts\nexport * from \"./providers/query.provider\";\nexport * from \"./providers/auth.provider\";\nexport * from \"./providers/whitelabel.provider\";\n\n// Hooks\nexport {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport type {\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport { SUBSCRIPTIONS_QUERY_KEY } from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport { ADDON_IDS, AI_CREDIT_OPTIONS, AI_CREDIT_VALUES } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { AddonKindEnum, AiCreditOption } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { Plan, PlanItem } from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type { Card as PaymentCard } from \"./modules/cards/types\";\nexport { CardSchema as PaymentCardSchema } from \"./modules/cards/types\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { getPriceFromCalculatedData, periodicityToBillingPeriod } from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\n\n// Providers\nexport { QueryProvider } from \"./providers/query.provider\";\n\n// Middleware\nexport { createAuthMiddleware } from \"./middlewares/create-auth-middleware\";\nexport { createMiddlewareChain } from \"./middlewares/chain\";\nexport { continueChain, stopChain } from \"./middlewares/types\";\nexport type {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} from \"./components/layouts/MainLayout\";\nexport { NavBar } from \"./components/layouts/NavBar\";\nexport type { NavBarProps } from \"./components/layouts/NavBar\";\nexport { AppNavBar } from \"./components/layouts/AppNavBar\";\nexport type { AppNavBarProps } from \"./components/layouts/AppNavBar\";\nexport { AppMobileNavBar } from \"./components/layouts/AppMobileNavBar\";\nexport type { AppMobileNavBarProps } from \"./components/layouts/AppMobileNavBar\";\nexport { SideBarNavigation } from \"./components/layouts/SideBarNavigation\";\nexport { MdSideBarNavigation } from \"./components/layouts/MdSideBarNavigation\";\nexport { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from './components/navigation/AppNavigation';\nexport { CancelledSubscriptionBanner } from './components/navigation/CancelledSubscriptionBanner';\nexport type { NavItemConfig } from './components/navigation/subcomponents/NavItems';\nexport type { NavigationProject } from './components/navigation/types';\nexport { useMobileNavbarSheet } from './store/useMobileNavbarSheet';\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\n\n// UI - Buttons\nexport { Button, buttonVariants } from \"./components/ui/buttons/Button\";\nexport { CopyButton } from \"./components/ui/buttons/CopyButton\";\nexport { default as CancelButton } from \"./components/ui/buttons/CancelButton\";\n\n// UI - Data Display\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} from \"./components/ui/data-display/Tabs\";\nexport { UserAvatar } from \"./components/ui/data-display/UserAvatar\";\nexport type { UserAvatarProps } from \"./components/ui/data-display/UserAvatar\";\n\n// UI - Feedback\nexport { default as CircularProgress } from \"./components/ui/feedback/CircularProgress\";\nexport { default as DefaultCircularProgress } from \"./components/ui/feedback/DefaultCircularProgress\";\nexport { Progress } from \"./components/ui/feedback/Progress\";\nexport { LoadingOverlay } from \"./components/ui/feedback/LoadingOverlay\";\nexport {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} from \"./components/ui/feedback/Toast\";\nexport type { ToastProps } from \"./components/ui/feedback/Toast\";\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from \"./components/ui/form/Calendar\";\nexport { Checkbox } from \"./components/ui/form/Checkbox\";\nexport { DatePicker } from \"./components/ui/form/DatePicker\";\nexport { DateRangePicker } from \"./components/ui/form/DateRangePicker\";\nexport { Input } from \"./components/ui/form/Input\";\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport { CrispEmbed, openCrispHelpdesk, hideCrisp, showCrisp } from \"./components/embeds/CrispEmbed\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useModalManager } from \"./store/useModalManager\";\nexport type { ModalData } from \"./store/useModalManager\";\n\n// Enums\nexport { AccountSectionType } from \"./enums/AccountSectionType\";\n\n// Hooks\nexport { default as usePasswordVisibility } from \"./hooks/usePasswordVisibility\";\nexport { default as useCountdownTimer } from \"./hooks/useCountdownTimer\";\nexport { default as useIsMobile } from \"./hooks/useIsMobile\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} from \"./utils/intl/locales\";\nexport type { LocaleOption } from \"./utils/intl/locales\";\nexport { copyToClipboard, readFromClipboard } from \"./utils/browser/clipboard\";\n\n// UI - Form (new widgets)\nexport { FormField } from \"./components/ui/form/FormField\";\nexport { SelectField } from \"./components/ui/form/SelectField\";\nexport { ComboboxField } from \"./components/ui/form/ComboboxField\";\nexport type { ComboboxOption } from \"./components/ui/form/ComboboxField\";\nexport { default as PhoneInput } from \"./components/ui/form/PhoneInput\";\nexport { default as SwitchOptionFieldWithIcon } from \"./components/ui/form/SwitchOptionFieldWithIcon\";\nexport { TextAreaField } from \"./components/ui/form/TextAreaField\";\n\n// Account Module - Hooks\nexport {\n useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from \"./modules/accounts/hooks/useAccountManagement\";\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from \"./modules/accounts/types\";\n\nexport { default as AccountModals } from \"./components/account/AccountModals\";\nexport { useAccountModals } from \"./store/useAccountModals\";\nexport type { AccountModalsConfig } from \"./store/useAccountModals\";\n\nexport { ModalManager } from \"./components/modals/ModalManager\";\nexport { Modals } from \"./components/modals/Modals\";\n\nexport { default as TwoFactorAuthModal } from \"./components/account/TwoFactorAuthModal\";\nexport { default as DisableTwoFactorAuthModal } from \"./components/account/DisableTwoFactorAuthModal\";\nexport { default as ConfirmGlobalPreferencesModal } from \"./components/account/ConfirmGlobalPreferencesModal\";\nexport { MyProfileSection } from \"./components/account/sections/MyProfileSection\";\nexport { PreferencesSection } from \"./components/account/sections/PreferencesSection\";\nexport { SecuritySection } from \"./components/account/sections/SecuritySection\";\nexport { ChangePasswordSection } from \"./components/account/sections/ChangePasswordSection\";\nexport { ChangeEmailModal } from \"./components/account/sections/ChangeEmailModal\";\nexport { ChangePhoneModal } from \"./components/account/sections/ChangePhoneModal\";\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,gCAAgC;AACzC,SAAS,iCAAiC;AAC1C,SAAS,UAAU,uBAAuB;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B;AAC3B,SAAS,YAAY,mBAAmB,WAAW,iBAAiB;AAGpE,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAIhC,SAAS,0BAA0B;AAGnC,SAAoB,WAAXA,gBAAwC;AACjD,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,iBAA8B;AACvC,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACoB;AAAA,OACf;AAEP,SAAS,iBAAiB,yBAAyB;AAGnD,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,SAAoB,WAAXA,iBAA6B;AACtC,SAAoB,WAAXA,iBAA4C;AACrD,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAoB,WAAXA,iBAAgC;AACzC,SAAS,wBAAwB;AAGjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from \"./modules/auth/schema\";\nexport * from \"./modules/users/schema\";\nexport * from \"./modules/whitelabel/schema\";\n// Style types now come from whitelabel schema directly\nexport * from \"./infra/api/types\";\n\n// Contexts\nexport * from \"./providers/query.provider\";\nexport * from \"./providers/auth.provider\";\nexport * from \"./providers/whitelabel.provider\";\n\n// Hooks\nexport {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport type {\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport { SUBSCRIPTIONS_QUERY_KEY } from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport { ADDON_IDS, AI_CREDIT_OPTIONS, AI_CREDIT_VALUES } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { AddonKindEnum, AiCreditOption } from \"./modules/subscriptions/constants/addons.constants\";\nexport type { Plan, PlanItem } from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type { Card as PaymentCard } from \"./modules/cards/types\";\nexport { CardSchema as PaymentCardSchema } from \"./modules/cards/types\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { getPriceFromCalculatedData, periodicityToBillingPeriod } from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\n\n// Providers\nexport { QueryProvider } from \"./providers/query.provider\";\n\n// Middleware\nexport { createAuthMiddleware } from \"./middlewares/create-auth-middleware\";\nexport { createMiddlewareChain } from \"./middlewares/chain\";\nexport { continueChain, stopChain } from \"./middlewares/types\";\nexport type {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} from \"./components/layouts/MainLayout\";\nexport { NavBar } from \"./components/layouts/NavBar\";\nexport type { NavBarProps } from \"./components/layouts/NavBar\";\nexport { AppNavBar } from \"./components/layouts/AppNavBar\";\nexport type { AppNavBarProps } from \"./components/layouts/AppNavBar\";\nexport { AppMobileNavBar } from \"./components/layouts/AppMobileNavBar\";\nexport type { AppMobileNavBarProps } from \"./components/layouts/AppMobileNavBar\";\nexport { SideBarNavigation } from \"./components/layouts/SideBarNavigation\";\nexport { MdSideBarNavigation } from \"./components/layouts/MdSideBarNavigation\";\nexport { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from './components/navigation/AppNavigation';\nexport { CancelledSubscriptionBanner } from './components/navigation/CancelledSubscriptionBanner';\nexport type { NavItemConfig } from './components/navigation/subcomponents/NavItems';\nexport type { NavigationProject } from './components/navigation/types';\nexport { useMobileNavbarSheet } from './store/useMobileNavbarSheet';\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\n\n// UI - Buttons\nexport { Button, buttonVariants } from \"./components/ui/buttons/Button\";\nexport { CopyButton } from \"./components/ui/buttons/CopyButton\";\nexport { default as CancelButton } from \"./components/ui/buttons/CancelButton\";\n\n// UI - Data Display\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} from \"./components/ui/data-display/Tabs\";\nexport { UserAvatar } from \"./components/ui/data-display/UserAvatar\";\nexport type { UserAvatarProps } from \"./components/ui/data-display/UserAvatar\";\n\n// UI - Feedback\nexport { default as CircularProgress } from \"./components/ui/feedback/CircularProgress\";\nexport { default as DefaultCircularProgress } from \"./components/ui/feedback/DefaultCircularProgress\";\nexport { Progress } from \"./components/ui/feedback/Progress\";\nexport { LoadingOverlay } from \"./components/ui/feedback/LoadingOverlay\";\nexport {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} from \"./components/ui/feedback/Toast\";\nexport type { ToastProps } from \"./components/ui/feedback/Toast\";\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from \"./components/ui/form/Calendar\";\nexport { Checkbox } from \"./components/ui/form/Checkbox\";\nexport { DatePicker } from \"./components/ui/form/DatePicker\";\nexport { DateRangePicker } from \"./components/ui/form/DateRangePicker\";\nexport { Input } from \"./components/ui/form/Input\";\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport { CrispEmbed, openCrispHelpdesk, hideCrisp, showCrisp } from \"./components/embeds/CrispEmbed\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useModalManager } from \"./store/useModalManager\";\nexport type { ModalData } from \"./store/useModalManager\";\n\n// Enums\nexport { AccountSectionType } from \"./enums/AccountSectionType\";\n\n// Hooks\nexport { default as usePasswordVisibility } from \"./hooks/usePasswordVisibility\";\nexport { default as useCountdownTimer } from \"./hooks/useCountdownTimer\";\nexport { default as useIsMobile } from \"./hooks/useIsMobile\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} from \"./utils/intl/locales\";\nexport type { LocaleOption } from \"./utils/intl/locales\";\nexport { copyToClipboard, readFromClipboard } from \"./utils/browser/clipboard\";\n\n// UI - Form (new widgets)\nexport { FormField } from \"./components/ui/form/FormField\";\nexport { SelectField } from \"./components/ui/form/SelectField\";\nexport { ComboboxField } from \"./components/ui/form/ComboboxField\";\nexport type { ComboboxOption } from \"./components/ui/form/ComboboxField\";\nexport { default as PhoneInput } from \"./components/ui/form/PhoneInput\";\nexport { default as SwitchOptionFieldWithIcon } from \"./components/ui/form/SwitchOptionFieldWithIcon\";\nexport { TextAreaField } from \"./components/ui/form/TextAreaField\";\n\n// Account Module - Hooks\nexport {\n useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from \"./modules/accounts/hooks/useAccountManagement\";\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from \"./modules/accounts/types\";\n\nexport { default as AccountModals } from \"./components/account/AccountModals\";\nexport { useAccountModals } from \"./store/useAccountModals\";\nexport type { AccountModalsConfig } from \"./store/useAccountModals\";\n\nexport { ModalManager } from \"./components/modals/ModalManager\";\nexport { Modals } from \"./components/modals/Modals\";\n\nexport { default as TwoFactorAuthModal } from \"./components/account/TwoFactorAuthModal\";\nexport { default as DisableTwoFactorAuthModal } from \"./components/account/DisableTwoFactorAuthModal\";\nexport { default as ConfirmGlobalPreferencesModal } from \"./components/account/ConfirmGlobalPreferencesModal\";\nexport { MyProfileSection } from \"./components/account/sections/MyProfileSection\";\nexport { PreferencesSection } from \"./components/account/sections/PreferencesSection\";\nexport { SecuritySection } from \"./components/account/sections/SecuritySection\";\nexport { ChangePasswordSection } from \"./components/account/sections/ChangePasswordSection\";\nexport { ChangeEmailModal } from \"./components/account/sections/ChangeEmailModal\";\nexport { ChangePhoneModal } from \"./components/account/sections/ChangePhoneModal\";\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,gCAAgC;AACzC,SAAS,iCAAiC;AAC1C,SAAS,UAAU,uBAAuB;AAC1C,SAAS,oBAAoB;AAU7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,mBAAmB,wBAAwB;AAG/D,SAAS,YAAY,sBAAsB;AAQ3C,SAAuB,kBAAyB;AAChD,SAAS,uBAAuB;AAChC,SAAS,4BAA4B,kCAAkC;AACvE,SAAS,0BAA0B;AACnC,SAAoB,WAAXA,gBAAkC;AAC3C,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,qBA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A,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACoB;AAAA,OACf;AAEP,SAAS,iBAAiB,yBAAyB;AAGnD,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,SAAoB,WAAXA,iBAA6B;AACtC,SAAoB,WAAXA,iBAA4C;AACrD,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAoB,WAAXA,iBAAgC;AACzC,SAAS,wBAAwB;AAGjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
@@ -29,7 +29,7 @@ const SubscriptionSchema = z.object({
|
|
|
29
29
|
id_coupon: z.union([z.number(), z.string()]).nullable(),
|
|
30
30
|
type: z.string(),
|
|
31
31
|
payment_method: z.number().nullable(),
|
|
32
|
-
periodicity: z.
|
|
32
|
+
periodicity: z.coerce.number().nullable(),
|
|
33
33
|
value: z.number().nullable(),
|
|
34
34
|
id_product: z.number(),
|
|
35
35
|
id_plan: z.number(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/types/subscription.type.ts"],"sourcesContent":["import z from 'zod';\r\n\r\nexport const SubscriptionItemSchema = z.object({\r\n id: z.union([z.number(), z.string()]),\r\n deleted: z.number(),\r\n datetime_alt: z.coerce.date().nullable().optional(),\r\n datetime_del: z.coerce.date().nullable().optional(),\r\n datetime_add: z.coerce.date(),\r\n id_wl: z.number(),\r\n id_subscription: z.union([z.number(), z.string()]),\r\n id_addon: z.number().nullable(),\r\n addon_name: z.string().optional(),\r\n value: z.number(),\r\n currency: z.string(),\r\n quantity: z.number(),\r\n payment_status: z.number(),\r\n id_charge: z.union([z.number(), z.string()]).nullable(),\r\n trial: z.boolean(),\r\n trial_ends_at: z.coerce.date().nullable().optional(),\r\n});\r\n\r\nexport type SubscriptionItem = z.infer<typeof SubscriptionItemSchema>;\r\n\r\nexport const SubscriptionSchema = z.object({\r\n id: z.union([z.number(), z.string()]),\r\n deleted: z.number(),\r\n datetime_alt: z.coerce.date().nullable().optional(),\r\n datetime_del: z.coerce.date().nullable().optional(),\r\n datetime_add: z.coerce.date(),\r\n id_wl: z.number(),\r\n id_account: z.union([z.number(), z.string()]),\r\n id_card: z.union([z.number(), z.string()]).nullable(),\r\n id_coupon: z.union([z.number(), z.string()]).nullable(),\r\n type: z.string(),\r\n payment_method: z.number().nullable(),\r\n periodicity: z.
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/types/subscription.type.ts"],"sourcesContent":["import z from 'zod';\r\n\r\nexport const SubscriptionItemSchema = z.object({\r\n id: z.union([z.number(), z.string()]),\r\n deleted: z.number(),\r\n datetime_alt: z.coerce.date().nullable().optional(),\r\n datetime_del: z.coerce.date().nullable().optional(),\r\n datetime_add: z.coerce.date(),\r\n id_wl: z.number(),\r\n id_subscription: z.union([z.number(), z.string()]),\r\n id_addon: z.number().nullable(),\r\n addon_name: z.string().optional(),\r\n value: z.number(),\r\n currency: z.string(),\r\n quantity: z.number(),\r\n payment_status: z.number(),\r\n id_charge: z.union([z.number(), z.string()]).nullable(),\r\n trial: z.boolean(),\r\n trial_ends_at: z.coerce.date().nullable().optional(),\r\n});\r\n\r\nexport type SubscriptionItem = z.infer<typeof SubscriptionItemSchema>;\r\n\r\nexport const SubscriptionSchema = z.object({\r\n id: z.union([z.number(), z.string()]),\r\n deleted: z.number(),\r\n datetime_alt: z.coerce.date().nullable().optional(),\r\n datetime_del: z.coerce.date().nullable().optional(),\r\n datetime_add: z.coerce.date(),\r\n id_wl: z.number(),\r\n id_account: z.union([z.number(), z.string()]),\r\n id_card: z.union([z.number(), z.string()]).nullable(),\r\n id_coupon: z.union([z.number(), z.string()]).nullable(),\r\n type: z.string(),\r\n payment_method: z.number().nullable(),\r\n periodicity: z.coerce.number().nullable(),\r\n value: z.number().nullable(),\r\n id_product: z.number(),\r\n id_plan: z.number(),\r\n plan_name: z.string().nullable().optional(),\r\n id_gateway: z.union([z.number(), z.string()]).nullable(),\r\n gateway_account: z.string().nullable(),\r\n date_hiring: z.coerce.date().nullable(),\r\n date_due: z.coerce.date(),\r\n date_cancellation: z.coerce.date().nullable(),\r\n date_verification: z.coerce.date().nullable(),\r\n cancellation_reason: z.string().nullable(),\r\n cancellation_description: z.string().nullable(),\r\n active: z.boolean(),\r\n charged: z.boolean(),\r\n datetime_last_update_periodicity: z.coerce.date().nullable().optional(),\r\n card_name: z.string().nullable().optional(),\r\n card_brand: z.string().nullable().optional(),\r\n card_number: z.string().nullable().optional(),\r\n items: z.array(SubscriptionItemSchema),\r\n});\r\n\r\nexport type Subscription = z.infer<typeof SubscriptionSchema>;\r\n\r\nexport interface FindSubscriptionsParams {\r\n active?: boolean;\r\n trial?: boolean;\r\n date_start?: string;\r\n date_end?: string;\r\n date_hiring_start?: string;\r\n date_hiring_end?: string;\r\n}\r\n"],"mappings":"AAAA,OAAO,OAAO;AAEP,MAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;AAAA,EACpC,SAAS,EAAE,OAAO;AAAA,EAClB,cAAc,EAAE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,cAAc,EAAE,OAAO,KAAK,EAAE,SAAS,EAAE,SAA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EAAE,OAAO,OAAO,EAAE,SAAS;AAAA,EACxC,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,YAAY,EAAE,OAAO;AAAA,EACrB,SAAS,EAAE,OAAO;AAAA,EAClB,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1C,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS;AAAA,EACvD,iBAAiB,EAAE,OAAO,EAAE,SAAS;AAAA,EACrC,aAAa,EAAE,OAAO,KAAK,EAAE,SAAS;AAAA,EACtC,UAAU,EAAE,OAAO,KAAK;AAAA,EACxB,mBAAmB,EAAE,OAAO,KAAK,EAAE,SAAS;AAAA,EAC5C,mBAAmB,EAAE,OAAO,KAAK,EAAE,SAAS;AAAA,EAC5C,qBAAqB,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,0BAA0B,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9C,QAAQ,EAAE,QAAQ;AAAA,EAClB,SAAS,EAAE,QAAQ;AAAA,EACnB,kCAAkC,EAAE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACtE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC1C,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC3C,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC5C,OAAO,EAAE,MAAM,sBAAsB;AACvC,CAAC;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { whitelabelStylesService } from "../services/whitelabel-styles.service";
|
|
3
|
+
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
4
|
+
async function revalidateWhitelabelStylesAction(id_wl) {
|
|
5
|
+
return safeServerAction(async () => {
|
|
6
|
+
return whitelabelStylesService.revalidateByWlId(id_wl);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
revalidateWhitelabelStylesAction
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=revalidate-whitelabel-styles.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { headers } from "next/headers";
|
|
3
|
+
import { whitelabelService } from "../services/whitelabel.service";
|
|
4
|
+
import { ApiError } from "../../../infra/api/types";
|
|
5
|
+
import { safeServerAction } from "../../../utils/safeServerAction";
|
|
6
|
+
async function revalidateWhitelabelAction() {
|
|
7
|
+
return safeServerAction(async () => {
|
|
8
|
+
const headersList = await headers();
|
|
9
|
+
const host = headersList.get("host");
|
|
10
|
+
if (!host) {
|
|
11
|
+
throw new ApiError("Host header not found", "HOST_NOT_FOUND", 400);
|
|
12
|
+
}
|
|
13
|
+
return whitelabelService.revalidateByDomain(host);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
revalidateWhitelabelAction
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=revalidate-whitelabel.action.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -37,23 +37,22 @@ class WhitelabelStylesService {
|
|
|
37
37
|
if (!token) throw new ApiError("WHITELABEL_TOKEN_MASTER not configured", "CONFIG_ERROR", 500);
|
|
38
38
|
return token;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const token = this.getToken();
|
|
43
|
-
const url = `${apiUrl}/v1/pt-br/1/whitelabels/${id_wl}/with-style`;
|
|
44
|
-
console.log("[WhitelabelStylesService] Fetching with-style for id_wl", { id_wl, url });
|
|
45
|
-
const cache = new greatCache({
|
|
40
|
+
createCache() {
|
|
41
|
+
return new greatCache({
|
|
46
42
|
service: "whitelabel-styles-service",
|
|
47
43
|
version: "1.0",
|
|
48
44
|
domain: "whitelabel-cache.greatapps.com.br",
|
|
49
45
|
ambient: process.env.NODE_ENV || "development"
|
|
50
46
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
}
|
|
48
|
+
getCacheKey(id_wl) {
|
|
49
|
+
return `whitelabel-styles-${id_wl}`;
|
|
50
|
+
}
|
|
51
|
+
async fetchFromApi(id_wl) {
|
|
52
|
+
const apiUrl = this.getApiUrl();
|
|
53
|
+
const token = this.getToken();
|
|
54
|
+
const url = `${apiUrl}/v1/pt-br/1/whitelabels/${id_wl}/with-style`;
|
|
55
|
+
console.log("[WhitelabelStylesService] Fetching with-style for id_wl", { id_wl, url });
|
|
57
56
|
const response = await fetch(url, {
|
|
58
57
|
method: "GET",
|
|
59
58
|
headers: { authorization: token }
|
|
@@ -67,10 +66,32 @@ class WhitelabelStylesService {
|
|
|
67
66
|
console.warn("[WhitelabelStylesService] No data in with-style for id_wl", { id_wl });
|
|
68
67
|
return null;
|
|
69
68
|
}
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
return mapWithStyleResponse(result.data[0]);
|
|
70
|
+
}
|
|
71
|
+
async getByWlId(id_wl) {
|
|
72
|
+
const cache = this.createCache();
|
|
73
|
+
const cacheKey = this.getCacheKey(id_wl);
|
|
74
|
+
const cachedData = await cache.select(cacheKey);
|
|
75
|
+
if (cachedData.status == 1 && "data" in cachedData && cachedData.data) {
|
|
76
|
+
console.log("[WhitelabelStylesService] Cache hit for id_wl", { id_wl });
|
|
77
|
+
return JSON.parse(cachedData.data);
|
|
78
|
+
}
|
|
79
|
+
const parsed = await this.fetchFromApi(id_wl);
|
|
80
|
+
if (parsed?.id) {
|
|
81
|
+
await cache.insert(cacheKey, JSON.stringify(parsed), 300);
|
|
82
|
+
}
|
|
83
|
+
return parsed;
|
|
84
|
+
}
|
|
85
|
+
async revalidateByWlId(id_wl) {
|
|
86
|
+
const cache = this.createCache();
|
|
87
|
+
const cacheKey = this.getCacheKey(id_wl);
|
|
88
|
+
console.log("[WhitelabelStylesService] Revalidating cache for id_wl", { id_wl });
|
|
89
|
+
await cache.delete(cacheKey);
|
|
90
|
+
const parsed = await this.fetchFromApi(id_wl);
|
|
91
|
+
if (parsed?.id) {
|
|
72
92
|
await cache.insert(cacheKey, JSON.stringify(parsed), 300);
|
|
73
93
|
}
|
|
94
|
+
console.log("[WhitelabelStylesService] Cache revalidated for id_wl", { id_wl });
|
|
74
95
|
return parsed;
|
|
75
96
|
}
|
|
76
97
|
}
|
|
@@ -1 +1 @@
|
|
|
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 async
|
|
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":"AAAA,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AAQzB,SAAS,gBAAmB,OAA0B;AACpD,MAAI,OAAO,UAAU,UAAU;AAC7B,QAAI;AAAE,aAAO,KAAK,MAAM,KAAK;AAAA,IAAQ,QAAQ;AAAE,aAAO;AAAA,IAAM;AAAA,EAC9D;AACA,MAAI,SAAS,OAAO,UAAU,SAAU,QAAO;AAC/C,SAAO;AACT;AAEA,SAAS,qBAAqB,KAAoD;AAChF,QAAM,UAAU,gBAAkC,IAAI,eAAe,CAAC;AAEtE,MAAI,SAA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[]}
|
|
@@ -15,23 +15,22 @@ class WhitelabelService {
|
|
|
15
15
|
}
|
|
16
16
|
return token;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const apiUrl = this.getApiUrl();
|
|
21
|
-
const whitelabelMasterToken = this.getToken();
|
|
22
|
-
const url = `${apiUrl}/v1/pt-br/1/whitelabel/${hostname}/token`;
|
|
23
|
-
console.log("[WhitelabelService] Fetching token for domain", { url });
|
|
24
|
-
const cache = new greatCache({
|
|
18
|
+
createCache() {
|
|
19
|
+
return new greatCache({
|
|
25
20
|
service: "whitelabel-service",
|
|
26
21
|
version: "1.0",
|
|
27
22
|
domain: "whitelabel-cache.greatapps.com.br",
|
|
28
23
|
ambient: process.env.NODE_ENV || "development"
|
|
29
24
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
}
|
|
26
|
+
getCacheKey(hostname) {
|
|
27
|
+
return `whitelabel-token-${hostname}`;
|
|
28
|
+
}
|
|
29
|
+
async fetchFromApi(hostname) {
|
|
30
|
+
const apiUrl = this.getApiUrl();
|
|
31
|
+
const whitelabelMasterToken = this.getToken();
|
|
32
|
+
const url = `${apiUrl}/v1/pt-br/1/whitelabel/${hostname}/token`;
|
|
33
|
+
console.log("[WhitelabelService] Fetching token for domain", { url });
|
|
35
34
|
const response = await fetch(url, {
|
|
36
35
|
method: "GET",
|
|
37
36
|
headers: {
|
|
@@ -50,9 +49,32 @@ class WhitelabelService {
|
|
|
50
49
|
if (result.status !== 1 || !result.data?.length) {
|
|
51
50
|
throw new ApiError("Whitelabel token not found", "TOKEN_NOT_FOUND", 404);
|
|
52
51
|
}
|
|
53
|
-
await cache.insert(`whitelabel-token-${hostname}`, JSON.stringify(result.data[0]), 604800);
|
|
54
52
|
return result.data[0];
|
|
55
53
|
}
|
|
54
|
+
async getTokenByDomain(hostname) {
|
|
55
|
+
hostname = process.env.WHITELABEL_DOMAIN || hostname;
|
|
56
|
+
const cache = this.createCache();
|
|
57
|
+
const cacheKey = this.getCacheKey(hostname);
|
|
58
|
+
const cachedData = await cache.select(cacheKey);
|
|
59
|
+
if (cachedData.status == 1 && "data" in cachedData && cachedData.data) {
|
|
60
|
+
console.log("[WhitelabelService] Cache hit for domain", { hostname });
|
|
61
|
+
return JSON.parse(cachedData.data);
|
|
62
|
+
}
|
|
63
|
+
const data = await this.fetchFromApi(hostname);
|
|
64
|
+
await cache.insert(cacheKey, JSON.stringify(data), 604800);
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
async revalidateByDomain(hostname) {
|
|
68
|
+
hostname = process.env.WHITELABEL_DOMAIN || hostname;
|
|
69
|
+
const cache = this.createCache();
|
|
70
|
+
const cacheKey = this.getCacheKey(hostname);
|
|
71
|
+
console.log("[WhitelabelService] Revalidating cache for domain", { hostname });
|
|
72
|
+
await cache.delete(cacheKey);
|
|
73
|
+
const data = await this.fetchFromApi(hostname);
|
|
74
|
+
await cache.insert(cacheKey, JSON.stringify(data), 604800);
|
|
75
|
+
console.log("[WhitelabelService] Cache revalidated for domain", { hostname });
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
56
78
|
}
|
|
57
79
|
const whitelabelService = new WhitelabelService();
|
|
58
80
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/whitelabel/services/whitelabel.service.ts"],"sourcesContent":["\r\nimport greatCache from '@greatapps/cache';\r\nimport { ApiError } from '../../../infra/api/types';\r\nimport { WhitelabelTokenApiResponse, WhitelabelTokenData } from '../schema';\r\n\r\nclass WhitelabelService {\r\n private getApiUrl(): string {\r\n const apiUrl = process.env.GAPPS_R3_API_URL;\r\n if (!apiUrl) {\r\n throw new ApiError('GAPPS_R3_API_URL not configured', 'CONFIG_ERROR', 500);\r\n }\r\n return apiUrl;\r\n }\r\n\r\n private getToken(): string {\r\n const token = process.env.WHITELABEL_TOKEN_MASTER;\r\n if (!token) {\r\n throw new ApiError('WHITELABEL_TOKEN_MASTER not configured', 'CONFIG_ERROR', 500);\r\n }\r\n return token;\r\n }\r\n\r\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/whitelabel/services/whitelabel.service.ts"],"sourcesContent":["\r\nimport greatCache from '@greatapps/cache';\r\nimport { ApiError } from '../../../infra/api/types';\r\nimport { WhitelabelTokenApiResponse, WhitelabelTokenData } from '../schema';\r\n\r\nclass WhitelabelService {\r\n private getApiUrl(): string {\r\n const apiUrl = process.env.GAPPS_R3_API_URL;\r\n if (!apiUrl) {\r\n throw new ApiError('GAPPS_R3_API_URL not configured', 'CONFIG_ERROR', 500);\r\n }\r\n return apiUrl;\r\n }\r\n\r\n private getToken(): string {\r\n const token = process.env.WHITELABEL_TOKEN_MASTER;\r\n if (!token) {\r\n throw new ApiError('WHITELABEL_TOKEN_MASTER not configured', 'CONFIG_ERROR', 500);\r\n }\r\n return token;\r\n }\r\n\r\n private createCache() {\r\n return new greatCache({\r\n service: 'whitelabel-service',\r\n version: '1.0',\r\n domain: 'whitelabel-cache.greatapps.com.br',\r\n ambient: process.env.NODE_ENV || 'development',\r\n });\r\n }\r\n\r\n private getCacheKey(hostname: string): string {\r\n return `whitelabel-token-${hostname}`;\r\n }\r\n\r\n private async fetchFromApi(hostname: string): Promise<WhitelabelTokenData> {\r\n const apiUrl = this.getApiUrl();\r\n const whitelabelMasterToken = this.getToken();\r\n const url = `${apiUrl}/v1/pt-br/1/whitelabel/${hostname}/token`;\r\n\r\n console.log('[WhitelabelService] Fetching token for domain', { url });\r\n\r\n const response = await fetch(url, {\r\n method: 'GET',\r\n headers: {\r\n authorization: whitelabelMasterToken,\r\n },\r\n });\r\n\r\n if (!response.ok) {\r\n console.error('[WhitelabelService] Failed to fetch whitelabel token', { response });\r\n throw new ApiError(\r\n `Failed to fetch whitelabel token: ${response.status}`,\r\n 'FETCH_ERROR',\r\n response.status\r\n );\r\n }\r\n\r\n const result: WhitelabelTokenApiResponse = await response.json();\r\n\r\n if (result.status !== 1 || !result.data?.length) {\r\n throw new ApiError('Whitelabel token not found', 'TOKEN_NOT_FOUND', 404);\r\n }\r\n\r\n return result.data[0];\r\n }\r\n\r\n async getTokenByDomain(hostname: string): Promise<WhitelabelTokenData> {\r\n hostname = process.env.WHITELABEL_DOMAIN || hostname;\r\n\r\n const cache = this.createCache();\r\n const cacheKey = this.getCacheKey(hostname);\r\n\r\n const cachedData = await cache.select(cacheKey);\r\n\r\n if (cachedData.status == 1 && 'data' in cachedData && cachedData.data) {\r\n console.log('[WhitelabelService] Cache hit for domain', { hostname });\r\n return JSON.parse(cachedData.data) as WhitelabelTokenData;\r\n }\r\n\r\n const data = await this.fetchFromApi(hostname);\r\n\r\n await cache.insert(cacheKey, JSON.stringify(data), 604800);\r\n\r\n return data;\r\n }\r\n\r\n async revalidateByDomain(hostname: string): Promise<WhitelabelTokenData> {\r\n hostname = process.env.WHITELABEL_DOMAIN || hostname;\r\n\r\n const cache = this.createCache();\r\n const cacheKey = this.getCacheKey(hostname);\r\n\r\n console.log('[WhitelabelService] Revalidating cache for domain', { hostname });\r\n\r\n await cache.delete(cacheKey);\r\n\r\n const data = await this.fetchFromApi(hostname);\r\n\r\n await cache.insert(cacheKey, JSON.stringify(data), 604800);\r\n\r\n console.log('[WhitelabelService] Cache revalidated for domain', { hostname });\r\n\r\n return data;\r\n }\r\n}\r\n\r\nexport const whitelabelService = new WhitelabelService();\r\n"],"mappings":"AACA,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AAGzB,MAAM,kBAAkB;AAAA,EACd,YAAoB;AAC1B,UAAM,SAAS,QAAQ,IAAI;AAC3B,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,SAAS,mCAAmC,gBAAgB,GAAG;AAAA,IAC3E;AACA,WAAO;AAAA,EACT;AAAA,EAEQ,WAAmB;AACzB,UAAM,QAAQ,QAAQ,IAAI;AAC1B,QAAI,CAAC,OAAO;AACV,YAAM,IAAI,SAAS,0CAA0C,gBAAgB,GAAG;AAAA,IA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K,MAAM,WAAW,IAAI;AAAA,IACnC;AAEA,UAAM,OAAO,MAAM,KAAK,aAAa,QAAQ;AAE7C,UAAM,MAAM,OAAO,UAAU,KAAK,UAAU,IAAI,GAAG,MAAM;AAEzD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,mBAAmB,UAAgD;AACvE,eAAW,QAAQ,IAAI,qBAAqB;AAE5C,UAAM,QAAQ,KAAK,YAAY;AAC/B,UAAM,WAAW,KAAK,YAAY,QAAQ;AAE1C,YAAQ,IAAI,qDAAqD,EAAE,SAAS,CAAC;AAE7E,UAAM,MAAM,OAAO,QAAQ;AAE3B,UAAM,OAAO,MAAM,KAAK,aAAa,QAAQ;AAE7C,UAAM,MAAM,OAAO,UAAU,KAAK,UAAU,IAAI,GAAG,MAAM;AAEzD,YAAQ,IAAI,oDAAoD,EAAE,SAAS,CAAC;AAE5E,WAAO;AAAA,EACT;AACF;AAEO,MAAM,oBAAoB,IAAI,kBAAkB;","names":[]}
|
|
@@ -4,10 +4,9 @@ import { createContext, useContext } from "react";
|
|
|
4
4
|
const WhitelabelContext = createContext(void 0);
|
|
5
5
|
function WhitelabelProvider({
|
|
6
6
|
children,
|
|
7
|
-
whitelabel
|
|
8
|
-
whitelabelStyles = null
|
|
7
|
+
whitelabel
|
|
9
8
|
}) {
|
|
10
|
-
return /* @__PURE__ */ jsx(WhitelabelContext.Provider, { value: { whitelabel
|
|
9
|
+
return /* @__PURE__ */ jsx(WhitelabelContext.Provider, { value: { whitelabel }, children });
|
|
11
10
|
}
|
|
12
11
|
function useWhitelabel() {
|
|
13
12
|
const context = useContext(WhitelabelContext);
|
|
@@ -17,11 +16,13 @@ function useWhitelabel() {
|
|
|
17
16
|
return context;
|
|
18
17
|
}
|
|
19
18
|
function useWhitelabelStyles() {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const { whitelabel } = useWhitelabel();
|
|
20
|
+
return {
|
|
21
|
+
general: whitelabel?.general ?? null,
|
|
22
|
+
signin_page: whitelabel?.signin_page ?? null,
|
|
23
|
+
signup_page: whitelabel?.signup_page ?? null,
|
|
24
|
+
dashboard: whitelabel?.dashboard ?? null
|
|
25
|
+
};
|
|
25
26
|
}
|
|
26
27
|
export {
|
|
27
28
|
WhitelabelProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/providers/whitelabel.provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, ReactNode, useContext } from \"react\";\nimport { WhitelabelData
|
|
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"],"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;","names":[]}
|
package/dist/server.mjs
CHANGED
|
@@ -2,8 +2,7 @@ import "server-only";
|
|
|
2
2
|
import { ApiClient, api, apiClient } from "./infra/api/client";
|
|
3
3
|
import { authService } from "./modules/auth/services/auth.service";
|
|
4
4
|
import { whitelabelService } from "./modules/whitelabel/services/whitelabel.service";
|
|
5
|
-
import {
|
|
6
|
-
import { findWhitelabelStyles } from "./modules/whitelabel/actions/find-whitelabel-styles.action";
|
|
5
|
+
import { revalidateWhitelabelAction } from "./modules/whitelabel/actions/revalidate-whitelabel.action";
|
|
7
6
|
import { subscriptionsService } from "./modules/subscriptions/services/subscriptions.service";
|
|
8
7
|
import { plansService } from "./modules/plans/services/plans.service";
|
|
9
8
|
import { cardsService } from "./modules/cards/services/cards.service";
|
|
@@ -67,7 +66,6 @@ export {
|
|
|
67
66
|
findPlanByIdAction,
|
|
68
67
|
findUserById,
|
|
69
68
|
findWhitelabel,
|
|
70
|
-
findWhitelabelStyles,
|
|
71
69
|
generateTwoFactorAction,
|
|
72
70
|
getClientInfoFromRequest,
|
|
73
71
|
getUserContext,
|
|
@@ -84,6 +82,7 @@ export {
|
|
|
84
82
|
requestEmailChangeAction,
|
|
85
83
|
requestPhoneChangeAction,
|
|
86
84
|
resolvePlanExtrasPrices,
|
|
85
|
+
revalidateWhitelabelAction,
|
|
87
86
|
safeServerAction,
|
|
88
87
|
subscriptionsService,
|
|
89
88
|
twoFactorService,
|
|
@@ -92,7 +91,6 @@ export {
|
|
|
92
91
|
updateSubscriptionPlanAction,
|
|
93
92
|
updateUserAction,
|
|
94
93
|
validateSessionAction,
|
|
95
|
-
whitelabelService
|
|
96
|
-
whitelabelStylesService
|
|
94
|
+
whitelabelService
|
|
97
95
|
};
|
|
98
96
|
//# sourceMappingURL=server.mjs.map
|
package/dist/server.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\r\n\r\n// API Client\r\nexport { ApiClient, api, apiClient } from './infra/api/client';\r\n\r\n// Services\r\nexport { authService } from './modules/auth/services/auth.service';\r\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\r\nexport {
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\r\n\r\n// API Client\r\nexport { ApiClient, api, apiClient } from './infra/api/client';\r\n\r\n// Services\r\nexport { authService } from './modules/auth/services/auth.service';\r\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\r\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\r\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\r\nexport { plansService } from './modules/plans/services/plans.service';\r\nexport { cardsService } from './modules/cards/services/cards.service';\r\nexport { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';\r\n\r\n// Actions\r\nexport { findWhitelabel } from './modules/whitelabel/actions/find-whitelabel.action';\r\nexport { validateSessionAction } from './modules/auth/actions/validate-session.action';\r\nexport { findUserById } from './modules/users/action/find-user-by-id.action';\r\nexport { findCurrentAccount } from './modules/accounts/actions/find-current-account.action';\r\nexport { listSubscriptionsAction } from './modules/subscriptions/actions/list-subscriptions.action';\r\nexport { findPlanByIdAction } from './modules/plans/actions/find-plan-by-id.action';\r\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\r\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\r\nexport { listCardsAction } from './modules/cards/actions/list-cards.action';\r\nexport { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';\r\nexport { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';\r\n\r\n// Project Users Services & Actions (server-only)\r\nexport { projectUsersService } from './modules/projects/services/project-users.service';\r\nexport { listProjectUsersAction } from './modules/projects/actions/list-project-users.action';\r\nexport { listAvailableUsersAction } from './modules/projects/actions/list-available-users.action';\r\nexport { addProjectUserAction } from './modules/projects/actions/add-project-user.action';\r\nexport { removeProjectUserAction } from './modules/projects/actions/remove-project-user.action';\r\n\r\n// Account Services & Actions (server-only)\r\nexport { accountService } from './modules/accounts/services/account.service';\r\nexport { twoFactorService } from './modules/accounts/services/two-factor.service';\r\nexport {\r\n listAccountUsersAction,\r\n updateUserAction,\r\n updateAccountAction,\r\n updateAccountUserByIdAction,\r\n deleteAccountUserAction,\r\n deleteAccountAction,\r\n createAccountUserAction,\r\n changePasswordAction,\r\n requestEmailChangeAction,\r\n confirmEmailChangeAction,\r\n requestPhoneChangeAction,\r\n confirmPhoneChangeAction,\r\n generateTwoFactorAction,\r\n confirmTwoFactorAction,\r\n disableTwoFactorAction,\r\n} from './modules/accounts/actions/account-management.action';\r\n\r\n// Server Utils\r\nexport { getClientInfoFromRequest } from './infra/utils/client-info';\r\nexport { getUserContext } from './modules/auth/utils/get-user-context';\r\nexport { safeServerAction } from './utils/safeServerAction';\r\n"],"mappings":"AAAA,OAAO;AAGP,SAAS,WAAW,KAAK,iBAAiB;AAG1C,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB;AAChC,SAAS,+BAA+B;AACxC,SAAS,2BAA2B;AAGpC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AAGxC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;","names":[]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export * from "./modules/auth/schema";
|
|
3
3
|
export * from "./modules/users/schema";
|
|
4
4
|
export * from "./modules/whitelabel/schema";
|
|
5
|
-
|
|
5
|
+
// Style types now come from whitelabel schema directly
|
|
6
6
|
export * from "./infra/api/types";
|
|
7
7
|
|
|
8
8
|
// Contexts
|
|
@@ -33,7 +33,7 @@ export const SubscriptionSchema = z.object({
|
|
|
33
33
|
id_coupon: z.union([z.number(), z.string()]).nullable(),
|
|
34
34
|
type: z.string(),
|
|
35
35
|
payment_method: z.number().nullable(),
|
|
36
|
-
periodicity: z.
|
|
36
|
+
periodicity: z.coerce.number().nullable(),
|
|
37
37
|
value: z.number().nullable(),
|
|
38
38
|
id_product: z.number(),
|
|
39
39
|
id_plan: z.number(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { whitelabelStylesService } from '../services/whitelabel-styles.service';
|
|
4
|
+
import { safeServerAction } from '../../../utils/safeServerAction';
|
|
5
|
+
|
|
6
|
+
export async function revalidateWhitelabelStylesAction(id_wl: number) {
|
|
7
|
+
return safeServerAction(async () => {
|
|
8
|
+
return whitelabelStylesService.revalidateByWlId(id_wl);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { headers } from 'next/headers';
|
|
4
|
+
import { whitelabelService } from '../services/whitelabel.service';
|
|
5
|
+
import { ApiError } from '../../../infra/api/types';
|
|
6
|
+
import { safeServerAction } from '../../../utils/safeServerAction';
|
|
7
|
+
|
|
8
|
+
export async function revalidateWhitelabelAction() {
|
|
9
|
+
return safeServerAction(async () => {
|
|
10
|
+
const headersList = await headers();
|
|
11
|
+
const host = headersList.get('host');
|
|
12
|
+
|
|
13
|
+
if (!host) {
|
|
14
|
+
throw new ApiError('Host header not found', 'HOST_NOT_FOUND', 400);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return whitelabelService.revalidateByDomain(host);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -1,49 +1,77 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
export interface GeneralStyleJson {
|
|
2
|
+
cor_principal: string;
|
|
3
|
+
cor_hover: string;
|
|
4
|
+
cor_link: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface PageStyleJson {
|
|
8
|
+
titulo_principal: string | null;
|
|
9
|
+
cor_titulo_principal: string | null;
|
|
10
|
+
cor_fundo: string | null;
|
|
11
|
+
imagem: string | null;
|
|
12
|
+
titulo_secundario: string | null;
|
|
13
|
+
cor_titulo_secundario: string | null;
|
|
14
|
+
descricao: string | null;
|
|
15
|
+
cor_descricao: string | null;
|
|
16
|
+
toggle_imagem: boolean;
|
|
17
|
+
toggle_titulo_secundario: boolean;
|
|
18
|
+
toggle_descricao: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface DashboardStyleJson {
|
|
22
|
+
cor_fundo: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface WhitelabelData {
|
|
26
|
+
id: number;
|
|
27
|
+
deleted: number;
|
|
28
|
+
datetime_alt: string;
|
|
29
|
+
datetime_del: string | null;
|
|
30
|
+
datetime_add: string;
|
|
31
|
+
id_account: number;
|
|
32
|
+
active: boolean;
|
|
33
|
+
name: string;
|
|
34
|
+
email: string;
|
|
35
|
+
email_financial: string;
|
|
36
|
+
email_transactional: string;
|
|
37
|
+
domain: string;
|
|
38
|
+
domain_free: string | null;
|
|
39
|
+
url_api: string;
|
|
40
|
+
url_cname: string;
|
|
41
|
+
url_help: string;
|
|
42
|
+
url_login: string;
|
|
43
|
+
url_site: string;
|
|
44
|
+
url_signup: string;
|
|
45
|
+
url_use_terms: string;
|
|
46
|
+
url_cookies_policies: string;
|
|
47
|
+
url_privacy_policies: string;
|
|
48
|
+
url_video_link: string;
|
|
49
|
+
codes: string;
|
|
50
|
+
external_contracting: boolean;
|
|
51
|
+
external_contracting_link_contracting: string;
|
|
52
|
+
external_contracting_link_plans: string;
|
|
53
|
+
logo: string;
|
|
54
|
+
favicon: string;
|
|
55
|
+
general: GeneralStyleJson | null;
|
|
56
|
+
signin_page: PageStyleJson | null;
|
|
57
|
+
signup_page: PageStyleJson | null;
|
|
58
|
+
dashboard: DashboardStyleJson | null;
|
|
59
|
+
token?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export interface WhitelabelApiResponse {
|
|
64
|
+
status: number;
|
|
65
|
+
total: number;
|
|
66
|
+
data: WhitelabelData[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface WhitelabelTokenData extends WhitelabelData {
|
|
70
|
+
token: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface WhitelabelTokenApiResponse {
|
|
74
|
+
status: number;
|
|
75
|
+
total: number;
|
|
76
|
+
data: WhitelabelTokenData[];
|
|
77
|
+
}
|
|
@@ -46,27 +46,25 @@ class WhitelabelStylesService {
|
|
|
46
46
|
return token;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const token = this.getToken();
|
|
52
|
-
const url = `${apiUrl}/v1/pt-br/1/whitelabels/${id_wl}/with-style`;
|
|
53
|
-
|
|
54
|
-
console.log('[WhitelabelStylesService] Fetching with-style for id_wl', { id_wl, url });
|
|
55
|
-
|
|
56
|
-
const cache = new greatCache({
|
|
49
|
+
private createCache() {
|
|
50
|
+
return new greatCache({
|
|
57
51
|
service: 'whitelabel-styles-service',
|
|
58
52
|
version: '1.0',
|
|
59
53
|
domain: 'whitelabel-cache.greatapps.com.br',
|
|
60
54
|
ambient: process.env.NODE_ENV || 'development',
|
|
61
55
|
});
|
|
56
|
+
}
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
private getCacheKey(id_wl: number): string {
|
|
59
|
+
return `whitelabel-styles-${id_wl}`;
|
|
60
|
+
}
|
|
65
61
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
62
|
+
private async fetchFromApi(id_wl: number): Promise<WhitelabelStylesData | null> {
|
|
63
|
+
const apiUrl = this.getApiUrl();
|
|
64
|
+
const token = this.getToken();
|
|
65
|
+
const url = `${apiUrl}/v1/pt-br/1/whitelabels/${id_wl}/with-style`;
|
|
66
|
+
|
|
67
|
+
console.log('[WhitelabelStylesService] Fetching with-style for id_wl', { id_wl, url });
|
|
70
68
|
|
|
71
69
|
const response = await fetch(url, {
|
|
72
70
|
method: 'GET',
|
|
@@ -85,12 +83,45 @@ class WhitelabelStylesService {
|
|
|
85
83
|
return null;
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
|
|
86
|
+
return mapWithStyleResponse(result.data[0]);
|
|
87
|
+
}
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
async getByWlId(id_wl: number): Promise<WhitelabelStylesData | null> {
|
|
90
|
+
const cache = this.createCache();
|
|
91
|
+
const cacheKey = this.getCacheKey(id_wl);
|
|
92
|
+
|
|
93
|
+
const cachedData = await cache.select(cacheKey);
|
|
94
|
+
|
|
95
|
+
if (cachedData.status == 1 && 'data' in cachedData && cachedData.data) {
|
|
96
|
+
console.log('[WhitelabelStylesService] Cache hit for id_wl', { id_wl });
|
|
97
|
+
return JSON.parse(cachedData.data) as WhitelabelStylesData;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const parsed = await this.fetchFromApi(id_wl);
|
|
101
|
+
|
|
102
|
+
if (parsed?.id) {
|
|
103
|
+
await cache.insert(cacheKey, JSON.stringify(parsed), 300);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return parsed;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async revalidateByWlId(id_wl: number): Promise<WhitelabelStylesData | null> {
|
|
110
|
+
const cache = this.createCache();
|
|
111
|
+
const cacheKey = this.getCacheKey(id_wl);
|
|
112
|
+
|
|
113
|
+
console.log('[WhitelabelStylesService] Revalidating cache for id_wl', { id_wl });
|
|
114
|
+
|
|
115
|
+
await cache.delete(cacheKey);
|
|
116
|
+
|
|
117
|
+
const parsed = await this.fetchFromApi(id_wl);
|
|
118
|
+
|
|
119
|
+
if (parsed?.id) {
|
|
91
120
|
await cache.insert(cacheKey, JSON.stringify(parsed), 300);
|
|
92
121
|
}
|
|
93
122
|
|
|
123
|
+
console.log('[WhitelabelStylesService] Cache revalidated for id_wl', { id_wl });
|
|
124
|
+
|
|
94
125
|
return parsed;
|
|
95
126
|
}
|
|
96
127
|
}
|
|
@@ -20,30 +20,25 @@ class WhitelabelService {
|
|
|
20
20
|
return token;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const apiUrl = this.getApiUrl();
|
|
27
|
-
const whitelabelMasterToken = this.getToken();
|
|
28
|
-
|
|
29
|
-
const url = `${apiUrl}/v1/pt-br/1/whitelabel/${hostname}/token`;
|
|
30
|
-
|
|
31
|
-
console.log('[WhitelabelService] Fetching token for domain', { url });
|
|
32
|
-
|
|
33
|
-
const cache = new greatCache({
|
|
23
|
+
private createCache() {
|
|
24
|
+
return new greatCache({
|
|
34
25
|
service: 'whitelabel-service',
|
|
35
26
|
version: '1.0',
|
|
36
27
|
domain: 'whitelabel-cache.greatapps.com.br',
|
|
37
28
|
ambient: process.env.NODE_ENV || 'development',
|
|
38
29
|
});
|
|
30
|
+
}
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
private getCacheKey(hostname: string): string {
|
|
33
|
+
return `whitelabel-token-${hostname}`;
|
|
34
|
+
}
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
private async fetchFromApi(hostname: string): Promise<WhitelabelTokenData> {
|
|
37
|
+
const apiUrl = this.getApiUrl();
|
|
38
|
+
const whitelabelMasterToken = this.getToken();
|
|
39
|
+
const url = `${apiUrl}/v1/pt-br/1/whitelabel/${hostname}/token`;
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
}
|
|
41
|
+
console.log('[WhitelabelService] Fetching token for domain', { url });
|
|
47
42
|
|
|
48
43
|
const response = await fetch(url, {
|
|
49
44
|
method: 'GET',
|
|
@@ -67,10 +62,47 @@ class WhitelabelService {
|
|
|
67
62
|
throw new ApiError('Whitelabel token not found', 'TOKEN_NOT_FOUND', 404);
|
|
68
63
|
}
|
|
69
64
|
|
|
70
|
-
await cache.insert(`whitelabel-token-${hostname}`, JSON.stringify(result.data[0]), 604800);
|
|
71
|
-
|
|
72
65
|
return result.data[0];
|
|
73
66
|
}
|
|
67
|
+
|
|
68
|
+
async getTokenByDomain(hostname: string): Promise<WhitelabelTokenData> {
|
|
69
|
+
hostname = process.env.WHITELABEL_DOMAIN || hostname;
|
|
70
|
+
|
|
71
|
+
const cache = this.createCache();
|
|
72
|
+
const cacheKey = this.getCacheKey(hostname);
|
|
73
|
+
|
|
74
|
+
const cachedData = await cache.select(cacheKey);
|
|
75
|
+
|
|
76
|
+
if (cachedData.status == 1 && 'data' in cachedData && cachedData.data) {
|
|
77
|
+
console.log('[WhitelabelService] Cache hit for domain', { hostname });
|
|
78
|
+
return JSON.parse(cachedData.data) as WhitelabelTokenData;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const data = await this.fetchFromApi(hostname);
|
|
82
|
+
|
|
83
|
+
await cache.insert(cacheKey, JSON.stringify(data), 604800);
|
|
84
|
+
|
|
85
|
+
return data;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async revalidateByDomain(hostname: string): Promise<WhitelabelTokenData> {
|
|
89
|
+
hostname = process.env.WHITELABEL_DOMAIN || hostname;
|
|
90
|
+
|
|
91
|
+
const cache = this.createCache();
|
|
92
|
+
const cacheKey = this.getCacheKey(hostname);
|
|
93
|
+
|
|
94
|
+
console.log('[WhitelabelService] Revalidating cache for domain', { hostname });
|
|
95
|
+
|
|
96
|
+
await cache.delete(cacheKey);
|
|
97
|
+
|
|
98
|
+
const data = await this.fetchFromApi(hostname);
|
|
99
|
+
|
|
100
|
+
await cache.insert(cacheKey, JSON.stringify(data), 604800);
|
|
101
|
+
|
|
102
|
+
console.log('[WhitelabelService] Cache revalidated for domain', { hostname });
|
|
103
|
+
|
|
104
|
+
return data;
|
|
105
|
+
}
|
|
74
106
|
}
|
|
75
107
|
|
|
76
108
|
export const whitelabelService = new WhitelabelService();
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { createContext, ReactNode, useContext } from "react";
|
|
4
|
-
import { WhitelabelData } from "../modules/whitelabel/schema";
|
|
5
|
-
import { WhitelabelStylesData } from "../modules/whitelabel/styles-schema";
|
|
4
|
+
import type { WhitelabelData, GeneralStyleJson, PageStyleJson, DashboardStyleJson } from "../modules/whitelabel/schema";
|
|
6
5
|
|
|
7
6
|
interface WhitelabelContextProps {
|
|
8
7
|
whitelabel: WhitelabelData | null;
|
|
9
|
-
whitelabelStyles: WhitelabelStylesData | null;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
const WhitelabelContext = createContext<WhitelabelContextProps | undefined>(undefined);
|
|
@@ -14,16 +12,14 @@ const WhitelabelContext = createContext<WhitelabelContextProps | undefined>(unde
|
|
|
14
12
|
interface WhitelabelProviderProps {
|
|
15
13
|
children: ReactNode;
|
|
16
14
|
whitelabel: WhitelabelData | null;
|
|
17
|
-
whitelabelStyles?: WhitelabelStylesData | null;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
export function WhitelabelProvider({
|
|
21
18
|
children,
|
|
22
19
|
whitelabel,
|
|
23
|
-
whitelabelStyles = null,
|
|
24
20
|
}: WhitelabelProviderProps) {
|
|
25
21
|
return (
|
|
26
|
-
<WhitelabelContext.Provider value={{ whitelabel
|
|
22
|
+
<WhitelabelContext.Provider value={{ whitelabel }}>
|
|
27
23
|
{children}
|
|
28
24
|
</WhitelabelContext.Provider>
|
|
29
25
|
);
|
|
@@ -37,10 +33,12 @@ export function useWhitelabel(): WhitelabelContextProps {
|
|
|
37
33
|
return context;
|
|
38
34
|
}
|
|
39
35
|
|
|
40
|
-
export function useWhitelabelStyles()
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
export function useWhitelabelStyles() {
|
|
37
|
+
const { whitelabel } = useWhitelabel();
|
|
38
|
+
return {
|
|
39
|
+
general: whitelabel?.general ?? null,
|
|
40
|
+
signin_page: whitelabel?.signin_page ?? null,
|
|
41
|
+
signup_page: whitelabel?.signup_page ?? null,
|
|
42
|
+
dashboard: whitelabel?.dashboard ?? null,
|
|
43
|
+
};
|
|
46
44
|
}
|
package/src/server.ts
CHANGED
|
@@ -6,8 +6,7 @@ export { ApiClient, api, apiClient } from './infra/api/client';
|
|
|
6
6
|
// Services
|
|
7
7
|
export { authService } from './modules/auth/services/auth.service';
|
|
8
8
|
export { whitelabelService } from './modules/whitelabel/services/whitelabel.service';
|
|
9
|
-
export {
|
|
10
|
-
export { findWhitelabelStyles } from './modules/whitelabel/actions/find-whitelabel-styles.action';
|
|
9
|
+
export { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';
|
|
11
10
|
export { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';
|
|
12
11
|
export { plansService } from './modules/plans/services/plans.service';
|
|
13
12
|
export { cardsService } from './modules/cards/services/cards.service';
|