pr360-questionnaire 2.1.5 → 2.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.
@@ -17311,14 +17311,6 @@ meter::-webkit-meter-optimum-value {
17311
17311
  this.visitedNodes = [];
17312
17312
  this.hubspotId = "40834387";
17313
17313
  }
17314
- get providers() {
17315
- return this.getAttribute("providers")?.split(",") || [];
17316
- }
17317
- set providers(value) {
17318
- if (value !== null && value !== void 0) {
17319
- this.setAttribute("providers", value.join(","));
17320
- }
17321
- }
17322
17314
  get topic() {
17323
17315
  return `questionnaires:${this.siteId}`;
17324
17316
  }
@@ -17390,19 +17382,29 @@ meter::-webkit-meter-optimum-value {
17390
17382
  </div>
17391
17383
  <div>
17392
17384
  <label for="email">Email</label>
17393
- <input type="email" id="email" name="email" required/>
17385
+ <input type="email" id="email" name="email" required
17386
+ pattern="^[^@\s]+@[^@\s]+\\.[^@\s]+$"
17387
+ title="Please enter a valid email address (e.g. user@example.com)"/>
17394
17388
  </div>
17395
17389
  <div>
17396
17390
  <label for="phone">Phone</label>
17397
- <input type="tel" id="phone" name="phone" required/>
17391
+ <input type="tel" id="phone" name="phone" required
17392
+ pattern="^[0-9]{6,11}$"
17393
+ title="Please enter a valid phone number (6-11 digits)"/>
17398
17394
  </div>
17399
17395
  <div>
17400
17396
  <label for="zip_code">Zip Code</label>
17401
- <input type="text" id="zip_code" name="zip_code" required/>
17397
+ <input type="text" id="zip_code" name="zip_code" required
17398
+ pattern="^[0-9]{5,6}$"
17399
+ title="Please enter a valid US zip code (5 or 6 digits)"/>
17402
17400
  </div>
17403
17401
  <div>
17404
17402
  <label for="insurance_provider">Insurance Provider</label>
17405
- <input type="text" id="insurance_provider" name="insurance_provider"/>
17403
+ <select id="insurance_provider" name="insurance_provider">
17404
+ ${this.providers.map((provider) => x`
17405
+ <option value="${provider}">${provider}</option>
17406
+ `)}
17407
+ </select>
17406
17408
  </div>
17407
17409
  </div>
17408
17410
  <div class="footer u-text-center">
@@ -17482,6 +17484,23 @@ meter::-webkit-meter-optimum-value {
17482
17484
  event.preventDefault();
17483
17485
  if (this.contactInfoForm?.checkValidity()) {
17484
17486
  const email = this.emailInput?.value;
17487
+ const phone = this.phoneInput?.value;
17488
+ const zipCode = this.zipCodeInput?.value;
17489
+ const emailRegex = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
17490
+ if (!emailRegex.test(email)) {
17491
+ alert("Please enter a valid email address");
17492
+ return;
17493
+ }
17494
+ const phoneRegex = /^\d{6,}$/;
17495
+ if (!phoneRegex.test(phone)) {
17496
+ alert("Phone number must contain only numbers and be at least 6 digits long");
17497
+ return;
17498
+ }
17499
+ const zipCodeRegex = /^\d{5,6}$/;
17500
+ if (!zipCodeRegex.test(zipCode)) {
17501
+ alert("Zip code must be 5 or 6 digits");
17502
+ return;
17503
+ }
17485
17504
  const hsq = window["_hsq"] = window["_hsq"] || [];
17486
17505
  hsq.push(["identify", { email }]);
17487
17506
  hsq.push(["setPath", "/submit-contact-info"]);
@@ -17492,8 +17511,8 @@ meter::-webkit-meter-optimum-value {
17492
17511
  first_name: this.firstNameInput.value,
17493
17512
  last_name: this.lastNameInput.value,
17494
17513
  email,
17495
- zip_code: this.zipCodeInput.value,
17496
- phone_number: this.phoneInput.value,
17514
+ zip_code: zipCode,
17515
+ phone_number: phone,
17497
17516
  insurance_provider: this.insuranceProviderSelect.value
17498
17517
  }
17499
17518
  }));
