@gropulse/booking-widget 0.1.2 → 0.1.3

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.
@@ -13,6 +13,7 @@ interface UseBookingChatResult {
13
13
  sendMessage: (text: string) => Promise<void>;
14
14
  pickSlot: (slot: Slot) => Promise<void>;
15
15
  start: () => Promise<void>;
16
+ reset: () => void;
16
17
  }
17
18
  export declare function useBookingChat(opts: UseBookingChatOptions): UseBookingChatResult;
18
19
  export {};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react"),B=60*24*60*60*1e3;function v(t){return`gbw_booking_${t}`}function D(t){try{const o=localStorage.getItem(v(t));if(!o)return null;const s=JSON.parse(o);return Date.now()-s.savedAt>B?(localStorage.removeItem(v(t)),null):{id:s.id,start:s.start,attendeeEmail:s.attendeeEmail}}catch{return null}}function $(t,o){try{localStorage.setItem(v(t),JSON.stringify({...o,savedAt:Date.now()}))}catch{}}function T(t){try{localStorage.removeItem(v(t))}catch{}}function j(t){const{apiBaseUrl:o,context:s,onBookingConfirmed:n}=t,[r,i]=w.useState([]),[d,g]=w.useState(null),[f,b]=w.useState(()=>D(s.shopDomain)),[c,x]=w.useState(!1),[k,p]=w.useState(null),h=w.useCallback(async l=>{const a={...s,timezone:s.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone},u=await fetch(`${o}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:l,context:a})});if(!u.ok){const m=await u.text();throw new Error(`Chat API error ${u.status}: ${m}`)}return await u.json()},[o,s]),y=w.useCallback(l=>{i(a=>[...a,{role:"assistant",content:l.message}]),l.action==="show_slots"&&l.slots&&g(l.slots),l.action==="booking_confirmed"&&l.booking&&(b(l.booking),g(null),$(s.shopDomain,l.booking),n==null||n(l.booking))},[n,s.shopDomain]),N=w.useCallback(async()=>{if(!(r.length>0||c)){x(!0),p(null);try{const a=await h([{role:"user",content:"__START__"}]);i([{role:"assistant",content:a.message}]),a.action==="show_slots"&&a.slots&&g(a.slots),a.action==="booking_confirmed"&&a.booking&&(b(a.booking),n==null||n(a.booking))}catch(l){p(l.message)}finally{x(!1)}}},[r.length,c,h,n]),S=w.useCallback(async l=>{const a=l.trim();if(!a||c)return;const u=[...r,{role:"user",content:a}];i(u),x(!0),p(null);try{const m=await h(u);y(m)}catch(m){p(m.message)}finally{x(!1)}},[r,c,h,y]),C=w.useCallback(async l=>{if(c)return;const a=new Date(l.time).toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),u=[...r,{role:"user",content:`I'll take ${a} (${l.time})`}];i(u),g(null),x(!0),p(null);try{const m=await h(u);y(m)}catch(m){p(m.message)}finally{x(!1)}},[r,c,h,y]),L=w.useCallback(()=>{T(s.shopDomain),i([]),g(null),b(null),p(null)},[s.shopDomain]);return{messages:r,slots:d,booking:f,isLoading:c,error:k,sendMessage:S,pickSlot:C,start:N,reset:L}}function M(t){return t.split(`
