By submitting this request, I am confirming the following:<\/p>
(1) Accuracy<\/strong>: the information I have provided is true and accurate; (2) TrustArc role<\/strong>: that I understand the service is provided by TrustArc on behalf of JVCKENWOOD USA Corporation and that once TrustArc provides my request to JVCKENWOOD USA Corporation, TrustArc will retain an encrypted record of my request; (3) Privacy<\/strong>: that I understand the information will be handled by TrustArc in accordance with its Privacy Policy<\/a> and by JVCKENWOOD USA Corporation in accordance with its\u0026nbsp;<\/a>Privacy Policy<\/u><\/a>; (4) Contact<\/strong>: that JVCKENWOOD USA Corporation has the right to contact me to verify my identity and to process this request.<\/p>
<\/p>","type":"checkbox"}}}};
const hiddenFields = [
"accountId",
"locale",
"authType",
"authResponse",
"formId",
"requestId",
"suppValidationId",
"sourceWebsite",
"ipAddress",
"gpcEnabled",
"captchaAnswer",
"captchaInput"
];
hiddenFields.forEach(function(hiddenField) {
jsonData.schema.properties[hiddenField] = {
type : "string",
};
jsonData.options.fields[hiddenField] = {
type : "hidden"
};
});
jsonData.schema.properties.accountId.default = "e28934e7-1bbd-42ad-8f18-39bf8fd81087";
jsonData.schema.properties.locale.default = locale;
jsonData.schema.properties.formId.default = formId;
jsonData.schema.properties.requestId.default = requestId;
jsonData.schema.properties.suppValidationId.default = suppValidationId;
jsonData.schema.properties.authResponse.default = 'no-token';
jsonData.schema.properties.authType.default = authType;
jsonData.schema.properties.sourceWebsite.default = sourceWebsite;
jsonData.schema.properties.ipAddress.default = ipAddress;
jsonData.schema.properties.gpcEnabled.default = gpcEnabled;
jsonData.schema.properties.captchaAnswer.default = '';
jsonData.schema.properties.captchaInput.default = '';
jsonData.options.form.buttons.submit.click = initSubmit;
if( jsonData.view.layout && jsonData.view.layout.bindings ) {
jsonData.view.layout.bindings.accountId = 'column-1';
jsonData.view.layout.bindings.locale = 'column-1';
jsonData.view.layout.bindings.formId = 'column-1';
jsonData.view.layout.bindings.requestId = 'column-1';
jsonData.view.layout.bindings.suppValidationId = 'column-1';
jsonData.view.layout.bindings.authResponse = 'column-1';
jsonData.view.layout.bindings.authType = 'column-1';
jsonData.view.layout.bindings.sourceWebsite = 'column-1';
jsonData.view.layout.bindings.ipAddress = 'column-1';
jsonData.view.layout.bindings.gpcEnabled = 'column-1';
jsonData.view.layout.bindings.captchaAnswer = 'column-1';
jsonData.view.layout.bindings.captchaInput = 'column-1';
}
jsonData.postRender = postRenderer;
if(jsonData.view.layout && jsonData.view.layout.template){
jsonData.view.layout.template = appendBuildVersionQueryParam(jsonData.view.layout.template);
}
if(jsonData.view.fields){
for (var fieldKey in jsonData.view.fields){
var field = jsonData.view.fields[fieldKey];
if(field && field.templates){
for (var templateKey in field.templates){
var template = field.templates[templateKey];
field.templates[templateKey] = appendBuildVersionQueryParam(template);
}
}
}
}
jsonData.view.locale = locale;
jsonData.view.messages[locale] = {
"invalidEmail": jsonData.view.messages.invalidEmail
}
// Buttons doesn't work
if (noSubmit) {
for (var button in jsonData.options.form.buttons) {
jsonData.options.form.buttons[button].click = function() {
window.alert("Test Mode");
return;
}
}
}
// Date Locales
for (var keyId in jsonData.schema.properties) {
var schemaProps = jsonData.schema.properties[keyId];
var optionProps = jsonData.options.fields[keyId];
if (schemaProps.format === 'date') {
if (!("picker" in optionProps)) {
optionProps.picker = {};
}
optionProps.picker.locale = locale;
}
}
if(!jsonData.options.header.showCompanyName){
jsonData.schema.title = null;
}
//Disable autofocus on the first input field
jsonData.options.focus = "";
$("#form1").alpaca(jsonData);
}
function submitMethod(alpaca) {
const formData = alpaca.getValue();
if(GOOGLE_RECAPTCHA_V3_ENABLED){
grecaptcha.ready(function () {
grecaptcha.execute("6LdSn6gUAAAAAKZ5SiEQ8PdCUOgV9sf1ei4utXrB", {action: 'homepage'}).then(function (token) {
console.log("Google Token: " + token);
formData.authResponse = token;
alpaca.form.find("textarea.g-recaptcha-response").prop('disabled', true);
if(TRUSTARC_CAPTCHA_ENABLED){
submitTrustArcCaptcha(alpaca, formData);
}else{
submit(alpaca, formData);
}
});
});
}else if(TRUSTARC_CAPTCHA_ENABLED){
submitTrustArcCaptcha(alpaca, formData);
}else if (authType === 'TRUSTARC') {
formData.authResponse = trustarc.__token;
Object.keys(trustarc.__data).forEach(function(key) {
let value = trustarc.__data[key];
if (key && value) {
if (!(key in formData) && alpaca.isValid(true)) {
var input = $('')
input.val(value);
alpaca.getFormEl().append(input);
}
formData[key] = value;
}
});
submit(alpaca, formData);
}
}
function submitTrustArcCaptcha(alpaca, formData){
formData.captchaAnswer = captchaAnswer;
formData.captchaInput = captchaInput;
submit(alpaca, formData);
}
function submit(alpaca, formData){
alpaca.setValue(formData);
//postmessage submit
parentPostMessage(alpaca, {
source: "trustarc_irm",
message: "submit",
data: ""
});
disableSubmitButton();
alpaca.submit();
}
function parentPostMessage(alpaca, data) {
var requestType = nullSafeGet(['00000000-0000-0000-0000-000000001005'], alpaca.getValue());
var ccmEnabled = nullSafeGet(['options', 'fields', '00000000-0000-0000-0000-000000001005', 'ccmEnabledOptions', requestType, 'enabled'], alpaca.topControl);
if (ccmEnabled === true || isGPCEnabled()) {
window.parent.postMessage(JSON.stringify(data), '*');
}
}
var isModalConfirmInit = false;
function initModal(alpaca){
if (!isModalConfirmInit) {
$("#modal-btn-confirm").on("click", function(){
submitMethod(alpaca);
$("#mi-modal").modal('hide');
});
$("#modal-btn-cancel").on("click", function(){
// Enable all upload File Hidden Field again after cancel
updateFileUploadState(false);
$("#mi-modal").modal('hide');
});
$(".close").on("click", function(){
// Enable all upload File Hidden Field again after cancel
updateFileUploadState(false);
});
isModalConfirmInit = true;
}
$("#mi-modal").modal('show');
//TODO: Find better way for late binding
var confirmLabel = nullSafeGet(['00000000-0000-0000-0000-000000001005'], alpaca.getValue());
var confirmMessage = nullSafeGet(['options', 'fields', '00000000-0000-0000-0000-000000001005', 'confirmMessages', confirmLabel, 'message'], alpaca.topControl);
var requestTypeLabel = nullSafeGet(['options', 'fields', '00000000-0000-0000-0000-000000001005', 'confirmMessages', confirmLabel, 'requestTypeLabel'], alpaca.topControl);
confirmMessage = confirmMessage.replace('\[\[\$\{requestType\}\]\]', requestTypeLabel);
$("#confirmMessage").html(confirmMessage);
}
function initSubmit(event, alpacaForm) {
var alpaca = !alpacaForm ? this : alpacaForm;
// Disable all upload File Hidden Field, so it wont be sent on submit
updateFileUploadState(true);
if (hasConfirm(alpaca)) {
initModal(alpaca);
} else {
submitMethod(alpaca);
}
}
function updateFileUploadState(disabled) {
document.querySelectorAll(".uploadFileHiddenField").forEach(function(item) {
item.disabled = disabled;
});
document.querySelectorAll(".uploadFileField").forEach(function(item) {
if (item.parentElement.classList.contains("disabled")) {
item.disabled = disabled;
}
});
}
function hasConfirm(alpaca) {
var conLabels = nullSafeGet(['options', 'fields', '00000000-0000-0000-0000-000000001005', 'confirmLabels'], alpaca.topControl);
var reqValue = nullSafeGet(['00000000-0000-0000-0000-000000001005'], alpaca.getValue());
if (conLabels && conLabels.includes(reqValue)) {
var reqIds = nullSafeGet(['schema', 'properties', '00000000-0000-0000-0000-000000001005', 'enum'], alpaca.topControl);
var reqVals = nullSafeGet(['options', 'fields', '00000000-0000-0000-0000-000000001005', 'optionLabels'], alpaca.topControl);
if (reqIds && reqVals && reqIds.length == reqVals.length) {
var reqIndex = reqIds.indexOf(reqValue);
if (reqIndex != -1) {
$('#requestTypeName').html(reqVals[reqIndex]);
return true;
}
}
}
return false;
}
let initForm = true;
let isCaptchaCorrect = false;
const CAPTCHA_ANSWER_LENGTH = 5;
let captchaAnswer;
let captchaInput;
const hideTrustArcCaptcha = function(){
if(!TRUSTARC_CAPTCHA_ENABLED){
return;
}
$('#captcha-container').hide();
}
const showTrustArcCaptcha = function(){
if(!TRUSTARC_CAPTCHA_ENABLED){
return;
}
$('#captcha-container').show();
}
const refreshTrustArcCaptcha = function(manualRefresh){
if(!TRUSTARC_CAPTCHA_ENABLED){
return;
}
const captchaInputField = $("#captcha-input");
const captchaRefresh = $('#captcha-refresh');
const captchaRefreshSection = $('#captcha-refresh-section');
captchaRefresh.prop('disabled', true);
captchaRefresh.css('cursor', 'not-allowed');
captchaRefreshSection.invisible();
captchaInputField.val('');
captchaInputField.prop('disabled', true);
$.getJSON("/services/validation/api/v1/captcha", function(captcha) {
captchaAnswer = captcha.answer;
$("#captcha-image").attr("src", captcha.image);
changeTrustArcCaptchaAudio(captcha.audio);
captchaRefresh.prop('disabled', false);
captchaRefresh.css('cursor', 'pointer');
captchaInputField.prop('disabled', false);
captchaRefreshSection.visible();
if(manualRefresh){
captchaInputField.focus();
}
}).fail(function(error) {
alert('Failed to load captcha!');
console.log( "[get captcha] error", error);
});
}
const changeTrustArcCaptchaAudio = function (sourceUrl) {
if(!TRUSTARC_CAPTCHA_ENABLED){
return;
}
const audio = $("#captcha-audio");
$("#captcha-audio-source").attr("src", sourceUrl);
audio[0].pause();
audio[0].load();
}
function postRenderer(control) {
$('.alpaca-required-indicator').html((''));
//WCAG 2 Compliance
var count=1;
$('#form1 a').each(function(){
var newId = 'tr-a-link-' + count++;
var label = $("