@gropulse/booking-widget 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react");function v(o){const{apiBaseUrl:s,context:n,onBookingConfirmed:t}=o,[g,w]=a.useState([]),[h,l]=a.useState(null),[f,r]=a.useState(null),[c,m]=a.useState(!1),[j,x]=a.useState(null),p=a.useCallback(async b=>{const i={...n,timezone:n.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone},d=await fetch(`${s}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:b,context:i})});if(!d.ok){const u=await d.text();throw new Error(`Chat API error ${d.status}: ${u}`)}return await d.json()},[s,n]),y=a.useCallback(b=>{w(i=>[...i,{role:"assistant",content:b.message}]),b.action==="show_slots"&&b.slots&&l(b.slots),b.action==="booking_confirmed"&&b.booking&&(r(b.booking),l(null),t==null||t(b.booking))},[t]),k=a.useCallback(async()=>{if(!(g.length>0||c)){m(!0),x(null);try{const i=await p([{role:"user",content:"__START__"}]);w([{role:"assistant",content:i.message}]),i.action==="show_slots"&&i.slots&&l(i.slots),i.action==="booking_confirmed"&&i.booking&&(r(i.booking),t==null||t(i.booking))}catch(b){x(b.message)}finally{m(!1)}}},[g.length,c,p,t]),N=a.useCallback(async b=>{const i=b.trim();if(!i||c)return;const d=[...g,{role:"user",content:i}];w(d),m(!0),x(null);try{const u=await p(d);y(u)}catch(u){x(u.message)}finally{m(!1)}},[g,c,p,y]),S=a.useCallback(async b=>{if(c)return;const i=new Date(b.time).toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),d=[...g,{role:"user",content:`I'll take ${i} (${b.time})`}];w(d),l(null),m(!0),x(null);try{const u=await p(d);y(u)}catch(u){x(u.message)}finally{m(!1)}},[g,c,p,y]);return{messages:g,slots:h,booking:f,isLoading:c,error:j,sendMessage:N,pickSlot:S,start:k}}function C({message:o}){const s=o.role==="user";return e.jsx("div",{className:`gbw-flex ${s?"gbw-justify-end":"gbw-justify-start"} gbw-mb-2`,children:e.jsx("div",{className:s?"gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-br-sm gbw-bg-gropulse-navy gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-white":"gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-gropulse-text gbw-border gbw-border-gropulse-border",children:o.content})})}function L({messages:o,isLoading:s}){const n=a.useRef(null);return a.useEffect(()=>{var t;(t=n.current)==null||t.scrollIntoView({behavior:"smooth",block:"end"})},[o,s]),e.jsxs("div",{className:"gbw-flex-1 gbw-overflow-y-auto gbw-px-4 gbw-py-3",children:[o.map((t,g)=>e.jsx(C,{message:t},g)),s?e.jsx(B,{}):null,e.jsx("div",{ref:n})]})}function B(){return e.jsx("div",{className:"gbw-flex gbw-justify-start gbw-mb-2",children:e.jsx("div",{className:"gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-border gbw-border-gropulse-border gbw-px-3.5 gbw-py-2.5",children:e.jsxs("div",{className:"gbw-flex gbw-gap-1",children:[e.jsx("span",{className:"gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block"}),e.jsx("span",{className:"gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block"}),e.jsx("span",{className:"gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block"})]})})})}function T({onSend:o,disabled:s,placeholder:n}){const[t,g]=a.useState(""),w=()=>{const l=t.trim();!l||s||(o(l),g(""))},h=l=>{l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),w())};return e.jsx("div",{className:"gbw-border-t gbw-border-gropulse-border gbw-bg-white gbw-p-3",children:e.jsxs("div",{className:"gbw-flex gbw-items-end gbw-gap-2",children:[e.jsx("textarea",{value:t,onChange:l=>g(l.target.value),onKeyDown:h,disabled:s,rows:1,placeholder:n??"Type a message…",className:"gbw-flex-1 gbw-resize-none gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-px-3 gbw-py-2 gbw-text-sm gbw-outline-none focus:gbw-border-gropulse-navy focus:gbw-ring-2 focus:gbw-ring-gropulse-navy/10 disabled:gbw-bg-gropulse-bg disabled:gbw-text-gropulse-muted",style:{maxHeight:120}}),e.jsx("button",{type:"button",onClick:w,disabled:s||!t.trim(),className:"gbw-shrink-0 gbw-rounded-xl gbw-bg-gropulse-navy gbw-px-4 gbw-py-2 gbw-text-sm gbw-font-medium gbw-text-white gbw-transition hover:gbw-bg-gropulse-navyHover disabled:gbw-opacity-40",children:"Send"})]})})}function D({slots:o,onPick:s,disabled:n}){const t=a.useMemo(()=>M(o),[o]);return o.length===0?e.jsx("div",{className:"gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-gropulse-bg gbw-px-3 gbw-py-2 gbw-text-sm gbw-text-gropulse-muted",children:"No slots available right now — try again in a moment."}):e.jsxs("div",{className:"gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-p-3",children:[e.jsx("div",{className:"gbw-mb-2 gbw-text-xs gbw-font-medium gbw-uppercase gbw-tracking-wide gbw-text-gropulse-muted",children:"Pick a time that works"}),e.jsx("div",{className:"gbw-flex gbw-flex-col gbw-gap-3 gbw-max-h-60 gbw-overflow-y-auto",children:t.map(g=>e.jsxs("div",{children:[e.jsx("div",{className:"gbw-mb-1.5 gbw-text-xs gbw-font-semibold gbw-text-gropulse-text",children:g.dayLabel}),e.jsx("div",{className:"gbw-grid gbw-grid-cols-3 gbw-gap-1.5",children:g.slots.map(w=>e.jsx("button",{type:"button",disabled:n,onClick:()=>s(w),className:"gbw-rounded-lg gbw-border gbw-border-gropulse-border gbw-bg-white gbw-px-2 gbw-py-1.5 gbw-text-xs gbw-font-medium gbw-text-gropulse-text gbw-transition hover:gbw-border-gropulse-navy hover:gbw-bg-gropulse-navy hover:gbw-text-white disabled:gbw-opacity-40",children:_(w.time)},w.time))})]},g.dayLabel))})]})}function M(o){const s=new Map;for(const n of o){const g=new Date(n.time).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}),w=s.get(g);w?w.push(n):s.set(g,[n])}return Array.from(s.entries()).map(([n,t])=>({dayLabel:n,slots:t}))}function _(o){return new Date(o).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function I(o){const{apiBaseUrl:s,context:n,trigger:t="button",buttonLabel:g="Book Free Strategy Call",onBookingConfirmed:w,className:h}=o,[l,f]=a.useState(t==="auto"),r=v({apiBaseUrl:s,context:n,onBookingConfirmed:w});return a.useEffect(()=>{l&&r.messages.length===0&&!r.isLoading&&r.start()},[l,r]),e.jsxs("div",{className:`gbw-root ${h??""}`,children:[t==="button"?e.jsxs("button",{type:"button",onClick:()=>f(c=>!c),className:"gbw-inline-flex gbw-items-center gbw-gap-2 gbw-rounded-xl gbw-bg-gropulse-navy gbw-px-4 gbw-py-2.5 gbw-text-sm gbw-font-medium gbw-text-white gbw-shadow-sm gbw-transition hover:gbw-bg-gropulse-navyHover",children:[e.jsx("span",{className:"gbw-h-2 gbw-w-2 gbw-rounded-full gbw-bg-gropulse-accent"}),g]}):null,l?e.jsxs("div",{className:"gbw-fixed gbw-inset-0 gbw-z-[9999] gbw-flex gbw-items-end gbw-justify-end gbw-p-0 sm:gbw-p-4",children:[e.jsx("div",{className:"gbw-absolute gbw-inset-0 gbw-bg-black/20",onClick:()=>f(!1)}),e.jsxs("div",{className:"gbw-relative gbw-flex gbw-h-full gbw-w-full gbw-flex-col gbw-overflow-hidden gbw-bg-white gbw-shadow-panel sm:gbw-h-[620px] sm:gbw-w-[400px] sm:gbw-rounded-2xl",children:[e.jsx($,{ownerName:n.ownerName,onClose:()=>f(!1)}),e.jsx(L,{messages:r.messages,isLoading:r.isLoading}),r.slots&&!r.booking?e.jsx(D,{slots:r.slots,onPick:r.pickSlot,disabled:r.isLoading}):null,r.error?e.jsx("div",{className:"gbw-mx-4 gbw-mb-2 gbw-rounded-lg gbw-border gbw-border-red-200 gbw-bg-red-50 gbw-px-3 gbw-py-2 gbw-text-xs gbw-text-red-700",children:r.error}):null,r.booking?e.jsx(P,{}):e.jsx(T,{onSend:r.sendMessage,disabled:r.isLoading,placeholder:"Reply…"})]})]}):null]})}function $({ownerName:o,onClose:s}){return e.jsxs("div",{className:"gbw-flex gbw-items-center gbw-justify-between gbw-border-b gbw-border-gropulse-border gbw-bg-gropulse-navy gbw-px-4 gbw-py-3 gbw-text-white",children:[e.jsxs("div",{children:[e.jsx("div",{className:"gbw-text-sm gbw-font-semibold",children:"Gropulse Growth Strategy"}),e.jsxs("div",{className:"gbw-text-xs gbw-text-white/70",children:["Hey ",o.split(" ")[0]," — let’s find a time."]})]}),e.jsx("button",{type:"button",onClick:s,"aria-label":"Close",className:"gbw-rounded-md gbw-p-1 gbw-text-white/80 gbw-transition hover:gbw-bg-white/10 hover:gbw-text-white",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]})}function P(){return e.jsx("div",{className:"gbw-border-t gbw-border-gropulse-border gbw-bg-gropulse-bg gbw-px-4 gbw-py-3 gbw-text-center gbw-text-xs gbw-text-gropulse-muted",children:"Calendar invite on its way. You can close this window."})}exports.BookingWidget=I;exports.useBookingChat=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react");function v(g){const{apiBaseUrl:o,context:r,onBookingConfirmed:t}=g,[s,b]=w.useState([]),[d,n]=w.useState(null),[f,i]=w.useState(null),[u,x]=w.useState(!1),[j,p]=w.useState(null),h=w.useCallback(async l=>{const a={...r,timezone:r.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone},c=await fetch(`${o}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:l,context:a})});if(!c.ok){const m=await c.text();throw new Error(`Chat API error ${c.status}: ${m}`)}return await c.json()},[o,r]),y=w.useCallback(l=>{b(a=>[...a,{role:"assistant",content:l.message}]),l.action==="show_slots"&&l.slots&&n(l.slots),l.action==="booking_confirmed"&&l.booking&&(i(l.booking),n(null),t==null||t(l.booking))},[t]),k=w.useCallback(async()=>{if(!(s.length>0||u)){x(!0),p(null);try{const a=await h([{role:"user",content:"__START__"}]);b([{role:"assistant",content:a.message}]),a.action==="show_slots"&&a.slots&&n(a.slots),a.action==="booking_confirmed"&&a.booking&&(i(a.booking),t==null||t(a.booking))}catch(l){p(l.message)}finally{x(!1)}}},[s.length,u,h,t]),N=w.useCallback(async l=>{const a=l.trim();if(!a||u)return;const c=[...s,{role:"user",content:a}];b(c),x(!0),p(null);try{const m=await h(c);y(m)}catch(m){p(m.message)}finally{x(!1)}},[s,u,h,y]),S=w.useCallback(async l=>{if(u)return;const a=new Date(l.time).toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),c=[...s,{role:"user",content:`I'll take ${a} (${l.time})`}];b(c),n(null),x(!0),p(null);try{const m=await h(c);y(m)}catch(m){p(m.message)}finally{x(!1)}},[s,u,h,y]);return{messages:s,slots:d,booking:f,isLoading:u,error:j,sendMessage:N,pickSlot:S,start:k}}function C(g){return g.split(`
2
+ `).flatMap((o,r,t)=>{const s=[],b=o.split(/(\*\*[^*]+\*\*|\*[^*]+\*)/g);for(let d=0;d<b.length;d++){const n=b[d];n.startsWith("**")&&n.endsWith("**")?s.push(e.jsx("strong",{children:n.slice(2,-2)},`${r}-${d}`)):n.startsWith("*")&&n.endsWith("*")?s.push(e.jsx("em",{children:n.slice(1,-1)},`${r}-${d}`)):s.push(n)}return r<t.length-1&&s.push(e.jsx("br",{},`br-${r}`)),s})}function L({message:g}){const o=g.role==="user";return e.jsx("div",{className:`gbw-flex ${o?"gbw-justify-end":"gbw-justify-start"} gbw-mb-2`,children:e.jsx("div",{className:o?"gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-br-sm gbw-bg-gropulse-navy gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-white":"gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-gropulse-text gbw-border gbw-border-gropulse-border",children:o?g.content:C(g.content)})})}function $({messages:g,isLoading:o}){const r=w.useRef(null);return w.useEffect(()=>{var t;(t=r.current)==null||t.scrollIntoView({behavior:"smooth",block:"end"})},[g,o]),e.jsxs("div",{className:"gbw-flex-1 gbw-overflow-y-auto gbw-px-4 gbw-py-3",children:[g.map((t,s)=>e.jsx(L,{message:t},s)),o?e.jsx(T,{}):null,e.jsx("div",{ref:r})]})}function T(){return e.jsx("div",{className:"gbw-flex gbw-justify-start gbw-mb-2",children:e.jsx("div",{className:"gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-border gbw-border-gropulse-border gbw-px-3.5 gbw-py-2.5",children:e.jsxs("div",{className:"gbw-flex gbw-gap-1",children:[e.jsx("span",{className:"gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block"}),e.jsx("span",{className:"gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block"}),e.jsx("span",{className:"gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block"})]})})})}function B({onSend:g,disabled:o,placeholder:r}){const[t,s]=w.useState(""),b=()=>{const n=t.trim();!n||o||(g(n),s(""))},d=n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),b())};return e.jsx("div",{className:"gbw-border-t gbw-border-gropulse-border gbw-bg-white gbw-p-3",children:e.jsxs("div",{className:"gbw-flex gbw-items-end gbw-gap-2",children:[e.jsx("textarea",{value:t,onChange:n=>s(n.target.value),onKeyDown:d,disabled:o,rows:1,placeholder:r??"Type a message…",className:"gbw-flex-1 gbw-resize-none gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-px-3 gbw-py-2 gbw-text-sm gbw-outline-none focus:gbw-border-gropulse-navy focus:gbw-ring-2 focus:gbw-ring-gropulse-navy/10 disabled:gbw-bg-gropulse-bg disabled:gbw-text-gropulse-muted",style:{maxHeight:120}}),e.jsx("button",{type:"button",onClick:b,disabled:o||!t.trim(),className:"gbw-shrink-0 gbw-rounded-xl gbw-bg-gropulse-navy gbw-px-4 gbw-py-2 gbw-text-sm gbw-font-medium gbw-text-white gbw-transition hover:gbw-bg-gropulse-navyHover disabled:gbw-opacity-40",children:"Send"})]})})}function M({slots:g,onPick:o,disabled:r}){const t=w.useMemo(()=>D(g),[g]);return g.length===0?e.jsx("div",{className:"gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-gropulse-bg gbw-px-3 gbw-py-2 gbw-text-sm gbw-text-gropulse-muted",children:"No slots available right now — try again in a moment."}):e.jsxs("div",{className:"gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-p-3",children:[e.jsx("div",{className:"gbw-mb-2 gbw-text-xs gbw-font-medium gbw-uppercase gbw-tracking-wide gbw-text-gropulse-muted",children:"Pick a time that works"}),e.jsx("div",{className:"gbw-flex gbw-flex-col gbw-gap-3 gbw-max-h-60 gbw-overflow-y-auto",children:t.map(s=>e.jsxs("div",{children:[e.jsx("div",{className:"gbw-mb-1.5 gbw-text-xs gbw-font-semibold gbw-text-gropulse-text",children:s.dayLabel}),e.jsx("div",{className:"gbw-grid gbw-grid-cols-3 gbw-gap-1.5",children:s.slots.map(b=>e.jsx("button",{type:"button",disabled:r,onClick:()=>o(b),className:"gbw-rounded-lg gbw-border gbw-border-gropulse-border gbw-bg-white gbw-px-2 gbw-py-1.5 gbw-text-xs gbw-font-medium gbw-text-gropulse-text gbw-transition hover:gbw-border-gropulse-navy hover:gbw-bg-gropulse-navy hover:gbw-text-white disabled:gbw-opacity-40",children:W(b.time)},b.time))})]},s.dayLabel))})]})}function D(g){const o=new Map;for(const t of g){const b=new Date(t.time).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"}),d=o.get(b);d?d.push(t):o.set(b,[t])}const r=new Date().toLocaleTimeString(void 0,{timeZoneName:"short"}).split(" ").pop()??"";return Array.from(o.entries()).map(([t,s])=>({dayLabel:`${t} · ${r}`,slots:s}))}function W(g){return new Date(g).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function _(g){const{apiBaseUrl:o,context:r,trigger:t="button",buttonLabel:s="Book Free Strategy Call",onBookingConfirmed:b,className:d}=g,[n,f]=w.useState(t==="auto"),i=v({apiBaseUrl:o,context:r,onBookingConfirmed:b});return w.useEffect(()=>{n&&i.messages.length===0&&!i.isLoading&&i.start()},[n,i]),e.jsxs("div",{className:`gbw-root ${d??""}`,children:[t==="button"?e.jsxs("button",{type:"button",onClick:()=>f(u=>!u),className:"gbw-inline-flex gbw-items-center gbw-gap-2 gbw-rounded-xl gbw-bg-gropulse-navy gbw-px-4 gbw-py-2.5 gbw-text-sm gbw-font-medium gbw-text-white gbw-shadow-sm gbw-transition hover:gbw-bg-gropulse-navyHover",children:[e.jsx("span",{className:"gbw-h-2 gbw-w-2 gbw-rounded-full gbw-bg-gropulse-accent"}),s]}):null,n?e.jsxs("div",{className:"gbw-fixed gbw-inset-0 gbw-z-[9999] gbw-flex gbw-items-end gbw-justify-end gbw-p-0 sm:gbw-p-4",children:[e.jsx("div",{className:"gbw-absolute gbw-inset-0 gbw-bg-black/20",onClick:()=>f(!1)}),e.jsxs("div",{className:"gbw-relative gbw-flex gbw-h-full gbw-w-full gbw-flex-col gbw-overflow-hidden gbw-bg-white gbw-shadow-panel sm:gbw-h-[620px] sm:gbw-w-[400px] sm:gbw-rounded-2xl",children:[e.jsx(z,{ownerName:r.ownerName,onClose:()=>f(!1)}),e.jsx($,{messages:i.messages,isLoading:i.isLoading}),i.slots&&!i.booking?e.jsx(M,{slots:i.slots,onPick:i.pickSlot,disabled:i.isLoading}):null,i.error?e.jsx("div",{className:"gbw-mx-4 gbw-mb-2 gbw-rounded-lg gbw-border gbw-border-red-200 gbw-bg-red-50 gbw-px-3 gbw-py-2 gbw-text-xs gbw-text-red-700",children:i.error}):null,i.booking?e.jsx(P,{}):e.jsx(B,{onSend:i.sendMessage,disabled:i.isLoading,placeholder:"Reply…"})]})]}):null]})}function z({ownerName:g,onClose:o}){return e.jsxs("div",{className:"gbw-flex gbw-items-center gbw-justify-between gbw-border-b gbw-border-gropulse-border gbw-bg-gropulse-navy gbw-px-4 gbw-py-3 gbw-text-white",children:[e.jsxs("div",{children:[e.jsx("div",{className:"gbw-text-sm gbw-font-semibold",children:"Gropulse Growth Strategy"}),e.jsxs("div",{className:"gbw-text-xs gbw-text-white/70",children:["Hey ",g.split(" ")[0]," — let’s find a time."]})]}),e.jsx("button",{type:"button",onClick:o,"aria-label":"Close",className:"gbw-rounded-md gbw-p-1 gbw-text-white/80 gbw-transition hover:gbw-bg-white/10 hover:gbw-text-white",children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]})}function P(){return e.jsx("div",{className:"gbw-border-t gbw-border-gropulse-border gbw-bg-gropulse-bg gbw-px-4 gbw-py-3 gbw-text-center gbw-text-xs gbw-text-gropulse-muted",children:"Calendar invite on its way. You can close this window."})}exports.BookingWidget=_;exports.useBookingChat=v;
package/dist/index.js CHANGED
@@ -1,131 +1,142 @@
1
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
- import { useState as m, useCallback as y, useRef as T, useEffect as N, useMemo as B } from "react";
1
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
+ import { useState as p, useCallback as v, useRef as T, useEffect as N, useMemo as j } from "react";
3
3
  function D(g) {
4
- const { apiBaseUrl: o, context: n, onBookingConfirmed: t } = g, [s, w] = m([]), [v, i] = m(null), [f, r] = m(null), [c, p] = m(!1), [C, h] = m(null), x = y(
5
- async (b) => {
6
- const l = {
7
- ...n,
8
- timezone: n.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone
9
- }, d = await fetch(`${o}/api/chat`, {
4
+ const { apiBaseUrl: s, context: r, onBookingConfirmed: t } = g, [o, b] = p([]), [a, n] = p(null), [y, i] = p(null), [u, h] = p(!1), [L, f] = p(null), x = v(
5
+ async (l) => {
6
+ const w = {
7
+ ...r,
8
+ timezone: r.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone
9
+ }, c = await fetch(`${s}/api/chat`, {
10
10
  method: "POST",
11
11
  headers: { "Content-Type": "application/json" },
12
- body: JSON.stringify({ messages: b, context: l })
12
+ body: JSON.stringify({ messages: l, context: w })
13
13
  });
14
- if (!d.ok) {
15
- const u = await d.text();
16
- throw new Error(`Chat API error ${d.status}: ${u}`);
14
+ if (!c.ok) {
15
+ const m = await c.text();
16
+ throw new Error(`Chat API error ${c.status}: ${m}`);
17
17
  }
18
- return await d.json();
18
+ return await c.json();
19
19
  },
20
- [o, n]
21
- ), k = y(
22
- (b) => {
23
- w((l) => [...l, { role: "assistant", content: b.message }]), b.action === "show_slots" && b.slots && i(b.slots), b.action === "booking_confirmed" && b.booking && (r(b.booking), i(null), t == null || t(b.booking));
20
+ [s, r]
21
+ ), k = v(
22
+ (l) => {
23
+ b((w) => [...w, { role: "assistant", content: l.message }]), l.action === "show_slots" && l.slots && n(l.slots), l.action === "booking_confirmed" && l.booking && (i(l.booking), n(null), t == null || t(l.booking));
24
24
  },
25
25
  [t]
26
- ), L = y(async () => {
27
- if (!(s.length > 0 || c)) {
28
- p(!0), h(null);
26
+ ), S = v(async () => {
27
+ if (!(o.length > 0 || u)) {
28
+ h(!0), f(null);
29
29
  try {
30
- const l = await x([{
30
+ const w = await x([{
31
31
  role: "user",
32
32
  content: "__START__"
33
33
  }]);
34
- w([{ role: "assistant", content: l.message }]), l.action === "show_slots" && l.slots && i(l.slots), l.action === "booking_confirmed" && l.booking && (r(l.booking), t == null || t(l.booking));
35
- } catch (b) {
36
- h(b.message);
34
+ b([{ role: "assistant", content: w.message }]), w.action === "show_slots" && w.slots && n(w.slots), w.action === "booking_confirmed" && w.booking && (i(w.booking), t == null || t(w.booking));
35
+ } catch (l) {
36
+ f(l.message);
37
37
  } finally {
38
- p(!1);
38
+ h(!1);
39
39
  }
40
40
  }
41
- }, [s.length, c, x, t]), S = y(
42
- async (b) => {
43
- const l = b.trim();
44
- if (!l || c) return;
45
- const d = [...s, { role: "user", content: l }];
46
- w(d), p(!0), h(null);
41
+ }, [o.length, u, x, t]), C = v(
42
+ async (l) => {
43
+ const w = l.trim();
44
+ if (!w || u) return;
45
+ const c = [...o, { role: "user", content: w }];
46
+ b(c), h(!0), f(null);
47
47
  try {
48
- const u = await x(d);
49
- k(u);
50
- } catch (u) {
51
- h(u.message);
48
+ const m = await x(c);
49
+ k(m);
50
+ } catch (m) {
51
+ f(m.message);
52
52
  } finally {
53
- p(!1);
53
+ h(!1);
54
54
  }
55
55
  },
56
- [s, c, x, k]
57
- ), j = y(
58
- async (b) => {
59
- if (c) return;
60
- const l = new Date(b.time).toLocaleString(void 0, {
56
+ [o, u, x, k]
57
+ ), $ = v(
58
+ async (l) => {
59
+ if (u) return;
60
+ const w = new Date(l.time).toLocaleString(void 0, {
61
61
  weekday: "short",
62
62
  month: "short",
63
63
  day: "numeric",
64
64
  hour: "numeric",
65
65
  minute: "2-digit"
66
- }), d = [
67
- ...s,
68
- { role: "user", content: `I'll take ${l} (${b.time})` }
66
+ }), c = [
67
+ ...o,
68
+ { role: "user", content: `I'll take ${w} (${l.time})` }
69
69
  ];
70
- w(d), i(null), p(!0), h(null);
70
+ b(c), n(null), h(!0), f(null);
71
71
  try {
72
- const u = await x(d);
73
- k(u);
74
- } catch (u) {
75
- h(u.message);
72
+ const m = await x(c);
73
+ k(m);
74
+ } catch (m) {
75
+ f(m.message);
76
76
  } finally {
77
- p(!1);
77
+ h(!1);
78
78
  }
79
79
  },
80
- [s, c, x, k]
80
+ [o, u, x, k]
81
81
  );