2
+ `).flatMap((o,s,n)=>{const r=[],i=o.split(/(\*\*[^*]+\*\*|\*[^*]+\*)/g);for(let d=0;d<i.length;d++){const g=i[d];g.startsWith("**")&&g.endsWith("**")?r.push(e.jsx("strong",{children:g.slice(2,-2)},`${s}-${d}`)):g.startsWith("*")&&g.endsWith("*")?r.push(e.jsx("em",{children:g.slice(1,-1)},`${s}-${d}`)):r.push(g)}return s<n.length-1&&r.push(e.jsx("br",{},`br-${s}`)),r})}function _({message:t}){const o=t.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?t.content:M(t.content)})})}function I({messages:t,isLoading:o}){const s=w.useRef(null);return w.useEffect(()=>{var n;(n=s.current)==null||n.scrollIntoView({behavior:"smooth",block:"end"})},[t,o]),e.jsxs("div",{className:"gbw-flex-1 gbw-overflow-y-auto gbw-px-4 gbw-py-3",children:[t.map((n,r)=>e.jsx(_,{message:n},r)),o?e.jsx(O,{}):null,e.jsx("div",{ref:s})]})}function O(){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 W({onSend:t,disabled:o,placeholder:s}){const[n,r]=w.useState(""),i=()=>{const g=n.trim();!g||o||(t(g),r(""))},d=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),i())};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:n,onChange:g=>r(g.target.value),onKeyDown:d,disabled:o,rows:1,placeholder:s??"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:i,disabled:o||!n.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 E({slots:t,onPick:o,disabled:s}){const n=w.useMemo(()=>R(t),[t]);return t.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:n.map(r=>e.jsxs("div",{children:[e.jsx("div",{className:"gbw-mb-1.5 gbw-text-xs gbw-font-semibold gbw-text-gropulse-text",children:r.dayLabel}),e.jsx("div",{className:"gbw-grid gbw-grid-cols-3 gbw-gap-1.5",children:r.slots.map(i=>e.jsx("button",{type:"button",disabled:s,onClick:()=>o(i),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:z(i.time)},i.time))})]},r.dayLabel))})]})}function R(t){const o=new Map;for(const n of t){const i=new Date(n.time).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"}),d=o.get(i);d?d.push(n):o.set(i,[n])}const s=new Date().toLocaleTimeString(void 0,{timeZoneName:"short"}).split(" ").pop()??"";return Array.from(o.entries()).map(([n,r])=>({dayLabel:`${n} · ${s}`,slots:r}))}function z(t){return new Date(t).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function A(t){const{apiBaseUrl:o,context:s,trigger:n="button",buttonLabel:r="Book Free Strategy Call",onBookingConfirmed:i,className:d}=t,[g,f]=w.useState(n==="auto"),b=j({apiBaseUrl:o,context:s,onBookingConfirmed:i}),c=b.booking!==null&&b.messages.length===0;return w.useEffect(()=>{g&&!c&&b.messages.length===0&&!b.isLoading&&b.start()},[g,c,b]),e.jsxs("div",{className:`gbw-root ${d??""}`,children:[n==="button"?e.jsxs("button",{type:"button",onClick:()=>f(x=>!x),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"}),c?"View Your Booking":r]}):null,g?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(P,{ownerName:s.ownerName,onClose:()=>f(!1)}),c?e.jsx(K,{booking:b.booking,ownerName:s.ownerName,onReset:b.reset}):e.jsxs(e.Fragment,{children:[e.jsx(I,{messages:b.messages,isLoading:b.isLoading}),b.slots&&!b.booking?e.jsx(E,{slots:b.slots,onPick:b.pickSlot,disabled:b.isLoading}):null,b.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:b.error}):null,b.booking?e.jsx(H,{}):e.jsx(W,{onSend:b.sendMessage,disabled:b.isLoading,placeholder:"Reply…"})]})]})]}):null]})}function P({ownerName:t,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 ",t.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 H(){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."})}function K({booking:t,ownerName:o,onReset:s}){const n=new Date(t.start).toLocaleString(void 0,{weekday:"long",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"});return e.jsxs("div",{className:"gbw-flex gbw-flex-1 gbw-flex-col gbw-items-center gbw-justify-center gbw-gap-4 gbw-p-6 gbw-text-center",children:[e.jsx("div",{className:"gbw-flex gbw-h-14 gbw-w-14 gbw-items-center gbw-justify-center gbw-rounded-full gbw-bg-green-100",children:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"#16a34a",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}),e.jsxs("div",{children:[e.jsxs("div",{className:"gbw-text-base gbw-font-semibold gbw-text-gropulse-text",children:["You’re all booked, ",o.split(" ")[0],"!"]}),e.jsx("div",{className:"gbw-mt-1 gbw-text-sm gbw-text-gropulse-muted",children:n}),e.jsxs("div",{className:"gbw-mt-0.5 gbw-text-xs gbw-text-gropulse-muted",children:["Invite sent to ",t.attendeeEmail]})]}),e.jsx("button",{type:"button",onClick:s,className:"gbw-mt-2 gbw-text-xs gbw-text-gropulse-muted gbw-underline gbw-underline-offset-2 hover:gbw-text-gropulse-text",children:"Book another call"})]})}exports.BookingWidget=A;exports.useBookingChat=j;
package/dist/index.js CHANGED
@@ -1,142 +1,175 @@
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
- function D(g) {
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(
1
+ import { jsx as e, jsxs as a, Fragment as j } from "react/jsx-runtime";
2
+ import { useState as f, useCallback as y, useRef as T, useEffect as S, useMemo as _ } from "react";
3
+ const M = 60 * 24 * 60 * 60 * 1e3;
4
+ function N(t) {
5
+ return `gbw_booking_${t}`;
6
+ }
7
+ function I(t) {
8
+ try {
9
+ const n = localStorage.getItem(N(t));
10
+ if (!n) return null;
11
+ const o = JSON.parse(n);
12
+ return Date.now() - o.savedAt > M ? (localStorage.removeItem(N(t)), null) : { id: o.id, start: o.start, attendeeEmail: o.attendeeEmail };
13
+ } catch {
14
+ return null;
15
+ }
16
+ }
17
+ function O(t, n) {
18
+ try {
19
+ localStorage.setItem(
20
+ N(t),
21
+ JSON.stringify({ ...n, savedAt: Date.now() })
22
+ );
23
+ } catch {
24
+ }
25
+ }
26
+ function W(t) {
27
+ try {
28
+ localStorage.removeItem(N(t));
29
+ } catch {
30
+ }
31
+ }
32
+ function E(t) {
33
+ const { apiBaseUrl: n, context: o, onBookingConfirmed: r } = t, [s, i] = f([]), [d, g] = f(null), [v, b] = f(
34
+ () => I(o.shopDomain)
35
+ ), [c, p] = f(!1), [L, h] = f(null), x = y(
5
36
  async (l) => {
6
37
  const w = {
7
- ...r,
8
- timezone: r.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone
9
- }, c = await fetch(`${s}/api/chat`, {
38
+ ...o,
39
+ timezone: o.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone
40
+ }, u = await fetch(`${n}/api/chat`, {
10
41
  method: "POST",
11
42
  headers: { "Content-Type": "application/json" },
12
43
  body: JSON.stringify({ messages: l, context: w })
13
44
  });
14
- if (!c.ok) {
15
- const m = await c.text();
16
- throw new Error(`Chat API error ${c.status}: ${m}`);
45
+ if (!u.ok) {
46
+ const m = await u.text();
47
+ throw new Error(`Chat API error ${u.status}: ${m}`);
17
48
  }
18
- return await c.json();
49
+ return await u.json();
19
50
  },
20
- [s, r]
21
- ), k = v(
51
+ [n, o]
52
+ ), k = y(
22
53
  (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));
54
+ i((w) => [...w, { role: "assistant", content: l.message }]), l.action === "show_slots" && l.slots && g(l.slots), l.action === "booking_confirmed" && l.booking && (b(l.booking), g(null), O(o.shopDomain, l.booking), r == null || r(l.booking));
24
55
  },
25
- [t]
26
- ), S = v(async () => {
27
- if (!(o.length > 0 || u)) {
28
- h(!0), f(null);
56
+ [r, o.shopDomain]
57
+ ), B = y(async () => {
58
+ if (!(s.length > 0 || c)) {
59
+ p(!0), h(null);
29
60
  try {
30
61
  const w = await x([{
31
62
  role: "user",
32
63
  content: "__START__"
33
64
  }]);
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));
65
+ i([{ role: "assistant", content: w.message }]), w.action === "show_slots" && w.slots && g(w.slots), w.action === "booking_confirmed" && w.booking && (b(w.booking), r == null || r(w.booking));
35
66
  } catch (l) {
36
- f(l.message);
67
+ h(l.message);
37
68
  } finally {
38
- h(!1);
69
+ p(!1);
39
70
  }
40
71
  }
41
- }, [o.length, u, x, t]), C = v(
72
+ }, [s.length, c, x, r]), D = y(
42
73
  async (l) => {
43
74
  const w = l.trim();
44
- if (!w || u) return;
45
- const c = [...o, { role: "user", content: w }];
46
- b(c), h(!0), f(null);
75
+ if (!w || c) return;
76
+ const u = [...s, { role: "user", content: w }];
77
+ i(u), p(!0), h(null);
47
78
  try {
48
- const m = await x(c);
79
+ const m = await x(u);
49
80
  k(m);
50
81
  } catch (m) {
51
- f(m.message);
82
+ h(m.message);
52
83
  } finally {
53
- h(!1);
84
+ p(!1);
54
85
  }
55
86
  },
56
- [o, u, x, k]
57
- ), $ = v(
87
+ [s, c, x, k]
88
+ ), C = y(
58
89
  async (l) => {
59
- if (u) return;
90
+ if (c) return;
60
91
  const w = new Date(l.time).toLocaleString(void 0, {
61
92
  weekday: "short",
62
93
  month: "short",
63
94
  day: "numeric",
64
95
  hour: "numeric",
65
96
  minute: "2-digit"
66
- }), c = [
67
- ...o,
97
+ }), u = [
98
+ ...s,
68
99
  { role: "user", content: `I'll take ${w} (${l.time})` }
