Tech Focus: Tax, research and ICT

Mazars legal experts address R&D tax credits and the Knowledge Development Box for the Irish digital technology sector

Ireland has one of the highest concentrations of digital technology activity and employment within the OECD which is primarily due to a highly skilled workforce, high education standards, competitive corporate tax rates, political stability, geographic advantages, EU membership and a proven track record of business development 1. As a country, Ireland is emerging as a global technology hub. This sector is thriving, with exports and employment in both indigenous and multinational technology firms continuing to grow. In the last three years over 17,500 jobs have been announced by technology companies and the sector is responsible for 40% of our national exports (€72 billion per annum). The technology sector in Ireland directly employs over 105,000 people, with 75% employed in multinational companies and the remainder in the indigenous digital technology sector 2.

“To help offset the R&D cost to companies and to promote innovation and competitiveness, the R&D tax credit and the recent Knowledge Development Box are valuable tax resources which encourage companies to create new and improve existing products and processes and intellectual capital in Ireland”

Being a diverse and competitive sector, it has embraced a well-developed global supply chain model, comprising a number of very large players as well as smaller, agile, and technology intensive and innovative firms. With innovation in mind the R&D life cycle is relatively short, iterative and highly competitive and a close connection with the customer is an essential part of the process. The phenomenal increase in big data and mobility pose real challenges for the sector and cloud computing has been identified as the industry’s solution to manage these challenges through the standardisation and virtualisation of IT hardware and software assets, the simplification of data centre management software and the use of collaboration tools and unified communications 3.

 

advertisement

 

Offsetting
To help offset the R&D cost to companies and to promote innovation and competitiveness, the R&D tax credit and the recent Knowledge Development Box (KDB) are valuable tax resources which encourage companies to create new and improve existing products and processes and intellectual capital in Ireland. The incentive provides a 25% refundable tax credit on the qualifying R&D expenditure and in relation to the KDB, profits arising from patents, copyrighted software or IP equivalent to a patentable invention are taxed at 6.25% rather than the headline rate of 12.5%. In 2011, over 1,400 companies received the benefit of the R&D tax credit, 29% of which were in the Information and Communications Technology sector 4. It is expected that this percentage has since increased but the relevant data is not currently available.

It is important to note that the R&D tax credit has to be made in a field of science or technology and the OECD Frascati Manual states “for software development to be classified as R&D its completion must be dependent on the development of a scientific and / or technical advance and the aim of the project must be resolution of a scientific and / or technical uncertainty on a systematic basis” 5. However, just because the project is carried out using science or technology, it does not necessarily mean that the project will qualify for the credit. Revenue has stated that “software developments using known methodologies in standard development environments using the standard features and functions of existing tools would not typically advance technology and would not address or resolve technological uncertainty. Undertaking routine analysis, copying, upgrading or adaptation of an existing product, process, service or material would not be considered to be R&D activities. Therefore, much software development does not qualify as R&D activity” 6.

Qualify software development
So does this suggest that much software development does not qualify, the answer is no. Revenue recognises that there is a significant amount of ground-breaking software development taking place in Ireland across a range of sectors that is delivering real advances in science and/or technology and involves the resolution of scientific or technological uncertainty6. Therefore, in evaluating the technology from a computer science or information technology perspective, it is important to consider what the technological advancements and the associated technological uncertainties are rather than just the features and functionality of the technology. Take for example two identical applications with the same end functionality. If these applications are built with entirely different algorithms, architectures and developmental challenges, it may be a case that only one of the applications may qualify for R&D tax credit as the other may be developed entirely from known code and architecture, and thus does not qualify.

Not to deter away from the credit, many aspects of software and ICT development can qualify; these include preliminary scoping, prototyping, core build, testing, evolution, as well as integration with various platforms and operating systems7. Examples of such qualifying activities are presented in Table 1. However, it is important to note, that even if the project is not successful, the core principle of technological advancement and uncertainty may still exist, such that, the qualifying expense incurred may qualify for the credit. Although disappointing, the credit used from the unsuccessful project can be used to fund other projects in the business, thus potentially negating the need to raise further equity.

 

Table 1                      Examples of qualifying activities

Functional enhancements and new capabilities for existing applications, designed to create a competitive advantage Development of new, custom algorithms to better optimise performance of the software Conducting requirements, domain, software elements, or scope analysis for a new functional software enhancement
Establishing electronic interfaces and functional relationships between various software modules Application developments and integration to work in conjunction with and exiting in-house system Development of flexible, high-quality, and scalable rule engines to manage and automate complex business structures and models
Developing new operating systems or languages Programming software source code Improvements to security or data encryption
Development activities to better manage customer relationships through improved collection, storage, and analysis techniques Applications development which requires fundamental technical updates following software advances made by 3rd party software providers e.g. Facebook, Microsoft, SAP Aspects of video games development, such as increasingly realistic graphics, sound or playability or development of existing games to work on new platforms taking into account advances in the video game hardware
Developing wireless or telecom applications Specialised technologies, such as artificial intelligence or voice recognition applications Interactive software Creation of new encryption or security techniques that do not follow established methodologies
Testing of new solutions in the cloud Data tracking solutions Resolving certain conflicts within hardware or software
Establishing electronic interfaces and functional relationships between various software modules Integration of various individual components and functionality into a single streamlined system Intranet and Internet software in which scale and complexity present technological challenges

 

