hyperauto-cookie
v1.0.19
Published
Hyperauto cookie utilities
Downloads
27
Readme
Пакет для работы с cookie Гиперавто.
Установка и использование
Устанавливаем пакет.
npm i hyperauto-cookie
Заходим в его директорию и генерируем бандл.
cd node_modules/hyperauto_cookie/
npm run build
На всех страницах, где необходимо фиксировать/отслеживать предпочтения пользователя, подключить 2 файла:
node_modules/hyperauto-cookie/bundle.css
- файл со стилямиnode_modules/hyperauto-cookie/bundle.js
- скрипт
На момент последнего релиза логика сервиса предельно проста и заключается в следующем: сервис проверяет, есть ли на клиенте cookie с именем city, и, если нет, делает запрос на получение модального окна со списком доступных городов, после чего прикрепляет полученный HTML к DOM и вызывает показ модального окна.
Модальное окно невозможно закрыть всеми традиционными способами (ESC, backdrop click, close button). После выбора города, сервис кладет cookie c именем city и данными выбранного города, с временем жизни в год и действительную для домена hyperauto.ru и всех его поддоменов.