69
100
  ];
70
- b(c), n(null), h(!0), f(null);
101
+ i(u), g(null), p(!0), h(null);
71
102
  try {
72
- const m = await x(c);
103
+ const m = await x(u);
73
104
  k(m);
74
105
  } catch (m) {
75
- f(m.message);
106
+ h(m.message);
76
107
  } finally {
77
- h(!1);
108
+ p(!1);
78
109
  }
79
110
  },
80
- [o, u, x, k]
81
- );
82
- return { messages: o, slots: a, booking: y, isLoading: u, error: L, sendMessage: C, pickSlot: $, start: S };
111
+ [s, c, x, k]
112
+ ), $ = y(() => {
113
+ W(o.shopDomain), i([]), g(null), b(null), h(null);
114
+ }, [o.shopDomain]);
115
+ return { messages: s, slots: d, booking: v, isLoading: c, error: L, sendMessage: D, pickSlot: C, start: B, reset: $ };
83
116
  }
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);
117
+ function R(t) {
118
+ return t.split(`
119
+ `).flatMap((n, o, r) => {
120
+ const s = [], i = n.split(/(\*\*[^*]+\*\*|\*[^*]+\*)/g);
121
+ for (let d = 0; d < i.length; d++) {
122
+ const g = i[d];
123
+ g.startsWith("**") && g.endsWith("**") ? s.push(/* @__PURE__ */ e("strong", { children: g.slice(2, -2) }, `${o}-${d}`)) : g.startsWith("*") && g.endsWith("*") ? s.push(/* @__PURE__ */ e("em", { children: g.slice(1, -1) }, `${o}-${d}`)) : s.push(g);
91
124
  }
92
- return r < t.length - 1 && o.push(/* @__PURE__ */ e("br", {}, `br-${r}`)), o;
125
+ return o < r.length - 1 && s.push(/* @__PURE__ */ e("br", {}, `br-${o}`)), s;
93
126
  });
94
127
  }
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(
128
+ function z({ message: t }) {
129
+ const n = t.role === "user";
130
+ return /* @__PURE__ */ e("div", { className: `gbw-flex ${n ? "gbw-justify-end" : "gbw-justify-start"} gbw-mb-2`, children: /* @__PURE__ */ e(
98
131
  "div",
99
132
  {
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)
133
+ className: n ? "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",
134
+ children: n ? t.content : R(t.content)
102
135
  }
103
136
  ) });
104
137
  }
