npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@findify/mjs

v5.6.7

Published

Findify widgets

Downloads

166

Readme

Findify Merchant JS npm (scoped)

Getting started

Accessing API:

After MJS loads it start listening to objects in window.findifyApiRegistry and processing them immediately. By using this functionality you can modify response, change styles and inject your code to every part of MJS lifecycle.

Customize styles in iFrame:

You can modify CSS styles of components by simply adding object with single key style and styles or link to CSS file in thats value. e.q:

{
  style: 'body{ background: black; }'
}

Include JavaScript files in iFrame:

Same as with adding styles, you can add to registry object with key script and value with link to script you would like to include. e.q:

{
  script: 'http://path_to_your_javascript_file'
}

Modify data and view on fly with Hooks.

MJS uses powerful hook system, which allow you to modify data views inside components lifecycle. Hook object contains three fields:

  1. hook - name of hook, is [context].[component] composition, which specifies component where hook will be injected.
  2. mapProps - function which allow you to change data which will be passed to component.
  3. didMount - function triggers on component view was rendered in window.
  4. didUpdate - similar to previews one, but triggers every time when view was changed.

e.q:

{
  hook: 'search.products',

  didMount: function(data) {
    $(data.node).appendChild('<div>CUSTOM HTML</div>');
  },

  mapProps: function(props) {
    var width = props.size.width;
    if (width > 1000) {
      return { columns: 4 };
    } else {
      return { columns: 3 };
    }
  }
}

Available hooks:

search:

  • search.results - Search results container
  • search.facets - Desktop facets list
  • search.facet - Single desktop facet
  • search.products - Products grid
  • search.product - Single product item
  • search.noResults - Products list, which renders when no matching products found

autocomplete:

  • autocomplete.suggestions - Suggestions list
  • autocomplete.products - Products matches grid
  • autocomplete.product - Single product item

recommendations:

  • recommendations.slider - Recommendations list with type "Carousel"
  • recommendations.products - Recommendations list with type "Grid"
  • recommendations.product - Single recommendation

mobile:

  • mobile.facets - Facets list in mobile view
  • mobile.facet - Single facet in mobile view

Lifecycle functions:

mapProps, ({ config, ...rest }) - Allow you to change props which will be passed to component, it contains config and other component specific props. Important - don't execute slow code here, it will affect component rendering speed

didMount, ({ node: DOMNode, data: componentProps }) - Function which will be executed on component did mount, it will pass node and component props to callback. We recommend to do all DOM manipulations here.

didUpdate, ({ node: DOMNode, data: componentProps }) - same as didMount, but will fire every time when props was updated

Versioning

We will try to follow semver as close as possible. That means bug fixes will be patch releases (1.0.1 -> 1.0.2), additional functionality like new endpoints will be minor releases (1.0.1 -> 1.1.0) and breaking changes to both the library and the API endpoints it hits, will be major releases (1.0.1 -> 2.0.0).

Getting help

We use the GitHub issues for tracking bugs and feature requests.

Opening Issues

If you encounter a bug with the Findify Merchant JS we would like to hear about it. Search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of the Merchange JS, Node.js or browser environment and OS you’re using. Please include a stack trace and reduced repro case when appropriate, too.

The GitHub issues are intended for bug reports and feature requests. For help and questions with using the Findify Merchant JS please make use of the resources listed in the Getting help section.

Contributing

Please see CONTRIBUTING.md for information on how to contribute, setup the development environment and run tests.