Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uniformdev/context-react

Package Overview
Dependencies
Maintainers
9
Versions
639
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniformdev/context-react - npm Package Compare versions

Comparing version 13.0.1-alpha.133 to 13.0.1-alpha.271

2

dist/index.js

@@ -1,1 +0,1 @@

var it=Object.create;var v=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty;var B=t=>v(t,"__esModule",{value:!0});var ft=(t,e)=>{for(var o in e)v(t,o,{get:e[o],enumerable:!0})},Q=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of at(e))!pt.call(t,r)&&(o||r!=="default")&&v(t,r,{get:()=>e[r],enumerable:!(n=st(e,r))||n.enumerable});return t},C=(t,e)=>Q(B(v(t!=null?it(mt(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),ut=(t=>(e,o)=>t&&t.get(e)||(o=Q(B({}),e,1),t&&t.set(e,o),o))(typeof WeakMap!="undefined"?new WeakMap:0);var Pt={};ft(Pt,{Personalize:()=>dt,Test:()=>lt,Track:()=>Ct,TrackFragment:()=>gt,UniformContext:()=>xt,useQuirks:()=>ct,useScores:()=>A,useUniformContext:()=>s});var W=require("react");var M=require("react"),L=(0,M.createContext)(void 0),_=(0,M.createContext)({});function s(t={}){let{throwOnMissingProvider:e=!0}=t,o=(0,W.useContext)(L);if(e){if(o===void 0)throw new Error("useUniformContext must be used within a <UniformContext> provider");return o}return o}var w=require("react");function ct(){let{context:t}=s(),[e,o]=(0,w.useState)(t.storage.data.quirks),n=r=>{o(r)};return(0,w.useEffect)(()=>(t.events.on("quirksUpdated",n),()=>{t.events.off("quirksUpdated",n)}),[t]),e}var I=require("react");var j=require("dequal/lite");function A(){let{context:t}=s(),[e,o]=(0,I.useState)(t.scores);return(0,I.useEffect)(()=>{let n=m=>{o(m)},r=t.scores;return(0,j.dequal)(e,r)||o(r),t.events.on("scoresUpdated",n),()=>{t.events.off("scoresUpdated",n)}},[t]),e}var F=C(require("react"));var y=C(require("react"));function X({variations:t,component:e,wrapperComponent:o,name:n,count:r=1}){let{context:m}=s(),i=A(),{variations:c,personalized:g}=(0,y.useMemo)(()=>m.personalize({name:n,variations:t,take:r}),[i,m,r,n,t]),P=o!=null?o:({children:T})=>y.default.createElement(y.default.Fragment,null,T),h=e;return y.default.createElement(_.Provider,{value:{personalized:!0}},c.length?y.default.createElement(P,{personalizationOccurred:g},c.map(T=>y.default.createElement(h,{key:T.id,personalizationResult:{variation:T,personalizationOccurred:g},...T}))):null)}var U=require("@uniformdev/context"),p=C(require("react"));var G=require("@uniformdev/context"),K=require("react"),x=t=>(0,K.createElement)(G.EdgeNodeTagName,t);function Y(t){let{variations:e,count:o,component:n}=t,r={count:o!=null?o:1},m=n;return p.default.createElement(p.default.Fragment,null,p.default.createElement(x,{"data-type":U.ScriptType.ListStart,dangerouslySetInnerHTML:{__html:JSON.stringify(r)}}),e.map(i=>p.default.createElement(p.Fragment,{key:i.id},p.default.createElement(x,{"data-type":U.ScriptType.ListItemSettings,dangerouslySetInnerHTML:{__html:JSON.stringify({id:i.id,pz:i.pz||null})}}),p.default.createElement(x,{"data-type":U.ScriptType.ListItem},p.default.createElement(m,{key:i.id,personalizationResult:{variation:i,personalizationOccurred:!1},...i})))),p.default.createElement(x,{"data-type":U.ScriptType.ListEnd}))}var E=typeof window=="undefined";function dt(t){let{outputType:e}=s();return!E||e==="standard"?F.default.createElement(X,{...t}):e==="edge"?F.default.createElement(Y,{...t}):null}var D=C(require("react"));var S=require("@uniformdev/context"),f=C(require("react"));function Z(t){let{name:e,variations:o,component:n}=t,r={name:e},m=n;return f.default.createElement(f.default.Fragment,null,f.default.createElement(x,{"data-type":S.ScriptType.TestStart,dangerouslySetInnerHTML:{__html:JSON.stringify(r)}}),o.map((i,c)=>f.default.createElement(f.Fragment,{key:i.id},f.default.createElement(x,{"data-type":S.ScriptType.ListItemSettings,dangerouslySetInnerHTML:{__html:JSON.stringify({id:i.id})}}),f.default.createElement(x,{"data-type":S.ScriptType.ListItem},f.default.createElement(m,{key:c,...i})))),f.default.createElement(x,{"data-type":S.ScriptType.TestEnd}))}var $=C(require("react"));var tt=({name:t,variations:e,component:o})=>{let{context:n}=s(),{result:r}=n.test({name:t,variations:e});return r?$.default.createElement(o,{...r}):null};var lt=t=>{let{outputType:e}=s();return!E||e==="standard"?D.default.createElement(tt,{...t}):e==="edge"?D.default.createElement(Z,{...t}):null};var V=C(require("react")),et=require("@uniformdev/context");var ot=C(require("cookie")),xt=({context:t,children:e,outputType:o="standard",trackRouteOnRender:n=!0})=>((0,V.useEffect)(()=>{E||!n||t.update({url:new URL(window.location.href),cookies:ot.default.parse(document.cookie)})}),V.default.createElement(L.Provider,{value:{context:t,outputType:o}},e,E?V.default.createElement(Tt,null):null));function Tt(){let{context:t}=s(),e={quirks:t.storage.data.quirks,tests:t.storage.data.tests,ssv:t.scores};return V.default.createElement("script",{id:et.SERVER_STATE_ID,type:"application/json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})}var u=require("react");var rt=require("react");var N=t=>{let{personalized:e}=(0,rt.useContext)(_);return typeof e!="undefined"?e:typeof(t==null?void 0:t.personalized)!="undefined"?t.personalized:!1};var Ct=({behavior:t,children:e,tagName:o="div",threshold:n=.5,disableVisibilityTrigger:r=typeof window=="undefined"||!("IntersectionObserver"in window),...m})=>{let i=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:c}=s(),g=N(),[P,h]=(0,u.useState)(),[T,k]=(0,u.useState)(!1),H=(0,u.useRef)(null),d=(0,u.useRef)();return(0,u.useEffect)(()=>{P!==i&&(k(!1),h(i))},[i,P]),(0,u.useEffect)(()=>{var b;let q=!t||Array.isArray(t)&&!t.length;if(g||q||!H.current)return;let nt=Array.isArray(t)?t:[t],J=()=>{var l;T||(c.update({enrichments:nt}),k(!0),(l=d.current)==null||l.call(d))};if(r)J();else{(b=d.current)==null||b.call(d);let l=new IntersectionObserver(([O])=>{O.isIntersecting&&J()},{threshold:n});l.observe(H.current),d.current=()=>{var O;return(O=l.disconnect)==null?void 0:O.call(l)}}return()=>{var l;(l=d.current)==null||l.call(d)}},[c,t,r,n,g,P,i,T]),(0,u.createElement)(o,{...m,ref:H},e)};var R=C(require("react")),z=require("react");var gt=({behavior:t,children:e})=>{let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:n}=s(),r=N(),[m,i]=(0,z.useState)(),[c,g]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{m!==o&&(g(!1),i(o))},[o,m]),(0,z.useEffect)(()=>{let P=!t||Array.isArray(t)&&!t.length;if(r||P)return;(()=>{if(c)return;let k=Array.isArray(t)?t:[t];n.update({enrichments:k}),g(!0)})()},[n,t,r,c]),R.default.createElement(R.default.Fragment,null,e)};module.exports=ut(Pt);0&&(module.exports={Personalize,Test,Track,TrackFragment,UniformContext,useQuirks,useScores,useUniformContext});
var nt=Object.create;var v=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var at=Object.getPrototypeOf,mt=Object.prototype.hasOwnProperty;var pt=(t,e)=>{for(var o in e)v(t,o,{get:e[o],enumerable:!0})},B=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of st(e))!mt.call(t,r)&&r!==o&&v(t,r,{get:()=>e[r],enumerable:!(n=it(e,r))||n.enumerable});return t};var C=(t,e,o)=>(o=t!=null?nt(at(t)):{},B(e||!t||!t.__esModule?v(o,"default",{value:t,enumerable:!0}):o,t)),ft=t=>B(v({},"__esModule",{value:!0}),t);var gt={};pt(gt,{Personalize:()=>ct,Test:()=>dt,Track:()=>Tt,TrackFragment:()=>Ct,UniformContext:()=>lt,useQuirks:()=>ut,useScores:()=>A,useUniformContext:()=>s});module.exports=ft(gt);var Q=require("react");var M=require("react"),L=(0,M.createContext)(void 0),_=(0,M.createContext)({});function s(t={}){let{throwOnMissingProvider:e=!0}=t,o=(0,Q.useContext)(L);if(e){if(o===void 0)throw new Error("useUniformContext must be used within a <UniformContext> provider");return o}return o}var w=require("react");function ut(){let{context:t}=s(),[e,o]=(0,w.useState)(t.storage.data.quirks),n=r=>{o(r)};return(0,w.useEffect)(()=>(t.events.on("quirksUpdated",n),()=>{t.events.off("quirksUpdated",n)}),[t]),e}var I=require("react");var W=require("dequal/lite");function A(){let{context:t}=s(),[e,o]=(0,I.useState)(t.scores);return(0,I.useEffect)(()=>{let n=m=>{o(m)},r=t.scores;return(0,W.dequal)(e,r)||o(r),t.events.on("scoresUpdated",n),()=>{t.events.off("scoresUpdated",n)}},[t]),e}var F=C(require("react"));var y=C(require("react"));function j({variations:t,component:e,wrapperComponent:o,name:n,count:r=1}){let{context:m}=s(),i=A(),{variations:c,personalized:g}=(0,y.useMemo)(()=>m.personalize({name:n,variations:t,take:r}),[i,m,r,n,t]),P=o!=null?o:({children:T})=>y.default.createElement(y.default.Fragment,null,T),h=e;return y.default.createElement(_.Provider,{value:{personalized:!0}},c.length?y.default.createElement(P,{personalizationOccurred:g},c.map(T=>y.default.createElement(h,{key:T.id,personalizationResult:{variation:T,personalizationOccurred:g},...T}))):null)}var U=require("@uniformdev/context"),p=C(require("react"));var X=require("@uniformdev/context"),G=require("react"),x=t=>(0,G.createElement)(X.EdgeNodeTagName,t);function K(t){let{variations:e,count:o,component:n}=t,r={count:o!=null?o:1},m=n;return p.default.createElement(p.default.Fragment,null,p.default.createElement(x,{"data-type":U.ScriptType.ListStart,dangerouslySetInnerHTML:{__html:JSON.stringify(r)}}),e.map(i=>p.default.createElement(p.Fragment,{key:i.id},p.default.createElement(x,{"data-type":U.ScriptType.ListItemSettings,dangerouslySetInnerHTML:{__html:JSON.stringify({id:i.id,pz:i.pz||null})}}),p.default.createElement(x,{"data-type":U.ScriptType.ListItem},p.default.createElement(m,{key:i.id,personalizationResult:{variation:i,personalizationOccurred:!1},...i})))),p.default.createElement(x,{"data-type":U.ScriptType.ListEnd}))}var E=typeof window=="undefined";function ct(t){let{outputType:e}=s();return!E||e==="standard"?F.default.createElement(j,{...t}):e==="edge"?F.default.createElement(K,{...t}):null}var D=C(require("react"));var S=require("@uniformdev/context"),f=C(require("react"));function Y(t){let{name:e,variations:o,component:n}=t,r={name:e},m=n;return f.default.createElement(f.default.Fragment,null,f.default.createElement(x,{"data-type":S.ScriptType.TestStart,dangerouslySetInnerHTML:{__html:JSON.stringify(r)}}),o.map((i,c)=>f.default.createElement(f.Fragment,{key:i.id},f.default.createElement(x,{"data-type":S.ScriptType.ListItemSettings,dangerouslySetInnerHTML:{__html:JSON.stringify({id:i.id})}}),f.default.createElement(x,{"data-type":S.ScriptType.ListItem},f.default.createElement(m,{key:c,...i})))),f.default.createElement(x,{"data-type":S.ScriptType.TestEnd}))}var Z=C(require("react"));var $=({name:t,variations:e,component:o})=>{let{context:n}=s(),{result:r}=n.test({name:t,variations:e});return r?Z.default.createElement(o,{...r}):null};var dt=t=>{let{outputType:e}=s();return!E||e==="standard"?D.default.createElement($,{...t}):e==="edge"?D.default.createElement(Y,{...t}):null};var V=C(require("react")),tt=require("@uniformdev/context");var et=C(require("cookie")),lt=({context:t,children:e,outputType:o="standard",trackRouteOnRender:n=!0})=>((0,V.useEffect)(()=>{E||!n||t.update({url:new URL(window.location.href),cookies:et.default.parse(document.cookie)})}),V.default.createElement(L.Provider,{value:{context:t,outputType:o}},e,E?V.default.createElement(xt,null):null));function xt(){let{context:t}=s(),e={quirks:t.storage.data.quirks,tests:t.storage.data.tests,ssv:t.scores};return V.default.createElement("script",{id:tt.SERVER_STATE_ID,type:"application/json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})}var u=require("react");var ot=require("react");var N=t=>{let{personalized:e}=(0,ot.useContext)(_);return typeof e!="undefined"?e:typeof(t==null?void 0:t.personalized)!="undefined"?t.personalized:!1};var Tt=({behavior:t,children:e,tagName:o="div",threshold:n=.5,disableVisibilityTrigger:r=typeof window=="undefined"||!("IntersectionObserver"in window),...m})=>{let i=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:c}=s(),g=N(),[P,h]=(0,u.useState)(),[T,k]=(0,u.useState)(!1),H=(0,u.useRef)(null),d=(0,u.useRef)();return(0,u.useEffect)(()=>{P!==i&&(k(!1),h(i))},[i,P]),(0,u.useEffect)(()=>{var b;let q=!t||Array.isArray(t)&&!t.length;if(g||q||!H.current)return;let rt=Array.isArray(t)?t:[t],J=()=>{var l;T||(c.update({enrichments:rt}),k(!0),(l=d.current)==null||l.call(d))};if(r)J();else{(b=d.current)==null||b.call(d);let l=new IntersectionObserver(([O])=>{O.isIntersecting&&J()},{threshold:n});l.observe(H.current),d.current=()=>{var O;return(O=l.disconnect)==null?void 0:O.call(l)}}return()=>{var l;(l=d.current)==null||l.call(d)}},[c,t,r,n,g,P,i,T]),(0,u.createElement)(o,{...m,ref:H},e)};var R=C(require("react")),z=require("react");var Ct=({behavior:t,children:e})=>{let o=typeof document=="undefined"?"__uniform_ssr_url":document.location.href,{context:n}=s(),r=N(),[m,i]=(0,z.useState)(),[c,g]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{m!==o&&(g(!1),i(o))},[o,m]),(0,z.useEffect)(()=>{let P=!t||Array.isArray(t)&&!t.length;if(r||P)return;(()=>{if(c)return;let k=Array.isArray(t)?t:[t];n.update({enrichments:k}),g(!0)})()},[n,t,r,c]),R.default.createElement(R.default.Fragment,null,e)};0&&(module.exports={Personalize,Test,Track,TrackFragment,UniformContext,useQuirks,useScores,useUniformContext});
{
"name": "@uniformdev/context-react",
"version": "13.0.1-alpha.133+5e32ce3cd",
"version": "13.0.1-alpha.271+7307a0d06",
"description": "Uniform Context React integration package",

@@ -26,13 +26,15 @@ "license": "SEE LICENSE IN LICENSE.txt",

"devDependencies": {
"@types/cookie": "0.4.1",
"@types/cookie": "0.5.0",
"@types/react": "17.0.44",
"react": "17.0.2"
"react": "17.0.2",
"react-dom": "17.0.2"
},
"dependencies": {
"@uniformdev/context": "^13.0.1-alpha.133+5e32ce3cd",
"cookie": "^0.4.1",
"dequal": "^2.0.2"
"@uniformdev/context": "^13.0.1-alpha.271+7307a0d06",
"cookie": "0.5.0",
"dequal": "2.0.2"
},
"peerDependencies": {
"react": ">=16.13.1"
"react": ">=16.13.1",
"react-dom": ">=16.13.1"
},

@@ -45,3 +47,3 @@ "files": [

},
"gitHead": "5e32ce3cd962560af97708369bf4c4c91a0116d1"
"gitHead": "7307a0d061e09506ffeb6a72798a986f0ea2da2c"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc