@queuezero/vue 0.1.8 → 0.1.9

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/README.md CHANGED
@@ -77,9 +77,26 @@ Ready-to-use signup form.
77
77
  <input :value="email" @input="setEmail($event.target.value)" />
78
78
  <button @click="submit">{{ loading ? '...' : 'Join' }}</button>
79
79
  </WaitlistForm>
80
+
81
+ <!-- Modal mode -->
82
+ <WaitlistForm
83
+ display-mode="modal"
84
+ trigger-text="Join Our Waitlist"
85
+ modal-size="md"
86
+ />
80
87
  </template>
81
88
  ```
82
89
 
90
+ #### Modal Mode Props
91
+
92
+ | Prop | Type | Default | Description |
93
+ |------|------|---------|-------------|
94
+ | `display-mode` | `'inline' \| 'modal'` | `'inline'` | Display as inline form or modal |
95
+ | `trigger-text` | `string` | `'Join Waitlist'` | Button text (modal mode only) |
96
+ | `modal-size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Modal width (modal mode only) |
97
+
98
+ The modal automatically uses your campaign's branding (logo, cover image, theme color) from the API.
99
+
83
100
  ### WaitlistStatus
84
101
 
85
102
  Displays position, score, and referral count.
package/dist/index.js CHANGED
@@ -76,7 +76,13 @@ function useWaitlist(campaign, config) {
76
76
  join: stateManager.join.bind(stateManager),
77
77
  refresh: stateManager.refresh.bind(stateManager),
78
78
  fetchPublicConfig: stateManager.fetchPublicConfig.bind(stateManager),
79
- getReferralLink: stateManager.getReferralLink.bind(stateManager),
79
+ getReferralLink: () => {
80
+ const code = stateManager.getReferralCode();
81
+ if (code && typeof window !== "undefined") {
82
+ return `${window.location.origin}${window.location.pathname}?ref=${code}`;
83
+ }
84
+ return stateManager.getReferralLink();
85
+ },
80
86
  getReferralCode: stateManager.getReferralCode.bind(stateManager),
81
87
  reset: stateManager.reset.bind(stateManager)
82
88
  };
