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

@prestashopcorp/builtfor-generator-vanilla

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prestashopcorp/builtfor-generator-vanilla

Built for PS generator with customization option

  • 1.5.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

Logo

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

Keywords

FAQs

Package last updated on 26 Jul 2024

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