pr360-questionnaire 2.3.4 → 2.3.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.
- package/build/questionnaire-test.js +48 -14
- package/css/questionnaire.lit.scss +3 -2
- package/dist/index.js +47 -13
- package/js/questionnaire.ts +46 -10
- package/package.json +1 -1
- package/test/questionnaire-test.ts +1 -1
|
@@ -17001,8 +17001,9 @@ meter::-webkit-meter-optimum-value {
|
|
|
17001
17001
|
text-decoration: none;
|
|
17002
17002
|
display: inline-block;
|
|
17003
17003
|
width: auto;
|
|
17004
|
-
min-width:
|
|
17005
|
-
|
|
17004
|
+
min-width: 180px;
|
|
17005
|
+
min-height: auto;
|
|
17006
|
+
padding: 12px 32px;
|
|
17006
17007
|
margin: 20px 0;
|
|
17007
17008
|
text-align: center;
|
|
17008
17009
|
}
|
|
@@ -17369,9 +17370,10 @@ meter::-webkit-meter-optimum-value {
|
|
|
17369
17370
|
super(...arguments);
|
|
17370
17371
|
this.accountActive = true;
|
|
17371
17372
|
this.visitedNodes = [];
|
|
17372
|
-
this.
|
|
17373
|
+
this.formError = null;
|
|
17373
17374
|
this.canSelfBook = false;
|
|
17374
17375
|
this.hubspotId = "40834387";
|
|
17376
|
+
this.showInsuranceNotes = false;
|
|
17375
17377
|
}
|
|
17376
17378
|
get topic() {
|
|
17377
17379
|
return `questionnaires:${this.siteId}`;
|
|
@@ -17438,6 +17440,9 @@ meter::-webkit-meter-optimum-value {
|
|
|
17438
17440
|
if (this.outcome) {
|
|
17439
17441
|
this.trackQuestionnaireCompletion();
|
|
17440
17442
|
}
|
|
17443
|
+
if (this.providers && !this.insuranceProviderSelect) {
|
|
17444
|
+
this.showInsuranceNotes = this.isOtherInsurance(this.providers[0]);
|
|
17445
|
+
}
|
|
17441
17446
|
}
|
|
17442
17447
|
render() {
|
|
17443
17448
|
return x`
|
|
@@ -17488,15 +17493,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
17488
17493
|
<h1>${this.siteSource ? `${this.siteSource} can help.` : "We think we can help."}</h1>
|
|
17489
17494
|
<h2>${this.currentStep.text}</h2>
|
|
17490
17495
|
</div>
|
|
17496
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
17491
17497
|
<form @submit=${this.submitContactInfo}>
|
|
17492
17498
|
<div class="form">
|
|
17493
17499
|
<div class="u-margin--top">
|
|
17494
17500
|
<label for="name">First Name</label>
|
|
17495
|
-
<input type="text" id="first_name" name="first_name" required
|
|
17501
|
+
<input type="text" id="first_name" name="first_name" required
|
|
17502
|
+
minlength="2"
|
|
17503
|
+
title="Please enter at least 2 characters"/>
|
|
17496
17504
|
</div>
|
|
17497
17505
|
<div class="u-margin--top">
|
|
17498
17506
|
<label for="name">Last Name</label>
|
|
17499
|
-
<input type="text" id="last_name" name="last_name" required
|
|
17507
|
+
<input type="text" id="last_name" name="last_name" required
|
|
17508
|
+
minlength="2"
|
|
17509
|
+
title="Please enter at least 2 characters"/>
|
|
17500
17510
|
</div>
|
|
17501
17511
|
<div>
|
|
17502
17512
|
<label for="email">Email</label>
|
|
@@ -17505,8 +17515,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
17505
17515
|
<div>
|
|
17506
17516
|
<label for="phone">Phone</label>
|
|
17507
17517
|
<input type="tel" id="phone" name="phone" required
|
|
17508
|
-
pattern="^[0-9]{
|
|
17509
|
-
title="Please enter a valid phone number (
|
|
17518
|
+
pattern="^[0-9]{9,10}$"
|
|
17519
|
+
title="Please enter a valid phone number (9-10 digits)"/>
|
|
17510
17520
|
</div>
|
|
17511
17521
|
<div>
|
|
17512
17522
|
<label for="zip_code">Zip Code</label>
|
|
@@ -17516,12 +17526,18 @@ meter::-webkit-meter-optimum-value {
|
|
|
17516
17526
|
</div>
|
|
17517
17527
|
<div>
|
|
17518
17528
|
<label for="insurance_provider">Insurance Provider</label>
|
|
17519
|
-
<select id="insurance_provider" name="insurance_provider">
|
|
17529
|
+
<select id="insurance_provider" name="insurance_provider" @change=${this.handleInsuranceChange}>
|
|
17520
17530
|
${this.providers.map((provider) => x`
|
|
17521
17531
|
<option value="${provider}">${provider}</option>
|
|
17522
17532
|
`)}
|
|
17523
17533
|
</select>
|
|
17524
17534
|
</div>
|
|
17535
|
+
${this.showInsuranceNotes ? x`
|
|
17536
|
+
<div>
|
|
17537
|
+
<label for="insurance_notes">Insurance Information</label>
|
|
17538
|
+
<input type="text" id="insurance_notes" name="insurance_notes" />
|
|
17539
|
+
</div>
|
|
17540
|
+
` : ""}
|
|
17525
17541
|
</div>
|
|
17526
17542
|
<div class="footer u-text-center">
|
|
17527
17543
|
<button class="button button--primary u-push-top" type="submit">Get Assessment</button>
|
|
@@ -17553,7 +17569,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17553
17569
|
<input type="text" id="verification_code" name="verification_code" required
|
|
17554
17570
|
pattern="^[a-zA-Z0-9]+$"
|
|
17555
17571
|
title="Please enter the verification code" />
|
|
17556
|
-
${this.
|
|
17572
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
17557
17573
|
</div>
|
|
17558
17574
|
</div>
|
|
17559
17575
|
<div class="footer u-text-center">
|
|
@@ -17626,9 +17642,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
17626
17642
|
}
|
|
17627
17643
|
}));
|
|
17628
17644
|
}
|
|
17645
|
+
isOtherInsurance(value) {
|
|
17646
|
+
return value?.toLowerCase() === "other";
|
|
17647
|
+
}
|
|
17648
|
+
handleInsuranceChange(event) {
|
|
17649
|
+
const select = event.target;
|
|
17650
|
+
this.showInsuranceNotes = this.isOtherInsurance(select.value);
|
|
17651
|
+
if (!this.showInsuranceNotes && this.insuranceNotesInput) {
|
|
17652
|
+
this.insuranceNotesInput.value = "";
|
|
17653
|
+
}
|
|
17654
|
+
}
|
|
17629
17655
|
submitContactInfo(event) {
|
|
17630
17656
|
event.stopPropagation();
|
|
17631
17657
|
event.preventDefault();
|
|
17658
|
+
this.formError = null;
|
|
17632
17659
|
if (this.contactInfoForm?.checkValidity()) {
|
|
17633
17660
|
const email = this.emailInput?.value;
|
|
17634
17661
|
const hsq = window["_hsq"] = window["_hsq"] || [];
|
|
@@ -17642,7 +17669,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
17642
17669
|
email,
|
|
17643
17670
|
zip_code: this.zipCodeInput?.value,
|
|
17644
17671
|
phone_number: this.phoneInput?.value,
|
|
17645
|
-
insurance_provider: this.insuranceProviderSelect.value
|
|
17672
|
+
insurance_provider: this.insuranceProviderSelect.value,
|
|
17673
|
+
insurance_notes: this.insuranceNotesInput?.value
|
|
17646
17674
|
};
|
|
17647
17675
|
window["dataLayer"] = window["dataLayer"] || [];
|
|
17648
17676
|
window["dataLayer"].push({
|
|
@@ -17659,7 +17687,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17659
17687
|
event.preventDefault();
|
|
17660
17688
|
const code = this.verificationCodeInput?.value;
|
|
17661
17689
|
if (code) {
|
|
17662
|
-
this.
|
|
17690
|
+
this.formError = null;
|
|
17663
17691
|
const nodeId = this.currentStep?.id.replace("verification_", "");
|
|
17664
17692
|
this.dispatchEvent(new CustomEvent("submitVerification", {
|
|
17665
17693
|
detail: { verificationCode: code, nodeId }
|
|
@@ -17702,7 +17730,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17702
17730
|
], QuestionnaireElement.prototype, "outcome", 2);
|
|
17703
17731
|
__decorateClass([
|
|
17704
17732
|
t3()
|
|
17705
|
-
], QuestionnaireElement.prototype, "
|
|
17733
|
+
], QuestionnaireElement.prototype, "formError", 2);
|
|
17706
17734
|
__decorateClass([
|
|
17707
17735
|
t3()
|
|
17708
17736
|
], QuestionnaireElement.prototype, "canSelfBook", 2);
|
|
@@ -17746,6 +17774,12 @@ meter::-webkit-meter-optimum-value {
|
|
|
17746
17774
|
__decorateClass([
|
|
17747
17775
|
i4("#insurance_provider")
|
|
17748
17776
|
], QuestionnaireElement.prototype, "insuranceProviderSelect", 2);
|
|
17777
|
+
__decorateClass([
|
|
17778
|
+
i4("#insurance_notes")
|
|
17779
|
+
], QuestionnaireElement.prototype, "insuranceNotesInput", 2);
|
|
17780
|
+
__decorateClass([
|
|
17781
|
+
t3()
|
|
17782
|
+
], QuestionnaireElement.prototype, "showInsuranceNotes", 2);
|
|
17749
17783
|
__decorateClass([
|
|
17750
17784
|
i4("#verification_code")
|
|
17751
17785
|
], QuestionnaireElement.prototype, "verificationCodeInput", 2);
|
|
@@ -17761,7 +17795,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17761
17795
|
QuestionnaireElement = __decorateClass([
|
|
17762
17796
|
e4("pr360-questionnaire"),
|
|
17763
17797
|
liveStateDecorator_default({
|
|
17764
|
-
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "
|
|
17798
|
+
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "formError", "canSelfBook", "bookingUrl", "siteSource"],
|
|
17765
17799
|
events: {
|
|
17766
17800
|
send: ["answerQuestion", "submitContactInfo", "goBack", "setUtmParams", "submitVerification", "resendCode"]
|
|
17767
17801
|
},
|
|
@@ -32224,7 +32258,7 @@ ${inspect(response)}
|
|
|
32224
32258
|
text: "Please enter the verification code we sent to your phone.",
|
|
32225
32259
|
phoneNumber: "555-123-4567"
|
|
32226
32260
|
};
|
|
32227
|
-
questionnaireElement.
|
|
32261
|
+
questionnaireElement.formError = "Invalid verification code";
|
|
32228
32262
|
questionnaireElement.links = {
|
|
32229
32263
|
contact_info_image: "/images/contact.jpg"
|
|
32230
32264
|
};
|
|
@@ -261,8 +261,9 @@ meter::-webkit-meter-optimum-value {
|
|
|
261
261
|
text-decoration: none;
|
|
262
262
|
display: inline-block;
|
|
263
263
|
width: auto;
|
|
264
|
-
min-width:
|
|
265
|
-
|
|
264
|
+
min-width: 180px;
|
|
265
|
+
min-height: auto;
|
|
266
|
+
padding: 12px 32px;
|
|
266
267
|
margin: 20px 0;
|
|
267
268
|
text-align: center;
|
|
268
269
|
|
package/dist/index.js
CHANGED
|
@@ -7196,8 +7196,9 @@ meter::-webkit-meter-optimum-value {
|
|
|
7196
7196
|
text-decoration: none;
|
|
7197
7197
|
display: inline-block;
|
|
7198
7198
|
width: auto;
|
|
7199
|
-
min-width:
|
|
7200
|
-
|
|
7199
|
+
min-width: 180px;
|
|
7200
|
+
min-height: auto;
|
|
7201
|
+
padding: 12px 32px;
|
|
7201
7202
|
margin: 20px 0;
|
|
7202
7203
|
text-align: center;
|
|
7203
7204
|
}
|
|
@@ -7558,9 +7559,10 @@ meter::-webkit-meter-optimum-value {
|
|
|
7558
7559
|
super(...arguments);
|
|
7559
7560
|
this.accountActive = true;
|
|
7560
7561
|
this.visitedNodes = [];
|
|
7561
|
-
this.
|
|
7562
|
+
this.formError = null;
|
|
7562
7563
|
this.canSelfBook = false;
|
|
7563
7564
|
this.hubspotId = "40834387";
|
|
7565
|
+
this.showInsuranceNotes = false;
|
|
7564
7566
|
}
|
|
7565
7567
|
get topic() {
|
|
7566
7568
|
return `questionnaires:${this.siteId}`;
|
|
@@ -7627,6 +7629,9 @@ meter::-webkit-meter-optimum-value {
|
|
|
7627
7629
|
if (this.outcome) {
|
|
7628
7630
|
this.trackQuestionnaireCompletion();
|
|
7629
7631
|
}
|
|
7632
|
+
if (this.providers && !this.insuranceProviderSelect) {
|
|
7633
|
+
this.showInsuranceNotes = this.isOtherInsurance(this.providers[0]);
|
|
7634
|
+
}
|
|
7630
7635
|
}
|
|
7631
7636
|
render() {
|
|
7632
7637
|
return x`
|
|
@@ -7677,15 +7682,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
7677
7682
|
<h1>${this.siteSource ? `${this.siteSource} can help.` : "We think we can help."}</h1>
|
|
7678
7683
|
<h2>${this.currentStep.text}</h2>
|
|
7679
7684
|
</div>
|
|
7685
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
7680
7686
|
<form @submit=${this.submitContactInfo}>
|
|
7681
7687
|
<div class="form">
|
|
7682
7688
|
<div class="u-margin--top">
|
|
7683
7689
|
<label for="name">First Name</label>
|
|
7684
|
-
<input type="text" id="first_name" name="first_name" required
|
|
7690
|
+
<input type="text" id="first_name" name="first_name" required
|
|
7691
|
+
minlength="2"
|
|
7692
|
+
title="Please enter at least 2 characters"/>
|
|
7685
7693
|
</div>
|
|
7686
7694
|
<div class="u-margin--top">
|
|
7687
7695
|
<label for="name">Last Name</label>
|
|
7688
|
-
<input type="text" id="last_name" name="last_name" required
|
|
7696
|
+
<input type="text" id="last_name" name="last_name" required
|
|
7697
|
+
minlength="2"
|
|
7698
|
+
title="Please enter at least 2 characters"/>
|
|
7689
7699
|
</div>
|
|
7690
7700
|
<div>
|
|
7691
7701
|
<label for="email">Email</label>
|
|
@@ -7694,8 +7704,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
7694
7704
|
<div>
|
|
7695
7705
|
<label for="phone">Phone</label>
|
|
7696
7706
|
<input type="tel" id="phone" name="phone" required
|
|
7697
|
-
pattern="^[0-9]{
|
|
7698
|
-
title="Please enter a valid phone number (
|
|
7707
|
+
pattern="^[0-9]{9,10}$"
|
|
7708
|
+
title="Please enter a valid phone number (9-10 digits)"/>
|
|
7699
7709
|
</div>
|
|
7700
7710
|
<div>
|
|
7701
7711
|
<label for="zip_code">Zip Code</label>
|
|
@@ -7705,12 +7715,18 @@ meter::-webkit-meter-optimum-value {
|
|
|
7705
7715
|
</div>
|
|
7706
7716
|
<div>
|
|
7707
7717
|
<label for="insurance_provider">Insurance Provider</label>
|
|
7708
|
-
<select id="insurance_provider" name="insurance_provider">
|
|
7718
|
+
<select id="insurance_provider" name="insurance_provider" @change=${this.handleInsuranceChange}>
|
|
7709
7719
|
${this.providers.map((provider) => x`
|
|
7710
7720
|
<option value="${provider}">${provider}</option>
|
|
7711
7721
|
`)}
|
|
7712
7722
|
</select>
|
|
7713
7723
|
</div>
|
|
7724
|
+
${this.showInsuranceNotes ? x`
|
|
7725
|
+
<div>
|
|
7726
|
+
<label for="insurance_notes">Insurance Information</label>
|
|
7727
|
+
<input type="text" id="insurance_notes" name="insurance_notes" />
|
|
7728
|
+
</div>
|
|
7729
|
+
` : ""}
|
|
7714
7730
|
</div>
|
|
7715
7731
|
<div class="footer u-text-center">
|
|
7716
7732
|
<button class="button button--primary u-push-top" type="submit">Get Assessment</button>
|
|
@@ -7742,7 +7758,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7742
7758
|
<input type="text" id="verification_code" name="verification_code" required
|
|
7743
7759
|
pattern="^[a-zA-Z0-9]+$"
|
|
7744
7760
|
title="Please enter the verification code" />
|
|
7745
|
-
${this.
|
|
7761
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
7746
7762
|
</div>
|
|
7747
7763
|
</div>
|
|
7748
7764
|
<div class="footer u-text-center">
|
|
@@ -7815,9 +7831,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
7815
7831
|
}
|
|
7816
7832
|
}));
|
|
7817
7833
|
}
|
|
7834
|
+
isOtherInsurance(value) {
|
|
7835
|
+
return value?.toLowerCase() === "other";
|
|
7836
|
+
}
|
|
7837
|
+
handleInsuranceChange(event) {
|
|
7838
|
+
const select = event.target;
|
|
7839
|
+
this.showInsuranceNotes = this.isOtherInsurance(select.value);
|
|
7840
|
+
if (!this.showInsuranceNotes && this.insuranceNotesInput) {
|
|
7841
|
+
this.insuranceNotesInput.value = "";
|
|
7842
|
+
}
|
|
7843
|
+
}
|
|
7818
7844
|
submitContactInfo(event) {
|
|
7819
7845
|
event.stopPropagation();
|
|
7820
7846
|
event.preventDefault();
|
|
7847
|
+
this.formError = null;
|
|
7821
7848
|
if (this.contactInfoForm?.checkValidity()) {
|
|
7822
7849
|
const email = this.emailInput?.value;
|
|
7823
7850
|
const hsq = window["_hsq"] = window["_hsq"] || [];
|
|
@@ -7831,7 +7858,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
7831
7858
|
email,
|
|
7832
7859
|
zip_code: this.zipCodeInput?.value,
|
|
7833
7860
|
phone_number: this.phoneInput?.value,
|
|
7834
|
-
insurance_provider: this.insuranceProviderSelect.value
|
|
7861
|
+
insurance_provider: this.insuranceProviderSelect.value,
|
|
7862
|
+
insurance_notes: this.insuranceNotesInput?.value
|
|
7835
7863
|
};
|
|
7836
7864
|
window["dataLayer"] = window["dataLayer"] || [];
|
|
7837
7865
|
window["dataLayer"].push({
|
|
@@ -7848,7 +7876,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7848
7876
|
event.preventDefault();
|
|
7849
7877
|
const code = this.verificationCodeInput?.value;
|
|
7850
7878
|
if (code) {
|
|
7851
|
-
this.
|
|
7879
|
+
this.formError = null;
|
|
7852
7880
|
const nodeId = this.currentStep?.id.replace("verification_", "");
|
|
7853
7881
|
this.dispatchEvent(new CustomEvent("submitVerification", {
|
|
7854
7882
|
detail: { verificationCode: code, nodeId }
|
|
@@ -7891,7 +7919,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7891
7919
|
], QuestionnaireElement.prototype, "outcome", 2);
|
|
7892
7920
|
__decorateClass([
|
|
7893
7921
|
t3()
|
|
7894
|
-
], QuestionnaireElement.prototype, "
|
|
7922
|
+
], QuestionnaireElement.prototype, "formError", 2);
|
|
7895
7923
|
__decorateClass([
|
|
7896
7924
|
t3()
|
|
7897
7925
|
], QuestionnaireElement.prototype, "canSelfBook", 2);
|
|
@@ -7935,6 +7963,12 @@ meter::-webkit-meter-optimum-value {
|
|
|
7935
7963
|
__decorateClass([
|
|
7936
7964
|
i4("#insurance_provider")
|
|
7937
7965
|
], QuestionnaireElement.prototype, "insuranceProviderSelect", 2);
|
|
7966
|
+
__decorateClass([
|
|
7967
|
+
i4("#insurance_notes")
|
|
7968
|
+
], QuestionnaireElement.prototype, "insuranceNotesInput", 2);
|
|
7969
|
+
__decorateClass([
|
|
7970
|
+
t3()
|
|
7971
|
+
], QuestionnaireElement.prototype, "showInsuranceNotes", 2);
|
|
7938
7972
|
__decorateClass([
|
|
7939
7973
|
i4("#verification_code")
|
|
7940
7974
|
], QuestionnaireElement.prototype, "verificationCodeInput", 2);
|
|
@@ -7950,7 +7984,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7950
7984
|
QuestionnaireElement = __decorateClass([
|
|
7951
7985
|
e4("pr360-questionnaire"),
|
|
7952
7986
|
liveStateDecorator_default({
|
|
7953
|
-
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "
|
|
7987
|
+
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "formError", "canSelfBook", "bookingUrl", "siteSource"],
|
|
7954
7988
|
events: {
|
|
7955
7989
|
send: ["answerQuestion", "submitContactInfo", "goBack", "setUtmParams", "submitVerification", "resendCode"]
|
|
7956
7990
|
},
|
package/js/questionnaire.ts
CHANGED
|
@@ -44,7 +44,7 @@ export type Answer = {
|
|
|
44
44
|
|
|
45
45
|
@customElement('pr360-questionnaire')
|
|
46
46
|
@liveState({
|
|
47
|
-
properties: ['currentStep', 'visitedNodes', 'phoneNumber', 'links', 'accountActive', 'questionnaireDepth', 'providers', 'outcome', '
|
|
47
|
+
properties: ['currentStep', 'visitedNodes', 'phoneNumber', 'links', 'accountActive', 'questionnaireDepth', 'providers', 'outcome', 'formError', 'canSelfBook', 'bookingUrl', 'siteSource'],
|
|
48
48
|
events: {
|
|
49
49
|
send: ['answerQuestion', 'submitContactInfo', 'goBack', 'setUtmParams', 'submitVerification', 'resendCode']
|
|
50
50
|
},
|
|
@@ -79,7 +79,7 @@ export class QuestionnaireElement extends LitElement {
|
|
|
79
79
|
@state() outcome: string;
|
|
80
80
|
|
|
81
81
|
@state()
|
|
82
|
-
|
|
82
|
+
formError: string | null = null;
|
|
83
83
|
|
|
84
84
|
@state()
|
|
85
85
|
canSelfBook: boolean = false;
|
|
@@ -124,6 +124,12 @@ export class QuestionnaireElement extends LitElement {
|
|
|
124
124
|
@query('#insurance_provider')
|
|
125
125
|
insuranceProviderSelect: HTMLSelectElement| undefined;
|
|
126
126
|
|
|
127
|
+
@query('#insurance_notes')
|
|
128
|
+
insuranceNotesInput: HTMLTextAreaElement | undefined;
|
|
129
|
+
|
|
130
|
+
@state()
|
|
131
|
+
showInsuranceNotes: boolean = false;
|
|
132
|
+
|
|
127
133
|
@query('#verification_code')
|
|
128
134
|
verificationCodeInput: HTMLInputElement | undefined;
|
|
129
135
|
|
|
@@ -214,6 +220,10 @@ export class QuestionnaireElement extends LitElement {
|
|
|
214
220
|
if (this.outcome) {
|
|
215
221
|
this.trackQuestionnaireCompletion();
|
|
216
222
|
}
|
|
223
|
+
|
|
224
|
+
if (this.providers && !this.insuranceProviderSelect) {
|
|
225
|
+
this.showInsuranceNotes = this.isOtherInsurance(this.providers[0]);
|
|
226
|
+
}
|
|
217
227
|
}
|
|
218
228
|
|
|
219
229
|
render() {
|
|
@@ -266,15 +276,20 @@ export class QuestionnaireElement extends LitElement {
|
|
|
266
276
|
<h1>${this.siteSource ? `${this.siteSource} can help.` : 'We think we can help.'}</h1>
|
|
267
277
|
<h2>${(this.currentStep as ContactInfo).text}</h2>
|
|
268
278
|
</div>
|
|
279
|
+
${this.formError ? html`<div class="error">${this.formError}</div>` : ''}
|
|
269
280
|
<form @submit=${this.submitContactInfo}>
|
|
270
281
|
<div class="form">
|
|
271
282
|
<div class="u-margin--top">
|
|
272
283
|
<label for="name">First Name</label>
|
|
273
|
-
<input type="text" id="first_name" name="first_name" required
|
|
284
|
+
<input type="text" id="first_name" name="first_name" required
|
|
285
|
+
minlength="2"
|
|
286
|
+
title="Please enter at least 2 characters"/>
|
|
274
287
|
</div>
|
|
275
288
|
<div class="u-margin--top">
|
|
276
289
|
<label for="name">Last Name</label>
|
|
277
|
-
<input type="text" id="last_name" name="last_name" required
|
|
290
|
+
<input type="text" id="last_name" name="last_name" required
|
|
291
|
+
minlength="2"
|
|
292
|
+
title="Please enter at least 2 characters"/>
|
|
278
293
|
</div>
|
|
279
294
|
<div>
|
|
280
295
|
<label for="email">Email</label>
|
|
@@ -283,8 +298,8 @@ export class QuestionnaireElement extends LitElement {
|
|
|
283
298
|
<div>
|
|
284
299
|
<label for="phone">Phone</label>
|
|
285
300
|
<input type="tel" id="phone" name="phone" required
|
|
286
|
-
pattern="^[0-9]{
|
|
287
|
-
title="Please enter a valid phone number (
|
|
301
|
+
pattern="^[0-9]{9,10}$"
|
|
302
|
+
title="Please enter a valid phone number (9-10 digits)"/>
|
|
288
303
|
</div>
|
|
289
304
|
<div>
|
|
290
305
|
<label for="zip_code">Zip Code</label>
|
|
@@ -294,12 +309,18 @@ export class QuestionnaireElement extends LitElement {
|
|
|
294
309
|
</div>
|
|
295
310
|
<div>
|
|
296
311
|
<label for="insurance_provider">Insurance Provider</label>
|
|
297
|
-
<select id="insurance_provider" name="insurance_provider">
|
|
312
|
+
<select id="insurance_provider" name="insurance_provider" @change=${this.handleInsuranceChange}>
|
|
298
313
|
${this.providers.map(provider => html`
|
|
299
314
|
<option value="${provider}">${provider}</option>
|
|
300
315
|
`)}
|
|
301
316
|
</select>
|
|
302
317
|
</div>
|
|
318
|
+
${this.showInsuranceNotes ? html`
|
|
319
|
+
<div>
|
|
320
|
+
<label for="insurance_notes">Insurance Information</label>
|
|
321
|
+
<input type="text" id="insurance_notes" name="insurance_notes" />
|
|
322
|
+
</div>
|
|
323
|
+
` : ''}
|
|
303
324
|
</div>
|
|
304
325
|
<div class="footer u-text-center">
|
|
305
326
|
<button class="button button--primary u-push-top" type="submit">Get Assessment</button>
|
|
@@ -332,7 +353,7 @@ export class QuestionnaireElement extends LitElement {
|
|
|
332
353
|
<input type="text" id="verification_code" name="verification_code" required
|
|
333
354
|
pattern="^[a-zA-Z0-9]+$"
|
|
334
355
|
title="Please enter the verification code" />
|
|
335
|
-
${this.
|
|
356
|
+
${this.formError ? html`<div class="error">${this.formError}</div>` : ''}
|
|
336
357
|
</div>
|
|
337
358
|
</div>
|
|
338
359
|
<div class="footer u-text-center">
|
|
@@ -414,10 +435,24 @@ export class QuestionnaireElement extends LitElement {
|
|
|
414
435
|
}));
|
|
415
436
|
}
|
|
416
437
|
|
|
438
|
+
isOtherInsurance(value: string): boolean {
|
|
439
|
+
return value?.toLowerCase() === 'other';
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
handleInsuranceChange(event: Event) {
|
|
443
|
+
const select = event.target as HTMLSelectElement;
|
|
444
|
+
this.showInsuranceNotes = this.isOtherInsurance(select.value);
|
|
445
|
+
if (!this.showInsuranceNotes && this.insuranceNotesInput) {
|
|
446
|
+
this.insuranceNotesInput.value = '';
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
417
450
|
submitContactInfo(event: Event) {
|
|
418
451
|
event.stopPropagation();
|
|
419
452
|
event.preventDefault();
|
|
420
453
|
|
|
454
|
+
this.formError = null;
|
|
455
|
+
|
|
421
456
|
if (this.contactInfoForm?.checkValidity()) {
|
|
422
457
|
const email = this.emailInput?.value;
|
|
423
458
|
|
|
@@ -433,7 +468,8 @@ export class QuestionnaireElement extends LitElement {
|
|
|
433
468
|
email: email,
|
|
434
469
|
zip_code: this.zipCodeInput?.value,
|
|
435
470
|
phone_number: this.phoneInput?.value,
|
|
436
|
-
insurance_provider: this.insuranceProviderSelect.value
|
|
471
|
+
insurance_provider: this.insuranceProviderSelect.value,
|
|
472
|
+
insurance_notes: this.insuranceNotesInput?.value
|
|
437
473
|
};
|
|
438
474
|
|
|
439
475
|
window['dataLayer'] = window['dataLayer'] || [];
|
|
@@ -454,7 +490,7 @@ export class QuestionnaireElement extends LitElement {
|
|
|
454
490
|
|
|
455
491
|
const code = this.verificationCodeInput?.value;
|
|
456
492
|
if (code) {
|
|
457
|
-
this.
|
|
493
|
+
this.formError = null;
|
|
458
494
|
// Extract node_id from verification id (format: "verification_nodeId")
|
|
459
495
|
const nodeId = this.currentStep?.id.replace('verification_', '');
|
|
460
496
|
this.dispatchEvent(new CustomEvent('submitVerification', {
|
package/package.json
CHANGED
|
@@ -120,7 +120,7 @@ describe('questionnaire test', async () => {
|
|
|
120
120
|
text: "Please enter the verification code we sent to your phone.",
|
|
121
121
|
phoneNumber: "555-123-4567"
|
|
122
122
|
} as Verification;
|
|
123
|
-
questionnaireElement.
|
|
123
|
+
questionnaireElement.formError = "Invalid verification code";
|
|
124
124
|
questionnaireElement.links = {
|
|
125
125
|
contact_info_image: '/images/contact.jpg'
|
|
126
126
|
};
|