@ctonti/ask-golf-veneto 1.0.4 → 1.0.5

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,49 @@ 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-115px)] flex-col items-center justify-center gap-8 text-foreground overflow-hidden",
17
+ children: [
18
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-0 bg-gradient-to-b from-[#213f31] to-[#1a3227]" }),
19
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-0 bg-[url('https://www.transparenttextures.com/patterns/cubes.png')] opacity-10 mix-blend-overlay" }),
20
+ /* @__PURE__ */ jsxs("div", {
21
+ className: "relative z-10 w-full max-w-215 p-6 md:p-2 flex flex-col items-center gap-12",
22
+ children: [
23
+ /* @__PURE__ */ jsxs("div", {
24
+ className: "text-center space-y-4",
25
+ children: [title && /* @__PURE__ */ jsx("h1", {
26
+ className: "text-center text-5xl md:text-7xl font-thin leading-[1.1] tracking-[-0.02em] font-heading italic text-white drop-shadow-md",
27
+ dangerouslySetInnerHTML: { __html: title }
28
+ }), /* @__PURE__ */ jsx("p", {
29
+ className: "text-[#e8d9c0] font-sans text-lg md:text-xl font-light uppercase tracking-widest mt-4",
30
+ children: "Il tuo concierge di viaggio personalizzato"
31
+ })]
32
+ }),
33
+ /* @__PURE__ */ jsx("div", {
34
+ className: "w-full bg-white/5 backdrop-blur-lg rounded-2xl p-6 shadow-2xl border border-white/10 relative",
35
+ children: /* @__PURE__ */ jsx(PromptIntro, {})
36
+ }),
37
+ /* @__PURE__ */ jsx("div", {
38
+ className: "flex flex-wrap items-center justify-center gap-3 mt-4 max-w-3xl",
39
+ children: [
40
+ "5 giorni golf e prosecco per due",
41
+ "Weekend romantico con golf a Venezia",
42
+ "Vacanza famiglia tra golf e Gardaland",
43
+ "Tour dei migliori campi da golf del Veneto"
44
+ ].map((prompt, i) => /* @__PURE__ */ jsx("button", {
45
+ onClick: () => append?.({
46
+ role: "user",
47
+ content: prompt
48
+ }),
49
+ className: "px-5 py-2.5 rounded-full bg-white/10 hover:bg-[#478264]/80 backdrop-blur text-white text-sm font-medium transition-all duration-300 border border-white/10 hover:border-transparent hover:shadow-lg transform hover:-translate-y-0.5",
50
+ children: prompt
51
+ }, i))
52
+ })
53
+ ]
25
54
  })
26
- })
55
+ ]
27
56
  });
28
57
  }
29
58
  //#endregion
@@ -147,4 +176,4 @@ function getHtmlLang() {
147
176
  //#endregion
148
177
  export { Preview as a, Renderer$1 as i, Chat as n, PreviewRenderer as o, COMPONENTS as r, Main as s, App as t };
149
178
 
150
- //# sourceMappingURL=app-DWg095Qd.mjs.map
179
+ //# sourceMappingURL=app-a0BueseU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-a0BueseU.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 golf e prosecco per due\",\n \"Weekend romantico con golf a Venezia\",\n \"Vacanza famiglia tra golf e Gardaland\",\n \"Tour dei migliori campi da golf del Veneto\"\n ];\n\n return (\n <section className=\"relative flex min-h-[calc(100vh-115px)] flex-col items-center justify-center gap-8 text-foreground overflow-hidden\">\n <div className=\"absolute inset-0 z-0 bg-gradient-to-b from-[#213f31] to-[#1a3227]\" />\n <div className=\"absolute inset-0 z-0 bg-[url('https://www.transparenttextures.com/patterns/cubes.png')] opacity-10 mix-blend-overlay\" />\n \n <div className=\"relative z-10 w-full max-w-215 p-6 md:p-2 flex flex-col items-center gap-12\">\n <div className=\"text-center space-y-4\">\n {title && (\n <h1\n className=\"text-center text-5xl md:text-7xl font-thin leading-[1.1] tracking-[-0.02em] font-heading italic text-white drop-shadow-md\"\n dangerouslySetInnerHTML={{ __html: title }}\n />\n )}\n <p className=\"text-[#e8d9c0] font-sans text-lg md:text-xl font-light uppercase tracking-widest mt-4\">\n Il tuo concierge di viaggio personalizzato\n </p>\n </div>\n \n <div className=\"w-full bg-white/5 backdrop-blur-lg rounded-2xl p-6 shadow-2xl border border-white/10 relative\">\n <PromptIntro />\n </div>\n \n <div className=\"flex flex-wrap items-center justify-center gap-3 mt-4 max-w-3xl\">\n {prompts.map((prompt, i) => (\n <button\n key={i}\n onClick={() => append?.({ role: 'user', content: prompt })}\n className=\"px-5 py-2.5 rounded-full bg-white/10 hover:bg-[#478264]/80 backdrop-blur text-white text-sm font-medium transition-all duration-300 border border-white/10 hover:border-transparent hover:shadow-lg transform hover:-translate-y-0.5\"\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;GACE,oBAAC,OAAD,EAAK,WAAU,qEAAsE,CAAA;GACrF,oBAAC,OAAD,EAAK,WAAU,wHAAyH,CAAA;GAExI,qBAAC,OAAD;IAAK,WAAU;cAAf;KACE,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACG,SACC,oBAAC,MAAD;OACE,WAAU;OACV,y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