@gropulse/booking-widget 0.1.3 → 0.1.4

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,2 +1,2 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),R=60*24*60*60*1e3;function S(t){return`gbw_booking_${t}`}function T(t){try{const o=localStorage.getItem(S(t));if(!o)return null;const s=JSON.parse(o);return Date.now()-s.savedAt>R?(localStorage.removeItem(S(t)),null):{id:s.id,start:s.start,attendeeEmail:s.attendeeEmail}}catch{return null}}function M(t,o){try{localStorage.setItem(S(t),JSON.stringify({...o,savedAt:Date.now()}))}catch{}}function _(t){try{localStorage.removeItem(S(t))}catch{}}function C(t){const{apiBaseUrl:o,context:s,onBookingConfirmed:n}=t,[r,l]=i.useState([]),[c,g]=i.useState(null),[j,b]=i.useState(()=>T(s.shopDomain)),[d,m]=i.useState(!1),[k,x]=i.useState(null),p=i.useCallback(async a=>{const u={...s,timezone:s.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone},w=await fetch(`${o}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:a,context:u})});if(!w.ok){const h=await w.text();throw new Error(`Chat API error ${w.status}: ${h}`)}return await w.json()},[o,s]),f=i.useCallback(a=>{l(u=>[...u,{role:"assistant",content:a.message}]),a.action==="show_slots"&&a.slots&&g(a.slots),a.action==="booking_confirmed"&&a.booking&&(b(a.booking),g(null),M(s.shopDomain,a.booking),n==null||n(a.booking))},[n,s.shopDomain]),y=i.useRef(!1),v=i.useRef(0),N=i.useCallback(async()=>{if(y.current)return;y.current=!0;const a=v.current;m(!0),x(null);try{const w=await p([{role:"user",content:"__START__"}]);if(a!==v.current)return;l([{role:"assistant",content:w.message}]),w.action==="show_slots"&&w.slots&&g(w.slots),w.action==="booking_confirmed"&&w.booking&&(b(w.booking),n==null||n(w.booking))}catch(u){a===v.current&&x(u.message)}finally{a===v.current&&(m(!1),y.current=!1)}},[p,n]),L=i.useCallback(()=>r.length>0||d?Promise.resolve():N(),[r.length,d,N]),B=i.useCallback(async a=>{const u=a.trim();if(!u||d)return;const w=[...r,{role:"user",content:u}];l(w),m(!0),x(null);try{const h=await p(w);f(h)}catch(h){x(h.message)}finally{m(!1)}},[r,d,p,f]),D=i.useCallback(async a=>{if(d)return;const u=new Date(a.time).toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),w=[...r,{role:"user",content:`I'll take ${u} (${a.time})`}];l(w),g(null),m(!0),x(null);try{const h=await p(w);f(h)}catch(h){x(h.message)}finally{m(!1)}},[r,d,p,f]),$=i.useCallback(()=>{v.current+=1,_(s.shopDomain),y.current=!1,l([]),g(null),b(null),x(null),m(!1),N()},[s.shopDomain,N]);return{messages:r,slots:c,booking:j,isLoading:d,error:k,sendMessage:B,pickSlot:D,start:L,reset:$}}function I(t){return t.split(`
2
+ `).flatMap((o,s,n)=>{const r=[],l=o.split(/(\*\*[^*]+\*\*|\*[^*]+\*)/g);for(let c=0;c<l.length;c++){const g=l[c];g.startsWith("**")&&g.endsWith("**")?r.push(e.jsx("strong",{children:g.slice(2,-2)},`${s}-${c}`)):g.startsWith("*")&&g.endsWith("*")?r.push(e.jsx("em",{children:g.slice(1,-1)},`${s}-${c}`)):r.push(g)}return s<n.length-1&&r.push(e.jsx("br",{},`br-${s}`)),r})}function O({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:I(t.content)})})}function W({messages:t,isLoading:o}){const s=i.useRef(null);return i.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(O,{message:n},r)),o?e.jsx(E,{}):null,e.jsx("div",{ref:s})]})}function E(){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 P({onSend:t,disabled:o,placeholder:s}){const[n,r]=i.useState(""),l=()=>{const g=n.trim();!g||o||(t(g),r(""))},c=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),l())};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:c,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:l,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 z({slots:t,onPick:o,disabled:s}){const n=i.useMemo(()=>A(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(l=>e.jsx("button",{type:"button",disabled:s,onClick:()=>o(l),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:H(l.time)},l.time))})]},r.dayLabel))})]})}function A(t){const o=new Map;for(const n of t){const l=new Date(n.time).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"}),c=o.get(l);c?c.push(n):o.set(l,[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 H(t){return new Date(t).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function K(t){const{apiBaseUrl:o,context:s,trigger:n="button",buttonLabel:r="Book Free Strategy Call",onBookingConfirmed:l,className:c}=t,[g,j]=i.useState(n==="auto"),b=C({apiBaseUrl:o,context:s,onBookingConfirmed:l}),d=b.booking!==null&&b.messages.length===0,{start:m,messages:k,isLoading:x,booking:p,error:f}=b,y=i.useRef(m);return y.current=m,i.useEffect(()=>{g&&!d&&k.length===0&&!x&&p===null&&!f&&y.current()},[g,d,k.length,x,p,f]),e.jsxs("div",{className:`gbw-root ${c??""}`,children:[n==="button"?e.jsxs("button",{type:"button",onClick:()=>j(v=>!v),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"}),d?"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:()=>j(!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(F,{ownerName:s.ownerName,onClose:()=>j(!1)}),d?e.jsx(G,{booking:b.booking,ownerName:s.ownerName,onReset:b.reset}):e.jsxs(e.Fragment,{children:[e.jsx(W,{messages:b.messages,isLoading:b.isLoading}),b.slots&&!b.booking?e.jsx(z,{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(V,{}):e.jsx(P,{onSend:b.sendMessage,disabled:b.isLoading,placeholder:"Reply…"})]})]})]}):null]})}function F({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-cursor-pointer gbw-rounded-md gbw-border-0 gbw-bg-transparent gbw-p-1 gbw-text-white/70 gbw-transition hover:gbw-bg-white/15 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 V(){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 G({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-4 gbw-inline-flex gbw-items-center gbw-gap-1.5 gbw-rounded-lg gbw-border gbw-border-gropulse-border gbw-px-4 gbw-py-2 gbw-text-xs gbw-font-medium gbw-text-gropulse-muted gbw-transition-colors hover:gbw-border-gropulse-accent hover:gbw-text-gropulse-accent active:gbw-scale-95",children:"Book another call"})]})}exports.BookingWidget=K;exports.useBookingChat=C;
package/dist/index.js CHANGED
@@ -1,173 +1,172 @@
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) {
1
+ import { jsx as e, jsxs as w, Fragment as I } from "react/jsx-runtime";
2
+ import { useState as N, useCallback as k, useRef as D, useEffect as $, useMemo as R } from "react";
3
+ const O = 60 * 24 * 60 * 60 * 1e3;
4
+ function C(t) {
5
5
  return `gbw_booking_${t}`;
6
6
  }
7
- function I(t) {
7
+ function W(t) {
8
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 };
9
+ const r = localStorage.getItem(C(t));
10
+ if (!r) return null;
11
+ const o = JSON.parse(r);
12
+ return Date.now() - o.savedAt > O ? (localStorage.removeItem(C(t)), null) : { id: o.id, start: o.start, attendeeEmail: o.attendeeEmail };
13
13
  } catch {
14
14
  return null;
15
15
  }
16
16
  }
17
- function O(t, n) {
17
+ function E(t, r) {
18
18
  try {
19
19
  localStorage.setItem(
20
- N(t),
21
- JSON.stringify({ ...n, savedAt: Date.now() })
20
+ C(t),
21
+ JSON.stringify({ ...r, savedAt: Date.now() })
22
22
  );
23
23
  } catch {
24
24
  }
25
25
  }
26
- function W(t) {
26
+ function z(t) {
27
27
  try {
28
- localStorage.removeItem(N(t));
28
+ localStorage.removeItem(C(t));
29
29
  } catch {
30
30
  }
31
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(
32
+ function A(t) {
33
+ const { apiBaseUrl: r, context: o, onBookingConfirmed: n } = t, [s, i] = N([]), [c, g] = N(null), [S, b] = N(
34
+ () => W(o.shopDomain)
35
+ ), [d, m] = N(!1), [L, p] = N(null), h = k(
36
36
  async (l) => {
37
- const w = {
37
+ const u = {
38
38
  ...o,
39
39
  timezone: o.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone
40
- }, u = await fetch(`${n}/api/chat`, {
40
+ }, a = await fetch(`${r}/api/chat`, {
41
41
  method: "POST",
42
42
  headers: { "Content-Type": "application/json" },
43
- body: JSON.stringify({ messages: l, context: w })
43
+ body: JSON.stringify({ messages: l, context: u })
44
44
  });
45
- if (!u.ok) {
46
- const m = await u.text();
47
- throw new Error(`Chat API error ${u.status}: ${m}`);
45
+ if (!a.ok) {
46
+ const f = await a.text();
47
+ throw new Error(`Chat API error ${a.status}: ${f}`);
48
48
  }
49
- return await u.json();
49
+ return await a.json();
50
50
  },
51
- [n, o]
52
- ), k = y(
51
+ [r, o]
52
+ ), x = k(
53
53
  (l) => {
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));
54
+ i((u) => [...u, { 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), E(o.shopDomain, l.booking), n == null || n(l.booking));
55
55
  },
56
- [r, o.shopDomain]
57
- ), B = y(async () => {
58
- if (!(s.length > 0 || c)) {
59
- p(!0), h(null);
60
- try {
61
- const w = await x([{
62
- role: "user",
63
- content: "__START__"
64
- }]);
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));
66
- } catch (l) {
67
- h(l.message);
68
- } finally {
69
- p(!1);
70
- }
56
+ [n, o.shopDomain]
57
+ ), y = D(!1), v = D(0), B = k(async () => {
58
+ if (y.current) return;
59
+ y.current = !0;
60
+ const l = v.current;
61
+ m(!0), p(null);
62
+ try {
63
+ const a = await h([{ role: "user", content: "__START__" }]);
64
+ if (l !== v.current) return;
65
+ 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));
66
+ } catch (u) {
67
+ l === v.current && p(u.message);
68
+ } finally {
69
+ l === v.current && (m(!1), y.current = !1);
71
70
  }
72
- }, [s.length, c, x, r]), D = y(
71
+ }, [h, n]), j = k(() => s.length > 0 || d ? Promise.resolve() : B(), [s.length, d, B]), T = k(
73
72
  async (l) => {
74
- const w = l.trim();
75
- if (!w || c) return;
76
- const u = [...s, { role: "user", content: w }];
77
- i(u), p(!0), h(null);
73
+ const u = l.trim();
74
+ if (!u || d) return;
75
+ const a = [...s, { role: "user", content: u }];
76
+ i(a), m(!0), p(null);
78
77
  try {
79
- const m = await x(u);
80
- k(m);
81
- } catch (m) {
82
- h(m.message);
78
+ const f = await h(a);
79
+ x(f);
80
+ } catch (f) {
81
+ p(f.message);
83
82
  } finally {
84
- p(!1);
83
+ m(!1);
85
84
  }
86
85
  },
87
- [s, c, x, k]
88
- ), C = y(
86
+ [s, d, h, x]
87
+ ), _ = k(
89
88
  async (l) => {
90
- if (c) return;
91
- const w = new Date(l.time).toLocaleString(void 0, {
89
+ if (d) return;
90
+ const u = new Date(l.time).toLocaleString(void 0, {
92
91
  weekday: "short",
93
92
  month: "short",
94
93
  day: "numeric",
95
94
  hour: "numeric",
96
95
  minute: "2-digit"
97
- }), u = [
96
+ }), a = [
98
97
  ...s,
99
- { role: "user", content: `I'll take ${w} (${l.time})` }
98
+ { role: "user", content: `I'll take ${u} (${l.time})` }
100
99
  ];
101
- i(u), g(null), p(!0), h(null);
100
+ i(a), g(null), m(!0), p(null);
102
101
  try {
103
- const m = await x(u);
104
- k(m);
105
- } catch (m) {
106
- h(m.message);
102
+ const f = await h(a);
103
+ x(f);
104
+ } catch (f) {
105
+ p(f.message);
107
106
  } finally {
108
- p(!1);
107
+ m(!1);
109
108
  }
110
109
  },
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: $ };
110
+ [s, d, h, x]
111
+ ), M = k(() => {
112
+ v.current += 1, z(o.shopDomain), y.current = !1, i([]), g(null), b(null), p(null), m(!1), B();
113
+ }, [o.shopDomain, B]);
114
+ return { messages: s, slots: c, booking: S, isLoading: d, error: L, sendMessage: T, pickSlot: _, start: j, reset: M };
116
115
  }
