algoliasearch.zendesk-hc
Advanced tools
Comparing version 2.29.1 to 3.0.0-alpha.1
@@ -1,6 +0,4 @@ | ||
Changelog | ||
========== | ||
# Changelog | ||
For transparency and insight into our release cycle, releases will be numbered | ||
with the follow format: | ||
For transparency and insight into our release cycle, releases will be numbered with the follow format: | ||
@@ -11,5 +9,5 @@ `<major>.<minor>.<patch>` | ||
* Breaking backwards compatibility bumps the major | ||
* New additions without breaking backwards compatibility bumps the minor | ||
* Bug fixes and misc changes bump the patch | ||
- Breaking backwards compatibility bumps the major | ||
- New additions without breaking backwards compatibility bumps the minor | ||
- Bug fixes and misc changes bump the patch | ||
@@ -22,2 +20,2 @@ For more information on semantic versioning, please visit http://semver.org/. | ||
* Initial import | ||
- Initial import |
105
package.json
{ | ||
"name": "algoliasearch.zendesk-hc", | ||
"version": "2.29.1", | ||
"version": "3.0.0-alpha.1", | ||
"description": "Algolia Search for Zendesk's Help Center", | ||
@@ -20,81 +20,42 @@ "author": "Algolia <support@algolia.com>", | ||
"files": [ | ||
"dist/", | ||
"dist-es5-module/" | ||
"dist/" | ||
], | ||
"main": "dist-es5-module/index.js", | ||
"browserify-shim": { | ||
"moment": "global:moment" | ||
}, | ||
"engines": { | ||
"node": ">=8 <11" | ||
}, | ||
"main": "dist/algoliasearch.zendesk-hc.js", | ||
"dependencies": { | ||
"algoliasearch": "^3.18.1", | ||
"autocomplete.js": "^0.28.1", | ||
"hogan.js": "^3.0.2", | ||
"instantsearch.js": "^1.0.0", | ||
"@algolia/autocomplete-js": "1.0.0-alpha.43", | ||
"@algolia/autocomplete-plugin-algolia-insights": "1.0.0-alpha.43", | ||
"@algolia/autocomplete-plugin-recent-searches": "1.0.0-alpha.43", | ||
"@algolia/autocomplete-preset-algolia": "1.0.0-alpha.43", | ||
"@algolia/autocomplete-theme-classic": "1.0.0-alpha.43", | ||
"@algolia/client-search": "4.8.3", | ||
"algoliasearch": "4.8.3", | ||
"fargs": "^1.1.1", | ||
"js-cookie": "^2.2.1", | ||
"stopwords": "https://github.com/6/stopwords/tarball/ccec79a4ba22d65eb095bc277d79a7ad8096552c", | ||
"unorm": "^1.4.1", | ||
"vietnamese-stopwords": "0.0.2" | ||
"lodash": "^4.17.21", | ||
"preact": "^10.5.12", | ||
"search-insights": "1.6.3", | ||
"to-factory": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.9.0", | ||
"babel-eslint": "^4.1.6", | ||
"babel-loader": "^6.2.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.6.4", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babelify": "^7.2.0", | ||
"browserify": "^13.0.0", | ||
"browserify-shim": "^3.8.12", | ||
"browserify-versionify": "^1.0.6", | ||
"chalk": "^1.1.1", | ||
"del": "^2.2.0", | ||
"envify": "^3.4.0", | ||
"eslint": "^4.18.2", | ||
"eslint-config-airbnb": "^2.0.0", | ||
"eslint-config-algolia": "^4.6.0", | ||
"eslint-plugin-algolia": "^1.5.0", | ||
"eslint-plugin-react": "^3.16.1", | ||
"expect": "^1.13.4", | ||
"fargs": "^1.1.0", | ||
"gulp": "^3.9.0", | ||
"gulp-babel": "^6.1.1", | ||
"gulp-connect": "^2.3.1", | ||
"gulp-cssnano": "^2.1.0", | ||
"gulp-eslint": "^1.1.1", | ||
"gulp-header": "^1.8.8", | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-mocha": "^2.2.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sass": "^2.2.0", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-uglify": "^2.0.0", | ||
"gulp-util": "^3.0.7", | ||
"isparta": "^4.0.0", | ||
"jsdom": "^7.2.2", | ||
"jsdom-global": "^1.6.1", | ||
"merge-stream": "^1.0.0", | ||
"mochawesome": "^1.2.2", | ||
"stringify": "^5.2.0", | ||
"to-factory": "^1.0.0", | ||
"uglifyify": "^3.0.1", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.1.0", | ||
"watchify": "^3.11.1", | ||
"yiewd": "^0.6.0" | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^10.1.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"eslint": "^7.20.0", | ||
"eslint-config-algolia": "15.0.0", | ||
"eslint-config-prettier": "6.15.0", | ||
"eslint-plugin-eslint-comments": "3.2.0", | ||
"eslint-plugin-import": "2.22.1", | ||
"eslint-plugin-prettier": "3.2.0", | ||
"eslint-plugin-react": "7.21.5", | ||
"parcel-bundler": "1.12.4", | ||
"prettier": "^2.2.1" | ||
}, | ||
"scripts": { | ||
"build:css": "gulp build:css", | ||
"build:docs": "gulp build:docs", | ||
"build:js": "gulp build:js", | ||
"build": "gulp build", | ||
"clean": "gulp clean", | ||
"dev": "gulp dev", | ||
"lint": "gulp lint", | ||
"start": "npm run dev", | ||
"server": "gulp server", | ||
"test:coverage": "gulp test:coverage", | ||
"test": "gulp test" | ||
"clean": "rm -rf dist/ node_modules/", | ||
"build": "parcel build index.js --global algoliasearchZendeskHC -o algoliasearch.zendesk-hc.js", | ||
"dev": "parcel index.html --global algoliasearchZendeskHC", | ||
"format": "prettier --write .", | ||
"lint": "eslint --ext .js src" | ||
} | ||
} |
400
README.md
@@ -5,5 +5,3 @@ # JavaScript library: `algoliasearchZendeskHC` | ||
[![Dependency Status](https://david-dm.org/algolia/algoliasearch-zendesk.png?path=app)](https://david-dm.org/algolia/algoliasearch-zendesk?path=app) | ||
[![devDependency Status](https://david-dm.org/algolia/algoliasearch-zendesk/dev-status.png?path=app)](https://david-dm.org/algolia/algoliasearch-zendesk?path=app#info=devDependencies) | ||
[![peerDependency Status](https://david-dm.org/algolia/algoliasearch-zendesk/peer-status.png?path=app)](https://david-dm.org/algolia/algoliasearch-zendesk?path=app#info=peerDependencies) | ||
[![Dependency Status](https://david-dm.org/algolia/algoliasearch-zendesk.png?path=app)](https://david-dm.org/algolia/algoliasearch-zendesk?path=app) [![devDependency Status](https://david-dm.org/algolia/algoliasearch-zendesk/dev-status.png?path=app)](https://david-dm.org/algolia/algoliasearch-zendesk?path=app#info=devDependencies) [![peerDependency Status](https://david-dm.org/algolia/algoliasearch-zendesk/peer-status.png?path=app)](https://david-dm.org/algolia/algoliasearch-zendesk?path=app#info=peerDependencies) | ||
@@ -14,11 +12,4 @@ [![GitHub license](https://img.shields.io/github/license/algolia/algoliasearch-zendesk.png)](../LICENSE) | ||
To browse through the crawler, visit the [crawler/](../crawler/) folder. | ||
## Documentation | ||
<!-- | ||
docs/documentation.md is generated from the content of the ## Documentation section of app/README.md | ||
To change its content, modify app/README.md, go to the app/ folder and run `npm install && npm run build:docs` | ||
--> | ||
### Synchronize Algolia with your Help Center | ||
@@ -35,10 +26,7 @@ | ||
When you install our Zendesk integration, it creates what we call a connector in your Algolia account. | ||
You can access it with the left sidebar in your dashboard. | ||
When you install our Zendesk integration, it creates what we call a connector in your Algolia account. You can access it with the left sidebar in your dashboard. | ||
This connector will every day take your public Help Center articles and put them inside an Algolia index. | ||
In most cases, this should be enough to have an up-to-date search. | ||
This connector will every day take your public Help Center articles and put them inside an Algolia index. In most cases, this should be enough to have an up-to-date search. | ||
However, if you'd rather have it updated right now, like when you add a lot of support articles, you can manually trigger a full reindex. | ||
On this page, just click the "Reindex" button in the bottom right corner. A few minutes later, your search index will be updated. | ||
However, if you'd rather have it updated right now, like when you add a lot of support articles, you can manually trigger a full reindex. On this page, just click the "Reindex" button in the bottom right corner. A few minutes later, your search index will be updated. | ||
@@ -49,3 +37,3 @@ ### Updating your Help Center theme | ||
* Open the **Document Head** template in the **Theme Editor**: | ||
- Open the **Document Head** template in the **Theme Editor**: | ||
1. Head to your Zendesk Help Center | ||
@@ -60,5 +48,5 @@ 1. Click **General > Customize the design** in the top bar | ||
* Copy the **JavaScript** snippet & **Publish** changes: | ||
- Copy the **JavaScript** snippet & **Publish** changes: | ||
1. Paste the code we provide you while connecting your Zendesk Help Center with Algolia at the end of the template. | ||
1. Click **Save** and ensure everything is working using the preview on the right (if you have some small CSS issues, [read this part](#customizing-the-css)) | ||
1. Click **Save** and ensure everything is working using the preview on the right | ||
1. Click **Publish Changes** | ||
@@ -77,4 +65,11 @@ | ||
```html | ||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/2/algoliasearch.zendesk-hc.min.css"> | ||
<script type="text/javascript" src="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/2/algoliasearch.zendesk-hc.min.js"></script> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/3/algoliasearch.zendesk-hc.min.css" | ||
/> | ||
<script | ||
type="text/javascript" | ||
src="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/3/algoliasearch.zendesk-hc.min.js" | ||
></script> | ||
<script type="text/javascript"> | ||
@@ -89,31 +84,32 @@ algoliasearchZendeskHC({ | ||
// | ||
indexPrefix: 'zendesk_', // or your custom <INDEX_PREFIX> | ||
analytics: true, // should queries be processed by Algolia analytics | ||
baseUrl: '/hc/', // the base URL of your Help Center | ||
poweredBy: true, // show the "Search by Algolia" link (required if you're on Algolia's FREE plan) | ||
clickAnalytics: false, // whether or not to enable the clickAnalytics feature (available on the Enterprise plan) | ||
debug: false, // debug mode prevents the autocomplete to close when trying to inspect it | ||
color: '#158EC2', // main color (used for links) | ||
highlightColor: '#158EC2', // highlight color to emphasize matching text | ||
responsive: true, // responsive instantsearch page | ||
indexPrefix: 'zendesk_', // or your custom <INDEX_PREFIX> | ||
analytics: true, // should queries be processed by Algolia analytics | ||
baseUrl: '/hc/', // the base URL of your Help Center | ||
poweredBy: true, // show the "Search by Algolia" link (required if you're on Algolia's FREE plan) | ||
clickAnalytics: true, // whether or not to enable the clickAnalytics feature (available on the Enterprise plan) | ||
debug: false, // debug mode prevents the autocomplete to close when trying to inspect it | ||
color: '#158EC2', // main color (used for links) | ||
highlightColor: '#158EC2', // highlight color to emphasize matching text | ||
autocomplete: { | ||
enabled: true, // is the autocomplete feature enabled? | ||
inputSelector: '#query', // the DOM selector to select the search box | ||
hitsPerPage: 5 // the number of suggestions to display | ||
enabled: true, // is the autocomplete feature enabled? | ||
inputSelector: '#query', // the DOM selector to select the search box | ||
hitsPerPage: 5, // the number of suggestions to display | ||
}, | ||
instantsearch: { | ||
enabled: true, // is the instantsearch feature enabled? | ||
hitsPerPage: 20, // the number of suggestions to display | ||
paginationSelector: '.pagination', // the DOM selector for the current pagination (to hide it) | ||
reuseAutocomplete: false, // do not add a search input for the instant-search page | ||
hideAutocomplete: true, // whether or not to hide the autocomplete on the instantsearch page (ignored if reuseAutocomplete is used) | ||
selector: '.search-results', // the DOM selector for the results container | ||
tagsLimit: 15 // maximum number of tags to display | ||
}, | ||
instantsearchPage, // function to check if we're on the search page | ||
templates: { // template objects (see the templates section) | ||
// TODO: restore this | ||
// instantsearch: { | ||
// enabled: true, // is the instantsearch feature enabled? | ||
// hitsPerPage: 20, // the number of suggestions to display | ||
// paginationSelector: '.pagination', // the DOM selector for the current pagination (to hide it) | ||
// reuseAutocomplete: false, // do not add a search input for the instant-search page | ||
// hideAutocomplete: true, // whether or not to hide the autocomplete on the instantsearch page (ignored if reuseAutocomplete is used) | ||
// selector: '.search-results', // the DOM selector for the results container | ||
// tagsLimit: 15, // maximum number of tags to display | ||
// }, | ||
templates: { | ||
// template objects (see the templates section) | ||
autocomplete: {}, | ||
instantsearch: {} | ||
// TODO: restore this | ||
// instantsearch: {}, | ||
}, | ||
translations: {} // translation strings | ||
translations: {}, // translation strings | ||
}); | ||
@@ -123,32 +119,2 @@ </script> | ||
### Customizing the CSS | ||
It is definitely possible that, when you install the application, it doesn't exactly display as you expect. | ||
No worries, these are usually just a few conflicting rules between your design and our integration. | ||
You might also just want to change the look & feel of the search. | ||
Either way, just follow the following steps: | ||
- Ensure you read the [SCSS source file](https://github.com/algolia/algoliasearch-zendesk/blob/master/app/css/index.scss) to see all the rules we're using | ||
- Add a `<style>` tag after the `<link>` tag you've already added in your **Document Head** template and add your custom CSS here | ||
**Example:** | ||
```html | ||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/CURRENT_VERSION/algoliasearch.zendesk-hc.min.css"> | ||
<style> | ||
.aa-dropdown-menu { | ||
background-color: #ccc; | ||
} | ||
</style> | ||
<script type="text/javascript" src="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/CURRENT_VERSION/algoliasearch.zendesk-hc.min.js"></script> | ||
<script type="text/javascript"> | ||
algoliasearchZendeskHC(/* ... */); | ||
</script> | ||
``` | ||
**Note:** You might have some trouble trying to customize the autocomplete menu because it automatically closes when you try to Inspect it. | ||
Just set `debug: true` to avoid this behaviour. | ||
### Supporting multiple languages | ||
@@ -162,51 +128,50 @@ | ||
2. Some constant strings like the ones used in the sentence "12 results found in 1ms" need to be translated. | ||
The library already supports these locales: | ||
2. Some constant strings like the ones used in the sentence "12 results found in 1ms" need to be translated. The library already supports these locales: | ||
- __ar__: العربية / Arabic | ||
- __ar-eg__: العربية (مصر) / Arabic (Egypt) | ||
- __bg__: Български / Bulgarian | ||
- __cs__: Čeština / Czech | ||
- __da__: Dansk / Danish | ||
- __de__: Deutsch / German | ||
- __de-at__: Deutsch (Österreich) / German (Austria) | ||
- __de-ch__: Deutsch (Schweiz) / German (Switzerland) | ||
- __el__: Ελληνικά / Greek | ||
- __en-au__: English (Australia) | ||
- __en-ca__: English (Canada) | ||
- __en-gb__: English (Great Britain) | ||
- __en-ie__: English (Ireland) | ||
- __en-us__: English (United States) | ||
- __en-150__: English (Europe) | ||
- __es__: Español / Spanish | ||
- __es-es__: Español (España) / Spanish (Spain) | ||
- __es-mx__: Español (Mexico) / Spanish (Mexico) | ||
- __es-419__: Español (Latinoamérica) / Spanish (Latin America) | ||
- __fi__: Suomi / Finnish | ||
- __fr__: Français / French | ||
- __fr-be__: Français (Belgique) / French (Belgium) | ||
- __fr-ca__: Français (Canada) / French (Canada) | ||
- __fr-ch__: Français (Suisse) / French (Switzerland) | ||
- __fr-fr__: Français (France) / French (France) | ||
- __hu__: Magyar / Hungarian | ||
- __id__: Bahasa Indonesia / Indonesian | ||
- __it__: Italiano / Italian | ||
- __ja__: 日本語 / Japanese | ||
- __ko__: 한국어 / Korean | ||
- __nl__: Nederlands / Dutch | ||
- __nl-be__: Nederlands (België) / Dutch (Belgium) | ||
- __no__: Norsk / Norwegian | ||
- __pl__: Polski / Polish | ||
- __pt__: Português / Portuguese | ||
- __pt-br__: Português do Brasil / Brazilian Portuguese | ||
- __ro__: Română / Romanian | ||
- __ru__: Русский / Russian | ||
- __sk__: Slovenčina / Slovak | ||
- __sv__: Svenska / Swedish | ||
- __th__: ไทย / Thai | ||
- __tr__: Türkçe / Turkish | ||
- __uk__: Українська / Ukrainian | ||
- __vi__: Tiếng Việt / Vietnamese | ||
- __zh-cn__: 简体中文 / Simplified Chinese | ||
- __zh-tw__: 繁體中文 / Traditional Chinese | ||
- **ar**: العربية / Arabic | ||
- **ar-eg**: العربية (مصر) / Arabic (Egypt) | ||
- **bg**: Български / Bulgarian | ||
- **cs**: Čeština / Czech | ||
- **da**: Dansk / Danish | ||
- **de**: Deutsch / German | ||
- **de-at**: Deutsch (Österreich) / German (Austria) | ||
- **de-ch**: Deutsch (Schweiz) / German (Switzerland) | ||
- **el**: Ελληνικά / Greek | ||
- **en-au**: English (Australia) | ||
- **en-ca**: English (Canada) | ||
- **en-gb**: English (Great Britain) | ||
- **en-ie**: English (Ireland) | ||
- **en-us**: English (United States) | ||
- **en-150**: English (Europe) | ||
- **es**: Español / Spanish | ||
- **es-es**: Español (España) / Spanish (Spain) | ||
- **es-mx**: Español (Mexico) / Spanish (Mexico) | ||
- **es-419**: Español (Latinoamérica) / Spanish (Latin America) | ||
- **fi**: Suomi / Finnish | ||
- **fr**: Français / French | ||
- **fr-be**: Français (Belgique) / French (Belgium) | ||
- **fr-ca**: Français (Canada) / French (Canada) | ||
- **fr-ch**: Français (Suisse) / French (Switzerland) | ||
- **fr-fr**: Français (France) / French (France) | ||
- **hu**: Magyar / Hungarian | ||
- **id**: Bahasa Indonesia / Indonesian | ||
- **it**: Italiano / Italian | ||
- **ja**: 日本語 / Japanese | ||
- **ko**: 한국어 / Korean | ||
- **nl**: Nederlands / Dutch | ||
- **nl-be**: Nederlands (België) / Dutch (Belgium) | ||
- **no**: Norsk / Norwegian | ||
- **pl**: Polski / Polish | ||
- **pt**: Português / Portuguese | ||
- **pt-br**: Português do Brasil / Brazilian Portuguese | ||
- **ro**: Română / Romanian | ||
- **ru**: Русский / Russian | ||
- **sk**: Slovenčina / Slovak | ||
- **sv**: Svenska / Swedish | ||
- **th**: ไทย / Thai | ||
- **tr**: Türkçe / Turkish | ||
- **uk**: Українська / Ukrainian | ||
- **vi**: Tiếng Việt / Vietnamese | ||
- **zh-cn**: 简体中文 / Simplified Chinese | ||
- **zh-tw**: 繁體中文 / Traditional Chinese | ||
@@ -223,5 +188,4 @@ If you want to support another locale, please help us by [opening an issue on GitHub][locale_issue]. | ||
[locale_issue]: https://github.com/algolia/algoliasearch-zendesk/issues/new?title=Missing%20locale%3A%20%5Ben-us%5D&body=%3C!%E2%88%92%E2%88%92%0A%20%20To%20improve%20the%20extension%2C%20we%20need%20your%20help!%0A%20%20We%20only%20need%20to%20know%20how%20to%20write%20a%20few%20sentences%20in%20the%20language%20you%20want%20us%20to%20add.%0A%20%20Can%20you%20help%20us%20translate%20them%3F%20%3A)%0A%E2%88%92%E2%88%92%3E%0A%0ATranslations%3A%0A%0A%60%60%60txt%0ASearch%20in%20our%20articles%3A%20%0ASearch%20by%20Algolia%3A%20%0ANo%20result%20found%20for%20%22xxx%22%3A%20%0A%22change%20your%20query%22%20or%20%22clear%20your%20filters%22%3A%20%0A1%20result%20found%20in%20XXXms%3A%20%0A2%2C000%20results%20found%20in%20XXXms%3A%20%0ACategories%3A%20%0ATags%20(in%20the%20%22Labels%22%20meaning)%3A%20%0AFilter%20results%3A%20%0A%60%60%60%0A%0AIs%20there%20more%20than%201%20plural%20form%3F%20%5BYes%2FNo%5D%0AHow%20do%20you%20write%20big%20numbers%3F%20%5B20%2C000%5D | ||
[locale_issue]: https://github.com/algolia/algoliasearch-zendesk/issues/new?title=Missing%20locale%3A%20%5Ben-us%5D&body=%3C!%E2%88%92%E2%88%92%0A%20%20To%20improve%20the%20extension%2C%20we%20need%20your%20help!%0A%20%20We%20only%20need%20to%20know%20how%20to%20write%20a%20few%20sentences%20in%20the%20language%20you%20want%20us%20to%20add.%0A%20%20Can%20you%20help%20us%20translate%20them%3F%20%3A)%0A%E2%88%92%E2%88%92%3E%0A%0ATranslations%3A%0A%0A%60%60%60txt%0ASearch%20in%20our%20articles%3A%20%0ASearch%20by%20Algolia%3A%20%0ANo%20result%20found%20for%20%22xxx%22%3A%20%0A%22change%20your%20query%22%20or%20%22clear%20your%20filters%22%3A%20%0A1%20result%20found%20in%20XXXms%3A%20%0A2%2C000%20results%20found%20in%20XXXms%3A%20%0ACategories%3A%20%0ATags%20(in%20the%20%22Labels%22%20meaning)%3A%20%0AFilter%20results%3A%20%0A%60%60%60%0A%0AIs%20there%20more%20than%201%20plural%20form%3F%20%5BYes%2FNo%5D%0AHow%20do%20you%20write%20big%20numbers%3F%20%5B20%2C000%5D | ||
#### Modifying translations | ||
@@ -245,49 +209,18 @@ | ||
translations: { | ||
categories: { | ||
'en-us': 'Categories' | ||
}, | ||
change_query: { | ||
'en-us': 'Change your query' | ||
}, | ||
clear_filters: { | ||
'en-us': 'clear your filters' | ||
}, | ||
format_number: { | ||
'en-us': function (n) { return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } | ||
}, | ||
filter: { | ||
'en-us': 'Filter results' | ||
}, | ||
nb_results: { | ||
'en-us': function (nb) { | ||
return this.format_number(nb) + ' result' + (nb > 1 ? 's' : ''); | ||
nbResults: { | ||
en: function (nb) { | ||
return `${formatNumber(nb)} result${nb > 1 ? 's' : ''}`; | ||
} | ||
}, | ||
no_result_for: { | ||
'en-us': function (query) { | ||
noResultsFor: { | ||
en: function (query) { | ||
return 'No result found for ' + this.quoted(query); | ||
} | ||
}, | ||
no_result_actions: { | ||
'en-us': function () { | ||
return this.change_query + ' or ' + this.clear_filters; | ||
} | ||
}, | ||
placeholder: { | ||
'en-us': 'Search in our articles' | ||
en: 'Search in our articles' | ||
}, | ||
quoted: { | ||
'en-us': function (text) { return '"' + escapeHTML(text) + '"'; } | ||
searchByAlgolia: { | ||
en: function (algolia) { return 'Search by ' + algolia; } | ||
}, | ||
stats: { | ||
'en-us': function (nbHits, processing) { | ||
return this.nb_results(nbHits) + ' found in ' + processing + ' ms'; | ||
} | ||
}, | ||
search_by_algolia: { | ||
'en-us': function (algolia) { return 'Search by ' + algolia; } | ||
}, | ||
tags: { | ||
'en-us': 'Tags' | ||
} | ||
} | ||
@@ -298,5 +231,3 @@ ``` | ||
You can index localized tags based on locales prefix (e.g. `en-us` or `en`). | ||
If we detect a locale, we'll only index localized tags for this translation. | ||
For instance, an article with those tags: | ||
You can index localized tags based on locales prefix (e.g. `en-us` or `en`). If we detect a locale, we'll only index localized tags for this translation. For instance, an article with those tags: | ||
@@ -312,6 +243,3 @@ ```coffee | ||
For `fr` and `fr-*` locales, we'll index `{ "label_names": ["Incroyable"] }`. | ||
For `en-au`, `en-ca` and `en-us` locales, we'll index `{ "label_names": ["Awesome"] }`. | ||
For the `en-gb` locale, we'll index `{ "label_names": ["Good"] }`. | ||
For all the other locales, we'll index `{ "label_names": ["Wow"] }`. | ||
For `fr` and `fr-*` locales, we'll index `{ "label_names": ["Incroyable"] }`. For `en-au`, `en-ca` and `en-us` locales, we'll index `{ "label_names": ["Awesome"] }`. For the `en-gb` locale, we'll index `{ "label_names": ["Good"] }`. For all the other locales, we'll index `{ "label_names": ["Wow"] }`. | ||
@@ -324,56 +252,26 @@ ### Zendesk Community search | ||
Since we're providing a front-end search, and we can't securely know which access a user has in Zendesk's templates, we have to limit our indexing to public articles only. | ||
A public article is not a draft and is visible to Everybody. | ||
If you're in such a scenario, we recommend you to disable `instantsearch` by setting `enabled: false` and just use the auto-complete feature. | ||
Since we're providing a front-end search, and we can't securely know which access a user has in Zendesk's templates, we have to limit our indexing to public articles only. A public article is not a draft and is visible to Everybody. If you're in such a scenario, we recommend you to disable `instantsearch` by setting `enabled: false` and just use the auto-complete feature. | ||
### Removing specific articles from the search results | ||
You can let our script know that you'd want for an article not to be indexed. For this, all you need to do is to add an `algolia-ignore` tag on your article. | ||
After the next reindex, the article should not be searchable anymore. | ||
You can let our script know that you'd want for an article not to be indexed. For this, all you need to do is to add an `algolia-ignore` tag on your article. After the next reindex, the article should not be searchable anymore. | ||
### Excluding portions of article from indexing | ||
To prevent certain specific portion of your article to be indexed to Algolia, you can wrap the html source code of these portion between `<!-- algolia-ignore --> <!-- /algolia-ignore -->` tags. This way, these portions of text won't be searchable. | ||
To prevent certain specific portion of your article to be indexed to Algolia, you can wrap the html source code of these portion between `<!-- algolia-ignore --> <!-- /algolia-ignore -->` tags. This way, these portions of text won't be searchable. | ||
Example: | ||
```html | ||
<h1>This is a test article</h1> | ||
<!-- algolia-ignore --> | ||
<p> | ||
This paragraph won't be indexed to Algolia. | ||
</p> | ||
<p>This paragraph won't be indexed to Algolia.</p> | ||
<!-- /algolia-ignore --> | ||
<p> | ||
This paragraph will be indexed to Algolia. | ||
</p> | ||
<p>This paragraph will be indexed to Algolia.</p> | ||
``` | ||
### Analytics | ||
### Whitelisting our IPs | ||
The `analytics` parameter enables searches capturing, for reports about popular queries, searches without results, and more. It defaults to `true`. | ||
In case you're using Zendesk's [IP restrictions feature](https://support.zendesk.com/hc/en-us/articles/203663706-Restricting-access-to-Zendesk-Support-and-your-Help-Center-using-IP-restrictions), you'll need to whitelist our IPs for our indexing to work. Here are those IPs: | ||
The `clickAnalytics` parameter enables click capturing in search results, for reports about the click rate and average position of clicks for specific queries. It defaults to `false`, as this feature is only accessible on our Enterprise plan. | ||
With `clickAnalytics` enabled, you can use `algoliasearchZendeskHC.trackConversion()` on an article page to capture a “conversion” if your articles include Calls To Action. | ||
### Modifying templates | ||
__WARNING__: We don't provide any guarantee that we won't change the templates between versions. | ||
If you chose to modify a template, you'll need to lock your version to MAJOR.MINOR.PATCH instead of just MAJOR in | ||
```html | ||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/2/algoliasearch.zendesk-hc.min.css"> | ||
<script type="text/javascript" src="//cdn.jsdelivr.net/algoliasearch.zendesk-hc/2/algoliasearch.zendesk-hc.min.js"></script> | ||
``` | ||
The latest version is [![version](https://img.shields.io/npm/v/algoliasearch.zendesk-hc.png)](https://www.npmjs.com/package/algoliasearch.zendesk-hc). | ||
With your version locked in place, you can now look at [`templates.js`](https://github.com/algolia/algoliasearch-zendesk/blob/master/app/src/templates.js) to know which keys you can override. | ||
The code here is ES6, you'll need to rewrite your custom template using Vanilla JavaScript instead. | ||
Also, some templates are using a `compile` function in this file. This function is internally calling the [`Hogan.js` template engine](http://mustache.github.io/mustache.5.html) with square brackets instead of braces (because Zendesk templates already use braces). This function is available using `algoliasearchZendeskHC.compile`. | ||
### Whitelisting our IPs | ||
In case you're using Zendesk's [IP restrictions feature](https://support.zendesk.com/hc/en-us/articles/203663706-Restricting-access-to-Zendesk-Support-and-your-Help-Center-using-IP-restrictions), you'll need to whitelist our IPs for our indexing to work. | ||
Here are those IPs: | ||
- `3.221.200.5` | ||
@@ -386,81 +284,9 @@ - `52.204.20.39` | ||
The `package.json` holds multiple scripts: | ||
- `build:css`: Compiles the CSS files to `dist/algoliasearch.zendesk-hc.css` | ||
- `build:docs`: Extracts the documentation from this `README.md` to [`../docs/documentation.md`](../docs/documentation.md) | ||
- `build:js`: Compiles the JS files to `dist/algoliasearch.zendesk-hc.js` and `dist-es5-module/*.js` | ||
- `build`: Launches all 3 previous builds | ||
- `clean`: Removes `dist/` and `dist-es5-module` | ||
- `dev`: Launches `build` and `server`, and watches the files to rebuild them if needed | ||
- `clean`: Removes `dist/` and `node_modules/` | ||
- `build`: Compiles the JS & CSS files to `dist/algoliasearch.zendesk-hc.{css,js}` | ||
- `dev`: Launches `parcel`, and watches the files to rebuild them if needed | ||
- `lint`: Lints the JS files | ||
- `server`: Runs a simple HTTP server pointing to `dist/` | ||
- `test:coverage`: Runs `test` with coverage enabled | ||
- `test`: Runs the test suite | ||
- `format`: Runs prettier | ||
`build:js`, `build:css`, `build` and `dev` can be passed a `NODE_ENV` environment variable. | ||
If set to production, it also creates minified files and map files. | ||
`server` accepts a `PORT` environment variable to change on which port it will run. | ||
### Example | ||
```sh | ||
$ PORT=3005 npm run dev | ||
> algoliasearch.zendesk-hc@2.22.3 dev /Users/jerska/algolia/zendesk/app | ||
> gulp dev | ||
[13:59:53] Failed to load external module @babel/register | ||
[13:59:53] Requiring external module babel-register | ||
[13:59:56] Using gulpfile ~/algolia/zendesk/app/gulpfile.babel.js | ||
[13:59:56] Starting 'build:js:watch'... | ||
[13:59:56] Environment for 'build:js': NODE_ENV=development | ||
[13:59:56] Starting 'build:css'... | ||
[13:59:56] Environment for 'build:css': NODE_ENV=development | ||
[13:59:56] Starting 'build:css:watcher'... | ||
[13:59:56] Finished 'build:css:watcher' after 8.64 ms | ||
[13:59:56] Starting 'build:docs'... | ||
[13:59:56] Starting 'build:docs:watcher'... | ||
[13:59:56] Finished 'build:docs:watcher' after 1.11 ms | ||
[13:59:56] Starting 'server'... | ||
[13:59:56] Finished 'server' after 42 ms | ||
[13:59:56] Server started http://localhost:3005 | ||
[13:59:56] Finished 'build:docs' after 66 ms | ||
[13:59:56] Starting 'build:docs:watch'... | ||
[13:59:56] Finished 'build:docs:watch' after 40 μs | ||
[13:59:56] Finished 'build:css' after 109 ms | ||
[13:59:56] Starting 'build:css:watch'... | ||
[13:59:56] Finished 'build:css:watch' after 3.4 μs | ||
[14:00:00] Finished 'build:js:watch' after 4.05 s | ||
[14:00:00] Starting 'dev'... | ||
[14:00:00] Finished 'dev' after 2.68 μs | ||
``` | ||
When running, you can then add this custom script to your Help Center, inside the Document Head template: | ||
```html | ||
<link rel="stylesheet" type="text/css" href="http://localhost:3005/dist/algoliasearch.zendesk-hc.css"> | ||
<script type="text/javascript" src="http://localhost:3005/dist/algoliasearch.zendesk-hc.js"></script> | ||
<script type="text/javascript"> | ||
algoliasearchZendeskHC({ | ||
applicationId: 'FIXME', | ||
apiKey: 'FIXME', | ||
subdomain: 'FIXME', | ||
}) | ||
</script> | ||
``` | ||
This might however not load, due to trying to load HTTP content on an HTTPS site. | ||
Some browsers will prevent the connection and print warnings in your browser console. | ||
In this case, you'll need to authorize insecure loading. | ||
This will most often be hidden behind a shield icon or the green lock icon in your location bar. | ||
For instance, on Firefox: click the lock icon in the location bar > Right arrow with label "Show connection details" > Disable protection for now | ||
### Documentation | ||
To update the documentation of the project, you only need to update this README. | ||
To propagate the changes to the `docs/` website, you simply need to run: | ||
```sh | ||
npm run build:docs | ||
``` | ||
## Contributing | ||
@@ -467,0 +293,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
13
0
2
2079853
13
7
1963
2
284
9
+ Added@algolia/autocomplete-plugin-algolia-insights@1.0.0-alpha.43
+ Added@algolia/autocomplete-plugin-recent-searches@1.0.0-alpha.43
+ Added@algolia/client-search@4.8.3
+ Addedfargs@^1.1.1
+ Addedlodash@^4.17.21
+ Addedpreact@^10.5.12
+ Addedsearch-insights@1.6.3
+ Addedto-factory@^1.0.0
+ Added@algolia/autocomplete-core@1.0.0-alpha.43(transitive)
+ Added@algolia/autocomplete-js@1.0.0-alpha.43(transitive)
+ Added@algolia/autocomplete-plugin-algolia-insights@1.0.0-alpha.43(transitive)
+ Added@algolia/autocomplete-plugin-recent-searches@1.0.0-alpha.43(transitive)
+ Added@algolia/autocomplete-preset-algolia@1.0.0-alpha.43(transitive)
+ Added@algolia/autocomplete-shared@1.0.0-alpha.43(transitive)
+ Added@algolia/autocomplete-theme-classic@1.0.0-alpha.43(transitive)
+ Added@algolia/cache-browser-local-storage@4.8.3(transitive)
+ Added@algolia/cache-common@4.8.3(transitive)
+ Added@algolia/cache-in-memory@4.8.3(transitive)
+ Added@algolia/client-account@4.8.3(transitive)
+ Added@algolia/client-analytics@4.8.3(transitive)
+ Added@algolia/client-common@4.8.3(transitive)
+ Added@algolia/client-recommendation@4.8.3(transitive)
+ Added@algolia/client-search@4.8.3(transitive)
+ Added@algolia/logger-common@4.8.3(transitive)
+ Added@algolia/logger-console@4.8.3(transitive)
+ Added@algolia/requester-browser-xhr@4.8.3(transitive)
+ Added@algolia/requester-common@4.8.3(transitive)
+ Added@algolia/requester-node-http@4.8.3(transitive)
+ Added@algolia/transporter@4.8.3(transitive)
+ Addedalgoliasearch@4.8.3(transitive)
+ Addedfargs@1.1.1(transitive)
+ Addedpreact@10.24.3(transitive)
+ Addedsearch-insights@1.6.3(transitive)
- Removedautocomplete.js@^0.28.1
- Removedhogan.js@^3.0.2
- Removedinstantsearch.js@^1.0.0
- Removedstopwords@https://github.com/6/stopwords/tarball/ccec79a4ba22d65eb095bc277d79a7ad8096552c
- Removedunorm@^1.4.1
- Removedvietnamese-stopwords@0.0.2
- Removedabbrev@1.1.1(transitive)
- Removedagentkeepalive@2.2.0(transitive)
- Removedalgoliasearch@3.35.1(transitive)
- Removedalgoliasearch-helper@2.28.1(transitive)
- Removedasap@2.0.6(transitive)
- Removedautocomplete.js@0.28.3(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedclassnames@2.5.1(transitive)
- Removedclean-css@4.2.4(transitive)
- Removedclean-css-cli@4.3.0(transitive)
- Removedcommander@2.20.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddom-walk@0.1.2(transitive)
- Removedencoding@0.1.13(transitive)
- Removedenvify@4.1.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedesprima@4.0.1(transitive)
- Removedevents@1.1.1(transitive)
- Removedfbjs@0.8.18(transitive)
- Removedforeach@2.0.6(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedglob@7.2.3(transitive)
- Removedglobal@4.4.0(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhogan.js@3.0.2(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedimmediate@3.3.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedinstantsearch.js@1.12.1(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisarray@2.0.5(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedload-script@1.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedmin-document@2.19.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedmkdirp@0.3.0(transitive)
- Removedms@2.0.0(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removednopt@1.0.10(transitive)
- Removednouislider-algolia-fork@10.0.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprocess@0.11.10(transitive)
- Removedpromise@7.3.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedqs@6.13.1(transitive)
- Removedquerystring-es3@0.2.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedreact-dom@15.7.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedreact-nouislider@1.14.2(transitive)
- Removedreduce@1.0.3(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsemver@5.7.2(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedthrough@2.3.8(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedua-parser-js@0.7.39(transitive)
- Removedunorm@1.6.0(transitive)
- Removedvietnamese-stopwords@0.0.2(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedalgoliasearch@4.8.3