@queuezero/embed 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var QueueZero=(()=>{var d=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var y=(i,t,e)=>t in i?d(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var q=(i,t)=>{for(var e in t)d(i,e,{get:t[e],enumerable:!0})},z=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!b.call(i,n)&&n!==e&&d(i,n,{get:()=>t[n],enumerable:!(r=f(t,n))||r.enumerable});return i};var v=i=>z(d({},"__esModule",{value:!0}),i);var s=(i,t,e)=>y(i,typeof t!="symbol"?t+"":t,e);var E={};q(E,{init:()=>w});var x=`
1
+ var QueueZero=(()=>{var d=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var y=(i,t,e)=>t in i?d(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var q=(i,t)=>{for(var e in t)d(i,e,{get:t[e],enumerable:!0})},z=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!b.call(i,n)&&n!==e&&d(i,n,{get:()=>t[n],enumerable:!(r=h(t,n))||r.enumerable});return i};var v=i=>z(d({},"__esModule",{value:!0}),i);var s=(i,t,e)=>y(i,typeof t!="symbol"?t+"":t,e);var E={};q(E,{init:()=>w});var x=`
2
2
  .qz-form {
3
3
  font-family: system-ui, -apple-system, sans-serif;
4
4
  max-width: 400px;
@@ -79,7 +79,7 @@ var QueueZero=(()=>{var d=Object.defineProperty;var f=Object.getOwnPropertyDescr
79
79
  padding: 24px;
80
80
  color: #6c7086;
81
81
  }
82
- `,m=class{constructor(t,e,r){s(this,"container");s(this,"campaign");s(this,"options");s(this,"configData",null);s(this,"submitted",!1);s(this,"submittedData",null);let n=document.getElementById(t);if(!n){console.error(`QueueZero: Element with ID "${t}" not found.`),this.container=document.createElement("div");return}this.container=n,this.campaign=e,this.options=r,this.injectStyles(),this.render(),this.loadCampaign()}injectStyles(){if(document.getElementById("qz-styles"))return;let t=document.createElement("style");t.id="qz-styles",t.textContent=x,document.head.appendChild(t)}render(){this.container.innerHTML='<div class="qz-loading">Loading waitlist...</div>'}async loadCampaign(){try{let t=await fetch(`${this.options.apiUrl}/v1/config/${this.campaign}`);if(!t.ok)throw new Error(`Waitlist not found (${t.status})`);this.configData=await t.json(),this.renderForm()}catch(t){this.container.innerHTML=`<div class="qz-error">Failed to load waitlist: ${t.message}</div>`}}renderForm(){if(!this.configData)return;let t=this.configData.branding?.themeColor||"#10B981";this.container.style.setProperty("--qz-theme-color",t);let e=(this.configData.form_fields||[]).filter(o=>o.enabled);e.length===0&&e.push({key:"email",label:"Email Address",type:"email",enabled:!0,required:!0});let r=e.map(o=>`
82
+ `,m=class{constructor(t,e,r){s(this,"container");s(this,"campaign");s(this,"options");s(this,"configData",null);s(this,"submitted",!1);s(this,"submittedData",null);let n=document.getElementById(t);if(!n){console.error(`QueueZero: Element with ID "${t}" not found.`),this.container=document.createElement("div");return}this.container=n,this.campaign=e,this.options=r,this.injectStyles(),this.render(),this.loadCampaign()}injectStyles(){if(document.getElementById("qz-styles"))return;let t=document.createElement("style");t.id="qz-styles",t.textContent=x,document.head.appendChild(t)}render(){this.container.innerHTML='<div class="qz-loading">Loading waitlist...</div>'}async loadCampaign(){try{let t=await fetch(`${this.options.apiUrl}/v1/config/${this.campaign}`);if(!t.ok)throw new Error(`Waitlist not found (${t.status})`);this.configData=await t.json(),this.renderForm()}catch(t){this.container.innerHTML=`<div class="qz-error">Failed to load waitlist: ${t.message}</div>`}}renderForm(){if(!this.configData)return;let t=this.configData.branding?.themeColor||"#10B981";this.container.style.setProperty("--qz-theme-color",t);let e=(this.configData.formFields||[]).filter(o=>o.enabled);e.length===0&&e.push({key:"email",label:"Email Address",type:"email",enabled:!0,required:!0});let r=e.map(o=>`
83
83
  <div class="qz-form-group">
84
84
  <label class="qz-label" for="qz-${o.key}">${o.label}${o.required?" *":""}</label>
85
85
  <input
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@queuezero/embed",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Embeddable vanilla JS widget for QueueZero viral waitlists",
5
5
  "main": "./dist/index.global.js",
6
6
  "browser": "./dist/index.global.js",