@greatapps/common 1.1.793 → 1.1.795

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.
@@ -1,38 +1,146 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ const ANIMATION_CSS = `
5
+ .gp-confetti {
6
+ --gp-confetti-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%,
7
+ 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%,
8
+ 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%,
9
+ 1.003 76.9%, 1.004 83.8%, 1);
10
+ --gp-confetti-out: cubic-bezier(0.22, 1, 0.36, 1);
11
+ overflow: visible;
12
+ }
13
+ @supports not (animation-timing-function: linear(0, 1)) {
14
+ .gp-confetti { --gp-confetti-spring: cubic-bezier(0.34, 1.56, 0.64, 1); }
15
+ }
16
+ .gp-confetti path {
17
+ stroke-dasharray: var(--gp-len) calc(var(--gp-len) + 4px);
18
+ stroke-dashoffset: calc(var(--gp-len) + 2px);
19
+ transform-box: fill-box;
20
+ transform-origin: center;
21
+ opacity: 0;
22
+ }
23
+ .gp-confetti-seal {
24
+ transform-box: fill-box;
25
+ transform-origin: center;
26
+ opacity: 0;
27
+ transform: scale(0.4);
28
+ }
29
+ .gp-confetti--play .gp-confetti-seal {
30
+ animation:
31
+ gp-confetti-seal-pop 670ms var(--gp-confetti-spring) 80ms both,
32
+ gp-confetti-seal-breathe 3600ms ease-in-out 930ms infinite alternate;
33
+ }
34
+ .gp-confetti--play .gp-confetti-seal path { opacity: 1; }
35
+ .gp-confetti--play .gp-confetti-badge {
36
+ animation: gp-confetti-draw 470ms var(--gp-confetti-out) 95ms both;
37
+ }
38
+ .gp-confetti--play .gp-confetti-check {
39
+ animation: gp-confetti-draw 320ms var(--gp-confetti-out) 310ms both;
40
+ }
41
+ .gp-confetti-piece {
42
+ --gp-confetti-delay: calc(375ms + var(--gp-i, 0) * 28ms);
43
+ --gp-confetti-drawtime: 350ms;
44
+ }
45
+ .gp-confetti-squiggle { --gp-confetti-drawtime: 600ms; }
46
+ .gp-confetti--play .gp-confetti-piece {
47
+ animation:
48
+ gp-confetti-pop 735ms var(--gp-confetti-spring) var(--gp-confetti-delay) both,
49
+ gp-confetti-draw var(--gp-confetti-drawtime) var(--gp-confetti-out) var(--gp-confetti-delay) both,
50
+ gp-confetti-float var(--gp-fd, 3200ms) ease-in-out calc(var(--gp-confetti-delay) + 735ms) infinite alternate;
51
+ }
52
+ @keyframes gp-confetti-seal-pop { to { opacity: 1; transform: scale(1); } }
53
+ @keyframes gp-confetti-seal-breathe { from { transform: scale(1); } to { transform: scale(1.025); } }
54
+ @keyframes gp-confetti-draw { to { stroke-dashoffset: 0; } }
55
+ @keyframes gp-confetti-pop {
56
+ from { opacity: 0; transform: translate(var(--gp-tx, 0px), var(--gp-ty, 0px)) scale(0.2) rotate(var(--gp-rot0, 0deg)); }
57
+ to { opacity: var(--gp-op, 1); transform: translate(0, 0) scale(1) rotate(0deg); }
58
+ }
59
+ @keyframes gp-confetti-float {
60
+ from { opacity: var(--gp-op, 1); transform: translate(0, 0) rotate(0deg); }
61
+ to { opacity: calc(var(--gp-op, 1) * 0.55); transform: translate(var(--gp-fx, 0px), var(--gp-fy, 0px)) rotate(var(--gp-fr, 0deg)); }
62
+ }
63
+ @media (prefers-reduced-motion: reduce) {
64
+ .gp-confetti path,
65
+ .gp-confetti-seal { animation: none !important; }
66
+ .gp-confetti-seal { opacity: 1 !important; transform: none !important; }
67
+ .gp-confetti path {
68
+ opacity: var(--gp-op, 1) !important;
69
+ stroke-dashoffset: 0 !important;
70
+ transform: none !important;
71
+ }
72
+ }
73
+ `;
74
+ const CENTER = { x: 74.5, y: 41.5 };
75
+ const rand = (min, max) => min + Math.random() * (max - min);
2
76
  function SuccessConfettiIcon({ className }) {
3
- return /* @__PURE__ */ jsxs(
4
- "svg",
5
- {
6
- width: "149",
7
- height: "83",
8
- viewBox: "0 0 149 83",
9
- fill: "none",
10
- xmlns: "http://www.w3.org/2000/svg",
11
- className,
12
- "aria-hidden": true,
13
- children: [
14
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M18.6348 28.4102C18.6348 30.574 19.9096 30.8716 21.7838 31.1393", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
15
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M109.117 41.4266C110.106 41.3745 110.639 40.9023 110.797 39.957", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
16
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M64.6035 75.1963C62.2234 77.2378 61.7986 79.4524 63.2302 82.1283", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
17
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M108.953 6.33984C106.531 6.40444 105.075 7.59006 104.965 10.072C104.898 11.5735 105.114 12.692 103.285 13.0577", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
18
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M131.021 51.2682C130.631 53.6598 129.26 54.9429 126.786 54.7178C125.289 54.5817 124.21 54.217 123.601 55.9798", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
19
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M34.1753 59.0104C33.2963 61.0245 32.8213 61.1372 30.7893 61.1213C29.7394 61.1131 28.0011 61.8028 27.5653 62.8448", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
20
- /* @__PURE__ */ jsx("path", { d: "M112.314 25.2715L113.514 24.7026", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
21
- /* @__PURE__ */ jsx("path", { d: "M51.492 49.2344C51.0065 49.3838 50.6337 49.7823 50.2324 50.0741", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
22
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M77.8867 9.72656C77.4011 9.87596 77.3223 10.0019 77.3223 10.0019", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
23
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M10.7246 56.0059C10.239 56.1553 10.1602 56.2812 10.1602 56.2812", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
24
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M28.3302 80.1108C28.6726 79.7356 28.6766 79.587 28.6766 79.587", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
25
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M128.043 49.0421C127.77 48.6138 127.627 48.5713 127.627 48.5713", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
26
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M135.461 29.4915C134.972 29.6314 134.891 29.7558 134.891 29.7558", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
27
- /* @__PURE__ */ jsx("path", { opacity: "0.4", d: "M52.3396 22.1222C52.0664 21.6939 51.924 21.6514 51.924 21.6514", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
28
- /* @__PURE__ */ jsx("path", { d: "M45.9383 40.1115L45.1508 39.1744", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
29
- /* @__PURE__ */ jsx("path", { opacity: "0.8", d: "M97.7421 69.0733C97.1523 69.9712 97.989 71.6124 98.5913 72.3132C99.7005 73.6036 100.945 73.8145 102.199 73.9149C103.234 73.9977 105.21 73.5621 105.476 72.3174C105.948 71.1367 104.935 69.8432 103.934 70.3872C102.571 71.1277 103.112 72.7192 103.73 73.7787C104.604 75.2776 105.879 76.6545 107.249 77.7108C108.333 78.5474 109.732 79.029 110.308 79.0142", stroke: "#12B76A", strokeWidth: "1.41098", strokeLinecap: "round" }),
30
- /* @__PURE__ */ jsx("path", { d: "M55.1022 11.4613C55.7297 11.187 55.8499 9.89737 55.7699 9.24592C55.6225 8.04626 55.0286 7.4129 54.3908 6.83895C53.8646 6.36537 52.6539 5.803 52.0797 6.41026C51.4175 6.89618 51.5122 8.05793 52.2377 8.15673C53.2253 8.2912 53.4868 7.15184 53.5227 6.28731C53.5734 5.06421 53.367 3.74644 52.9989 2.5746C52.7073 1.64647 52.1242 0.793399 51.8104 0.565035", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
31
- /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M58.1139 44.0572L60.4163 47.0706L60.9134 50.8219C61.1889 52.9028 62.8247 54.5405 64.9056 54.818L68.6666 55.3208L71.678 57.6214C73.3446 58.8949 75.6548 58.8949 77.3214 57.6214L80.3348 55.3189H80.3309L84.0842 54.8218C86.1651 54.5463 87.8028 52.9105 88.0802 50.8297L88.5812 47.0687C88.5812 47.0706 89.7449 45.5466 90.8836 44.0572C92.1572 42.3906 92.1553 40.0805 90.8836 38.4138L88.585 35.3985L88.0879 31.6472C87.8124 29.5663 86.1766 27.9286 84.0958 27.6512L80.3329 27.1502L77.3214 24.8497C75.6548 23.5761 73.3446 23.5761 71.678 24.8497L68.6646 27.1502H68.6685L64.9152 27.6492C62.8344 27.9248 61.1966 29.5605 60.9192 31.6414L60.4163 35.4024C60.4163 35.4004 59.2526 36.9245 58.1139 38.4138C56.8422 40.0785 56.8422 42.3906 58.1139 44.0572V44.0572Z", stroke: "#12B76A", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
32
- /* @__PURE__ */ jsx("path", { d: "M79.9009 38.541L73.1554 45.2865L69.1035 41.2384", stroke: "#12B76A", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
33
- ]
77
+ const ref = useRef(null);
78
+ const [play, setPlay] = useState(false);
79
+ useEffect(() => {
80
+ const svg = ref.current;
81
+ if (!svg) return;
82
+ try {
83
+ svg.querySelectorAll("path").forEach((path) => {
84
+ path.style.setProperty("--gp-len", `${path.getTotalLength().toFixed(2)}px`);
85
+ });
86
+ Array.from(svg.querySelectorAll(".gp-confetti-piece")).map((path) => {
87
+ const box = path.getBBox();
88
+ const dx = box.x + box.width / 2 - CENTER.x;
89
+ const dy = box.y + box.height / 2 - CENTER.y;
90
+ return { path, dx, dy, dist: Math.hypot(dx, dy) };
91
+ }).sort((a, b) => a.dist - b.dist).forEach(({ path, dx, dy }, i) => {
92
+ path.style.setProperty("--gp-i", String(i));
93
+ path.style.setProperty("--gp-tx", `${(-dx * 0.55).toFixed(2)}px`);
94
+ path.style.setProperty("--gp-ty", `${(-dy * 0.55).toFixed(2)}px`);
95
+ path.style.setProperty("--gp-rot0", `${rand(-60, 60).toFixed(1)}deg`);
96
+ path.style.setProperty("--gp-fx", `${rand(-2.2, 2.2).toFixed(2)}px`);
97
+ path.style.setProperty("--gp-fy", `${rand(-2.6, 2.6).toFixed(2)}px`);
98
+ path.style.setProperty("--gp-fr", `${rand(-16, 16).toFixed(1)}deg`);
99
+ path.style.setProperty("--gp-fd", `${Math.round(rand(2400, 4200))}ms`);
100
+ });
101
+ } catch {
34
102
  }
35
- );
103
+ setPlay(true);
104
+ }, []);
105
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
106
+ /* @__PURE__ */ jsx("style", { children: ANIMATION_CSS }),
107
+ /* @__PURE__ */ jsxs(
108
+ "svg",
109
+ {
110
+ ref,
111
+ width: "149",
112
+ height: "83",
113
+ viewBox: "0 0 149 83",
114
+ fill: "none",
115
+ xmlns: "http://www.w3.org/2000/svg",
116
+ className: ["gp-confetti", play && "gp-confetti--play", className].filter(Boolean).join(" "),
117
+ "aria-hidden": true,
118
+ children: [
119
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M18.6348 28.4102C18.6348 30.574 19.9096 30.8716 21.7838 31.1393", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
120
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M109.117 41.4266C110.106 41.3745 110.639 40.9023 110.797 39.957", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
121
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M64.6035 75.1963C62.2234 77.2378 61.7986 79.4524 63.2302 82.1283", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
122
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M108.953 6.33984C106.531 6.40444 105.075 7.59006 104.965 10.072C104.898 11.5735 105.114 12.692 103.285 13.0577", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
123
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M131.021 51.2682C130.631 53.6598 129.26 54.9429 126.786 54.7178C125.289 54.5817 124.21 54.217 123.601 55.9798", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
124
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M34.1753 59.0104C33.2963 61.0245 32.8213 61.1372 30.7893 61.1213C29.7394 61.1131 28.0011 61.8028 27.5653 62.8448", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
125
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 1 }, d: "M112.314 25.2715L113.514 24.7026", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
126
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 1 }, d: "M51.492 49.2344C51.0065 49.3838 50.6337 49.7823 50.2324 50.0741", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
127
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M77.8867 9.72656C77.4011 9.87596 77.3223 10.0019 77.3223 10.0019", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
128
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M10.7246 56.0059C10.239 56.1553 10.1602 56.2812 10.1602 56.2812", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
129
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M28.3302 80.1108C28.6726 79.7356 28.6766 79.587 28.6766 79.587", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
130
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M128.043 49.0421C127.77 48.6138 127.627 48.5713 127.627 48.5713", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
131
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M135.461 29.4915C134.972 29.6314 134.891 29.7558 134.891 29.7558", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
132
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 0.4 }, d: "M52.3396 22.1222C52.0664 21.6939 51.924 21.6514 51.924 21.6514", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
133
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece", style: { "--gp-op": 1 }, d: "M45.9383 40.1115L45.1508 39.1744", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
134
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece gp-confetti-squiggle", style: { "--gp-op": 0.8 }, d: "M97.7421 69.0733C97.1523 69.9712 97.989 71.6124 98.5913 72.3132C99.7005 73.6036 100.945 73.8145 102.199 73.9149C103.234 73.9977 105.21 73.5621 105.476 72.3174C105.948 71.1367 104.935 69.8432 103.934 70.3872C102.571 71.1277 103.112 72.7192 103.73 73.7787C104.604 75.2776 105.879 76.6545 107.249 77.7108C108.333 78.5474 109.732 79.029 110.308 79.0142", stroke: "#12B76A", strokeWidth: "1.41098", strokeLinecap: "round" }),
135
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-piece gp-confetti-squiggle", style: { "--gp-op": 1 }, d: "M55.1022 11.4613C55.7297 11.187 55.8499 9.89737 55.7699 9.24592C55.6225 8.04626 55.0286 7.4129 54.3908 6.83895C53.8646 6.36537 52.6539 5.803 52.0797 6.41026C51.4175 6.89618 51.5122 8.05793 52.2377 8.15673C53.2253 8.2912 53.4868 7.15184 53.5227 6.28731C53.5734 5.06421 53.367 3.74644 52.9989 2.5746C52.7073 1.64647 52.1242 0.793399 51.8104 0.565035", stroke: "#12B76A", strokeWidth: "1.12879", strokeLinecap: "round" }),
136
+ /* @__PURE__ */ jsxs("g", { className: "gp-confetti-seal", children: [
137
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-badge", fillRule: "evenodd", clipRule: "evenodd", d: "M58.1139 44.0572L60.4163 47.0706L60.9134 50.8219C61.1889 52.9028 62.8247 54.5405 64.9056 54.818L68.6666 55.3208L71.678 57.6214C73.3446 58.8949 75.6548 58.8949 77.3214 57.6214L80.3348 55.3189H80.3309L84.0842 54.8218C86.1651 54.5463 87.8028 52.9105 88.0802 50.8297L88.5812 47.0687C88.5812 47.0706 89.7449 45.5466 90.8836 44.0572C92.1572 42.3906 92.1553 40.0805 90.8836 38.4138L88.585 35.3985L88.0879 31.6472C87.8124 29.5663 86.1766 27.9286 84.0958 27.6512L80.3329 27.1502L77.3214 24.8497C75.6548 23.5761 73.3446 23.5761 71.678 24.8497L68.6646 27.1502H68.6685L64.9152 27.6492C62.8344 27.9248 61.1966 29.5605 60.9192 31.6414L60.4163 35.4024C60.4163 35.4004 59.2526 36.9245 58.1139 38.4138C56.8422 40.0785 56.8422 42.3906 58.1139 44.0572V44.0572Z", stroke: "#12B76A", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }),
138
+ /* @__PURE__ */ jsx("path", { className: "gp-confetti-check", d: "M79.9009 38.541L73.1554 45.2865L69.1035 41.2384", stroke: "#12B76A", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
139
+ ] })
140
+ ]
141
+ }
142
+ )
143
+ ] });
36
144
  }
37
145
  export {
38
146
  SuccessConfettiIcon
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ui/data-display/SuccessConfettiIcon.tsx"],"sourcesContent":["export function SuccessConfettiIcon({ className }: { className?: string }) {\n return (\n <svg\n width=\"149\"\n height=\"83\"\n viewBox=\"0 0 149 83\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n aria-hidden\n >\n <path opacity=\"0.4\" d=\"M18.6348 28.4102C18.6348 30.574 19.9096 30.8716 21.7838 31.1393\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M109.117 41.4266C110.106 41.3745 110.639 40.9023 110.797 39.957\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M64.6035 75.1963C62.2234 77.2378 61.7986 79.4524 63.2302 82.1283\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M108.953 6.33984C106.531 6.40444 105.075 7.59006 104.965 10.072C104.898 11.5735 105.114 12.692 103.285 13.0577\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M131.021 51.2682C130.631 53.6598 129.26 54.9429 126.786 54.7178C125.289 54.5817 124.21 54.217 123.601 55.9798\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M34.1753 59.0104C33.2963 61.0245 32.8213 61.1372 30.7893 61.1213C29.7394 61.1131 28.0011 61.8028 27.5653 62.8448\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path d=\"M112.314 25.2715L113.514 24.7026\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path d=\"M51.492 49.2344C51.0065 49.3838 50.6337 49.7823 50.2324 50.0741\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M77.8867 9.72656C77.4011 9.87596 77.3223 10.0019 77.3223 10.0019\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M10.7246 56.0059C10.239 56.1553 10.1602 56.2812 10.1602 56.2812\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M28.3302 80.1108C28.6726 79.7356 28.6766 79.587 28.6766 79.587\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M128.043 49.0421C127.77 48.6138 127.627 48.5713 127.627 48.5713\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M135.461 29.4915C134.972 29.6314 134.891 29.7558 134.891 29.7558\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.4\" d=\"M52.3396 22.1222C52.0664 21.6939 51.924 21.6514 51.924 21.6514\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path d=\"M45.9383 40.1115L45.1508 39.1744\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path opacity=\"0.8\" d=\"M97.7421 69.0733C97.1523 69.9712 97.989 71.6124 98.5913 72.3132C99.7005 73.6036 100.945 73.8145 102.199 73.9149C103.234 73.9977 105.21 73.5621 105.476 72.3174C105.948 71.1367 104.935 69.8432 103.934 70.3872C102.571 71.1277 103.112 72.7192 103.73 73.7787C104.604 75.2776 105.879 76.6545 107.249 77.7108C108.333 78.5474 109.732 79.029 110.308 79.0142\" stroke=\"#12B76A\" strokeWidth=\"1.41098\" strokeLinecap=\"round\"/>\n <path d=\"M55.1022 11.4613C55.7297 11.187 55.8499 9.89737 55.7699 9.24592C55.6225 8.04626 55.0286 7.4129 54.3908 6.83895C53.8646 6.36537 52.6539 5.803 52.0797 6.41026C51.4175 6.89618 51.5122 8.05793 52.2377 8.15673C53.2253 8.2912 53.4868 7.15184 53.5227 6.28731C53.5734 5.06421 53.367 3.74644 52.9989 2.5746C52.7073 1.64647 52.1242 0.793399 51.8104 0.565035\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M58.1139 44.0572L60.4163 47.0706L60.9134 50.8219C61.1889 52.9028 62.8247 54.5405 64.9056 54.818L68.6666 55.3208L71.678 57.6214C73.3446 58.8949 75.6548 58.8949 77.3214 57.6214L80.3348 55.3189H80.3309L84.0842 54.8218C86.1651 54.5463 87.8028 52.9105 88.0802 50.8297L88.5812 47.0687C88.5812 47.0706 89.7449 45.5466 90.8836 44.0572C92.1572 42.3906 92.1553 40.0805 90.8836 38.4138L88.585 35.3985L88.0879 31.6472C87.8124 29.5663 86.1766 27.9286 84.0958 27.6512L80.3329 27.1502L77.3214 24.8497C75.6548 23.5761 73.3446 23.5761 71.678 24.8497L68.6646 27.1502H68.6685L64.9152 27.6492C62.8344 27.9248 61.1966 29.5605 60.9192 31.6414L60.4163 35.4024C60.4163 35.4004 59.2526 36.9245 58.1139 38.4138C56.8422 40.0785 56.8422 42.3906 58.1139 44.0572V44.0572Z\" stroke=\"#12B76A\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path d=\"M79.9009 38.541L73.1554 45.2865L69.1035 41.2384\" stroke=\"#12B76A\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n </svg>\n );\n}\n"],"mappings":"AAEI,SASE,KATF;AAFG,SAAS,oBAAoB,EAAE,UAAU,GAA2B;AACzE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,OAAM;AAAA,MACN;AAAA,MACA,eAAW;AAAA,MAEX;AAAA,4BAAC,UAAK,SAAQ,OAAM,GAAE,mEAAkE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACpJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,mEAAkE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACpJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,oEAAmE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACrJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,kHAAiH,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACnM,oBAAC,UAAK,SAAQ,OAAM,GAAE,iHAAgH,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QAClM,oBAAC,UAAK,SAAQ,OAAM,GAAE,oHAAmH,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACrM,oBAAC,UAAK,GAAE,oCAAmC,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACvG,oBAAC,UAAK,GAAE,mEAAkE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACtI,oBAAC,UAAK,SAAQ,OAAM,GAAE,oEAAmE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACrJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,mEAAkE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACpJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,kEAAiE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACnJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,mEAAkE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACpJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,oEAAmE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACrJ,oBAAC,UAAK,SAAQ,OAAM,GAAE,kEAAiE,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACnJ,oBAAC,UAAK,GAAE,oCAAmC,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACvG,oBAAC,UAAK,SAAQ,OAAM,GAAE,gWAA+V,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACjb,oBAAC,UAAK,GAAE,+VAA8V,QAAO,WAAU,aAAY,WAAU,eAAc,SAAO;AAAA,QACla,oBAAC,UAAK,UAAS,WAAU,UAAS,WAAU,GAAE,yuBAAwuB,QAAO,WAAU,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAAO;AAAA,QACn2B,oBAAC,UAAK,GAAE,mDAAkD,QAAO,WAAU,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAAO;AAAA;AAAA;AAAA,EACzI;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/ui/data-display/SuccessConfettiIcon.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\n/**\n * Selo de sucesso com confetes — a arte de sempre, agora animada.\n *\n * A cada mount o selo entra com spring enquanto o contorno se desenha, o check risca em\n * seguida e os confetes explodem do centro pra fora (os mais próximos primeiro), desenhando\n * o traço no voo; depois ficam flutuando devagar, cada um no seu ritmo.\n *\n * ANIMAÇÃO: CSS puro injetado pelo próprio componente (mesmo padrão do `ImageCropModal`), e\n * não classes vindas do `globals.css` de cada app como no `AiCreditsOfferModal`. Aqui isso\n * importa: é um ícone folha que qualquer app pode renderizar, então carregar o CSS junto\n * evita ter que replicar um bloco de keyframes nos quatro consumidores e mantê-los em sincronia.\n *\n * Comprimento de traço e vetor de explosão dependem da geometria de cada path, então são\n * medidos no cliente (`getTotalLength`/`getBBox`) e injetados como CSS vars por elemento. Só\n * ligamos a classe de play depois de medir — antes disso os traços ficam invisíveis, o que\n * também deixa o `useEffect` (em vez de `useLayoutEffect`) seguro: não há flash de conteúdo\n * não animado, e a lib não precisa supor se o consumidor renderiza no servidor.\n */\n\nconst ANIMATION_CSS = `\n.gp-confetti {\n --gp-confetti-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%,\n 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%,\n 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%,\n 1.003 76.9%, 1.004 83.8%, 1);\n --gp-confetti-out: cubic-bezier(0.22, 1, 0.36, 1);\n overflow: visible;\n}\n@supports not (animation-timing-function: linear(0, 1)) {\n .gp-confetti { --gp-confetti-spring: cubic-bezier(0.34, 1.56, 0.64, 1); }\n}\n.gp-confetti path {\n stroke-dasharray: var(--gp-len) calc(var(--gp-len) + 4px);\n stroke-dashoffset: calc(var(--gp-len) + 2px);\n transform-box: fill-box;\n transform-origin: center;\n opacity: 0;\n}\n.gp-confetti-seal {\n transform-box: fill-box;\n transform-origin: center;\n opacity: 0;\n transform: scale(0.4);\n}\n.gp-confetti--play .gp-confetti-seal {\n animation:\n gp-confetti-seal-pop 670ms var(--gp-confetti-spring) 80ms both,\n gp-confetti-seal-breathe 3600ms ease-in-out 930ms infinite alternate;\n}\n.gp-confetti--play .gp-confetti-seal path { opacity: 1; }\n.gp-confetti--play .gp-confetti-badge {\n animation: gp-confetti-draw 470ms var(--gp-confetti-out) 95ms both;\n}\n.gp-confetti--play .gp-confetti-check {\n animation: gp-confetti-draw 320ms var(--gp-confetti-out) 310ms both;\n}\n.gp-confetti-piece {\n --gp-confetti-delay: calc(375ms + var(--gp-i, 0) * 28ms);\n --gp-confetti-drawtime: 350ms;\n}\n.gp-confetti-squiggle { --gp-confetti-drawtime: 600ms; }\n.gp-confetti--play .gp-confetti-piece {\n animation:\n gp-confetti-pop 735ms var(--gp-confetti-spring) var(--gp-confetti-delay) both,\n gp-confetti-draw var(--gp-confetti-drawtime) var(--gp-confetti-out) var(--gp-confetti-delay) both,\n gp-confetti-float var(--gp-fd, 3200ms) ease-in-out calc(var(--gp-confetti-delay) + 735ms) infinite alternate;\n}\n@keyframes gp-confetti-seal-pop { to { opacity: 1; transform: scale(1); } }\n@keyframes gp-confetti-seal-breathe { from { transform: scale(1); } to { transform: scale(1.025); } }\n@keyframes gp-confetti-draw { to { stroke-dashoffset: 0; } }\n@keyframes gp-confetti-pop {\n from { opacity: 0; transform: translate(var(--gp-tx, 0px), var(--gp-ty, 0px)) scale(0.2) rotate(var(--gp-rot0, 0deg)); }\n to { opacity: var(--gp-op, 1); transform: translate(0, 0) scale(1) rotate(0deg); }\n}\n@keyframes gp-confetti-float {\n from { opacity: var(--gp-op, 1); transform: translate(0, 0) rotate(0deg); }\n to { opacity: calc(var(--gp-op, 1) * 0.55); transform: translate(var(--gp-fx, 0px), var(--gp-fy, 0px)) rotate(var(--gp-fr, 0deg)); }\n}\n@media (prefers-reduced-motion: reduce) {\n .gp-confetti path,\n .gp-confetti-seal { animation: none !important; }\n .gp-confetti-seal { opacity: 1 !important; transform: none !important; }\n .gp-confetti path {\n opacity: var(--gp-op, 1) !important;\n stroke-dashoffset: 0 !important;\n transform: none !important;\n }\n}\n`;\n\n/** Centro do selo no viewBox — os confetes explodem a partir daqui. */\nconst CENTER = { x: 74.5, y: 41.5 };\n\nconst rand = (min: number, max: number) => min + Math.random() * (max - min);\n\nexport function SuccessConfettiIcon({ className }: { className?: string }) {\n const ref = useRef<SVGSVGElement>(null);\n const [play, setPlay] = useState(false);\n\n useEffect(() => {\n const svg = ref.current;\n if (!svg) return;\n\n try {\n svg.querySelectorAll<SVGPathElement>('path').forEach((path) => {\n path.style.setProperty('--gp-len', `${path.getTotalLength().toFixed(2)}px`);\n });\n\n Array.from(svg.querySelectorAll<SVGPathElement>('.gp-confetti-piece'))\n .map((path) => {\n const box = path.getBBox();\n const dx = box.x + box.width / 2 - CENTER.x;\n const dy = box.y + box.height / 2 - CENTER.y;\n return { path, dx, dy, dist: Math.hypot(dx, dy) };\n })\n .sort((a, b) => a.dist - b.dist)\n .forEach(({ path, dx, dy }, i) => {\n path.style.setProperty('--gp-i', String(i));\n // começa mais perto do selo e voa pra posição final\n path.style.setProperty('--gp-tx', `${(-dx * 0.55).toFixed(2)}px`);\n path.style.setProperty('--gp-ty', `${(-dy * 0.55).toFixed(2)}px`);\n path.style.setProperty('--gp-rot0', `${rand(-60, 60).toFixed(1)}deg`);\n // deriva idle: pequena, lenta e diferente pra cada peça\n path.style.setProperty('--gp-fx', `${rand(-2.2, 2.2).toFixed(2)}px`);\n path.style.setProperty('--gp-fy', `${rand(-2.6, 2.6).toFixed(2)}px`);\n path.style.setProperty('--gp-fr', `${rand(-16, 16).toFixed(1)}deg`);\n path.style.setProperty('--gp-fd', `${Math.round(rand(2400, 4200))}ms`);\n });\n } catch {\n // svg sem layout (display:none) — sem medidas o CSS cai pro traço inteiro, só anima pop/float\n }\n\n setPlay(true);\n }, []);\n\n return (\n <>\n <style>{ANIMATION_CSS}</style>\n <svg\n ref={ref}\n width=\"149\"\n height=\"83\"\n viewBox=\"0 0 149 83\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={['gp-confetti', play && 'gp-confetti--play', className].filter(Boolean).join(' ')}\n aria-hidden\n >\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M18.6348 28.4102C18.6348 30.574 19.9096 30.8716 21.7838 31.1393\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M109.117 41.4266C110.106 41.3745 110.639 40.9023 110.797 39.957\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M64.6035 75.1963C62.2234 77.2378 61.7986 79.4524 63.2302 82.1283\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M108.953 6.33984C106.531 6.40444 105.075 7.59006 104.965 10.072C104.898 11.5735 105.114 12.692 103.285 13.0577\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M131.021 51.2682C130.631 53.6598 129.26 54.9429 126.786 54.7178C125.289 54.5817 124.21 54.217 123.601 55.9798\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M34.1753 59.0104C33.2963 61.0245 32.8213 61.1372 30.7893 61.1213C29.7394 61.1131 28.0011 61.8028 27.5653 62.8448\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 1 } as React.CSSProperties} d=\"M112.314 25.2715L113.514 24.7026\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 1 } as React.CSSProperties} d=\"M51.492 49.2344C51.0065 49.3838 50.6337 49.7823 50.2324 50.0741\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M77.8867 9.72656C77.4011 9.87596 77.3223 10.0019 77.3223 10.0019\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M10.7246 56.0059C10.239 56.1553 10.1602 56.2812 10.1602 56.2812\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M28.3302 80.1108C28.6726 79.7356 28.6766 79.587 28.6766 79.587\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M128.043 49.0421C127.77 48.6138 127.627 48.5713 127.627 48.5713\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M135.461 29.4915C134.972 29.6314 134.891 29.7558 134.891 29.7558\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 0.4 } as React.CSSProperties} d=\"M52.3396 22.1222C52.0664 21.6939 51.924 21.6514 51.924 21.6514\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece\" style={{ '--gp-op': 1 } as React.CSSProperties} d=\"M45.9383 40.1115L45.1508 39.1744\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece gp-confetti-squiggle\" style={{ '--gp-op': 0.8 } as React.CSSProperties} d=\"M97.7421 69.0733C97.1523 69.9712 97.989 71.6124 98.5913 72.3132C99.7005 73.6036 100.945 73.8145 102.199 73.9149C103.234 73.9977 105.21 73.5621 105.476 72.3174C105.948 71.1367 104.935 69.8432 103.934 70.3872C102.571 71.1277 103.112 72.7192 103.73 73.7787C104.604 75.2776 105.879 76.6545 107.249 77.7108C108.333 78.5474 109.732 79.029 110.308 79.0142\" stroke=\"#12B76A\" strokeWidth=\"1.41098\" strokeLinecap=\"round\"/>\n <path className=\"gp-confetti-piece gp-confetti-squiggle\" style={{ '--gp-op': 1 } as React.CSSProperties} d=\"M55.1022 11.4613C55.7297 11.187 55.8499 9.89737 55.7699 9.24592C55.6225 8.04626 55.0286 7.4129 54.3908 6.83895C53.8646 6.36537 52.6539 5.803 52.0797 6.41026C51.4175 6.89618 51.5122 8.05793 52.2377 8.15673C53.2253 8.2912 53.4868 7.15184 53.5227 6.28731C53.5734 5.06421 53.367 3.74644 52.9989 2.5746C52.7073 1.64647 52.1242 0.793399 51.8104 0.565035\" stroke=\"#12B76A\" strokeWidth=\"1.12879\" strokeLinecap=\"round\"/>\n <g className=\"gp-confetti-seal\">\n <path className=\"gp-confetti-badge\" fillRule=\"evenodd\" clipRule=\"evenodd\" d=\"M58.1139 44.0572L60.4163 47.0706L60.9134 50.8219C61.1889 52.9028 62.8247 54.5405 64.9056 54.818L68.6666 55.3208L71.678 57.6214C73.3446 58.8949 75.6548 58.8949 77.3214 57.6214L80.3348 55.3189H80.3309L84.0842 54.8218C86.1651 54.5463 87.8028 52.9105 88.0802 50.8297L88.5812 47.0687C88.5812 47.0706 89.7449 45.5466 90.8836 44.0572C92.1572 42.3906 92.1553 40.0805 90.8836 38.4138L88.585 35.3985L88.0879 31.6472C87.8124 29.5663 86.1766 27.9286 84.0958 27.6512L80.3329 27.1502L77.3214 24.8497C75.6548 23.5761 73.3446 23.5761 71.678 24.8497L68.6646 27.1502H68.6685L64.9152 27.6492C62.8344 27.9248 61.1966 29.5605 60.9192 31.6414L60.4163 35.4024C60.4163 35.4004 59.2526 36.9245 58.1139 38.4138C56.8422 40.0785 56.8422 42.3906 58.1139 44.0572V44.0572Z\" stroke=\"#12B76A\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n <path className=\"gp-confetti-check\" d=\"M79.9009 38.541L73.1554 45.2865L69.1035 41.2384\" stroke=\"#12B76A\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"/>\n </g>\n </svg>\n </>\n );\n}\n"],"mappings":"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","names":[]}
@@ -8,8 +8,8 @@ import dynamic from "next/dynamic";
8
8
  import {
9
9
  PersistQueryClientProvider
10
10
  } from "@tanstack/react-query-persist-client";
11
- import { broadcastQueryClient } from "@tanstack/query-broadcast-client-experimental";
12
11
  import { set, get, del } from "idb-keyval";
12
+ import { isShareableQuery, shareQueryCacheBetweenTabs } from "./share-query-cache";
13
13
  const ReactQueryDevtools = process.env.NODE_ENV === "development" ? dynamic(
14
14
  () => import("@tanstack/react-query-devtools").then((mod) => ({
15
15
  default: mod.ReactQueryDevtools
@@ -62,12 +62,7 @@ function QueryProvider({
62
62
  }
63
63
  })
64
64
  );
65
- useEffect(() => {
66
- broadcastQueryClient({
67
- queryClient,
68
- broadcastChannel: "react-query"
69
- });
70
- }, [queryClient]);
65
+ useEffect(() => shareQueryCacheBetweenTabs(queryClient), [queryClient]);
71
66
  return /* @__PURE__ */ jsxs(
72
67
  PersistQueryClientProvider,
73
68
  {
@@ -77,12 +72,7 @@ function QueryProvider({
77
72
  maxAge: 2 * 60 * 60 * 1e3,
78
73
  buster: persisterVersion,
79
74
  dehydrateOptions: {
80
- shouldDehydrateQuery: (query) => {
81
- if (query.state.status === "error") return false;
82
- if (query.meta?.persist === false) return false;
83
- if ((query.state.dataUpdateCount ?? 0) > 10) return false;
84
- return true;
85
- }
75
+ shouldDehydrateQuery: isShareableQuery
86
76
  }
87
77
  },
88
78
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/providers/query.provider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n QueryCache,\r\n QueryClient,\r\n QueryClientProvider,\r\n} from \"@tanstack/react-query\";\r\nimport { ReactNode, useEffect, useState } from \"react\";\r\nimport dynamic from \"next/dynamic\";\r\nimport { toast } from \"sonner\";\r\nimport {\r\n PersistedClient,\r\n PersistQueryClientProvider,\r\n} from \"@tanstack/react-query-persist-client\";\r\nimport { broadcastQueryClient } from \"@tanstack/query-broadcast-client-experimental\";\r\nimport { set, get, del } from \"idb-keyval\";\r\n\r\n// React Query Devtools só em desenvolvimento - remove do bundle de produção\r\nconst ReactQueryDevtools =\r\n process.env.NODE_ENV === \"development\"\r\n ? dynamic(\r\n () =>\r\n import(\"@tanstack/react-query-devtools\").then((mod) => ({\r\n default: mod.ReactQueryDevtools,\r\n })),\r\n { ssr: false },\r\n )\r\n : () => null;\r\n\r\nexport const persister = {\r\n persistClient: async (client: PersistedClient) => {\r\n try {\r\n await set(\"rq-cache\", client);\r\n } catch {\r\n console.warn(\"Falha ao persistir cache\");\r\n }\r\n },\r\n restoreClient: async (): Promise<PersistedClient | undefined> => {\r\n try {\r\n return await get(\"rq-cache\");\r\n } catch {\r\n await del(\"rq-cache\").catch(() => {});\r\n return undefined;\r\n }\r\n },\r\n removeClient: async () => {\r\n try {\r\n await del(\"rq-cache\");\r\n } catch {\r\n console.warn(\"Falha ao remover cache\");\r\n }\r\n },\r\n};\r\n\r\ninterface QueryProviderProps {\r\n children: ReactNode;\r\n persisterVersion?: string;\r\n}\r\n\r\nexport function QueryProvider({\r\n children,\r\n persisterVersion = \"v1\",\r\n}: QueryProviderProps) {\r\n const [queryClient] = useState(\r\n () =>\r\n new QueryClient({\r\n defaultOptions: {\r\n queries: {\r\n staleTime: 15 * 1000,\r\n gcTime: 5 * 60 * 1000,\r\n refetchOnWindowFocus: false,\r\n refetchOnReconnect: true,\r\n retry: 2,\r\n retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 30000),\r\n },\r\n mutations: {\r\n retry: false,\r\n },\r\n },\r\n }),\r\n );\r\n\r\n useEffect(() => {\r\n broadcastQueryClient({\r\n queryClient,\r\n broadcastChannel: \"react-query\",\r\n });\r\n }, [queryClient]);\r\n\r\n return (\r\n <PersistQueryClientProvider\r\n client={queryClient}\r\n persistOptions={{\r\n persister,\r\n maxAge: 2 * 60 * 60 * 1000,\r\n buster: persisterVersion,\r\n dehydrateOptions: {\r\n shouldDehydrateQuery: (query) => {\r\n if (query.state.status === \"error\") return false;\r\n if (query.meta?.persist === false) return false;\r\n if ((query.state.dataUpdateCount ?? 0) > 10) return false;\r\n return true;\r\n },\r\n },\r\n }}\r\n >\r\n {children}\r\n <ReactQueryDevtools initialIsOpen={false} />\r\n </PersistQueryClientProvider>\r\n );\r\n}\r\n"],"mappings":";AA0FI,SAiBE,KAjBF;AAxFJ;AAAA,EAEE;AAAA,OAEK;AACP,SAAoB,WAAW,gBAAgB;AAC/C,OAAO,aAAa;AAEpB;AAAA,EAEE;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,KAAK,KAAK,WAAW;AAG9B,MAAM,qBACJ,QAAQ,IAAI,aAAa,gBACrB;AAAA,EACE,MACE,OAAO,gCAAgC,EAAE,KAAK,CAAC,SAAS;AAAA,IACtD,SAAS,IAAI;AAAA,EACf,EAAE;AAAA,EACJ,EAAE,KAAK,MAAM;AACf,IACA,MAAM;AAEL,MAAM,YAAY;AAAA,EACvB,eAAe,OAAO,WAA4B;AAChD,QAAI;AACF,YAAM,IAAI,YAAY,MAAM;AAAA,IAC9B,QAAQ;AACN,cAAQ,KAAK,0BAA0B;AAAA,IACzC;AAAA,EACF;AAAA,EACA,eAAe,YAAkD;AAC/D,QAAI;AACF,aAAO,MAAM,IAAI,UAAU;AAAA,IAC7B,QAAQ;AACN,YAAM,IAAI,UAAU,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AACpC,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,cAAc,YAAY;AACxB,QAAI;AACF,YAAM,IAAI,UAAU;AAAA,IACtB,QAAQ;AACN,cAAQ,KAAK,wBAAwB;AAAA,IACvC;AAAA,EACF;AACF;AAOO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,mBAAmB;AACrB,GAAuB;AACrB,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS;AAAA,UACP,WAAW,KAAK;AAAA,UAChB,QAAQ,IAAI,KAAK;AAAA,UACjB,sBAAsB;AAAA,UACtB,oBAAoB;AAAA,UACpB,OAAO;AAAA,UACP,YAAY,CAAC,YAAY,KAAK,IAAI,MAAO,KAAK,SAAS,GAAK;AAAA,QAC9D;AAAA,QACA,WAAW;AAAA,UACT,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACL;AAEA,YAAU,MAAM;AACd,yBAAqB;AAAA,MACnB;AAAA,MACA,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR,gBAAgB;AAAA,QACd;AAAA,QACA,QAAQ,IAAI,KAAK,KAAK;AAAA,QACtB,QAAQ;AAAA,QACR,kBAAkB;AAAA,UAChB,sBAAsB,CAAC,UAAU;AAC/B,gBAAI,MAAM,MAAM,WAAW,QAAS,QAAO;AAC3C,gBAAI,MAAM,MAAM,YAAY,MAAO,QAAO;AAC1C,iBAAK,MAAM,MAAM,mBAAmB,KAAK,GAAI,QAAO;AACpD,mBAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,QACD,oBAAC,sBAAmB,eAAe,OAAO;AAAA;AAAA;AAAA,EAC5C;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/providers/query.provider.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {\r\n QueryCache,\r\n QueryClient,\r\n QueryClientProvider,\r\n} from \"@tanstack/react-query\";\r\nimport { ReactNode, useEffect, useState } from \"react\";\r\nimport dynamic from \"next/dynamic\";\r\nimport { toast } from \"sonner\";\r\nimport {\r\n PersistedClient,\r\n PersistQueryClientProvider,\r\n} from \"@tanstack/react-query-persist-client\";\r\nimport { set, get, del } from \"idb-keyval\";\r\nimport { isShareableQuery, shareQueryCacheBetweenTabs } from \"./share-query-cache\";\r\n\r\n// React Query Devtools só em desenvolvimento - remove do bundle de produção\r\nconst ReactQueryDevtools =\r\n process.env.NODE_ENV === \"development\"\r\n ? dynamic(\r\n () =>\r\n import(\"@tanstack/react-query-devtools\").then((mod) => ({\r\n default: mod.ReactQueryDevtools,\r\n })),\r\n { ssr: false },\r\n )\r\n : () => null;\r\n\r\nexport const persister = {\r\n persistClient: async (client: PersistedClient) => {\r\n try {\r\n await set(\"rq-cache\", client);\r\n } catch {\r\n console.warn(\"Falha ao persistir cache\");\r\n }\r\n },\r\n restoreClient: async (): Promise<PersistedClient | undefined> => {\r\n try {\r\n return await get(\"rq-cache\");\r\n } catch {\r\n await del(\"rq-cache\").catch(() => {});\r\n return undefined;\r\n }\r\n },\r\n removeClient: async () => {\r\n try {\r\n await del(\"rq-cache\");\r\n } catch {\r\n console.warn(\"Falha ao remover cache\");\r\n }\r\n },\r\n};\r\n\r\ninterface QueryProviderProps {\r\n children: ReactNode;\r\n persisterVersion?: string;\r\n}\r\n\r\nexport function QueryProvider({\r\n children,\r\n persisterVersion = \"v1\",\r\n}: QueryProviderProps) {\r\n const [queryClient] = useState(\r\n () =>\r\n new QueryClient({\r\n defaultOptions: {\r\n queries: {\r\n staleTime: 15 * 1000,\r\n gcTime: 5 * 60 * 1000,\r\n refetchOnWindowFocus: false,\r\n refetchOnReconnect: true,\r\n retry: 2,\r\n retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 30000),\r\n },\r\n mutations: {\r\n retry: false,\r\n },\r\n },\r\n }),\r\n );\r\n\r\n useEffect(() => shareQueryCacheBetweenTabs(queryClient), [queryClient]);\r\n\r\n return (\r\n <PersistQueryClientProvider\r\n client={queryClient}\r\n persistOptions={{\r\n persister,\r\n maxAge: 2 * 60 * 60 * 1000,\r\n buster: persisterVersion,\r\n dehydrateOptions: {\r\n shouldDehydrateQuery: isShareableQuery,\r\n },\r\n }}\r\n >\r\n {children}\r\n <ReactQueryDevtools initialIsOpen={false} />\r\n </PersistQueryClientProvider>\r\n );\r\n}\r\n"],"mappings":";AAqFI,SAYE,KAZF;AAnFJ;AAAA,EAEE;AAAA,OAEK;AACP,SAAoB,WAAW,gBAAgB;AAC/C,OAAO,aAAa;AAEpB;AAAA,EAEE;AAAA,OACK;AACP,SAAS,KAAK,KAAK,WAAW;AAC9B,SAAS,kBAAkB,kCAAkC;AAG7D,MAAM,qBACJ,QAAQ,IAAI,aAAa,gBACrB;AAAA,EACE,MACE,OAAO,gCAAgC,EAAE,KAAK,CAAC,SAAS;AAAA,IACtD,SAAS,IAAI;AAAA,EACf,EAAE;AAAA,EACJ,EAAE,KAAK,MAAM;AACf,IACA,MAAM;AAEL,MAAM,YAAY;AAAA,EACvB,eAAe,OAAO,WAA4B;AAChD,QAAI;AACF,YAAM,IAAI,YAAY,MAAM;AAAA,IAC9B,QAAQ;AACN,cAAQ,KAAK,0BAA0B;AAAA,IACzC;AAAA,EACF;AAAA,EACA,eAAe,YAAkD;AAC/D,QAAI;AACF,aAAO,MAAM,IAAI,UAAU;AAAA,IAC7B,QAAQ;AACN,YAAM,IAAI,UAAU,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AACpC,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,cAAc,YAAY;AACxB,QAAI;AACF,YAAM,IAAI,UAAU;AAAA,IACtB,QAAQ;AACN,cAAQ,KAAK,wBAAwB;AAAA,IACvC;AAAA,EACF;AACF;AAOO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,mBAAmB;AACrB,GAAuB;AACrB,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS;AAAA,UACP,WAAW,KAAK;AAAA,UAChB,QAAQ,IAAI,KAAK;AAAA,UACjB,sBAAsB;AAAA,UACtB,oBAAoB;AAAA,UACpB,OAAO;AAAA,UACP,YAAY,CAAC,YAAY,KAAK,IAAI,MAAO,KAAK,SAAS,GAAK;AAAA,QAC9D;AAAA,QACA,WAAW;AAAA,UACT,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACL;AAEA,YAAU,MAAM,2BAA2B,WAAW,GAAG,CAAC,WAAW,CAAC;AAEtE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR,gBAAgB;AAAA,QACd;AAAA,QACA,QAAQ,IAAI,KAAK,KAAK;AAAA,QACtB,QAAQ;AAAA,QACR,kBAAkB;AAAA,UAChB,sBAAsB;AAAA,QACxB;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,QACD,oBAAC,sBAAmB,eAAe,OAAO;AAAA;AAAA;AAAA,EAC5C;AAEJ;","names":[]}
@@ -0,0 +1,54 @@
1
+ function isShareableQuery(query) {
2
+ if (query.state.status === "error") return false;
3
+ if (query.meta?.persist === false) return false;
4
+ if (query.state.dataUpdateCount > 10) return false;
5
+ return true;
6
+ }
7
+ function shareQueryCacheBetweenTabs(queryClient) {
8
+ if (typeof BroadcastChannel === "undefined") return () => {
9
+ };
10
+ const channel = new BroadcastChannel("greatapps-query-cache");
11
+ const queryCache = queryClient.getQueryCache();
12
+ let applyingRemoteMessage = false;
13
+ const unsubscribe = queryCache.subscribe((event) => {
14
+ if (applyingRemoteMessage) return;
15
+ const { query } = event;
16
+ const { queryHash, queryKey } = query;
17
+ if (event.type === "removed" && query.observers.length > 0) {
18
+ channel.postMessage({ type: "removed", queryHash, queryKey });
19
+ }
20
+ if (event.type === "updated" && event.action.type === "success" && isShareableQuery(query)) {
21
+ try {
22
+ channel.postMessage({ type: "updated", queryHash, queryKey, state: query.state });
23
+ } catch {
24
+ console.warn("Falha ao espelhar query entre abas", queryHash);
25
+ }
26
+ }
27
+ });
28
+ channel.addEventListener("message", (event) => {
29
+ const message = event.data;
30
+ const query = queryCache.get(message.queryHash);
31
+ applyingRemoteMessage = true;
32
+ try {
33
+ if (message.type === "removed" && query) queryCache.remove(query);
34
+ if (message.type === "updated") {
35
+ if (!query) {
36
+ queryCache.build(queryClient, { queryKey: message.queryKey, queryHash: message.queryHash }, message.state);
37
+ } else if (isShareableQuery(query) && message.state.dataUpdatedAt >= query.state.dataUpdatedAt) {
38
+ query.setState(message.state);
39
+ }
40
+ }
41
+ } finally {
42
+ applyingRemoteMessage = false;
43
+ }
44
+ });
45
+ return () => {
46
+ unsubscribe();
47
+ channel.close();
48
+ };
49
+ }
50
+ export {
51
+ isShareableQuery,
52
+ shareQueryCacheBetweenTabs
53
+ };
54
+ //# sourceMappingURL=share-query-cache.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/providers/share-query-cache.ts"],"sourcesContent":["import type { Query, QueryClient, QueryKey, QueryState } from \"@tanstack/react-query\";\n\ntype CacheMessage =\n | { type: \"removed\"; queryHash: string; queryKey: QueryKey }\n | { type: \"updated\"; queryHash: string; queryKey: QueryKey; state: QueryState };\n\nexport function isShareableQuery(query: Query): boolean {\n if (query.state.status === \"error\") return false;\n if (query.meta?.persist === false) return false;\n if (query.state.dataUpdateCount > 10) return false;\n return true;\n}\n\nexport function shareQueryCacheBetweenTabs(queryClient: QueryClient): () => void {\n if (typeof BroadcastChannel === \"undefined\") return () => {};\n const channel = new BroadcastChannel(\"greatapps-query-cache\");\n const queryCache = queryClient.getQueryCache();\n let applyingRemoteMessage = false;\n\n const unsubscribe = queryCache.subscribe((event) => {\n if (applyingRemoteMessage) return;\n const { query } = event;\n const { queryHash, queryKey } = query;\n if (event.type === \"removed\" && query.observers.length > 0) {\n channel.postMessage({ type: \"removed\", queryHash, queryKey });\n }\n if (event.type === \"updated\" && event.action.type === \"success\" && isShareableQuery(query)) {\n try {\n channel.postMessage({ type: \"updated\", queryHash, queryKey, state: query.state });\n } catch {\n console.warn(\"Falha ao espelhar query entre abas\", queryHash);\n }\n }\n });\n\n channel.addEventListener(\"message\", (event: MessageEvent<CacheMessage>) => {\n const message = event.data;\n const query = queryCache.get(message.queryHash);\n applyingRemoteMessage = true;\n try {\n if (message.type === \"removed\" && query) queryCache.remove(query);\n if (message.type === \"updated\") {\n if (!query) {\n queryCache.build(queryClient, { queryKey: message.queryKey, queryHash: message.queryHash }, message.state);\n } else if (isShareableQuery(query) && message.state.dataUpdatedAt >= query.state.dataUpdatedAt) {\n query.setState(message.state);\n }\n }\n } finally {\n applyingRemoteMessage = false;\n }\n });\n\n return () => {\n unsubscribe();\n channel.close();\n };\n}\n"],"mappings":"AAMO,SAAS,iBAAiB,OAAuB;AACtD,MAAI,MAAM,MAAM,WAAW,QAAS,QAAO;AAC3C,MAAI,MAAM,MAAM,YAAY,MAAO,QAAO;AAC1C,MAAI,MAAM,MAAM,kBAAkB,GAAI,QAAO;AAC7C,SAAO;AACT;AAEO,SAAS,2BAA2B,aAAsC;AAC/E,MAAI,OAAO,qBAAqB,YAAa,QAAO,MAAM;AAAA,EAAC;AAC3D,QAAM,UAAU,IAAI,iBAAiB,uBAAuB;AAC5D,QAAM,aAAa,YAAY,cAAc;AAC7C,MAAI,wBAAwB;AAE5B,QAAM,cAAc,WAAW,UAAU,CAAC,UAAU;AAClD,QAAI,sBAAuB;AAC3B,UAAM,EAAE,MAAM,IAAI;AAClB,UAAM,EAAE,WAAW,SAAS,IAAI;AAChC,QAAI,MAAM,SAAS,aAAa,MAAM,UAAU,SAAS,GAAG;AAC1D,cAAQ,YAAY,EAAE,MAAM,WAAW,WAAW,SAAS,CAAC;AAAA,IAC9D;AACA,QAAI,MAAM,SAAS,aAAa,MAAM,OAAO,SAAS,aAAa,iBAAiB,KAAK,GAAG;AAC1F,UAAI;AACF,gBAAQ,YAAY,EAAE,MAAM,WAAW,WAAW,UAAU,OAAO,MAAM,MAAM,CAAC;AAAA,MAClF,QAAQ;AACN,gBAAQ,KAAK,sCAAsC,SAAS;AAAA,MAC9D;AAAA,IACF;AAAA,EACF,CAAC;AAED,UAAQ,iBAAiB,WAAW,CAAC,UAAsC;AACzE,UAAM,UAAU,MAAM;AACtB,UAAM,QAAQ,WAAW,IAAI,QAAQ,SAAS;AAC9C,4BAAwB;AACxB,QAAI;AACF,UAAI,QAAQ,SAAS,aAAa,MAAO,YAAW,OAAO,KAAK;AAChE,UAAI,QAAQ,SAAS,WAAW;AAC9B,YAAI,CAAC,OAAO;AACV,qBAAW,MAAM,aAAa,EAAE,UAAU,QAAQ,UAAU,WAAW,QAAQ,UAAU,GAAG,QAAQ,KAAK;AAAA,QAC3G,WAAW,iBAAiB,KAAK,KAAK,QAAQ,MAAM,iBAAiB,MAAM,MAAM,eAAe;AAC9F,gBAAM,SAAS,QAAQ,KAAK;AAAA,QAC9B;AAAA,MACF;AAAA,IACF,UAAE;AACA,8BAAwB;AAAA,IAC1B;AAAA,EACF,CAAC;AAED,SAAO,MAAM;AACX,gBAAY;AACZ,YAAQ,MAAM;AAAA,EAChB;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/common",
3
- "version": "1.1.793",
3
+ "version": "1.1.795",
4
4
  "description": "Shared library for GreatApps frontend applications",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -1,33 +1,177 @@
1
+ 'use client';
2
+
3
+ import { useEffect, useRef, useState } from 'react';
4
+
5
+ /**
6
+ * Selo de sucesso com confetes — a arte de sempre, agora animada.
7
+ *
8
+ * A cada mount o selo entra com spring enquanto o contorno se desenha, o check risca em
9
+ * seguida e os confetes explodem do centro pra fora (os mais próximos primeiro), desenhando
10
+ * o traço no voo; depois ficam flutuando devagar, cada um no seu ritmo.
11
+ *
12
+ * ANIMAÇÃO: CSS puro injetado pelo próprio componente (mesmo padrão do `ImageCropModal`), e
13
+ * não classes vindas do `globals.css` de cada app como no `AiCreditsOfferModal`. Aqui isso
14
+ * importa: é um ícone folha que qualquer app pode renderizar, então carregar o CSS junto
15
+ * evita ter que replicar um bloco de keyframes nos quatro consumidores e mantê-los em sincronia.
16
+ *
17
+ * Comprimento de traço e vetor de explosão dependem da geometria de cada path, então são
18
+ * medidos no cliente (`getTotalLength`/`getBBox`) e injetados como CSS vars por elemento. Só
19
+ * ligamos a classe de play depois de medir — antes disso os traços ficam invisíveis, o que
20
+ * também deixa o `useEffect` (em vez de `useLayoutEffect`) seguro: não há flash de conteúdo
21
+ * não animado, e a lib não precisa supor se o consumidor renderiza no servidor.
22
+ */
23
+
24
+ const ANIMATION_CSS = `
25
+ .gp-confetti {
26
+ --gp-confetti-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%,
27
+ 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%,
28
+ 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%,
29
+ 1.003 76.9%, 1.004 83.8%, 1);
30
+ --gp-confetti-out: cubic-bezier(0.22, 1, 0.36, 1);
31
+ overflow: visible;
32
+ }
33
+ @supports not (animation-timing-function: linear(0, 1)) {
34
+ .gp-confetti { --gp-confetti-spring: cubic-bezier(0.34, 1.56, 0.64, 1); }
35
+ }
36
+ .gp-confetti path {
37
+ stroke-dasharray: var(--gp-len) calc(var(--gp-len) + 4px);
38
+ stroke-dashoffset: calc(var(--gp-len) + 2px);
39
+ transform-box: fill-box;
40
+ transform-origin: center;
41
+ opacity: 0;
42
+ }
43
+ .gp-confetti-seal {
44
+ transform-box: fill-box;
45
+ transform-origin: center;
46
+ opacity: 0;
47
+ transform: scale(0.4);
48
+ }
49
+ .gp-confetti--play .gp-confetti-seal {
50
+ animation:
51
+ gp-confetti-seal-pop 670ms var(--gp-confetti-spring) 80ms both,
52
+ gp-confetti-seal-breathe 3600ms ease-in-out 930ms infinite alternate;
53
+ }
54
+ .gp-confetti--play .gp-confetti-seal path { opacity: 1; }
55
+ .gp-confetti--play .gp-confetti-badge {
56
+ animation: gp-confetti-draw 470ms var(--gp-confetti-out) 95ms both;
57
+ }
58
+ .gp-confetti--play .gp-confetti-check {
59
+ animation: gp-confetti-draw 320ms var(--gp-confetti-out) 310ms both;
60
+ }
61
+ .gp-confetti-piece {
62
+ --gp-confetti-delay: calc(375ms + var(--gp-i, 0) * 28ms);
63
+ --gp-confetti-drawtime: 350ms;
64
+ }
65
+ .gp-confetti-squiggle { --gp-confetti-drawtime: 600ms; }
66
+ .gp-confetti--play .gp-confetti-piece {
67
+ animation:
68
+ gp-confetti-pop 735ms var(--gp-confetti-spring) var(--gp-confetti-delay) both,
69
+ gp-confetti-draw var(--gp-confetti-drawtime) var(--gp-confetti-out) var(--gp-confetti-delay) both,
70
+ gp-confetti-float var(--gp-fd, 3200ms) ease-in-out calc(var(--gp-confetti-delay) + 735ms) infinite alternate;
71
+ }
72
+ @keyframes gp-confetti-seal-pop { to { opacity: 1; transform: scale(1); } }
73
+ @keyframes gp-confetti-seal-breathe { from { transform: scale(1); } to { transform: scale(1.025); } }
74
+ @keyframes gp-confetti-draw { to { stroke-dashoffset: 0; } }
75
+ @keyframes gp-confetti-pop {
76
+ from { opacity: 0; transform: translate(var(--gp-tx, 0px), var(--gp-ty, 0px)) scale(0.2) rotate(var(--gp-rot0, 0deg)); }
77
+ to { opacity: var(--gp-op, 1); transform: translate(0, 0) scale(1) rotate(0deg); }
78
+ }
79
+ @keyframes gp-confetti-float {
80
+ from { opacity: var(--gp-op, 1); transform: translate(0, 0) rotate(0deg); }
81
+ to { opacity: calc(var(--gp-op, 1) * 0.55); transform: translate(var(--gp-fx, 0px), var(--gp-fy, 0px)) rotate(var(--gp-fr, 0deg)); }
82
+ }
83
+ @media (prefers-reduced-motion: reduce) {
84
+ .gp-confetti path,
85
+ .gp-confetti-seal { animation: none !important; }
86
+ .gp-confetti-seal { opacity: 1 !important; transform: none !important; }
87
+ .gp-confetti path {
88
+ opacity: var(--gp-op, 1) !important;
89
+ stroke-dashoffset: 0 !important;
90
+ transform: none !important;
91
+ }
92
+ }
93
+ `;
94
+
95
+ /** Centro do selo no viewBox — os confetes explodem a partir daqui. */
96
+ const CENTER = { x: 74.5, y: 41.5 };
97
+
98
+ const rand = (min: number, max: number) => min + Math.random() * (max - min);
99
+
1
100
  export function SuccessConfettiIcon({ className }: { className?: string }) {
101
+ const ref = useRef<SVGSVGElement>(null);
102
+ const [play, setPlay] = useState(false);
103
+
104
+ useEffect(() => {
105
+ const svg = ref.current;
106
+ if (!svg) return;
107
+
108
+ try {
109
+ svg.querySelectorAll<SVGPathElement>('path').forEach((path) => {
110
+ path.style.setProperty('--gp-len', `${path.getTotalLength().toFixed(2)}px`);
111
+ });
112
+
113
+ Array.from(svg.querySelectorAll<SVGPathElement>('.gp-confetti-piece'))
114
+ .map((path) => {
115
+ const box = path.getBBox();
116
+ const dx = box.x + box.width / 2 - CENTER.x;
117
+ const dy = box.y + box.height / 2 - CENTER.y;
118
+ return { path, dx, dy, dist: Math.hypot(dx, dy) };
119
+ })
120
+ .sort((a, b) => a.dist - b.dist)
121
+ .forEach(({ path, dx, dy }, i) => {
122
+ path.style.setProperty('--gp-i', String(i));
123
+ // começa mais perto do selo e voa pra posição final
124
+ path.style.setProperty('--gp-tx', `${(-dx * 0.55).toFixed(2)}px`);
125
+ path.style.setProperty('--gp-ty', `${(-dy * 0.55).toFixed(2)}px`);
126
+ path.style.setProperty('--gp-rot0', `${rand(-60, 60).toFixed(1)}deg`);
127
+ // deriva idle: pequena, lenta e diferente pra cada peça
128
+ path.style.setProperty('--gp-fx', `${rand(-2.2, 2.2).toFixed(2)}px`);
129
+ path.style.setProperty('--gp-fy', `${rand(-2.6, 2.6).toFixed(2)}px`);
130
+ path.style.setProperty('--gp-fr', `${rand(-16, 16).toFixed(1)}deg`);
131
+ path.style.setProperty('--gp-fd', `${Math.round(rand(2400, 4200))}ms`);
132
+ });
133
+ } catch {
134
+ // svg sem layout (display:none) — sem medidas o CSS cai pro traço inteiro, só anima pop/float
135
+ }
136
+
137
+ setPlay(true);
138
+ }, []);
139
+
2
140
  return (
3
- <svg
4
- width="149"
5
- height="83"
6
- viewBox="0 0 149 83"
7
- fill="none"
8
- xmlns="http://www.w3.org/2000/svg"
9
- className={className}
10
- aria-hidden
11
- >
12
- <path opacity="0.4" d="M18.6348 28.4102C18.6348 30.574 19.9096 30.8716 21.7838 31.1393" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
13
- <path opacity="0.4" d="M109.117 41.4266C110.106 41.3745 110.639 40.9023 110.797 39.957" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
14
- <path opacity="0.4" d="M64.6035 75.1963C62.2234 77.2378 61.7986 79.4524 63.2302 82.1283" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
15
- <path opacity="0.4" d="M108.953 6.33984C106.531 6.40444 105.075 7.59006 104.965 10.072C104.898 11.5735 105.114 12.692 103.285 13.0577" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
16
- <path opacity="0.4" d="M131.021 51.2682C130.631 53.6598 129.26 54.9429 126.786 54.7178C125.289 54.5817 124.21 54.217 123.601 55.9798" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
17
- <path opacity="0.4" d="M34.1753 59.0104C33.2963 61.0245 32.8213 61.1372 30.7893 61.1213C29.7394 61.1131 28.0011 61.8028 27.5653 62.8448" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
18
- <path d="M112.314 25.2715L113.514 24.7026" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
19
- <path d="M51.492 49.2344C51.0065 49.3838 50.6337 49.7823 50.2324 50.0741" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
20
- <path opacity="0.4" d="M77.8867 9.72656C77.4011 9.87596 77.3223 10.0019 77.3223 10.0019" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
21
- <path opacity="0.4" d="M10.7246 56.0059C10.239 56.1553 10.1602 56.2812 10.1602 56.2812" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
22
- <path opacity="0.4" d="M28.3302 80.1108C28.6726 79.7356 28.6766 79.587 28.6766 79.587" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
23
- <path opacity="0.4" d="M128.043 49.0421C127.77 48.6138 127.627 48.5713 127.627 48.5713" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
24
- <path opacity="0.4" d="M135.461 29.4915C134.972 29.6314 134.891 29.7558 134.891 29.7558" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
25
- <path opacity="0.4" d="M52.3396 22.1222C52.0664 21.6939 51.924 21.6514 51.924 21.6514" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
26
- <path d="M45.9383 40.1115L45.1508 39.1744" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
27
- <path opacity="0.8" d="M97.7421 69.0733C97.1523 69.9712 97.989 71.6124 98.5913 72.3132C99.7005 73.6036 100.945 73.8145 102.199 73.9149C103.234 73.9977 105.21 73.5621 105.476 72.3174C105.948 71.1367 104.935 69.8432 103.934 70.3872C102.571 71.1277 103.112 72.7192 103.73 73.7787C104.604 75.2776 105.879 76.6545 107.249 77.7108C108.333 78.5474 109.732 79.029 110.308 79.0142" stroke="#12B76A" strokeWidth="1.41098" strokeLinecap="round"/>
28
- <path d="M55.1022 11.4613C55.7297 11.187 55.8499 9.89737 55.7699 9.24592C55.6225 8.04626 55.0286 7.4129 54.3908 6.83895C53.8646 6.36537 52.6539 5.803 52.0797 6.41026C51.4175 6.89618 51.5122 8.05793 52.2377 8.15673C53.2253 8.2912 53.4868 7.15184 53.5227 6.28731C53.5734 5.06421 53.367 3.74644 52.9989 2.5746C52.7073 1.64647 52.1242 0.793399 51.8104 0.565035" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
29
- <path fillRule="evenodd" clipRule="evenodd" d="M58.1139 44.0572L60.4163 47.0706L60.9134 50.8219C61.1889 52.9028 62.8247 54.5405 64.9056 54.818L68.6666 55.3208L71.678 57.6214C73.3446 58.8949 75.6548 58.8949 77.3214 57.6214L80.3348 55.3189H80.3309L84.0842 54.8218C86.1651 54.5463 87.8028 52.9105 88.0802 50.8297L88.5812 47.0687C88.5812 47.0706 89.7449 45.5466 90.8836 44.0572C92.1572 42.3906 92.1553 40.0805 90.8836 38.4138L88.585 35.3985L88.0879 31.6472C87.8124 29.5663 86.1766 27.9286 84.0958 27.6512L80.3329 27.1502L77.3214 24.8497C75.6548 23.5761 73.3446 23.5761 71.678 24.8497L68.6646 27.1502H68.6685L64.9152 27.6492C62.8344 27.9248 61.1966 29.5605 60.9192 31.6414L60.4163 35.4024C60.4163 35.4004 59.2526 36.9245 58.1139 38.4138C56.8422 40.0785 56.8422 42.3906 58.1139 44.0572V44.0572Z" stroke="#12B76A" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
30
- <path d="M79.9009 38.541L73.1554 45.2865L69.1035 41.2384" stroke="#12B76A" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
31
- </svg>
141
+ <>
142
+ <style>{ANIMATION_CSS}</style>
143
+ <svg
144
+ ref={ref}
145
+ width="149"
146
+ height="83"
147
+ viewBox="0 0 149 83"
148
+ fill="none"
149
+ xmlns="http://www.w3.org/2000/svg"
150
+ className={['gp-confetti', play && 'gp-confetti--play', className].filter(Boolean).join(' ')}
151
+ aria-hidden
152
+ >
153
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M18.6348 28.4102C18.6348 30.574 19.9096 30.8716 21.7838 31.1393" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
154
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M109.117 41.4266C110.106 41.3745 110.639 40.9023 110.797 39.957" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
155
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M64.6035 75.1963C62.2234 77.2378 61.7986 79.4524 63.2302 82.1283" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
156
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M108.953 6.33984C106.531 6.40444 105.075 7.59006 104.965 10.072C104.898 11.5735 105.114 12.692 103.285 13.0577" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
157
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M131.021 51.2682C130.631 53.6598 129.26 54.9429 126.786 54.7178C125.289 54.5817 124.21 54.217 123.601 55.9798" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
158
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M34.1753 59.0104C33.2963 61.0245 32.8213 61.1372 30.7893 61.1213C29.7394 61.1131 28.0011 61.8028 27.5653 62.8448" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
159
+ <path className="gp-confetti-piece" style={{ '--gp-op': 1 } as React.CSSProperties} d="M112.314 25.2715L113.514 24.7026" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
160
+ <path className="gp-confetti-piece" style={{ '--gp-op': 1 } as React.CSSProperties} d="M51.492 49.2344C51.0065 49.3838 50.6337 49.7823 50.2324 50.0741" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
161
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M77.8867 9.72656C77.4011 9.87596 77.3223 10.0019 77.3223 10.0019" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
162
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M10.7246 56.0059C10.239 56.1553 10.1602 56.2812 10.1602 56.2812" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
163
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M28.3302 80.1108C28.6726 79.7356 28.6766 79.587 28.6766 79.587" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
164
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M128.043 49.0421C127.77 48.6138 127.627 48.5713 127.627 48.5713" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
165
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M135.461 29.4915C134.972 29.6314 134.891 29.7558 134.891 29.7558" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
166
+ <path className="gp-confetti-piece" style={{ '--gp-op': 0.4 } as React.CSSProperties} d="M52.3396 22.1222C52.0664 21.6939 51.924 21.6514 51.924 21.6514" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
167
+ <path className="gp-confetti-piece" style={{ '--gp-op': 1 } as React.CSSProperties} d="M45.9383 40.1115L45.1508 39.1744" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
168
+ <path className="gp-confetti-piece gp-confetti-squiggle" style={{ '--gp-op': 0.8 } as React.CSSProperties} d="M97.7421 69.0733C97.1523 69.9712 97.989 71.6124 98.5913 72.3132C99.7005 73.6036 100.945 73.8145 102.199 73.9149C103.234 73.9977 105.21 73.5621 105.476 72.3174C105.948 71.1367 104.935 69.8432 103.934 70.3872C102.571 71.1277 103.112 72.7192 103.73 73.7787C104.604 75.2776 105.879 76.6545 107.249 77.7108C108.333 78.5474 109.732 79.029 110.308 79.0142" stroke="#12B76A" strokeWidth="1.41098" strokeLinecap="round"/>
169
+ <path className="gp-confetti-piece gp-confetti-squiggle" style={{ '--gp-op': 1 } as React.CSSProperties} d="M55.1022 11.4613C55.7297 11.187 55.8499 9.89737 55.7699 9.24592C55.6225 8.04626 55.0286 7.4129 54.3908 6.83895C53.8646 6.36537 52.6539 5.803 52.0797 6.41026C51.4175 6.89618 51.5122 8.05793 52.2377 8.15673C53.2253 8.2912 53.4868 7.15184 53.5227 6.28731C53.5734 5.06421 53.367 3.74644 52.9989 2.5746C52.7073 1.64647 52.1242 0.793399 51.8104 0.565035" stroke="#12B76A" strokeWidth="1.12879" strokeLinecap="round"/>
170
+ <g className="gp-confetti-seal">
171
+ <path className="gp-confetti-badge" fillRule="evenodd" clipRule="evenodd" d="M58.1139 44.0572L60.4163 47.0706L60.9134 50.8219C61.1889 52.9028 62.8247 54.5405 64.9056 54.818L68.6666 55.3208L71.678 57.6214C73.3446 58.8949 75.6548 58.8949 77.3214 57.6214L80.3348 55.3189H80.3309L84.0842 54.8218C86.1651 54.5463 87.8028 52.9105 88.0802 50.8297L88.5812 47.0687C88.5812 47.0706 89.7449 45.5466 90.8836 44.0572C92.1572 42.3906 92.1553 40.0805 90.8836 38.4138L88.585 35.3985L88.0879 31.6472C87.8124 29.5663 86.1766 27.9286 84.0958 27.6512L80.3329 27.1502L77.3214 24.8497C75.6548 23.5761 73.3446 23.5761 71.678 24.8497L68.6646 27.1502H68.6685L64.9152 27.6492C62.8344 27.9248 61.1966 29.5605 60.9192 31.6414L60.4163 35.4024C60.4163 35.4004 59.2526 36.9245 58.1139 38.4138C56.8422 40.0785 56.8422 42.3906 58.1139 44.0572V44.0572Z" stroke="#12B76A" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
172
+ <path className="gp-confetti-check" d="M79.9009 38.541L73.1554 45.2865L69.1035 41.2384" stroke="#12B76A" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
173
+ </g>
174
+ </svg>
175
+ </>
32
176
  );
33
177
  }
@@ -12,8 +12,8 @@ import {
12
12
  PersistedClient,
13
13
  PersistQueryClientProvider,
14
14
  } from "@tanstack/react-query-persist-client";
15
- import { broadcastQueryClient } from "@tanstack/query-broadcast-client-experimental";
16
15
  import { set, get, del } from "idb-keyval";
16
+ import { isShareableQuery, shareQueryCacheBetweenTabs } from "./share-query-cache";
17
17
 
18
18
  // React Query Devtools só em desenvolvimento - remove do bundle de produção
19
19
  const ReactQueryDevtools =
@@ -80,12 +80,7 @@ export function QueryProvider({
80
80
  }),
81
81
  );
82
82
 
83
- useEffect(() => {
84
- broadcastQueryClient({
85
- queryClient,
86
- broadcastChannel: "react-query",
87
- });
88
- }, [queryClient]);
83
+ useEffect(() => shareQueryCacheBetweenTabs(queryClient), [queryClient]);
89
84
 
90
85
  return (
91
86
  <PersistQueryClientProvider
@@ -95,12 +90,7 @@ export function QueryProvider({
95
90
  maxAge: 2 * 60 * 60 * 1000,
96
91
  buster: persisterVersion,
97
92
  dehydrateOptions: {
98
- shouldDehydrateQuery: (query) => {
99
- if (query.state.status === "error") return false;
100
- if (query.meta?.persist === false) return false;
101
- if ((query.state.dataUpdateCount ?? 0) > 10) return false;
102
- return true;
103
- },
93
+ shouldDehydrateQuery: isShareableQuery,
104
94
  },
105
95
  }}
106
96
  >
@@ -0,0 +1,58 @@
1
+ import type { Query, QueryClient, QueryKey, QueryState } from "@tanstack/react-query";
2
+
3
+ type CacheMessage =
4
+ | { type: "removed"; queryHash: string; queryKey: QueryKey }
5
+ | { type: "updated"; queryHash: string; queryKey: QueryKey; state: QueryState };
6
+
7
+ export function isShareableQuery(query: Query): boolean {
8
+ if (query.state.status === "error") return false;
9
+ if (query.meta?.persist === false) return false;
10
+ if (query.state.dataUpdateCount > 10) return false;
11
+ return true;
12
+ }
13
+
14
+ export function shareQueryCacheBetweenTabs(queryClient: QueryClient): () => void {
15
+ if (typeof BroadcastChannel === "undefined") return () => {};
16
+ const channel = new BroadcastChannel("greatapps-query-cache");
17
+ const queryCache = queryClient.getQueryCache();
18
+ let applyingRemoteMessage = false;
19
+
20
+ const unsubscribe = queryCache.subscribe((event) => {
21
+ if (applyingRemoteMessage) return;
22
+ const { query } = event;
23
+ const { queryHash, queryKey } = query;
24
+ if (event.type === "removed" && query.observers.length > 0) {
25
+ channel.postMessage({ type: "removed", queryHash, queryKey });
26
+ }
27
+ if (event.type === "updated" && event.action.type === "success" && isShareableQuery(query)) {
28
+ try {
29
+ channel.postMessage({ type: "updated", queryHash, queryKey, state: query.state });
30
+ } catch {
31
+ console.warn("Falha ao espelhar query entre abas", queryHash);
32
+ }
33
+ }
34
+ });
35
+
36
+ channel.addEventListener("message", (event: MessageEvent<CacheMessage>) => {
37
+ const message = event.data;
38
+ const query = queryCache.get(message.queryHash);
39
+ applyingRemoteMessage = true;
40
+ try {
41
+ if (message.type === "removed" && query) queryCache.remove(query);
42
+ if (message.type === "updated") {
43
+ if (!query) {
44
+ queryCache.build(queryClient, { queryKey: message.queryKey, queryHash: message.queryHash }, message.state);
45
+ } else if (isShareableQuery(query) && message.state.dataUpdatedAt >= query.state.dataUpdatedAt) {
46
+ query.setState(message.state);
47
+ }
48
+ }
49
+ } finally {
50
+ applyingRemoteMessage = false;
51
+ }
52
+ });
53
+
54
+ return () => {
55
+ unsubscribe();
56
+ channel.close();
57
+ };
58
+ }