Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "wordpress-plugins/real-cookie-banner/src/public/ts/components/config/settings/countryBypass"

Index

Variables

Const SettingsFormCountryBypass

SettingsFormCountryBypass: FC<{}> = observer(() => {const { optionStore } = useStores();const {busyCountryBypassUpdate,others: { isPro, isLicensed, iso3166OneAlpha2, predefinedCountryBypassLists },countryBypass: countryBypassOption,countryBypassDbDownloadTime} = optionStore;const handleUpdateDatabase = useCallback(async () => {try {await optionStore.updateCountryBypassDatabase();message.success(__("You successfully updated the IP-to-Country database."));} catch (e) {message.error(e.responseJSON.message);throw e;}}, [optionStore]);const getLabelForPredefinedCountryList = useCallback((code: string) => {return __("Countries where %s applies", code);}, []);return (<><Form.Item label={__("Geo-restriction")} style={{ marginBottom: 10 }}><Form.Item name="countryBypass" noStyle><Radio.Group><Radio.Button disabled={!isPro || !isLicensed} value={true}>{__("Enabled")}</Radio.Button><Radio.Button disabled={!isPro || !isLicensed} value={false}>{__("Disabled")}</Radio.Button></Radio.Group></Form.Item>{isPro && !isLicensed && (<div className="notice notice-error inline below-h2 notice-alt" style={{ margin: "10px 0" }}><p>{__("This functionality is only available with a valid license, as the IP-to-Country database must be downloaded regularly from our cloud service.")}{" "}&bull; <a href="#/licensing">{__("Activate license")}</a></p></div>)}<div style={{ margin: "5px 0px 0px" }}><ProTagtitle={__("Enable geo-restriction?")}testDrivefeature="country-bypass"assetName={__("pro-modal/geo-restriction.png")}description={__("Cookie banners must be displayed only to visitors from certain countries. For example, visitors from the EU. With geo-restriction you can specify exactly who sees a cookie banner and who doesn't, by country.")}/></div><p className="description">{__(`With the geo-restrictions you can specify that the cookie banner should be displayed only for users from certain countries. In many countries (outside the EU) it is not necessary to display a cookie banner. The location of the user is determined by their IP address.`)}</p></Form.Item><Form.ItemnoStyleshouldUpdate={(prevValues, curValues) => prevValues.countryBypass !== curValues.countryBypass}>{({ getFieldValue }) => {const countryBypass = getFieldValue("countryBypass") as boolean;return (isPro &&countryBypass && (<><Form.ItemwrapperCol={{ offset: 6 }}name="countryBypassCheckboxTerms"valuePropName="checked"style={{ marginBottom: 15 }}rules={[{type: "boolean",required: true,transform: (value) => value || undefined,message: __("Please confirm that you have read this!")}]}><Checkbox disabled={countryBypassOption}>{_i(__("To determine the location of your website visitors, the MaxMind GeoLite2 database will be downloaded to your server and used from there. I have read and agree to the {{aMaxMindEndUserLicense}}MaxMind End User License Agreement{{/aMaxMindEndUserLicense}}. The download of the database is done via a devowl.io server and I agree to the {{aTerms}}terms and conditions{{/aTerms}} and {{aPrivacyPolicy}}privacy policy{{/aPrivacyPolicy}}."),{aMaxMindEndUserLicense: (<ahref={__("https://www.maxmind.com/en/end-user-license-agreement")}target="_blank"rel="noreferrer"/>),aTerms: (<ahref={__("https://devowl.io/terms/")}target="_blank"rel="noreferrer"/>),aPrivacyPolicy: (<ahref={__("https://devowl.io/privacy-policy/")}target="_blank"rel="noreferrer"/>)})}</Checkbox></Form.Item><Form.ItemwrapperCol={{ offset: 6 }}name="countryBypassCheckboxAccuracy"valuePropName="checked"style={{ marginBottom: 15 }}rules={[{type: "boolean",required: true,transform: (value) => value || undefined,message: __("Please confirm that you have read this!")}]}><Checkbox disabled={countryBypassOption}>{_i(__("I understand that this type of location determination is not accurate with one hundred percent certainty. According to {{a}}MaxMind's data{{/a}}, 99.6%% accuracy is estimated without obligation."),{a: (<ahref={__("https://www.maxmind.com/en/geoip2-city-accuracy-comparison")}target="_blank"rel="noreferrer"/>)})}</Checkbox></Form.Item><Form.Item label={__("Show banner only to users from these countries")}><Form.Item name="countryBypassCountries" noStyle><Selectmode="multiple"showSearchfilterOption={(input, { children }) =>children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>{Object.keys(predefinedCountryBypassLists).map((code) => {const label = getLabelForPredefinedCountryList(code);return (label && (<Select.Option value={code} key={code}>{label}</Select.Option>));})}{Object.keys(iso3166OneAlpha2).map((code) => (<Select.Option value={code} key={code}>{iso3166OneAlpha2[code]}</Select.Option>))}</Select></Form.Item><p className="description">{__("Determines for users from which countries you want to display a cookie banner. It is recommended to display cookie banners at least in the countries where the GDPR and CCPA apply. The list of countries can be extended at any time by the accession of new countries (Last update: April 2021).")}</p>{Object.keys(predefinedCountryBypassLists).map((code) => {const label = getLabelForPredefinedCountryList(code);return (label && (<p className="description" key={code}><strong>{label}: </strong>{predefinedCountryBypassLists[code].map((cc) => iso3166OneAlpha2[cc]).join(", ")}</p>));})}</Form.Item><Form.Itemlabel={__("Implicit consent for users from third countries")}style={{ marginBottom: 10 }}><Form.Item name="countryBypassType" noStyle><Radio.Group><Radio.Button value="all">{__("Accept all")}</Radio.Button><Radio.Button value="essentials">{__("Accept only essentials")}</Radio.Button></Radio.Group></Form.Item><p className="description">{__(`Set what consent should be implied when a visitor is not shown a cookie banner.`)}</p></Form.Item>{countryBypassOption && (<><Form.Item label={__("IP-to-Country database")}><Spin spinning={busyCountryBypassUpdate}><button type="button" className="button" onClick={handleUpdateDatabase}>{__("Update now")}</button></Spin>{countryBypassDbDownloadTime ? (<p style={{ margin: "10px 0 0 0" }}><strong>{__("You have downloaded the IP-to-Country database the last time on %s",new Date(countryBypassDbDownloadTime).toLocaleString(document.documentElement.lang))}</strong></p>) : (<divclassName="notice notice-error inline below-h2 notice-alt"style={{ margin: "10px 0 0 0" }}><p>{__("Something seems to have gone wrong when downloading the IP-to-Country database. Please check if your server has a firewall configured and is blocking the download accordingly, or contact our support!")}</p></div>)}<p className="description">{__("The IP-to-Country database contains a huge set of IP ranges where we can look up where the current user is coming from based on a specific IP address.")}</p></Form.Item></>)}</>));}}</Form.Item></>);})

Generated using TypeDoc