@@ -17531,7 +17550,7 @@ meter::-webkit-meter-optimum-value {
17531
17550
  ], QuestionnaireElement.prototype, "phoneNumber", 2);
17532
17551
  __decorateClass([
17533
17552
  t3()
17534
- ], QuestionnaireElement.prototype, "insuranceProvider", 2);
17553
+ ], QuestionnaireElement.prototype, "providers", 2);
17535
17554
  __decorateClass([
17536
17555
  n5(),
17537
17556
  liveStateConfig("url")
@@ -17545,10 +17564,6 @@ meter::-webkit-meter-optimum-value {
17545
17564
  __decorateClass([
17546
17565
  n5({ type: Boolean })
17547
17566
  ], QuestionnaireElement.prototype, "open", 2);
17548
- __decorateClass([
17549
- n5({ type: Array }),
17550
- liveStateConfig("providers")
17551
- ], QuestionnaireElement.prototype, "providers", 1);
17552
17567
  __decorateClass([
17553
17568
  i4("#question-modal")
17554
17569
  ], QuestionnaireElement.prototype, "modal", 2);
@@ -17579,7 +17594,7 @@ meter::-webkit-meter-optimum-value {
17579
17594
  QuestionnaireElement = __decorateClass([
17580
17595
  e4("pr360-questionnaire"),
17581
17596
  liveStateDecorator_default({
17582
- properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth"],
17597
+ properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers"],
17583
17598
  events: {
17584
17599
  send: ["answerQuestion", "submitContactInfo", "goBack"]
17585
17600
  },
@@ -668,4 +668,7 @@ table.prospects-table {
668
668
  margin: 4px 0;
669
669
  border-color: rgba(255, 255, 255, 0.2);
670
670
  }
671
+ }
672
+ .field-div{
673
+ margin-top: 10px;
671
674
  }
package/dist/index.js CHANGED
@@ -7500,14 +7500,6 @@ meter::-webkit-meter-optimum-value {
7500
7500
  this.visitedNodes = [];
7501
7501
  this.hubspotId = "40834387";
7502
7502
  }
7503
- get providers() {
7504
- return this.getAttribute("providers")?.split(",") || [];
7505
- }
7506
- set providers(value) {
7507
- if (value !== null && value !== void 0) {
7508
- this.setAttribute("providers", value.join(","));
7509
- }
7510
- }
7511
7503
  get topic() {
7512
7504
  return `questionnaires:${this.siteId}`;
7513
7505
  }
@@ -7579,19 +7571,29 @@ meter::-webkit-meter-optimum-value {
7579
7571
  </div>
7580
7572
  <div>
7581
7573
  <label for="email">Email</label>
7582
- <input type="email" id="email" name="email" required/>
7574
+ <input type="email" id="email" name="email" required
7575
+ pattern="^[^@\s]+@[^@\s]+\\.[^@\s]+$"
7576
+ title="Please enter a valid email address (e.g. user@example.com)"/>
7583
7577
  </div>
7584
7578
  <div>
7585
7579
  <label for="phone">Phone</label>
7586
- <input type="tel" id="phone" name="phone" required/>
7580
+ <input type="tel" id="phone" name="phone" required
7581
+ pattern="^[0-9]{6,11}$"
7582
+ title="Please enter a valid phone number (6-11 digits)"/>
7587
7583
  </div>
7588
7584
  <div>
7589
7585
  <label for="zip_code">Zip Code</label>
7590
- <input type="text" id="zip_code" name="zip_code" required/>
7586
+ <input type="text" id="zip_code" name="zip_code" required
7587
+ pattern="^[0-9]{5,6}$"
7588
+ title="Please enter a valid US zip code (5 or 6 digits)"/>
7591
7589
  </div>
7592
7590
  <div>
7593
7591
  <label for="insurance_provider">Insurance Provider</label>
7594
- <input type="text" id="insurance_provider" name="insurance_provider"/>
7592
+ <select id="insurance_provider" name="insurance_provider">
7593
+ ${this.providers.map((provider) => x`
7594
+ <option value="${provider}">${provider}</option>
7595
+ `)}
7596
+ </select>
7595
7597
  </div>
7596
7598
  </div>
7597
7599
  <div class="footer u-text-center">
@@ -7671,6 +7673,23 @@ meter::-webkit-meter-optimum-value {
7671
7673
  event.preventDefault();
7672
7674
  if (this.contactInfoForm?.checkValidity()) {
7673
7675
  const email = this.emailInput?.value;
7676
+ const phone = this.phoneInput?.value;
7677
+ const zipCode = this.zipCodeInput?.value;
7678
+ const emailRegex = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
7679
+ if (!emailRegex.test(email)) {
7680
+ alert("Please enter a valid email address");
7681
+ return;
7682
+ }
7683
+ const phoneRegex = /^\d{6,}$/;
7684
+ if (!phoneRegex.test(phone)) {
7685
+ alert("Phone number must contain only numbers and be at least 6 digits long");
7686
+ return;
7687
+ }
7688
+ const zipCodeRegex = /^\d{5,6}$/;
7689
+ if (!zipCodeRegex.test(zipCode)) {
7690
+ alert("Zip code must be 5 or 6 digits");
7691
+ return;
7692
+ }
7674
7693
  const hsq = window["_hsq"] = window["_hsq"] || [];
7675
7694
  hsq.push(["identify", { email }]);
7676
7695
  hsq.push(["setPath", "/submit-contact-info"]);
@@ -7681,8 +7700,8 @@ meter::-webkit-meter-optimum-value {
7681
7700
  first_name: this.firstNameInput.value,
7682
7701
  last_name: this.lastNameInput.value,
7683
7702
  email,
7684
- zip_code: this.zipCodeInput.value,
7685
- phone_number: this.phoneInput.value,
7703
+ zip_code: zipCode,
7704
+ phone_number: phone,
7686
7705
  insurance_provider: this.insuranceProviderSelect.value
7687
7706
  }
7688
7707
  }));
@@ -7720,7 +7739,7 @@ meter::-webkit-meter-optimum-value {
7720
7739
  ], QuestionnaireElement.prototype, "phoneNumber", 2);
7721
7740
  __decorateClass([
7722
7741
  t3()
7723
- ], QuestionnaireElement.prototype, "insuranceProvider", 2);
7742
+ ], QuestionnaireElement.prototype, "providers", 2);
7724
7743
  __decorateClass([
7725
7744
  n5(),
7726
7745
  liveStateConfig("url")
@@ -7734,10 +7753,6 @@ meter::-webkit-meter-optimum-value {
7734
7753
  __decorateClass([
7735
7754
  n5({ type: Boolean })
7736
7755
  ], QuestionnaireElement.prototype, "open", 2);
7737
- __decorateClass([
7738
- n5({ type: Array }),
7739
- liveStateConfig("providers")
7740
- ], QuestionnaireElement.prototype, "providers", 1);
7741
7756
  __decorateClass([
7742
7757
  i4("#question-modal")
7743
7758
  ], QuestionnaireElement.prototype, "modal", 2);
@@ -7768,7 +7783,7 @@ meter::-webkit-meter-optimum-value {
7768
7783
  QuestionnaireElement = __decorateClass([
7769
7784
  e4("pr360-questionnaire"),
7770
7785
  liveStateDecorator_default({
7771
- properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth"],
7786
+ properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers"],
7772
7787
  events: {
7773
7788
  send: ["answerQuestion", "submitContactInfo", "goBack"]
7774
7789
  },
@@ -36,7 +36,7 @@ export type Answer = {
36
36
 
37
37
  @customElement('pr360-questionnaire')
38
38
  @liveState({
39
- properties: ['currentStep', 'visitedNodes', 'phoneNumber', 'links', 'accountActive', 'questionnaireDepth'],
39
+ properties: ['currentStep', 'visitedNodes', 'phoneNumber', 'links', 'accountActive', 'questionnaireDepth', 'providers'],
40
40
  events: {
41
41
  send: ['answerQuestion', 'submitContactInfo', 'goBack']
42
42
  },
@@ -66,7 +66,7 @@ export class QuestionnaireElement extends LitElement {
66
66
  phoneNumber: string;
67
67
 
68
68
  @state()
69
- insuranceProvider: string;
69
+ providers: string[];
70
70
 
71
71
  @property()
72
72
  @liveStateConfig('url')
@@ -81,18 +81,6 @@ export class QuestionnaireElement extends LitElement {
81
81
  @property({ type: Boolean })
82
82
  open: boolean;
83
83
 
84
- @property({ type: Array })
85
- @liveStateConfig('providers')
86
- get providers(): string[] {
87
- return this.getAttribute('providers')?.split(',') || [];
88
- }
89
-
90
- set providers(value: string[]) {
91
- if (value !== null && value !== undefined) {
92
- this.setAttribute('providers', value.join(','));
93
- }
94
- }
95
-
96
84
  @query('#question-modal')
97
85
  modal: HTMLDialogElement | undefined;
98
86
 
@@ -190,19 +178,29 @@ export class QuestionnaireElement extends LitElement {
190
178
  </div>
191
179
  <div>
192
180
  <label for="email">Email</label>
193
- <input type="email" id="email" name="email" required/>
181
+ <input type="email" id="email" name="email" required
182
+ pattern="^[^@\s]+@[^@\s]+\\.[^@\s]+$"
183
+ title="Please enter a valid email address (e.g. user@example.com)"/>
194
184
  </div>
195
185
  <div>
196
186
  <label for="phone">Phone</label>
197
- <input type="tel" id="phone" name="phone" required/>
187
+ <input type="tel" id="phone" name="phone" required
188
+ pattern="^[0-9]{6,11}$"
189
+ title="Please enter a valid phone number (6-11 digits)"/>
198
190
  </div>
199
191
  <div>
200
192
  <label for="zip_code">Zip Code</label>
201
- <input type="text" id="zip_code" name="zip_code" required/>
193
+ <input type="text" id="zip_code" name="zip_code" required
194
+ pattern="^[0-9]{5,6}$"
195
+ title="Please enter a valid US zip code (5 or 6 digits)"/>
202
196
  </div>
203
197
  <div>
204
198
  <label for="insurance_provider">Insurance Provider</label>
205
- <input type="text" id="insurance_provider" name="insurance_provider"/>
199
+ <select id="insurance_provider" name="insurance_provider">
200
+ ${this.providers.map(provider => html`
201
+ <option value="${provider}">${provider}</option>
202
+ `)}
203
+ </select>
206
204
  </div>
207
205
  </div>
208
206
  <div class="footer u-text-center">
@@ -289,8 +287,33 @@ export class QuestionnaireElement extends LitElement {
289
287
  submitContactInfo(event: Event) {
290
288
  event.stopPropagation();
291
289
  event.preventDefault();
290
+
292
291
  if (this.contactInfoForm?.checkValidity()) {
293
292
  const email = this.emailInput?.value;
293
+ const phone = this.phoneInput?.value;
294
+ const zipCode = this.zipCodeInput?.value;
295
+
296
+ // Email validation
297
+ const emailRegex = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
298
+ if (!emailRegex.test(email)) {
299
+ alert('Please enter a valid email address');
300
+ return;
301
+ }
302
+
303
+ // Phone validation
304
+ const phoneRegex = /^\d{6,}$/;
305
+ if (!phoneRegex.test(phone)) {
306
+ alert('Phone number must contain only numbers and be at least 6 digits long');
307
+ return;
308
+ }
309
+
310
+ // Zip code validation
311
+ const zipCodeRegex = /^\d{5,6}$/;
312
+ if (!zipCodeRegex.test(zipCode)) {
313
+ alert('Zip code must be 5 or 6 digits');
314
+ return;
315
+ }
316
+
294
317
  const hsq = window['_hsq'] = window['_hsq'] || [];
295
318
  hsq.push(['identify', { email: email }]);
296
319
  hsq.push(['setPath', '/submit-contact-info']);
@@ -302,8 +325,8 @@ export class QuestionnaireElement extends LitElement {
302
325
  first_name: this.firstNameInput.value,
303
326
  last_name: this.lastNameInput.value,
304
327
  email: email,
305
- zip_code: this.zipCodeInput.value,
306
- phone_number: this.phoneInput.value,
328
+ zip_code: zipCode,
329
+ phone_number: phone,
307
330
  insurance_provider: this.insuranceProviderSelect.value
308
331
  }
309
332
  }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pr360-questionnaire",
3
3
  "description": "An element to render a questionnaire for PatientReach 360.",
4
- "version": "2.1.5",
4
+ "version": "2.1.6",
5
5
  "main": "dist/index.js",
6
6
  "author": {
7
7
  "email": "chris@launchscout.com",