@greatapps/common 1.1.488 → 1.1.490
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/ConfigurationsMyAccountModal.mjs +3 -3
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs +3 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs +3 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
- package/dist/components/layouts/AppMobileNavBar.mjs +3 -1
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
- package/dist/components/layouts/NavBar.mjs +2 -2
- package/dist/components/layouts/NavBar.mjs.map +1 -1
- package/dist/components/layouts/NotificationsPopover.mjs +5 -2
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
- package/dist/components/layouts/ProfilePopover.mjs +3 -2
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/modals/BuyCreditsModal.mjs +3 -1
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddCardModal.mjs +3 -1
- package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +5 -2
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/components/pages/NotFoundPage.mjs +2 -2
- package/dist/components/pages/NotFoundPage.mjs.map +1 -1
- package/dist/components/ui/buttons/Button.mjs +7 -2
- package/dist/components/ui/buttons/Button.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs +3 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +4 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
- package/dist/components/ui/feedback/Toast.mjs +7 -2
- package/dist/components/ui/feedback/Toast.mjs.map +1 -1
- package/dist/components/widgets/notifications/NotificationCard.mjs +4 -1
- package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -1
- package/dist/providers/whitelabel.provider.mjs +5 -0
- package/dist/providers/whitelabel.provider.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/account/ConfigurationsMyAccountModal.tsx +4 -3
- package/src/components/account/sections/ChangeEmailModal.tsx +3 -1
- package/src/components/account/sections/ChangePhoneModal.tsx +3 -1
- package/src/components/layouts/AppMobileNavBar.tsx +5 -1
- package/src/components/layouts/NavBar.tsx +2 -2
- package/src/components/layouts/NotificationsPopover.tsx +5 -2
- package/src/components/layouts/ProfilePopover.tsx +3 -2
- package/src/components/modals/BuyCreditsModal.tsx +3 -1
- package/src/components/modals/cards/AddCardModal.tsx +3 -1
- package/src/components/navigation/subcomponents/ProjectSelector.tsx +5 -2
- package/src/components/pages/NotFoundPage.tsx +2 -2
- package/src/components/ui/buttons/Button.tsx +7 -2
- package/src/components/ui/data-display/PaymentInfoCard.tsx +7 -1
- package/src/components/ui/feedback/DefaultCircularProgress.tsx +5 -1
- package/src/components/ui/feedback/Toast.tsx +7 -4
- package/src/components/widgets/notifications/NotificationCard.tsx +6 -1
- package/src/providers/whitelabel.provider.tsx +5 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { IconClock } from "@tabler/icons-react";
|
|
3
4
|
import { cn } from "../../../infra/utils/clsx";
|
|
5
|
+
import { useIsDefaultWhitelabel } from "../../../providers/whitelabel.provider";
|
|
4
6
|
function NotificationCard({
|
|
5
7
|
icon,
|
|
6
8
|
iconBgColor,
|
|
@@ -13,6 +15,7 @@ function NotificationCard({
|
|
|
13
15
|
className,
|
|
14
16
|
gapPx = 16
|
|
15
17
|
}) {
|
|
18
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
16
19
|
return /* @__PURE__ */ jsxs(
|
|
17
20
|
"div",
|
|
18
21
|
{
|
|
@@ -43,7 +46,7 @@ function NotificationCard({
|
|
|
43
46
|
] }),
|
|
44
47
|
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: actions })
|
|
45
48
|
] }),
|
|
46
|
-
isUnread && /* @__PURE__ */ jsx("div", { className:
|
|
49
|
+
isUnread && /* @__PURE__ */ jsx("div", { className: `size-2 rounded-full shrink-0 mt-1 ${isDefaultWl ? "bg-cyan-400" : "bg-zinc-400"}` })
|
|
47
50
|
]
|
|
48
51
|
}
|
|
49
52
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/widgets/notifications/NotificationCard.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/widgets/notifications/NotificationCard.tsx"],"sourcesContent":["'use client';\n\nimport { IconClock } from '@tabler/icons-react';\nimport { ReactNode } from 'react';\nimport { cn } from '../../../infra/utils/clsx';\nimport { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';\n\ntype NotificationCardProps = {\n icon: ReactNode;\n iconBgColor?: string;\n title: string;\n description?: string;\n time: string;\n actions?: ReactNode;\n isUnread?: boolean;\n showBorder?: boolean;\n className?: string;\n gapPx: number;\n};\n\nexport default function NotificationCard({\n icon,\n iconBgColor,\n title,\n description,\n time,\n actions,\n isUnread = false,\n showBorder = true,\n className,\n gapPx = 16\n}: NotificationCardProps) {\n const isDefaultWl = useIsDefaultWhitelabel();\n\n return (\n <div\n className={cn(\n 'flex flex-col lg:flex-row items-start p-4 lg:p-5 gap-3 lg:gap-4 relative',\n showBorder && 'border-b border-gray-200',\n className\n )}\n >\n <div\n className={cn(\n 'flex items-center justify-center size-10 rounded-full shrink-0',\n iconBgColor\n )}\n >\n {icon}\n </div>\n\n <div className=\"flex flex-col flex-1\" style={{ gap: `${gapPx}px` }}>\n <div className=\"flex flex-col gap-1\">\n <span className=\"paragraph-small-semibold text-gray-950\">{title}</span>\n {description && (\n <span className=\"paragraph-small-regular text-gray-600\">{description}</span>\n )}\n </div>\n\n <div className=\"flex items-center gap-1.5\">\n <IconClock size={14} className=\"text-gray-400\" />\n <span className=\"paragraph-xsmall-medium text-gray-600\">{time}</span>\n </div>\n\n {actions && <div className=\"flex items-center gap-2\">{actions}</div>}\n </div>\n\n {isUnread && <div className={`size-2 rounded-full shrink-0 mt-1 ${isDefaultWl ? 'bg-cyan-400' : 'bg-zinc-400'}`} />}\n </div>\n );\n}\n\nexport type { NotificationCardProps };\n"],"mappings":";AA0CM,cAUE,YAVF;AAxCN,SAAS,iBAAiB;AAE1B,SAAS,UAAU;AACnB,SAAS,8BAA8B;AAexB,SAAR,iBAAkC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb;AAAA,EACA,QAAQ;AACV,GAA0B;AACxB,QAAM,cAAc,uBAAuB;AAE3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,cAAc;AAAA,QACd;AAAA,MACF;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,YACF;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QAEA,qBAAC,SAAI,WAAU,wBAAuB,OAAO,EAAE,KAAK,GAAG,KAAK,KAAK,GAC/D;AAAA,+BAAC,SAAI,WAAU,uBACb;AAAA,gCAAC,UAAK,WAAU,0CAA0C,iBAAM;AAAA,YAC/D,eACC,oBAAC,UAAK,WAAU,yCAAyC,uBAAY;AAAA,aAEzE;AAAA,UAEA,qBAAC,SAAI,WAAU,6BACb;AAAA,gCAAC,aAAU,MAAM,IAAI,WAAU,iBAAgB;AAAA,YAC/C,oBAAC,UAAK,WAAU,yCAAyC,gBAAK;AAAA,aAChE;AAAA,UAEC,WAAW,oBAAC,SAAI,WAAU,2BAA2B,mBAAQ;AAAA,WAChE;AAAA,QAEC,YAAY,oBAAC,SAAI,WAAW,qCAAqC,cAAc,gBAAgB,aAAa,IAAI;AAAA;AAAA;AAAA,EACnH;AAEJ;","names":[]}
|
|
@@ -24,6 +24,10 @@ function useWhitelabelStyles() {
|
|
|
24
24
|
dashboard: whitelabel?.dashboard ?? null
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
function useIsDefaultWhitelabel() {
|
|
28
|
+
const context = useContext(WhitelabelContext);
|
|
29
|
+
return !context?.whitelabel || context.whitelabel.id === 1;
|
|
30
|
+
}
|
|
27
31
|
function useWhitelabelUrls() {
|
|
28
32
|
const { whitelabel } = useWhitelabel();
|
|
29
33
|
return {
|
|
@@ -35,6 +39,7 @@ function useWhitelabelUrls() {
|
|
|
35
39
|
}
|
|
36
40
|
export {
|
|
37
41
|
WhitelabelProvider,
|
|
42
|
+
useIsDefaultWhitelabel,
|
|
38
43
|
useWhitelabel,
|
|
39
44
|
useWhitelabelStyles,
|
|
40
45
|
useWhitelabelUrls
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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 useIsDefaultWhitelabel(): boolean {\n const context = useContext(WhitelabelContext);\n return !context?.whitelabel || context.whitelabel.id === 1;\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,yBAAkC;AAChD,QAAM,UAAU,WAAW,iBAAiB;AAC5C,SAAO,CAAC,SAAS,cAAc,QAAQ,WAAW,OAAO;AAC3D;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":[]}
|
package/package.json
CHANGED
|
@@ -27,7 +27,8 @@ export default function ConfigurationsMyAccountModal() {
|
|
|
27
27
|
const { hasActiveSubscription } = config;
|
|
28
28
|
|
|
29
29
|
const { user } = useAuth();
|
|
30
|
-
const
|
|
30
|
+
const isOwner = user?.profile === UserProfile.owner;
|
|
31
|
+
|
|
31
32
|
const isMobile = useIsMobile();
|
|
32
33
|
const { activeSection, setActiveSection } = useConfigurationsModal({
|
|
33
34
|
isOpen: open,
|
|
@@ -109,7 +110,7 @@ export default function ConfigurationsMyAccountModal() {
|
|
|
109
110
|
<span className="paragraph-small-medium">Preferências</span>
|
|
110
111
|
</TabsTrigger>
|
|
111
112
|
|
|
112
|
-
{
|
|
113
|
+
{isOwner && (
|
|
113
114
|
<TabsTrigger value={AccountSectionType.SECURITY} className={tabTriggerClasses}>
|
|
114
115
|
<IconLock size={20} className="shrink-0" />
|
|
115
116
|
<span className="paragraph-small-medium">Segurança</span>
|
|
@@ -123,7 +124,7 @@ export default function ConfigurationsMyAccountModal() {
|
|
|
123
124
|
<PreferencesSection onClose={close} />
|
|
124
125
|
</TabsContent>
|
|
125
126
|
|
|
126
|
-
{
|
|
127
|
+
{isOwner && (
|
|
127
128
|
<>
|
|
128
129
|
<TabsContent value={AccountSectionType.SECURITY} className="h-full! relative overflow-hidden">
|
|
129
130
|
<SecuritySection
|
|
@@ -9,6 +9,7 @@ import { FormField } from '../../ui/form/FormField';
|
|
|
9
9
|
import { formatTimer } from '../../../utils/format/masks';
|
|
10
10
|
import { OTP_CODE_LENGTH } from '../../../utils/validators/account';
|
|
11
11
|
import { useAuth } from '../../../providers/auth.provider';
|
|
12
|
+
import { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';
|
|
12
13
|
import { useInvalidateUser } from '../../../modules/auth/hooks/useUserQuery';
|
|
13
14
|
import { confirmEmailChangeAction } from '../../../modules/accounts/actions/account-management.action';
|
|
14
15
|
import useChangeEmailForm from '../hooks/useChangeEmailForm';
|
|
@@ -21,6 +22,7 @@ interface ChangeEmailModalProps {
|
|
|
21
22
|
|
|
22
23
|
export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
|
|
23
24
|
const { user } = useAuth();
|
|
25
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
24
26
|
const invalidateUser = useInvalidateUser();
|
|
25
27
|
|
|
26
28
|
const {
|
|
@@ -117,7 +119,7 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
|
|
|
117
119
|
</>
|
|
118
120
|
)}
|
|
119
121
|
|
|
120
|
-
<div className={`${showVerification ? 'w-full' : 'w-1/2'} h-0.75 bg-cyan-300`} />
|
|
122
|
+
<div className={`${showVerification ? 'w-full' : 'w-1/2'} h-0.75 ${isDefaultWl ? 'bg-cyan-300' : 'bg-zinc-300'}`} />
|
|
121
123
|
|
|
122
124
|
{showVerification ? (
|
|
123
125
|
<form
|
|
@@ -9,6 +9,7 @@ import PhoneInput from '../../ui/form/PhoneInput';
|
|
|
9
9
|
import { formatTimer, formatPhone } from '../../../utils/format/masks';
|
|
10
10
|
import { OTP_CODE_LENGTH } from '../../../utils/validators/account';
|
|
11
11
|
import { useAuth } from '../../../providers/auth.provider';
|
|
12
|
+
import { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';
|
|
12
13
|
import { useInvalidateUser } from '../../../modules/auth/hooks/useUserQuery';
|
|
13
14
|
import { confirmPhoneChangeAction } from '../../../modules/accounts/actions/account-management.action';
|
|
14
15
|
import useChangePhoneForm from '../hooks/useChangePhoneForm';
|
|
@@ -21,6 +22,7 @@ interface ChangePhoneModalProps {
|
|
|
21
22
|
|
|
22
23
|
export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
|
|
23
24
|
const { user } = useAuth();
|
|
25
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
24
26
|
const invalidateUser = useInvalidateUser();
|
|
25
27
|
|
|
26
28
|
const hasExistingPhone = !!user?.phone;
|
|
@@ -134,7 +136,7 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
|
|
|
134
136
|
</>
|
|
135
137
|
)}
|
|
136
138
|
|
|
137
|
-
<div className={`${showVerification || !hasExistingPhone ? 'w-full' : 'w-1/2'} h-0.75 bg-cyan-300`} />
|
|
139
|
+
<div className={`${showVerification || !hasExistingPhone ? 'w-full' : 'w-1/2'} h-0.75 ${isDefaultWl ? 'bg-cyan-300' : 'bg-zinc-300'}`} />
|
|
138
140
|
|
|
139
141
|
{showVerification ? (
|
|
140
142
|
<form
|
|
@@ -5,6 +5,7 @@ import Image from "next/image";
|
|
|
5
5
|
import { IconMenu2, IconX } from "@tabler/icons-react";
|
|
6
6
|
import { ProfilePopover } from "./ProfilePopover";
|
|
7
7
|
import { useMobileNavbarSheet } from "../../store/useMobileNavbarSheet";
|
|
8
|
+
import { useIsDefaultWhitelabel } from "../../providers/whitelabel.provider";
|
|
8
9
|
import type { ProfileMenuItem } from "./ProfilePopover";
|
|
9
10
|
|
|
10
11
|
export interface AppMobileNavBarProps {
|
|
@@ -26,6 +27,7 @@ export function AppMobileNavBar({
|
|
|
26
27
|
showMenuToggle = true,
|
|
27
28
|
}: AppMobileNavBarProps) {
|
|
28
29
|
const { isOpen, toggle } = useMobileNavbarSheet();
|
|
30
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
29
31
|
|
|
30
32
|
const isGpagesActive = activeApp === "gpages";
|
|
31
33
|
|
|
@@ -36,7 +38,9 @@ export function AppMobileNavBar({
|
|
|
36
38
|
<div
|
|
37
39
|
className={`size-10 rounded-lg flex items-center justify-center transition-colors ${
|
|
38
40
|
isGpagesActive
|
|
39
|
-
?
|
|
41
|
+
? isDefaultWl
|
|
42
|
+
? "bg-cyan-100 border-2 border-white ring-2 ring-cyan-300"
|
|
43
|
+
: "border-2 border-white ring-2 ring-zinc-300 bg-zinc-100"
|
|
40
44
|
: onAppIconClick ? "cursor-pointer hover:bg-gray-100" : ""
|
|
41
45
|
}`}
|
|
42
46
|
onClick={onAppIconClick}
|
|
@@ -6,7 +6,7 @@ import { IconChevronRight } from "@tabler/icons-react";
|
|
|
6
6
|
import { Separator } from "../ui/data-display/Separator";
|
|
7
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/overlay/Tooltip";
|
|
8
8
|
import { useDesktopSidebarStore, useDesktopSidebarHydration } from "../../store/useDesktopSidebarStore";
|
|
9
|
-
import { useWhitelabel } from "../../providers/whitelabel.provider";
|
|
9
|
+
import { useWhitelabel, useIsDefaultWhitelabel } from "../../providers/whitelabel.provider";
|
|
10
10
|
import { cn } from "../../infra/utils/clsx";
|
|
11
11
|
|
|
12
12
|
type NavBarProps = {
|
|
@@ -32,7 +32,7 @@ function NavBar({
|
|
|
32
32
|
useDesktopSidebarStore();
|
|
33
33
|
useDesktopSidebarHydration();
|
|
34
34
|
const { whitelabel } = useWhitelabel();
|
|
35
|
-
const isDefaultWl =
|
|
35
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
36
36
|
const primaryColor = whitelabel?.general?.primary_color;
|
|
37
37
|
const wlName = whitelabel?.name || 'Great';
|
|
38
38
|
|
|
@@ -8,6 +8,7 @@ import { Button } from "../ui/buttons/Button";
|
|
|
8
8
|
import NotificationCard from "../widgets/notifications/NotificationCard";
|
|
9
9
|
import { cn } from "../../infra/utils/clsx";
|
|
10
10
|
import { useMessages, useMarkAllMessagesAsRead } from "../../modules/users/hooks/messages.hook";
|
|
11
|
+
import { useIsDefaultWhitelabel } from "../../providers/whitelabel.provider";
|
|
11
12
|
import { formatDistanceToNow } from "date-fns";
|
|
12
13
|
import { ptBR } from "date-fns/locale";
|
|
13
14
|
|
|
@@ -24,8 +25,10 @@ function NotificationsPopover({
|
|
|
24
25
|
side,
|
|
25
26
|
align,
|
|
26
27
|
contentClassName,
|
|
27
|
-
badgeClassName
|
|
28
|
+
badgeClassName,
|
|
28
29
|
}: NotificationsPopoverProps) {
|
|
30
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
31
|
+
const resolvedBadgeClassName = badgeClassName ?? (isDefaultWl ? "bg-cyan-300" : "bg-zinc-300");
|
|
29
32
|
const [open, setOpen] = useState(false);
|
|
30
33
|
const { data: messagesData } = useMessages({ type: 'notification', readed: true, limit: 5 });
|
|
31
34
|
const { mutate: markAllAsRead } = useMarkAllMessagesAsRead();
|
|
@@ -51,7 +54,7 @@ function NotificationsPopover({
|
|
|
51
54
|
<span
|
|
52
55
|
className={cn(
|
|
53
56
|
"absolute top-0.5 right-0.5 size-3.5 rounded-full border-2 border-white",
|
|
54
|
-
|
|
57
|
+
resolvedBadgeClassName,
|
|
55
58
|
)}
|
|
56
59
|
/>
|
|
57
60
|
)}
|
|
@@ -11,7 +11,7 @@ import { NavBarItem } from "./NavBarItem";
|
|
|
11
11
|
import { UserAvatar } from "../ui/data-display/UserAvatar";
|
|
12
12
|
import { LoadingOverlay } from "../ui/feedback/LoadingOverlay";
|
|
13
13
|
import { useAuth } from "../../providers/auth.provider";
|
|
14
|
-
import { useWhitelabelUrls } from "../../providers/whitelabel.provider";
|
|
14
|
+
import { useIsDefaultWhitelabel, useWhitelabelUrls } from "../../providers/whitelabel.provider";
|
|
15
15
|
import { cn } from "../../infra/utils/clsx";
|
|
16
16
|
import { useIaCredits } from "../../modules/ia-credits/hooks/ia-credits.hook";
|
|
17
17
|
import { useBuyCreditsModal } from "../../store/useBuyCreditsModal";
|
|
@@ -42,6 +42,7 @@ function ProfilePopover({
|
|
|
42
42
|
const { summary, subscription, isSubscriptionLoading, isCreditsLoading } =
|
|
43
43
|
useIaCredits();
|
|
44
44
|
const { openModal: openBuyCreditsModal } = useBuyCreditsModal();
|
|
45
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
45
46
|
const { accountsUrl } = useWhitelabelUrls();
|
|
46
47
|
const router = useRouter();
|
|
47
48
|
|
|
@@ -54,7 +55,7 @@ function ProfilePopover({
|
|
|
54
55
|
const hasSubscription = !isSubscriptionLoading && subscription !== null;
|
|
55
56
|
|
|
56
57
|
const isApiPlan = hasSubscription && subscription.id_plan === 411;
|
|
57
|
-
const shouldShowCredits = hasSubscription &&
|
|
58
|
+
const shouldShowCredits = hasSubscription && isDefaultWl && !isApiPlan;
|
|
58
59
|
const creditsPercentage =
|
|
59
60
|
shouldShowCredits && summary.totalCredits > 0
|
|
60
61
|
? (summary.usedCredits / summary.totalCredits) * 100
|
|
@@ -24,6 +24,7 @@ import { useActiveSubscription } from '../../modules/subscriptions/hooks/find-ac
|
|
|
24
24
|
import { useCalculateSubscription } from '../../modules/subscriptions/hooks/calculate-subscription.hook';
|
|
25
25
|
import { useUpdateSubscriptionPlan } from '../../modules/subscriptions/hooks/update-subscription-plan.hook';
|
|
26
26
|
import { getPriceFromCalculatedData } from '../../modules/subscriptions/utils/periodicity';
|
|
27
|
+
import { useIsDefaultWhitelabel } from '../../providers/whitelabel.provider';
|
|
27
28
|
import { IconInfoCircle, IconX, IconLoader2 } from '@tabler/icons-react';
|
|
28
29
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
29
30
|
import { useForm } from 'react-hook-form';
|
|
@@ -43,6 +44,7 @@ type BuyCreditFormData = z.infer<typeof buyCreditSchema>;
|
|
|
43
44
|
export default function BuyCreditsModal() {
|
|
44
45
|
const { open, closeModal } = useBuyCreditsModal();
|
|
45
46
|
const { openModal } = useModalManager();
|
|
47
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
46
48
|
const { data: cardsData } = useCards();
|
|
47
49
|
const { data: subscriptionData } = useActiveSubscription();
|
|
48
50
|
const subscription = subscriptionData?.data?.[0] ?? null;
|
|
@@ -279,7 +281,7 @@ export default function BuyCreditsModal() {
|
|
|
279
281
|
/>
|
|
280
282
|
|
|
281
283
|
{hasChanged && (
|
|
282
|
-
<div className=
|
|
284
|
+
<div className={`flex items-center gap-3 p-4 rounded-lg ${isDefaultWl ? 'bg-cyan-50' : 'bg-zinc-50'}`}>
|
|
283
285
|
<IconInfoCircle className="size-4 text-zinc-950 shrink-0" />
|
|
284
286
|
<span className="paragraph-small-regular text-zinc-950">
|
|
285
287
|
{isIncreasingCredits
|
|
@@ -9,6 +9,7 @@ import { useCreateCard } from '../../../modules/cards/hooks/create-card.hook';
|
|
|
9
9
|
import { useUpdateAccount } from '../../../modules/accounts/hooks/useAccountManagement';
|
|
10
10
|
import { CardFormFields, BillingFormFields, cardFormSchema } from './CardFormFields';
|
|
11
11
|
import type { CardFormData, StripeElementsStatus } from './CardFormFields';
|
|
12
|
+
import { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';
|
|
12
13
|
import { IconLoader2, IconX } from '@tabler/icons-react';
|
|
13
14
|
import { useForm } from 'react-hook-form';
|
|
14
15
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
@@ -23,6 +24,7 @@ const INITIAL_STRIPE_STATUS: StripeElementsStatus = {
|
|
|
23
24
|
|
|
24
25
|
export default function AddCardModal() {
|
|
25
26
|
const { activeModal, modalData, closeModal } = useModalManager();
|
|
27
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
26
28
|
const isOpen = activeModal === 'addCardModal';
|
|
27
29
|
const [currentStep, setCurrentStep] = useState(1);
|
|
28
30
|
const [stripeStatus, setStripeStatus] = useState<StripeElementsStatus>(INITIAL_STRIPE_STATUS);
|
|
@@ -209,7 +211,7 @@ export default function AddCardModal() {
|
|
|
209
211
|
{/* Progress bar */}
|
|
210
212
|
<div className="h-1 bg-zinc-100 w-full">
|
|
211
213
|
<div
|
|
212
|
-
className=
|
|
214
|
+
className={`h-full transition-all duration-300 ease-in-out ${isDefaultWl ? 'bg-cyan-400' : 'bg-zinc-400'}`}
|
|
213
215
|
style={{ width: currentStep === 1 ? '50%' : '100%' }}
|
|
214
216
|
/>
|
|
215
217
|
</div>
|
|
@@ -4,7 +4,7 @@ import { useState, useRef, useEffect, RefObject } from 'react';
|
|
|
4
4
|
import { useMobileNavbarSheet } from '../../../store/useMobileNavbarSheet';
|
|
5
5
|
import { useAppNavigationContext } from '../AppNavigationContext';
|
|
6
6
|
import { ProjectSelectorPopover } from '../ProjectSelectorPopover';
|
|
7
|
-
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList, UserAvatar } from '../../../index';
|
|
7
|
+
import { cn, Command, CommandEmpty, CommandInput, CommandItem, CommandList, UserAvatar, useWhitelabel } from '../../../index';
|
|
8
8
|
import { IconChevronDown } from '@tabler/icons-react';
|
|
9
9
|
import type { NavigationProject } from '../types';
|
|
10
10
|
|
|
@@ -40,6 +40,7 @@ export function ProjectSelector({
|
|
|
40
40
|
onAddProject,
|
|
41
41
|
onManageProjects,
|
|
42
42
|
}: ProjectSelectorProps) {
|
|
43
|
+
const { whitelabel } = useWhitelabel();
|
|
43
44
|
const { breakpoint } = useAppNavigationContext();
|
|
44
45
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
45
46
|
const [activeSection, setActiveSection] = useState<'projects' | null>(null);
|
|
@@ -56,7 +57,9 @@ export function ProjectSelector({
|
|
|
56
57
|
// Desktop and md: title + popover (aligned with NavBar logo + separator)
|
|
57
58
|
if (breakpoint === 'desktop' || breakpoint === 'md') {
|
|
58
59
|
return (
|
|
59
|
-
<div className=
|
|
60
|
+
<div className={cn(
|
|
61
|
+
whitelabel?.id != 1 ? "mt-[14.5px.5px] mb-[7px]" : "mt-[6.5px] mb-[3px]"
|
|
62
|
+
)}>
|
|
60
63
|
<div className="flex items-center h-7">
|
|
61
64
|
<ProjectSelectorPopover
|
|
62
65
|
open={isPopoverOpen}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Image from "next/image";
|
|
4
4
|
import { useRouter } from "next/navigation";
|
|
5
|
-
import { useWhitelabel } from "../../providers/whitelabel.provider";
|
|
5
|
+
import { useWhitelabel, useIsDefaultWhitelabel } from "../../providers/whitelabel.provider";
|
|
6
6
|
import { Button } from "../ui/buttons/Button";
|
|
7
7
|
|
|
8
8
|
function GreatAppsLogo() {
|
|
@@ -18,7 +18,7 @@ function GreatAppsLogo() {
|
|
|
18
18
|
export function NotFoundPage() {
|
|
19
19
|
const router = useRouter();
|
|
20
20
|
const { whitelabel } = useWhitelabel();
|
|
21
|
-
const isGreatApps =
|
|
21
|
+
const isGreatApps = useIsDefaultWhitelabel();
|
|
22
22
|
const whitelabelLogo = whitelabel?.logo
|
|
23
23
|
? `${process.env.NEXT_PUBLIC_STORAGE_URL}/${whitelabel.logo}`
|
|
24
24
|
: null;
|
|
@@ -4,6 +4,7 @@ import * as React from "react"
|
|
|
4
4
|
import { Slot } from "@radix-ui/react-slot"
|
|
5
5
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
6
|
import { cn } from "../../../infra/utils/clsx"
|
|
7
|
+
import { useIsDefaultWhitelabel } from "../../../providers/whitelabel.provider"
|
|
7
8
|
|
|
8
9
|
const buttonVariants = cva(
|
|
9
10
|
"paragraph-small-semibold cursor-pointer flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
@@ -15,7 +16,7 @@ const buttonVariants = cva(
|
|
|
15
16
|
"bg-white text-gray-950 border-gray-200 hover:border-gray-400 border",
|
|
16
17
|
ghost:
|
|
17
18
|
"text-gray-600 hover:bg-accent hover:text-gray-950 dark:hover:bg-accent/50",
|
|
18
|
-
brand: "
|
|
19
|
+
brand: "text-gray-950",
|
|
19
20
|
},
|
|
20
21
|
size: {
|
|
21
22
|
default: "h-12 px-4 py-2 has-[>svg]:px-3",
|
|
@@ -43,12 +44,16 @@ function Button({
|
|
|
43
44
|
VariantProps<typeof buttonVariants> & {
|
|
44
45
|
asChild?: boolean
|
|
45
46
|
}) {
|
|
47
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
46
48
|
const Comp = asChild ? Slot : "button"
|
|
47
49
|
|
|
48
50
|
return (
|
|
49
51
|
<Comp
|
|
50
52
|
data-slot="button"
|
|
51
|
-
className={cn(
|
|
53
|
+
className={cn(
|
|
54
|
+
buttonVariants({ variant, size, className }),
|
|
55
|
+
variant === "brand" && (isDefaultWl ? "bg-cyan-300 hover:bg-cyan-200" : "bg-zinc-300 hover:bg-zinc-200")
|
|
56
|
+
)}
|
|
52
57
|
{...props}
|
|
53
58
|
/>
|
|
54
59
|
)
|
|
@@ -7,6 +7,7 @@ import useIsMobile from '../../../hooks/useIsMobile';
|
|
|
7
7
|
import { useCards } from '../../../modules/cards/hooks/cards.hook';
|
|
8
8
|
import { useCallback, useState } from 'react';
|
|
9
9
|
import { useModalManager } from '../../../store/useModalManager';
|
|
10
|
+
import { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';
|
|
10
11
|
import type { Card } from '../../../modules/cards/types';
|
|
11
12
|
|
|
12
13
|
type PaymentInfoCardProps = {
|
|
@@ -26,6 +27,7 @@ export function PaymentInfoCard({
|
|
|
26
27
|
}: PaymentInfoCardProps) {
|
|
27
28
|
const isMobile = useIsMobile();
|
|
28
29
|
const { openModal } = useModalManager();
|
|
30
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
29
31
|
|
|
30
32
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
31
33
|
|
|
@@ -163,7 +165,11 @@ export function PaymentInfoCard({
|
|
|
163
165
|
<button
|
|
164
166
|
type="button"
|
|
165
167
|
onClick={onManageCards}
|
|
166
|
-
className=
|
|
168
|
+
className={`flex items-center justify-center h-10 px-4 paragraph-small-semibold rounded-lg transition-colors cursor-pointer mt-2 ${
|
|
169
|
+
isDefaultWl
|
|
170
|
+
? 'text-cyan-600 border border-cyan-200 hover:bg-cyan-50'
|
|
171
|
+
: 'text-zinc-600 border border-zinc-200 hover:bg-zinc-50'
|
|
172
|
+
}`}
|
|
167
173
|
>
|
|
168
174
|
Gerenciar cartões
|
|
169
175
|
</button>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
calculateRadius,
|
|
3
5
|
calculateCircumference,
|
|
4
6
|
calculatePercentage,
|
|
5
7
|
calculateCircularProgressOffset,
|
|
6
8
|
} from "../../../infra/utils/percentage";
|
|
9
|
+
import { useIsDefaultWhitelabel } from "../../../providers/whitelabel.provider";
|
|
7
10
|
|
|
8
11
|
interface CircularProgressProps {
|
|
9
12
|
current: number;
|
|
@@ -18,6 +21,7 @@ export default function DefaultCircularProgress({
|
|
|
18
21
|
size = 62,
|
|
19
22
|
strokeWidth = 3,
|
|
20
23
|
}: CircularProgressProps) {
|
|
24
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
21
25
|
const radius = calculateRadius(size, strokeWidth);
|
|
22
26
|
const circumference = calculateCircumference(radius);
|
|
23
27
|
const percentage = calculatePercentage(current, total);
|
|
@@ -46,7 +50,7 @@ export default function DefaultCircularProgress({
|
|
|
46
50
|
cx={size / 2}
|
|
47
51
|
cy={size / 2}
|
|
48
52
|
r={radius}
|
|
49
|
-
stroke="var(--color-cyan-300)"
|
|
53
|
+
stroke={isDefaultWl ? "var(--color-cyan-300)" : "var(--color-zinc-300)"}
|
|
50
54
|
strokeWidth={strokeWidth}
|
|
51
55
|
fill="none"
|
|
52
56
|
strokeDasharray={circumference}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
"use client"
|
|
4
|
-
|
|
5
3
|
import * as React from "react"
|
|
6
4
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
7
5
|
import { IconCircleCheck, IconCircleX, IconAlertCircle, IconInfoCircle, IconCircle, IconX } from "@tabler/icons-react"
|
|
8
6
|
import { toast } from "sonner"
|
|
9
7
|
import { cn } from "../../../infra/utils/clsx"
|
|
8
|
+
import { useIsDefaultWhitelabel } from "../../../providers/whitelabel.provider"
|
|
10
9
|
import { Button } from "../buttons/Button"
|
|
11
10
|
|
|
12
11
|
const toastVariants = cva(
|
|
@@ -35,7 +34,7 @@ const toastIconContainerVariants = cva(
|
|
|
35
34
|
success: "bg-green-50 text-green-500",
|
|
36
35
|
error: "bg-red-50 text-red-500",
|
|
37
36
|
warning: "bg-yellow-50 text-yellow-400",
|
|
38
|
-
info: "
|
|
37
|
+
info: "",
|
|
39
38
|
default: "bg-gray-50 text-gray-950",
|
|
40
39
|
},
|
|
41
40
|
},
|
|
@@ -69,6 +68,7 @@ function Toast({
|
|
|
69
68
|
className,
|
|
70
69
|
toastId,
|
|
71
70
|
}: ToastProps) {
|
|
71
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
72
72
|
const Icon = variant ? TOAST_ICONS[variant] : null
|
|
73
73
|
|
|
74
74
|
return (
|
|
@@ -77,7 +77,10 @@ function Toast({
|
|
|
77
77
|
children
|
|
78
78
|
) : (
|
|
79
79
|
<div className="flex items-center gap-3 flex-1 min-w-0">
|
|
80
|
-
<div className={cn(
|
|
80
|
+
<div className={cn(
|
|
81
|
+
toastIconContainerVariants({ variant }),
|
|
82
|
+
variant === "info" && (isDefaultWl ? "bg-cyan-50 text-pages-500" : "bg-zinc-50 text-zinc-500")
|
|
83
|
+
)}>
|
|
81
84
|
{icon || (Icon && <Icon size={16} />)}
|
|
82
85
|
</div>
|
|
83
86
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { IconClock } from '@tabler/icons-react';
|
|
2
4
|
import { ReactNode } from 'react';
|
|
3
5
|
import { cn } from '../../../infra/utils/clsx';
|
|
6
|
+
import { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';
|
|
4
7
|
|
|
5
8
|
type NotificationCardProps = {
|
|
6
9
|
icon: ReactNode;
|
|
@@ -27,6 +30,8 @@ export default function NotificationCard({
|
|
|
27
30
|
className,
|
|
28
31
|
gapPx = 16
|
|
29
32
|
}: NotificationCardProps) {
|
|
33
|
+
const isDefaultWl = useIsDefaultWhitelabel();
|
|
34
|
+
|
|
30
35
|
return (
|
|
31
36
|
<div
|
|
32
37
|
className={cn(
|
|
@@ -60,7 +65,7 @@ export default function NotificationCard({
|
|
|
60
65
|
{actions && <div className="flex items-center gap-2">{actions}</div>}
|
|
61
66
|
</div>
|
|
62
67
|
|
|
63
|
-
{isUnread && <div className=
|
|
68
|
+
{isUnread && <div className={`size-2 rounded-full shrink-0 mt-1 ${isDefaultWl ? 'bg-cyan-400' : 'bg-zinc-400'}`} />}
|
|
64
69
|
</div>
|
|
65
70
|
);
|
|
66
71
|
}
|
|
@@ -43,6 +43,11 @@ export function useWhitelabelStyles() {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
export function useIsDefaultWhitelabel(): boolean {
|
|
47
|
+
const context = useContext(WhitelabelContext);
|
|
48
|
+
return !context?.whitelabel || context.whitelabel.id === 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
export function useWhitelabelUrls() {
|
|
47
52
|
const { whitelabel } = useWhitelabel();
|
|
48
53
|
return {
|