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

manyways-run

v1.0.4

Published

A react context library for Manyways Journeys

Downloads

2

Readme

REMOVED:

"prompts": "^2.4.2",

NOTE : NOTHING IN PUBLIC WILL BE AVAILABLE FOR THE END USER _ ONLY FOR DEV

Public methods

separate in src/publicmethod.js

Includes:

  • Restart: window.manyways.restart()
  • Dispatcher: window.manyways.dispatcher()
  • Back: window.manyways.back()
  • Share: window.manyways.share()

can disable w 'disablePublicMethods' on custom element

Running defaults

<manyways-wrapper
  slug="my-slug"
  mode="scroll"
  locale="en"
  customcss=".somecss {color: red}"
  disablePublicMethods
></manyways-wrapper>

Running the SDK.

Initialization

import ManywaysProvider from "@manyways/run";

const MyApp = ({ children }) => {
  return (
    <>
      <ManywaysRunProvider
        slug="my-slug"
        mode="scroll"
        customComponents={{
          choiceWithImage: MyComponent,
        }}
        disableRender={false}
      >
        {children}
      </ManywaysRunProvider>
    </>
  );
};

Props

| Prop | Description | | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | slug (required) | Your Journey Slug | | disableRender | This causes the Provider not to render any components at all, ideally used when in pure headless mode | | customComponents | This is ignored if disableRender is true. Can provide a object mapped with name and value. Expects the value to be a react component. Full list of component names can be found here @todo | | mode | Accepts scroll or slideshow. Default is scroll |

  • locale
  • classNamePrefix
customComponents

All Custom components will have value and onChange props passed to them.

INPUTS

  • ChoiceWithImage
  • Text
  • Number
  • Date
  • DateTime
  • Checkbox
  • Dropdown (Select)

NULL FIELDS

  • Prose (HTML)
  • Content Switcher
  • Slideshow

TBD:

  • AutoComplete
  • MapWithDynamicSource

useManyways hook

This is the main way to utilize the various methods and journey states used by manyways.

import { useManyways } from "@manyways/run";
Getters, setters and actions

| Name | Desc | | ------------------- | --------------------------------------------------------------------------------------------- | | currentNode | The current node object from the api | | currentResponse | The current user response to the current node if it exists. Will return null if unanswered | | goBack | Take the user to the previous node. Will return current node if the user is unable to go back | | setResponse | Set the current response | | goForward | Go to the next node with the current response | | responseHistory | An array of response objects with node ids and responses | | getResponseByNodeID | Get response for node based on nodeID | | treeConfig | Get tree config | | journeyNodes | Array of all journey nodes | | locale | Get the current language | | setLocale | Set the current language |

Run Mode Variables

  • backgroundImage - takes an image
  • nodeLayout - center, content-left, and content-right (can be overriden on node)
  • foregroundImage -
  • customNextButton - global default, can be overriden on node
  • customPreviewButton - global default, can be overriden on node

TODO

  • ManywaysContext - Double check this is workign correctly with umami tracking... is this needed? If not remove. const isPreview = () => { // @TODO // if (window.location.search.includes("revision")) { // let revisionId = window.location.search // .split("revision=")[1] // .split("&")[0]; // setSlugAndRevisionParams(${slug}/begin?revision=${revisionId}`); // }

    return window.location.search.includes("preview"); }; `

other

  • Page titles (+ share titles)
  • Header

Mini things

  • ManywaysContext: check currentNodeId instead of setCurrentNodeId let currentNode = currentNodeId !== false ? nodes.find((n) => n.id === currentNodeId) : false;
  • ManywaysContext - removed let umamidata = { website: treeConfig?.analytics_config?.umami_id, };