|
1 |
| -define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) { |
| 1 | +define( |
| 2 | + ['jquery', 'algoliaBundle', 'Magento_PageCache/js/form-key-provider',], function ($, algoliaBundle, formKeyInit) { |
2 | 3 | // Character maps supplied for more performant Regex ops
|
3 | 4 | const SPECIAL_CHAR_ENCODE_MAP = {
|
4 | 5 | '&': '&',
|
@@ -98,15 +99,26 @@ define(['jquery', 'algoliaBundle'], function ($, algoliaBundle) {
|
98 | 99 | return check;
|
99 | 100 | };
|
100 | 101 |
|
101 |
| - window.getCookie = function (name) { |
102 |
| - var value = "; " + document.cookie; |
103 |
| - var parts = value.split("; " + name + "="); |
104 |
| - if (parts.length == 2) { |
105 |
| - return parts.pop().split(";").shift(); |
| 102 | + window.getCookie = function(name) { |
| 103 | + let cookie, i; |
| 104 | + |
| 105 | + const cookieName = name + "=", |
| 106 | + cookieArr = document.cookie.split(';'); |
| 107 | + |
| 108 | + for (i = 0; i < cookieArr.length; i++) { |
| 109 | + cookie = cookieArr[i]; |
| 110 | + |
| 111 | + while (cookie.charAt(0) === ' ') { |
| 112 | + cookie = cookie.substring(1, cookie.length); |
| 113 | + } |
| 114 | + |
| 115 | + if (cookie.indexOf(cookieName) === 0) { |
| 116 | + return cookie.substring(cookieName.length, cookie.length); |
| 117 | + } |
106 | 118 | }
|
107 | 119 |
|
108 | 120 | return "";
|
109 |
| - }; |
| 121 | + } |
110 | 122 |
|
111 | 123 | window.transformHit = function (hit, price_key, helper) {
|
112 | 124 | if (Array.isArray(hit.categories))
|
|
0 commit comments