117
- function R(t) {
116
+ function K(t) {
118
117
  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);
118
+ `).flatMap((r, o, n) => {
119
+ const s = [], i = r.split(/(\*\*[^*]+\*\*|\*[^*]+\*)/g);
120
+ for (let c = 0; c < i.length; c++) {
121
+ const g = i[c];
122
+ g.startsWith("**") && g.endsWith("**") ? s.push(/* @__PURE__ */ e("strong", { children: g.slice(2, -2) }, `${o}-${c}`)) : g.startsWith("*") && g.endsWith("*") ? s.push(/* @__PURE__ */ e("em", { children: g.slice(1, -1) }, `${o}-${c}`)) : s.push(g);
124
123
  }
125
- return o < r.length - 1 && s.push(/* @__PURE__ */ e("br", {}, `br-${o}`)), s;
124
+ return o < n.length - 1 && s.push(/* @__PURE__ */ e("br", {}, `br-${o}`)), s;
126
125
  });
127
126
  }
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(
127
+ function P({ message: t }) {
128
+ const r = t.role === "user";
129
+ return /* @__PURE__ */ e("div", { className: `gbw-flex ${r ? "gbw-justify-end" : "gbw-justify-start"} gbw-mb-2`, children: /* @__PURE__ */ e(
131
130
  "div",
132
131
  {
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)
132
+ className: r ? "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",
133
+ children: r ? t.content : K(t.content)
135
134
  }
136
135
  ) });
137
136
  }
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,
137
+ function H({ messages: t, isLoading: r }) {
138
+ const o = D(null);
139
+ return $(() => {
140
+ var n;
141
+ (n = o.current) == null || n.scrollIntoView({ behavior: "smooth", block: "end" });
142
+ }, [t, r]), /* @__PURE__ */ w("div", { className: "gbw-flex-1 gbw-overflow-y-auto gbw-px-4 gbw-py-3", children: [
143
+ t.map((n, s) => /* @__PURE__ */ e(P, { message: n }, s)),
144
+ r ? /* @__PURE__ */ e(F, {}) : null,
146
145
  /* @__PURE__ */ e("div", { ref: o })
147
146
  ] });
148
147
  }
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: [
148
+ function F() {
149
+ 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__ */ w("div", { className: "gbw-flex gbw-gap-1", children: [
151
150
  /* @__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" }),
152
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" }),
153
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" })
154
153
  ] }) }) });
155
154
  }
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(""));
155
+ function V({ onSend: t, disabled: r, placeholder: o }) {
156
+ const [n, s] = N(""), i = () => {
157
+ const g = n.trim();
158
+ !g || r || (t(g), s(""));
160
159
  };
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: [
160
+ return /* @__PURE__ */ e("div", { className: "gbw-border-t gbw-border-gropulse-border gbw-bg-white gbw-p-3", children: /* @__PURE__ */ w("div", { className: "gbw-flex gbw-items-end gbw-gap-2", children: [
162
161
  /* @__PURE__ */ e(
163
162
  "textarea",
164
163
  {
165
- value: r,
164
+ value: n,
166
165
  onChange: (g) => s(g.target.value),
167
166
  onKeyDown: (g) => {
168
167
  g.key === "Enter" && !g.shiftKey && (g.preventDefault(), i());
169
168
  },
170
- disabled: n,
169
+ disabled: r,
171
170
  rows: 1,
172
171
  placeholder: o ?? "Type a message…",
173
172
  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",
@@ -179,106 +178,106 @@ function H({ onSend: t, disabled: n, placeholder: o }) {
179
178
  {
180
179
  type: "button",
181
180
  onClick: i,
182
- disabled: n || !r.trim(),
181
+ disabled: r || !n.trim(),
183
182
  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",
184
183
  children: "Send"
185
184
  }
186
185
  )
187
186
  ] }) });
188
187
  }
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: [
188
+ function G({ slots: t, onPick: r, disabled: o }) {
189
+ const n = R(() => J(t), [t]);
190
+ 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__ */ w("div", { className: "gbw-mx-4 gbw-mb-3 gbw-rounded-xl gbw-border gbw-border-gropulse-border gbw-bg-white gbw-p-3", children: [
192
191
  /* @__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" }),
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: [
192
+ /* @__PURE__ */ e("div", { className: "gbw-flex gbw-flex-col gbw-gap-3 gbw-max-h-60 gbw-overflow-y-auto", children: n.map((s) => /* @__PURE__ */ w("div", { children: [
194
193
  /* @__PURE__ */ e("div", { className: "gbw-mb-1.5 gbw-text-xs gbw-font-semibold gbw-text-gropulse-text", children: s.dayLabel }),
195
194
  /* @__PURE__ */ e("div", { className: "gbw-grid gbw-grid-cols-3 gbw-gap-1.5", children: s.slots.map((i) => /* @__PURE__ */ e(
196
195
  "button",
197
196
  {
198
197
  type: "button",
199
198
  disabled: o,
200
- onClick: () => n(i),
199
+ onClick: () => r(i),
201
200
  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",
202
- children: V(i.time)
201
+ children: U(i.time)
203
202
  },
204
203
  i.time
205
204
  )) })
206
205
  ] }, s.dayLabel)) })
207
206
  ] });
208
207
  }
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, {
208
+ function J(t) {
209
+ const r = /* @__PURE__ */ new Map();
210
+ for (const n of t) {
211
+ const i = new Date(n.time).toLocaleDateString(void 0, {
213
212
  weekday: "long",
214
213
  month: "short",
215
214
  day: "numeric"
216
- }), d = n.get(i);
217
- d ? d.push(r) : n.set(i, [r]);
215
+ }), c = r.get(i);
216
+ c ? c.push(n) : r.set(i, [n]);
218
217
  }
219
218
  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}`,
219
+ return Array.from(r.entries()).map(([n, s]) => ({
220
+ dayLabel: `${n} · ${o}`,
222
221
  slots: s
223
222
  }));
224
223
  }