@@ -158,6 +164,7 @@ var WaitlistForm = (0, import_vue2.defineComponent)({
158
164
  const email = (0, import_vue2.ref)("");
159
165
  const localError = (0, import_vue2.ref)(null);
160
166
  const isModalOpen = (0, import_vue2.ref)(false);
167
+ const successData = (0, import_vue2.ref)(null);
161
168
  const formData = (0, import_vue2.reactive)({});
162
169
  const displayError = (0, import_vue2.computed)(() => localError.value || contextError.value);
163
170
  const branding = (0, import_vue2.computed)(() => publicConfig.value?.branding || {});
@@ -177,6 +184,7 @@ var WaitlistForm = (0, import_vue2.defineComponent)({
177
184
  if (result) {
178
185
  email.value = "";
179
186
  Object.keys(formData).forEach((key) => delete formData[key]);
187
+ successData.value = result;
180
188
  emit("success", result);
181
189
  } else if (contextError.value) {
182
190
  emit("error", contextError.value);
@@ -210,7 +218,7 @@ var WaitlistForm = (0, import_vue2.defineComponent)({
210
218
  formData[field.key] = e.target.value;
211
219
  }
212
220
  }, [
213
- (0, import_vue2.h)("option", { value: "" }, field.placeholder || `Select ${field.label}`),
221
+ (0, import_vue2.h)("option", { value: "" }, "Select an option"),
214
222
  ...(field.options || []).map(
215
223
  (opt) => (0, import_vue2.h)("option", { value: opt }, opt)
216
224
  )
@@ -389,7 +397,20 @@ var WaitlistForm = (0, import_vue2.defineComponent)({
389
397
  // Body
390
398
  (0, import_vue2.h)("div", { class: "qz-modal-body" }, [
391
399
  (0, import_vue2.h)("h2", { class: "qz-modal-title" }, publicConfig.value?.name || "Join Waitlist"),
392
- formContent
400
+ successData.value ? (0, import_vue2.h)("div", { class: "qz-success" }, [
401
+ (0, import_vue2.h)("h3", { style: { fontSize: "1.25rem", fontWeight: "600", marginBottom: "0.5rem", textAlign: "center" } }, "You're on the list!"),
402
+ (0, import_vue2.h)("p", { style: { textAlign: "center", marginBottom: "1.5rem", opacity: "0.9" } }, `You're #${successData.value.position || "?"} in line.`),
403
+ successData.value.referralLink && (0, import_vue2.h)("div", { style: { marginTop: "1.5rem" } }, [
404
+ (0, import_vue2.h)("p", { style: { marginBottom: "0.5rem", fontSize: "0.875rem", opacity: "0.9", textAlign: "center" } }, "Refer friends to move up:"),
405
+ (0, import_vue2.h)("input", {
406
+ class: "qz-form-input",
407
+ style: { textAlign: "center", cursor: "pointer" },
408
+ readonly: true,
409
+ value: window.location.origin + window.location.pathname + "?ref=" + successData.value.referralCode,
410
+ onClick: (e) => e.target.select()
411
+ })
412
+ ])
413
+ ]) : formContent
393
414
  ])
394
415
  ])
395
416
  ]
package/dist/index.mjs CHANGED
@@ -40,7 +40,13 @@ function useWaitlist(campaign, config) {
40
40
  join: stateManager.join.bind(stateManager),
41
41
  refresh: stateManager.refresh.bind(stateManager),
42
42
  fetchPublicConfig: stateManager.fetchPublicConfig.bind(stateManager),
43
- getReferralLink: stateManager.getReferralLink.bind(stateManager),
43
+ getReferralLink: () => {
44
+ const code = stateManager.getReferralCode();
45
+ if (code && typeof window !== "undefined") {
46
+ return `${window.location.origin}${window.location.pathname}?ref=${code}`;
47
+ }
48
+ return stateManager.getReferralLink();
49
+ },
44
50
  getReferralCode: stateManager.getReferralCode.bind(stateManager),
45
51
  reset: stateManager.reset.bind(stateManager)
46
52
  };
@@ -122,6 +128,7 @@ var WaitlistForm = defineComponent({
122
128
  const email = ref2("");
123
129
  const localError = ref2(null);
124
130
  const isModalOpen = ref2(false);
131
+ const successData = ref2(null);
125
132
  const formData = reactive({});
126
133
  const displayError = computed2(() => localError.value || contextError.value);
127
134
  const branding = computed2(() => publicConfig.value?.branding || {});
@@ -141,6 +148,7 @@ var WaitlistForm = defineComponent({
141
148
  if (result) {
142
149
  email.value = "";
143
150
  Object.keys(formData).forEach((key) => delete formData[key]);
151
+ successData.value = result;
144
152
  emit("success", result);
145
153
  } else if (contextError.value) {
146
154
  emit("error", contextError.value);
@@ -174,7 +182,7 @@ var WaitlistForm = defineComponent({
174
182
  formData[field.key] = e.target.value;
175
183
  }
176
184
  }, [
177
- h("option", { value: "" }, field.placeholder || `Select ${field.label}`),
185
+ h("option", { value: "" }, "Select an option"),
178
186
  ...(field.options || []).map(
179
187
  (opt) => h("option", { value: opt }, opt)
180
188
  )
@@ -353,7 +361,20 @@ var WaitlistForm = defineComponent({
353
361
  // Body
354
362
  h("div", { class: "qz-modal-body" }, [
355
363
  h("h2", { class: "qz-modal-title" }, publicConfig.value?.name || "Join Waitlist"),
356
- formContent
364
+ successData.value ? h("div", { class: "qz-success" }, [
365
+ h("h3", { style: { fontSize: "1.25rem", fontWeight: "600", marginBottom: "0.5rem", textAlign: "center" } }, "You're on the list!"),
366
+ h("p", { style: { textAlign: "center", marginBottom: "1.5rem", opacity: "0.9" } }, `You're #${successData.value.position || "?"} in line.`),
367
+ successData.value.referralLink && h("div", { style: { marginTop: "1.5rem" } }, [
368
+ h("p", { style: { marginBottom: "0.5rem", fontSize: "0.875rem", opacity: "0.9", textAlign: "center" } }, "Refer friends to move up:"),
369
+ h("input", {
370
+ class: "qz-form-input",
371
+ style: { textAlign: "center", cursor: "pointer" },
372
+ readonly: true,
373
+ value: window.location.origin + window.location.pathname + "?ref=" + successData.value.referralCode,
374
+ onClick: (e) => e.target.select()
375
+ })
376
+ ])
377
+ ]) : formContent
357
378
  ])
358
379
  ])
359
380
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@queuezero/vue",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Vue components and composables for QueueZero viral waitlists",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",