105
- function _({ messages: g, isLoading: s }) {
106
- const r = T(null);
107
- return N(() => {
108
- var t;
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 })
138
+ function A({ messages: t, isLoading: n }) {
139
+ const o = T(null);
140
+ return S(() => {
141
+ var r;
142
+ (r = o.current) == null || r.scrollIntoView({ behavior: "smooth", block: "end" });
143
+ }, [t, n]), /* @__PURE__ */ a("div", { className: "gbw-flex-1 gbw-overflow-y-auto gbw-px-4 gbw-py-3", children: [
144
+ t.map((r, s) => /* @__PURE__ */ e(z, { message: r }, s)),
145
+ n ? /* @__PURE__ */ e(K, {}) : null,
146
+ /* @__PURE__ */ e("div", { ref: o })
114
147
  ] });
115
148
  }
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: [
149
+ function K() {
150
+ 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: [
118
151
  /* @__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" }),
119
152
  /* @__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" }),
120
153
  /* @__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" })
121
154
  ] }) }) });
122
155
  }
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(""));
156
+ function H({ onSend: t, disabled: n, placeholder: o }) {
157
+ const [r, s] = f(""), i = () => {
158
+ const g = r.trim();
159
+ !g || n || (t(g), s(""));
127
160
  };
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: [
161
+ 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: [
129
162
  /* @__PURE__ */ e(
130
163
  "textarea",
131
164
  {
132
- value: t,
133
- onChange: (n) => o(n.target.value),
134
- onKeyDown: (n) => {
135
- n.key === "Enter" && !n.shiftKey && (n.preventDefault(), b());
165
+ value: r,
166
+ onChange: (g) => s(g.target.value),
167
+ onKeyDown: (g) => {
168
+ g.key === "Enter" && !g.shiftKey && (g.preventDefault(), i());
136
169
  },
137
- disabled: s,
170
+ disabled: n,
138
171
  rows: 1,
139
- placeholder: r ?? "Type a message…",
172
+ placeholder: o ?? "Type a message…",
140
173
  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",
141
174
  style: { maxHeight: 120 }
142
175
  }
@@ -145,125 +178,134 @@ function z({ onSend: g, disabled: s, placeholder: r }) {
145
178
  "button",
146
179
  {
147
180
  type: "button",
148
- onClick: b,
149
- disabled: s || !t.trim(),
181
+ onClick: i,
182
+ disabled: n || !r.trim(),
150
183
  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",
151
184
  children: "Send"
152
185
  }
153
186
  )
154
187
  ] }) });
155
188
  }
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: [
189
+ function P({ slots: t, onPick: n, disabled: o }) {
190
+ const r = _(() => F(t), [t]);
191
+ return t.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: [
159
192
  /* @__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" }),
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(
193
+ /* @__PURE__ */ e("div", { className: "gbw-flex gbw-flex-col gbw-gap-3 gbw-max-h-60 gbw-overflow-y-auto", children: r.map((s) => /* @__PURE__ */ a("div", { children: [
194
+ /* @__PURE__ */ e("div", { className: "gbw-mb-1.5 gbw-text-xs gbw-font-semibold gbw-text-gropulse-text", children: s.dayLabel }),
195
+ /* @__PURE__ */ e("div", { className: "gbw-grid gbw-grid-cols-3 gbw-gap-1.5", children: s.slots.map((i) => /* @__PURE__ */ e(
163
196
  "button",
164
197
  {
165
198
  type: "button",
166
- disabled: r,
167
- onClick: () => s(b),
199
+ disabled: o,
200
+ onClick: () => n(i),
168
201
  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",
169
- children: R(b.time)
202
+ children: V(i.time)
170
203
  },
171
- b.time
204
+ i.time
172
205
  )) })
173
- ] }, o.dayLabel)) })
206
+ ] }, s.dayLabel)) })
174
207
  ] });
175
208
  }
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, {
209
+ function F(t) {
210
+ const n = /* @__PURE__ */ new Map();
211
+ for (const r of t) {
212
+ const i = new Date(r.time).toLocaleDateString(void 0, {
180
213
  weekday: "long",
181
214
  month: "short",
182
215
  day: "numeric"
183
- }), a = s.get(b);
184
- a ? a.push(t) : s.set(b, [t]);
216
+ }), d = n.get(i);
217
+ d ? d.push(r) : n.set(i, [r]);
185
218
  }
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
219
+ const o = (/* @__PURE__ */ new Date()).toLocaleTimeString(void 0, { timeZoneName: "short" }).split(" ").pop() ?? "";
220
+ return Array.from(n.entries()).map(([r, s]) => ({
221
+ dayLabel: `${r} · ${o}`,
222
+ slots: s
190
223
  }));
191
224
  }
