pr360-questionnaire 2.3.5 → 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 +45 -12
- package/dist/index.js +44 -11
- package/js/questionnaire.ts +46 -10
- package/package.json +1 -1
- package/test/questionnaire-test.ts +1 -1
|
@@ -17370,9 +17370,10 @@ meter::-webkit-meter-optimum-value {
|
|
|
17370
17370
|
super(...arguments);
|
|
17371
17371
|
this.accountActive = true;
|
|
17372
17372
|
this.visitedNodes = [];
|
|
17373
|
-
this.
|
|
17373
|
+
this.formError = null;
|
|
17374
17374
|
this.canSelfBook = false;
|
|
17375
17375
|
this.hubspotId = "40834387";
|
|
17376
|
+
this.showInsuranceNotes = false;
|
|
17376
17377
|
}
|
|
17377
17378
|
get topic() {
|
|
17378
17379
|
return `questionnaires:${this.siteId}`;
|
|
@@ -17439,6 +17440,9 @@ meter::-webkit-meter-optimum-value {
|
|
|
17439
17440
|
if (this.outcome) {
|
|
17440
17441
|
this.trackQuestionnaireCompletion();
|
|
17441
17442
|
}
|
|
17443
|
+
if (this.providers && !this.insuranceProviderSelect) {
|
|
17444
|
+
this.showInsuranceNotes = this.isOtherInsurance(this.providers[0]);
|
|
17445
|
+
}
|
|
17442
17446
|
}
|
|
17443
17447
|
render() {
|
|
17444
17448
|
return x`
|
|
@@ -17489,15 +17493,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
17489
17493
|
<h1>${this.siteSource ? `${this.siteSource} can help.` : "We think we can help."}</h1>
|
|
17490
17494
|
<h2>${this.currentStep.text}</h2>
|
|
17491
17495
|
</div>
|
|
17496
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
17492
17497
|
<form @submit=${this.submitContactInfo}>
|
|
17493
17498
|
<div class="form">
|
|
17494
17499
|
<div class="u-margin--top">
|
|
17495
17500
|
<label for="name">First Name</label>
|
|
17496
|
-
<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"/>
|
|
17497
17504
|
</div>
|
|
17498
17505
|
<div class="u-margin--top">
|
|
17499
17506
|
<label for="name">Last Name</label>
|
|
17500
|
-
<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"/>
|
|
17501
17510
|
</div>
|
|
17502
17511
|
<div>
|
|
17503
17512
|
<label for="email">Email</label>
|
|
@@ -17506,8 +17515,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
17506
17515
|
<div>
|
|
17507
17516
|
<label for="phone">Phone</label>
|
|
17508
17517
|
<input type="tel" id="phone" name="phone" required
|
|
17509
|
-
pattern="^[0-9]{
|
|
17510
|
-
title="Please enter a valid phone number (
|
|
17518
|
+
pattern="^[0-9]{9,10}$"
|
|
17519
|
+
title="Please enter a valid phone number (9-10 digits)"/>
|
|
17511
17520
|
</div>
|
|
17512
17521
|
<div>
|
|
17513
17522
|
<label for="zip_code">Zip Code</label>
|
|
@@ -17517,12 +17526,18 @@ meter::-webkit-meter-optimum-value {
|
|
|
17517
17526
|
</div>
|
|
17518
17527
|
<div>
|
|
17519
17528
|
<label for="insurance_provider">Insurance Provider</label>
|
|
17520
|
-
<select id="insurance_provider" name="insurance_provider">
|
|
17529
|
+
<select id="insurance_provider" name="insurance_provider" @change=${this.handleInsuranceChange}>
|
|
17521
17530
|
${this.providers.map((provider) => x`
|
|
17522
17531
|
<option value="${provider}">${provider}</option>
|
|
17523
17532
|
`)}
|
|
17524
17533
|
</select>
|
|
17525
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
|
+
` : ""}
|
|
17526
17541
|
</div>
|
|
17527
17542
|
<div class="footer u-text-center">
|
|
17528
17543
|
<button class="button button--primary u-push-top" type="submit">Get Assessment</button>
|
|
@@ -17554,7 +17569,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17554
17569
|
<input type="text" id="verification_code" name="verification_code" required
|
|
17555
17570
|
pattern="^[a-zA-Z0-9]+$"
|
|
17556
17571
|
title="Please enter the verification code" />
|
|
17557
|
-
${this.
|
|
17572
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
17558
17573
|
</div>
|
|
17559
17574
|
</div>
|
|
17560
17575
|
<div class="footer u-text-center">
|
|
@@ -17627,9 +17642,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
17627
17642
|
}
|
|
17628
17643
|
}));
|
|
17629
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
|
+
}
|
|
17630
17655
|
submitContactInfo(event) {
|
|
17631
17656
|
event.stopPropagation();
|
|
17632
17657
|
event.preventDefault();
|
|
17658
|
+
this.formError = null;
|
|
17633
17659
|
if (this.contactInfoForm?.checkValidity()) {
|
|
17634
17660
|
const email = this.emailInput?.value;
|
|
17635
17661
|
const hsq = window["_hsq"] = window["_hsq"] || [];
|
|
@@ -17643,7 +17669,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
17643
17669
|
email,
|
|
17644
17670
|
zip_code: this.zipCodeInput?.value,
|
|
17645
17671
|
phone_number: this.phoneInput?.value,
|
|
17646
|
-
insurance_provider: this.insuranceProviderSelect.value
|
|
17672
|
+
insurance_provider: this.insuranceProviderSelect.value,
|
|
17673
|
+
insurance_notes: this.insuranceNotesInput?.value
|
|
17647
17674
|
};
|
|
17648
17675
|
window["dataLayer"] = window["dataLayer"] || [];
|
|
17649
17676
|
window["dataLayer"].push({
|
|
@@ -17660,7 +17687,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17660
17687
|
event.preventDefault();
|
|
17661
17688
|
const code = this.verificationCodeInput?.value;
|
|
17662
17689
|
if (code) {
|
|
17663
|
-
this.
|
|
17690
|
+
this.formError = null;
|
|
17664
17691
|
const nodeId = this.currentStep?.id.replace("verification_", "");
|
|
17665
17692
|
this.dispatchEvent(new CustomEvent("submitVerification", {
|
|
17666
17693
|
detail: { verificationCode: code, nodeId }
|
|
@@ -17703,7 +17730,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17703
17730
|
], QuestionnaireElement.prototype, "outcome", 2);
|
|
17704
17731
|
__decorateClass([
|
|
17705
17732
|
t3()
|
|
17706
|
-
], QuestionnaireElement.prototype, "
|
|
17733
|
+
], QuestionnaireElement.prototype, "formError", 2);
|
|
17707
17734
|
__decorateClass([
|
|
17708
17735
|
t3()
|
|
17709
17736
|
], QuestionnaireElement.prototype, "canSelfBook", 2);
|
|
@@ -17747,6 +17774,12 @@ meter::-webkit-meter-optimum-value {
|
|
|
17747
17774
|
__decorateClass([
|
|
17748
17775
|
i4("#insurance_provider")
|
|
17749
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);
|
|
17750
17783
|
__decorateClass([
|
|
17751
17784
|
i4("#verification_code")
|
|
17752
17785
|
], QuestionnaireElement.prototype, "verificationCodeInput", 2);
|
|
@@ -17762,7 +17795,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
17762
17795
|
QuestionnaireElement = __decorateClass([
|
|
17763
17796
|
e4("pr360-questionnaire"),
|
|
17764
17797
|
liveStateDecorator_default({
|
|
17765
|
-
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "
|
|
17798
|
+
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "formError", "canSelfBook", "bookingUrl", "siteSource"],
|
|
17766
17799
|
events: {
|
|
17767
17800
|
send: ["answerQuestion", "submitContactInfo", "goBack", "setUtmParams", "submitVerification", "resendCode"]
|
|
17768
17801
|
},
|
|
@@ -32225,7 +32258,7 @@ ${inspect(response)}
|
|
|
32225
32258
|
text: "Please enter the verification code we sent to your phone.",
|
|
32226
32259
|
phoneNumber: "555-123-4567"
|
|
32227
32260
|
};
|
|
32228
|
-
questionnaireElement.
|
|
32261
|
+
questionnaireElement.formError = "Invalid verification code";
|
|
32229
32262
|
questionnaireElement.links = {
|
|
32230
32263
|
contact_info_image: "/images/contact.jpg"
|
|
32231
32264
|
};
|
package/dist/index.js
CHANGED
|
@@ -7559,9 +7559,10 @@ meter::-webkit-meter-optimum-value {
|
|
|
7559
7559
|
super(...arguments);
|
|
7560
7560
|
this.accountActive = true;
|
|
7561
7561
|
this.visitedNodes = [];
|
|
7562
|
-
this.
|
|
7562
|
+
this.formError = null;
|
|
7563
7563
|
this.canSelfBook = false;
|
|
7564
7564
|
this.hubspotId = "40834387";
|
|
7565
|
+
this.showInsuranceNotes = false;
|
|
7565
7566
|
}
|
|
7566
7567
|
get topic() {
|
|
7567
7568
|
return `questionnaires:${this.siteId}`;
|
|
@@ -7628,6 +7629,9 @@ meter::-webkit-meter-optimum-value {
|
|
|
7628
7629
|
if (this.outcome) {
|
|
7629
7630
|
this.trackQuestionnaireCompletion();
|
|
7630
7631
|
}
|
|
7632
|
+
if (this.providers && !this.insuranceProviderSelect) {
|
|
7633
|
+
this.showInsuranceNotes = this.isOtherInsurance(this.providers[0]);
|
|
7634
|
+
}
|
|
7631
7635
|
}
|
|
7632
7636
|
render() {
|
|
7633
7637
|
return x`
|
|
@@ -7678,15 +7682,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
7678
7682
|
<h1>${this.siteSource ? `${this.siteSource} can help.` : "We think we can help."}</h1>
|
|
7679
7683
|
<h2>${this.currentStep.text}</h2>
|
|
7680
7684
|
</div>
|
|
7685
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
7681
7686
|
<form @submit=${this.submitContactInfo}>
|
|
7682
7687
|
<div class="form">
|
|
7683
7688
|
<div class="u-margin--top">
|
|
7684
7689
|
<label for="name">First Name</label>
|
|
7685
|
-
<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"/>
|
|
7686
7693
|
</div>
|
|
7687
7694
|
<div class="u-margin--top">
|
|
7688
7695
|
<label for="name">Last Name</label>
|
|
7689
|
-
<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"/>
|
|
7690
7699
|
</div>
|
|
7691
7700
|
<div>
|
|
7692
7701
|
<label for="email">Email</label>
|
|
@@ -7695,8 +7704,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
7695
7704
|
<div>
|
|
7696
7705
|
<label for="phone">Phone</label>
|
|
7697
7706
|
<input type="tel" id="phone" name="phone" required
|
|
7698
|
-
pattern="^[0-9]{
|
|
7699
|
-
title="Please enter a valid phone number (
|
|
7707
|
+
pattern="^[0-9]{9,10}$"
|
|
7708
|
+
title="Please enter a valid phone number (9-10 digits)"/>
|
|
7700
7709
|
</div>
|
|
7701
7710
|
<div>
|
|
7702
7711
|
<label for="zip_code">Zip Code</label>
|
|
@@ -7706,12 +7715,18 @@ meter::-webkit-meter-optimum-value {
|
|
|
7706
7715
|
</div>
|
|
7707
7716
|
<div>
|
|
7708
7717
|
<label for="insurance_provider">Insurance Provider</label>
|
|
7709
|
-
<select id="insurance_provider" name="insurance_provider">
|
|
7718
|
+
<select id="insurance_provider" name="insurance_provider" @change=${this.handleInsuranceChange}>
|
|
7710
7719
|
${this.providers.map((provider) => x`
|
|
7711
7720
|
<option value="${provider}">${provider}</option>
|
|
7712
7721
|
`)}
|
|
7713
7722
|
</select>
|
|
7714
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
|
+
` : ""}
|
|
7715
7730
|
</div>
|
|
7716
7731
|
<div class="footer u-text-center">
|
|
7717
7732
|
<button class="button button--primary u-push-top" type="submit">Get Assessment</button>
|
|
@@ -7743,7 +7758,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7743
7758
|
<input type="text" id="verification_code" name="verification_code" required
|
|
7744
7759
|
pattern="^[a-zA-Z0-9]+$"
|
|
7745
7760
|
title="Please enter the verification code" />
|
|
7746
|
-
${this.
|
|
7761
|
+
${this.formError ? x`<div class="error">${this.formError}</div>` : ""}
|
|
7747
7762
|
</div>
|
|
7748
7763
|
</div>
|
|
7749
7764
|
<div class="footer u-text-center">
|
|
@@ -7816,9 +7831,20 @@ meter::-webkit-meter-optimum-value {
|
|
|
7816
7831
|
}
|
|
7817
7832
|
}));
|
|
7818
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
|
+
}
|
|
7819
7844
|
submitContactInfo(event) {
|
|
7820
7845
|
event.stopPropagation();
|
|
7821
7846
|
event.preventDefault();
|
|
7847
|
+
this.formError = null;
|
|
7822
7848
|
if (this.contactInfoForm?.checkValidity()) {
|
|
7823
7849
|
const email = this.emailInput?.value;
|
|
7824
7850
|
const hsq = window["_hsq"] = window["_hsq"] || [];
|
|
@@ -7832,7 +7858,8 @@ meter::-webkit-meter-optimum-value {
|
|
|
7832
7858
|
email,
|
|
7833
7859
|
zip_code: this.zipCodeInput?.value,
|
|
7834
7860
|
phone_number: this.phoneInput?.value,
|
|
7835
|
-
insurance_provider: this.insuranceProviderSelect.value
|
|
7861
|
+
insurance_provider: this.insuranceProviderSelect.value,
|
|
7862
|
+
insurance_notes: this.insuranceNotesInput?.value
|
|
7836
7863
|
};
|
|
7837
7864
|
window["dataLayer"] = window["dataLayer"] || [];
|
|
7838
7865
|
window["dataLayer"].push({
|
|
@@ -7849,7 +7876,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7849
7876
|
event.preventDefault();
|
|
7850
7877
|
const code = this.verificationCodeInput?.value;
|
|
7851
7878
|
if (code) {
|
|
7852
|
-
this.
|
|
7879
|
+
this.formError = null;
|
|
7853
7880
|
const nodeId = this.currentStep?.id.replace("verification_", "");
|
|
7854
7881
|
this.dispatchEvent(new CustomEvent("submitVerification", {
|
|
7855
7882
|
detail: { verificationCode: code, nodeId }
|
|
@@ -7892,7 +7919,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7892
7919
|
], QuestionnaireElement.prototype, "outcome", 2);
|
|
7893
7920
|
__decorateClass([
|
|
7894
7921
|
t3()
|
|
7895
|
-
], QuestionnaireElement.prototype, "
|
|
7922
|
+
], QuestionnaireElement.prototype, "formError", 2);
|
|
7896
7923
|
__decorateClass([
|
|
7897
7924
|
t3()
|
|
7898
7925
|
], QuestionnaireElement.prototype, "canSelfBook", 2);
|
|
@@ -7936,6 +7963,12 @@ meter::-webkit-meter-optimum-value {
|
|
|
7936
7963
|
__decorateClass([
|
|
7937
7964
|
i4("#insurance_provider")
|
|
7938
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);
|
|
7939
7972
|
__decorateClass([
|
|
7940
7973
|
i4("#verification_code")
|
|
7941
7974
|
], QuestionnaireElement.prototype, "verificationCodeInput", 2);
|
|
@@ -7951,7 +7984,7 @@ meter::-webkit-meter-optimum-value {
|
|
|
7951
7984
|
QuestionnaireElement = __decorateClass([
|
|
7952
7985
|
e4("pr360-questionnaire"),
|
|
7953
7986
|
liveStateDecorator_default({
|
|
7954
|
-
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "
|
|
7987
|
+
properties: ["currentStep", "visitedNodes", "phoneNumber", "links", "accountActive", "questionnaireDepth", "providers", "outcome", "formError", "canSelfBook", "bookingUrl", "siteSource"],
|
|
7955
7988
|
events: {
|
|
7956
7989
|
send: ["answerQuestion", "submitContactInfo", "goBack", "setUtmParams", "submitVerification", "resendCode"]
|
|
7957
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
|
};
|