It is important for claimant companies to identify not only those developments that result from qualifying activity but also the phases of the software development life-cycle that are qualifying activity6. Qualifying activity must be systematic in nature as well as achieving advances. Revenue recognises that agile development methodologies such as Scrum and similar techniques, while not exhibiting the linear nature of a traditional software lifecycle, are systematic in nature6. Software development companies often utilise a number of industry-standard processes such as Waterfall or Agile. In relation to waterfall type development methodology, the scope of the project is easier to define with identifiable phases and as such is more suited to Revenues requirements. To meet the rapid response to change and continuous development, software development is increasingly headed toward an agile model in which software quickly comes to market and is then subject to continuous maintenance and improvement. Difficulties faced in qualifying for the credit is often (a) differentiating between the development required to meet user requirements, (b) the development required to resolve the start and finish of the technological uncertainty and (c) ensuring that the entire team understand the basic requirements of the R&D tax credits. With this in mind, the agile model blurs the boundaries of traditional software development stages and makes every stage a potential source of R&D expense. Below are common development stages and their R&D tax credit relevancy 7.

  • Preliminary Analysis: The phase includes initial scoping and defining of software requirements and feasibility. A great deal of technical uncertainty must be addressed by means of experimentation, examination of alternatives, and prototyping. Often, specific documents result from these activities, including a Systems Boundary Document, a Project Management Plan, and a Functional Requirements Document, all of which provide excellent R&D credit documentation 7.
  • Design and Development: With functionality requirements defined, the question becomes how to actually design the software. Whereas rote design elements and coding are not credit eligible, elements of the build which are new to the developer have credit eligibility. These might include a specific feature or needed integration with platforms and operating systems 7.
  • Testing: Testing determines how well the design meets the requirements outlined in the preliminary analysis. Errors are debugged, and the design is reconfigured or enhanced. Text Analysis Reports substantiate the R&D which occurs at this phase. By contrast, routine quality control testing of software would not be credit eligible 7.
  • Evolution: This phase is often the longest part of the development cycle and contains meaningful R&D credit elements. Particularly for agile development, beta versions of the software are subject to constant fixes, enhancements, iterations, and evolution 7.

However, it is important to note that documentation for the credit is required and can be recorded in a number of ways, such as:

  • Utilising accounting software to track staff time and costs taken on each project
  • Pre-project planning including emails and minutes of meetings
  • Documentation outlining both the design and functional requirements and design and architecture of the software system
  • Details of methodology used
  • Documenting sprint/scrum review meetings or reports throughout the lifecycle of the project
  • Source code and or source code repository check-ins to document R&D
  • Code defect notification and resolution reports
  • Identifying specific algorithms developed and the experimentation undertaken
  • Emails describing technical issues and or resolutions
  • Patent application or granted patent
  • Copyrighted software documentation
  • Details on personnel involved in the project
  • Notes of problems encountered
  • Detailed team discussions and reporting

 

On review, the R&D tax credit provides a provision for a tax credit for certain expenditure on R&D activities, equipment, plant and buildings. Salaries paid to employees who conduct qualified activities are generally the largest component of qualifying R&D expenses. The money paid to the staff performing the qualified R&D activities as well as project managers and personnel who directly support the R&D can qualify. The goal of the R&D tax credit is to encourage R&D investment by indigenous and foreign owned firms of all sizes alike by rewarding qualified research. This tax mechanism offsets against tax liability because the credits can help companies increase their cash flow and earnings per share, reduce their effective tax rate, hire more staff, develop new products, and finance other business objectives. In Ireland, the cost of the scheme to the exchequer was €421 million in 2013 8 and almost 1,400 companies, employing nearly 150,000 people, have availed of the incentive 9.

