|
| 1 | +{% include "@bolt-components-typeahead/typeahead.twig" with { |
| 2 | + attributes: { |
| 3 | + class: [ |
| 4 | + "js-typeahead-hook--global-search" |
| 5 | + ] |
| 6 | + }, |
| 7 | +} %} |
| 8 | + |
| 9 | +<script> |
| 10 | + const typeahead = document.querySelector('.js-typeahead-hook--global-search'); |
| 11 | +
|
| 12 | + const items = [ |
| 13 | + { |
| 14 | + label: 'AI and improving the customer experience', |
| 15 | + description: '“Artificial intelligence” (AI) presents both distracting hype and powerful opportunities to drive customer engagement.', |
| 16 | + url: 'https://www.pega.com/ai-and-improving-customer-experience' |
| 17 | + }, { |
| 18 | + label: 'Gartner Magic Quadrant for Enterprise Low-Code Application Platforms 2019', |
| 19 | + description: 'Pega was cited as a Visionary in Gartner’s new 2019 Magic Quadrant for Enterprise Low-Code Application Platforms.', |
| 20 | + url: 'https://www.pega.com/insights/resources/gartner-magic-quadrant-enterprise-low-code-application-platforms-2019' |
| 21 | + }, { |
| 22 | + label: 'Pega Data & Integrations', |
| 23 | + description: "Take full advantage of integration opportunities with Pega's open architecture, allowing you to build applications faster and meet the increasing demands of your business.", |
| 24 | + url: 'https://www.pega.com/products/pega-platform/data-integrations' |
| 25 | + }, { |
| 26 | + label: 'Digital Customer Experiences', |
| 27 | + description: 'Deliver engaging digital customer experiences anywhere, anytime, with unique designs for your business right out of the box.', |
| 28 | + url: 'https://www.pega.com/products/pega-platform/digital-customer-experiences' |
| 29 | + }, { |
| 30 | + label: 'DevOps and Testing', |
| 31 | + description: "Continuous integration and deployment. Continuous evolution. With one-click DevOps, you'll break barriers to delivery – and leapfrog competitors – by empowering business teams to…", |
| 32 | + url: 'https://www.pega.com/products/pega-platform/devops-testing' |
| 33 | + }, { |
| 34 | + label: 'Pega Onboarding', |
| 35 | + description: 'Intelligent work automation dramatically cuts time to revenue while ensuring compliance with global and local regulations, whether you are onboarding new clients, adding products…', |
| 36 | + url: 'https://www.pega.com/industries/financial-services/onboarding' |
| 37 | + }, { |
| 38 | + label: 'Case Management', |
| 39 | + description: 'Pega BPM and case management solutions allow you to build and manage enterprise-level strategic applications that can communicate with legacy systems.', |
| 40 | + url: 'https://www.pega.com/products/pega-platform/case-management' |
| 41 | + }, { |
| 42 | + label: 'Pega Intelligent Virtual Assistant', |
| 43 | + description: "Across all channels, Pega's Intelligent Virtual Assistant engages users where they are and gives them experiences based on context, not just auto-responses.", |
| 44 | + url: 'https://www.pega.com/products/pega-platform/intelligent-virtual-assistant' |
| 45 | + }, |
| 46 | + ]; |
| 47 | +
|
| 48 | + typeahead.addEventListener('ready', function (e) { |
| 49 | + if (e.detail.name === 'bolt-typeahead') { |
| 50 | + typeahead.items = items; |
| 51 | +
|
| 52 | + typeahead.on('onSelected', (element, event, suggestion) => { |
| 53 | + const exactMatch = element.items.filter(item => item.label === suggestion.suggestionValue)[0]; |
| 54 | +
|
| 55 | + function navigateTo(url) { |
| 56 | + if (window.location !== window.parent.location) { |
| 57 | + const win = window.open(url, '_blank'); |
| 58 | + win.focus(); |
| 59 | + } else { |
| 60 | + window.location = url; |
| 61 | + } |
| 62 | + } |
| 63 | +
|
| 64 | + if (exactMatch && exactMatch.url) { |
| 65 | + if (exactMatch.url) { |
| 66 | + navigateTo(exactMatch.url); |
| 67 | + } else { |
| 68 | + navigateTo(`https://www.pega.com/search?q=${ |
| 69 | + itemSelected.label |
| 70 | + }`); |
| 71 | + } |
| 72 | + } else if (suggestion.suggestionValue !== '') { |
| 73 | + navigateTo(`https://www.pega.com/search?q=${ |
| 74 | + suggestion.suggestionValue |
| 75 | + }`); |
| 76 | + } |
| 77 | + }); |
| 78 | + } |
| 79 | + }); |
| 80 | +</script> |
0 commit comments