open-index/open-npm huggingface dataset:
npm package: @store-sync/redux-middleware
Description: Redux middleware that syncs state
Author: João Jerónimo
Latest version: 0.0.5

# `reduxMiddleware`

Syncs your redux store with a store-sync backend

## Usage

```
import { createStore, combineReducers, applyMiddleware } from 'redux'
import storeSync from '@store-sync/redux-middleware'
import userReducer from './user-reducer'

const sync = storeSync({
  url: 'wss://yourbackend.com/'
})

const userStore = createStore(
  userReducer,
  applyMiddleware(sync)
)
```
npm package: @store-unit/react
Description: A React integration for store-unit, a watchable data unit for UIs
Author: everdimension
Latest version: 1.0.4

# @store-unit/react

A react integration for [store-unit](https://github.com/everdimension/store-unit)

## Getting Started

### Install

```sh
npm install @store-unit/react

```

### Usage

```typescript
import { Store } from 'store-unit';
import { useStore } from '@store-unit/react';

const themeStore = new Store({ isLight: true });

export function Component() {
  const value = useStore(themeStore);
  return (
    <div style={{ background: value.isLight ? 'white' : 'black' }}>
      <button
        onClick={() => {
          themeStore.setState({ isLight: !value.isLight });
        }}
      >
        Toggle theme
      </button>
    </div>
  );
}
```
npm package: @storebox/react-native-detector
Description: a screenshot detector for react native
Author: Abdulaziz Alkharashi
Latest version: 0.2.3

# react-native-detector

a simply and easy to use screenshot detector for react native

## Installation

yarn

```sh
yarn add react-native-detector
```

npm

```sh
npm install react-native-detector
```

### iOS

```sh
cd ios && pod install
```

### android

for Android you need to have access for `READ_EXTERNAL_STORAGE` to detect screenshots by user to do that you just need to add this line in `AndroidManifest.xml`

```xml
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
```

and get user permission

```js
import { PermissionsAndroid } from 'react-native';

//...
const requestPermission = async () => {
  await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
    {
      title: 'Get Read External Storage Access',
      message: 'get read external storage access for detecting screenshots',
      buttonNeutral: 'Ask Me Later',
      buttonNegative: 'Cancel',
      buttonPositive: 'OK',
    }
  );
};
```

## Usage

```js
import {
  addScreenshotListener,
  removeScreenshotListener,
} from 'react-native-detector';

// ...
React.useEffect(() => {
  const userDidScreenshot = () => {
    console.log('User took screenshot');
  };
  const unsubscribe = addScreenshotListener(userDidScreenshot);
  return () => {
    unsubscribe();
  };
}, []);
```

## Roadmap

|                        Status                         | Goal                                   |
| :---------------------------------------------------: | :------------------------------------- |
|                          ✅                           | iOS version of screenshot detector     |
| ✅ (Thanks to [@mhssn95](https://github.com/mhssn95)) | Android version of screenshot detector |
|                          🚧                           | Screen recording detecting             |
|                          🚧                           | Calls detector                         |

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT
npm package: @storecraft/database-mongodb
Description: Storecraft database driver for mongodb on node / bun / deno platform
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft MongoDB driver for node / deno / bun

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

[![MongoDB](https://github.com/store-craft/storecraft/actions/workflows/test.database-mongodb.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.database-mongodb.yml)

Official `mongodb` driver for `StoreCraft` on **Node.js** / **Deno** / **Bun** platforms.
Also, official support for mongo-db as vector store.

```bash
npm i @storecraft/database-mongodb
```

## usage

```js
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { MongoDB } from '@storecraft/database-mongodb'
import { migrateToLatest } from '@storecraft/database-mongodb/migrate.js'
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { MongoVectorStore } from '@storecraft/database-mongodb/vector-store'

const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(
  new MongoDB(
    {
      url: process.env.MONGODB_URL,
      db_name: process.env.MONGODB_NAME,
    }
  )
)
.withVectorStore(
  new MongoVectorStore(
    { 
      embedder: new OpenAIEmbedder(),
      url: process.env.MONGODB_VECTOR_STORE_URL ?? process.env.MONGODB_URL,
      db_name: process.env.MONGODB_VECTOR_STORE_DB_NAME ?? process.env.MONGODB_NAME,
    }
  )
)
.init();

await migrateToLatest(app.__show_me_everything.db, false);
await app.__show_me_everything.vector_store.createVectorIndex();

http.createServer(app.handler).listen(
  8000,
  () => {
    app.print_banner('http://localhost:8000');
  }
); 

```


Storecraft will search the following `env` variables

```bash
MONGODB_NAME=main
MONGODB_URL='mongodb-connection-string'

// also, this will default into `MONGODB_NAME`
MONGODB_VECTOR_STORE_DB_NAME=vector-store
// also, this will default into `MONGODB_URL`
MONGODB_VECTOR_STORE_URL='mongodb-connection-string'
```

So, you can instantiate with empty config

```ts
.withDatabase(
  new MongoDB()
)
.withVectorStore(
  new MongoVectorStore(
    {
      embedder: new OpenAIEmbedder(),
    }
  )
)
```


## Testing Locally (I recommend to use `Atlas`)

1. Start a `mongo-db` server with `docker`

First, make sure you have `docker` installed,
Then, run

```bash
npm run database-mongodb:docker-compose-up
```

2. create Environment

create `.env` file with

```bash
MONGODB_URL="mongodb://127.0.0.1:27017/?replicaSet=rs0"
MONGODB_NAME="main"
```

3. Run `tests/runner.test.js`

```bash
npm run database-mongodb:test
```


```text
Author: Tomer Shalev <tomer.shalev@gmail.com>
```
npm package: @storecraft/database-mysql
Description: Official MySQL Database driver for storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft `MySQL` driver

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

[![SQLite / Postgres / MySQL](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml)

Official `MySQL` driver for `StoreCraft` using `mysql2` package.

```bash
npm i @storecraft/database-mysql
```

## usage

```js
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { MySQL } from '@storecraft/database-mysql';
import { migrateToLatest } from '@storecraft/database-sql-base/migrate.js'

const app = new App(
  {
    auth_admins_emails: ['admin@sc.com'],
  }
)
.withPlatform(new NodePlatform())
.withDatabase(
  new MySQL(
    {
      pool_options: {
        database: process.env.MYSQL_DATABASE,
        host: process.env.MYSQL_HOST,
        port: parseInt(process.env.MYSQL_PORT),
        user: process.env.MYSQL_USER,
        password: process.env.MYSQL_PASSWORD,
      }
    }
  )
)
.withStorage(new NodeLocalStorage('storage'))
.init();

await migrateToLatest(app.__show_me_everything.db, false);
await app.__show_me_everything.vector_store?.createVectorIndex();

http.createServer(app.handler).listen(
  8000,
  () => {
    app.print_banner('http://localhost:8000');
  }
); 

```

Storecraft will search the following `env` variables

```bash
MYSQL_USER=root
MYSQL_PASSWORD=password
MYSQL_DATABASE=main
MYSQL_PORT=3306
MYSQL_HOST=localhost
```

So, you can instantiate with empty config
```ts
.withDatabase(
  new MySQL()
)
```

## Testing Locally

1. First start a `mysql` server
First, make sure you have `docker` installed,
Then, run

```bash
npm run database-mysql:docker-compose-up
```

2. create Environment

create `.env` file with

```bash
MYSQL_USER=root
MYSQL_PASSWORD=password
MYSQL_DATABASE=main
MYSQL_PORT=3306
MYSQL_HOST=localhost
```

3. Run `tests/runner.test.js`

```bash
npm run database-mysql:test
```

```text
Author: Tomer Shalev <tomer.shalev@gmail.com>
```
npm package: @storecraft/database-neon
Description: `Storecraft` database driver for `Neon` over http
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft Neon (cloud postgres) Database support

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

Official `Neon` driver for `StoreCraft` on any platforms. Supports two serverless drivers:
1. `NeonServerless` - serverless neon, supports interactive transactions over websockets.
2. `NeonHttp` - serverless http only neon, supports NON-interactive transactions, only batches over HTTP.

```bash
npm i @storecraft/database-neon
```

## Setup

- First, login to your [neon account](https://neon.tech) account.
- Create a database.
- Copy the `connection string`.


## usage

```js
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { NeonHttp, NeonServerless } from '@storecraft/database-neon'
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { migrateToLatest } from '@storecraft/database-neon/migrate.js'

const app = new App(
  {
    auth_admins_emails: ['admin@sc.com'],
    auth_secret_access_token: 'auth_secret_access_token',
    auth_secret_refresh_token: 'auth_secret_refresh_token'
  }
)
.withPlatform(new NodePlatform())
.withDatabase(
  new NeonHttp(
    { 
      connectionString: process.env.NEON_CONNECTION_URL
    }
  )
)
.withStorage(new NodeLocalStorage('storage'))
.init();

await migrateToLatest(app.__show_me_everything.db, false);
await app.__show_me_everything.vector_store.createVectorIndex();

http.createServer(app.handler).listen(
  8000,
  () => {
    app.print_banner('http://localhost:8000');
  }
); 

```

```text
Author: Tomer Shalev <tomer.shalev@gmail.com>
```
npm package: @storecraft/database-planetscale
Description: `Storecraft` database driver for `PlanetScale` (cloud mysql)
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft Planetscale (cloud mysql) Database support

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

Official `Planetscale` (cloud MySql) driver for `StoreCraft` on any platforms.

```bash
npm i @storecraft/database-planetscale
```

## Setup

- First, login to your [planetscale](https://planetscale.com/) account.
- Create a database.
- Copy the `connection string`.


## usage

```js
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { PlanetScale } from '@storecraft/database-planetscale'
import { migrateToLatest } from '@storecraft/database-planetscale/migrate.js'

const app = new App(
  {
    auth_admins_emails: ['admin@sc.com'],
    auth_secret_access_token: 'auth_secret_access_token',
    auth_secret_refresh_token: 'auth_secret_refresh_token'
  }
)
.withPlatform(new NodePlatform())
.withDatabase(
  new PlanetScale(
    { 
      url: process.env.PLANETSCALE_CONNECTION_URL,
      useSharedConnection: true
    }
  )
)
.withStorage(new NodeLocalStorage('storage'))
.init();

await migrateToLatest(app.__show_me_everything.db, false);
await app.__show_me_everything.vector_store.createVectorIndex();

http.createServer(app.handler).listen(
  8000,
  () => {
    app.print_banner('http://localhost:8000');
  }
); 

```

```text
Author: Tomer Shalev <tomer.shalev@gmail.com>
```
npm package: @storecraft/database-postgres
Description: Official Postgres Database driver for storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft `Postgres` driver

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

[![SQLite / Postgres / MySQL](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml)

Official `Postgres` driver for `StoreCraft` using `pg` package.

```bash
npm i @storecraft/database-postgres
```

## usage

```js
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { Postgres } from '@storecraft/database-postgres';
import { migrateToLatest } from '@storecraft/database-sql-base/migrate.js'

const app = new App(
  {
    auth_admins_emails: ['admin@sc.com'],
  }
)
.withPlatform(new NodePlatform())
.withDatabase(
  new Postgres({
    pool_config: {
      host: process.env.POSTGRES_HOST,
      port: parseInt(process.env.POSTGRES_PORT),
      user: process.env.POSTGRES_USER,
      password: process.env.POSTGRES_PASSWORD,
    }
  })
)
.withStorage(new NodeLocalStorage('storage'))
.init();

await migrateToLatest(app.__show_me_everything.db, false);
await app.__show_me_everything.vector_store.createVectorIndex();

http.createServer(app.handler).listen(
  8000,
  () => {
    app.print_banner('http://localhost:8000');
  }
); 

```

Storecraft will search the following `env` variables

```bash
POSTGRES_USER='admin'
POSTGRES_PASSWORD='admin'
POSTGRES_PORT=6432
POSTGRES_HOST='localhost'
```

So, you can instantiate with empty config
```ts
.withDatabase(
  new Postgres()
)
```


## Testing Locally

1. First start a `postgres` server
First, make sure you have `docker` installed,
Then, run

```bash
npm run database-postgres:docker-compose-up
```

2. create Environment

create `.env` file with

```bash
POSTGRES_USER='admin'
POSTGRES_PASSWORD='admin'
POSTGRES_PORT=6432
POSTGRES_HOST='localhost'
```

3. Run `tests/runner.test.js`

```bash
npm run database-postgres:test
```


```text
Author: Tomer Shalev <tomer.shalev@gmail.com>
```
npm package: @storecraft/database-sqlite
Description: Official SQLite Database driver for storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft `SQLite` driver

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

[![SQLite / Postgres / MySQL](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.database-sql.yml)

Official `SQLite` driver for `StoreCraft` using `better-sqlite` package.

```bash
npm i @storecraft/database-sqlite
```

## usage

```js
import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { SQLite } from '@storecraft/database-sqlite'
import { migrateToLatest } from '@storecraft/database-sqlite/migrate.js'

const app = new App(
  {
    auth_admins_emails: ['admin@sc.com'],
  }
)
.withPlatform(new NodePlatform())
.withDatabase(
  new SQLite(
    { 
      filepath: join(homedir(), 'db.sqlite') 
    }
  )
)
.withStorage(new NodeLocalStorage())
.init();

await migrateToLatest(app.__show_me_everything.db, false);

http.createServer(app.handler).listen(
  8000,
  () => {
    app.print_banner('http://localhost:8000');
  }
); 
```

Storecraft will search the following `env` variables

```bash
SQLITE_FILEPATH=./data.db
```

So, you can instantiate with empty config
```ts
.withDatabase(
  new SQLite()
)
```


## Testing Locally

Simply run `tests/runner.test.js`

```bash
npm run database-sqlite:test
```

```text
Author: Tomer Shalev <tomer.shalev@gmail.com>
```
npm package: @storecraft/mailer-providers-http
Description: Official Serverless Friendly e-mail adapters for storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# `storecraft` Official serverless http email providers

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

Supports wellknown http-based `serverless` friendly `email` providers,

- [Sendgrid](https://docs.sendgrid.com/api-reference/mail-send/mail-send)
- [Resend](https://resend.com/docs/api-reference/emails/send-email)
- [Mailchimp](https://mailchimp.com/developer/transactional/api/messages/send-new-message/)
- [Mailgun](https://documentation.mailgun.com/en/latest/api-sending.html#examples)

```bash
npm i @storecraft/mailer-providers-http
```

## Howto

### Sendgrid

```js
import { App } from '@storecraft/core';
import { SendGrid } from '@storecraft/mailer-providers-http/sendgrid';

const app = new App(config)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(new GoogleStorage())
.withMailer(
  new SendGrid(
    {
      apikey: process.env.SEND_GRID_SECRET
    }
  )
).init();
```

Storecraft will search the following `env` variables

```bash
SENDGRID_API_KEY=<key>
```

So, you can instantiate with empty config

```ts
.withMailer(
  new SendGrid()
)
```

### Resend
```js
import { App } from '@storecraft/core';
import { Resend } from '@storecraft/mailer-providers-http/resend';

const app = new App(config)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(new GoogleStorage())
.withMailer(
  new Resend(
    {
      apikey: process.env.RESEND_API_KEY
    }
  )
).init();
```

Storecraft will search the following `env` variables

```bash
RESEND_API_KEY=<key>
```

So, you can instantiate with empty config

```ts
.withMailer(
  new Resend()
)
```

### Mailchimp

```js
import { App } from '@storecraft/core';
import { MailChimp } from '@storecraft/mailer-providers-http/mailchimp';

const app = new App(config)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(new GoogleStorage())
.withMailer(
  new MailChimp(
    {
      apikey: process.env.MAILCHIMP_API_KEY
    }
  )
).init();

```
Storecraft will search the following `env` variables

```bash
MAILCHIMP_API_KEY=<key>
```

So, you can instantiate with empty config

```ts
.withMailer(
  new MailChimp()
)
```

### Mailgun

```js

import { App } from '@storecraft/core';
import { Mailgun } from '@storecraft/mailer-providers-http/mailgun';

const app = new App(config)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(new GoogleStorage())
.withMailer(
  new Mailgun(
    {
      apikey: process.env.MAILGUN_API_KEY
    }
  )
).init();
```

Storecraft will search the following `env` variables

```bash
MAILGUN_API_KEY=<key>
```

So, you can instantiate with empty config

```ts
.withMailer(
  new Mailgun()
)
```

```text
Author: Tomer Shalev (tomer.shalev@gmail.com)
```
npm package: @storecraft/mailer-smtp
Description: Official SMTP email provider for node, deno and bun for storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# SMTP proxy client for Node.js

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

## Features
- Send emails using a known smtp server
- uses `nodemailer` under the hood

```bash
npm i @storecraft/mailer-smtp
```

## Howto

```js
import { MailerSmtpNode } from '@storecraft/mailer-smtp';

const mailer = new MailerSmtpNode(
  {
    host: "smtp.sendgrid.net",
    port: 465,
    secure: true, // true for 465, false for other ports
    auth: {
      user: 'apikey', // generated ethereal user
      pass: process.env.SEND_GRID_SECRET, // generated ethereal password
    },  
  }
);

let { success, native_response } = await mailer.email({
  from: {name: 'bob 👻', address: process.env.FROM_EMAIL }, // sender address
  to: [ { address: process.env.TO_EMAIL } ], // list of receivers
  subject: 'subject test', // Subject line
  text: 'plain text test', // plain text body
  html: '<p>html test</p>', // html body
});

```

```text
Author: Tomer Shalev (tomer.shalev@gmail.com)
```
npm package: @storecraft/payments-paypal
Description: Official Paypal integration with Storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# Paypal payment gateway for **StoreCraft**

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

[paypal](https://developer.paypal.com/docs/checkout/) integration

## Features
- Create checkouts with `AUTHORIZE` or `CAPTURE` intents
- `capture`, `void`, `refund` actions
- Get a readable and explainable `status`
- Supports both `prod` and `test` endpoints

```bash
npm i @storecraft/payments-paypal
```

## Howto

```ts
import { PayPal, Config } from '@storecraft/payments-paypal';

const config: Config = {
  env: 'prod',
  client_id: process.env.PAYPAL_CLIENT_ID,
  secret: env.process.PAYPAL_SECRET,
  currency_code: 'USD',
  intent_on_checkout: 'AUTHORIZE'
}

new Paypal(config);
```

## In Storecraft App

```ts
import { App } from '@storecraft/core';
import { MongoDB } from '@storecraft/database-mongodb';
import { NodePlatform } from '@storecraft/core/platform/node';
import { GoogleStorage } from '@storecraft/storage-google';
import { Paypal } from '@storecraft/payments-paypal'

const app = new App(config)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(new GoogleStorage())
.withPaymentGateways({
  paypal_standard_prod: new Paypal() // config can be inferred from env variables
}).init();

```

## Developer info and test

Integration examples
- [https://developer.paypal.com/](https://developer.paypal.com/)

Credit Card Generator
- [https://developer.paypal.com/tools/sandbox/card-testing/#link-creditcardgenerator](https://developer.paypal.com/tools/sandbox/card-testing/#link-creditcardgenerator)

## todo:
- Add tests
- Add webhook support

```text
Author: Tomer Shalev (tomer.shalev@gmail.com)
```
npm package: @storecraft/payments-stripe
Description: Official Storecraft <-> Stripe integration
Author: Tomer Shalev
Latest version: 1.3.0

# Stripe payment gateway for **StoreCraft**

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

[Stripe](https://docs.stripe.com/payments/place-a-hold-on-a-payment-method) integration


```bash
npm i @storecraft/payments-stripe
```

## Howto

```js
import { Stripe } from '@storecraft/payments-stripe';
import { Stripe as StripeCls } from 'stripe';

const config = {
  //`stripe` publishable key. if missing, it will be inferred from env variable
  publishable_key: env.process.STRIPE_PUBLISHABLE_KEY // 'pk_....',

  // `stripe` private secret. if missing, it will be inferred from env variable
  secret: process.env.STRIPE_SECRET_KEY //'sk_.....',

  // (Optional) `stripe` private `webhook` secret.
  // if missing, it will be inferred from env variable
  webhook_endpoint_secret: process.env.STRIPE_WEBHOOK_SECRET // 'whsec_.....',
  
  // config options for `stripe`
  stripe_config: {
    httpClient: StripeCls.createFetchHttpClient()
  },

  // configure `intent` creation
  stripe_intent_create_params: {
    currency: 'usd', 
    automatic_payment_methods: {
      enabled: true,
    },
    payment_method_options: {
      card: {
        // authorize and capture flow
        capture_method: 'manual',
      },
    },
  }  
}

new Stripe(config);

// or, env variables will be inferred by 
// - `STRIPE_PUBLISHABLE_KEY`
// - `STRIPE_SECRET_KEY`
// - `STRIPE_WEBHOOK_SECRET`
new Stripe();
```

## In Storecraft App

```ts
import { App } from '@storecraft/core';
import { MongoDB } from '@storecraft/database-mongodb';
import { NodePlatform } from '@storecraft/core/platform/node';
import { GoogleStorage } from '@storecraft/storage-google';
import { PaypalStandard } from '@storecraft/payments-paypal-standard'

const app = new App(config)
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(new GoogleStorage())
.withPaymentGateways({
  stripe: new Stripe() // config can be inferred from env variables
})
.init();

```


## Developer info and test

First, some resources from `stripe`

- [Authorize and Capture Flow](https://docs.stripe.com/payments/place-a-hold-on-a-payment-method)
- [Webhooks](https://docs.stripe.com/webhooks)
- [Credit Card Generator](https://developer.paypal.com/tools/sandbox/card-testing/#link-creditcardgenerator)

## Test Webhooks
First, consult [Stripe Webhooks Docs](https://docs.stripe.com/webhooks)
Then, Install the `stripe` cli.

```bash
stripe listen --skip-verify --forward-to localhost:8000/api/payments/gateways/stripe/webhook
```

This will print the `webhook` **SECRET**

```bash
Ready! Your webhook signing secret is '{{WEBHOOK_SIGNING_SECRET}}' (^C to quit)
```

Copy the `WEBHOOK_SIGNING_SECRET` and put it in the `config` of the gateway.

Now, start interacting, and test some payments.


## todo:
- Add tests


```text
Author: Tomer Shalev (tomer.shalev@gmail.com)
```
npm package: @storecraft/sdk-react-hooks
Description: Official Storecraft Javascript SDK React Hooks
Author: Tomer Shalev
Latest version: 1.3.0

# **Storecraft** Official React Hooks

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

Official **React** hooks for storecraft's javascript `SDK`.
Many hooks manage the state into the browser `LocalStorage` and even a cache
hook for `IndexDB`. All hooks have types and documentation.

Start by installing the package:

```bash
npm i @storecraft/sdk-react-hooks
```

Some of the useful hooks are:

## `useStorecraft()`

Gain access into the **SDK**, you can initialize with sdk config or you can
defer it and use the `updateConfig` callback. Either way, the config will be saved
locally with `LocalStorage` at the browser.

```js

import { useStorecraftSDK } from '@storecraft/sdk-react-hooks'

const {
  config,
  sdk, 
  isAuthenticated, 
  error,
  actions: {
    updateConfig
  }
} = useStorecraftSDK(config)

```


## `useAuth()`

Gain access and subscribe to `authentication` updates

```js

import { useAuth } from '@storecraft/sdk-react-hooks'

const {
  auth,
  isAuthenticated,
  actions: {
    signin, 
    signup, 
    signout
  }
} = useAuth();

```

## `useDocument()`

Fetch / Mutate a single document by `id` or `handle`

```js

import { useDocument } from '@storecraft/sdk-react-hooks'

const {
  doc, 
  sdk,
  loading, 
  hasLoaded, 
  error, 
  op, 
  resource,
  document,
  actions: { 
    reload, upsert, remove, setError,
  }
} = useDocument(
  'products', 
  'product_id_or_handle', 
  autoLoad=true, 
  try_cache_on_autoload=true
);

```

## `useCollection()`

Query collection of documents with pagination

```js

import { useCollection } from '@storecraft/sdk-react-hooks'

const {
  pages, 
  page,
  loading, 
  error, 
  sdk,
  queryCount, 
  resource,
  actions: {
    prev, 
    next, 
    query,
    poll, 
    removeDocument
  },
} = useCollection(
  'products', 
  { // optional initial query
    order: 'desc',
    sortBy: ['updated_at', 'id'],
    vql: {
      updated_at: {
        $gte: '2024-03-24',
      },
      active: true,
      $or: [
        { $search: 'tag:genre_action' },
        { $search: 'tag:genre_sports' },
      ],
    },
    limit: 10,
  },
  autoLoad=true, 
);

```

## `useCart()`

A utility hook to manage a frontend cart with `LocalStorage` support.
This can be used later to create a checkout session.

```js

import { useCart } from '@storecraft/sdk-react-hooks'

const {
  cart: {
    line_items, 
    coupons, 
    shipping,
    customer,
    updated_at,
    created_at,
  },
  actions: {
    addItem, 
    removeItem, 
    clearCart,
    setCoupons,
    setShipping,
    setCustomer,
  }
} = useCart();

```

```text
Author: Tomer Shalev (tomer.shalev@gmail.com)
```
npm package: @storecraft/storage-google
Description: Official Google Storage adapter for storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft Google Cloud Storage

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

**Storecraft** supports the `Google Storage` services. The service is 
serverless friendly. Through the `@storecraft/storage-google` package.

Features:
- Works in any `js` runtime and platform that supports `fetch`
- Supports streaming `Get` / `Put` / `Delete`
- Supports `presigned` `Get` / `Put` requests to offload to client

## How-to
1. Create a bucket at `GCP console` or even at `firebase`
2. Download the `service json file`

Use the values of the service file.

Note:
- You can use an empty constructor and upon `StoreCraft` init, the platform
environment variables will be used by this storage if needed.


## Usage

```bash
npm i @storecraft/storage-google
```
  
then,

```ts
import { App } from '@storecraft/core';
import { GoogleStorage } from '@storecraft/storage-google';

const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
  new GoogleStorage(
    {
      bucket: process.env.GS_BUCKET, 
      client_email: process.env.GS_CLIENT_EMAIL, 
      private_key: process.env.GS_PRIVATE_KEY, 
      private_key_id: process.env.GS_PRIVATE_KEY_ID
    }
  )
).init();
  
```

## config

Storecraft will search the following `env` variables

```bash
GS_BUCKET=...
GS_CLIENT_EMAIL=...
GS_PRIVATE_KEY=...
GS_PRIVATE_KEY_ID=...
```

So, you can instantiate with empty config

```ts
.withStorage(
  new GoogleStorage()
)
```

```text
Author: Tomer Shalev (tomer.shalev@gmail.com)
```
npm package: @storecraft/storage-s3-compatible
Description: Official S3-Compatible Storage adapter for storecraft
Author: Tomer Shalev
Latest version: 1.3.0

# Storecraft S3 compatible storage

<div style="text-align:center">
  <img src='https://storecraft.app/storecraft-color.svg' 
       width='90%' />
</div><hr/><br/>

[![S3 Compatible](https://github.com/store-craft/storecraft/actions/workflows/test.storage-s3-compatible.yml/badge.svg)](https://github.com/store-craft/storecraft/actions/workflows/test.storage-s3-compatible.yml)

`fetch` ready support for an `S3` like storage:
- `Amazon S3`
- `Cloudflare R2`
- `DigitalOcean Spaces`
- `minIO` servers

Features:
- Works in any `js` runtime and platform that supports `fetch`
- Supports streaming `Get` / `Put` / `Delete`
- Supports `presigned` `Get` / `Put` requests to offload to client

```bash
npm i @storecraft/storage-s3-compatible
```

## AWS S3

```js
import { App } from '@storecraft/core';
import { S3 } from '@storecraft/storage-s3-compatible'

const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
  new S3(
    {
      forcePathStyle: FORCE_PATH_STYLE,
      bucket: process.env.S3_BUCKET,
      region: process.env.S3_REGION,
      accessKeyId: process.env.S3_ACCESS_KEY_ID,
      secretAccessKey: process.env.S3_SECRET_KEY
    }
  )
).init();
```

## config

Storecraft will search the following `env` variables

```bash
S3_BUCKET=...
S3_REGION=...
S3_ACCESS_KEY_ID=...
S3_SECRET_KEY=...
```

So, you can instantiate with empty config

```ts
.withStorage(
  new S3()
)
```


## Cloudflare R2

```js
import { App } from '@storecraft/core';
import { R2 } from '@storecraft/storage-s3-compatible'

const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
  new R2(
    {
      account_id: process.env.CF_ACCOUNT_ID,
      bucket: process.env.S3_BUCKET,
      accessKeyId: process.env.S3_ACCESS_KEY_ID,
      secretAccessKey: process.env.S3_SECRET_ACCESS_KEY
    }
  )
).init();

```

## config

Storecraft will search the following `env` variables

```bash
CF_ACCOUNT_ID=...
S3_BUCKET=...
S3_ACCESS_KEY_ID=...
S3_SECRET_ACCESS_KEY=...
```

So, you can instantiate with empty config

```ts
.withStorage(
  new R2()
)
```

### Any S3 compatible storage (minio for example)

```js
import { App } from '@storecraft/core';
import { S3CompatibleStorage } from '@storecraft/storage-s3-compatible'

const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB())
.withStorage(
  new S3CompatibleStorage(
    {
      endpoint: process.env.S3_ENDPOINT,
      accessKeyId: process.env.S3_ACCESS_KEY_ID,
      secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
      bucket: process.env.S3_BUCKET,
      region: process.env.S3_REGION
      forcePathStyle: true,
    }
  )
).init();
```

## config

Storecraft will search the following `env` variables

```bash
S3_ENDPOINT=...
S3_BUCKET=...
S3_REGION=...
S3_ACCESS_KEY_ID=...
S3_SECRET_KEY=...
```

So, you can instantiate with empty config

```ts
.withStorage(
  new S3CompatibleStorage()
)
```


```text
Author: Tomer Shalev (tomer.shalev@gmail.com)
```
npm package: @storefront/breadcrumbs
Description: StoreFront breadcrumbs component
Latest version: 2.10.0

# StoreFront breadcrumbs

StoreFront `<gb-breadcrumbs>` component

[![npm (scoped with tag)](https://img.shields.io/npm/v/@storefront/breadcrumbs.svg?style=flat-square)](https://www.npmjs.com/package/@storefront/breadcrumbs)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![API Reference](https://img.shields.io/badge/API_reference-latest-blue.svg?style=flat-square)](https://groupby.github.io/storefront/modules/_storefront_breadcrumbs.html)

## Getting Started

This module requires [`@storefront/core`](https://www.npmjs.com/package/@storefront/core) for the component to render
and receive data from GroupBy microservices.

### Prerequisites

This module is meant to be used in a `node` environment which is bundled for use in the browser.

### Installing

Use `npm` or `yarn` to install in a `node` project that uses `webpack`, `browserify` or similar.

```sh
npm install --save @storefront/breadcrumbs
# or
yarn add @storefront/breadcrumbs
```

## Usage

This module provides the `<gb-breadcrumbs>` component for use with StoreFront.

### Mount tag

```html
<!-- index.html -->
<body>
  <gb-breadcrumbs></gb-breadcrumbs>
</body>
```

```js
// index.js
storefront.mount('gb-breadcrumbs');
```

### Building the package
To build an individual package, run the following command:
```sh
yarn build
```

To build an individual package in response to changes within the `src` directory, run the following command:
```sh
yarn dev
```

### Running tests
To test an individual packages, run the following command:
```sh
yarn test
```

To test an individual package in response to changes within the `src` and `test` directories, run the following command:
```sh
yarn tdd
```

### Linting
To lint a package, run the following command:
```sh
yarn lint
```

To programmatically fix lint errors within a package, run the following command:
```sh
yarn lint:fix
```

## Contributing
Read the [contributing](../../../CONTRIBUTING.md) file to learn about how to contribute to the StoreFront project.

## License
StoreFront and its related packages are [MIT licensed](../../../LICENSE).
npm package: @storefront/collections
Description: StoreFront collections component
Latest version: 2.9.0

# StoreFront collections

StoreFront `<gb-collections>` component

[![npm (scoped with tag)](https://img.shields.io/npm/v/@storefront/collections.svg?style=flat-square)](https://www.npmjs.com/package/@storefront/collections)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![API Reference](https://img.shields.io/badge/API_reference-latest-blue.svg?style=flat-square)](https://groupby.github.io/storefront/modules/_storefront_collections.html)

## Getting Started

This module requires [`@storefront/core`](https://www.npmjs.com/package/@storefront/core) for the component to render
and receive data from GroupBy microservices.

### Prerequisites

This module is meant to be used in a `node` environment which is bundled for use in the browser.

### Installing

Use `npm` or `yarn` to install in a `node` project that uses `webpack`, `browserify` or similar.

```sh
npm install --save @storefront/collections
# or
yarn add @storefront/collections
```

## Usage

This module provides the `<gb-collections>` component for use with StoreFront.

### Mount tag

```html
<!-- index.html -->
<body>
  <gb-collections></gb-collections>
</body>
```

```js
// index.js
storefront.mount('gb-collections');
```

### Building the package
To build an individual package, run the following command:
```sh
yarn build
```

To build an individual package in response to changes within the `src` directory, run the following command:
```sh
yarn dev
```

### Running tests
To test an individual packages, run the following command:
```sh
yarn test
```

To test an individual package in response to changes within the `src` and `test` directories, run the following command:
```sh
yarn tdd
```

### Linting
To lint a package, run the following command:
```sh
yarn lint
```

To programmatically fix lint errors within a package, run the following command:
```sh
yarn lint:fix
```

## Contributing
Read the [contributing](../../../CONTRIBUTING.md) file to learn about how to contribute to the StoreFront project.

## License
StoreFront and its related packages are [MIT licensed](../../../LICENSE).
npm package: @storefront/details
Description: StoreFront details component
Latest version: 2.9.0

# StoreFront details

StoreFront `<gb-details>` component

[![npm (scoped with tag)](https://img.shields.io/npm/v/@storefront/details.svg?style=flat-square)](https://www.npmjs.com/package/@storefront/details)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![API Reference](https://img.shields.io/badge/API_reference-latest-blue.svg?style=flat-square)](https://groupby.github.io/storefront/modules/_storefront_details.html)

## Getting Started

This module requires [`@storefront/core`](https://www.npmjs.com/package/@storefront/core) for the component to render
and receive data from GroupBy microservices.

### Prerequisites

This module is meant to be used in a `node` environment which is bundled for use in the browser.

### Installing

Use `npm` or `yarn` to install in a `node` project that uses `webpack`, `browserify` or similar.

```sh
npm install --save @storefront/details
# or
yarn add @storefront/details
```

## Usage

This module provides the `<gb-details>` component for use with StoreFront.

### Mount tag

```html
<!-- index.html -->
<body>
  <gb-details></gb-details>
</body>
```

```js
// index.js
storefront.mount('gb-details');
```

### Building the package
To build an individual package, run the following command:
```sh
yarn build
```

To build an individual package in response to changes within the `src` directory, run the following command:
```sh
yarn dev
```

### Running tests
To test an individual packages, run the following command:
```sh
yarn test
```

To test an individual package in response to changes within the `src` and `test` directories, run the following command:
```sh
yarn tdd
```

### Linting
To lint a package, run the following command:
```sh
yarn lint
```

To programmatically fix lint errors within a package, run the following command:
```sh
yarn lint:fix
```

## Contributing
Read the [contributing](../../../CONTRIBUTING.md) file to learn about how to contribute to the StoreFront project.

## License
StoreFront and its related packages are [MIT licensed](../../../LICENSE).
npm package: @storefront/did-you-mean
Description: StoreFront did-you-mean component
Author: Ben Teichman
Latest version: 2.9.0

# StoreFront did-you-mean

StoreFront `<gb-did-you-mean>` component

[![npm (scoped with tag)](https://img.shields.io/npm/v/@storefront/did-you-mean.svg?style=flat-square)](https://www.npmjs.com/package/@storefront/did-you-mean)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![API Reference](https://img.shields.io/badge/API_reference-latest-blue.svg?style=flat-square)](https://groupby.github.io/storefront/modules/_storefront_did_you_mean.html)

## Getting Started

This module requires [`@storefront/core`](https://www.npmjs.com/package/@storefront/core) for the component to render
and receive data from GroupBy microservices.

### Prerequisites

This module is meant to be used in a `node` environment which is bundled for use in the browser.

### Installing

Use `npm` or `yarn` to install in a `node` project that uses `webpack`, `browserify` or similar.

```sh
npm install --save @storefront/did-you-mean
# or
yarn add @storefront/did-you-mean
```

## Usage

This module provides the `<gb-did-you-mean>` component for use with StoreFront.

### Mount tag

```html
<!-- index.html -->
<body>
  <gb-did-you-mean></gb-did-you-mean>
</body>
```

```js
// index.js
storefront.mount('gb-did-you-mean');
```

### Building the package
To build an individual package, run the following command:
```sh
yarn build
```

To build an individual package in response to changes within the `src` directory, run the following command:
```sh
yarn dev
```

### Running tests
To test an individual packages, run the following command:
```sh
yarn test
```

To test an individual package in response to changes within the `src` and `test` directories, run the following command:
```sh
yarn tdd
```

### Linting
To lint a package, run the following command:
```sh
yarn lint
```

To programmatically fix lint errors within a package, run the following command:
```sh
yarn lint:fix
```

## Contributing
Read the [contributing](../../../CONTRIBUTING.md) file to learn about how to contribute to the StoreFront project.

## License
StoreFront and its related packages are [MIT licensed](../../../LICENSE).
npm package: @storefront/flux-capacitor
Description: State management for StoreFront
Author: Ben Teichman
Latest version: 1.74.1

# FluxCapacitor

State Management for StoreFront

[![npm (scoped with tag)](https://img.shields.io/npm/v/@storefront/flux-capacitor.svg?style=flat-square)](https://www.npmjs.com/package/@storefront/flux-capacitor)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![API Reference](https://img.shields.io/badge/API_reference-latest-blue.svg?style=flat-square)](https://groupby.github.io/storefront/modules/_storefront_flux_capacitor.html)

### Building the package
To build an individual package, run the following command:
```sh
yarn build
```

To build an individual package in response to changes within the `src` directory, run the following command:
```sh
yarn dev
```

### Running tests
To test an individual packages, run the following command:
```sh
yarn test
```

To test an individual package in response to changes within the `src` and `test` directories, run the following command:
```sh
yarn tdd
```

### Linting
To lint a package, run the following command:
```sh
yarn lint
```

To programmatically fix lint errors within a package, run the following command:
```sh
yarn lint:fix
```

## Contributing
Read the [contributing](../../../CONTRIBUTING.md) file to learn about how to contribute to the StoreFront project.

## License
StoreFront and its related packages are [MIT licensed](../../../LICENSE).
npm package: @storefront/infinite-scroll
Description: StoreFront infinite-scroll component
Latest version: 2.9.0

# StoreFront infinite-scroll

StoreFront `<gb-infinite-scroll>` component

[![npm (scoped with tag)](https://img.shields.io/npm/v/@storefront/infinite-scroll.svg?style=flat-square)](https://www.npmjs.com/package/@storefront/infinite-scroll)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![API Reference](https://img.shields.io/badge/API_reference-latest-blue.svg?style=flat-square)](https://groupby.github.io/storefront/modules/_storefront_infinite_scroll.html)

## Getting Started

This module requires [`@storefront/core`](https://www.npmjs.com/package/@storefront/core) for the component to render
and receive data from GroupBy microservices.

### Prerequisites

This module is meant to be used in a `node` environment which is bundled for use in the browser.

### Installing

Use `npm` or `yarn` to install in a `node` project that uses `webpack`, `browserify` or similar.

```sh
npm install --save @storefront/infinite-scroll
# or
yarn add @storefront/infinite-scroll
```

## Usage

This module provides the `<gb-infinite-scroll>` component for use with StoreFront.

### Mount tag

```html
<!-- index.html -->
<body>
  <gb-infinite-scroll></gb-infinite-scroll>
</body>
```

```js
// index.js
storefront.mount('gb-infinite-scroll');
```

### Building the package
To build an individual package, run the following command:
```sh
yarn build
```

To build an individual package in response to changes within the `src` directory, run the following command:
```sh
yarn dev
```

### Running tests
To test an individual packages, run the following command:
```sh
yarn test
```

To test an individual package in response to changes within the `src` and `test` directories, run the following command:
```sh
yarn tdd
```

### Linting
To lint a package, run the following command:
```sh
yarn lint
```

To programmatically fix lint errors within a package, run the following command:
```sh
yarn lint:fix
```

## Contributing
Read the [contributing](../../../CONTRIBUTING.md) file to learn about how to contribute to the StoreFront project.

## License
StoreFront and its related packages are [MIT licensed](../../../LICENSE).
npm package: @storefront/navigation
Description: StoreFront navigation component
Latest version: 2.9.0

# StoreFront navigation

StoreFront `<gb-navigation>` component

[![npm (scoped with tag)](https://img.shields.io/npm/v/@storefront/navigation.svg?style=flat-square)](https://www.npmjs.com/package/@storefront/navigation)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![API Reference](https://img.shields.io/badge/API_reference-latest-blue.svg?style=flat-square)](https://groupby.github.io/storefront/modules/_storefront_navigation.html)

## Getting Started

This module requires [`@storefront/core`](https://www.npmjs.com/package/@storefront/core) for the component to render
and receive data from GroupBy microservices.

### Prerequisites

This module is meant to be used in a `node` environment which is bundled for use in the browser.

### Installing

Use `npm` or `yarn` to install in a `node` project that uses `webpack`, `browserify` or similar.

```sh
npm install --save @storefront/navigation
# or
yarn add @storefront/navigation
```

## Usage

This module provides the `<gb-navigation>` component for use with StoreFront.

### Mount tag

```html
<!-- index.html -->
<body>
  <gb-navigation></gb-navigation>
</body>
```

```js
// index.js
storefront.mount('gb-navigation');
```

### Building the package
To build an individual package, run the following command:
```sh
yarn build
```

To build an individual package in response to changes within the `src` directory, run the following command:
```sh
yarn dev
```

### Running tests
To test an individual packages, run the following command:
```sh
yarn test
```

To test an individual package in response to changes within the `src` and `test` directories, run the following command:
```sh
yarn tdd
```

### Linting
To lint a package, run the following command:
```sh
yarn lint
```

To programmatically fix lint errors within a package, run the following command:
```sh
yarn lint:fix
```

## Contributing
Read the [contributing](../../../CONTRIBUTING.md) file to learn about how to contribute to the StoreFront project.

## License
StoreFront and its related packages are [MIT licensed](../../../LICENSE).