Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ cdk.out
**/*.d.ts

build
.docusaurus
.docusaurus
docs/build/**
70 changes: 70 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["prettier", "plugin:jest/recommended", "plugin:import/recommended"],
"plugins": ["@typescript-eslint", "jest", "prettier", "unused-imports", "import"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parserOptions": {
"project": ["./tsconfig.json"]
},
"rules": {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "off"
}
}
],
"rules": {
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 120,
"endOfLine": "auto",
"semi": true,
"arrowParens": "always",
"bracketSpacing": false,
"tabWidth": 2
}
],
"import/no-unresolved": [
0,
{
"commonjs": true,
"amd": true
}
],
"import/no-cycle": "error",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/valid-expect": "error",
"import/first": "error",
"import/named": "off",
"import/no-duplicates": "error",
"import/newline-after-import": "error",
"no-console": "error",
"no-unused-expressions": [
1,
{
"allowTernary": true
}
],
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
]
}
}
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage
node_modules
dist
build
coverage
.github
.idea
.vscode
.cache
.yalc
package-lock.json
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"semi": true,
"arrowParens": "always",
"printWidth": 120,
"bracketSpacing": false,
"tabWidth": 2
}
27 changes: 10 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
# [1.7.0](https://github.com/Salable/js-sdk/compare/v1.6.0...v1.7.0) (2023-05-05)


### Features

* promoCode and allowPromoCode options added to checkout config ([d9d903a](https://github.com/Salable/js-sdk/commit/d9d903a5ba18530235257b9561b6c8ed4b11dfb2))
- promoCode and allowPromoCode options added to checkout config ([d9d903a](https://github.com/Salable/js-sdk/commit/d9d903a5ba18530235257b9561b6c8ed4b11dfb2))

# [1.6.0](https://github.com/Salable/js-sdk/compare/v1.5.0...v1.6.0) (2023-04-20)


### Features

* set feature sort order per pricing table ([62199b2](https://github.com/Salable/js-sdk/commit/62199b2ddeaf60317285fa0af95ad92b55be2078))
- set feature sort order per pricing table ([62199b2](https://github.com/Salable/js-sdk/commit/62199b2ddeaf60317285fa0af95ad92b55be2078))

# [1.5.0](https://github.com/Salable/js-sdk/compare/v1.4.2...v1.5.0) (2023-04-05)


### Features

* feature sort order implemented based on values set in Salable ([1ba09f0](https://github.com/Salable/js-sdk/commit/1ba09f065cbfc736cffb775b60db0e53f19daad8))
- feature sort order implemented based on values set in Salable ([1ba09f0](https://github.com/Salable/js-sdk/commit/1ba09f065cbfc736cffb775b60db0e53f19daad8))

## [1.4.2](https://github.com/Salable/js-sdk/compare/v1.4.1...v1.4.2) (2023-03-30)


### Bug Fixes

* correct api domain added ([de7b7d0](https://github.com/Salable/js-sdk/commit/de7b7d0890580aba50fc15d7118c2bdebd2c8bcc))
- correct api domain added ([de7b7d0](https://github.com/Salable/js-sdk/commit/de7b7d0890580aba50fc15d7118c2bdebd2c8bcc))

## [1.4.1](https://github.com/Salable/js-sdk/compare/v1.4.0...v1.4.1) (2023-03-30)


### Bug Fixes

* added cdn domain to theme css link ([27be197](https://github.com/Salable/js-sdk/commit/27be197714895cfe57c32a410805bc96ab956db7))
* removed width calcs on features ([caca24a](https://github.com/Salable/js-sdk/commit/caca24af62456225c0ed57bfcd02711f7d80271d))
- added cdn domain to theme css link ([27be197](https://github.com/Salable/js-sdk/commit/27be197714895cfe57c32a410805bc96ab956db7))
- removed width calcs on features ([caca24a](https://github.com/Salable/js-sdk/commit/caca24af62456225c0ed57bfcd02711f7d80271d))

# [1.4.0](https://github.com/Salable/js-sdk/compare/v1.3.1...v1.4.0) (2023-03-22)


### Bug Fixes

* change to required fields to check for product OR pricing table uuid ([96796ad](https://github.com/Salable/js-sdk/commit/96796ade3a5d1ac04e123d990bc3074f79f3633a))

- change to required fields to check for product OR pricing table uuid ([96796ad](https://github.com/Salable/js-sdk/commit/96796ade3a5d1ac04e123d990bc3074f79f3633a))

### Features

* **featured plan:** styling to add featured plan and overwrite button colour values set in salable ([5650967](https://github.com/Salable/js-sdk/commit/56509676889c6f477aac1f2673b4d81de69e462a))
* **PPP-20:** custom pricing tables ([c40d16e](https://github.com/Salable/js-sdk/commit/c40d16ee47035663be4a636faca1e3228d3ff998))
* **pricing tables:** more css variables which can be changed through customisation from Salable api ([2c3607e](https://github.com/Salable/js-sdk/commit/2c3607e9db1f99de628fb5509bc140eacdba7d49))
- **featured plan:** styling to add featured plan and overwrite button colour values set in salable ([5650967](https://github.com/Salable/js-sdk/commit/56509676889c6f477aac1f2673b4d81de69e462a))
- **PPP-20:** custom pricing tables ([c40d16e](https://github.com/Salable/js-sdk/commit/c40d16ee47035663be4a636faca1e3228d3ff998))
- **pricing tables:** more css variables which can be changed through customisation from Salable api ([2c3607e](https://github.com/Salable/js-sdk/commit/2c3607e9db1f99de628fb5509bc140eacdba7d49))

## [1.3.1](https://github.com/Salable/js-sdk/compare/v1.3.0...v1.3.1) (2023-02-14)

Expand Down
74 changes: 36 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,51 @@
# @salable/js-sdk
<p align="center">
<a href="https://github.com/Salable/js-sdk" target="_blank" rel="noopener noreferrer">
<img src="./docs/salable-logo.png" height="64">
</a>
<br />
</p>

## Packages Included
<div align="center">

- [@salable/pricing-table](https://github.com/Salable/js-sdk/tree/main/packages/pricing-table)
</div>

## Development
---

### Initial Setup
## Overview

To set up the JS SDK on your local machine for development, perform the following steps.
Salable JS is a JavaScript library for building and managing a SaaS application's products, plans, subscriptions, and payment.

1. Clone the repo to your local machine
2. Run `npm i` at the root of the project
## Getting Started

_Note: You don't need to run `npm i` per package. Because this project uses NPM workspaces, you only ever need to run it at root._
### Installation

### Adding Packages
You can include Salable JS in your project by importing the SalableJS npm module or loading SalableJS with a script tag

If you want to add a new package, perform the following steps.
### Install SalableJS with npm

1. Create a new folder inside the `packages` directory named as the name of the package. (e.g. pricing-table)
2. Inside the new package folder, create `package.json` and `README.md` files.
- Use the template for `package.json` below, replacing information where required.
3. Create a `src` folder in the root of your new package folder and inside it put a `index.ts` or `index.js` file depending on if you're using TS or not.
- From the `index.{js|ts}` file, export your package's files. This file is the entry point for Rollup to build from.
4. Update `./packages/index.ts` to include your new package index file to ensure it is included in the output build.
- Export your new package from `./packages/index.ts` with a name based on your package name.
5. Update this `README.md` file to include your new package in the list of packages at the top fo this file.
6. To install/uninstall NPM packages to your new package, use the following commands and replace information where required. _NOTE: For your package name, use the directory name inside `./packages`_
- **Install:** `npm install <NPM_PACKAGE_NAME> -w <YOUR_PACKAGE_NAME>`
- **Uninstall:** `npm uninstall <NPM_PACKAGE_NAME> -w <YOUR_PACKAGE_NAME>`
```bash
npm instal @salable/salable-js
```

Once the installation is done, import the package and create and instance.

```typescript
import {Salable} from '@salable/salable-js';
const salable = new Salable('{your-api-key-here}');
```

### Install SalableJS with script tag

#### `package.json` example
```html
<script async>
import {Salable} from 'https://cdn.salable.app/latest/index.js';

```json
{
"name": "@salable/<YOUR_PACKAGE_NAME>",
"version": "1.0.0",
"description": "",
"type": "module",
"main": "src/index.{js|ts}",
"scripts": {
// Your scripts here
},
"author": "Salable",
"license": "MIT"
}
const salable = new Salable(`{your-api-key-here}`);
</script>
```

#### Example
## License

This project is licensed under the **MIT license**.

For an example package, see the `pricing-table` package/directory inside `./packages`.
See [LICENSE](https://github.com/Salable/js-sdk/tree/main/packages/salable-js/LICENSE) for more information.
Loading