@greatapps/common 1.1.717 → 1.1.718
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 +32 -38
- package/dist/index.mjs.map +1 -1
- package/dist/providers/auth.provider.mjs +0 -2
- package/dist/providers/auth.provider.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -3
- package/src/providers/auth.provider.tsx +0 -3
- package/dist/components/modals/HexaPromoModal.mjs +0 -169
- package/dist/components/modals/HexaPromoModal.mjs.map +0 -1
- package/dist/components/modals/HexaPromoModalGate.mjs +0 -61
- package/dist/components/modals/HexaPromoModalGate.mjs.map +0 -1
- package/dist/store/useHexaPromoModal.mjs +0 -14
- package/dist/store/useHexaPromoModal.mjs.map +0 -1
- package/dist/utils/cookies/hexa-promo.mjs +0 -88
- package/dist/utils/cookies/hexa-promo.mjs.map +0 -1
- package/src/components/modals/HexaPromoModal.tsx +0 -218
- package/src/components/modals/HexaPromoModalGate.tsx +0 -93
- package/src/store/useHexaPromoModal.ts +0 -13
- package/src/utils/cookies/hexa-promo.ts +0 -114
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { toast } from "sonner";
|
|
4
|
-
import {
|
|
5
|
-
IconCheck,
|
|
6
|
-
IconCopy,
|
|
7
|
-
IconInfoCircle,
|
|
8
|
-
IconStar,
|
|
9
|
-
IconTicket,
|
|
10
|
-
IconX
|
|
11
|
-
} from "@tabler/icons-react";
|
|
12
|
-
import { Dialog, DialogClose, DialogContent, DialogTitle } from "../ui/overlay/Dialog";
|
|
13
|
-
import { Toast } from "../ui/feedback/Toast";
|
|
14
|
-
import { Button } from "../ui/buttons/Button";
|
|
15
|
-
import useCopyToClipboard from "../../hooks/copy-to-clipboard.hook";
|
|
16
|
-
import { useModalManager } from "../../store/useModalManager";
|
|
17
|
-
import { useWhitelabelUrls } from "../../providers/whitelabel.provider";
|
|
18
|
-
import { cn } from "../../infra/utils/clsx";
|
|
19
|
-
const COPY = {
|
|
20
|
-
title: "Rumo ao Hexa!",
|
|
21
|
-
subtitlePrefix: "Ofertas exclusivas at\xE9 ",
|
|
22
|
-
subtitleDate: "24/06",
|
|
23
|
-
mostChosen: "Mais escolhido",
|
|
24
|
-
couponLabel: "Cupom",
|
|
25
|
-
choosePlan: "Escolher plano",
|
|
26
|
-
couponCopied: "Cupom copiado!",
|
|
27
|
-
close: "Fechar",
|
|
28
|
-
footerPrefix: "V\xE1lido para a ",
|
|
29
|
-
footerBold: "primeira contrata\xE7\xE3o",
|
|
30
|
-
footerSuffix: " dos planos Essencial, Neg\xF3cio ou Ag\xEAncia"
|
|
31
|
-
};
|
|
32
|
-
const COMBOS = [
|
|
33
|
-
{
|
|
34
|
-
coupon: "MENSAL10",
|
|
35
|
-
name: "Combo convoca\xE7\xE3o",
|
|
36
|
-
highlighted: false,
|
|
37
|
-
period: "monthly",
|
|
38
|
-
features: ["10% OFF no plano mensal", "Webinars exclusivos"]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
coupon: "SEMESTRAL10",
|
|
42
|
-
name: "Combo Hexa",
|
|
43
|
-
highlighted: true,
|
|
44
|
-
period: "semiannual",
|
|
45
|
-
features: ["10% OFF no plano semestral", "3 templates exclusivos", "Webinars exclusivos"]
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
coupon: "ANUAL10",
|
|
49
|
-
name: "Combo escala\xE7\xE3o",
|
|
50
|
-
highlighted: false,
|
|
51
|
-
period: "annual",
|
|
52
|
-
features: ["10% OFF no plano anual", "3 templates exclusivos"]
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
const GRADIENT = "linear-gradient(180deg, #08c44f 0%, #7bd237 46.6%, #ffe31b 100%)";
|
|
56
|
-
function HexaPromoModal() {
|
|
57
|
-
const { activeModal, closeModal } = useModalManager();
|
|
58
|
-
const { accountsUrl } = useWhitelabelUrls();
|
|
59
|
-
const isOpen = activeModal === "hexaPromoModal";
|
|
60
|
-
const goToPlans = (coupon, period) => {
|
|
61
|
-
closeModal();
|
|
62
|
-
const url = `${accountsUrl}/subscriptions?tab=plans&coupon=${encodeURIComponent(coupon)}&period=${encodeURIComponent(period)}`;
|
|
63
|
-
window.location.assign(url);
|
|
64
|
-
};
|
|
65
|
-
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: () => closeModal(), children: /* @__PURE__ */ jsxs(
|
|
66
|
-
DialogContent,
|
|
67
|
-
{
|
|
68
|
-
showCloseButton: false,
|
|
69
|
-
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
70
|
-
className: "border-0 bg-transparent p-0 shadow-none w-[calc(100%-32px)] sm:max-w-[940px] md:w-[924px] lg:w-[924px] max-h-[calc(100dvh-32px)] overflow-y-auto",
|
|
71
|
-
children: [
|
|
72
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: COPY.title }),
|
|
73
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-[12px] p-1", style: { background: GRADIENT }, children: /* @__PURE__ */ jsxs("div", { className: "relative overflow-hidden rounded-[10px] bg-white p-8 shadow-[0px_2px_10px_0px_rgba(26,26,26,0.05)]", children: [
|
|
74
|
-
/* @__PURE__ */ jsx(
|
|
75
|
-
"img",
|
|
76
|
-
{
|
|
77
|
-
src: "/promo/hexa-confetti.png",
|
|
78
|
-
alt: "",
|
|
79
|
-
"aria-hidden": true,
|
|
80
|
-
className: "pointer-events-none absolute -top-10 right-0 w-[280px] rotate-[16deg] select-none"
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
/* @__PURE__ */ jsxs(DialogClose, { className: "absolute right-3 top-3 z-10 flex size-[34px] cursor-pointer items-center justify-center rounded-lg bg-white p-2 text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-950 focus:outline-none", children: [
|
|
84
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: COPY.close }),
|
|
85
|
-
/* @__PURE__ */ jsx(IconX, { className: "size-[18px]" })
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ jsxs("div", { className: "relative z-[1] flex w-fit items-center gap-[9px] rounded-lg bg-zinc-100 px-[9px] py-2", children: [
|
|
88
|
-
/* @__PURE__ */ jsx("img", { src: "/promo/hexa-logo.svg", alt: "", "aria-hidden": true, className: "size-6 select-none" }),
|
|
89
|
-
/* @__PURE__ */ jsx("img", { src: "/promo/hexa-flag.png", alt: "", "aria-hidden": true, className: "size-6 rounded select-none" })
|
|
90
|
-
] }),
|
|
91
|
-
/* @__PURE__ */ jsxs("div", { className: "relative z-[1] mt-4 flex flex-col gap-1", children: [
|
|
92
|
-
/* @__PURE__ */ jsx("h2", { className: "font-['Outfit'] text-[32px] font-semibold leading-8 text-zinc-950", children: COPY.title }),
|
|
93
|
-
/* @__PURE__ */ jsxs("p", { className: "paragraph-medium-medium text-zinc-950", children: [
|
|
94
|
-
COPY.subtitlePrefix,
|
|
95
|
-
/* @__PURE__ */ jsx("span", { className: "font-bold", children: COPY.subtitleDate })
|
|
96
|
-
] })
|
|
97
|
-
] }),
|
|
98
|
-
/* @__PURE__ */ jsx("div", { className: "relative z-[1] mt-10 flex flex-col items-stretch gap-3 md:flex-row", children: COMBOS.map((combo) => /* @__PURE__ */ jsx(ComboCard, { combo, onChoose: () => goToPlans(combo.coupon, combo.period) }, combo.coupon)) }),
|
|
99
|
-
/* @__PURE__ */ jsxs("div", { className: "relative z-[1] mt-3 flex items-center justify-center gap-2.5 rounded-[10px] bg-zinc-100 p-3 text-center", children: [
|
|
100
|
-
/* @__PURE__ */ jsx(IconInfoCircle, { className: "size-4 shrink-0 text-zinc-950" }),
|
|
101
|
-
/* @__PURE__ */ jsxs("p", { className: "paragraph-small-medium text-zinc-950", children: [
|
|
102
|
-
COPY.footerPrefix,
|
|
103
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: COPY.footerBold }),
|
|
104
|
-
COPY.footerSuffix
|
|
105
|
-
] })
|
|
106
|
-
] })
|
|
107
|
-
] }) })
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
) });
|
|
111
|
-
}
|
|
112
|
-
function ComboCard({ combo, onChoose }) {
|
|
113
|
-
const { isCopied, copy } = useCopyToClipboard({
|
|
114
|
-
onSuccess: () => {
|
|
115
|
-
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: COPY.couponCopied, toastId: t }));
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
return /* @__PURE__ */ jsxs(
|
|
119
|
-
"div",
|
|
120
|
-
{
|
|
121
|
-
className: cn(
|
|
122
|
-
"relative flex flex-1 flex-col rounded-[10px] border bg-white pb-3 md:w-[276px]",
|
|
123
|
-
combo.highlighted ? "border-cyan-500" : "border-zinc-200"
|
|
124
|
-
),
|
|
125
|
-
children: [
|
|
126
|
-
combo.highlighted && /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2 top-0 z-[1] flex h-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center gap-[5px] rounded-md border-4 border-white bg-cyan-100 px-2", children: [
|
|
127
|
-
/* @__PURE__ */ jsx(IconStar, { className: "size-3 text-cyan-600" }),
|
|
128
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-semibold whitespace-nowrap text-cyan-600", children: COPY.mostChosen }),
|
|
129
|
-
/* @__PURE__ */ jsx(IconStar, { className: "size-3 text-cyan-600" })
|
|
130
|
-
] }),
|
|
131
|
-
/* @__PURE__ */ jsx("h3", { className: "border-b border-zinc-200 px-4 py-4 text-center font-['Outfit'] text-base font-semibold text-zinc-950", children: combo.name }),
|
|
132
|
-
/* @__PURE__ */ jsx("ul", { className: "flex flex-1 flex-col gap-5 px-5 pt-5", children: combo.features.map((feature) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2.5", children: [
|
|
133
|
-
/* @__PURE__ */ jsx(IconCheck, { className: "size-5 shrink-0 text-cyan-500" }),
|
|
134
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-zinc-950", children: feature })
|
|
135
|
-
] }, feature)) }),
|
|
136
|
-
/* @__PURE__ */ jsxs("div", { className: "mx-3 mt-5 flex items-center gap-3 rounded-lg bg-cyan-50 py-2 pl-3.5 pr-2.5", children: [
|
|
137
|
-
/* @__PURE__ */ jsx(IconTicket, { className: "size-5 shrink-0 text-cyan-600" }),
|
|
138
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
139
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-zinc-400", children: COPY.couponLabel }),
|
|
140
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-zinc-950", children: combo.coupon })
|
|
141
|
-
] }),
|
|
142
|
-
/* @__PURE__ */ jsx(
|
|
143
|
-
"button",
|
|
144
|
-
{
|
|
145
|
-
type: "button",
|
|
146
|
-
"aria-label": COPY.couponLabel,
|
|
147
|
-
onClick: () => copy(combo.coupon),
|
|
148
|
-
className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-cyan-100 hover:text-zinc-950",
|
|
149
|
-
children: isCopied ? /* @__PURE__ */ jsx(IconCheck, { className: "size-[18px]" }) : /* @__PURE__ */ jsx(IconCopy, { className: "size-[18px]" })
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
] }),
|
|
153
|
-
/* @__PURE__ */ jsx("div", { className: "mx-3 mt-3", children: /* @__PURE__ */ jsx(
|
|
154
|
-
Button,
|
|
155
|
-
{
|
|
156
|
-
variant: combo.highlighted ? "default" : "secondary",
|
|
157
|
-
className: cn("h-11! w-full", combo.highlighted && "bg-cyan-500 text-white hover:bg-cyan-600"),
|
|
158
|
-
onClick: onChoose,
|
|
159
|
-
children: COPY.choosePlan
|
|
160
|
-
}
|
|
161
|
-
) })
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
export {
|
|
167
|
-
HexaPromoModal as default
|
|
168
|
-
};
|
|
169
|
-
//# sourceMappingURL=HexaPromoModal.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modals/HexaPromoModal.tsx"],"sourcesContent":["'use client';\n\nimport { toast } from 'sonner';\nimport {\n IconCheck,\n IconCopy,\n IconInfoCircle,\n IconStar,\n IconTicket,\n IconX,\n} from '@tabler/icons-react';\nimport { Dialog, DialogClose, DialogContent, DialogTitle } from '../ui/overlay/Dialog';\nimport { Toast } from '../ui/feedback/Toast';\nimport { Button } from '../ui/buttons/Button';\nimport useCopyToClipboard from '../../hooks/copy-to-clipboard.hook';\nimport { useModalManager } from '../../store/useModalManager';\nimport { useWhitelabelUrls } from '../../providers/whitelabel.provider';\nimport { cn } from '../../infra/utils/clsx';\n\ntype ComboPeriod = 'monthly' | 'semiannual' | 'annual';\n\ninterface HexaCombo {\n coupon: string;\n name: string;\n features: string[];\n highlighted: boolean;\n period: ComboPeriod;\n}\n\n// Campanha \"Rumo ao Hexa\" — exclusiva da whitelabel 1 (público pt-br). O texto é fixo de\n// propósito: a modal precisa renderizar também no gapps, que não tem provider de next-intl.\nconst COPY = {\n title: 'Rumo ao Hexa!',\n subtitlePrefix: 'Ofertas exclusivas até ',\n subtitleDate: '24/06',\n mostChosen: 'Mais escolhido',\n couponLabel: 'Cupom',\n choosePlan: 'Escolher plano',\n couponCopied: 'Cupom copiado!',\n close: 'Fechar',\n footerPrefix: 'Válido para a ',\n footerBold: 'primeira contratação',\n footerSuffix: ' dos planos Essencial, Negócio ou Agência',\n};\n\nconst COMBOS: HexaCombo[] = [\n {\n coupon: 'MENSAL10',\n name: 'Combo convocação',\n highlighted: false,\n period: 'monthly',\n features: ['10% OFF no plano mensal', 'Webinars exclusivos'],\n },\n {\n coupon: 'SEMESTRAL10',\n name: 'Combo Hexa',\n highlighted: true,\n period: 'semiannual',\n features: ['10% OFF no plano semestral', '3 templates exclusivos', 'Webinars exclusivos'],\n },\n {\n coupon: 'ANUAL10',\n name: 'Combo escalação',\n highlighted: false,\n period: 'annual',\n features: ['10% OFF no plano anual', '3 templates exclusivos'],\n },\n];\n\n// Cores promocionais (verde/amarelo do Brasil) — específicas desta campanha, fora do design\n// system, por isso ficam hardcoded apenas aqui.\nconst GRADIENT = 'linear-gradient(180deg, #08c44f 0%, #7bd237 46.6%, #ffe31b 100%)';\n\nexport default function HexaPromoModal() {\n const { activeModal, closeModal } = useModalManager();\n const { accountsUrl } = useWhitelabelUrls();\n const isOpen = activeModal === 'hexaPromoModal';\n\n const goToPlans = (coupon: string, period: ComboPeriod) => {\n closeModal();\n const url = `${accountsUrl}/subscriptions?tab=plans&coupon=${encodeURIComponent(coupon)}&period=${encodeURIComponent(period)}`;\n window.location.assign(url);\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={() => closeModal()}>\n <DialogContent\n showCloseButton={false}\n onOpenAutoFocus={(e) => e.preventDefault()}\n className=\"border-0 bg-transparent p-0 shadow-none w-[calc(100%-32px)] sm:max-w-[940px] md:w-[924px] lg:w-[924px] max-h-[calc(100dvh-32px)] overflow-y-auto\"\n >\n <DialogTitle className=\"sr-only\">{COPY.title}</DialogTitle>\n\n <div className=\"rounded-[12px] p-1\" style={{ background: GRADIENT }}>\n <div className=\"relative overflow-hidden rounded-[10px] bg-white p-8 shadow-[0px_2px_10px_0px_rgba(26,26,26,0.05)]\">\n {/* Arte decorativa (festão/bandeira) no canto superior direito */}\n <img\n src=\"/promo/hexa-confetti.png\"\n alt=\"\"\n aria-hidden\n className=\"pointer-events-none absolute -top-10 right-0 w-[280px] rotate-[16deg] select-none\"\n />\n\n <DialogClose className=\"absolute right-3 top-3 z-10 flex size-[34px] cursor-pointer items-center justify-center rounded-lg bg-white p-2 text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-950 focus:outline-none\">\n <span className=\"sr-only\">{COPY.close}</span>\n <IconX className=\"size-[18px]\" />\n </DialogClose>\n\n {/* Header: logo + bandeira */}\n <div className=\"relative z-[1] flex w-fit items-center gap-[9px] rounded-lg bg-zinc-100 px-[9px] py-2\">\n <img src=\"/promo/hexa-logo.svg\" alt=\"\" aria-hidden className=\"size-6 select-none\" />\n <img src=\"/promo/hexa-flag.png\" alt=\"\" aria-hidden className=\"size-6 rounded select-none\" />\n </div>\n\n {/* Título */}\n <div className=\"relative z-[1] mt-4 flex flex-col gap-1\">\n <h2 className=\"font-['Outfit'] text-[32px] font-semibold leading-8 text-zinc-950\">\n {COPY.title}\n </h2>\n <p className=\"paragraph-medium-medium text-zinc-950\">\n {COPY.subtitlePrefix}\n <span className=\"font-bold\">{COPY.subtitleDate}</span>\n </p>\n </div>\n\n {/* Cards */}\n <div className=\"relative z-[1] mt-10 flex flex-col items-stretch gap-3 md:flex-row\">\n {COMBOS.map((combo) => (\n <ComboCard key={combo.coupon} combo={combo} onChoose={() => goToPlans(combo.coupon, combo.period)} />\n ))}\n </div>\n\n {/* Rodapé informativo */}\n <div className=\"relative z-[1] mt-3 flex items-center justify-center gap-2.5 rounded-[10px] bg-zinc-100 p-3 text-center\">\n <IconInfoCircle className=\"size-4 shrink-0 text-zinc-950\" />\n <p className=\"paragraph-small-medium text-zinc-950\">\n {COPY.footerPrefix}\n <span className=\"font-semibold\">{COPY.footerBold}</span>\n {COPY.footerSuffix}\n </p>\n </div>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n\ninterface ComboCardProps {\n combo: HexaCombo;\n onChoose: () => void;\n}\n\nfunction ComboCard({ combo, onChoose }: ComboCardProps) {\n const { isCopied, copy } = useCopyToClipboard({\n onSuccess: () => {\n toast.custom((t) => <Toast variant=\"success\" message={COPY.couponCopied} toastId={t} />);\n },\n });\n\n return (\n <div\n className={cn(\n 'relative flex flex-1 flex-col rounded-[10px] border bg-white pb-3 md:w-[276px]',\n combo.highlighted ? 'border-cyan-500' : 'border-zinc-200',\n )}\n >\n {combo.highlighted && (\n <div className=\"absolute left-1/2 top-0 z-[1] flex h-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center gap-[5px] rounded-md border-4 border-white bg-cyan-100 px-2\">\n <IconStar className=\"size-3 text-cyan-600\" />\n <span className=\"paragraph-xsmall-semibold whitespace-nowrap text-cyan-600\">\n {COPY.mostChosen}\n </span>\n <IconStar className=\"size-3 text-cyan-600\" />\n </div>\n )}\n\n <h3 className=\"border-b border-zinc-200 px-4 py-4 text-center font-['Outfit'] text-base font-semibold text-zinc-950\">\n {combo.name}\n </h3>\n\n <ul className=\"flex flex-1 flex-col gap-5 px-5 pt-5\">\n {combo.features.map((feature) => (\n <li key={feature} className=\"flex items-center gap-2.5\">\n <IconCheck className=\"size-5 shrink-0 text-cyan-500\" />\n <span className=\"paragraph-small-medium text-zinc-950\">{feature}</span>\n </li>\n ))}\n </ul>\n\n <div className=\"mx-3 mt-5 flex items-center gap-3 rounded-lg bg-cyan-50 py-2 pl-3.5 pr-2.5\">\n <IconTicket className=\"size-5 shrink-0 text-cyan-600\" />\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"paragraph-xsmall-medium text-zinc-400\">{COPY.couponLabel}</span>\n <span className=\"paragraph-small-semibold text-zinc-950\">{combo.coupon}</span>\n </div>\n <button\n type=\"button\"\n aria-label={COPY.couponLabel}\n onClick={() => copy(combo.coupon)}\n className=\"flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-cyan-100 hover:text-zinc-950\"\n >\n {isCopied ? <IconCheck className=\"size-[18px]\" /> : <IconCopy className=\"size-[18px]\" />}\n </button>\n </div>\n\n <div className=\"mx-3 mt-3\">\n <Button\n variant={combo.highlighted ? 'default' : 'secondary'}\n className={cn('h-11! w-full', combo.highlighted && 'bg-cyan-500 text-white hover:bg-cyan-600')}\n onClick={onChoose}\n >\n {COPY.choosePlan}\n </Button>\n </div>\n </div>\n );\n}\n"],"mappings":";AA2FQ,cAYI,YAZJ;AAzFR,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,E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C,WAAU;AAAA,cAET,qBAAW,oBAAC,aAAU,WAAU,eAAc,IAAK,oBAAC,YAAS,WAAU,eAAc;AAAA;AAAA,UACxF;AAAA,WACF;AAAA,QAEA,oBAAC,SAAI,WAAU,aACb;AAAA,UAAC;AAAA;AAAA,YACC,SAAS,MAAM,cAAc,YAAY;AAAA,YACzC,WAAW,GAAG,gBAAgB,MAAM,eAAe,0CAA0C;AAAA,YAC7F,SAAS;AAAA,YAER,eAAK;AAAA;AAAA,QACR,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import { useActiveSubscription } from "../../modules/subscriptions/hooks/find-active-subscription.hook";
|
|
4
|
-
import { useAuth } from "../../providers/auth.provider";
|
|
5
|
-
import { useWhitelabel } from "../../providers/whitelabel.provider";
|
|
6
|
-
import { useModalManager } from "../../store/useModalManager";
|
|
7
|
-
import {
|
|
8
|
-
getHexaPromoSeenDay,
|
|
9
|
-
getHexaPromoSince,
|
|
10
|
-
hexaPromoDayKey,
|
|
11
|
-
setHexaPromoSeenDay,
|
|
12
|
-
setHexaPromoSince
|
|
13
|
-
} from "../../utils/cookies/hexa-promo";
|
|
14
|
-
const ONLINE_DELAY_MS = 3 * 60 * 1e3;
|
|
15
|
-
const FORCE_OPEN_FOR_TEST = false;
|
|
16
|
-
function HexaPromoModalGate() {
|
|
17
|
-
const { isAuthenticated } = useAuth();
|
|
18
|
-
const { whitelabel } = useWhitelabel();
|
|
19
|
-
const { activeModal, openModal, closeModal } = useModalManager();
|
|
20
|
-
const { data } = useActiveSubscription();
|
|
21
|
-
const subscription = data?.data?.[0] ?? null;
|
|
22
|
-
const eligible = isAuthenticated && whitelabel?.id === 1 && subscription?.type === "trial";
|
|
23
|
-
const eligibleRef = useRef(eligible);
|
|
24
|
-
eligibleRef.current = eligible;
|
|
25
|
-
const forcedRef = useRef(false);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (FORCE_OPEN_FOR_TEST) return;
|
|
28
|
-
if (!eligible && activeModal === "hexaPromoModal") closeModal();
|
|
29
|
-
}, [eligible, activeModal, closeModal]);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (typeof window === "undefined") return;
|
|
32
|
-
if (FORCE_OPEN_FOR_TEST) {
|
|
33
|
-
if (forcedRef.current || activeModal) return;
|
|
34
|
-
forcedRef.current = true;
|
|
35
|
-
openModal("hexaPromoModal");
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (!eligible) return;
|
|
39
|
-
if (activeModal) return;
|
|
40
|
-
const todayKey = hexaPromoDayKey();
|
|
41
|
-
if (getHexaPromoSeenDay() === todayKey) return;
|
|
42
|
-
let since = getHexaPromoSince();
|
|
43
|
-
if (!since || since.day !== todayKey) {
|
|
44
|
-
since = { day: todayKey, ms: Date.now() };
|
|
45
|
-
setHexaPromoSince(since.day, since.ms);
|
|
46
|
-
}
|
|
47
|
-
const remaining = Math.max(0, since.ms + ONLINE_DELAY_MS - Date.now());
|
|
48
|
-
const timer = setTimeout(() => {
|
|
49
|
-
if (!eligibleRef.current) return;
|
|
50
|
-
if (getHexaPromoSeenDay() === todayKey) return;
|
|
51
|
-
setHexaPromoSeenDay(todayKey);
|
|
52
|
-
openModal("hexaPromoModal");
|
|
53
|
-
}, remaining);
|
|
54
|
-
return () => clearTimeout(timer);
|
|
55
|
-
}, [eligible, activeModal, openModal]);
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
HexaPromoModalGate as default
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=HexaPromoModalGate.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modals/HexaPromoModalGate.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { useAuth } from '../../providers/auth.provider';\nimport { useWhitelabel } from '../../providers/whitelabel.provider';\nimport { useModalManager } from '../../store/useModalManager';\nimport {\n getHexaPromoSeenDay,\n getHexaPromoSince,\n hexaPromoDayKey,\n setHexaPromoSeenDay,\n setHexaPromoSince,\n} from '../../utils/cookies/hexa-promo';\n\n/** Janela de tempo online antes de abrir a modal (3 minutos). */\nconst ONLINE_DELAY_MS = 3 * 60 * 1000;\n\n/**\n * TESTE: quando `true`, a modal abre imediatamente ao carregar o app, ignorando\n * trial / whitelabel / timer de 3 min / cookies. Manter `false` em produção.\n */\nconst FORCE_OPEN_FOR_TEST = false;\n\n/**\n * Dispara a modal \"Rumo ao Hexa\" quando um usuário em **trial** da **whitelabel 1** fica\n * 3 minutos online. A janela é cumulativa entre gapps e gpages (timestamp compartilhado em\n * cookie no domínio pai) e a modal abre **uma única vez** — reabrindo só no dia seguinte ou\n * após logout/login. Montar este componente uma vez no layout de cada app consumidor.\n */\nexport default function HexaPromoModalGate() {\n const { isAuthenticated } = useAuth();\n const { whitelabel } = useWhitelabel();\n const { activeModal, openModal, closeModal } = useModalManager();\n const { data } = useActiveSubscription();\n\n const subscription = data?.data?.[0] ?? null;\n const eligible =\n isAuthenticated && whitelabel?.id === 1 && subscription?.type === 'trial';\n\n // Elegibilidade atual visível dentro do setTimeout (que captura o valor do agendamento).\n const eligibleRef = useRef(eligible);\n eligibleRef.current = eligible;\n\n const forcedRef = useRef(false);\n\n // Nunca deixa a modal aberta para usuário deslogado/inelegível: se ele abriu logado e\n // depois deslogou (ou perdeu a elegibilidade), fecha.\n useEffect(() => {\n if (FORCE_OPEN_FOR_TEST) return;\n if (!eligible && activeModal === 'hexaPromoModal') closeModal();\n }, [eligible, activeModal, closeModal]);\n\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n // TESTE: abre uma vez ao carregar, sem nenhuma condição.\n if (FORCE_OPEN_FOR_TEST) {\n if (forcedRef.current || activeModal) return;\n forcedRef.current = true;\n openModal('hexaPromoModal');\n return;\n }\n\n if (!eligible) return;\n // Outra modal aberta: não empilha em cima. Reavalia quando ela fechar (dep `activeModal`).\n if (activeModal) return;\n\n const todayKey = hexaPromoDayKey();\n if (getHexaPromoSeenDay() === todayKey) return; // já exibida hoje/nesta sessão\n\n // Início da janela compartilhado entre os apps; reinicia a cada novo dia.\n let since = getHexaPromoSince();\n if (!since || since.day !== todayKey) {\n since = { day: todayKey, ms: Date.now() };\n setHexaPromoSince(since.day, since.ms);\n }\n\n const remaining = Math.max(0, since.ms + ONLINE_DELAY_MS - Date.now());\n const timer = setTimeout(() => {\n // Revalida no disparo: o usuário pode ter deslogado durante a janela.\n if (!eligibleRef.current) return;\n // Recheca o cookie no disparo: se o outro app já abriu, não reabre aqui.\n if (getHexaPromoSeenDay() === todayKey) return;\n setHexaPromoSeenDay(todayKey);\n openModal('hexaPromoModal');\n }, remaining);\n\n return () => clearTimeout(timer);\n }, [eligible, activeModal, openModal]);\n\n return null;\n}\n"],"mappings":";AAEA,SAAS,WAAW,cAAc;AAClC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,MAAM,kBAAkB,IAAI,KAAK;AAMjC,MAAM,sBAAsB;AAQb,SAAR,qBAAsC;AAC3C,QAAM,EAAE,gBAAgB,IAAI,QAAQ;AACpC,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAC/D,QAAM,EAAE,KAAK,IAAI,sBAAsB;AAEvC,QAAM,eAAe,MAAM,OAAO,CAAC,KAAK;AACxC,QAAM,WACJ,mBAAmB,YAAY,OAAO,KAAK,cAAc,SAAS;AAGpE,QAAM,cAAc,OAAO,QAAQ;AACnC,cAAY,UAAU;AAEtB,QAAM,YAAY,OAAO,KAAK;AAI9B,YAAU,MAAM;AACd,QAAI,oBAAqB;AACzB,QAAI,CAAC,YAAY,gBAAgB,iBAAkB,YAAW;AAAA,EAChE,GAAG,CAAC,UAAU,aAAa,UAAU,CAAC;AAEtC,YAAU,MAAM;AACd,QAAI,OAAO,WAAW,YAAa;AAGnC,QAAI,qBAAqB;AACvB,UAAI,UAAU,WAAW,YAAa;AACtC,gBAAU,UAAU;AACpB,gBAAU,gBAAgB;AAC1B;AAAA,IACF;AAEA,QAAI,CAAC,SAAU;AAEf,QAAI,YAAa;AAEjB,UAAM,WAAW,gBAAgB;AACjC,QAAI,oBAAoB,MAAM,SAAU;AAGxC,QAAI,QAAQ,kBAAkB;AAC9B,QAAI,CAAC,SAAS,MAAM,QAAQ,UAAU;AACpC,cAAQ,EAAE,KAAK,UAAU,IAAI,KAAK,IAAI,EAAE;AACxC,wBAAkB,MAAM,KAAK,MAAM,EAAE;AAAA,IACvC;AAEA,UAAM,YAAY,KAAK,IAAI,GAAG,MAAM,KAAK,kBAAkB,KAAK,IAAI,CAAC;AACrE,UAAM,QAAQ,WAAW,MAAM;AAE7B,UAAI,CAAC,YAAY,QAAS;AAE1B,UAAI,oBAAoB,MAAM,SAAU;AACxC,0BAAoB,QAAQ;AAC5B,gBAAU,gBAAgB;AAAA,IAC5B,GAAG,SAAS;AAEZ,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,UAAU,aAAa,SAAS,CAAC;AAErC,SAAO;AACT;","names":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useModalManager } from "./useModalManager";
|
|
2
|
-
const HEXA_PROMO_MODAL_KEY = "hexaPromoModal";
|
|
3
|
-
const useHexaPromoModal = () => {
|
|
4
|
-
const { activeModal, openModal, closeModal } = useModalManager();
|
|
5
|
-
return {
|
|
6
|
-
open: activeModal === HEXA_PROMO_MODAL_KEY,
|
|
7
|
-
openModal: () => openModal(HEXA_PROMO_MODAL_KEY),
|
|
8
|
-
closeModal
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
useHexaPromoModal
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=useHexaPromoModal.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/useHexaPromoModal.ts"],"sourcesContent":["import { useModalManager } from './useModalManager';\n\nconst HEXA_PROMO_MODAL_KEY = 'hexaPromoModal';\n\nexport const useHexaPromoModal = () => {\n const { activeModal, openModal, closeModal } = useModalManager();\n\n return {\n open: activeModal === HEXA_PROMO_MODAL_KEY,\n openModal: () => openModal(HEXA_PROMO_MODAL_KEY),\n closeModal,\n };\n};\n"],"mappings":"AAAA,SAAS,uBAAuB;AAEhC,MAAM,uBAAuB;AAEtB,MAAM,oBAAoB,MAAM;AACrC,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAE/D,SAAO;AAAA,IACL,MAAM,gBAAgB;AAAA,IACtB,WAAW,MAAM,UAAU,oBAAoB;AAAA,IAC/C;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
const SINCE_COOKIE = "gpromo-hexa-since";
|
|
2
|
-
const SEEN_COOKIE = "gpromo-hexa-seen";
|
|
3
|
-
const MAX_AGE_SECONDS = 60 * 60 * 24 * 2;
|
|
4
|
-
function parentCookieDomain() {
|
|
5
|
-
if (typeof window === "undefined") return void 0;
|
|
6
|
-
const host = window.location.hostname;
|
|
7
|
-
if (!host || host === "localhost") return void 0;
|
|
8
|
-
if (/^\d+\.\d+\.\d+\.\d+$/.test(host)) return void 0;
|
|
9
|
-
const parts = host.split(".");
|
|
10
|
-
if (parts.length < 2) return void 0;
|
|
11
|
-
return "." + parts.slice(1).join(".");
|
|
12
|
-
}
|
|
13
|
-
function readCookie(name) {
|
|
14
|
-
if (typeof document === "undefined") return null;
|
|
15
|
-
const m = document.cookie.match(new RegExp(`(?:^|;\\s*)${name}=([^;]+)`));
|
|
16
|
-
if (!m) return null;
|
|
17
|
-
try {
|
|
18
|
-
return decodeURIComponent(m[1]);
|
|
19
|
-
} catch {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function writeCookie(name, value) {
|
|
24
|
-
if (typeof document === "undefined" || typeof window === "undefined") return;
|
|
25
|
-
const domain = parentCookieDomain();
|
|
26
|
-
const parts = [
|
|
27
|
-
`${name}=${encodeURIComponent(value)}`,
|
|
28
|
-
"Path=/",
|
|
29
|
-
`Max-Age=${MAX_AGE_SECONDS}`,
|
|
30
|
-
"SameSite=Lax",
|
|
31
|
-
domain ? `Domain=${domain}` : "",
|
|
32
|
-
window.location.protocol === "https:" ? "Secure" : ""
|
|
33
|
-
].filter(Boolean);
|
|
34
|
-
try {
|
|
35
|
-
document.cookie = parts.join("; ");
|
|
36
|
-
} catch {
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function expireCookie(name) {
|
|
40
|
-
if (typeof document === "undefined" || typeof window === "undefined") return;
|
|
41
|
-
const domain = parentCookieDomain();
|
|
42
|
-
const parts = [
|
|
43
|
-
`${name}=`,
|
|
44
|
-
"Path=/",
|
|
45
|
-
"Max-Age=0",
|
|
46
|
-
"SameSite=Lax",
|
|
47
|
-
domain ? `Domain=${domain}` : "",
|
|
48
|
-
window.location.protocol === "https:" ? "Secure" : ""
|
|
49
|
-
].filter(Boolean);
|
|
50
|
-
try {
|
|
51
|
-
document.cookie = parts.join("; ");
|
|
52
|
-
} catch {
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function hexaPromoDayKey() {
|
|
56
|
-
const d = /* @__PURE__ */ new Date();
|
|
57
|
-
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
58
|
-
}
|
|
59
|
-
function getHexaPromoSeenDay() {
|
|
60
|
-
return readCookie(SEEN_COOKIE);
|
|
61
|
-
}
|
|
62
|
-
function setHexaPromoSeenDay(day) {
|
|
63
|
-
writeCookie(SEEN_COOKIE, day);
|
|
64
|
-
}
|
|
65
|
-
function getHexaPromoSince() {
|
|
66
|
-
const raw = readCookie(SINCE_COOKIE);
|
|
67
|
-
if (!raw) return null;
|
|
68
|
-
const [day, msRaw] = raw.split("|");
|
|
69
|
-
const ms = Number(msRaw);
|
|
70
|
-
if (!day || !Number.isFinite(ms)) return null;
|
|
71
|
-
return { day, ms };
|
|
72
|
-
}
|
|
73
|
-
function setHexaPromoSince(day, ms) {
|
|
74
|
-
writeCookie(SINCE_COOKIE, `${day}|${ms}`);
|
|
75
|
-
}
|
|
76
|
-
function clearHexaPromo() {
|
|
77
|
-
expireCookie(SINCE_COOKIE);
|
|
78
|
-
expireCookie(SEEN_COOKIE);
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
clearHexaPromo,
|
|
82
|
-
getHexaPromoSeenDay,
|
|
83
|
-
getHexaPromoSince,
|
|
84
|
-
hexaPromoDayKey,
|
|
85
|
-
setHexaPromoSeenDay,
|
|
86
|
-
setHexaPromoSince
|
|
87
|
-
};
|
|
88
|
-
//# sourceMappingURL=hexa-promo.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/cookies/hexa-promo.ts"],"sourcesContent":["/**\n * Estado do \"Rumo ao Hexa\" promo modal — persistido em **cookies no domínio registrável\n * pai** (ex.: `accounts.greatpages.dev.br` → `.greatpages.dev.br`) para serem compartilhados\n * entre os subdomínios dos apps (accounts/gapps ↔ pages/gpages). Assim a janela de \"3 minutos\n * online\" é cumulativa entre os apps e a modal abre **uma única vez** por sessão/dia,\n * independente de em qual app o usuário esteja.\n *\n * São dois cookies:\n * - `gpromo-hexa-since` = `<dia>|<timestampMs>` — início da janela de 3 min (gravado uma vez).\n * - `gpromo-hexa-seen` = `<dia>` — dia em que a modal já foi exibida.\n *\n * `<dia>` é a data local `YYYY-MM-DD`: vira automaticamente no dia seguinte, fazendo a modal\n * reaparecer. No logout, ambos os cookies são limpos (ver `auth.provider`), então um novo\n * login também faz a modal reaparecer.\n *\n * Em localhost (sem subdomínio) caem em cookies host-scoped — equivalente ao localStorage;\n * cross-port não compartilha (limitação aceita no dev local).\n */\n\nconst SINCE_COOKIE = 'gpromo-hexa-since';\nconst SEEN_COOKIE = 'gpromo-hexa-seen';\nconst MAX_AGE_SECONDS = 60 * 60 * 24 * 2; // 2 dias — folga sobre a janela de 1 dia.\n\nfunction parentCookieDomain(): string | undefined {\n if (typeof window === 'undefined') return undefined;\n const host = window.location.hostname;\n if (!host || host === 'localhost') return undefined;\n // IP literal → sem atributo Domain (cookie host-scoped)\n if (/^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(host)) return undefined;\n const parts = host.split('.');\n if (parts.length < 2) return undefined;\n // Tira o subdomínio mais à esquerda — `accounts.greatpages.dev.br` → `.greatpages.dev.br`\n return '.' + parts.slice(1).join('.');\n}\n\nfunction readCookie(name: string): string | null {\n if (typeof document === 'undefined') return null;\n const m = document.cookie.match(new RegExp(`(?:^|;\\\\s*)${name}=([^;]+)`));\n if (!m) return null;\n try {\n return decodeURIComponent(m[1]);\n } catch {\n return null;\n }\n}\n\nfunction writeCookie(name: string, value: string): void {\n if (typeof document === 'undefined' || typeof window === 'undefined') return;\n const domain = parentCookieDomain();\n const parts = [\n `${name}=${encodeURIComponent(value)}`,\n 'Path=/',\n `Max-Age=${MAX_AGE_SECONDS}`,\n 'SameSite=Lax',\n domain ? `Domain=${domain}` : '',\n window.location.protocol === 'https:' ? 'Secure' : '',\n ].filter(Boolean);\n try {\n document.cookie = parts.join('; ');\n } catch {\n // Se o navegador bloquear cookies, seguimos com a exibição única por sessão (timer no Gate).\n }\n}\n\nfunction expireCookie(name: string): void {\n if (typeof document === 'undefined' || typeof window === 'undefined') return;\n const domain = parentCookieDomain();\n const parts = [\n `${name}=`,\n 'Path=/',\n 'Max-Age=0',\n 'SameSite=Lax',\n domain ? `Domain=${domain}` : '',\n window.location.protocol === 'https:' ? 'Secure' : '',\n ].filter(Boolean);\n try {\n document.cookie = parts.join('; ');\n } catch {\n // noop\n }\n}\n\n/** Chave do dia local (`YYYY-MM-DD`) usada para reabrir a modal a cada novo dia. */\nexport function hexaPromoDayKey(): string {\n const d = new Date();\n return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;\n}\n\nexport function getHexaPromoSeenDay(): string | null {\n return readCookie(SEEN_COOKIE);\n}\n\nexport function setHexaPromoSeenDay(day: string): void {\n writeCookie(SEEN_COOKIE, day);\n}\n\nexport function getHexaPromoSince(): { day: string; ms: number } | null {\n const raw = readCookie(SINCE_COOKIE);\n if (!raw) return null;\n const [day, msRaw] = raw.split('|');\n const ms = Number(msRaw);\n if (!day || !Number.isFinite(ms)) return null;\n return { day, ms };\n}\n\nexport function setHexaPromoSince(day: string, ms: number): void {\n writeCookie(SINCE_COOKIE, `${day}|${ms}`);\n}\n\n/** Limpa o estado da promo (chamado no logout para reabrir a modal no próximo login). */\nexport function clearHexaPromo(): void {\n expireCookie(SINCE_COOKIE);\n expireCookie(SEEN_COOKIE);\n}\n"],"mappings":"AAmBA,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,kBAAkB,KAAK,KAAK,KAAK;AAEvC,SAAS,qBAAyC;AAChD,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,OAAO,OAAO,SAAS;AAC7B,MAAI,CAAC,QAAQ,SAAS,YAAa,QAAO;AAE1C,MAAI,uBAAuB,KAAK,IAAI,EAAG,QAAO;AAC9C,QAAM,QAAQ,KAAK,MAAM,GAAG;AAC5B,MAAI,MAAM,SAAS,EAAG,QAAO;AAE7B,SAAO,MAAM,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG;AACtC;AAEA,SAAS,WAAW,MAA6B;AAC/C,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAM,IAAI,SAAS,OAAO,MAAM,IAAI,OAAO,cAAc,IAAI,UAAU,CAAC;AACxE,MAAI,CA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,oBAAwD;AACtE,QAAM,MAAM,WAAW,YAAY;AACnC,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,CAAC,KAAK,KAAK,IAAI,IAAI,MAAM,GAAG;AAClC,QAAM,KAAK,OAAO,KAAK;AACvB,MAAI,CAAC,OAAO,CAAC,OAAO,SAAS,EAAE,EAAG,QAAO;AACzC,SAAO,EAAE,KAAK,GAAG;AACnB;AAEO,SAAS,kBAAkB,KAAa,IAAkB;AAC/D,cAAY,cAAc,GAAG,GAAG,IAAI,EAAE,EAAE;AAC1C;AAGO,SAAS,iBAAuB;AACrC,eAAa,YAAY;AACzB,eAAa,WAAW;AAC1B;","names":[]}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { toast } from 'sonner';
|
|
4
|
-
import {
|
|
5
|
-
IconCheck,
|
|
6
|
-
IconCopy,
|
|
7
|
-
IconInfoCircle,
|
|
8
|
-
IconStar,
|
|
9
|
-
IconTicket,
|
|
10
|
-
IconX,
|
|
11
|
-
} from '@tabler/icons-react';
|
|
12
|
-
import { Dialog, DialogClose, DialogContent, DialogTitle } from '../ui/overlay/Dialog';
|
|
13
|
-
import { Toast } from '../ui/feedback/Toast';
|
|
14
|
-
import { Button } from '../ui/buttons/Button';
|
|
15
|
-
import useCopyToClipboard from '../../hooks/copy-to-clipboard.hook';
|
|
16
|
-
import { useModalManager } from '../../store/useModalManager';
|
|
17
|
-
import { useWhitelabelUrls } from '../../providers/whitelabel.provider';
|
|
18
|
-
import { cn } from '../../infra/utils/clsx';
|
|
19
|
-
|
|
20
|
-
type ComboPeriod = 'monthly' | 'semiannual' | 'annual';
|
|
21
|
-
|
|
22
|
-
interface HexaCombo {
|
|
23
|
-
coupon: string;
|
|
24
|
-
name: string;
|
|
25
|
-
features: string[];
|
|
26
|
-
highlighted: boolean;
|
|
27
|
-
period: ComboPeriod;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Campanha "Rumo ao Hexa" — exclusiva da whitelabel 1 (público pt-br). O texto é fixo de
|
|
31
|
-
// propósito: a modal precisa renderizar também no gapps, que não tem provider de next-intl.
|
|
32
|
-
const COPY = {
|
|
33
|
-
title: 'Rumo ao Hexa!',
|
|
34
|
-
subtitlePrefix: 'Ofertas exclusivas até ',
|
|
35
|
-
subtitleDate: '24/06',
|
|
36
|
-
mostChosen: 'Mais escolhido',
|
|
37
|
-
couponLabel: 'Cupom',
|
|
38
|
-
choosePlan: 'Escolher plano',
|
|
39
|
-
couponCopied: 'Cupom copiado!',
|
|
40
|
-
close: 'Fechar',
|
|
41
|
-
footerPrefix: 'Válido para a ',
|
|
42
|
-
footerBold: 'primeira contratação',
|
|
43
|
-
footerSuffix: ' dos planos Essencial, Negócio ou Agência',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const COMBOS: HexaCombo[] = [
|
|
47
|
-
{
|
|
48
|
-
coupon: 'MENSAL10',
|
|
49
|
-
name: 'Combo convocação',
|
|
50
|
-
highlighted: false,
|
|
51
|
-
period: 'monthly',
|
|
52
|
-
features: ['10% OFF no plano mensal', 'Webinars exclusivos'],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
coupon: 'SEMESTRAL10',
|
|
56
|
-
name: 'Combo Hexa',
|
|
57
|
-
highlighted: true,
|
|
58
|
-
period: 'semiannual',
|
|
59
|
-
features: ['10% OFF no plano semestral', '3 templates exclusivos', 'Webinars exclusivos'],
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
coupon: 'ANUAL10',
|
|
63
|
-
name: 'Combo escalação',
|
|
64
|
-
highlighted: false,
|
|
65
|
-
period: 'annual',
|
|
66
|
-
features: ['10% OFF no plano anual', '3 templates exclusivos'],
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
// Cores promocionais (verde/amarelo do Brasil) — específicas desta campanha, fora do design
|
|
71
|
-
// system, por isso ficam hardcoded apenas aqui.
|
|
72
|
-
const GRADIENT = 'linear-gradient(180deg, #08c44f 0%, #7bd237 46.6%, #ffe31b 100%)';
|
|
73
|
-
|
|
74
|
-
export default function HexaPromoModal() {
|
|
75
|
-
const { activeModal, closeModal } = useModalManager();
|
|
76
|
-
const { accountsUrl } = useWhitelabelUrls();
|
|
77
|
-
const isOpen = activeModal === 'hexaPromoModal';
|
|
78
|
-
|
|
79
|
-
const goToPlans = (coupon: string, period: ComboPeriod) => {
|
|
80
|
-
closeModal();
|
|
81
|
-
const url = `${accountsUrl}/subscriptions?tab=plans&coupon=${encodeURIComponent(coupon)}&period=${encodeURIComponent(period)}`;
|
|
82
|
-
window.location.assign(url);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<Dialog open={isOpen} onOpenChange={() => closeModal()}>
|
|
87
|
-
<DialogContent
|
|
88
|
-
showCloseButton={false}
|
|
89
|
-
onOpenAutoFocus={(e) => e.preventDefault()}
|
|
90
|
-
className="border-0 bg-transparent p-0 shadow-none w-[calc(100%-32px)] sm:max-w-[940px] md:w-[924px] lg:w-[924px] max-h-[calc(100dvh-32px)] overflow-y-auto"
|
|
91
|
-
>
|
|
92
|
-
<DialogTitle className="sr-only">{COPY.title}</DialogTitle>
|
|
93
|
-
|
|
94
|
-
<div className="rounded-[12px] p-1" style={{ background: GRADIENT }}>
|
|
95
|
-
<div className="relative overflow-hidden rounded-[10px] bg-white p-8 shadow-[0px_2px_10px_0px_rgba(26,26,26,0.05)]">
|
|
96
|
-
{/* Arte decorativa (festão/bandeira) no canto superior direito */}
|
|
97
|
-
<img
|
|
98
|
-
src="/promo/hexa-confetti.png"
|
|
99
|
-
alt=""
|
|
100
|
-
aria-hidden
|
|
101
|
-
className="pointer-events-none absolute -top-10 right-0 w-[280px] rotate-[16deg] select-none"
|
|
102
|
-
/>
|
|
103
|
-
|
|
104
|
-
<DialogClose className="absolute right-3 top-3 z-10 flex size-[34px] cursor-pointer items-center justify-center rounded-lg bg-white p-2 text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-950 focus:outline-none">
|
|
105
|
-
<span className="sr-only">{COPY.close}</span>
|
|
106
|
-
<IconX className="size-[18px]" />
|
|
107
|
-
</DialogClose>
|
|
108
|
-
|
|
109
|
-
{/* Header: logo + bandeira */}
|
|
110
|
-
<div className="relative z-[1] flex w-fit items-center gap-[9px] rounded-lg bg-zinc-100 px-[9px] py-2">
|
|
111
|
-
<img src="/promo/hexa-logo.svg" alt="" aria-hidden className="size-6 select-none" />
|
|
112
|
-
<img src="/promo/hexa-flag.png" alt="" aria-hidden className="size-6 rounded select-none" />
|
|
113
|
-
</div>
|
|
114
|
-
|
|
115
|
-
{/* Título */}
|
|
116
|
-
<div className="relative z-[1] mt-4 flex flex-col gap-1">
|
|
117
|
-
<h2 className="font-['Outfit'] text-[32px] font-semibold leading-8 text-zinc-950">
|
|
118
|
-
{COPY.title}
|
|
119
|
-
</h2>
|
|
120
|
-
<p className="paragraph-medium-medium text-zinc-950">
|
|
121
|
-
{COPY.subtitlePrefix}
|
|
122
|
-
<span className="font-bold">{COPY.subtitleDate}</span>
|
|
123
|
-
</p>
|
|
124
|
-
</div>
|
|
125
|
-
|
|
126
|
-
{/* Cards */}
|
|
127
|
-
<div className="relative z-[1] mt-10 flex flex-col items-stretch gap-3 md:flex-row">
|
|
128
|
-
{COMBOS.map((combo) => (
|
|
129
|
-
<ComboCard key={combo.coupon} combo={combo} onChoose={() => goToPlans(combo.coupon, combo.period)} />
|
|
130
|
-
))}
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
{/* Rodapé informativo */}
|
|
134
|
-
<div className="relative z-[1] mt-3 flex items-center justify-center gap-2.5 rounded-[10px] bg-zinc-100 p-3 text-center">
|
|
135
|
-
<IconInfoCircle className="size-4 shrink-0 text-zinc-950" />
|
|
136
|
-
<p className="paragraph-small-medium text-zinc-950">
|
|
137
|
-
{COPY.footerPrefix}
|
|
138
|
-
<span className="font-semibold">{COPY.footerBold}</span>
|
|
139
|
-
{COPY.footerSuffix}
|
|
140
|
-
</p>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</DialogContent>
|
|
145
|
-
</Dialog>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
interface ComboCardProps {
|
|
150
|
-
combo: HexaCombo;
|
|
151
|
-
onChoose: () => void;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function ComboCard({ combo, onChoose }: ComboCardProps) {
|
|
155
|
-
const { isCopied, copy } = useCopyToClipboard({
|
|
156
|
-
onSuccess: () => {
|
|
157
|
-
toast.custom((t) => <Toast variant="success" message={COPY.couponCopied} toastId={t} />);
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
return (
|
|
162
|
-
<div
|
|
163
|
-
className={cn(
|
|
164
|
-
'relative flex flex-1 flex-col rounded-[10px] border bg-white pb-3 md:w-[276px]',
|
|
165
|
-
combo.highlighted ? 'border-cyan-500' : 'border-zinc-200',
|
|
166
|
-
)}
|
|
167
|
-
>
|
|
168
|
-
{combo.highlighted && (
|
|
169
|
-
<div className="absolute left-1/2 top-0 z-[1] flex h-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center gap-[5px] rounded-md border-4 border-white bg-cyan-100 px-2">
|
|
170
|
-
<IconStar className="size-3 text-cyan-600" />
|
|
171
|
-
<span className="paragraph-xsmall-semibold whitespace-nowrap text-cyan-600">
|
|
172
|
-
{COPY.mostChosen}
|
|
173
|
-
</span>
|
|
174
|
-
<IconStar className="size-3 text-cyan-600" />
|
|
175
|
-
</div>
|
|
176
|
-
)}
|
|
177
|
-
|
|
178
|
-
<h3 className="border-b border-zinc-200 px-4 py-4 text-center font-['Outfit'] text-base font-semibold text-zinc-950">
|
|
179
|
-
{combo.name}
|
|
180
|
-
</h3>
|
|
181
|
-
|
|
182
|
-
<ul className="flex flex-1 flex-col gap-5 px-5 pt-5">
|
|
183
|
-
{combo.features.map((feature) => (
|
|
184
|
-
<li key={feature} className="flex items-center gap-2.5">
|
|
185
|
-
<IconCheck className="size-5 shrink-0 text-cyan-500" />
|
|
186
|
-
<span className="paragraph-small-medium text-zinc-950">{feature}</span>
|
|
187
|
-
</li>
|
|
188
|
-
))}
|
|
189
|
-
</ul>
|
|
190
|
-
|
|
191
|
-
<div className="mx-3 mt-5 flex items-center gap-3 rounded-lg bg-cyan-50 py-2 pl-3.5 pr-2.5">
|
|
192
|
-
<IconTicket className="size-5 shrink-0 text-cyan-600" />
|
|
193
|
-
<div className="flex min-w-0 flex-1 flex-col">
|
|
194
|
-
<span className="paragraph-xsmall-medium text-zinc-400">{COPY.couponLabel}</span>
|
|
195
|
-
<span className="paragraph-small-semibold text-zinc-950">{combo.coupon}</span>
|
|
196
|
-
</div>
|
|
197
|
-
<button
|
|
198
|
-
type="button"
|
|
199
|
-
aria-label={COPY.couponLabel}
|
|
200
|
-
onClick={() => copy(combo.coupon)}
|
|
201
|
-
className="flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-cyan-100 hover:text-zinc-950"
|
|
202
|
-
>
|
|
203
|
-
{isCopied ? <IconCheck className="size-[18px]" /> : <IconCopy className="size-[18px]" />}
|
|
204
|
-
</button>
|
|
205
|
-
</div>
|
|
206
|
-
|
|
207
|
-
<div className="mx-3 mt-3">
|
|
208
|
-
<Button
|
|
209
|
-
variant={combo.highlighted ? 'default' : 'secondary'}
|
|
210
|
-
className={cn('h-11! w-full', combo.highlighted && 'bg-cyan-500 text-white hover:bg-cyan-600')}
|
|
211
|
-
onClick={onChoose}
|
|
212
|
-
>
|
|
213
|
-
{COPY.choosePlan}
|
|
214
|
-
</Button>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
);
|
|
218
|
-
}
|