# Product Fruits npm package

A thin npm wrapper for installing Product Fruits in browser environments. It injects the Product Fruits script and exposes a small typed API (`init` / `safeExec`). The package supports TypeScript.

# Instructions

1. Install this package

```
npm install product-fruits --save
```

2. Use this package

```javascript
import { productFruits } from 'product-fruits';

// Call this later in your code; it can be called only once.
// This will load Product Fruits content immediatelly.
// Pass the real username of the current user. Read our docs for more options.
productFruits.init('YOUR PROJECT CODE', 'LANGUAGE CODE', { username: '<<REPLACE>>' });
```

# Compatibility

The package is framework-agnostic. It ships as an ES module with TypeScript
typings (`types.d.ts`) and has **zero runtime dependencies**. It works in any
modern browser bundler/toolchain (Vite, webpack, Rollup, esbuild, Next.js, etc.)
and with any frontend framework (React, Angular, Vue, Svelte, plain JS). Because
it must run in the browser, import it only in client-side code (guard against
server-side rendering / SSG).

# Versioning, releases & security

- **Changelog / releases:** every npm version has a matching
  [GitHub Release](https://github.com/product-fruits/npm-product-fruits/releases)
  with notes. The latest version published on npm is the recommended version for
  production.
- **Provenance:** each release is published from CI with npm provenance, so the
  published package is verifiably built from this repository (`npm audit signatures`).
- **Security policy & vulnerability reporting:** see [SECURITY.md](SECURITY.md).

# More docs

Read more at [https://help.productfruits.com/en/article/npm-package](https://help.productfruits.com/en/article/installation-via-npm-package)