So, as long as companies are attempting to develop new and improved technologies or software, they could be eligible. While companies are beginning to plan for the coming year and beyond, there is no time like the present for R&D and financial professionals within the sector to evaluate whether they are taking full advantage of the R&D tax credit. From our experience there are 3 questions which are commonly asked;

  1. How does the credit work? The R&D credit works by providing a company with a credit calculated as 25% of qualifying R&D expenditure. In addition to the 12.5% trading deduction, this effectively means that the company can benefit from an effective tax benefit of 37.5% on their R&D spend.
  2. What are qualifying expenditures? This is expenditure incurred in developing processes which are systematic, investigative and experimental and as such qualify for the credit as set out by the guidelines issued by Revenue. Eligible expenditure includes direct and indirect costs so long as they are incurred in the carrying on of R&D in addition to capital expenditure on related plant and machinery. Basically, the company must be incurring expenditure on qualifying activities which are seeking to achieve a scientific or technological advancement through the resolution of a scientific or technological uncertainty in a 12-month accounting period.
  3. Why would a company claim the credit? Primarily, the principle gain to a company claiming the R&D tax credit is cash. This credit should not be undervalued or understated as cash is vital to the sustained health of any business. However, value can also be received for the R&D tax credit in a number of different ways, such as;
  4. Including offsetting the tax credit against Corporation Tax,
  5. As a refund by reference to payroll taxes and/or
  6. Corporation Tax paid or as a reward to key staff in a tax efficient manner.

The natural follow on from the R&D tax credit is the Knowledge Development Box (KDB), which was introduced by Finance Act 2015 for companies whose accounting period commences on or after 1st of January 2016. As previously outlined the KDB, it is a regime for the taxation of income which arises from patents (with comprehensive search reports), copyrighted software and, in relation to smaller companies, other intellectual property (IP) that is similar to an invention which could be patented. The official guidelines for this scheme was issued by Revenue in August 2016.

 

Authors:
Dr James Kennedy, manager, Research & Development Tax Credit Group, Mazars

James O’Hagan, tax consultant, Tax Credit Group, Mazars

Gerry Vahey, partner, Tax Credit Group, Mazars

 

References

  1. http://www.software.ie/Sectors/ISA/ISA.nsf/vPages/Knowledge~Sectoral_Knowledge~ireland—global-technology-hub/$file/The+Global+Technology+Hub+ICT+Ireland+ISA.pdf [Accessed 17 August 2016].
  2. http://www.ictireland.ie/Sectors/ICT/ICT.nsf/vPages/Papers_and_Sector_Data~sector-profile?OpenDocument [Accessed 17 August 2016].
  3. https://www.djei.ie/en/Publications/Publication-files/Forf%C3%A1s/Making-it-in-Ireland-Manufacturing-2020.pdf [Accessed 10 August 2016].
  4. Review of Irelands Research and Development (R&D) Tax Credit 2013, Page 38, Figure 13. Available from http://budget.gov.ie/Budgets/2014/Documents/Department%20of%20Finance%20Review%20of%20R&D%20Tax%20Credit%202013.pdf [Accessed 17 August 2016].
  5. Section 2.4.1 of the OECD Frascati Manual ‘Proposed Standard Practice for Surveys on Research and Experimental Development.
  6. http://www.revenue.ie/en/tax/ct/research-development.html [Accessed 10 August 2016].
  7. The R&D Tax Aspects of Software Development, Charles R Goulding, Charles G Goulding, and Rachelle Arum. Available from http://www.rdtaxsavers.com/articles/Software-Development [Accessed 16 August 2016]
  8. https://www.kildarestreet.com/wrans/?id=2016-01-28a.276 [Accessed 22 August 2016].
  9. http://www.irishtimes.com/business/just-15-firms-to-benefit-from-bulk-of-50m-tax-break-1.2084764 [Accessed 26 July 2016].

