@websolutespa/bom-mixer-hooks 1.8.0 → 1.8.1

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
@@ -1,5 +1,12 @@
1
1
  # @websolutespa/bom-mixer-hooks
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @websolutespa/bom-core@1.8.5
9
+
3
10
  ## 1.8.0
4
11
 
5
12
  ### Minor Changes
package/dist/index.js CHANGED
@@ -1691,16 +1691,6 @@ var import_bom_core8 = require("@websolutespa/bom-core");
1691
1691
  var import_router2 = require("next/router");
1692
1692
  var import_react32 = require("react");
1693
1693
  var USE_ENCRYPTION = true;
1694
- function base64ToString(base64) {
1695
- if (!USE_ENCRYPTION)
1696
- return base64;
1697
- return import_bom_core8.isBrowser ? window.atob(base64) : Buffer.from(base64, "base64").toString();
1698
- }
1699
- function stringToBase64(text) {
1700
- if (!USE_ENCRYPTION)
1701
- return text;
1702
- return import_bom_core8.isBrowser ? window.btoa(text) : Buffer.from(text).toString("base64");
1703
- }
1704
1694
  function stringToURLSearchParams(url) {
1705
1695
  return new URLSearchParams(url);
1706
1696
  }
@@ -1736,7 +1726,7 @@ function serialize_2(url, value, key) {
1736
1726
  function decode(encoded, key) {
1737
1727
  let decoded = null;
1738
1728
  if (encoded) {
1739
- const json = base64ToString(encoded);
1729
+ const json = USE_ENCRYPTION ? (0, import_bom_core8.base64ToString)(encoded) : encoded;
1740
1730
  decoded = JSON.parse(json);
1741
1731
  }
1742
1732
  if (key && decoded) {
@@ -1753,7 +1743,7 @@ function encode(params, value, key) {
1753
1743
  params = Object.assign(params, value);
1754
1744
  }
1755
1745
  const json = JSON.stringify(params);
1756
- encoded = stringToBase64(json);
1746
+ encoded = USE_ENCRYPTION ? (0, import_bom_core8.stringToBase64)(json) : json;
1757
1747
  return encoded;
1758
1748
  }
1759
1749
  function searchParamsToObject_2(params) {
package/dist/index.mjs CHANGED
@@ -1551,20 +1551,10 @@ function useSearchParamsValue(key) {
1551
1551
  }
1552
1552
 
1553
1553
  // src/useSearchParamsEncoded/useSearchParamsEncoded.ts
1554
- import { isBrowser as isBrowser4 } from "@websolutespa/bom-core";
1554
+ import { base64ToString, isBrowser as isBrowser4, stringToBase64 } from "@websolutespa/bom-core";
1555
1555
  import { useRouter as useRouter2 } from "next/router";
1556
1556
  import { useCallback as useCallback6, useMemo as useMemo6 } from "react";
1557
1557
  var USE_ENCRYPTION = true;
1558
- function base64ToString(base64) {
1559
- if (!USE_ENCRYPTION)
1560
- return base64;
1561
- return isBrowser4 ? window.atob(base64) : Buffer.from(base64, "base64").toString();
1562
- }
1563
- function stringToBase64(text) {
1564
- if (!USE_ENCRYPTION)
1565
- return text;
1566
- return isBrowser4 ? window.btoa(text) : Buffer.from(text).toString("base64");
1567
- }
1568
1558
  function stringToURLSearchParams(url) {
1569
1559
  return new URLSearchParams(url);
1570
1560
  }
@@ -1600,7 +1590,7 @@ function serialize_2(url, value, key) {
1600
1590
  function decode(encoded, key) {
1601
1591
  let decoded = null;
1602
1592
  if (encoded) {
1603
- const json = base64ToString(encoded);
1593
+ const json = USE_ENCRYPTION ? base64ToString(encoded) : encoded;
1604
1594
  decoded = JSON.parse(json);
1605
1595
  }
1606
1596
  if (key && decoded) {
@@ -1617,7 +1607,7 @@ function encode(params, value, key) {
1617
1607
  params = Object.assign(params, value);
1618
1608
  }
1619
1609
  const json = JSON.stringify(params);
1620
- encoded = stringToBase64(json);
1610
+ encoded = USE_ENCRYPTION ? stringToBase64(json) : json;
1621
1611
  return encoded;
1622
1612
  }
1623
1613
  function searchParamsToObject_2(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-hooks",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Mixer Hooks module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -1,19 +1,9 @@
1
- import { isBrowser } from '@websolutespa/bom-core';
1
+ import { base64ToString, isBrowser, stringToBase64 } from '@websolutespa/bom-core';
2
2
  import { NextRouter, useRouter } from 'next/router';
3
3
  import { useCallback, useMemo } from 'react';
4
4
 
5
5
  const USE_ENCRYPTION = true;
6
6
 
7
- function base64ToString(base64: string): string {
8
- if (!USE_ENCRYPTION) return base64;
9
- return isBrowser ? window.atob(base64) : Buffer.from(base64, 'base64').toString();
10
- }
11
-
12
- function stringToBase64(text: string): string {
13
- if (!USE_ENCRYPTION) return text;
14
- return isBrowser ? window.btoa(text) : Buffer.from(text).toString('base64');
15
- }
16
-
17
7
  function stringToURLSearchParams(url: string): URLSearchParams {
18
8
  // console.log('stringToURLSearchParams', url);
19
9
  return new URLSearchParams(url);
@@ -92,7 +82,7 @@ function serialize_(url: string, value: IParamsEncoded, key?: string): URLSearch
92
82
  function decode(encoded: string | null | undefined, key?: string): IParamsEncoded {
93
83
  let decoded = null;
94
84
  if (encoded) {
95
- const json = base64ToString(encoded);
85
+ const json = USE_ENCRYPTION ? base64ToString(encoded) : encoded;
96
86
  decoded = JSON.parse(json);
97
87
  }
98
88
  // console.log('useSearchParamsEncoded.decode', decoded);
@@ -112,7 +102,7 @@ function encode(params: IParamsEncoded, value: IParamsEncoded, key?: string) {
112
102
  }
113
103
  // console.log('useSearchParamsEncoded.encode', params);
114
104
  const json = JSON.stringify(params);
115
- encoded = stringToBase64(json);
105
+ encoded = USE_ENCRYPTION ? stringToBase64(json) : json;
116
106
  return encoded;
117
107
  }
118
108