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

@nuskin/configuration-sdk

Package Overview
Dependencies
Maintainers
5
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuskin/configuration-sdk

The configuration sdk gets market configuration from content stack. You can get the full configuration for a list of config maps or get partial configuration using graphql. The sdk caches the configurations for 2 minutes in memory. The sdk also allows

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
increased by74.55%
Maintainers
5
Weekly downloads
 
Created
Source

@nuskin/configuration-sdk

"The configuration sdk gets market configuration from content stack. You can get the full configuration for a list of config maps or get partial configuration using graphql. The sdk caches the configurations for 2 minutes in memory. The sdk also allows for configuraitons to be overridden. Override configurations for runtime shopping context configurations. Or use the function for testing purposes to override configuration in the browser on the fly.",

Installing

Usng npm:

npm add @nuskin/configuration-sdk

Usng yarn:

yarn add @nuskin/configuration-sdk

Example usage

const {init, overrideConfigurationProperty, clearConfigurationOverrides, overrideConfiguration, getConfiguration, getPartialConfig} = require('@nuskin/configuration-sdk');

// If you are using this module in the browser you don't need to initialize it with get and set storage functions.
// init allows the module to store the configuration overrides
// you don't need init unless you plan on overriding configuration
init(AsyncStorage.set, AsyncStorage.get);

// Override a single configuration for shopping context and market.  The overrides will be merged with the configuration
overrideConfigurationProperty({configMap: 'Ordering', configMapProperty: 'testing', value: true, country: 'US', shoppingContext: 'personal_offer'});

// Override configuration for shopping context and market.  The overrides will be merged with the configuration 
overrideConfiguration({configMap: ''});

// Expose the overrideConfiguration function so QA can change configuration in the browser
// Just expose the function on window so when you open the console in the dev tools you can access it
// Testers can also override the marketConfigurationOverrides sessionStorage object instead of using this function
window.nuskin.overrideConfiguration = overrideConfiguration; 

// get partial config through graphql endpoint.  Returns just the fields requested
const config = await getPartialConfig({
    queryFields: {
        Ordering: ['spendingRestrictionsEnabled', 'inventoryCheckEnabled'],
        Cart: ['minAdrPsv']
    },
    country: 'US',
    clientId: 'Client id for you application'
});

// get full configuration for config maps
const config = await getConfiguration({
    configMapNames: ['Ordering', 'Cart'],
    country: 'US',
    clientId: 'Your application client id'
});

Resources

License

MIT

FAQs

Package last updated on 04 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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