@12-apps/mcp 3.1.0 → 3.2.1

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.
@@ -0,0 +1,1183 @@
1
+ import {
2
+ AI_CAPABILITIES,
3
+ AI_PERMISSION_MODEL,
4
+ aiConnectPrompt,
5
+ aiHostGuides,
6
+ providerForHostId
7
+ } from "../chunk-FYEVBTDU.js";
8
+ import {
9
+ __name
10
+ } from "../chunk-7QVYU63E.js";
11
+
12
+ // src/react/ai-onboarding.tsx
13
+ import {
14
+ GuidedSection,
15
+ OnboardingProvider,
16
+ useOnboarding
17
+ } from "@12-apps/onboarding";
18
+
19
+ // src/react/ai-landing.tsx
20
+ import BoltOutlinedIcon from "@mui/icons-material/BoltOutlined";
21
+ import LanguageOutlinedIcon from "@mui/icons-material/LanguageOutlined";
22
+ import LockOpenOutlinedIcon from "@mui/icons-material/LockOpenOutlined";
23
+ import VerifiedUserOutlinedIcon from "@mui/icons-material/VerifiedUserOutlined";
24
+ import { Button } from "@12-apps/ui/form/Button";
25
+ import { Box as Box4 } from "@12-apps/ui/mui/Box";
26
+ import { Stack as Stack2 } from "@12-apps/ui/mui/Stack";
27
+ import { Text as Text3 } from "@12-apps/ui/typography/Text";
28
+
29
+ // src/react/ai-capabilities.tsx
30
+ import { Box as Box2 } from "@12-apps/ui/mui/Box";
31
+ import { Text } from "@12-apps/ui/typography/Text";
32
+
33
+ // src/react/ai-icons.tsx
34
+ import AutoAwesomeIcon from "@mui/icons-material/AutoAwesome";
35
+ import CategoryIcon from "@mui/icons-material/Category";
36
+ import HubIcon from "@mui/icons-material/Hub";
37
+ import Inventory2Icon from "@mui/icons-material/Inventory2";
38
+ import QueryStatsIcon from "@mui/icons-material/QueryStats";
39
+ import ReceiptLongIcon from "@mui/icons-material/ReceiptLong";
40
+ import { Box } from "@12-apps/ui/mui/Box";
41
+ import { jsx } from "react/jsx-runtime";
42
+ var BRAND = {
43
+ claude: { bg: "#D97757", Icon: AutoAwesomeIcon, label: "Claude (Anthropic)" },
44
+ openai: { bg: "#10A37F", Icon: HubIcon, label: "OpenAI" }
45
+ };
46
+ function HostBrandAvatar({
47
+ brand,
48
+ size = 40
49
+ }) {
50
+ const { bg, Icon, label } = BRAND[brand];
51
+ return /* @__PURE__ */ jsx(
52
+ Box,
53
+ {
54
+ "aria-label": label,
55
+ sx: {
56
+ width: size,
57
+ height: size,
58
+ borderRadius: "50%",
59
+ bgcolor: bg,
60
+ color: "#fff",
61
+ display: "flex",
62
+ alignItems: "center",
63
+ justifyContent: "center",
64
+ flexShrink: 0
65
+ },
66
+ children: /* @__PURE__ */ jsx(Icon, { sx: { fontSize: size * 0.55 } })
67
+ }
68
+ );
69
+ }
70
+ __name(HostBrandAvatar, "HostBrandAvatar");
71
+ var CAPABILITY_ICON = {
72
+ orders: ReceiptLongIcon,
73
+ inventory: Inventory2Icon,
74
+ catalog: CategoryIcon,
75
+ sales: QueryStatsIcon
76
+ };
77
+ function CapabilityIcon({
78
+ id,
79
+ fontSize = 24
80
+ }) {
81
+ const Icon = CAPABILITY_ICON[id] ?? AutoAwesomeIcon;
82
+ return /* @__PURE__ */ jsx(Icon, { sx: { fontSize } });
83
+ }
84
+ __name(CapabilityIcon, "CapabilityIcon");
85
+
86
+ // src/react/ai-capabilities.tsx
87
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
88
+ function CapabilityCard({ capability }) {
89
+ return /* @__PURE__ */ jsxs(
90
+ Box2,
91
+ {
92
+ "data-testid": `ai-capability-${capability.id}`,
93
+ sx: {
94
+ p: 2.5,
95
+ borderRadius: 3,
96
+ border: 1,
97
+ borderColor: "divider",
98
+ bgcolor: "background.paper",
99
+ height: "100%",
100
+ // Static transition string: safe to cross the server→client boundary.
101
+ transition: "border-color 200ms, box-shadow 200ms, transform 200ms",
102
+ "&:hover": { borderColor: "primary.main", boxShadow: 3, transform: "translateY(-3px)" }
103
+ },
104
+ children: [
105
+ /* @__PURE__ */ jsx2(
106
+ Box2,
107
+ {
108
+ sx: {
109
+ width: 44,
110
+ height: 44,
111
+ borderRadius: 2,
112
+ display: "flex",
113
+ alignItems: "center",
114
+ justifyContent: "center",
115
+ bgcolor: "primary.main",
116
+ color: "primary.contrastText",
117
+ mb: 1.5
118
+ },
119
+ children: /* @__PURE__ */ jsx2(CapabilityIcon, { id: capability.id, fontSize: 26 })
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsx2(Text, { variant: "body", weight: "bold", as: "h3", children: capability.title }),
123
+ /* @__PURE__ */ jsx2(
124
+ Box2,
125
+ {
126
+ "data-testid": `ai-capability-prompt-${capability.id}`,
127
+ sx: {
128
+ mt: 1,
129
+ px: 1.5,
130
+ py: 1,
131
+ borderRadius: 2,
132
+ borderBottomLeftRadius: 4,
133
+ bgcolor: "action.hover",
134
+ border: 1,
135
+ borderColor: "divider"
136
+ },
137
+ children: /* @__PURE__ */ jsx2(Text, { variant: "body", size: "sm", as: "p", color: "secondary", children: capability.detail })
138
+ }
139
+ )
140
+ ]
141
+ }
142
+ );
143
+ }
144
+ __name(CapabilityCard, "CapabilityCard");
145
+ function AiCapabilities({
146
+ capabilities = AI_CAPABILITIES
147
+ }) {
148
+ return /* @__PURE__ */ jsxs(Box2, { "data-testid": "ai-capability-examples", sx: { width: "100%" }, children: [
149
+ /* @__PURE__ */ jsxs(Box2, { sx: { mb: 3 }, children: [
150
+ /* @__PURE__ */ jsx2(Text, { variant: "heading", size: "sm", as: "h2", children: "O que o assistente faz por voc\xEA" }),
151
+ /* @__PURE__ */ jsx2(Box2, { sx: { mt: 0.5 }, children: /* @__PURE__ */ jsx2(Text, { variant: "body", size: "sm", as: "p", color: "secondary", children: "Sem planilhas, sem cliques \u2014 \xE9 s\xF3 perguntar na conversa." }) })
152
+ ] }),
153
+ /* @__PURE__ */ jsx2(
154
+ Box2,
155
+ {
156
+ sx: {
157
+ display: "grid",
158
+ gap: 3,
159
+ gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr", md: "repeat(4, 1fr)" }
160
+ },
161
+ children: capabilities.map((capability) => /* @__PURE__ */ jsx2(CapabilityCard, { capability }, capability.id))
162
+ }
163
+ )
164
+ ] });
165
+ }
166
+ __name(AiCapabilities, "AiCapabilities");
167
+
168
+ // src/react/feature-badge.tsx
169
+ import { Box as Box3 } from "@12-apps/ui/mui/Box";
170
+ import { Stack } from "@12-apps/ui/mui/Stack";
171
+ import { Text as Text2 } from "@12-apps/ui/typography/Text";
172
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
173
+ function FeatureBadge({ icon, label, caption }) {
174
+ return /* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1.5, alignItems: "flex-start", children: [
175
+ /* @__PURE__ */ jsx3(
176
+ Box3,
177
+ {
178
+ sx: {
179
+ width: 36,
180
+ height: 36,
181
+ borderRadius: 2,
182
+ display: "flex",
183
+ alignItems: "center",
184
+ justifyContent: "center",
185
+ bgcolor: "background.paper",
186
+ color: "primary.main",
187
+ border: 1,
188
+ borderColor: "divider",
189
+ flexShrink: 0
190
+ },
191
+ children: icon
192
+ }
193
+ ),
194
+ /* @__PURE__ */ jsxs2(Box3, { children: [
195
+ /* @__PURE__ */ jsx3(Text2, { variant: "body", size: "sm", weight: "bold", as: "p", children: label }),
196
+ /* @__PURE__ */ jsx3(Text2, { variant: "caption", color: "secondary", as: "p", children: caption })
197
+ ] })
198
+ ] });
199
+ }
200
+ __name(FeatureBadge, "FeatureBadge");
201
+
202
+ // src/react/ai-landing.tsx
203
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
204
+ var FEATURES = [
205
+ { icon: /* @__PURE__ */ jsx4(LockOpenOutlinedIcon, {}), label: "Usa o seu pr\xF3prio login", caption: "Sem chaves ou credenciais extras" },
206
+ { icon: /* @__PURE__ */ jsx4(BoltOutlinedIcon, {}), label: "Sem instalar nada", caption: "Conecta em poucos minutos" },
207
+ { icon: /* @__PURE__ */ jsx4(VerifiedUserOutlinedIcon, {}), label: "S\xF3 o que voc\xEA pode", caption: "As suas permiss\xF5es, nada al\xE9m" },
208
+ { icon: /* @__PURE__ */ jsx4(LanguageOutlinedIcon, {}), label: "Navegador ou app", caption: "Claude, ChatGPT, Codex" }
209
+ ];
210
+ function Hero({ onStart }) {
211
+ return /* @__PURE__ */ jsxs3(Stack2, { spacing: 2.5, sx: { maxWidth: 680 }, children: [
212
+ /* @__PURE__ */ jsx4(
213
+ Box4,
214
+ {
215
+ sx: {
216
+ color: "primary.main",
217
+ fontSize: 12,
218
+ fontWeight: 700,
219
+ letterSpacing: 1.2,
220
+ textTransform: "uppercase"
221
+ },
222
+ children: "Integra\xE7\xE3o com IA"
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsxs3(Text3, { variant: "heading", size: "xl", weight: "bold", as: "h1", children: [
226
+ "Conecte",
227
+ " ",
228
+ /* @__PURE__ */ jsx4(Box4, { component: "span", sx: { color: "primary.main" }, children: "assistentes de IA" }),
229
+ " ",
230
+ "\xE0 sua loja"
231
+ ] }),
232
+ /* @__PURE__ */ jsx4(Text3, { variant: "body", color: "secondary", as: "p", children: "Deixe o Claude, o ChatGPT e outros assistentes responderem sobre o seu card\xE1pio, estoque e pedidos \u2014 e executarem a\xE7\xF5es por voc\xEA, direto na conversa. Com seguran\xE7a e sem instalar nada." }),
233
+ /* @__PURE__ */ jsx4(Box4, { sx: { pt: 1 }, children: /* @__PURE__ */ jsx4(Button, { onClick: onStart, "data-testid": "ai-landing-start", children: "Ver como conectar" }) })
234
+ ] });
235
+ }
236
+ __name(Hero, "Hero");
237
+ function AiLanding({
238
+ onStart,
239
+ permissionModel = AI_PERMISSION_MODEL,
240
+ capabilities = AI_CAPABILITIES
241
+ }) {
242
+ return /* @__PURE__ */ jsxs3(Stack2, { spacing: 6, "data-testid": "ai-landing", children: [
243
+ /* @__PURE__ */ jsx4(Hero, { onStart }),
244
+ /* @__PURE__ */ jsxs3(
245
+ Stack2,
246
+ {
247
+ direction: "row",
248
+ spacing: 1.5,
249
+ alignItems: "flex-start",
250
+ "data-testid": "ai-permission-callout",
251
+ sx: {
252
+ p: 2,
253
+ borderRadius: 2,
254
+ bgcolor: "action.hover",
255
+ border: 1,
256
+ borderColor: "divider"
257
+ },
258
+ children: [
259
+ /* @__PURE__ */ jsx4(VerifiedUserOutlinedIcon, { sx: { color: "success.main", mt: 0.25 } }),
260
+ /* @__PURE__ */ jsx4(Text3, { variant: "body", as: "p", children: permissionModel })
261
+ ]
262
+ }
263
+ ),
264
+ /* @__PURE__ */ jsx4(
265
+ Box4,
266
+ {
267
+ sx: {
268
+ p: { xs: 2.5, md: 3 },
269
+ borderRadius: 3,
270
+ bgcolor: "action.hover",
271
+ border: 1,
272
+ borderColor: "divider"
273
+ },
274
+ children: /* @__PURE__ */ jsx4(
275
+ Box4,
276
+ {
277
+ sx: {
278
+ display: "grid",
279
+ gap: 3,
280
+ gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr", md: "repeat(4, 1fr)" }
281
+ },
282
+ children: FEATURES.map((f) => /* @__PURE__ */ jsx4(FeatureBadge, { icon: f.icon, label: f.label, caption: f.caption }, f.label))
283
+ }
284
+ )
285
+ }
286
+ ),
287
+ /* @__PURE__ */ jsx4(Box4, { children: /* @__PURE__ */ jsx4(AiCapabilities, { capabilities }) })
288
+ ] });
289
+ }
290
+ __name(AiLanding, "AiLanding");
291
+
292
+ // src/react/ai-connection-utils.ts
293
+ var PROVIDER_LABEL = {
294
+ claude: "Claude",
295
+ chatgpt: "ChatGPT",
296
+ codex: "Codex"
297
+ };
298
+ function resolveHost(hosts, hostId) {
299
+ const found = hosts.find((h) => h.id === hostId) ?? hosts[0];
300
+ if (!found) throw new Error("resolveHost: hosts array must not be empty");
301
+ return found;
302
+ }
303
+ __name(resolveHost, "resolveHost");
304
+ function hostLabel(hosts, hostId) {
305
+ return hosts.find((h) => h.id === hostId)?.label ?? "seu assistente";
306
+ }
307
+ __name(hostLabel, "hostLabel");
308
+ function connectionForHost(connections, hostId) {
309
+ const provider = typeof hostId === "string" ? providerForHostId(hostId) : null;
310
+ if (!provider) return connections.find((c) => c.host === null) ?? connections[0] ?? null;
311
+ return connections.find((c) => c.host === provider) ?? connections.find((c) => c.host === null) ?? null;
312
+ }
313
+ __name(connectionForHost, "connectionForHost");
314
+ function activeAgo(date) {
315
+ const minutes = Math.max(0, Math.floor((Date.now() - date.getTime()) / 6e4));
316
+ if (minutes < 1) return "ativo agora";
317
+ if (minutes < 60) return `ativo h\xE1 ${minutes} min`;
318
+ const hours = Math.floor(minutes / 60);
319
+ if (hours < 24) return `ativo h\xE1 ${hours} h`;
320
+ return `ativo h\xE1 ${Math.floor(hours / 24)} dias`;
321
+ }
322
+ __name(activeAgo, "activeAgo");
323
+ function mostRecent(connections) {
324
+ return connections.reduce(
325
+ (best, c) => !best || c.lastActiveAt.getTime() > best.lastActiveAt.getTime() ? c : best,
326
+ null
327
+ );
328
+ }
329
+ __name(mostRecent, "mostRecent");
330
+ function connectedTitle(connections, hosts, connectedHostId) {
331
+ const providers = [...new Set(connections.map((c) => c.host).filter((h) => h !== null))];
332
+ if (providers.length === 1) return `${PROVIDER_LABEL[providers[0]]} Conectado`;
333
+ if (providers.length > 1) {
334
+ return `${providers.map((p) => PROVIDER_LABEL[p]).join(", ")} conectados`;
335
+ }
336
+ if (connections.length > 0) return `${hostLabel(hosts, connectedHostId)} Conectado`;
337
+ return "IA conectada";
338
+ }
339
+ __name(connectedTitle, "connectedTitle");
340
+ function connectedSummary(connections) {
341
+ const recent = mostRecent(connections);
342
+ if (!recent) return "Integra\xE7\xE3o configurada";
343
+ return activeAgo(recent.lastActiveAt);
344
+ }
345
+ __name(connectedSummary, "connectedSummary");
346
+
347
+ // src/react/ai-flow-steps.tsx
348
+ import CheckCircleIcon from "@mui/icons-material/CheckCircle";
349
+ import OpenInNewIcon2 from "@mui/icons-material/OpenInNew";
350
+ import { useEffect, useState as useState2 } from "react";
351
+ import { Progress } from "@12-apps/ui/data-display/Progress";
352
+ import { Button as Button3 } from "@12-apps/ui/form/Button";
353
+ import { Box as Box6 } from "@12-apps/ui/mui/Box";
354
+ import { Stack as Stack4 } from "@12-apps/ui/mui/Stack";
355
+ import { Text as Text5 } from "@12-apps/ui/typography/Text";
356
+
357
+ // src/react/host-connect-guide.tsx
358
+ import CheckIcon from "@mui/icons-material/Check";
359
+ import ContentCopyOutlinedIcon from "@mui/icons-material/ContentCopyOutlined";
360
+ import OpenInNewIcon from "@mui/icons-material/OpenInNew";
361
+ import { useState } from "react";
362
+ import { Button as Button2 } from "@12-apps/ui/form/Button";
363
+ import { Box as Box5 } from "@12-apps/ui/mui/Box";
364
+ import { Stack as Stack3 } from "@12-apps/ui/mui/Stack";
365
+ import { Text as Text4 } from "@12-apps/ui/typography/Text";
366
+
367
+ // src/react/mcp-endpoint-url.tsx
368
+ import { Code } from "@12-apps/ui/typography/Code";
369
+ import { jsx as jsx5 } from "react/jsx-runtime";
370
+ function McpEndpointUrl({
371
+ url,
372
+ copyable = true
373
+ }) {
374
+ return /* @__PURE__ */ jsx5(Code, { variant: "block", copyable, "data-testid": "mcp-endpoint-url", children: url });
375
+ }
376
+ __name(McpEndpointUrl, "McpEndpointUrl");
377
+
378
+ // src/react/host-connect-guide.tsx
379
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
380
+ function EndpointCopyBlock({
381
+ endpointUrl,
382
+ copied,
383
+ onCopy
384
+ }) {
385
+ const handleClick = /* @__PURE__ */ __name(() => {
386
+ if (typeof navigator !== "undefined" && navigator.clipboard) {
387
+ void navigator.clipboard.writeText(endpointUrl).catch(() => void 0);
388
+ }
389
+ onCopy();
390
+ }, "handleClick");
391
+ return /* @__PURE__ */ jsxs4(
392
+ Box5,
393
+ {
394
+ sx: {
395
+ p: 2,
396
+ borderRadius: 2,
397
+ border: 1,
398
+ borderColor: "primary.main",
399
+ bgcolor: "action.hover"
400
+ },
401
+ children: [
402
+ /* @__PURE__ */ jsx6(Text4, { variant: "caption", as: "p", weight: "bold", children: "URL do servidor da sua loja" }),
403
+ /* @__PURE__ */ jsx6(Text4, { variant: "caption", as: "p", color: "secondary", children: "Copie esta URL e cole no seu assistente para conect\xE1-lo \xE0 loja." }),
404
+ /* @__PURE__ */ jsx6(Box5, { sx: { mt: 1 }, children: /* @__PURE__ */ jsx6(McpEndpointUrl, { url: endpointUrl, copyable: false }) }),
405
+ /* @__PURE__ */ jsx6(Box5, { sx: { mt: 1.5 }, children: /* @__PURE__ */ jsxs4(Button2, { onClick: handleClick, "data-testid": "ai-copy-endpoint", children: [
406
+ copied ? /* @__PURE__ */ jsx6(CheckIcon, { sx: { fontSize: 18, mr: 0.5 } }) : /* @__PURE__ */ jsx6(ContentCopyOutlinedIcon, { sx: { fontSize: 18, mr: 0.5 } }),
407
+ copied ? "Copiado" : "Copiar URL"
408
+ ] }) })
409
+ ]
410
+ }
411
+ );
412
+ }
413
+ __name(EndpointCopyBlock, "EndpointCopyBlock");
414
+ function PromptCopyBlock({
415
+ title,
416
+ caption,
417
+ message
418
+ }) {
419
+ const [copied, setCopied] = useState(false);
420
+ const handleClick = /* @__PURE__ */ __name(() => {
421
+ if (typeof navigator !== "undefined" && navigator.clipboard) {
422
+ void navigator.clipboard.writeText(message).catch(() => void 0);
423
+ }
424
+ setCopied(true);
425
+ }, "handleClick");
426
+ return /* @__PURE__ */ jsxs4(
427
+ Box5,
428
+ {
429
+ sx: {
430
+ p: 2,
431
+ borderRadius: 2,
432
+ border: 1,
433
+ borderColor: "primary.main",
434
+ bgcolor: "action.hover"
435
+ },
436
+ children: [
437
+ /* @__PURE__ */ jsx6(Text4, { variant: "caption", as: "p", weight: "bold", children: title }),
438
+ /* @__PURE__ */ jsx6(Text4, { variant: "caption", as: "p", color: "secondary", children: caption }),
439
+ /* @__PURE__ */ jsx6(
440
+ Box5,
441
+ {
442
+ sx: {
443
+ mt: 1,
444
+ p: 1.5,
445
+ borderRadius: 1,
446
+ border: 1,
447
+ borderColor: "divider",
448
+ bgcolor: "background.paper",
449
+ whiteSpace: "pre-line"
450
+ },
451
+ children: /* @__PURE__ */ jsx6(Text4, { variant: "body", size: "sm", as: "p", children: message })
452
+ }
453
+ ),
454
+ /* @__PURE__ */ jsx6(Box5, { sx: { mt: 1.5 }, children: /* @__PURE__ */ jsxs4(Button2, { onClick: handleClick, "data-testid": "ai-copy-prompt", children: [
455
+ copied ? /* @__PURE__ */ jsx6(CheckIcon, { sx: { fontSize: 18, mr: 0.5 } }) : /* @__PURE__ */ jsx6(ContentCopyOutlinedIcon, { sx: { fontSize: 18, mr: 0.5 } }),
456
+ copied ? "Copiado" : "Copiar mensagem"
457
+ ] }) })
458
+ ]
459
+ }
460
+ );
461
+ }
462
+ __name(PromptCopyBlock, "PromptCopyBlock");
463
+ function HostConnectHeader({ host }) {
464
+ return /* @__PURE__ */ jsxs4(Stack3, { direction: "row", spacing: 1.5, alignItems: "center", children: [
465
+ /* @__PURE__ */ jsx6(HostBrandAvatar, { brand: host.brand, size: 36 }),
466
+ /* @__PURE__ */ jsxs4(Text4, { variant: "heading", size: "sm", as: "h3", children: [
467
+ "Conectar no ",
468
+ host.label
469
+ ] })
470
+ ] });
471
+ }
472
+ __name(HostConnectHeader, "HostConnectHeader");
473
+ function HostOpenButton({
474
+ host,
475
+ onOpen
476
+ }) {
477
+ if (!host.link) return null;
478
+ return /* @__PURE__ */ jsx6(Box5, { children: /* @__PURE__ */ jsxs4(
479
+ Button2,
480
+ {
481
+ onClick: () => {
482
+ window.open(host.link.url, "_blank", "noopener,noreferrer");
483
+ onOpen?.();
484
+ },
485
+ "data-testid": `ai-host-link-${host.id}`,
486
+ children: [
487
+ host.link.label,
488
+ /* @__PURE__ */ jsx6(OpenInNewIcon, { sx: { fontSize: 16, ml: 0.5 } })
489
+ ]
490
+ }
491
+ ) });
492
+ }
493
+ __name(HostOpenButton, "HostOpenButton");
494
+ function HostDocsLink({ host }) {
495
+ if (!host.docs) return null;
496
+ return /* @__PURE__ */ jsxs4(Text4, { variant: "caption", as: "p", color: "secondary", children: [
497
+ "Para mais informa\xE7\xF5es, consulte a",
498
+ " ",
499
+ /* @__PURE__ */ jsx6(
500
+ Box5,
501
+ {
502
+ component: "a",
503
+ href: host.docs.url,
504
+ target: "_blank",
505
+ rel: "noopener noreferrer",
506
+ "data-testid": `ai-host-docs-${host.id}`,
507
+ sx: { color: "primary.main", textDecoration: "underline" },
508
+ children: host.docs.label
509
+ }
510
+ ),
511
+ "."
512
+ ] });
513
+ }
514
+ __name(HostDocsLink, "HostDocsLink");
515
+ function HostStepList({
516
+ steps,
517
+ start = 1
518
+ }) {
519
+ return /* @__PURE__ */ jsx6(Box5, { component: "ol", start, sx: { m: 0, pl: 3 }, children: steps.map((step, index) => /* @__PURE__ */ jsx6(Box5, { component: "li", sx: { mb: 1 }, children: /* @__PURE__ */ jsx6(Text4, { variant: "body", as: "span", children: step }) }, index)) });
520
+ }
521
+ __name(HostStepList, "HostStepList");
522
+
523
+ // src/react/ai-flow-steps.tsx
524
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
525
+ var CONFIGURE_STEP_COUNT = 3;
526
+ var POLL_INTERVAL_MS = 3e3;
527
+ function StepNav({
528
+ nav,
529
+ onNext,
530
+ nextLabel = "Pr\xF3ximo",
531
+ nextDisabled = false,
532
+ nextTestId
533
+ }) {
534
+ return /* @__PURE__ */ jsxs5(Stack4, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
535
+ /* @__PURE__ */ jsx7(Button3, { variant: "ghost", onClick: () => nav.back(), "data-testid": "ai-step-back", children: "Voltar" }),
536
+ /* @__PURE__ */ jsx7(Button3, { onClick: onNext, disabled: nextDisabled, "data-testid": nextTestId, children: nextLabel })
537
+ ] });
538
+ }
539
+ __name(StepNav, "StepNav");
540
+ function CopyUrlStep({ nav, endpointUrl }) {
541
+ return /* @__PURE__ */ jsxs5(Stack4, { spacing: 3, "data-testid": "ai-copy-step", children: [
542
+ /* @__PURE__ */ jsxs5(Box6, { children: [
543
+ /* @__PURE__ */ jsx7(Text5, { variant: "heading", size: "sm", as: "h2", children: "Copie a URL da sua loja" }),
544
+ /* @__PURE__ */ jsx7(Text5, { variant: "caption", as: "p", color: "secondary", children: "\xC9 o \xFAnico dado que voc\xEA cola no assistente \u2014 ao copiar, seguimos para o pr\xF3ximo passo." })
545
+ ] }),
546
+ /* @__PURE__ */ jsx7(EndpointCopyBlock, { endpointUrl, copied: false, onCopy: () => nav.next() }),
547
+ /* @__PURE__ */ jsx7(Box6, { children: /* @__PURE__ */ jsx7(Button3, { variant: "ghost", onClick: () => nav.back(), "data-testid": "ai-step-back", children: "Voltar" }) })
548
+ ] });
549
+ }
550
+ __name(CopyUrlStep, "CopyUrlStep");
551
+ function ConfigureStep({ nav, host }) {
552
+ const [opened, setOpened] = useState2(!host.link);
553
+ return /* @__PURE__ */ jsxs5(Stack4, { spacing: 2.5, "data-testid": "ai-configure-step", children: [
554
+ /* @__PURE__ */ jsx7(HostConnectHeader, { host }),
555
+ /* @__PURE__ */ jsx7(HostOpenButton, { host, onOpen: () => setOpened(true) }),
556
+ /* @__PURE__ */ jsx7(HostStepList, { steps: host.steps.slice(0, CONFIGURE_STEP_COUNT), start: 1 }),
557
+ /* @__PURE__ */ jsx7(HostDocsLink, { host }),
558
+ /* @__PURE__ */ jsx7(StepNav, { nav, onNext: () => nav.next(), nextDisabled: !opened, nextTestId: "ai-configure-next" })
559
+ ] });
560
+ }
561
+ __name(ConfigureStep, "ConfigureStep");
562
+ function ConfigureStageStep({
563
+ nav,
564
+ host,
565
+ stage
566
+ }) {
567
+ const [opened, setOpened] = useState2(!stage.link);
568
+ return /* @__PURE__ */ jsxs5(Stack4, { spacing: 2.5, "data-testid": `ai-stage-${stage.id}`, children: [
569
+ /* @__PURE__ */ jsx7(HostConnectHeader, { host }),
570
+ stage.link && /* @__PURE__ */ jsx7(Box6, { children: /* @__PURE__ */ jsxs5(
571
+ Button3,
572
+ {
573
+ onClick: () => {
574
+ window.open(stage.link.url, "_blank", "noopener,noreferrer");
575
+ setOpened(true);
576
+ },
577
+ "data-testid": `ai-stage-link-${stage.id}`,
578
+ children: [
579
+ stage.link.label,
580
+ /* @__PURE__ */ jsx7(OpenInNewIcon2, { sx: { fontSize: 16, ml: 0.5 } })
581
+ ]
582
+ }
583
+ ) }),
584
+ /* @__PURE__ */ jsx7(HostStepList, { steps: stage.steps, start: 1 }),
585
+ /* @__PURE__ */ jsx7(HostDocsLink, { host }),
586
+ /* @__PURE__ */ jsx7(
587
+ StepNav,
588
+ {
589
+ nav,
590
+ onNext: () => nav.next(),
591
+ nextDisabled: !opened,
592
+ nextTestId: `ai-stage-next-${stage.id}`
593
+ }
594
+ )
595
+ ] });
596
+ }
597
+ __name(ConfigureStageStep, "ConfigureStageStep");
598
+ function ConnectStep({
599
+ nav,
600
+ host,
601
+ connectPrompt
602
+ }) {
603
+ return /* @__PURE__ */ jsxs5(Stack4, { spacing: 2.5, "data-testid": "ai-connect-step", children: [
604
+ /* @__PURE__ */ jsx7(HostConnectHeader, { host }),
605
+ /* @__PURE__ */ jsx7(HostStepList, { steps: host.steps.slice(CONFIGURE_STEP_COUNT), start: CONFIGURE_STEP_COUNT + 1 }),
606
+ /* @__PURE__ */ jsx7(
607
+ PromptCopyBlock,
608
+ {
609
+ title: "Cole esta mensagem no assistente",
610
+ caption: "Assim ele se conecta, se identifica (Claude, ChatGPT\u2026) e registramos a conex\xE3o.",
611
+ message: connectPrompt
612
+ }
613
+ ),
614
+ /* @__PURE__ */ jsx7(HostDocsLink, { host }),
615
+ /* @__PURE__ */ jsx7(StepNav, { nav, onNext: () => nav.next(), nextLabel: "Continuar", nextTestId: "ai-connect-done" })
616
+ ] });
617
+ }
618
+ __name(ConnectStep, "ConnectStep");
619
+ function InstallStep({
620
+ nav,
621
+ host,
622
+ connectPrompt
623
+ }) {
624
+ const [opened, setOpened] = useState2(false);
625
+ return /* @__PURE__ */ jsxs5(Stack4, { spacing: 2.5, "data-testid": "ai-install-step", children: [
626
+ /* @__PURE__ */ jsx7(HostConnectHeader, { host }),
627
+ /* @__PURE__ */ jsx7(Text5, { variant: "body", as: "p", color: "secondary", children: "Abra o plugin da sua loja, clique em Instalar e autorize o acesso \u2014 sem copiar URL nem gerar credenciais." }),
628
+ host.pluginUrl && /* @__PURE__ */ jsx7(Box6, { children: /* @__PURE__ */ jsxs5(
629
+ Button3,
630
+ {
631
+ onClick: () => {
632
+ window.open(host.pluginUrl, "_blank", "noopener,noreferrer");
633
+ setOpened(true);
634
+ },
635
+ "data-testid": "ai-install-open",
636
+ children: [
637
+ "Instalar o plugin da loja",
638
+ /* @__PURE__ */ jsx7(OpenInNewIcon2, { sx: { fontSize: 16, ml: 0.5 } })
639
+ ]
640
+ }
641
+ ) }),
642
+ /* @__PURE__ */ jsx7(
643
+ PromptCopyBlock,
644
+ {
645
+ title: "Pe\xE7a ao assistente para conectar",
646
+ caption: "Cole no assistente para ele se conectar, se identificar e confirmar o acesso.",
647
+ message: connectPrompt
648
+ }
649
+ ),
650
+ /* @__PURE__ */ jsx7(HostDocsLink, { host }),
651
+ /* @__PURE__ */ jsx7(
652
+ StepNav,
653
+ {
654
+ nav,
655
+ onNext: () => nav.next(),
656
+ nextLabel: "Continuar",
657
+ nextDisabled: !opened,
658
+ nextTestId: "ai-install-done"
659
+ }
660
+ )
661
+ ] });
662
+ }
663
+ __name(InstallStep, "InstallStep");
664
+ function ConfirmStep({
665
+ nav,
666
+ connections,
667
+ hosts,
668
+ onRetest
669
+ }) {
670
+ const selectedHostId = nav.data.selectedHost;
671
+ const connection = connectionForHost(connections, selectedHostId);
672
+ const label = connection?.clientName ?? hostLabel(hosts, selectedHostId);
673
+ useEffect(() => {
674
+ if (connection) return void 0;
675
+ const id = setInterval(() => onRetest(), POLL_INTERVAL_MS);
676
+ return () => clearInterval(id);
677
+ }, [connection, onRetest]);
678
+ if (connection) {
679
+ return /* @__PURE__ */ jsxs5(Stack4, { spacing: 2, "data-testid": "ai-confirm-connected", children: [
680
+ /* @__PURE__ */ jsxs5(Stack4, { direction: "row", spacing: 1.5, alignItems: "center", children: [
681
+ /* @__PURE__ */ jsx7(CheckCircleIcon, { sx: { color: "success.main" } }),
682
+ /* @__PURE__ */ jsxs5(Box6, { children: [
683
+ /* @__PURE__ */ jsxs5(Text5, { variant: "body", weight: "bold", as: "p", children: [
684
+ label,
685
+ " est\xE1 conectado \xE0 sua loja."
686
+ ] }),
687
+ /* @__PURE__ */ jsx7(Text5, { variant: "caption", as: "p", color: "secondary", children: activeAgo(connection.lastActiveAt) })
688
+ ] })
689
+ ] }),
690
+ /* @__PURE__ */ jsx7(Box6, { children: /* @__PURE__ */ jsx7(Button3, { onClick: () => nav.complete({ connectedHost: selectedHostId }), children: "Concluir" }) })
691
+ ] });
692
+ }
693
+ return /* @__PURE__ */ jsxs5(Stack4, { spacing: 2.5, "data-testid": "ai-confirm-waiting", children: [
694
+ /* @__PURE__ */ jsxs5(Stack4, { direction: "row", spacing: 1.5, alignItems: "center", children: [
695
+ /* @__PURE__ */ jsx7(Progress, { variant: "circular", circularSize: 22, thickness: 4, dataTestId: "ai-confirm-spinner" }),
696
+ /* @__PURE__ */ jsxs5(Box6, { children: [
697
+ /* @__PURE__ */ jsx7(Text5, { variant: "body", weight: "bold", as: "p", children: "Esperando conex\xE3o" }),
698
+ /* @__PURE__ */ jsxs5(Text5, { variant: "caption", as: "p", color: "secondary", children: [
699
+ "Assim que voc\xEA autorizar o acesso no ",
700
+ label,
701
+ ", ela aparece aqui automaticamente."
702
+ ] })
703
+ ] })
704
+ ] }),
705
+ /* @__PURE__ */ jsxs5(Stack4, { direction: "row", spacing: 1, children: [
706
+ /* @__PURE__ */ jsx7(Button3, { variant: "ghost", size: "sm", onClick: onRetest, "data-testid": "ai-confirm-retest", children: "Testar agora" }),
707
+ /* @__PURE__ */ jsx7(Button3, { variant: "ghost", size: "sm", onClick: () => nav.back(), children: "Voltar" })
708
+ ] })
709
+ ] });
710
+ }
711
+ __name(ConfirmStep, "ConfirmStep");
712
+
713
+ // src/react/ai-status-board.tsx
714
+ import AddLinkOutlinedIcon from "@mui/icons-material/AddLinkOutlined";
715
+ import CheckCircleIcon2 from "@mui/icons-material/CheckCircle";
716
+ import LinkOffOutlinedIcon from "@mui/icons-material/LinkOffOutlined";
717
+ import MenuBookOutlinedIcon from "@mui/icons-material/MenuBookOutlined";
718
+ import { ConfirmButton } from "@12-apps/ui/feedback/ConfirmAction";
719
+ import { Button as Button4 } from "@12-apps/ui/form/Button";
720
+ import { Box as Box7 } from "@12-apps/ui/mui/Box";
721
+ import { Stack as Stack5 } from "@12-apps/ui/mui/Stack";
722
+ import { Text as Text6 } from "@12-apps/ui/typography/Text";
723
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
724
+ function ConnectedControls({
725
+ host,
726
+ onConnect,
727
+ onDisconnect
728
+ }) {
729
+ return /* @__PURE__ */ jsxs6(
730
+ Stack5,
731
+ {
732
+ direction: "row",
733
+ spacing: 1,
734
+ alignItems: "center",
735
+ justifyContent: "flex-end",
736
+ sx: { flexShrink: 0, flexWrap: "wrap", rowGap: 0.5 },
737
+ children: [
738
+ /* @__PURE__ */ jsx8(
739
+ Box7,
740
+ {
741
+ sx: {
742
+ px: 1,
743
+ py: 0.25,
744
+ borderRadius: 999,
745
+ bgcolor: "success.main",
746
+ color: "success.contrastText"
747
+ },
748
+ children: /* @__PURE__ */ jsx8(Text6, { variant: "caption", weight: "bold", as: "span", children: "Conectado" })
749
+ }
750
+ ),
751
+ /* @__PURE__ */ jsxs6(
752
+ Button4,
753
+ {
754
+ variant: "text",
755
+ size: "sm",
756
+ onClick: () => onConnect(host.id),
757
+ "data-testid": `ai-status-instructions-${host.id}`,
758
+ children: [
759
+ /* @__PURE__ */ jsx8(MenuBookOutlinedIcon, { sx: { fontSize: 16, mr: 0.5 } }),
760
+ "Instru\xE7\xF5es"
761
+ ]
762
+ }
763
+ ),
764
+ onDisconnect ? /* @__PURE__ */ jsxs6(
765
+ ConfirmButton,
766
+ {
767
+ variant: "outline",
768
+ color: "danger",
769
+ size: "sm",
770
+ onClick: () => onDisconnect(host.id),
771
+ confirm: {
772
+ title: "Desconectar o assistente?",
773
+ entityName: host.label,
774
+ description: "Ele perde o acesso \xE0 sua loja na hora. Para voltar a usar, ser\xE1 preciso conectar de novo.",
775
+ confirmText: "Desconectar",
776
+ dataTestId: `ai-status-disconnect-confirm-${host.id}`
777
+ },
778
+ "data-testid": `ai-status-disconnect-${host.id}`,
779
+ children: [
780
+ /* @__PURE__ */ jsx8(LinkOffOutlinedIcon, { sx: { fontSize: 16, mr: 0.5 } }),
781
+ "Desconectar"
782
+ ]
783
+ }
784
+ ) : null
785
+ ]
786
+ }
787
+ );
788
+ }
789
+ __name(ConnectedControls, "ConnectedControls");
790
+ function StatusBox({
791
+ status,
792
+ onConnect,
793
+ onDisconnect
794
+ }) {
795
+ const { host, connected, detail } = status;
796
+ return /* @__PURE__ */ jsxs6(
797
+ Box7,
798
+ {
799
+ "data-testid": `ai-status-${host.id}`,
800
+ "data-connected": connected,
801
+ sx: {
802
+ display: "flex",
803
+ alignItems: "center",
804
+ gap: 1.5,
805
+ p: 2,
806
+ borderRadius: 3,
807
+ border: 1,
808
+ borderColor: connected ? "success.main" : "error.main",
809
+ bgcolor: "background.paper"
810
+ },
811
+ children: [
812
+ /* @__PURE__ */ jsx8(HostBrandAvatar, { brand: host.brand, size: 36 }),
813
+ /* @__PURE__ */ jsxs6(Box7, { sx: { minWidth: 0, flexGrow: 1 }, children: [
814
+ /* @__PURE__ */ jsxs6(Stack5, { direction: "row", spacing: 0.75, alignItems: "center", children: [
815
+ /* @__PURE__ */ jsx8(Text6, { variant: "body", weight: "bold", as: "span", children: host.label }),
816
+ connected ? /* @__PURE__ */ jsx8(CheckCircleIcon2, { sx: { fontSize: 18, color: "success.main" } }) : null
817
+ ] }),
818
+ /* @__PURE__ */ jsx8(Text6, { variant: "caption", as: "p", color: "secondary", children: connected ? detail ?? "Conectado" : "Ainda n\xE3o conectado" })
819
+ ] }),
820
+ connected ? /* @__PURE__ */ jsx8(ConnectedControls, { host, onConnect, onDisconnect }) : /* @__PURE__ */ jsxs6(
821
+ Button4,
822
+ {
823
+ variant: "outline",
824
+ size: "sm",
825
+ onClick: () => onConnect(host.id),
826
+ "data-testid": `ai-status-connect-${host.id}`,
827
+ children: [
828
+ /* @__PURE__ */ jsx8(AddLinkOutlinedIcon, { sx: { fontSize: 16, mr: 0.5 } }),
829
+ "Conectar"
830
+ ]
831
+ }
832
+ )
833
+ ]
834
+ }
835
+ );
836
+ }
837
+ __name(StatusBox, "StatusBox");
838
+ function AiStatusBoard({
839
+ statuses,
840
+ onConnect,
841
+ onDisconnect
842
+ }) {
843
+ return /* @__PURE__ */ jsxs6(Stack5, { spacing: 2, "data-testid": "ai-status-board", children: [
844
+ /* @__PURE__ */ jsxs6(Box7, { children: [
845
+ /* @__PURE__ */ jsx8(Text6, { variant: "heading", size: "sm", as: "h2", children: "Assistentes conectados" }),
846
+ /* @__PURE__ */ jsx8(Text6, { variant: "caption", as: "p", color: "secondary", children: "Em verde os que j\xE1 operam a sua loja; em vermelho os que faltam conectar." })
847
+ ] }),
848
+ /* @__PURE__ */ jsx8(
849
+ Box7,
850
+ {
851
+ sx: {
852
+ display: "grid",
853
+ gap: 2,
854
+ gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" }
855
+ },
856
+ children: statuses.map((status) => /* @__PURE__ */ jsx8(
857
+ StatusBox,
858
+ {
859
+ status,
860
+ onConnect,
861
+ onDisconnect
862
+ },
863
+ status.host.id
864
+ ))
865
+ }
866
+ )
867
+ ] });
868
+ }
869
+ __name(AiStatusBoard, "AiStatusBoard");
870
+
871
+ // src/react/host-select-step.tsx
872
+ import CheckCircleIcon3 from "@mui/icons-material/CheckCircle";
873
+ import { Box as Box8 } from "@12-apps/ui/mui/Box";
874
+ import { Stack as Stack6 } from "@12-apps/ui/mui/Stack";
875
+ import { Text as Text7 } from "@12-apps/ui/typography/Text";
876
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
877
+ function HostCard({
878
+ host,
879
+ active,
880
+ onSelect
881
+ }) {
882
+ return /* @__PURE__ */ jsxs7(
883
+ Box8,
884
+ {
885
+ component: "button",
886
+ type: "button",
887
+ onClick: onSelect,
888
+ "aria-pressed": active,
889
+ "data-testid": `ai-host-card-${host.id}`,
890
+ sx: {
891
+ position: "relative",
892
+ display: "flex",
893
+ alignItems: "center",
894
+ gap: 1.5,
895
+ p: 2,
896
+ borderRadius: 3,
897
+ cursor: "pointer",
898
+ textAlign: "left",
899
+ width: "100%",
900
+ border: 2,
901
+ borderColor: active ? "primary.main" : "divider",
902
+ bgcolor: active ? "action.selected" : "background.paper",
903
+ transition: /* @__PURE__ */ __name((theme) => theme.transitions.create(["border-color", "background-color"]), "transition"),
904
+ "&:hover": { borderColor: "primary.main" }
905
+ },
906
+ children: [
907
+ /* @__PURE__ */ jsx9(HostBrandAvatar, { brand: host.brand, size: 40 }),
908
+ /* @__PURE__ */ jsxs7(Box8, { sx: { minWidth: 0 }, children: [
909
+ /* @__PURE__ */ jsx9(Text7, { variant: "body", weight: "bold", as: "span", children: host.label }),
910
+ /* @__PURE__ */ jsx9(Text7, { variant: "caption", as: "p", color: "secondary", children: host.kind })
911
+ ] }),
912
+ active && /* @__PURE__ */ jsx9(
913
+ CheckCircleIcon3,
914
+ {
915
+ sx: { position: "absolute", top: 10, right: 10, fontSize: 20, color: "primary.main" }
916
+ }
917
+ )
918
+ ]
919
+ }
920
+ );
921
+ }
922
+ __name(HostCard, "HostCard");
923
+ function HostSelectStep({
924
+ hosts,
925
+ selectedId,
926
+ onSelect
927
+ }) {
928
+ return /* @__PURE__ */ jsxs7(Stack6, { spacing: 3, "data-testid": "ai-host-select", children: [
929
+ /* @__PURE__ */ jsxs7(Box8, { children: [
930
+ /* @__PURE__ */ jsx9(Text7, { variant: "heading", size: "sm", as: "h2", children: "Escolha o seu assistente" }),
931
+ /* @__PURE__ */ jsx9(Text7, { variant: "caption", as: "p", color: "secondary", children: "Selecione onde voc\xEA usa a IA \u2014 o passo a passo \xE9 feito sob medida para ele." })
932
+ ] }),
933
+ /* @__PURE__ */ jsx9(
934
+ Box8,
935
+ {
936
+ sx: {
937
+ display: "grid",
938
+ gap: 2,
939
+ gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" }
940
+ },
941
+ children: hosts.map((host) => /* @__PURE__ */ jsx9(
942
+ HostCard,
943
+ {
944
+ host,
945
+ active: host.id === selectedId,
946
+ onSelect: () => onSelect(host.id)
947
+ },
948
+ host.id
949
+ ))
950
+ }
951
+ )
952
+ ] });
953
+ }
954
+ __name(HostSelectStep, "HostSelectStep");
955
+
956
+ // src/react/ai-steps.tsx
957
+ import { jsx as jsx10 } from "react/jsx-runtime";
958
+ function StatusBoard({
959
+ nav,
960
+ connections,
961
+ hosts,
962
+ onDisconnect
963
+ }) {
964
+ const legacyHostId = nav.data.connectedHost ?? nav.data.selectedHost;
965
+ const statuses = hosts.map((host) => {
966
+ const provider = providerForHostId(host.id);
967
+ const connection = (provider ? connections.find((c) => c.host === provider) : void 0) ?? (host.id === legacyHostId ? connections.find((c) => c.host === null) : void 0) ?? null;
968
+ return {
969
+ host,
970
+ connected: connection !== null,
971
+ detail: connection ? activeAgo(connection.lastActiveAt) : void 0
972
+ };
973
+ });
974
+ const goToConnect = /* @__PURE__ */ __name((hostId) => {
975
+ nav.goTo(hosts.find((h) => h.id === hostId)?.pluginUrl ? "install" : "copy", {
976
+ selectedHost: hostId
977
+ });
978
+ }, "goToConnect");
979
+ const disconnect = onDisconnect ? async (hostId) => {
980
+ await onDisconnect(hostId);
981
+ const revoked = providerForHostId(hostId);
982
+ const othersLive = statuses.some(
983
+ (status) => status.connected && providerForHostId(status.host.id) !== revoked
984
+ );
985
+ if (!othersLive) goToConnect(hostId);
986
+ } : void 0;
987
+ return /* @__PURE__ */ jsx10(AiStatusBoard, { statuses, onConnect: goToConnect, onDisconnect: disconnect });
988
+ }
989
+ __name(StatusBoard, "StatusBoard");
990
+ function selectStep(hosts) {
991
+ return {
992
+ id: "select",
993
+ label: "Escolher",
994
+ render: /* @__PURE__ */ __name((nav) => /* @__PURE__ */ jsx10(
995
+ HostSelectStep,
996
+ {
997
+ hosts,
998
+ selectedId: nav.data.selectedHost ?? null,
999
+ onSelect: (hostId) => nav.goTo(hosts.find((h) => h.id === hostId)?.pluginUrl ? "install" : "copy", {
1000
+ selectedHost: hostId
1001
+ })
1002
+ }
1003
+ ), "render")
1004
+ };
1005
+ }
1006
+ __name(selectStep, "selectStep");
1007
+ function copyStep(endpointUrl) {
1008
+ return {
1009
+ id: "copy",
1010
+ label: "Copiar URL",
1011
+ render: /* @__PURE__ */ __name((nav) => /* @__PURE__ */ jsx10(CopyUrlStep, { nav, endpointUrl }), "render")
1012
+ };
1013
+ }
1014
+ __name(copyStep, "copyStep");
1015
+ function manualMiddle(host, hosts, endpointUrl, connectPrompt) {
1016
+ if (host.configureStages && host.configureStages.length > 0) {
1017
+ return [
1018
+ copyStep(endpointUrl),
1019
+ ...host.configureStages.map((stage) => ({
1020
+ id: stage.id,
1021
+ label: stage.label,
1022
+ render: /* @__PURE__ */ __name((nav) => /* @__PURE__ */ jsx10(ConfigureStageStep, { nav, host: resolveHost(hosts, nav.data.selectedHost), stage }), "render")
1023
+ }))
1024
+ ];
1025
+ }
1026
+ return [
1027
+ copyStep(endpointUrl),
1028
+ {
1029
+ id: "configure",
1030
+ label: "Configurar",
1031
+ render: /* @__PURE__ */ __name((nav) => /* @__PURE__ */ jsx10(ConfigureStep, { nav, host: resolveHost(hosts, nav.data.selectedHost) }), "render")
1032
+ },
1033
+ {
1034
+ id: "connect",
1035
+ label: "Conectar",
1036
+ render: /* @__PURE__ */ __name((nav) => /* @__PURE__ */ jsx10(ConnectStep, { nav, host: resolveHost(hosts, nav.data.selectedHost), connectPrompt }), "render")
1037
+ }
1038
+ ];
1039
+ }
1040
+ __name(manualMiddle, "manualMiddle");
1041
+ function simpleMiddle(hosts, connectPrompt) {
1042
+ return [
1043
+ {
1044
+ id: "install",
1045
+ label: "Instalar",
1046
+ render: /* @__PURE__ */ __name((nav) => /* @__PURE__ */ jsx10(InstallStep, { nav, host: resolveHost(hosts, nav.data.selectedHost), connectPrompt }), "render")
1047
+ }
1048
+ ];
1049
+ }
1050
+ __name(simpleMiddle, "simpleMiddle");
1051
+ function buildFlowSteps(opts) {
1052
+ const { host, hosts, endpointUrl, connectPrompt, connections, onRetest } = opts;
1053
+ const middle = host.pluginUrl ? simpleMiddle(hosts, connectPrompt) : manualMiddle(host, hosts, endpointUrl, connectPrompt);
1054
+ const confirm = {
1055
+ id: "confirm",
1056
+ label: "Confirmar",
1057
+ render: /* @__PURE__ */ __name((nav) => /* @__PURE__ */ jsx10(ConfirmStep, { nav, connections, hosts, onRetest }), "render")
1058
+ };
1059
+ return [selectStep(hosts), ...middle, confirm];
1060
+ }
1061
+ __name(buildFlowSteps, "buildFlowSteps");
1062
+
1063
+ // src/react/ai-onboarding.tsx
1064
+ import { jsx as jsx11 } from "react/jsx-runtime";
1065
+ var DEFAULT_FEATURE_KEY = "ai_integration";
1066
+ function AiOnboardingFlow(props) {
1067
+ const {
1068
+ endpointUrl,
1069
+ connections,
1070
+ hosts,
1071
+ capabilities,
1072
+ permissionModel,
1073
+ connectPrompt,
1074
+ onRetest,
1075
+ onDisconnect,
1076
+ devReset
1077
+ } = props;
1078
+ const { state } = useOnboarding();
1079
+ const selectedHost = hosts.find((h) => h.id === state.data.selectedHost) ?? hosts[0];
1080
+ const steps = buildFlowSteps({
1081
+ host: selectedHost,
1082
+ hosts,
1083
+ endpointUrl,
1084
+ connectPrompt,
1085
+ connections,
1086
+ onRetest
1087
+ });
1088
+ const connectedHostId = state.data.connectedHost ?? state.data.selectedHost;
1089
+ return /* @__PURE__ */ jsx11(
1090
+ GuidedSection,
1091
+ {
1092
+ steps,
1093
+ title: "Conecte assistentes de IA \xE0 sua loja",
1094
+ startLabel: "Ver como conectar",
1095
+ renderLanding: (start) => /* @__PURE__ */ jsx11(
1096
+ AiLanding,
1097
+ {
1098
+ onStart: start,
1099
+ permissionModel,
1100
+ capabilities
1101
+ }
1102
+ ),
1103
+ configuredTitle: connectedTitle(connections, hosts, connectedHostId),
1104
+ configuredSummary: connectedSummary(connections),
1105
+ editLabel: "Conectar IA",
1106
+ completedContent: (nav) => /* @__PURE__ */ jsx11(
1107
+ StatusBoard,
1108
+ {
1109
+ nav,
1110
+ connections,
1111
+ hosts,
1112
+ onDisconnect
1113
+ }
1114
+ ),
1115
+ devReset,
1116
+ dataTestId: "ai-onboarding"
1117
+ }
1118
+ );
1119
+ }
1120
+ __name(AiOnboardingFlow, "AiOnboardingFlow");
1121
+ function AiIntegrationOnboarding({
1122
+ store,
1123
+ endpointUrl,
1124
+ initialState,
1125
+ connections,
1126
+ featureKey = DEFAULT_FEATURE_KEY,
1127
+ devReset = false,
1128
+ platformName,
1129
+ hosts = aiHostGuides(platformName),
1130
+ capabilities = AI_CAPABILITIES,
1131
+ permissionModel = AI_PERMISSION_MODEL,
1132
+ connectPrompt,
1133
+ onRetest = /* @__PURE__ */ __name(() => {
1134
+ if (typeof window !== "undefined") window.location.reload();
1135
+ }, "onRetest"),
1136
+ onDisconnect
1137
+ }) {
1138
+ return /* @__PURE__ */ jsx11(
1139
+ OnboardingProvider,
1140
+ {
1141
+ featureKey,
1142
+ store,
1143
+ initialState,
1144
+ children: /* @__PURE__ */ jsx11(
1145
+ AiOnboardingFlow,
1146
+ {
1147
+ endpointUrl,
1148
+ connections,
1149
+ hosts,
1150
+ capabilities,
1151
+ permissionModel,
1152
+ connectPrompt,
1153
+ onRetest,
1154
+ onDisconnect,
1155
+ devReset
1156
+ }
1157
+ )
1158
+ }
1159
+ );
1160
+ }
1161
+ __name(AiIntegrationOnboarding, "AiIntegrationOnboarding");
1162
+ export {
1163
+ AI_CAPABILITIES,
1164
+ AI_PERMISSION_MODEL,
1165
+ AiCapabilities,
1166
+ AiIntegrationOnboarding,
1167
+ AiLanding,
1168
+ AiStatusBoard,
1169
+ CapabilityIcon,
1170
+ EndpointCopyBlock,
1171
+ FeatureBadge,
1172
+ HostBrandAvatar,
1173
+ HostConnectHeader,
1174
+ HostOpenButton,
1175
+ HostSelectStep,
1176
+ HostStepList,
1177
+ McpEndpointUrl,
1178
+ PromptCopyBlock,
1179
+ aiConnectPrompt,
1180
+ aiHostGuides,
1181
+ providerForHostId
1182
+ };
1183
+ //# sourceMappingURL=index.js.map