Skip to content

Commit

Permalink
Merge pull request #5335 from kiva/fix-invalid-form-in-MP-285
Browse files Browse the repository at this point in the history
fix: conflict between invalid inputs because of the variants and addi…
  • Loading branch information
christian14b authored May 30, 2024
2 parents 7928000 + 5e69622 commit a79a2d0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/components/Checkout/CheckoutDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
import _get from 'lodash/get';
import numeral from 'numeral';
import { validationMixin } from 'vuelidate';
import { required, email } from 'vuelidate/lib/validators';
import { required, email, requiredIf } from 'vuelidate/lib/validators';
import * as Sentry from '@sentry/vue';
import checkoutUtils from '@/plugins/checkout-utils-mixin';
Expand Down Expand Up @@ -195,7 +195,7 @@ export default {
isClientReady: false,
paymentTypes: ['paypal', 'card', 'applePay', 'googlePay'],
enableCommsExperiment: false,
selectedComms: '',
selectedComms: false,
enableRadioBtnExperiment: false,
};
},
Expand All @@ -204,8 +204,12 @@ export default {
required,
email,
},
termsAgreement: { required: value => value === true },
selectedComms: { required: value => value !== '' },
termsAgreement: {
required: value => value === true,
},
selectedComms: {
required: requiredIf(enableRadioBtnExperiment => enableRadioBtnExperiment),
},
},
mounted() {
this.isClientReady = !this.$isServer;
Expand Down Expand Up @@ -473,6 +477,10 @@ export default {
}
if (version === 'c') {
this.enableRadioBtnExperiment = true;
// Workaround to validate input within this experiment
this.selectedComms = '';
this.termsAgreement = true;
}
}
}
Expand Down
17 changes: 16 additions & 1 deletion src/components/Checkout/UserUpdatesPreference.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,26 @@
</p>
<p
v-if="selectedComms === '0'"
class="tw-border-brand-200 tw-border tw-bg-brand-100 tw-p-1 tw-rounded tw-text-small"
class="tw-border-brand-200 tw-border tw-bg-brand-100 tw-p-1 tw-rounded tw-text-small tw-mb-2"
>
Can we ask you to reconsider? This borrower and others like them will need your
help to change their lives. You can unsubscribe at any time.
</p>
<p class="tw-text-small">
By completing your loan, you agree to Kiva’s <a
:href="`https://${this.$appConfig.host}/legal/terms`"
target="_blank"
class="tw-underline"
title="Open Terms of Use in a new window"
>Terms of Use</a>
and
<a
:href="`https://${this.$appConfig.host}/legal/privacy`"
target="_blank"
class="tw-underline"
title="Open Privacy Policy in a new window"
>Privacy Policy</a>.
</p>
</div>
</template>

Expand Down
1 change: 1 addition & 0 deletions src/pages/LoginAndRegister/RegisterSocial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export default {
}
if (version === 'c') {
this.enableRadioBtnExperiment = true;
this.newAcctTerms = true;
}
}
},
Expand Down

0 comments on commit a79a2d0

Please sign in to comment.