RELATED ARTICLES
#mc_embed_signup{background:#fff; false;clear:left; font:14px Helvetica,Arial,sans-serif; width: px;} /* Add your own Mailchimp form style overrides in your site stylesheet or in this style block. We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
Sign up for the
Technology Minute
(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='MMERGE2';ftypes[2]='text';fnames[3]='MMERGE3';ftypes[3]='text';fnames[4]='MMERGE4';ftypes[4]='text';fnames[5]='SIGNUP';ftypes[5]='text';fnames[6]='MMERGE6';ftypes[6]='imageurl';}(jQuery));var $mcj = jQuery.noConflict(true); // SMS Phone Multi-Country Functionality if(!window.MC) { window.MC = {}; } window.MC.smsPhoneData = { defaultCountryCode: 'IE', programs: [], smsProgramDataCountryNames: [] }; function getCountryUnicodeFlag(countryCode) { return countryCode.toUpperCase().replace(/./g, (char) => String.fromCodePoint(char.charCodeAt(0) + 127397)) }; // HTML sanitization function to prevent XSS function sanitizeHtml(str) { if (typeof str !== 'string') return ''; return str .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, ''') .replace(/\//g, '/'); } // URL sanitization function to prevent javascript: and data: URLs function sanitizeUrl(url) { if (typeof url !== 'string') return ''; const trimmedUrl = url.trim().toLowerCase(); if (trimmedUrl.startsWith('javascript:') || trimmedUrl.startsWith('data:') || trimmedUrl.startsWith('vbscript:')) { return '#'; } return url; } const getBrowserLanguage = () => { if (!window?.navigator?.language?.split('-')[1]) { return window?.navigator?.language?.toUpperCase(); } return window?.navigator?.language?.split('-')[1]; }; // getBrowserLanguageCode() and getSmsProgramForCountryAndLanguage() are provided globally // by the external mc-sms-phone.js script loaded alongside this inline form script. function getDefaultCountryProgram(defaultCountryCode, smsProgramData) { if (!smsProgramData || smsProgramData.length === 0) { return null; } var browserCountryCode = getBrowserLanguage(); var browserLangCode = getBrowserLanguageCode(); if (browserCountryCode) { var match = getSmsProgramForCountryAndLanguage(smsProgramData, browserCountryCode, browserLangCode); if (match) { return match; } } if (defaultCountryCode) { var match = getSmsProgramForCountryAndLanguage(smsProgramData, defaultCountryCode, browserLangCode); if (match) { return match; } } return smsProgramData[0]; } function updateSmsLegalText(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } var programs = window?.MC?.smsPhoneData?.programs; if (!programs || !Array.isArray(programs)) { return; } var browserLangCode = getBrowserLanguageCode(); var program = getSmsProgramForCountryAndLanguage(programs, countryCode, browserLangCode); if (!program || !program.requiredTemplate) { return; } var smsConsentHtmlRenderingFixEnabled = true; const legalTextElement = document.querySelector('#legal-text-' + fieldName); if (!legalTextElement) { return; } const divRegex = new RegExp(']*>', 'gi'); const blockWrapperRegex = new RegExp(']*>', 'gi'); const fullAnchorRegex = new RegExp('<a.*?', 'g'); const anchorRegex = new RegExp('(.*?)'); const template = smsConsentHtmlRenderingFixEnabled ? program.requiredTemplate .replace(/\s*

]*>/gi, ' ') .replace(blockWrapperRegex, '') : program.requiredTemplate.replace(divRegex, ''); legalTextElement.textContent = ''; const parts = template.split(/(.*?)/g); parts.forEach(function(part) { if (!part) { return; } const anchorMatch = part.match(/(.+?)/); if (anchorMatch) { const linkElement = document.createElement('a'); linkElement.href = sanitizeUrl(anchorMatch[1]); linkElement.target = anchorMatch[2] ? sanitizeHtml(anchorMatch[2]) : '_blank'; linkElement.rel = 'noopener noreferrer'; linkElement.textContent = sanitizeHtml(anchorMatch[3]); legalTextElement.appendChild(linkElement); } else { legalTextElement.appendChild(document.createTextNode(part)); } }); } function generateDropdownOptions(smsProgramData) { if (!smsProgramData || smsProgramData.length === 0) { return ''; } var programs = true ? smsProgramData.filter(function(p, i, arr) { return arr.findIndex(function(q) { return q.countryCode === p.countryCode; }) === i; }) : smsProgramData; return programs.map(program => { const flag = getCountryUnicodeFlag(program.countryCode); const countryName = getCountryName(program.countryCode); const callingCode = program.countryCallingCode || ''; // Sanitize all values to prevent XSS const sanitizedCountryCode = sanitizeHtml(program.countryCode || ''); const sanitizedCountryName = sanitizeHtml(countryName || ''); const sanitizedCallingCode = sanitizeHtml(callingCode || ''); return '' + sanitizedCountryName + ' ' + sanitizedCallingCode + ''; }).join(''); } function getCountryName(countryCode) { if (window.MC?.smsPhoneData?.smsProgramDataCountryNames && Array.isArray(window.MC.smsPhoneData.smsProgramDataCountryNames)) { for (let i = 0; i < window.MC.smsPhoneData.smsProgramDataCountryNames.length; i++) { if (window.MC.smsPhoneData.smsProgramDataCountryNames[i].code === countryCode) { return window.MC.smsPhoneData.smsProgramDataCountryNames[i].name; } } } return countryCode; } function getDefaultPlaceholder(countryCode) { if (!countryCode || typeof countryCode !== 'string') { return '+1 000 000 0000'; // Default US placeholder } var mockPlaceholders = [ { countryCode: 'US', placeholder: '+1 000 000 0000', helpText: 'Include the US country code +1 before the phone number', }, { countryCode: 'GB', placeholder: '+44 0000 000000', helpText: 'Include the GB country code +44 before the phone number', }, { countryCode: 'CA', placeholder: '+1 000 000 0000', helpText: 'Include the CA country code +1 before the phone number', }, { countryCode: 'AU', placeholder: '+61 000 000 000', helpText: 'Include the AU country code +61 before the phone number', }, { countryCode: 'DE', placeholder: '+49 000 0000000', helpText: 'Fügen Sie vor der Telefonnummer die DE-Ländervorwahl +49 ein', }, { countryCode: 'FR', placeholder: '+33 0 00 00 00 00', helpText: 'Incluez le code pays FR +33 avant le numéro de téléphone', }, { countryCode: 'ES', placeholder: '+34 000 000 000', helpText: 'Incluya el código de país ES +34 antes del número de teléfono', }, { countryCode: 'NL', placeholder: '+31 0 00000000', helpText: 'Voeg de NL-landcode +31 toe vóór het telefoonnummer', }, { countryCode: 'BE', placeholder: '+32 000 00 00 00', helpText: 'Incluez le code pays BE +32 avant le numéro de téléphone', }, { countryCode: 'CH', placeholder: '+41 00 000 00 00', helpText: 'Fügen Sie vor der Telefonnummer die CH-Ländervorwahl +41 ein', }, { countryCode: 'AT', placeholder: '+43 000 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die AT-Ländervorwahl +43 ein', }, { countryCode: 'IE', placeholder: '+353 00 000 0000', helpText: 'Include the IE country code +353 before the phone number', }, { countryCode: 'IT', placeholder: '+39 000 000 0000', helpText: 'Includere il prefisso internazionale IT +39 prima del numero di telefono', }, { countryCode: 'NO', placeholder: '+47 000 00 000', helpText: 'Inkluder NO landskode +47 før telefonnummeret', }, { countryCode: 'SE', placeholder: '+46 00 000 00 00', helpText: 'Inkludera SE landskod +46 före telefonnumret', }, { countryCode: 'DK', placeholder: '+45 00 00 00 00', helpText: 'Inkluder DK landekode +45 før telefonnummeret', }, { countryCode: 'FI', placeholder: '+358 00 000 0000', helpText: 'Sisällytä FI-maakoodi +358 ennen puhelinnumeroa', }, { countryCode: 'EE', placeholder: '+372 0000 0000', helpText: 'Lisage EE riigikood +372 telefoninumbri ette', }, { countryCode: 'PL', placeholder: '+48 000 000 000', helpText: 'Podaj numer kierunkowy PL +48 przed numerem telefonu', }, { countryCode: 'SK', placeholder: '+421 000 000 000', helpText: 'Pred telefónne číslo uveďte kód krajiny SK +421', }, { countryCode: 'LV', placeholder: '+371 0000 0000', helpText: 'Iekļaujiet LV valsts kodu +371 pirms tālruņa numura', }, { countryCode: 'LT', placeholder: '+370 0000 0000', helpText: 'Įtraukite LT šalies kodą +370 prieš telefono numerį', }, { countryCode: 'GR', placeholder: '+30 000 000 0000', helpText: 'Συμπεριλάβετε τον κωδικό χώρας GR +30 πριν από τον αριθμό τηλεφώνου', }, { countryCode: 'PT', placeholder: '+351 000 000 000', helpText: 'Inclua o código de país PT +351 antes do número de telefone', }, { countryCode: 'HR', placeholder: '+385 00 000 0000', helpText: 'Uključite HR pozivni broj države +385 prije telefonskog broja', }, { countryCode: 'SI', placeholder: '+386 00 000 000', helpText: 'Vključite SI kodo države +386 pred telefonsko številko', }, { countryCode: 'IS', placeholder: '+354 000 0000', helpText: 'Láttu IS landsnúmer +354 fylgja á undan símanúmerinu', }, { countryCode: 'LU', placeholder: '+352 000 000 000', helpText: 'Incluez le code pays LU +352 avant le numéro de téléphone', }, { countryCode: 'MC', placeholder: '+377 00 00 00 00', helpText: 'Incluez le code pays MC +377 avant le numéro de téléphone', }, { countryCode: 'AD', placeholder: '+376 000 000', helpText: 'Incloeu el codi de país AD +376 abans del número de telèfon', }, { countryCode: 'JE', placeholder: '+44 0000 000000', helpText: 'Include the JE country code +44 before the phone number', }, { countryCode: 'IM', placeholder: '+44 0000 000000', helpText: 'Include the IM country code +44 before the phone number', }, { countryCode: 'GG', placeholder: '+44 0000 000000', helpText: 'Include the GG country code +44 before the phone number', }, { countryCode: 'AL', placeholder: '+355 00 000 0000', helpText: 'Përfshini kodin e vendit AL +355 para numrit të telefonit', }, { countryCode: 'SM', placeholder: '+378 0000 000000', helpText: 'Includere il prefisso internazionale SM +378 prima del numero di telefono', }, { countryCode: 'FO', placeholder: '+298 000000', helpText: 'Inkluder FO landekode +298 før telefonnummeret', }, { countryCode: 'MT', placeholder: '+356 0000 0000', helpText: 'Include the MT country code +356 before the phone number', }, { countryCode: 'LI', placeholder: '+423 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die LI-Ländervorwahl +423 ein', }, { countryCode: 'GI', placeholder: '+350 000 00000', helpText: 'Include the GI country code +350 before the phone number', }, { countryCode: 'MD', placeholder: '+373 00 000 000', helpText: 'Includeți codul de țară MD +373 înaintea numărului de telefon', }, { countryCode: 'HU', placeholder: '+36 00 000 0000', helpText: 'A telefonszám előtt adja meg a HU országkódot +36', }, { countryCode: 'NZ', placeholder: '+64 00 000 0000', helpText: 'Include the NZ country code +64 before the phone number', }, { countryCode: 'ME', placeholder: '+382 00 000 000', helpText: 'Uključite ME pozivni broj države +382 prije telefonskog broja', }, ]; const selectedPlaceholder = mockPlaceholders.find(function(item) { return item && item.countryCode === countryCode; }); return selectedPlaceholder ? selectedPlaceholder.placeholder : mockPlaceholders[0].placeholder; } function updatePlaceholder(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } const phoneInput = document.querySelector('#mce-' + fieldName); if (!phoneInput) { return; } const placeholder = getDefaultPlaceholder(countryCode); if (placeholder) { phoneInput.placeholder = placeholder; } } function updateCountryCodeInstruction(countryCode, fieldName) { updatePlaceholder(countryCode, fieldName); } function getDefaultHelpText(countryCode) { var mockPlaceholders = [ { countryCode: 'US', placeholder: '+1 000 000 0000', helpText: 'Include the US country code +1 before the phone number', }, { countryCode: 'GB', placeholder: '+44 0000 000000', helpText: 'Include the GB country code +44 before the phone number', }, { countryCode: 'CA', placeholder: '+1 000 000 0000', helpText: 'Include the CA country code +1 before the phone number', }, { countryCode: 'AU', placeholder: '+61 000 000 000', helpText: 'Include the AU country code +61 before the phone number', }, { countryCode: 'DE', placeholder: '+49 000 0000000', helpText: 'Fügen Sie vor der Telefonnummer die DE-Ländervorwahl +49 ein', }, { countryCode: 'FR', placeholder: '+33 0 00 00 00 00', helpText: 'Incluez le code pays FR +33 avant le numéro de téléphone', }, { countryCode: 'ES', placeholder: '+34 000 000 000', helpText: 'Incluya el código de país ES +34 antes del número de teléfono', }, { countryCode: 'NL', placeholder: '+31 0 00000000', helpText: 'Voeg de NL-landcode +31 toe vóór het telefoonnummer', }, { countryCode: 'BE', placeholder: '+32 000 00 00 00', helpText: 'Incluez le code pays BE +32 avant le numéro de téléphone', }, { countryCode: 'CH', placeholder: '+41 00 000 00 00', helpText: 'Fügen Sie vor der Telefonnummer die CH-Ländervorwahl +41 ein', }, { countryCode: 'AT', placeholder: '+43 000 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die AT-Ländervorwahl +43 ein', }, { countryCode: 'IE', placeholder: '+353 00 000 0000', helpText: 'Include the IE country code +353 before the phone number', }, { countryCode: 'IT', placeholder: '+39 000 000 0000', helpText: 'Includere il prefisso internazionale IT +39 prima del numero di telefono', }, { countryCode: 'NO', placeholder: '+47 000 00 000', helpText: 'Inkluder NO landskode +47 før telefonnummeret', }, { countryCode: 'SE', placeholder: '+46 00 000 00 00', helpText: 'Inkludera SE landskod +46 före telefonnumret', }, { countryCode: 'DK', placeholder: '+45 00 00 00 00', helpText: 'Inkluder DK landekode +45 før telefonnummeret', }, { countryCode: 'FI', placeholder: '+358 00 000 0000', helpText: 'Sisällytä FI-maakoodi +358 ennen puhelinnumeroa', }, { countryCode: 'EE', placeholder: '+372 0000 0000', helpText: 'Lisage EE riigikood +372 telefoninumbri ette', }, { countryCode: 'PL', placeholder: '+48 000 000 000', helpText: 'Podaj numer kierunkowy PL +48 przed numerem telefonu', }, { countryCode: 'SK', placeholder: '+421 000 000 000', helpText: 'Pred telefónne číslo uveďte kód krajiny SK +421', }, { countryCode: 'LV', placeholder: '+371 0000 0000', helpText: 'Iekļaujiet LV valsts kodu +371 pirms tālruņa numura', }, { countryCode: 'LT', placeholder: '+370 0000 0000', helpText: 'Įtraukite LT šalies kodą +370 prieš telefono numerį', }, { countryCode: 'GR', placeholder: '+30 000 000 0000', helpText: 'Συμπεριλάβετε τον κωδικό χώρας GR +30 πριν από τον αριθμό τηλεφώνου', }, { countryCode: 'PT', placeholder: '+351 000 000 000', helpText: 'Inclua o código de país PT +351 antes do número de telefone', }, { countryCode: 'HR', placeholder: '+385 00 000 0000', helpText: 'Uključite HR pozivni broj države +385 prije telefonskog broja', }, { countryCode: 'SI', placeholder: '+386 00 000 000', helpText: 'Vključite SI kodo države +386 pred telefonsko številko', }, { countryCode: 'IS', placeholder: '+354 000 0000', helpText: 'Láttu IS landsnúmer +354 fylgja á undan símanúmerinu', }, { countryCode: 'LU', placeholder: '+352 000 000 000', helpText: 'Incluez le code pays LU +352 avant le numéro de téléphone', }, { countryCode: 'MC', placeholder: '+377 00 00 00 00', helpText: 'Incluez le code pays MC +377 avant le numéro de téléphone', }, { countryCode: 'AD', placeholder: '+376 000 000', helpText: 'Incloeu el codi de país AD +376 abans del número de telèfon', }, { countryCode: 'JE', placeholder: '+44 0000 000000', helpText: 'Include the JE country code +44 before the phone number', }, { countryCode: 'IM', placeholder: '+44 0000 000000', helpText: 'Include the IM country code +44 before the phone number', }, { countryCode: 'GG', placeholder: '+44 0000 000000', helpText: 'Include the GG country code +44 before the phone number', }, { countryCode: 'AL', placeholder: '+355 00 000 0000', helpText: 'Përfshini kodin e vendit AL +355 para numrit të telefonit', }, { countryCode: 'SM', placeholder: '+378 0000 000000', helpText: 'Includere il prefisso internazionale SM +378 prima del numero di telefono', }, { countryCode: 'FO', placeholder: '+298 000000', helpText: 'Inkluder FO landekode +298 før telefonnummeret', }, { countryCode: 'MT', placeholder: '+356 0000 0000', helpText: 'Include the MT country code +356 before the phone number', }, { countryCode: 'LI', placeholder: '+423 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die LI-Ländervorwahl +423 ein', }, { countryCode: 'GI', placeholder: '+350 000 00000', helpText: 'Include the GI country code +350 before the phone number', }, { countryCode: 'MD', placeholder: '+373 00 000 000', helpText: 'Includeți codul de țară MD +373 înaintea numărului de telefon', }, { countryCode: 'HU', placeholder: '+36 00 000 0000', helpText: 'A telefonszám előtt adja meg a HU országkódot +36', }, { countryCode: 'NZ', placeholder: '+64 00 000 0000', helpText: 'Include the NZ country code +64 before the phone number', }, { countryCode: 'ME', placeholder: '+382 00 000 000', helpText: 'Uključite ME pozivni broj države +382 prije telefonskog broja', }, ]; if (!countryCode || typeof countryCode !== 'string') { return mockPlaceholders[0].helpText; } const selectedHelpText = mockPlaceholders.find(function(item) { return item && item.countryCode === countryCode; }); return selectedHelpText ? selectedHelpText.helpText : mockPlaceholders[0].helpText; } function setDefaultHelpText(countryCode) { const helpTextSpan = document.querySelector('#help-text'); if (!helpTextSpan) { return; } } function updateHelpTextCountryCode(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } setDefaultHelpText(countryCode); } function initializeSmsPhoneDropdown(fieldName) { if (!fieldName || typeof fieldName !== 'string') { return; } const dropdown = document.querySelector('#country-select-' + fieldName); const displayFlag = document.querySelector('#flag-display-' + fieldName); if (!dropdown || !displayFlag) { return; } const smsPhoneData = window.MC?.smsPhoneData; if (smsPhoneData && smsPhoneData.programs && Array.isArray(smsPhoneData.programs)) { dropdown.innerHTML = generateDropdownOptions(smsPhoneData.programs); } const defaultProgram = getDefaultCountryProgram(smsPhoneData?.defaultCountryCode, smsPhoneData?.programs); if (defaultProgram && defaultProgram.countryCode) { dropdown.value = defaultProgram.countryCode; const flagSpan = displayFlag?.querySelector('#flag-emoji-' + fieldName); if (flagSpan) { flagSpan.textContent = getCountryUnicodeFlag(defaultProgram.countryCode); flagSpan.setAttribute('aria-label', sanitizeHtml(defaultProgram.countryCode) + ' flag'); } updateSmsLegalText(defaultProgram.countryCode, fieldName); updatePlaceholder(defaultProgram.countryCode, fieldName); updateCountryCodeInstruction(defaultProgram.countryCode, fieldName); } var smsNotRequiredRemoveCountryCodeEnabled = true; var smsField = Object.values({"EMAIL":{"name":"EMAIL","label":"Email Address","helper_text":"","type":"email","required":true,"audience_field_name":"Email Address","merge_id":0,"help_text_enabled":false,"enabled":true,"order":0,"field_type":"merge"},"FNAME":{"name":"FNAME","label":"First Name","helper_text":"","type":"text","required":false,"audience_field_name":"First Name","enabled":false,"order":null,"field_type":"merge","merge_id":1},"MMERGE2":{"name":"MMERGE2","label":"Second Name","helper_text":"","type":"text","required":false,"audience_field_name":"Second Name","enabled":false,"order":null,"field_type":"merge","merge_id":2},"MMERGE3":{"name":"MMERGE3","label":"Company Name","helper_text":"","type":"text","required":false,"audience_field_name":"Company Name","enabled":false,"order":null,"field_type":"merge","merge_id":3},"MMERGE4":{"name":"MMERGE4","label":"Job Title","helper_text":"","type":"text","required":false,"audience_field_name":"Job Title","enabled":false,"order":null,"field_type":"merge","merge_id":4},"SIGNUP":{"name":"SIGNUP","label":"Signup form location","helper_text":"","type":"text","required":false,"audience_field_name":"Signup form location","enabled":false,"order":null,"field_type":"merge","merge_id":5},"MMERGE6":{"name":"MMERGE6","label":"Image URL","helper_text":"","type":"imageurl","required":false,"audience_field_name":"Image URL","enabled":false,"order":null,"field_type":"merge","merge_id":6}}).find(function(f) { return f.name === fieldName && f.type === 'smsphone'; }); var isRequired = smsField ? smsField.required : false; var shouldAppendCountryCode = smsNotRequiredRemoveCountryCodeEnabled ? isRequired : true; var phoneInput = document.querySelector('#mce-' + fieldName); if (phoneInput && defaultProgram.countryCallingCode && shouldAppendCountryCode) { phoneInput.value = defaultProgram.countryCallingCode; } displayFlag?.addEventListener('click', function(e) { dropdown.focus(); }); dropdown?.addEventListener('change', function() { const selectedCountry = this.value; if (!selectedCountry || typeof selectedCountry !== 'string') { return; } const flagSpan = displayFlag?.querySelector('#flag-emoji-' + fieldName); if (flagSpan) { flagSpan.textContent = getCountryUnicodeFlag(selectedCountry); flagSpan.setAttribute('aria-label', sanitizeHtml(selectedCountry) + ' flag'); } const selectedProgram = window.MC?.smsPhoneData?.programs.find(function(program) { return program && program.countryCode === selectedCountry; }); var smsNotRequiredRemoveCountryCodeEnabled = true; var smsField = Object.values({"EMAIL":{"name":"EMAIL","label":"Email Address","helper_text":"","type":"email","required":true,"audience_field_name":"Email Address","merge_id":0,"help_text_enabled":false,"enabled":true,"order":0,"field_type":"merge"},"FNAME":{"name":"FNAME","label":"First Name","helper_text":"","type":"text","required":false,"audience_field_name":"First Name","enabled":false,"order":null,"field_type":"merge","merge_id":1},"MMERGE2":{"name":"MMERGE2","label":"Second Name","helper_text":"","type":"text","required":false,"audience_field_name":"Second Name","enabled":false,"order":null,"field_type":"merge","merge_id":2},"MMERGE3":{"name":"MMERGE3","label":"Company Name","helper_text":"","type":"text","required":false,"audience_field_name":"Company Name","enabled":false,"order":null,"field_type":"merge","merge_id":3},"MMERGE4":{"name":"MMERGE4","label":"Job Title","helper_text":"","type":"text","required":false,"audience_field_name":"Job Title","enabled":false,"order":null,"field_type":"merge","merge_id":4},"SIGNUP":{"name":"SIGNUP","label":"Signup form location","helper_text":"","type":"text","required":false,"audience_field_name":"Signup form location","enabled":false,"order":null,"field_type":"merge","merge_id":5},"MMERGE6":{"name":"MMERGE6","label":"Image URL","helper_text":"","type":"imageurl","required":false,"audience_field_name":"Image URL","enabled":false,"order":null,"field_type":"merge","merge_id":6}}).find(function(f) { return f.name === fieldName && f.type === 'smsphone'; }); var isRequired = smsField ? smsField.required : false; var shouldAppendCountryCode = smsNotRequiredRemoveCountryCodeEnabled ? isRequired : true; var phoneInput = document.querySelector('#mce-' + fieldName); if (phoneInput && selectedProgram.countryCallingCode && shouldAppendCountryCode) { phoneInput.value = selectedProgram.countryCallingCode; } updateSmsLegalText(selectedCountry, fieldName); updatePlaceholder(selectedCountry, fieldName); updateCountryCodeInstruction(selectedCountry, fieldName); }); } document.addEventListener('DOMContentLoaded', function() { const smsPhoneFields = document.querySelectorAll('[id^="country-select-"]'); smsPhoneFields.forEach(function(dropdown) { const fieldName = dropdown?.id.replace('country-select-', ''); initializeSmsPhoneDropdown(fieldName); }); });

- Advertisment -

Most Popular

- Advertisment -