@@ -24,7 +24,6 @@ const algoliaInsightsPlugin = createAlgoliaInsightsPlugin({ insightsClient });
24
24
25
25
// define locations to separate invocation for mobile and desktop
26
26
const locations = [ '#autocomplete' , '#autocomplete-mobile' ] ;
27
- const engage_locations = [ '#engage-autocomplete' ]
28
27
29
28
function initAutocomplete ( item ) {
30
29
const search = autocomplete ( {
@@ -106,90 +105,4 @@ function initAutocomplete(item){
106
105
107
106
}
108
107
109
- function initEngageAutocomplete ( item ) {
110
- const search = autocomplete ( {
111
- container : item ,
112
- placeholder : "Search the Twilio Engage documentation" ,
113
- debug : false ,
114
- openOnFocus : false ,
115
- keyboardShortcuts : [ 's' , 191 ] ,
116
- plugins : [ algoliaInsightsPlugin , ] ,
117
- detachedMediaQuery :'none' ,
118
- getSources ( { query} ) {
119
- return [
120
- {
121
- sourceId : 'articles' ,
122
- getItemUrl ( { item } ) {
123
- if ( item . anchor != null ) {
124
- var itemUrl = '/docs' + item . url + "#" + item . anchor ;
125
- } else {
126
- var itemUrl = '/docs' + item . url ;
127
- }
128
- return itemUrl ;
129
- } ,
130
- getItems ( ) {
131
- return getAlgoliaResults ( {
132
- searchClient,
133
- queries : [
134
- {
135
- indexName : 'segment-docs' ,
136
- query,
137
- params : {
138
- hitsPerPage : 7 ,
139
- facetFilters : [ 'hidden:-true' ] ,
140
- clickAnalytics : true ,
141
- } ,
142
- } ,
143
- ] ,
144
- } ) ;
145
- } ,
146
- templates : {
147
- item ( { item, createElement } ) {
148
- if ( item . anchor != null ) {
149
- var anchorLink = "#" + item . anchor ;
150
- } else {
151
- var anchorLink = "" ;
152
- }
153
-
154
- if ( item . engage ) {
155
- var engage = "<span class='engage-pill'>Engage</span>"
156
- }
157
- return createElement ( 'div' , {
158
- dangerouslySetInnerHTML : {
159
- __html : `<a class="aa-link" href="/docs${ item . url } ${ anchorLink } ">
160
- <p class="aa-title" >${ highlightHit ( { hit : item , attribute : 'title' } ) } ${ engage } </h3>
161
- <p class="aa-content">${ highlightHit ( { hit : item , attribute : 'content' } ) } </p></a>`
162
- }
163
- } )
164
- } ,
165
- noResults ( ) {
166
- return html `< p class ="aa-content "> No results for < strong > ${ query } </ strong > </ p > ` ;
167
- }
168
- } ,
169
-
170
- } ,
171
- ] ;
172
- } ,
173
- navigator : {
174
- navigate ( { itemUrl } ) {
175
- window . location . assign ( itemUrl ) ;
176
- } ,
177
- navigateNewTab ( { itemUrl } ) {
178
- const windowReference = window . open ( itemUrl , '_blank' , 'noopener' ) ;
179
-
180
- if ( windowReference ) {
181
- windowReference . focus ( ) ;
182
- }
183
- } ,
184
- navigateNewWindow ( { itemUrl } ) {
185
- window . open ( itemUrl , '_blank' , 'noopener' ) ;
186
- } ,
187
- } ,
188
- } ) ;
189
-
190
- }
191
- if ( loc . startsWith ( "/docs/engage" ) ) {
192
- engage_locations . forEach ( initEngageAutocomplete )
193
- } else {
194
108
locations . forEach ( initAutocomplete ) ;
195
- }
0 commit comments