@eightshift/frontend-libs-tailwind 1.4.7 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
6
6
 
7
7
  ---
8
8
 
9
+ ## [1.4.8]
10
+
11
+ ### Added
12
+
13
+ - `domain parameter` to setCookie function.
14
+
9
15
  ## [1.4.7]
10
16
 
11
17
  ### Changed
@@ -169,6 +175,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
169
175
  - Initial release.
170
176
 
171
177
  [Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD
178
+ [1.4.8]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.7...1.4.8
172
179
  [1.4.7]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.6...1.4.7
173
180
  [1.4.6]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.5...1.4.6
174
181
  [1.4.5]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.4...1.4.5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/frontend-libs-tailwind",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
5
5
  "author": {
6
6
  "name": "Eightshift team",
@@ -2,6 +2,7 @@
2
2
  * Helper to set and unset cookies.
3
3
  */
4
4
  export const cookies = {
5
+
5
6
  /**
6
7
  * Set a cookie value
7
8
  *
@@ -9,7 +10,7 @@ export const cookies = {
9
10
  * @param {string} value - Cookie value.
10
11
  * @param {number} time - Number denoting the expiration of the cookie.
11
12
  * @param {string} path - URL path that must exist in the requested URL in order to send the Cookie header.
12
- *
13
+ * @param {string?} domain - Cookie domain. Optional.
13
14
  * @access public
14
15
  *
15
16
  * @returns {void}
@@ -19,16 +20,22 @@ export const cookies = {
19
20
  * cookies.setCookie('gdpr', '2', cookies.setOneDay(), '/');
20
21
  * ```
21
22
  */
22
- setCookie(key, value, time, path) {
23
+ setCookie(key, value, time, path, domain) {
23
24
  const expires = new Date();
24
- expires.setTime(expires.getTime() + time);
25
+ expires.setTime(expires.getTime() + (time));
26
+
25
27
  let pathValue = '';
28
+ let domainValue = '';
26
29
 
27
30
  if (typeof path !== 'undefined') {
28
- pathValue = `path=${path};`;
31
+ pathValue = `;path=${path}`;
32
+ }
33
+
34
+ if (typeof domain !== 'undefined') {
35
+ domainValue = `;domain=${domain}`;
29
36
  }
30
37
 
31
- document.cookie = `${key}=${value};${pathValue}expires=${expires.toUTCString()}`;
38
+ document.cookie = `${key}=${value}${pathValue}${domainValue};expires=${expires.toUTCString()}`;
32
39
  },
33
40
 
34
41
  /**
package/bun.lockb DELETED
Binary file