"use strict"; var BYD_Constants = { ValidationEndpointURL : 'https://validation.beyondcrm.com.au/api/{0}', ValidationClientId : 'FA701BEF-ABF2-E811-A972-000D3AD0ABFE', ValidationDefaultSettings : '{"showCountry": false, "ResultLimit": 100, "RetrieveGeoCoding": false}', __namespace: true } "use strict"; var BYD; (function (BYD) { var ValidationClient; (function (ValidationClient) { function SetAddressValue(output, crmField, addressField) { let value = output[addressField]; if (value === undefined || value === null) value = ""; BYD.ValidationClient.SetValue(value, crmField, "string"); } ValidationClient.SetAddressValue = SetAddressValue; function SetValue(value, crmField, datatype) { setFieldValue(value, crmField, datatype); } ValidationClient.SetValue = SetValue; function GetConfig() { var config = JSON.parse(BYD_Constants.ValidationDefaultSettings); var text = ValidationSettings; var specificConfig = JSON.parse(text); for (var val in specificConfig) { config[val] = specificConfig[val]; } config.ClientId = BYD_Constants.ValidationClientId; config.EndpointURL = BYD_Constants.ValidationEndpointURL; return config; } ValidationClient.GetConfig = GetConfig; function GetConfig2() { var config = JSON.parse(BYD_Constants.ValidationDefaultSettings); var text = ValidationSettingsAddress2; var specificConfig = JSON.parse(text); for (var val in specificConfig) { config[val] = specificConfig[val]; } config.ClientId = BYD_Constants.ValidationClientId; config.EndpointURL = BYD_Constants.ValidationEndpointURL; return config; } ValidationClient.GetConfig2 = GetConfig2; function RevertToManualAddress(config, isManual, e) { if (isManual) { BYD.ValidationClient.SetValue(false, config.resolvedAddressField, "boolean"); BYD.ValidationClient.SetValue(null, config.addressConfidenceField, "string"); BYD.ValidationClient.SetValue(null, config.addressMatchTypeField, "decimal"); } if (config.errorHandling.hideSection !== undefined && config.errorHandling.hideSection !== "") { showHideSection(config.errorHandling.hideSection, true); } if (config.errorHandling.showSection !== undefined && config.errorHandling.showSection !== "") { showHideSection(config.errorHandling.hideSection, false); } if (config.errorHandling.hideWebResource !== undefined && config.errorHandling.hideWebResource !== "") { } if (config.errorHandling.showWebResource !== undefined && config.errorHandling.showWebResource !== "") { } } ValidationClient.RevertToManualAddress = RevertToManualAddress; function showHideAddressSection(sectionName, show) { showHideSection(sectionName, show); } ValidationClient.showHideAddressSection = showHideAddressSection; function GetValue(fieldName, dataType) { return getFieldValue(fieldName, dataType); } ValidationClient.GetValue = GetValue; function SetDefaultValue(config) { var overrideAddress = false; if (config.overrideAddressField !== undefined && config.overrideAddressField !== "") overrideAddress = BYD.ValidationClient.GetValue(config.overrideAddressField, "boolean"); if (config.existingAddressFields !== undefined && config.existingAddressFields !== "" && (BYD.ValidationClient.GetValue(config.resolvedAddressField, "boolean") || overrideAddress)) { var address = []; config.existingAddressFields.split(",").forEach(function (value, index, arr) { var fieldValue = BYD.ValidationClient.GetValue(value, "string"); if (fieldValue !== "" && fieldValue !== null) { address.push(fieldValue); } }); $("#" + config.ui.data).val(address.join(", ")); } } ValidationClient.SetDefaultValue = SetDefaultValue; })(ValidationClient = BYD.ValidationClient || (BYD.ValidationClient = {})); })(BYD || (BYD = {})); //# sourceURL=validationAddressPortal.js