@namiml/web-sdk
Version:
Nami Web SDK makes subscriptions & in-app purchases easy, with powerful built-in paywalls and A/B testing
68 lines (45 loc) • 2.31 kB
Markdown

# Nami Web SDK
Nami is easy subscriptions & in-app purchases, with powerful built-in paywalls and A/B testing.
This library helps you easily offer in-app purchases and subscriptions.
- No IAP code to write.
- Focus on your app experience.
- All edge cases are handled and no server is required.
- Includes is powerful built-in paywalls templates
- Update paywalls easily using a browser-based paywall CMS.
- Conduct paywall A/B tests, to improve your conversion rate.
- Robust subscription analytics, webhooks, and much more.
Requires an account with Nami ML. See https://www.namiml.com/pricing for more details and to create a free account.
## Getting started with Nami's Web SDK
### Install the Web SDK in your project
You can install the SDK via NPM or Yarn
```
npm install /web-sdk --save
```
```
yarn add /web-sdk
```
Example apps showing how to use the SDK are available in our [Nami Web SDK repo](https://github.com/namiml/nami-web-sdk).
More information on configuring and using the SDK is available in our docs at [https://learn.namiml.com](https://learn.namiml.com).
## Legacy & polyfills
We provide two optional entry points so you can support older browsers or load polyfills only when needed.
- Legacy build
- Use the legacy entry point to load a version of the SDK that works on older browsers.
- ESM: `import Nami from '/web-sdk/legacy'`
- CommonJS: `const Nami = require('/web-sdk/legacy')`
- Polyfills (optional)
- If you need to include polyfills for older browsers, we provide a small polyfills bundle you can load before the SDK.
- ESM: `import '/web-sdk/polyfills'`
- CommonJS: `require('/web-sdk/polyfills')`
- You can also include the polyfills script directly in a page before loading the SDK bundle.
Recommended patterns
- Most modern apps should import the default package entry (modern bundle):
```js
import Nami from '/web-sdk'
```
- For older browsers, load polyfills first then the legacy bundle:
```js
import '/web-sdk/polyfills'
import Nami from '/web-sdk/legacy'
```
This lets you ship the smallest modern bundle to the majority of users while opting into legacy and polyfills only when required.