@ctonti/ask-golf-veneto 1.0.4 → 1.0.6

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,4 +1,4 @@
1
- import { r as registry } from "./registry-Bq-3Pbqd.mjs";
1
+ import { r as registry } from "./registry-YcWNxjzA.mjs";
2
2
  import { TooltipProvider } from "@websolutespa/ask-ui/components/tooltip";
3
3
  import { useContext, useMemo } from "react";
4
4
  import { ChatContext, ChatProvider, ComponentsContext, ComponentsProvider, ViewProvider } from "@websolutespa/ask-plugin";
@@ -10,20 +10,55 @@ import { toast } from "sonner";
10
10
  //#region src/components/intro.tsx
11
11
  function Intro() {
12
12
  const { PromptIntro } = useContext(ComponentsContext);
13
- const { contents } = useContext(ChatContext);
13
+ const { contents, append } = useContext(ChatContext);
14
14
  const title = contents.intro?.title || "Progetta la tua <em>vacanza golf</em> in Veneto";
15
- return /* @__PURE__ */ jsx("section", {
16
- className: "relative flex min-h-[calc(100vh-115px)] flex-col items-center justify-center gap-8 bg-background text-foreground",
17
- children: /* @__PURE__ */ jsx("div", {
18
- className: "relative w-full max-w-215 p-2",
19
- children: /* @__PURE__ */ jsxs("div", {
20
- className: "flex flex-col gap-20",
21
- children: [title && /* @__PURE__ */ jsx("h1", {
22
- className: "text-center text-[40px] font-thin leading-[1.45] tracking-[-0.02em] font-heading italic text-primary",
23
- dangerouslySetInnerHTML: { __html: title }
24
- }), /* @__PURE__ */ jsx(PromptIntro, {})]
15
+ return /* @__PURE__ */ jsxs("section", {
16
+ className: "relative flex min-h-[calc(100vh-80px)] w-full flex-col items-center justify-center py-12 px-6 bg-[#faf8f3] text-[#213f31] overflow-hidden",
17
+ children: [
18
+ /* @__PURE__ */ jsx("div", { className: "absolute -top-24 -right-24 w-96 h-96 rounded-full bg-[#213f31]/5 pointer-events-none" }),
19
+ /* @__PURE__ */ jsx("div", { className: "absolute -bottom-24 -left-24 w-96 h-96 rounded-full bg-[#478264]/5 pointer-events-none" }),
20
+ /* @__PURE__ */ jsxs("div", {
21
+ className: "relative z-10 w-full max-w-4xl mx-auto flex flex-col items-center gap-8 text-center",
22
+ children: [
23
+ /* @__PURE__ */ jsxs("div", {
24
+ className: "inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-[#213f31]/10 border border-[#213f31]/20",
25
+ children: [/* @__PURE__ */ jsx("span", { className: "w-2 h-2 rounded-full bg-[#34674e]" }), /* @__PURE__ */ jsx("span", {
26
+ className: "text-[#213f31] font-sans text-xs font-semibold uppercase tracking-[0.25em]",
27
+ children: "Concierge Ufficiale Golf in Veneto"
28
+ })]
29
+ }),
30
+ title && /* @__PURE__ */ jsx("h1", {
31
+ className: "text-4xl @md:text-6xl @lg:text-7xl font-normal leading-[1.15] font-heading italic text-[#213f31] drop-shadow-sm max-w-3xl",
32
+ dangerouslySetInnerHTML: { __html: title }
33
+ }),
34
+ /* @__PURE__ */ jsx("p", {
35
+ className: "font-sans text-[#213f31]/80 text-base @md:text-lg max-w-2xl font-light leading-relaxed",
36
+ children: "Un consulente dedicato per disegnare il tuo itinerario su misura: campi da golf affiliati, eccellenze enogastronomiche, arte e relax."
37
+ }),
38
+ /* @__PURE__ */ jsx("div", {
39
+ className: "w-full max-w-2xl mt-2 bg-white rounded-2xl p-4 shadow-xl border border-[#e8d9c0]",
40
+ children: /* @__PURE__ */ jsx(PromptIntro, {})
41
+ }),
42
+ /* @__PURE__ */ jsx("div", {
43
+ className: "flex flex-wrap items-center justify-center gap-2.5 mt-2 max-w-3xl",
44
+ children: [
45
+ "5 giorni tra golf d'eccellenza e Prosecco",
46
+ "Weekend romantico: Golf al Lido & Venezia",
47
+ "Golf, Terme ed Enogastronomia nei Colli Euganei",
48
+ "Tour dei migliori 15 Golf Club del Veneto"
49
+ ].map((prompt, i) => /* @__PURE__ */ jsx("button", {
50
+ type: "button",
51
+ onClick: () => append?.({
52
+ role: "user",
53
+ content: prompt
54
+ }),
55
+ className: "px-4 py-2 rounded-full bg-[#213f31]/5 hover:bg-[#213f31] text-[#213f31] hover:text-[#faf8f3] text-xs font-medium border border-[#213f31]/15 transition-all duration-200 cursor-pointer shadow-sm",
56
+ children: prompt
57
+ }, i))
58
+ })
59
+ ]
25
60
  })
26
- })
61
+ ]
27
62
  });
28
63
  }
29
64
  //#endregion
@@ -147,4 +182,4 @@ function getHtmlLang() {
147
182
  //#endregion
148
183
  export { Preview as a, Renderer$1 as i, Chat as n, PreviewRenderer as o, COMPONENTS as r, Main as s, App as t };
149
184
 
150
- //# sourceMappingURL=app-DWg095Qd.mjs.map
185
+ //# sourceMappingURL=app-Bc1Wuyn1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-Bc1Wuyn1.mjs","names":["Renderer","JsonRenderer"],"sources":["../src/components/intro.tsx","../src/components/main.tsx","../src/components/preview.tsx","../src/components/renderer.tsx","../src/components.ts","../src/components/chat.tsx","../src/components/app.tsx"],"sourcesContent":["'use client';\n\nimport { ChatContext, ComponentsContext } from '@websolutespa/ask-plugin';\nimport { useContext } from 'react';\n\nexport function Intro() {\n const { PromptIntro } = useContext(ComponentsContext);\n const { contents, append } = useContext(ChatContext);\n const title =\n contents.intro?.title || 'Progetta la tua <em>vacanza golf</em> in Veneto';\n\n const prompts = [\n \"5 giorni tra golf d'eccellenza e Prosecco\",\n \"Weekend romantico: Golf al Lido & Venezia\",\n \"Golf, Terme ed Enogastronomia nei Colli Euganei\",\n \"Tour dei migliori 15 Golf Club del Veneto\"\n ];\n\n return (\n <section className=\"relative flex min-h-[calc(100vh-80px)] w-full flex-col items-center justify-center py-12 px-6 bg-[#faf8f3] text-[#213f31] overflow-hidden\">\n {/* Decorative Brand Circles */}\n <div className=\"absolute -top-24 -right-24 w-96 h-96 rounded-full bg-[#213f31]/5 pointer-events-none\" />\n <div className=\"absolute -bottom-24 -left-24 w-96 h-96 rounded-full bg-[#478264]/5 pointer-events-none\" />\n\n <div className=\"relative z-10 w-full max-w-4xl mx-auto flex flex-col items-center gap-8 text-center\">\n {/* Subtitle Badge */}\n <div className=\"inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-[#213f31]/10 border border-[#213f31]/20\">\n <span className=\"w-2 h-2 rounded-full bg-[#34674e]\" />\n <span className=\"text-[#213f31] font-sans text-xs font-semibold uppercase tracking-[0.25em]\">\n Concierge Ufficiale Golf in Veneto\n </span>\n </div>\n\n {/* Main Title */}\n {title && (\n <h1\n className=\"text-4xl @md:text-6xl @lg:text-7xl font-normal leading-[1.15] font-heading italic text-[#213f31] drop-shadow-sm max-w-3xl\"\n dangerouslySetInnerHTML={{ __html: title }}\n />\n )}\n\n <p className=\"font-sans text-[#213f31]/80 text-base @md:text-lg max-w-2xl font-light leading-relaxed\">\n Un consulente dedicato per disegnare il tuo itinerario su misura: campi da golf affiliati, eccellenze enogastronomiche, arte e relax.\n </p>\n\n {/* Prompt Input Container */}\n <div className=\"w-full max-w-2xl mt-2 bg-white rounded-2xl p-4 shadow-xl border border-[#e8d9c0]\">\n <PromptIntro />\n </div>\n\n {/* Suggested Prompt Chips */}\n <div className=\"flex flex-wrap items-center justify-center gap-2.5 mt-2 max-w-3xl\">\n {prompts.map((prompt, i) => (\n <button\n key={i}\n type=\"button\"\n onClick={() => append?.({ role: 'user', content: prompt })}\n className=\"px-4 py-2 rounded-full bg-[#213f31]/5 hover:bg-[#213f31] text-[#213f31] hover:text-[#faf8f3] text-xs font-medium border border-[#213f31]/15 transition-all duration-200 cursor-pointer shadow-sm\"\n >\n {prompt}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n","'use client';\n\nimport { ChatContext, ComponentsContext } from '@websolutespa/ask-plugin';\nimport { useContext } from 'react';\n\nexport function Main() {\n const { Intro, Thread } = useContext(ComponentsContext);\n const { shouldShowIntro } = useContext(ChatContext);\n return (\n <div className=\"w-full min-h-svh flex flex-col gap-8 bg-background text-foreground\">\n {shouldShowIntro ? <Intro /> : <Thread />}\n </div>\n );\n}\n","'use client';\n\nimport { Spec } from '@json-render/core';\nimport { ComponentsContext, ComponentsProvider } from '@websolutespa/ask-plugin';\nimport { cn } from '@websolutespa/ask-ui';\nimport { Toaster } from '@websolutespa/ask-ui/components/sonner';\nimport { useContext } from 'react';\nimport { COMPONENTS } from '../components';\n\nexport function Preview({ spec }: { spec?: Spec | null }) {\n return (\n <ComponentsProvider components={COMPONENTS}>\n <PreviewRenderer spec={spec} />\n <Toaster />\n </ComponentsProvider>\n );\n}\n\nexport function PreviewRenderer({\n spec,\n className,\n}: {\n spec?: Spec | null;\n className?: string;\n}) {\n const { Renderer } = useContext(ComponentsContext);\n return (\n <div className={cn('w-full flex flex-col gap-10 py-5 @md:gap-20 @md:py-10', className)}>\n {spec ? <Renderer spec={spec} /> : <div>Spec not provided</div>}\n </div>\n );\n}\n","'use client';\n\nimport { Spec } from '@json-render/core';\nimport {\n ActionProvider,\n Renderer as JsonRenderer,\n StateProvider,\n VisibilityProvider,\n} from '@json-render/react';\nimport { ComponentsContext } from '@websolutespa/ask-plugin';\nimport { useContext } from 'react';\nimport { toast } from 'sonner';\n// IMPORTANT: import YOUR OWN registry so your custom blocks are rendered.\nimport { registry } from '../registry';\n\nexport function Renderer({\n spec,\n isStreaming = false,\n mounted = false,\n}: {\n spec?: Spec | null;\n isStreaming?: boolean;\n mounted?: boolean;\n}) {\n const { Fallback } = useContext(ComponentsContext);\n if (!spec) {\n return;\n }\n return (\n <StateProvider initialState={spec.state ?? {}}>\n <VisibilityProvider>\n <ActionProvider\n handlers={{\n linkClick: async (params) => {\n const href = (params?.href as string) || '#';\n if (mounted) {\n const { url } = params as { url?: string };\n if (url) window.open(url, '_blank', 'noopener,noreferrer');\n } else {\n toast.info(`Navigating to: ${href}`);\n }\n },\n }}\n >\n <JsonRenderer\n spec={spec}\n registry={registry}\n fallback={Fallback}\n loading={isStreaming}\n />\n </ActionProvider>\n </VisibilityProvider>\n </StateProvider>\n );\n}\n","import { App } from './components/app';\nimport { Chat } from './components/chat';\nimport { Intro } from './components/intro';\nimport { Main } from './components/main';\nimport { Preview } from './components/preview';\nimport { Renderer } from './components/renderer';\n\n// Components injected into the shared chat engine via ComponentsProvider.\n// Only list what you override; everything else falls back to @websolutespa/ask-plugin.\nexport const COMPONENTS = {\n App,\n Chat,\n Intro,\n Main,\n Preview,\n Renderer,\n};\n\nexport type Components = typeof COMPONENTS;\n\nexport * from './components/app';\nexport * from './components/chat';\nexport * from './components/main';\nexport * from './components/preview';\nexport * from './components/renderer';\n","'use client';\n\nimport {\n ChatProvider,\n ChatProviderProps,\n ComponentsProvider,\n ViewProvider,\n} from '@websolutespa/ask-plugin';\nimport { Toaster } from '@websolutespa/ask-ui/components/sonner';\nimport { COMPONENTS } from '../components';\nimport { Main } from './main';\n\nexport function Chat({ appKey, apiKey, ...props }: Partial<ChatProviderProps>) {\n if (!appKey) {\n return <div>appKey not defined</div>;\n }\n if (!apiKey) {\n return <div>apiKey not defined</div>;\n }\n return (\n <ComponentsProvider components={COMPONENTS}>\n <ChatProvider appKey={appKey} apiKey={apiKey} {...props}>\n <ViewProvider>\n <Main />\n <Toaster />\n </ViewProvider>\n </ChatProvider>\n </ComponentsProvider>\n );\n}\n","'use client';\n\nimport type { PageData, PluginOptions } from '@websolutespa/ask-plugin';\nimport { TooltipProvider } from '@websolutespa/ask-ui/components/tooltip';\nimport { useMemo } from 'react';\nimport { Chat } from './chat';\nimport { Preview } from './preview';\n\nexport type AppProps = PluginOptions;\n\nexport const App = (props: AppProps) => {\n const _data = useMemo<PageData>(() => {\n if (typeof window !== 'undefined') {\n const htmlLang = getHtmlLang();\n const title = document.querySelector('title');\n const description = document.querySelector('meta[name=\"description\"]');\n const canonical = document.querySelector('link[rel=\"canonical\"]');\n return {\n locale: htmlLang?.locale || 'it',\n market: htmlLang?.market || 'ww',\n origin: window.origin,\n canonical: canonical?.getAttribute('href') || window.location.href,\n title: title ? title.innerText : 'Untitled',\n description: description?.getAttribute('content') || '',\n slug: window.location.pathname,\n };\n }\n return {\n locale: 'it',\n market: 'ww',\n origin: '',\n canonical: '',\n title: 'Untitled',\n description: '',\n slug: '',\n };\n }, []);\n\n return (\n <div className=\"@container w-full\">\n <TooltipProvider>\n {props.preview ? (\n <Preview spec={props.initialSpec} />\n ) : (\n <Chat {...props} />\n )}\n </TooltipProvider>\n </div>\n );\n};\n\nfunction getHtmlLang(): { locale: string; market: string } | undefined {\n const html = document.querySelector('html');\n const htmlLang = html?.getAttribute('lang');\n if (htmlLang) {\n const segments = htmlLang.toLowerCase().split('-');\n return { locale: segments[0], market: segments[1] || 'ww' };\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;AAKA,SAAgB,QAAQ;CACtB,MAAM,EAAE,gBAAgB,WAAW,kBAAkB;CACrD,MAAM,EAAE,UAAU,WAAW,WAAW,YAAY;CACpD,MAAM,QACJ,SAAS,OAAO,SAAS;AAS3B,QACE,qBAAC,WAAD;EAAS,WAAU;YAAnB;GAEE,oBAAC,OAAD,EAAK,WAAU,wFAAyF,CAAA;GACxG,oBAAC,OAAD,EAAK,WAAU,0FAA2F,CAAA;GAE1G,qBAAC,OAAD;IAAK,WAAU;cAAf;KAEE,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,oBAAC,QAAD,EAAM,WAAU,qCAAsC,CAAA,EACtD,oBAAC,QAAD;OAAM,WAAU;iBAA6E;OAEtF,CAAA,CACH;;KAGL,SACC,oBAAC,MAAD;MACE,WAAU;MACV,yBAAyB,EAAE,QAAQ,OAAO;MAC1C,CAAA;KAGJ,oBAAC,KAAD;MAAG,WAAU;gBAAyF;MAElG,CAAA;KAGJ,oBAAC,OAAD;MAAK,WAAU;gBACb,oBAAC,aAAD,EAAe,CAAA;MACX,CAAA;KAGN,oBAAC,OAAD;MAAK,WAAU;gBACZ;OAxCP;OACA;OACA;OACA;OAqCc,CAAC,KAAK,QAAQ,MACpB,oBAAC,UAAD;OAEE,MAAK;OACL,eAAe,SAAS;QAAE,MAAM;QAAQ,SAAS;QAAQ,CAAC;OAC1D,WAAU;iBAET;OACM,EANF,EAME,CACT;MAC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