82
- return { messages: s, slots: v, booking: f, isLoading: c, error: C, sendMessage: S, pickSlot: j, start: L };
82
+ return { messages: o, slots: a, booking: y, isLoading: u, error: L, sendMessage: C, pickSlot: $, start: S };
83
83
  }
84
- function _({ message: g }) {
85
- const o = g.role === "user";
86
- return /* @__PURE__ */ e("div", { className: `gbw-flex ${o ? "gbw-justify-end" : "gbw-justify-start"} gbw-mb-2`, children: /* @__PURE__ */ e(
84
+ function B(g) {
85
+ return g.split(`
86
+ `).flatMap((s, r, t) => {
87
+ const o = [], b = s.split(/(\*\*[^*]+\*\*|\*[^*]+\*)/g);
88
+ for (let a = 0; a < b.length; a++) {
89
+ const n = b[a];
90
+ n.startsWith("**") && n.endsWith("**") ? o.push(/* @__PURE__ */ e("strong", { children: n.slice(2, -2) }, `${r}-${a}`)) : n.startsWith("*") && n.endsWith("*") ? o.push(/* @__PURE__ */ e("em", { children: n.slice(1, -1) }, `${r}-${a}`)) : o.push(n);
91
+ }
92
+ return r < t.length - 1 && o.push(/* @__PURE__ */ e("br", {}, `br-${r}`)), o;
93
+ });
94
+ }
95
+ function M({ message: g }) {
96
+ const s = g.role === "user";
97
+ return /* @__PURE__ */ e("div", { className: `gbw-flex ${s ? "gbw-justify-end" : "gbw-justify-start"} gbw-mb-2`, children: /* @__PURE__ */ e(
87
98
  "div",
88
99
  {
89
- className: o ? "gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-br-sm gbw-bg-gropulse-navy gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-white" : "gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-gropulse-text gbw-border gbw-border-gropulse-border",
90
- children: g.content
100
+ className: s ? "gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-br-sm gbw-bg-gropulse-navy gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-white" : "gbw-max-w-[80%] gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-px-3.5 gbw-py-2 gbw-text-sm gbw-text-gropulse-text gbw-border gbw-border-gropulse-border",
101
+ children: s ? g.content : B(g.content)
91
102
  }
92
103
  ) });
93
104
  }
94
- function I({ messages: g, isLoading: o }) {
95
- const n = T(null);
105
+ function _({ messages: g, isLoading: s }) {
106
+ const r = T(null);
96
107
  return N(() => {
97
108
  var t;
98
- (t = n.current) == null || t.scrollIntoView({ behavior: "smooth", block: "end" });
99
- }, [g, o]), /* @__PURE__ */ a("div", { className: "gbw-flex-1 gbw-overflow-y-auto gbw-px-4 gbw-py-3", children: [
100
- g.map((t, s) => /* @__PURE__ */ e(_, { message: t }, s)),
101
- o ? /* @__PURE__ */ e(M, {}) : null,
102
- /* @__PURE__ */ e("div", { ref: n })
109
+ (t = r.current) == null || t.scrollIntoView({ behavior: "smooth", block: "end" });
110
+ }, [g, s]), /* @__PURE__ */ d("div", { className: "gbw-flex-1 gbw-overflow-y-auto gbw-px-4 gbw-py-3", children: [
111
+ g.map((t, o) => /* @__PURE__ */ e(M, { message: t }, o)),
112
+ s ? /* @__PURE__ */ e(W, {}) : null,
113
+ /* @__PURE__ */ e("div", { ref: r })
103
114
  ] });
104
115
  }
105
- function M() {
106
- return /* @__PURE__ */ e("div", { className: "gbw-flex gbw-justify-start gbw-mb-2", children: /* @__PURE__ */ e("div", { className: "gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-border gbw-border-gropulse-border gbw-px-3.5 gbw-py-2.5", children: /* @__PURE__ */ a("div", { className: "gbw-flex gbw-gap-1", children: [
116
+ function W() {
117
+ return /* @__PURE__ */ e("div", { className: "gbw-flex gbw-justify-start gbw-mb-2", children: /* @__PURE__ */ e("div", { className: "gbw-rounded-2xl gbw-rounded-bl-sm gbw-bg-gropulse-bg gbw-border gbw-border-gropulse-border gbw-px-3.5 gbw-py-2.5", children: /* @__PURE__ */ d("div", { className: "gbw-flex gbw-gap-1", children: [
107
118
  /* @__PURE__ */ e("span", { className: "gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block" }),
108
119
  /* @__PURE__ */ e("span", { className: "gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block" }),
109
120
  /* @__PURE__ */ e("span", { className: "gbw-typing-dot gbw-h-1.5 gbw-w-1.5 gbw-rounded-full gbw-bg-gropulse-muted gbw-inline-block" })
110
121
  ] }) }) });
111
122
  }
112
- function $({ onSend: g, disabled: o, placeholder: n }) {
113
- const [t, s] = m(""), w = () => {
114
- const i = t.trim();
115
- !i || o || (g(i), s(""));
123
+ function z({ onSend: g, disabled: s, placeholder: r }) {
124
+ const [t, o] = p(""), b = () => {
125
+ const n = t.trim();
126
+ !n || s || (g(n), o(""));
116
127
  };
117
- return /* @__PURE__ */ e("div", { className: "gbw-border-t gbw-border-gropulse-border gbw-bg-white gbw-p-3", children: /* @__PURE__ */ a("div", { className: "gbw-flex gbw-items-end gbw-gap-2", children: [
128
+ return /* @__PURE__ */ e("div", { className: "gbw-border-t gbw-border-gropulse-border gbw-bg-white gbw-p-3", children: /* @__PURE__ */ d("div", { className: "gbw-flex gbw-items-end gbw-gap-2", children: [
118
129
  /* @__PURE__ */ e(
119
130
  "textarea",
120
131
  {
121
132
  value: t,
122
- onChange: (i) => s(i.target.value),
123
- onKeyDown: (i) => {
124
- i.key === "Enter" && !i.shiftKey && (i.preventDefault(), w());
133
+ onChange: (n) => o(n.target.value),
134
+ onKeyDown: (n) => {
135
+ n.key === "Enter" && !n.shiftKey && (n.preventDefault(), b());
125
136
  },
126
- disabled: o,
137
+ disabled: s,
127
138
  rows: 1,
128
- placeholder: n ?? "Type a message…",
139
+ placeholder: r ?? "Type a message…",
129
140
  className: "gbw-flex-1 gbw-resize-none gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-px-3 gbw-py-2 gbw-text-sm gbw-outline-none focus:gbw-border-gropulse-navy focus:gbw-ring-2 focus:gbw-ring-gropulse-navy/10 disabled:gbw-bg-gropulse-bg disabled:gbw-text-gropulse-muted",
130
141
  style: { maxHeight: 120 }
131
142
  }
@@ -134,47 +145,51 @@ function $({ onSend: g, disabled: o, placeholder: n }) {
134
145
  "button",
135
146
  {
136
147
  type: "button",
137
- onClick: w,
138
- disabled: o || !t.trim(),
148
+ onClick: b,
149
+ disabled: s || !t.trim(),
139
150
  className: "gbw-shrink-0 gbw-rounded-xl gbw-bg-gropulse-navy gbw-px-4 gbw-py-2 gbw-text-sm gbw-font-medium gbw-text-white gbw-transition hover:gbw-bg-gropulse-navyHover disabled:gbw-opacity-40",
140
151
  children: "Send"
141
152
  }
142
153
  )
143
154
  ] }) });
144
155
  }
145
- function z({ slots: g, onPick: o, disabled: n }) {
146
- const t = B(() => H(g), [g]);
147
- return g.length === 0 ? /* @__PURE__ */ e("div", { className: "gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-gropulse-bg gbw-px-3 gbw-py-2 gbw-text-sm gbw-text-gropulse-muted", children: "No slots available right now — try again in a moment." }) : /* @__PURE__ */ a("div", { className: "gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-p-3", children: [
156
+ function H({ slots: g, onPick: s, disabled: r }) {
157
+ const t = j(() => P(g), [g]);
158
+ return g.length === 0 ? /* @__PURE__ */ e("div", { className: "gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-gropulse-bg gbw-px-3 gbw-py-2 gbw-text-sm gbw-text-gropulse-muted", children: "No slots available right now — try again in a moment." }) : /* @__PURE__ */ d("div", { className: "gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-p-3", children: [
148
159
  /* @__PURE__ */ e("div", { className: "gbw-mb-2 gbw-text-xs gbw-font-medium gbw-uppercase gbw-tracking-wide gbw-text-gropulse-muted", children: "Pick a time that works" }),
149
- /* @__PURE__ */ e("div", { className: "gbw-flex gbw-flex-col gbw-gap-3 gbw-max-h-60 gbw-overflow-y-auto", children: t.map((s) => /* @__PURE__ */ a("div", { children: [
150
- /* @__PURE__ */ e("div", { className: "gbw-mb-1.5 gbw-text-xs gbw-font-semibold gbw-text-gropulse-text", children: s.dayLabel }),
151
- /* @__PURE__ */ e("div", { className: "gbw-grid gbw-grid-cols-3 gbw-gap-1.5", children: s.slots.map((w) => /* @__PURE__ */ e(
160
+ /* @__PURE__ */ e("div", { className: "gbw-flex gbw-flex-col gbw-gap-3 gbw-max-h-60 gbw-overflow-y-auto", children: t.map((o) => /* @__PURE__ */ d("div", { children: [
161
+ /* @__PURE__ */ e("div", { className: "gbw-mb-1.5 gbw-text-xs gbw-font-semibold gbw-text-gropulse-text", children: o.dayLabel }),
162
+ /* @__PURE__ */ e("div", { className: "gbw-grid gbw-grid-cols-3 gbw-gap-1.5", children: o.slots.map((b) => /* @__PURE__ */ e(
152
163
  "button",
153
164
  {
154
165
  type: "button",
155
- disabled: n,
156
- onClick: () => o(w),
166
+ disabled: r,
167
+ onClick: () => s(b),
157
168
  className: "gbw-rounded-lg gbw-border gbw-border-gropulse-border gbw-bg-white gbw-px-2 gbw-py-1.5 gbw-text-xs gbw-font-medium gbw-text-gropulse-text gbw-transition hover:gbw-border-gropulse-navy hover:gbw-bg-gropulse-navy hover:gbw-text-white disabled:gbw-opacity-40",
158
- children: P(w.time)
169
+ children: R(b.time)
159
170
  },
160
- w.time
171
+ b.time
161
172
  )) })
162
- ] }, s.dayLabel)) })
173
+ ] }, o.dayLabel)) })
163
174
  ] });
164
175
  }
165
- function H(g) {
166
- const o = /* @__PURE__ */ new Map();
167
- for (const n of g) {
168
- const s = new Date(n.time).toLocaleDateString(void 0, {
169
- weekday: "short",
176
+ function P(g) {
177
+ const s = /* @__PURE__ */ new Map();
178
+ for (const t of g) {
179
+ const b = new Date(t.time).toLocaleDateString(void 0, {
180
+ weekday: "long",
170
181
  month: "short",
171
182
  day: "numeric"
172
- }), w = o.get(s);
173
- w ? w.push(n) : o.set(s, [n]);
183
+ }), a = s.get(b);
184
+ a ? a.push(t) : s.set(b, [t]);
174
185
  }
175
- return Array.from(o.entries()).map(([n, t]) => ({ dayLabel: n, slots: t }));
186
+ const r = (/* @__PURE__ */ new Date()).toLocaleTimeString(void 0, { timeZoneName: "short" }).split(" ").pop() ?? "";
187
+ return Array.from(s.entries()).map(([t, o]) => ({
188
+ dayLabel: `${t} · ${r}`,
189
+ slots: o
190
+ }));
176
191
  }
177
- function P(g) {
192
+ function R(g) {
178
193
  return new Date(g).toLocaleTimeString(void 0, {
179
194
  hour: "numeric",
180
195
  minute: "2-digit"
@@ -182,59 +197,59 @@ function P(g) {
182
197
  }
183
198
  function A(g) {
184
199
  const {
185
- apiBaseUrl: o,
186
- context: n,
200
+ apiBaseUrl: s,
201
+ context: r,
187
202
  trigger: t = "button",
188
- buttonLabel: s = "Book Free Strategy Call",
189
- onBookingConfirmed: w,
190
- className: v
191
- } = g, [i, f] = m(t === "auto"), r = D({ apiBaseUrl: o, context: n, onBookingConfirmed: w });
203
+ buttonLabel: o = "Book Free Strategy Call",
204
+ onBookingConfirmed: b,
205
+ className: a
206
+ } = g, [n, y] = p(t === "auto"), i = D({ apiBaseUrl: s, context: r, onBookingConfirmed: b });
192
207
  return N(() => {
193
- i && r.messages.length === 0 && !r.isLoading && r.start();
194
- }, [i, r]), /* @__PURE__ */ a("div", { className: `gbw-root ${v ?? ""}`, children: [
195
- t === "button" ? /* @__PURE__ */ a(
208
+ n && i.messages.length === 0 && !i.isLoading && i.start();
209
+ }, [n, i]), /* @__PURE__ */ d("div", { className: `gbw-root ${a ?? ""}`, children: [
210
+ t === "button" ? /* @__PURE__ */ d(
196
211
  "button",
197
212
  {
198
213
  type: "button",
199
- onClick: () => f((c) => !c),
214
+ onClick: () => y((u) => !u),
200
215
  className: "gbw-inline-flex gbw-items-center gbw-gap-2 gbw-rounded-xl gbw-bg-gropulse-navy gbw-px-4 gbw-py-2.5 gbw-text-sm gbw-font-medium gbw-text-white gbw-shadow-sm gbw-transition hover:gbw-bg-gropulse-navyHover",
201
216
  children: [
202
217
  /* @__PURE__ */ e("span", { className: "gbw-h-2 gbw-w-2 gbw-rounded-full gbw-bg-gropulse-accent" }),
203
- s
218
+ o
204
219
  ]
205
220
  }
206
221
  ) : null,
207
- i ? /* @__PURE__ */ a("div", { className: "gbw-fixed gbw-inset-0 gbw-z-[9999] gbw-flex gbw-items-end gbw-justify-end gbw-p-0 sm:gbw-p-4", children: [
222
+ n ? /* @__PURE__ */ d("div", { className: "gbw-fixed gbw-inset-0 gbw-z-[9999] gbw-flex gbw-items-end gbw-justify-end gbw-p-0 sm:gbw-p-4", children: [
208
223
  /* @__PURE__ */ e(
209
224
  "div",
210
225
  {
211
226
  className: "gbw-absolute gbw-inset-0 gbw-bg-black/20",
212
- onClick: () => f(!1)
227
+ onClick: () => y(!1)
213
228
  }
214
229
  ),
215
- /* @__PURE__ */ a("div", { className: "gbw-relative gbw-flex gbw-h-full gbw-w-full gbw-flex-col gbw-overflow-hidden gbw-bg-white gbw-shadow-panel sm:gbw-h-[620px] sm:gbw-w-[400px] sm:gbw-rounded-2xl", children: [
230
+ /* @__PURE__ */ d("div", { className: "gbw-relative gbw-flex gbw-h-full gbw-w-full gbw-flex-col gbw-overflow-hidden gbw-bg-white gbw-shadow-panel sm:gbw-h-[620px] sm:gbw-w-[400px] sm:gbw-rounded-2xl", children: [
216
231
  /* @__PURE__ */ e(
217
- R,
232
+ E,
218
233
  {
219
- ownerName: n.ownerName,
220
- onClose: () => f(!1)
234
+ ownerName: r.ownerName,
235
+ onClose: () => y(!1)
221
236
  }
222
237
  ),
223
- /* @__PURE__ */ e(I, { messages: r.messages, isLoading: r.isLoading }),
224
- r.slots && !r.booking ? /* @__PURE__ */ e(
225
- z,
238
+ /* @__PURE__ */ e(_, { messages: i.messages, isLoading: i.isLoading }),
239
+ i.slots && !i.booking ? /* @__PURE__ */ e(
240
+ H,
226
241
  {
227
- slots: r.slots,
228
- onPick: r.pickSlot,
229
- disabled: r.isLoading
242
+ slots: i.slots,
243
+ onPick: i.pickSlot,
244
+ disabled: i.isLoading
230
245
  }
231
246
  ) : null,
232
- r.error ? /* @__PURE__ */ e("div", { className: "gbw-mx-4 gbw-mb-2 gbw-rounded-lg gbw-border gbw-border-red-200 gbw-bg-red-50 gbw-px-3 gbw-py-2 gbw-text-xs gbw-text-red-700", children: r.error }) : null,
233
- r.booking ? /* @__PURE__ */ e(E, {}) : /* @__PURE__ */ e(
234
- $,
247
+ i.error ? /* @__PURE__ */ e("div", { className: "gbw-mx-4 gbw-mb-2 gbw-rounded-lg gbw-border gbw-border-red-200 gbw-bg-red-50 gbw-px-3 gbw-py-2 gbw-text-xs gbw-text-red-700", children: i.error }) : null,
248
+ i.booking ? /* @__PURE__ */ e(I, {}) : /* @__PURE__ */ e(
249
+ z,
235
250
  {
236
- onSend: r.sendMessage,
237
- disabled: r.isLoading,
251
+ onSend: i.sendMessage,
252
+ disabled: i.isLoading,
238
253
  placeholder: "Reply…"
239
254
  }
240
255
  )
@@ -242,11 +257,11 @@ function A(g) {
242
257
  ] }) : null
243
258
  ] });
244
259
  }
245
- function R({ ownerName: g, onClose: o }) {
246
- return /* @__PURE__ */ a("div", { className: "gbw-flex gbw-items-center gbw-justify-between gbw-border-b gbw-border-gropulse-border gbw-bg-gropulse-navy gbw-px-4 gbw-py-3 gbw-text-white", children: [
247
- /* @__PURE__ */ a("div", { children: [
260
+ function E({ ownerName: g, onClose: s }) {
261
+ return /* @__PURE__ */ d("div", { className: "gbw-flex gbw-items-center gbw-justify-between gbw-border-b gbw-border-gropulse-border gbw-bg-gropulse-navy gbw-px-4 gbw-py-3 gbw-text-white", children: [
262
+ /* @__PURE__ */ d("div", { children: [
248
263
  /* @__PURE__ */ e("div", { className: "gbw-text-sm gbw-font-semibold", children: "Gropulse Growth Strategy" }),
249
- /* @__PURE__ */ a("div", { className: "gbw-text-xs gbw-text-white/70", children: [
264
+ /* @__PURE__ */ d("div", { className: "gbw-text-xs gbw-text-white/70", children: [
250
265
  "Hey ",
251
266
  g.split(" ")[0],
252
267
  " — let’s find a time."
@@ -256,10 +271,10 @@ function R({ ownerName: g, onClose: o }) {
256
271
  "button",
257
272
  {
258
273
  type: "button",
259
- onClick: o,
274
+ onClick: s,
260
275
  "aria-label": "Close",
261
276
  className: "gbw-rounded-md gbw-p-1 gbw-text-white/80 gbw-transition hover:gbw-bg-white/10 hover:gbw-text-white",
262
- children: /* @__PURE__ */ a(
277
+ children: /* @__PURE__ */ d(
263
278
  "svg",
264
279
  {
265
280
  width: "18",
@@ -280,7 +295,7 @@ function R({ ownerName: g, onClose: o }) {
280
295
  )
281
296
  ] });
282
297
  }
283
- function E() {
298
+ function I() {
284
299
  return /* @__PURE__ */ e("div", { className: "gbw-border-t gbw-border-gropulse-border gbw-bg-gropulse-bg gbw-px-4 gbw-py-3 gbw-text-center gbw-text-xs gbw-text-gropulse-muted", children: "Calendar invite on its way. You can close this window." });
285
300
  }
286
301
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gropulse/booking-widget",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Gropulse booking chat widget — embeds in Shopify apps to book free growth strategy calls",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",