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

@prestashopcorp/builtfor-generator-vanilla

v1.5.4

Published

Built for PS generator with customization option

Downloads

30

Readme

Built for PS Generator

This CLI allow you to generate a Built For PS with different parameters: PrestaShop version, Billing i sandbox or not, Billing environment, Product ID (which allow to use different pricing model)

Requirements

First of all you need to install composer, please refer to the Linux / Unix / MacOS instruction or Windows instructions.

Installation

npm i -g @prestashopcorp/builtfor-generator-vanilla

or

yarn global add @prestashopcorp/builtfor-generator-vanilla

Usage

Classic

Launch in a terminal this command

builtforGen -id <productId> [...other options]

Options documentation

Generate Built for PS for PrestaShop

Options:
  -id, --productId <productId>     Technical id of the Built for PS. This id will be used to generate the Built for PS with the proper value. Ths value should match the product family item configured
                                   in Chargebee, otherwise you must create it.
  --psVersion <version>            Description of the Built for PS (choices: "1.7", "8", default: "8")
  -s --sandbox                     Use this flag to generate a Built for PS in sandbox mode
  -e, --environment <environment>  Specify an environment when you don't want to use the production (choices: "prestabulle1", "prestabulle2", "prestabulle3", "prestabulle4", "prestabulle5",
                                   "prestabulle6", "preprod")
  -t, --template <template>        Specify a template when you want to handling display of yours plans  (choices: "standard", "handle",
                                   default: "standard")
  -wd, --workingDir <path>         Directory where the Built for PS will be created. You can specify a relative or an absolute path. (default: "tmp")
  -d, --description <description>  Description of the Built for PS (default: "Built for PS in Vanilla JS for PrestaShop")
  -name, --displayName <name>      Display name of the Built for PS
  -c, --context <context>          This option allow you to inject some information within the context. Please give a stringified json: '{"foo": "bar"}' (default: {})
  --customCancellation             Use this flag to activate custom cancellation modal
  -h, --help                       display help for command

Focus on --context

You need to use this when the Built For PS documentation about billing, mention to add info within the context from your Javascript (in configure.tpl).

In this case please refer to the documentation to known which JSON structure should be used.

Example:

// JSON which allow you to specify the unit when using a stairstep pricing model, in order to display
// the proper information in the plan page into the funnel
{
  "product": {
    "components": [
      {
        "id": "rbm_example_stairstep", // this is the pricing id in chargebee
        "unitDescription": "Users"
      }
    ]
  }
}

Registered configuration

This script provide some registered configuration to save time. In this case the module generated is compatible with PS version 1.7, and all config are in sandbox.

builtforRegistered -c <config>

Options documentation

Generate Built for PS for PrestaShop with registered whole configuration

Options:
  -c, --config <config>  Select your registered configuration (choices: "flat_bulle1", "flat_bulle2", "flat_bulle3", "flat_bulle4", "flat_bulle5", "flat_bulle6", "flat_preprod", "flat", "flat_handle_bulle1",
                         "flat_handle_bulle2", "flat_handle_bulle3", "flat_handle_bulle4", "flat_handle_bulle5", "flat_handle_bulle6", "flat_handle_preprod", "flat_handle", "stairstep_bulle1", "stairstep_bulle2",
                         "stairstep_bulle3", "stairstep_bulle4", "stairstep_bulle5", "stairstep_bulle6", "stairstep_preprod", "stairstep")
  -h, --help             display help for command

Example

PS 1.7, Sandbox, Prestabulle 2

Generate a flat fee module

The product id is the key that makes this module flat fee

builtforGen -id rbm_example -s -e prestabulle2 -d "PS 1.7 | Built for PS with a flat fee pricing in sandbox for prestabulle2" --psVersion "1.7"

Generate a flat fee module with predefined configuration

This command is the equivalent of the one above

builtforRegistered -c "flat_bulle2"

Generate a flat fee with handle plan module

The product id is the key that makes this module flat fee

builtforGen -id rbm_example -s -e prestabulle2 -d "PS 1.7 | Built for PS with a flat fee pricing in sandbox for prestabulle2" --psVersion "1.7" -t "handle"

Generate a flat fee with handle plan and predefined configuration

This command is the equivalent of the one above

builtforRegistered -c "flat_handle_bulle2"

Generate a flat fee module with the offer already selected

The product id is the key that makes this module flat fee

builtforGen \
  -id rbm_example \
  -s \
  -e prestabulle2 \
  -d "PS 1.7 | Built for PS with a flat fee pricing in sandbox for prestabulle2. Selection automatic of the plan." \
  --psVersion "1.7" \
  -c '{"offerSelection": {"offerPricingId": "builtfor_example-ultimate-EUR-Monthly"}}'

Generate a stairstep module

The product id is the key that makes this module stairstep with one plan

builtforGen \
  -id rbm_example_stairstep \
  -s \
  -e prestabulle2 \
  -d "PS 1.7 | Built for PS with a stairstep pricing in sandbox for prestabulle2" \
  --psVersion "1.7" \
  -c '{"product": {"components": [{"id": "rbm_example_stairstep", "unitDescription": "Users" }]}}'

Generate a stairstep module with preselected step

The product id is the key that makes this module stairstep with one plan

builtforGen \
  -id rbm_example_stairstep \
  -s \
  -e prestabulle2 \
  -d "PS 1.7 | Built for PS with a stairstep pricing in sandbox for prestabulle2" \
  --psVersion "1.7" \
  -c '{"product": {"components": [{"id": "rbm_example_stairstep", "unitDescription": "Users" }]}, "offerSelection": {"offerPricingId": "rbm_example_stairstep", "offerQuantity": 255}}'

** Generate a stairstep module with a frequency switcher

builtforGen \
  -id builtfor_example_stairstep \
  -name 'Builtfor Stairstep Example' \
  -e prestabulle2 \
  --psVersion 1.7 \
  --template frequency \
  -c '{"offerSelection": {"offerPricingId": "builtfor_stairstep-EUR-Monthly","offerQuantity": 1 }}'

PS 8, Live, Production

Generate a flat fee module

The product id is the key that makes this module flat fee

builtforGen -id rbm_example -d "PS 8 | Built for PS with a flat fee pricing in sandbox for prestabulle2"

Generate a stairstep module

The product id is the key that makes this module stairstep with one plan

builtforGen \
  -id rbm_example_stairstep \
  -d "PS 8 | Built for PS with a stairstep pricing" \
  -c "{\"product\": {\"components\": [{\"id\": \"rbm_example_stairstep\", \"unitDescription\": \"Users\" }]}}"

Contribute

Installation

yarn install

Launch

# Built for classic generator
yarn start

# Built for classic generator in watch mode
yarn start:dev

# Built for registered configuration
yarn start_reg

# Built for registered configuration in watch mode
yarn start_reg:dev

Build

yarn build