225
- function V(t) {
224
+ function U(t) {
226
225
  return new Date(t).toLocaleTimeString(void 0, {
227
226
  hour: "numeric",
228
227
  minute: "2-digit"
229
228
  });
230
229
  }
231
- function q(t) {
230
+ function ee(t) {
232
231
  const {
233
- apiBaseUrl: n,
232
+ apiBaseUrl: r,
234
233
  context: o,
235
- trigger: r = "button",
234
+ trigger: n = "button",
236
235
  buttonLabel: s = "Book Free Strategy Call",
237
236
  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(
237
+ className: c
238
+ } = t, [g, S] = N(n === "auto"), b = A({ apiBaseUrl: r, context: o, onBookingConfirmed: i }), d = b.booking !== null && b.messages.length === 0, { start: m, messages: L, isLoading: p, booking: h, error: x } = b, y = D(m);
239
+ return y.current = m, $(() => {
240
+ g && !d && L.length === 0 && !p && h === null && !x && y.current();
241
+ }, [g, d, L.length, p, h, x]), /* @__PURE__ */ w("div", { className: `gbw-root ${c ?? ""}`, children: [
242
+ n === "button" ? /* @__PURE__ */ w(
244
243
  "button",
245
244
  {
246
245
  type: "button",
247
- onClick: () => v((p) => !p),
246
+ onClick: () => S((v) => !v),
248
247
  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",
249
248
  children: [
250
249
  /* @__PURE__ */ e("span", { className: "gbw-h-2 gbw-w-2 gbw-rounded-full gbw-bg-gropulse-accent" }),
251
- c ? "View Your Booking" : s
250
+ d ? "View Your Booking" : s
252
251
  ]
253
252
  }
254
253
  ) : null,
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: [
254
+ g ? /* @__PURE__ */ w("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: [
256
255
  /* @__PURE__ */ e(
257
256
  "div",
258
257
  {
259
258
  className: "gbw-absolute gbw-inset-0 gbw-bg-black/20",
260
- onClick: () => v(!1)
259
+ onClick: () => S(!1)
261
260
  }
262
261
  ),
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: [
262
+ /* @__PURE__ */ w("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: [
264
263
  /* @__PURE__ */ e(
265
- G,
264
+ Y,
266
265
  {
267
266
  ownerName: o.ownerName,
268
- onClose: () => v(!1)
267
+ onClose: () => S(!1)
269
268
  }
270
269
  ),
271
- c ? /* @__PURE__ */ e(
272
- U,
270
+ d ? /* @__PURE__ */ e(
271
+ q,
273
272
  {
274
273
  booking: b.booking,
275
274
  ownerName: o.ownerName,
276
275
  onReset: b.reset
277
276
  }
278
- ) : /* @__PURE__ */ a(j, { children: [
279
- /* @__PURE__ */ e(A, { messages: b.messages, isLoading: b.isLoading }),
277
+ ) : /* @__PURE__ */ w(I, { children: [
278
+ /* @__PURE__ */ e(H, { messages: b.messages, isLoading: b.isLoading }),
280
279
  b.slots && !b.booking ? /* @__PURE__ */ e(
281
- P,
280
+ G,
282
281
  {
283
282
  slots: b.slots,
284
283
  onPick: b.pickSlot,
@@ -286,8 +285,8 @@ function q(t) {
286
285
  }
287
286
  ) : null,
288
287
  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,
288
+ b.booking ? /* @__PURE__ */ e(Z, {}) : /* @__PURE__ */ e(
289
+ V,
291
290
  {
292
291
  onSend: b.sendMessage,
293
292
  disabled: b.isLoading,
@@ -299,11 +298,11 @@ function q(t) {
299
298
  ] }) : null
300
299
  ] });
301
300
  }
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: [
301
+ function Y({ ownerName: t, onClose: r }) {
302
+ return /* @__PURE__ */ w("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: [
303
+ /* @__PURE__ */ w("div", { children: [
305
304
  /* @__PURE__ */ e("div", { className: "gbw-text-sm gbw-font-semibold", children: "Gropulse Growth Strategy" }),
306
- /* @__PURE__ */ a("div", { className: "gbw-text-xs gbw-text-white/70", children: [
305
+ /* @__PURE__ */ w("div", { className: "gbw-text-xs gbw-text-white/70", children: [
307
306
  "Hey ",
308
307
  t.split(" ")[0],
309
308
  " — let’s find a time."
@@ -313,10 +312,10 @@ function G({ ownerName: t, onClose: n }) {
313
312
  "button",
314
313
  {
315
314
  type: "button",
316
- onClick: n,
315
+ onClick: r,
317
316
  "aria-label": "Close",
318
- className: "gbw-rounded-md gbw-p-1 gbw-text-white/80 gbw-transition hover:gbw-bg-white/10 hover:gbw-text-white",
319
- children: /* @__PURE__ */ a(
317
+ className: "gbw-cursor-pointer gbw-rounded-md gbw-border-0 gbw-bg-transparent gbw-p-1 gbw-text-white/70 gbw-transition hover:gbw-bg-white/15 hover:gbw-text-white",
318
+ children: /* @__PURE__ */ w(
320
319
  "svg",
321
320
  {
322
321
  width: "18",
@@ -337,22 +336,22 @@ function G({ ownerName: t, onClose: n }) {
337
336
  )
338
337
  ] });
339
338
  }
340
- function J() {
339
+ function Z() {
341
340
  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." });
342
341
  }
343
- function U({
342
+ function q({
344
343
  booking: t,
345
- ownerName: n,
344
+ ownerName: r,
346
345
  onReset: o
347
346
  }) {
348
- const r = new Date(t.start).toLocaleString(void 0, {
347
+ const n = new Date(t.start).toLocaleString(void 0, {
349
348
  weekday: "long",
350
349
  month: "long",
351
350
  day: "numeric",
352
351
  hour: "numeric",
353
352
  minute: "2-digit"
354
353
  });
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: [
354
+ return /* @__PURE__ */ w("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
355
  /* @__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
356
  "svg",
358
357
  {
@@ -367,14 +366,14 @@ function U({
367
366
  children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
368
367
  }
369
368
  ) }),
370
- /* @__PURE__ */ a("div", { children: [
371
- /* @__PURE__ */ a("div", { className: "gbw-text-base gbw-font-semibold gbw-text-gropulse-text", children: [
369
+ /* @__PURE__ */ w("div", { children: [
370
+ /* @__PURE__ */ w("div", { className: "gbw-text-base gbw-font-semibold gbw-text-gropulse-text", children: [
372
371
  "You’re all booked, ",
373
- n.split(" ")[0],
372
+ r.split(" ")[0],
374
373
  "!"
375
374
  ] }),
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: [
375
+ /* @__PURE__ */ e("div", { className: "gbw-mt-1 gbw-text-sm gbw-text-gropulse-muted", children: n }),
376
+ /* @__PURE__ */ w("div", { className: "gbw-mt-0.5 gbw-text-xs gbw-text-gropulse-muted", children: [
378
377
  "Invite sent to ",
379
378
  t.attendeeEmail
380
379
  ] })
@@ -384,13 +383,13 @@ function U({
384
383
  {
385
384
  type: "button",
386
385
  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",
386
+ className: "gbw-mt-4 gbw-inline-flex gbw-items-center gbw-gap-1.5 gbw-rounded-lg gbw-border gbw-border-gropulse-border gbw-px-4 gbw-py-2 gbw-text-xs gbw-font-medium gbw-text-gropulse-muted gbw-transition-colors hover:gbw-border-gropulse-accent hover:gbw-text-gropulse-accent active:gbw-scale-95",
388
387
  children: "Book another call"
389
388
  }
390
389
  )
391
390
  ] });
392
391
  }
393
392
  export {
394
- q as BookingWidget,
395
- E as useBookingChat
393
+ ee as BookingWidget,
394
+ A as useBookingChat
396
395
  };
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-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}}
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-4{margin-top:1rem}.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-cursor-pointer{cursor:pointer}.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-0{border-width:0px}.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-transparent{background-color:transparent}.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-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}.gbw-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;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-accent:hover{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-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\/15:hover{background-color:#ffffff26}.hover\:gbw-text-gropulse-accent:hover{--tw-text-opacity: 1;color:rgb(16 185 129 / 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)}.active\:gbw-scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.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.3",
3
+ "version": "0.1.4",
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",