@uniformdev/context-react
Advanced tools
Comparing version 19.159.1-alpha.16 to 19.159.1-alpha.27
@@ -47,5 +47,6 @@ 'use client'; | ||
var import_react = require("react"); | ||
function useQuirks() { | ||
const { context } = useUniformContext(); | ||
const [quirks, setQuirks] = (0, import_react.useState)(context.quirks); | ||
function useQuirks(options) { | ||
var _a; | ||
const { context } = useUniformContext(options) || {}; | ||
const [quirks, setQuirks] = (0, import_react.useState)((_a = context == null ? void 0 : context.quirks) != null ? _a : {}); | ||
const quirkChangeListener = (updatedQuirks) => { | ||
@@ -55,5 +56,5 @@ setQuirks(updatedQuirks); | ||
(0, import_react.useEffect)(() => { | ||
context.events.on("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener); | ||
return () => { | ||
context.events.off("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener); | ||
}; | ||
@@ -318,4 +319,3 @@ }, [context]); | ||
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue; | ||
if (cannotTrack || !wrapperEl.current) | ||
return; | ||
if (cannotTrack || !wrapperEl.current) return; | ||
const enrichments = Array.isArray(behavior) ? behavior : [behavior]; | ||
@@ -394,4 +394,3 @@ const pushBehaviorEnrichment = () => { | ||
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue; | ||
if (cannotTrack) | ||
return; | ||
if (cannotTrack) return; | ||
const pushBehaviorEnrichment = () => { | ||
@@ -398,0 +397,0 @@ if (hasTracked) { |
@@ -9,3 +9,3 @@ import { Quirks, ScoreVector, Context, PersonalizedVariant, TestVariant, EnrichmentData } from '@uniformdev/context'; | ||
*/ | ||
declare function useQuirks(): Quirks; | ||
declare function useQuirks(options?: Parameters<typeof useUniformContext>[0]): Quirks; | ||
@@ -12,0 +12,0 @@ /** |
@@ -5,5 +5,6 @@ 'use client'; | ||
import { useEffect, useState } from "react"; | ||
function useQuirks() { | ||
const { context } = useUniformContext(); | ||
const [quirks, setQuirks] = useState(context.quirks); | ||
function useQuirks(options) { | ||
var _a; | ||
const { context } = useUniformContext(options) || {}; | ||
const [quirks, setQuirks] = useState((_a = context == null ? void 0 : context.quirks) != null ? _a : {}); | ||
const quirkChangeListener = (updatedQuirks) => { | ||
@@ -13,5 +14,5 @@ setQuirks(updatedQuirks); | ||
useEffect(() => { | ||
context.events.on("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener); | ||
return () => { | ||
context.events.off("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener); | ||
}; | ||
@@ -276,4 +277,3 @@ }, [context]); | ||
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue; | ||
if (cannotTrack || !wrapperEl.current) | ||
return; | ||
if (cannotTrack || !wrapperEl.current) return; | ||
const enrichments = Array.isArray(behavior) ? behavior : [behavior]; | ||
@@ -352,4 +352,3 @@ const pushBehaviorEnrichment = () => { | ||
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue; | ||
if (cannotTrack) | ||
return; | ||
if (cannotTrack) return; | ||
const pushBehaviorEnrichment = () => { | ||
@@ -356,0 +355,0 @@ if (hasTracked) { |
@@ -47,5 +47,6 @@ 'use client'; | ||
var import_react = require("react"); | ||
function useQuirks() { | ||
const { context } = useUniformContext(); | ||
const [quirks, setQuirks] = (0, import_react.useState)(context.quirks); | ||
function useQuirks(options) { | ||
var _a; | ||
const { context } = useUniformContext(options) || {}; | ||
const [quirks, setQuirks] = (0, import_react.useState)((_a = context == null ? void 0 : context.quirks) != null ? _a : {}); | ||
const quirkChangeListener = (updatedQuirks) => { | ||
@@ -55,5 +56,5 @@ setQuirks(updatedQuirks); | ||
(0, import_react.useEffect)(() => { | ||
context.events.on("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.on("quirksUpdated", quirkChangeListener); | ||
return () => { | ||
context.events.off("quirksUpdated", quirkChangeListener); | ||
context == null ? void 0 : context.events.off("quirksUpdated", quirkChangeListener); | ||
}; | ||
@@ -318,4 +319,3 @@ }, [context]); | ||
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue; | ||
if (cannotTrack || !wrapperEl.current) | ||
return; | ||
if (cannotTrack || !wrapperEl.current) return; | ||
const enrichments = Array.isArray(behavior) ? behavior : [behavior]; | ||
@@ -394,4 +394,3 @@ const pushBehaviorEnrichment = () => { | ||
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue; | ||
if (cannotTrack) | ||
return; | ||
if (cannotTrack) return; | ||
const pushBehaviorEnrichment = () => { | ||
@@ -398,0 +397,0 @@ if (hasTracked) { |
{ | ||
"name": "@uniformdev/context-react", | ||
"version": "19.159.1-alpha.16+112313047e", | ||
"version": "19.159.1-alpha.27+344f3d36db", | ||
"description": "Uniform Context React integration package", | ||
@@ -34,3 +34,3 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"dependencies": { | ||
"@uniformdev/context": "19.159.1-alpha.16+112313047e", | ||
"@uniformdev/context": "19.159.1-alpha.27+344f3d36db", | ||
"cookie": "0.6.0", | ||
@@ -49,3 +49,3 @@ "dequal": "2.0.3" | ||
}, | ||
"gitHead": "112313047e98c7a1c0045ea1c5d01a4c74b29871" | ||
"gitHead": "344f3d36dba87d4e2340a1687c20b163be1d2c83" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
109820
21
35
5
302
2073