viodotcom / opticks Goto Github PK
View Code? Open in Web Editor NEWVio.com Toggle Flag JavaScript SDK - Maintainer: @jopdeklein
License: MIT License
Vio.com Toggle Flag JavaScript SDK - Maintainer: @jopdeklein
License: MIT License
Currently the toggle
function requires all winner arguments to be available. We could treat missing arguments the same as null
, removing the call altogether.
When forcing an experiment via query string ie.: ab_experiment=b
, the booleanToggle
function doesn't return the correct variation that was forced to return.
Currently the default logger is used and cannot be overwritten from Opticks.
Add an option to do so, for more information about the Optimizely SDK logger:
https://docs.developers.optimizely.com/full-stack/docs/configure-the-logger
The documentation is very thorough, which is good, but I think it can benefit from a simple Installation
and Quick Example
section.
Using opticks on an non-ejected React App result in the lib throwing an error on Jest when the test suite runs.
The error as follows.
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". Here's what you can do: • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. • If you need a custom transformation specify a "transform" option in your config. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. You'll find more details and examples of these config options in the docs: https://jestjs.io/docs/en/configuration.html Details: /Users/vinicius/src/opticks-bug/node_modules/opticks/lib/optimizely.js:1 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){var Optimizely,optimizelyClient,userId,audienceSegmentationAttributes,handleToggleVariant=function(e){return"function"==typeof e?e():e},booleanToggle=function(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];switch(r.length){case 2:var i=r[0],o=r[1];return handleToggleVariant(e(t)?o:i);case 1:var l=r[0];return!!e(t)&&handleToggleVariant(l);default:return e(t)}}},multiToggle=function(e){return function(t){var n="a".charCodeAt(0),r=e(t);if(arguments.length<=1||!(arguments.length-1))return r;var a=r.charCodeAt(0)-n,i=a+1<1||arguments.length<=a+1?void 0:arguments[a+1];return handleToggleVariant(i)}},NOTIFICATION_TYPES={ACTIVATE:"ACTIVATE:experiment, user_id,attributes, variation, event",TRACK:"TRACK:event_key, user_id, attributes, event_tags, event"},featureEnabledCache={},experimentCache={},forced
To simulate live, create a blank create-react-app project, add the opticks as a dependency and import it in any place that its reachable by jest (App.js for instance), when the test suite runs, it yields the error. Ejecting the app doesn't solve the issue though.
Using "opticks": "^1.2.0"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.