192
- function R(g) {
193
- return new Date(g).toLocaleTimeString(void 0, {
225
+ function V(t) {
226
+ return new Date(t).toLocaleTimeString(void 0, {
194
227
  hour: "numeric",
195
228
  minute: "2-digit"
196
229
  });
197
230
  }
198
- function A(g) {
231
+ function q(t) {
199
232
  const {
200
- apiBaseUrl: s,
201
- context: r,
202
- trigger: t = "button",
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 });
207
- return N(() => {
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(
233
+ apiBaseUrl: n,
234
+ context: o,
235
+ trigger: r = "button",
236
+ buttonLabel: s = "Book Free Strategy Call",
237
+ onBookingConfirmed: i,
238
+ className: d
239
+ } = t, [g, v] = f(r === "auto"), b = E({ apiBaseUrl: n, context: o, onBookingConfirmed: i }), c = b.booking !== null && b.messages.length === 0;
240
+ return S(() => {
241
+ g && !c && b.messages.length === 0 && !b.isLoading && b.start();
242
+ }, [g, c, b]), /* @__PURE__ */ a("div", { className: `gbw-root ${d ?? ""}`, children: [
243
+ r === "button" ? /* @__PURE__ */ a(
211
244
  "button",
212
245
  {
213
246
  type: "button",
214
- onClick: () => y((u) => !u),
247
+ onClick: () => v((p) => !p),
215
248
  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",
216
249
  children: [
217
250
  /* @__PURE__ */ e("span", { className: "gbw-h-2 gbw-w-2 gbw-rounded-full gbw-bg-gropulse-accent" }),
218
- o
251
+ c ? "View Your Booking" : s
219
252
  ]
220
253
  }
221
254
  ) : null,
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: [
255
+ g ? /* @__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: [
223
256
  /* @__PURE__ */ e(
224
257
  "div",
225
258
  {
226
259
  className: "gbw-absolute gbw-inset-0 gbw-bg-black/20",
227
- onClick: () => y(!1)
260
+ onClick: () => v(!1)
228
261
  }
229
262
  ),
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: [
263
+ /* @__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: [
231
264
  /* @__PURE__ */ e(
232
- E,
265
+ G,
233
266
  {
234
- ownerName: r.ownerName,
235
- onClose: () => y(!1)
267
+ ownerName: o.ownerName,
268
+ onClose: () => v(!1)
236
269
  }
237
270
  ),
238
- /* @__PURE__ */ e(_, { messages: i.messages, isLoading: i.isLoading }),
239
- i.slots && !i.booking ? /* @__PURE__ */ e(
240
- H,
241
- {
242
- slots: i.slots,
243
- onPick: i.pickSlot,
244
- disabled: i.isLoading
245
- }
246
- ) : null,
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,
271
+ c ? /* @__PURE__ */ e(
272
+ U,
250
273
  {
251
- onSend: i.sendMessage,
252
- disabled: i.isLoading,
253
- placeholder: "Reply…"
274
+ booking: b.booking,
275
+ ownerName: o.ownerName,
276
+ onReset: b.reset
254
277
  }
255
- )
278
+ ) : /* @__PURE__ */ a(j, { children: [
279
+ /* @__PURE__ */ e(A, { messages: b.messages, isLoading: b.isLoading }),
280
+ b.slots && !b.booking ? /* @__PURE__ */ e(
281
+ P,
282
+ {
283
+ slots: b.slots,
284
+ onPick: b.pickSlot,
285
+ disabled: b.isLoading
286
+ }
287
+ ) : null,
288
+ b.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: b.error }) : null,
289
+ b.booking ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
290
+ H,
291
+ {
292
+ onSend: b.sendMessage,
293
+ disabled: b.isLoading,
294
+ placeholder: "Reply…"
295
+ }
296
+ )
297
+ ] })
256
298
  ] })
257
299
  ] }) : null
258
300
  ] });
259
301
  }
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: [
302
+ function G({ ownerName: t, onClose: n }) {
303
+ 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: [
304
+ /* @__PURE__ */ a("div", { children: [
263
305
  /* @__PURE__ */ e("div", { className: "gbw-text-sm gbw-font-semibold", children: "Gropulse Growth Strategy" }),
264
- /* @__PURE__ */ d("div", { className: "gbw-text-xs gbw-text-white/70", children: [
306
+ /* @__PURE__ */ a("div", { className: "gbw-text-xs gbw-text-white/70", children: [
265
307
  "Hey ",
266
- g.split(" ")[0],
308
+ t.split(" ")[0],
267
309
  " — let’s find a time."
268
310
  ] })
269
311
  ] }),
@@ -271,10 +313,10 @@ function E({ ownerName: g, onClose: s }) {
271
313
  "button",
272
314
  {
273
315
  type: "button",
274
- onClick: s,
316
+ onClick: n,
275
317
  "aria-label": "Close",
276
318
  className: "gbw-rounded-md gbw-p-1 gbw-text-white/80 gbw-transition hover:gbw-bg-white/10 hover:gbw-text-white",
277
- children: /* @__PURE__ */ d(
319
+ children: /* @__PURE__ */ a(
278
320
  "svg",
279
321
  {
280
322
  width: "18",
@@ -295,10 +337,60 @@ function E({ ownerName: g, onClose: s }) {
295
337
  )
296
338
  ] });
297
339
  }
298
- function I() {
340
+ function J() {
299
341
  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." });
300
342
  }
343
+ function U({
344
+ booking: t,
345
+ ownerName: n,
346
+ onReset: o
347
+ }) {
348
+ const r = new Date(t.start).toLocaleString(void 0, {
349
+ weekday: "long",
350
+ month: "long",
351
+ day: "numeric",
352
+ hour: "numeric",
353
+ minute: "2-digit"
354
+ });
355
+ return /* @__PURE__ */ a("div", { className: "gbw-flex gbw-flex-1 gbw-flex-col gbw-items-center gbw-justify-center gbw-gap-4 gbw-p-6 gbw-text-center", children: [
356
+ /* @__PURE__ */ e("div", { className: "gbw-flex gbw-h-14 gbw-w-14 gbw-items-center gbw-justify-center gbw-rounded-full gbw-bg-green-100", children: /* @__PURE__ */ e(
357
+ "svg",
358
+ {
359
+ width: "28",
360
+ height: "28",
361
+ viewBox: "0 0 24 24",
362
+ fill: "none",
363
+ stroke: "#16a34a",
364
+ strokeWidth: "2.5",
365
+ strokeLinecap: "round",
366
+ strokeLinejoin: "round",
367
+ children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
368
+ }
369
+ ) }),
370
+ /* @__PURE__ */ a("div", { children: [
371
+ /* @__PURE__ */ a("div", { className: "gbw-text-base gbw-font-semibold gbw-text-gropulse-text", children: [
372
+ "You’re all booked, ",
373
+ n.split(" ")[0],
374
+ "!"
375
+ ] }),
376
+ /* @__PURE__ */ e("div", { className: "gbw-mt-1 gbw-text-sm gbw-text-gropulse-muted", children: r }),
377
+ /* @__PURE__ */ a("div", { className: "gbw-mt-0.5 gbw-text-xs gbw-text-gropulse-muted", children: [
378
+ "Invite sent to ",
379
+ t.attendeeEmail
380
+ ] })
381
+ ] }),
382
+ /* @__PURE__ */ e(
383
+ "button",
384
+ {
385
+ type: "button",
386
+ onClick: o,
387
+ className: "gbw-mt-2 gbw-text-xs gbw-text-gropulse-muted gbw-underline gbw-underline-offset-2 hover:gbw-text-gropulse-text",
388
+ children: "Book another call"
389
+ }
390
+ )
391
+ ] });
392
+ }
301
393
  export {
302
- A as BookingWidget,
303
- D as useBookingChat
394
+ q as BookingWidget,
395
+ E as useBookingChat
304
396
  };
package/dist/styles.css CHANGED
@@ -1 +1 @@
1
- *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.gbw-root{font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;color:#0f172a}.gbw-typing-dot{animation:gbw-typing 1.4s infinite ease-in-out both}.gbw-typing-dot:nth-child(2){animation-delay:.15s}.gbw-typing-dot:nth-child(3){animation-delay:.3s}.gbw-fixed{position:fixed}.gbw-absolute{position:absolute}.gbw-relative{position:relative}.gbw-inset-0{top:0;right:0;bottom:0;left:0}.gbw-z-\[9999\]{z-index:9999}.gbw-mx-4{margin-left:1rem;margin-right:1rem}.gbw-mb-1\.5{margin-bottom:.375rem}.gbw-mb-2{margin-bottom:.5rem}.gbw-mb-3{margin-bottom:.75rem}.gbw-inline-block{display:inline-block}.gbw-flex{display:flex}.gbw-inline-flex{display:inline-flex}.gbw-grid{display:grid}.gbw-h-1\.5{height:.375rem}.gbw-h-2{height:.5rem}.gbw-h-full{height:100%}.gbw-max-h-60{max-height:15rem}.gbw-w-1\.5{width:.375rem}.gbw-w-2{width:.5rem}.gbw-w-full{width:100%}.gbw-max-w-\[80\%\]{max-width:80%}.gbw-flex-1{flex:1 1 0%}.gbw-shrink-0{flex-shrink:0}.gbw-resize-none{resize:none}.gbw-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.gbw-flex-col{flex-direction:column}.gbw-items-end{align-items:flex-end}.gbw-items-center{align-items:center}.gbw-justify-start{justify-content:flex-start}.gbw-justify-end{justify-content:flex-end}.gbw-justify-between{justify-content:space-between}.gbw-gap-1{gap:.25rem}.gbw-gap-1\.5{gap:.375rem}.gbw-gap-2{gap:.5rem}.gbw-gap-3{gap:.75rem}.gbw-overflow-hidden{overflow:hidden}.gbw-overflow-y-auto{overflow-y:auto}.gbw-rounded-2xl{border-radius:1rem}.gbw-rounded-full{border-radius:9999px}.gbw-rounded-lg{border-radius:.5rem}.gbw-rounded-md{border-radius:.375rem}.gbw-rounded-xl{border-radius:.75rem}.gbw-rounded-bl-sm{border-bottom-left-radius:.125rem}.gbw-rounded-br-sm{border-bottom-right-radius:.125rem}.gbw-border{border-width:1px}.gbw-border-b{border-bottom-width:1px}.gbw-border-t{border-top-width:1px}.gbw-border-gropulse-border{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.gbw-border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.gbw-bg-black\/20{background-color:#0003}.gbw-bg-gropulse-accent{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.gbw-bg-gropulse-bg{--tw-bg-opacity: 1;background-color:rgb(247 248 251 / var(--tw-bg-opacity, 1))}.gbw-bg-gropulse-muted{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.gbw-bg-gropulse-navy{--tw-bg-opacity: 1;background-color:rgb(15 29 58 / var(--tw-bg-opacity, 1))}.gbw-bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.gbw-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.gbw-p-0{padding:0}.gbw-p-1{padding:.25rem}.gbw-p-3{padding:.75rem}.gbw-px-2{padding-left:.5rem;padding-right:.5rem}.gbw-px-3{padding-left:.75rem;padding-right:.75rem}.gbw-px-3\.5{padding-left:.875rem;padding-right:.875rem}.gbw-px-4{padding-left:1rem;padding-right:1rem}.gbw-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.gbw-py-2{padding-top:.5rem;padding-bottom:.5rem}.gbw-py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.gbw-py-3{padding-top:.75rem;padding-bottom:.75rem}.gbw-text-center{text-align:center}.gbw-text-sm{font-size:.875rem;line-height:1.25rem}.gbw-text-xs{font-size:.75rem;line-height:1rem}.gbw-font-medium{font-weight:500}.gbw-font-semibold{font-weight:600}.gbw-uppercase{text-transform:uppercase}.gbw-tracking-wide{letter-spacing:.025em}.gbw-text-gropulse-muted{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.gbw-text-gropulse-text{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.gbw-text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.gbw-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.gbw-text-white\/70{color:#ffffffb3}.gbw-text-white\/80{color:#fffc}.gbw-shadow-panel{--tw-shadow: 0 20px 60px -10px rgba(15, 29, 58, .25);--tw-shadow-colored: 0 20px 60px -10px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.gbw-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.gbw-outline-none{outline:2px solid transparent;outline-offset:2px}.gbw-transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@keyframes gbw-typing{0%,80%,to{transform:scale(.6);opacity:.4}40%{transform:scale(1);opacity:1}}.hover\:gbw-border-gropulse-navy:hover{--tw-border-opacity: 1;border-color:rgb(15 29 58 / var(--tw-border-opacity, 1))}.hover\:gbw-bg-gropulse-navy:hover{--tw-bg-opacity: 1;background-color:rgb(15 29 58 / var(--tw-bg-opacity, 1))}.hover\:gbw-bg-gropulse-navyHover:hover{--tw-bg-opacity: 1;background-color:rgb(20 42 82 / var(--tw-bg-opacity, 1))}.hover\:gbw-bg-white\/10:hover{background-color:#ffffff1a}.hover\:gbw-text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.focus\:gbw-border-gropulse-navy:focus{--tw-border-opacity: 1;border-color:rgb(15 29 58 / var(--tw-border-opacity, 1))}.focus\:gbw-ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:gbw-ring-gropulse-navy\/10:focus{--tw-ring-color: rgb(15 29 58 / .1)}.disabled\:gbw-bg-gropulse-bg:disabled{--tw-bg-opacity: 1;background-color:rgb(247 248 251 / var(--tw-bg-opacity, 1))}.disabled\:gbw-text-gropulse-muted:disabled{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.disabled\:gbw-opacity-40:disabled{opacity:.4}@media (min-width: 640px){.sm\:gbw-h-\[620px\]{height:620px}.sm\:gbw-w-\[400px\]{width:400px}.sm\:gbw-rounded-2xl{border-radius:1rem}.sm\:gbw-p-4{padding:1rem}}
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.gbw-root{font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;color:#0f172a}.gbw-typing-dot{animation:gbw-typing 1.4s infinite ease-in-out both}.gbw-typing-dot:nth-child(2){animation-delay:.15s}.gbw-typing-dot:nth-child(3){animation-delay:.3s}.gbw-fixed{position:fixed}.gbw-absolute{position:absolute}.gbw-relative{position:relative}.gbw-inset-0{top:0;right:0;bottom:0;left:0}.gbw-z-\[9999\]{z-index:9999}.gbw-mx-4{margin-left:1rem;margin-right:1rem}.gbw-mb-1\.5{margin-bottom:.375rem}.gbw-mb-2{margin-bottom:.5rem}.gbw-mb-3{margin-bottom:.75rem}.gbw-mt-0\.5{margin-top:.125rem}.gbw-mt-1{margin-top:.25rem}.gbw-mt-2{margin-top:.5rem}.gbw-inline-block{display:inline-block}.gbw-flex{display:flex}.gbw-inline-flex{display:inline-flex}.gbw-grid{display:grid}.gbw-h-1\.5{height:.375rem}.gbw-h-14{height:3.5rem}.gbw-h-2{height:.5rem}.gbw-h-full{height:100%}.gbw-max-h-60{max-height:15rem}.gbw-w-1\.5{width:.375rem}.gbw-w-14{width:3.5rem}.gbw-w-2{width:.5rem}.gbw-w-full{width:100%}.gbw-max-w-\[80\%\]{max-width:80%}.gbw-flex-1{flex:1 1 0%}.gbw-shrink-0{flex-shrink:0}.gbw-resize-none{resize:none}.gbw-grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.gbw-flex-col{flex-direction:column}.gbw-items-end{align-items:flex-end}.gbw-items-center{align-items:center}.gbw-justify-start{justify-content:flex-start}.gbw-justify-end{justify-content:flex-end}.gbw-justify-center{justify-content:center}.gbw-justify-between{justify-content:space-between}.gbw-gap-1{gap:.25rem}.gbw-gap-1\.5{gap:.375rem}.gbw-gap-2{gap:.5rem}.gbw-gap-3{gap:.75rem}.gbw-gap-4{gap:1rem}.gbw-overflow-hidden{overflow:hidden}.gbw-overflow-y-auto{overflow-y:auto}.gbw-rounded-2xl{border-radius:1rem}.gbw-rounded-full{border-radius:9999px}.gbw-rounded-lg{border-radius:.5rem}.gbw-rounded-md{border-radius:.375rem}.gbw-rounded-xl{border-radius:.75rem}.gbw-rounded-bl-sm{border-bottom-left-radius:.125rem}.gbw-rounded-br-sm{border-bottom-right-radius:.125rem}.gbw-border{border-width:1px}.gbw-border-b{border-bottom-width:1px}.gbw-border-t{border-top-width:1px}.gbw-border-gropulse-border{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.gbw-border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.gbw-bg-black\/20{background-color:#0003}.gbw-bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.gbw-bg-gropulse-accent{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.gbw-bg-gropulse-bg{--tw-bg-opacity: 1;background-color:rgb(247 248 251 / var(--tw-bg-opacity, 1))}.gbw-bg-gropulse-muted{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.gbw-bg-gropulse-navy{--tw-bg-opacity: 1;background-color:rgb(15 29 58 / var(--tw-bg-opacity, 1))}.gbw-bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.gbw-bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.gbw-p-0{padding:0}.gbw-p-1{padding:.25rem}.gbw-p-3{padding:.75rem}.gbw-p-6{padding:1.5rem}.gbw-px-2{padding-left:.5rem;padding-right:.5rem}.gbw-px-3{padding-left:.75rem;padding-right:.75rem}.gbw-px-3\.5{padding-left:.875rem;padding-right:.875rem}.gbw-px-4{padding-left:1rem;padding-right:1rem}.gbw-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.gbw-py-2{padding-top:.5rem;padding-bottom:.5rem}.gbw-py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.gbw-py-3{padding-top:.75rem;padding-bottom:.75rem}.gbw-text-center{text-align:center}.gbw-text-base{font-size:1rem;line-height:1.5rem}.gbw-text-sm{font-size:.875rem;line-height:1.25rem}.gbw-text-xs{font-size:.75rem;line-height:1rem}.gbw-font-medium{font-weight:500}.gbw-font-semibold{font-weight:600}.gbw-uppercase{text-transform:uppercase}.gbw-tracking-wide{letter-spacing:.025em}.gbw-text-gropulse-muted{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.gbw-text-gropulse-text{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.gbw-text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.gbw-text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.gbw-text-white\/70{color:#ffffffb3}.gbw-text-white\/80{color:#fffc}.gbw-underline{text-decoration-line:underline}.gbw-underline-offset-2{text-underline-offset:2px}.gbw-shadow-panel{--tw-shadow: 0 20px 60px -10px rgba(15, 29, 58, .25);--tw-shadow-colored: 0 20px 60px -10px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.gbw-shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.gbw-outline-none{outline:2px solid transparent;outline-offset:2px}.gbw-transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@keyframes gbw-typing{0%,80%,to{transform:scale(.6);opacity:.4}40%{transform:scale(1);opacity:1}}.hover\:gbw-border-gropulse-navy:hover{--tw-border-opacity: 1;border-color:rgb(15 29 58 / var(--tw-border-opacity, 1))}.hover\:gbw-bg-gropulse-navy:hover{--tw-bg-opacity: 1;background-color:rgb(15 29 58 / var(--tw-bg-opacity, 1))}.hover\:gbw-bg-gropulse-navyHover:hover{--tw-bg-opacity: 1;background-color:rgb(20 42 82 / var(--tw-bg-opacity, 1))}.hover\:gbw-bg-white\/10:hover{background-color:#ffffff1a}.hover\:gbw-text-gropulse-text:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.hover\:gbw-text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.focus\:gbw-border-gropulse-navy:focus{--tw-border-opacity: 1;border-color:rgb(15 29 58 / var(--tw-border-opacity, 1))}.focus\:gbw-ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:gbw-ring-gropulse-navy\/10:focus{--tw-ring-color: rgb(15 29 58 / .1)}.disabled\:gbw-bg-gropulse-bg:disabled{--tw-bg-opacity: 1;background-color:rgb(247 248 251 / var(--tw-bg-opacity, 1))}.disabled\:gbw-text-gropulse-muted:disabled{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.disabled\:gbw-opacity-40:disabled{opacity:.4}@media (min-width: 640px){.sm\:gbw-h-\[620px\]{height:620px}.sm\:gbw-w-\[400px\]{width:400px}.sm\:gbw-rounded-2xl{border-radius:1rem}.sm\:gbw-p-4{padding:1rem}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gropulse/booking-widget",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
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",