@uniformdev/context-react 19.164.0 → 19.165.0
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +6 -5
- package/dist/index.js +6 -5
- package/dist/index.mjs +6 -5
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import react__default, { ReactNode, ReactElement, HTMLAttributes } from 'react';
|
|
|
6
6
|
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
7
7
|
* This can be used when you want to read current quirk values directly.
|
|
8
8
|
*/
|
|
9
|
-
declare function useQuirks(): Quirks;
|
|
9
|
+
declare function useQuirks(options?: Parameters<typeof useUniformContext>[0]): Quirks;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Provides reactive access to the Uniform Context's current visitor scores values.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import react__default, { ReactNode, ReactElement, HTMLAttributes } from 'react';
|
|
|
6
6
|
* Provides reactive access to the Uniform Context's current visitor quirks values
|
|
7
7
|
* This can be used when you want to read current quirk values directly.
|
|
8
8
|
*/
|
|
9
|
-
declare function useQuirks(): Quirks;
|
|
9
|
+
declare function useQuirks(options?: Parameters<typeof useUniformContext>[0]): Quirks;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Provides reactive access to the Uniform Context's current visitor scores values.
|
package/dist/index.esm.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
// src/hooks/useQuirks.ts
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
|
-
function useQuirks() {
|
|
6
|
-
|
|
7
|
-
const
|
|
5
|
+
function useQuirks(options) {
|
|
6
|
+
var _a;
|
|
7
|
+
const { context } = useUniformContext(options) || {};
|
|
8
|
+
const [quirks, setQuirks] = useState((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
8
9
|
const quirkChangeListener = (updatedQuirks) => {
|
|
9
10
|
setQuirks(updatedQuirks);
|
|
10
11
|
};
|
|
11
12
|
useEffect(() => {
|
|
12
|
-
context.events.on("quirksUpdated", quirkChangeListener);
|
|
13
|
+
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener);
|
|
13
14
|
return () => {
|
|
14
|
-
context.events.off("quirksUpdated", quirkChangeListener);
|
|
15
|
+
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener);
|
|
15
16
|
};
|
|
16
17
|
}, [context]);
|
|
17
18
|
return quirks;
|
package/dist/index.js
CHANGED
|
@@ -44,16 +44,17 @@ module.exports = __toCommonJS(src_exports);
|
|
|
44
44
|
|
|
45
45
|
// src/hooks/useQuirks.ts
|
|
46
46
|
var import_react = require("react");
|
|
47
|
-
function useQuirks() {
|
|
48
|
-
|
|
49
|
-
const
|
|
47
|
+
function useQuirks(options) {
|
|
48
|
+
var _a;
|
|
49
|
+
const { context } = useUniformContext(options) || {};
|
|
50
|
+
const [quirks, setQuirks] = (0, import_react.useState)((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
50
51
|
const quirkChangeListener = (updatedQuirks) => {
|
|
51
52
|
setQuirks(updatedQuirks);
|
|
52
53
|
};
|
|
53
54
|
(0, import_react.useEffect)(() => {
|
|
54
|
-
context.events.on("quirksUpdated", quirkChangeListener);
|
|
55
|
+
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener);
|
|
55
56
|
return () => {
|
|
56
|
-
context.events.off("quirksUpdated", quirkChangeListener);
|
|
57
|
+
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener);
|
|
57
58
|
};
|
|
58
59
|
}, [context]);
|
|
59
60
|
return quirks;
|
package/dist/index.mjs
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
// src/hooks/useQuirks.ts
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
|
-
function useQuirks() {
|
|
6
|
-
|
|
7
|
-
const
|
|
5
|
+
function useQuirks(options) {
|
|
6
|
+
var _a;
|
|
7
|
+
const { context } = useUniformContext(options) || {};
|
|
8
|
+
const [quirks, setQuirks] = useState((_a = context == null ? void 0 : context.quirks) != null ? _a : {});
|
|
8
9
|
const quirkChangeListener = (updatedQuirks) => {
|
|
9
10
|
setQuirks(updatedQuirks);
|
|
10
11
|
};
|
|
11
12
|
useEffect(() => {
|
|
12
|
-
context.events.on("quirksUpdated", quirkChangeListener);
|
|
13
|
+
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener);
|
|
13
14
|
return () => {
|
|
14
|
-
context.events.off("quirksUpdated", quirkChangeListener);
|
|
15
|
+
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener);
|
|
15
16
|
};
|
|
16
17
|
}, [context]);
|
|
17
18
|
return quirks;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/context-react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.165.0",
|
|
4
4
|
"description": "Uniform Context React integration package",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react-dom": "18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@uniformdev/context": "19.
|
|
34
|
+
"@uniformdev/context": "19.165.0",
|
|
35
35
|
"cookie": "0.6.0",
|
|
36
36
|
"dequal": "2.0.3"
|
|
37
37
|
},
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "edbe5a9fe21137f383003c6f604934dc9501b6e6"
|
|
49
49
|
}
|