Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Tags: flowglad/flowglad

Tags

v0.18.0

Toggle v0.18.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1762)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## [email protected]

### Minor Changes

-   eed1758: ### New Flowglad CLI Package

- [be03970](be039709):
Initial release of the Flowglad CLI package

- Install globally with `npm install -g flowglad` or run directly with
`npx flowglad`
- Built with `cac` CLI framework for lightweight, TypeScript-first
command handling
        -   Requires Node.js 18.0.0 or higher
        -   Dual ESM/CJS output with TypeScript declarations

- [95d77db](95d77db4): CLI
framework and help command implementation
- `flowglad help` command displays available commands and roadmap
        -   Extensible command registration pattern for future commands
- Foundation for pricing-as-code workflow (login, link, pull, push,
deploy coming soon)

    ### Documentation

Full CLI documentation available at
[flowglad.com/docs/cli](https://flowglad.com/docs/cli)

    ## Breaking Changes

⚠️ **None** - This is an additive release introducing the new CLI
package.

## @flowglad/[email protected]

### Minor Changes

-   eed1758: ### New Flowglad CLI Package

- [be03970](be039709):
Initial release of the Flowglad CLI package

- Install globally with `npm install -g flowglad` or run directly with
`npx flowglad`
- Built with `cac` CLI framework for lightweight, TypeScript-first
command handling
        -   Requires Node.js 18.0.0 or higher
        -   Dual ESM/CJS output with TypeScript declarations

- [95d77db](95d77db4): CLI
framework and help command implementation
- `flowglad help` command displays available commands and roadmap
        -   Extensible command registration pattern for future commands
- Foundation for pricing-as-code workflow (login, link, pull, push,
deploy coming soon)

    ### Documentation

Full CLI documentation available at
[flowglad.com/docs/cli](https://flowglad.com/docs/cli)

    ## Breaking Changes

⚠️ **None** - This is an additive release introducing the new CLI
package.

### Patch Changes

-   Updated dependencies [eed1758]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   eed1758: ### New Flowglad CLI Package

- [be03970](be039709):
Initial release of the Flowglad CLI package

- Install globally with `npm install -g flowglad` or run directly with
`npx flowglad`
- Built with `cac` CLI framework for lightweight, TypeScript-first
command handling
        -   Requires Node.js 18.0.0 or higher
        -   Dual ESM/CJS output with TypeScript declarations

- [95d77db](95d77db4): CLI
framework and help command implementation
- `flowglad help` command displays available commands and roadmap
        -   Extensible command registration pattern for future commands
- Foundation for pricing-as-code workflow (login, link, pull, push,
deploy coming soon)

    ### Documentation

Full CLI documentation available at
[flowglad.com/docs/cli](https://flowglad.com/docs/cli)

    ## Breaking Changes

⚠️ **None** - This is an additive release introducing the new CLI
package.

### Patch Changes

-   Updated dependencies [eed1758]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   eed1758: ### New Flowglad CLI Package

- [be03970](be039709):
Initial release of the Flowglad CLI package

- Install globally with `npm install -g flowglad` or run directly with
`npx flowglad`
- Built with `cac` CLI framework for lightweight, TypeScript-first
command handling
        -   Requires Node.js 18.0.0 or higher
        -   Dual ESM/CJS output with TypeScript declarations

- [95d77db](95d77db4): CLI
framework and help command implementation
- `flowglad help` command displays available commands and roadmap
        -   Extensible command registration pattern for future commands
- Foundation for pricing-as-code workflow (login, link, pull, push,
deploy coming soon)

    ### Documentation

Full CLI documentation available at
[flowglad.com/docs/cli](https://flowglad.com/docs/cli)

    ## Breaking Changes

⚠️ **None** - This is an additive release introducing the new CLI
package.

### Patch Changes

-   Updated dependencies [eed1758]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   eed1758: ### New Flowglad CLI Package

- [be03970](be039709):
Initial release of the Flowglad CLI package

- Install globally with `npm install -g flowglad` or run directly with
`npx flowglad`
- Built with `cac` CLI framework for lightweight, TypeScript-first
command handling
        -   Requires Node.js 18.0.0 or higher
        -   Dual ESM/CJS output with TypeScript declarations

- [95d77db](95d77db4): CLI
framework and help command implementation
- `flowglad help` command displays available commands and roadmap
        -   Extensible command registration pattern for future commands
- Foundation for pricing-as-code workflow (login, link, pull, push,
deploy coming soon)

    ### Documentation

Full CLI documentation available at
[flowglad.com/docs/cli](https://flowglad.com/docs/cli)

    ## Breaking Changes

⚠️ **None** - This is an additive release introducing the new CLI
package.


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Prepares the 0.18.0 release across all packages and introduces the
Flowglad CLI. Updates changelogs and internal package versions.

- **New Features**
- Flowglad CLI with a help command and extensible command registration.
  - Dual ESM/CJS builds with TypeScript types.
  - Docs: flowglad.com/docs/cli

- **Migration**
  - No breaking changes.
  - CLI requires Node.js 18+.
  - Install with npm install -g flowglad or run with npx flowglad.

<sup>Written for commit 5045f08.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

v0.17.2

Toggle v0.17.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1716)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Patch Changes

-   a30a395: ### ESM Build Fixes

-
[99c16e5](99c16e5):
Fix ESM build for `@flowglad/server` and `@flowglad/shared`
- Resolves ESM import failures in SvelteKit and other ESM environments
- Adds explicit `.mjs`/`.cjs` file extensions for proper module format
detection
- Uses `esbuild-fix-imports-plugin` to add `.mjs` extensions to relative
imports
- Removes need for `package.json` marker files in dist directories
- Fixes issue #1500 where ESM imports failed with "Cannot find module"
errors

    ### Better Auth Import Changes

-
[12c2e01](12c2e01):
Remove better-auth re-exports from main entry point
- Prevents module resolution errors when `better-auth` is not installed
- Users should now import better-auth integration from
`@flowglad/server/better-auth` directly
- Fixes module resolution errors for users using other auth providers
(next-auth, Clerk, Supabase Auth)

    ## Breaking Changes

⚠️ **Better Auth Import Path Change** - If you were importing
better-auth helpers from `@flowglad/server`, you must now import from
`@flowglad/server/better-auth`:

    **Before:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server";
    ```

    **After:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server/better-auth";
    ```

-   Updated dependencies [a30a395]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   a30a395: ### ESM Build Fixes

-
[99c16e5](99c16e5):
Fix ESM build for `@flowglad/server` and `@flowglad/shared`
- Resolves ESM import failures in SvelteKit and other ESM environments
- Adds explicit `.mjs`/`.cjs` file extensions for proper module format
detection
- Uses `esbuild-fix-imports-plugin` to add `.mjs` extensions to relative
imports
- Removes need for `package.json` marker files in dist directories
- Fixes issue #1500 where ESM imports failed with "Cannot find module"
errors

    ### Better Auth Import Changes

-
[12c2e01](12c2e01):
Remove better-auth re-exports from main entry point
- Prevents module resolution errors when `better-auth` is not installed
- Users should now import better-auth integration from
`@flowglad/server/better-auth` directly
- Fixes module resolution errors for users using other auth providers
(next-auth, Clerk, Supabase Auth)

    ## Breaking Changes

⚠️ **Better Auth Import Path Change** - If you were importing
better-auth helpers from `@flowglad/server`, you must now import from
`@flowglad/server/better-auth`:

    **Before:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server";
    ```

    **After:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server/better-auth";
    ```

-   Updated dependencies [a30a395]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   a30a395: ### ESM Build Fixes

-
[99c16e5](99c16e5):
Fix ESM build for `@flowglad/server` and `@flowglad/shared`
- Resolves ESM import failures in SvelteKit and other ESM environments
- Adds explicit `.mjs`/`.cjs` file extensions for proper module format
detection
- Uses `esbuild-fix-imports-plugin` to add `.mjs` extensions to relative
imports
- Removes need for `package.json` marker files in dist directories
- Fixes issue #1500 where ESM imports failed with "Cannot find module"
errors

    ### Better Auth Import Changes

-
[12c2e01](12c2e01):
Remove better-auth re-exports from main entry point
- Prevents module resolution errors when `better-auth` is not installed
- Users should now import better-auth integration from
`@flowglad/server/better-auth` directly
- Fixes module resolution errors for users using other auth providers
(next-auth, Clerk, Supabase Auth)

    ## Breaking Changes

⚠️ **Better Auth Import Path Change** - If you were importing
better-auth helpers from `@flowglad/server`, you must now import from
`@flowglad/server/better-auth`:

    **Before:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server";
    ```

    **After:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server/better-auth";
    ```

-   Updated dependencies [a30a395]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   a30a395: ### ESM Build Fixes

-
[99c16e5](99c16e5):
Fix ESM build for `@flowglad/server` and `@flowglad/shared`
- Resolves ESM import failures in SvelteKit and other ESM environments
- Adds explicit `.mjs`/`.cjs` file extensions for proper module format
detection
- Uses `esbuild-fix-imports-plugin` to add `.mjs` extensions to relative
imports
- Removes need for `package.json` marker files in dist directories
- Fixes issue #1500 where ESM imports failed with "Cannot find module"
errors

    ### Better Auth Import Changes

-
[12c2e01](12c2e01):
Remove better-auth re-exports from main entry point
- Prevents module resolution errors when `better-auth` is not installed
- Users should now import better-auth integration from
`@flowglad/server/better-auth` directly
- Fixes module resolution errors for users using other auth providers
(next-auth, Clerk, Supabase Auth)

    ## Breaking Changes

⚠️ **Better Auth Import Path Change** - If you were importing
better-auth helpers from `@flowglad/server`, you must now import from
`@flowglad/server/better-auth`:

    **Before:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server";
    ```

    **After:**

    ```typescript
    import { flowgladPlugin } from "@flowglad/server/better-auth";
    ```


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Versioned @flowglad/nextjs, @flowglad/react, @flowglad/server, and
@flowglad/shared to 0.17.2 to ship ESM build fixes and a safer auth
import path. This resolves ESM import errors and removes better-auth
re-exports to avoid module resolution issues.

- **Migration**
- If you imported better-auth helpers from @flowglad/server, switch to
@flowglad/server/better-auth.

<sup>Written for commit 1dbcd61.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

v0.17.1

Toggle v0.17.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1688)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Patch Changes

-   7170932: ### Better Auth Plugin Improvements

- [790042d](790042dd):
Rework Better Auth plugin with organization support

- Organization customer resolution when `customerType="organization"`
using `session.activeOrganizationId` (and adapter lookups) if no custom
`getCustomer` is provided
- Added `getExternalId`, `billing/pricing`, and `getUsageMeterBalances`
endpoints integrated with Better Auth
- Optimized organization lookup and added membership verification in
billing endpoints for defense-in-depth
- Expanded test coverage for endpoints, plugin behavior, and utilities
- Updated example projects to use the plugin pattern and removed
standalone `/api/flowglad` route requirement
- Migration: Use `flowgladPlugin` in Better Auth and set
`FlowgladProvider betterAuthBasePath="/api/auth"` in apps

- [037f19e](037f19e2):
Update Better Auth documentation and type annotations
- Clarified external ID resolution using `session.session.userId` and
`session.session.activeOrganizationId`
        -   Added notes about customer auto-creation hooks behavior
        -   Updated examples and troubleshooting documentation
        -   Documented optional `baseURL` parameter

    ### Usage Meter Hooks

- [3fd2a3a](3fd2a3ae): Add
`useUsageMeters()` and `useUsageMeter()` hooks to `@flowglad/react`

- Provides dedicated and efficient way to fetch usage meter balances
without relying on the full billing payload
- Wired `createUsageEvent` to invalidate caches for these new usage
meter hooks, ensuring automatic refresh after usage events
        -   Includes dev-mode support and comprehensive tests

- [71fd192](71fd192a):
Implement server-side integration for `GetUsageMeterBalances` action

- Added `getUsageMeterBalances` to `FlowgladServer` to call the platform
endpoint
- Created and registered new subroute handler for
`GetUsageMeterBalances`
- Wired the new action into the Better Auth plugin for authentication
and authorization
- Includes comprehensive tests for the new handler and updated auth
mappings

- [9dcbf5e](9dcbf5eb): Add
shared usage meter schema and action key
- Introduced new authenticated action key (`usage-meters/balances`) and
Zod schema in the shared SDK
- Enables dedicated, narrow endpoint for fetching usage meter balances
- Decouples usage meter reads from the larger `GetCustomerBilling`
payload
- Includes comprehensive tests for the new schema and action validator

-   Updated dependencies [7170932]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   7170932: ### Better Auth Plugin Improvements

- [790042d](790042dd):
Rework Better Auth plugin with organization support

- Organization customer resolution when `customerType="organization"`
using `session.activeOrganizationId` (and adapter lookups) if no custom
`getCustomer` is provided
- Added `getExternalId`, `billing/pricing`, and `getUsageMeterBalances`
endpoints integrated with Better Auth
- Optimized organization lookup and added membership verification in
billing endpoints for defense-in-depth
- Expanded test coverage for endpoints, plugin behavior, and utilities
- Updated example projects to use the plugin pattern and removed
standalone `/api/flowglad` route requirement
- Migration: Use `flowgladPlugin` in Better Auth and set
`FlowgladProvider betterAuthBasePath="/api/auth"` in apps

- [037f19e](037f19e2):
Update Better Auth documentation and type annotations
- Clarified external ID resolution using `session.session.userId` and
`session.session.activeOrganizationId`
        -   Added notes about customer auto-creation hooks behavior
        -   Updated examples and troubleshooting documentation
        -   Documented optional `baseURL` parameter

    ### Usage Meter Hooks

- [3fd2a3a](3fd2a3ae): Add
`useUsageMeters()` and `useUsageMeter()` hooks to `@flowglad/react`

- Provides dedicated and efficient way to fetch usage meter balances
without relying on the full billing payload
- Wired `createUsageEvent` to invalidate caches for these new usage
meter hooks, ensuring automatic refresh after usage events
        -   Includes dev-mode support and comprehensive tests

- [71fd192](71fd192a):
Implement server-side integration for `GetUsageMeterBalances` action

- Added `getUsageMeterBalances` to `FlowgladServer` to call the platform
endpoint
- Created and registered new subroute handler for
`GetUsageMeterBalances`
- Wired the new action into the Better Auth plugin for authentication
and authorization
- Includes comprehensive tests for the new handler and updated auth
mappings

- [9dcbf5e](9dcbf5eb): Add
shared usage meter schema and action key
- Introduced new authenticated action key (`usage-meters/balances`) and
Zod schema in the shared SDK
- Enables dedicated, narrow endpoint for fetching usage meter balances
- Decouples usage meter reads from the larger `GetCustomerBilling`
payload
- Includes comprehensive tests for the new schema and action validator

-   Updated dependencies [7170932]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   7170932: ### Better Auth Plugin Improvements

- [790042d](790042dd):
Rework Better Auth plugin with organization support

- Organization customer resolution when `customerType="organization"`
using `session.activeOrganizationId` (and adapter lookups) if no custom
`getCustomer` is provided
- Added `getExternalId`, `billing/pricing`, and `getUsageMeterBalances`
endpoints integrated with Better Auth
- Optimized organization lookup and added membership verification in
billing endpoints for defense-in-depth
- Expanded test coverage for endpoints, plugin behavior, and utilities
- Updated example projects to use the plugin pattern and removed
standalone `/api/flowglad` route requirement
- Migration: Use `flowgladPlugin` in Better Auth and set
`FlowgladProvider betterAuthBasePath="/api/auth"` in apps

- [037f19e](037f19e2):
Update Better Auth documentation and type annotations
- Clarified external ID resolution using `session.session.userId` and
`session.session.activeOrganizationId`
        -   Added notes about customer auto-creation hooks behavior
        -   Updated examples and troubleshooting documentation
        -   Documented optional `baseURL` parameter

    ### Usage Meter Hooks

- [3fd2a3a](3fd2a3ae): Add
`useUsageMeters()` and `useUsageMeter()` hooks to `@flowglad/react`

- Provides dedicated and efficient way to fetch usage meter balances
without relying on the full billing payload
- Wired `createUsageEvent` to invalidate caches for these new usage
meter hooks, ensuring automatic refresh after usage events
        -   Includes dev-mode support and comprehensive tests

- [71fd192](71fd192a):
Implement server-side integration for `GetUsageMeterBalances` action

- Added `getUsageMeterBalances` to `FlowgladServer` to call the platform
endpoint
- Created and registered new subroute handler for
`GetUsageMeterBalances`
- Wired the new action into the Better Auth plugin for authentication
and authorization
- Includes comprehensive tests for the new handler and updated auth
mappings

- [9dcbf5e](9dcbf5eb): Add
shared usage meter schema and action key
- Introduced new authenticated action key (`usage-meters/balances`) and
Zod schema in the shared SDK
- Enables dedicated, narrow endpoint for fetching usage meter balances
- Decouples usage meter reads from the larger `GetCustomerBilling`
payload
- Includes comprehensive tests for the new schema and action validator

-   Updated dependencies [7170932]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   7170932: ### Better Auth Plugin Improvements

- [790042d](790042dd):
Rework Better Auth plugin with organization support

- Organization customer resolution when `customerType="organization"`
using `session.activeOrganizationId` (and adapter lookups) if no custom
`getCustomer` is provided
- Added `getExternalId`, `billing/pricing`, and `getUsageMeterBalances`
endpoints integrated with Better Auth
- Optimized organization lookup and added membership verification in
billing endpoints for defense-in-depth
- Expanded test coverage for endpoints, plugin behavior, and utilities
- Updated example projects to use the plugin pattern and removed
standalone `/api/flowglad` route requirement
- Migration: Use `flowgladPlugin` in Better Auth and set
`FlowgladProvider betterAuthBasePath="/api/auth"` in apps

- [037f19e](037f19e2):
Update Better Auth documentation and type annotations
- Clarified external ID resolution using `session.session.userId` and
`session.session.activeOrganizationId`
        -   Added notes about customer auto-creation hooks behavior
        -   Updated examples and troubleshooting documentation
        -   Documented optional `baseURL` parameter

    ### Usage Meter Hooks

- [3fd2a3a](3fd2a3ae): Add
`useUsageMeters()` and `useUsageMeter()` hooks to `@flowglad/react`

- Provides dedicated and efficient way to fetch usage meter balances
without relying on the full billing payload
- Wired `createUsageEvent` to invalidate caches for these new usage
meter hooks, ensuring automatic refresh after usage events
        -   Includes dev-mode support and comprehensive tests

- [71fd192](71fd192a):
Implement server-side integration for `GetUsageMeterBalances` action

- Added `getUsageMeterBalances` to `FlowgladServer` to call the platform
endpoint
- Created and registered new subroute handler for
`GetUsageMeterBalances`
- Wired the new action into the Better Auth plugin for authentication
and authorization
- Includes comprehensive tests for the new handler and updated auth
mappings

- [9dcbf5e](9dcbf5eb): Add
shared usage meter schema and action key
- Introduced new authenticated action key (`usage-meters/balances`) and
Zod schema in the shared SDK
- Enables dedicated, narrow endpoint for fetching usage meter balances
- Decouples usage meter reads from the larger `GetCustomerBilling`
payload
- Includes comprehensive tests for the new schema and action validator

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

v0.17.0

Toggle v0.17.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1589)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Minor Changes

-   6248889: ### React SDK Hook Architecture

- [2b46e4e](2b46e4e3):
Refactor the React SDK to a hook-first architecture for billing and
pricing
- `useBilling` now loads on mount and `FlowgladProvider` no longer
accepts `loadBilling`
- Added `usePricingModel` and `usePricing` for public pricing model
retrieval
- Expanded hook test coverage across billing and pricing utilities

    ### Hybrid Pricing Model Retrieval

- [acae46d](acae46d7): Add
`GetPricingModel` action with authenticated pricing + default fallback
        -   Hybrid routing for optional-auth pricing model fetches
- Shared types and validators for `{ pricingModel, source }` responses
- Next.js and server handlers updated to support the new pricing model
endpoint

    ### Default Usage Prices & Pricing Utilities

- [6e66759](6e667596):
Support default usage prices and unify pricing lookups
- Shared pricing utilities now resolve usage prices from products
consistently
- Updated usage price behaviors to ensure a default is always active

    ### Resource Claims Scope Update

- [a3e4ed7](a3e4ed7d):
Remove `subscriptionItemFeatureId` from resource claims
- Resource claims now scope to `(subscriptionId, resourceId)` and
support `expiredAt`
- Server resource-claim queries and tests updated for the new schema

    ### Documentation Updates

- [cbf4efd](cbf4efdb):
Refresh SDK docs to use `usePricing` and remove `loadBilling`

### Patch Changes

-   Updated dependencies [6248889]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   6248889: ### React SDK Hook Architecture

- [2b46e4e](2b46e4e3):
Refactor the React SDK to a hook-first architecture for billing and
pricing
- `useBilling` now loads on mount and `FlowgladProvider` no longer
accepts `loadBilling`
- Added `usePricingModel` and `usePricing` for public pricing model
retrieval
- Expanded hook test coverage across billing and pricing utilities

    ### Hybrid Pricing Model Retrieval

- [acae46d](acae46d7): Add
`GetPricingModel` action with authenticated pricing + default fallback
        -   Hybrid routing for optional-auth pricing model fetches
- Shared types and validators for `{ pricingModel, source }` responses
- Next.js and server handlers updated to support the new pricing model
endpoint

    ### Default Usage Prices & Pricing Utilities

- [6e66759](6e667596):
Support default usage prices and unify pricing lookups
- Shared pricing utilities now resolve usage prices from products
consistently
- Updated usage price behaviors to ensure a default is always active

    ### Resource Claims Scope Update

- [a3e4ed7](a3e4ed7d):
Remove `subscriptionItemFeatureId` from resource claims
- Resource claims now scope to `(subscriptionId, resourceId)` and
support `expiredAt`
- Server resource-claim queries and tests updated for the new schema

    ### Documentation Updates

- [cbf4efd](cbf4efdb):
Refresh SDK docs to use `usePricing` and remove `loadBilling`

### Patch Changes

-   Updated dependencies [6248889]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   6248889: ### React SDK Hook Architecture

- [2b46e4e](2b46e4e3):
Refactor the React SDK to a hook-first architecture for billing and
pricing
- `useBilling` now loads on mount and `FlowgladProvider` no longer
accepts `loadBilling`
- Added `usePricingModel` and `usePricing` for public pricing model
retrieval
- Expanded hook test coverage across billing and pricing utilities

    ### Hybrid Pricing Model Retrieval

- [acae46d](acae46d7): Add
`GetPricingModel` action with authenticated pricing + default fallback
        -   Hybrid routing for optional-auth pricing model fetches
- Shared types and validators for `{ pricingModel, source }` responses
- Next.js and server handlers updated to support the new pricing model
endpoint

    ### Default Usage Prices & Pricing Utilities

- [6e66759](6e667596):
Support default usage prices and unify pricing lookups
- Shared pricing utilities now resolve usage prices from products
consistently
- Updated usage price behaviors to ensure a default is always active

    ### Resource Claims Scope Update

- [a3e4ed7](a3e4ed7d):
Remove `subscriptionItemFeatureId` from resource claims
- Resource claims now scope to `(subscriptionId, resourceId)` and
support `expiredAt`
- Server resource-claim queries and tests updated for the new schema

    ### Documentation Updates

- [cbf4efd](cbf4efdb):
Refresh SDK docs to use `usePricing` and remove `loadBilling`

### Patch Changes

-   Updated dependencies [6248889]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   6248889: ### React SDK Hook Architecture

- [2b46e4e](2b46e4e3):
Refactor the React SDK to a hook-first architecture for billing and
pricing
- `useBilling` now loads on mount and `FlowgladProvider` no longer
accepts `loadBilling`
- Added `usePricingModel` and `usePricing` for public pricing model
retrieval
- Expanded hook test coverage across billing and pricing utilities

    ### Hybrid Pricing Model Retrieval

- [acae46d](acae46d7): Add
`GetPricingModel` action with authenticated pricing + default fallback
        -   Hybrid routing for optional-auth pricing model fetches
- Shared types and validators for `{ pricingModel, source }` responses
- Next.js and server handlers updated to support the new pricing model
endpoint

    ### Default Usage Prices & Pricing Utilities

- [6e66759](6e667596):
Support default usage prices and unify pricing lookups
- Shared pricing utilities now resolve usage prices from products
consistently
- Updated usage price behaviors to ensure a default is always active

    ### Resource Claims Scope Update

- [a3e4ed7](a3e4ed7d):
Remove `subscriptionItemFeatureId` from resource claims
- Resource claims now scope to `(subscriptionId, resourceId)` and
support `expiredAt`
- Server resource-claim queries and tests updated for the new schema

    ### Documentation Updates

- [cbf4efd](cbf4efdb):
Refresh SDK docs to use `usePricing` and remove `loadBilling`

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

v0.16.4

Toggle v0.16.4's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1530)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Patch Changes

-   e4cc2c6: ### Upgrade to @flowglad/node 0.29.0

- [f3249ae](f3249ae8): Bump
@flowglad/node from 0.28.0 to 0.29.0 across all packages
        -   Adds proper typing for `UsageMeter.prices` field in the SDK
- Removes the need for type cast workarounds when accessing usage meter
prices

    ### Catalog → PricingModel Migration

- [275550d](275550da):
Rename `catalog` to `pricingModel` in shared utilities

- `constructGetProduct`, `constructGetPrice`, and
`constructHasPurchased` now accept `pricingModel` parameter
- Type safety improvements by removing `UsageMeterWithPrices` cast
workaround

- [1779246](17792466):
Replace `catalog` with `pricingModel` across packages

- `@flowglad/react`: `useCatalog` hook renamed to `usePricingModel`
- `@flowglad/server`: Updated `FlowgladServer` to use `pricingModel`
internally
- `@flowglad/shared`: Renamed `types/catalog.ts` to
`types/pricingModel.ts`, `Catalog` type renamed to `PricingModel`
        -   Documentation updated to reflect new naming

- [ddaa0fc](ddaa0fca): Add
deprecated aliases for backward compatibility
        -   `Catalog` type alias (deprecated, use `PricingModel`)
        -   `useCatalog` hook (deprecated, use `usePricingModel`)
- `catalog` property remains available in billing context (deprecated,
use `pricingModel`)

    ## Migration Guide

    ### Hook Migration

    **Before:**

    ```typescript
    import { useCatalog } from "@flowglad/react";
    const catalog = useCatalog();
    ```

    **After:**

    ```typescript
    import { usePricingModel } from "@flowglad/react";
    const pricingModel = usePricingModel();
    ```

    ### Type Migration

    **Before:**

    ```typescript
    import type { Catalog } from "@flowglad/shared";
    ```

    **After:**

    ```typescript
    import type { PricingModel } from "@flowglad/shared";
    ```

    ## Breaking Changes

⚠️ **None** - All changes include backward-compatible deprecated
aliases. The `catalog` property, `useCatalog` hook, and `Catalog` type
continue to work but are marked as deprecated. Users are encouraged to
migrate to the new `pricingModel` naming.

-   Updated dependencies [e4cc2c6]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   e4cc2c6: ### Upgrade to @flowglad/node 0.29.0

- [f3249ae](f3249ae8): Bump
@flowglad/node from 0.28.0 to 0.29.0 across all packages
        -   Adds proper typing for `UsageMeter.prices` field in the SDK
- Removes the need for type cast workarounds when accessing usage meter
prices

    ### Catalog → PricingModel Migration

- [275550d](275550da):
Rename `catalog` to `pricingModel` in shared utilities

- `constructGetProduct`, `constructGetPrice`, and
`constructHasPurchased` now accept `pricingModel` parameter
- Type safety improvements by removing `UsageMeterWithPrices` cast
workaround

- [1779246](17792466):
Replace `catalog` with `pricingModel` across packages

- `@flowglad/react`: `useCatalog` hook renamed to `usePricingModel`
- `@flowglad/server`: Updated `FlowgladServer` to use `pricingModel`
internally
- `@flowglad/shared`: Renamed `types/catalog.ts` to
`types/pricingModel.ts`, `Catalog` type renamed to `PricingModel`
        -   Documentation updated to reflect new naming

- [ddaa0fc](ddaa0fca): Add
deprecated aliases for backward compatibility
        -   `Catalog` type alias (deprecated, use `PricingModel`)
        -   `useCatalog` hook (deprecated, use `usePricingModel`)
- `catalog` property remains available in billing context (deprecated,
use `pricingModel`)

    ## Migration Guide

    ### Hook Migration

    **Before:**

    ```typescript
    import { useCatalog } from "@flowglad/react";
    const catalog = useCatalog();
    ```

    **After:**

    ```typescript
    import { usePricingModel } from "@flowglad/react";
    const pricingModel = usePricingModel();
    ```

    ### Type Migration

    **Before:**

    ```typescript
    import type { Catalog } from "@flowglad/shared";
    ```

    **After:**

    ```typescript
    import type { PricingModel } from "@flowglad/shared";
    ```

    ## Breaking Changes

⚠️ **None** - All changes include backward-compatible deprecated
aliases. The `catalog` property, `useCatalog` hook, and `Catalog` type
continue to work but are marked as deprecated. Users are encouraged to
migrate to the new `pricingModel` naming.

-   Updated dependencies [e4cc2c6]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   e4cc2c6: ### Upgrade to @flowglad/node 0.29.0

- [f3249ae](f3249ae8): Bump
@flowglad/node from 0.28.0 to 0.29.0 across all packages
        -   Adds proper typing for `UsageMeter.prices` field in the SDK
- Removes the need for type cast workarounds when accessing usage meter
prices

    ### Catalog → PricingModel Migration

- [275550d](275550da):
Rename `catalog` to `pricingModel` in shared utilities

- `constructGetProduct`, `constructGetPrice`, and
`constructHasPurchased` now accept `pricingModel` parameter
- Type safety improvements by removing `UsageMeterWithPrices` cast
workaround

- [1779246](17792466):
Replace `catalog` with `pricingModel` across packages

- `@flowglad/react`: `useCatalog` hook renamed to `usePricingModel`
- `@flowglad/server`: Updated `FlowgladServer` to use `pricingModel`
internally
- `@flowglad/shared`: Renamed `types/catalog.ts` to
`types/pricingModel.ts`, `Catalog` type renamed to `PricingModel`
        -   Documentation updated to reflect new naming

- [ddaa0fc](ddaa0fca): Add
deprecated aliases for backward compatibility
        -   `Catalog` type alias (deprecated, use `PricingModel`)
        -   `useCatalog` hook (deprecated, use `usePricingModel`)
- `catalog` property remains available in billing context (deprecated,
use `pricingModel`)

    ## Migration Guide

    ### Hook Migration

    **Before:**

    ```typescript
    import { useCatalog } from "@flowglad/react";
    const catalog = useCatalog();
    ```

    **After:**

    ```typescript
    import { usePricingModel } from "@flowglad/react";
    const pricingModel = usePricingModel();
    ```

    ### Type Migration

    **Before:**

    ```typescript
    import type { Catalog } from "@flowglad/shared";
    ```

    **After:**

    ```typescript
    import type { PricingModel } from "@flowglad/shared";
    ```

    ## Breaking Changes

⚠️ **None** - All changes include backward-compatible deprecated
aliases. The `catalog` property, `useCatalog` hook, and `Catalog` type
continue to work but are marked as deprecated. Users are encouraged to
migrate to the new `pricingModel` naming.

-   Updated dependencies [e4cc2c6]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   e4cc2c6: ### Upgrade to @flowglad/node 0.29.0

- [f3249ae](f3249ae8): Bump
@flowglad/node from 0.28.0 to 0.29.0 across all packages
        -   Adds proper typing for `UsageMeter.prices` field in the SDK
- Removes the need for type cast workarounds when accessing usage meter
prices

    ### Catalog → PricingModel Migration

- [275550d](275550da):
Rename `catalog` to `pricingModel` in shared utilities

- `constructGetProduct`, `constructGetPrice`, and
`constructHasPurchased` now accept `pricingModel` parameter
- Type safety improvements by removing `UsageMeterWithPrices` cast
workaround

- [1779246](17792466):
Replace `catalog` with `pricingModel` across packages

- `@flowglad/react`: `useCatalog` hook renamed to `usePricingModel`
- `@flowglad/server`: Updated `FlowgladServer` to use `pricingModel`
internally
- `@flowglad/shared`: Renamed `types/catalog.ts` to
`types/pricingModel.ts`, `Catalog` type renamed to `PricingModel`
        -   Documentation updated to reflect new naming

- [ddaa0fc](ddaa0fca): Add
deprecated aliases for backward compatibility
        -   `Catalog` type alias (deprecated, use `PricingModel`)
        -   `useCatalog` hook (deprecated, use `usePricingModel`)
- `catalog` property remains available in billing context (deprecated,
use `pricingModel`)

    ## Migration Guide

    ### Hook Migration

    **Before:**

    ```typescript
    import { useCatalog } from "@flowglad/react";
    const catalog = useCatalog();
    ```

    **After:**

    ```typescript
    import { usePricingModel } from "@flowglad/react";
    const pricingModel = usePricingModel();
    ```

    ### Type Migration

    **Before:**

    ```typescript
    import type { Catalog } from "@flowglad/shared";
    ```

    **After:**

    ```typescript
    import type { PricingModel } from "@flowglad/shared";
    ```

    ## Breaking Changes

⚠️ **None** - All changes include backward-compatible deprecated
aliases. The `catalog` property, `useCatalog` hook, and `Catalog` type
continue to work but are marked as deprecated. Users are encouraged to
migrate to the new `pricingModel` naming.

## @flowglad/[email protected]

### Patch Changes

-   Updated dependencies [e4cc2c6]
    -   @flowglad/[email protected]

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Publish patch releases across Flowglad packages to upgrade SDK typing
and align naming to pricingModel. No breaking changes; deprecated
aliases keep existing code working.

- **Dependencies**
- Upgrade to @flowglad/node 0.29.0 with proper UsageMeter.prices typing;
removes cast workarounds.
- Versions: @flowglad/{nextjs,react,server,shared} 0.16.4;
@flowglad/playground-seat-based-billing 1.0.1.

- **Migration**
  - Replace useCatalog with usePricingModel.
  - Replace Catalog type with PricingModel.

<sup>Written for commit 8087401.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Agree Ahmed <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>

v0.16.3

Toggle v0.16.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1455)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Patch Changes

-   f6ae438: ### Resource Management Support

- [5067fd7](5067fd7d): Add
resource claim types and validation schemas (#1416)

- Added `GetResources`, `ClaimResource`, `ReleaseResource`, and
`ListResourceClaims` to `FlowgladActionKey` enum
- Defined `ResourceUsage` and `ResourceClaim` TypeScript interfaces in
`@flowglad/shared`
- Implemented Zod schemas for resource claim operations with mutual
exclusivity rules
        -   Integrated schemas into `flowgladActionValidators` map
        -   Exported all new types and schemas from shared package

- [cfaf9e5](cfaf9e5d): Add
Resource feature type to setup schema (#1372)
- Added Resource variant to feature discriminated union with
`resourceSlug` references
- Added `resources` array in setup schema with uniqueness validation
- Resource reference validation for features that use Resource type
        -   Full test coverage for Resource feature type support

    ### Better Auth Integration Enhancements

- [90725b6](90725b60):
Better Auth plugin endpoints (Patch 1 - GP-51) (#1342)

- Exposed all 11 Flowglad billing endpoints through Better Auth plugin
with automatic session authentication
- Added automatic customer ID resolution for Better Auth sessions
- Added `betterAuthBasePath` prop to React SDK for routing API calls
through Better Auth endpoints
        -   Configured public API exports for Better Auth functionality

- [67b36aa](67b36aa9): Use
Better Auth routes for Flowglad API calls in playground (#1390)
- Updated `FlowgladProviderWrapper` to use
`betterAuthBasePath="/api/auth"`
- All Flowglad API routes now go through Better Auth endpoints at
`/api/auth/flowglad/*`

    ### Supabase Edge Functions Support

- [1fed5c4](1fed5c4a): Add
Supabase edge handler implementation (#1353)
- New `supabaseEdgeHandler` for seamless integration with Supabase Edge
Functions
- Supports explicit `basePath` configuration or auto-detects
`/functions/v1/<function-name>/` pattern
- Extracts query parameters for GET requests and JSON bodies for other
methods
- Returns consistent JSON responses with `data` and `error` fields
        -   Exported via `@flowglad/server/supabase` subexport

    ### Subscription Management Improvements

- [43c30e5](43c30e53):
Refactor adjustSubscription API to use flexible parameter forms (#1284)

- Replaced single signature with three mutually exclusive parameter
forms validated at type level
- Forms: `{ priceSlug, quantity?, ... }`, `{ priceId, quantity?, ... }`,
`{ subscriptionItems, ... }`
- Maintains backward compatibility with server and client-side
auto-resolution of `subscriptionId`
- Comprehensive test coverage for all three forms and validation rules

- [720c8b7](720c8b73): Add
adjustSubscription SDK method with terse positional API (#1178)
- Terse API: `adjustSubscription('pro-monthly')` or
`adjustSubscription('pro-monthly', { quantity: 5 })`
        -   Accepts price ID or slug interchangeably via `priceIdOrSlug`
- Auto-resolves subscriptionId when customer has exactly one
subscription
- Server-side price resolution: tries slug first, falls back to ID
        -   Timing options: 'immediately', 'at_end_of_period', or 'auto'

    ### Bug Fixes

- [cf60b48](cf60b48f):
Default error status to 500 when undefined (#1253)

- Fixed bug where errors with message but no status property caused
Express to crash
- Request handler now defaults to HTTP 500 instead of passing
`undefined` to Express
- Ensures clients receive clean JSON error responses instead of HTML
error pages

- [d87ceb8](d87ceb80):
Validate subscription ownership in createUsageEvent (#1224)
- Added subscription ownership validation to prevent unauthorized usage
event creation
- Validates that `subscriptionId` belongs to the requesting customer
before creating usage event
- Returns 403 Forbidden error if subscription is not found among
customer's current subscriptions
        -   Aligns with existing validation in `bulkCreateUsageEvents`

    ### Updated Dependencies

- [b0159e7](b0159e7f):
Upgrade `@flowglad/node` from 0.24.0 to 0.26.0 (#1415)
- Updated React context to include new subscription fields (`isUpgrade`,
`resolvedTiming`) for API compatibility
- All packages (nextjs, react, server, shared) aligned with 0.26.0

    ## Breaking Changes

⚠️ **None** - All changes are additive or bug fixes. Existing
functionality remains unchanged.

-   Updated dependencies [f6ae438]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   f6ae438: ### Resource Management Support

- [5067fd7](5067fd7d): Add
resource claim types and validation schemas (#1416)

- Added `GetResources`, `ClaimResource`, `ReleaseResource`, and
`ListResourceClaims` to `FlowgladActionKey` enum
- Defined `ResourceUsage` and `ResourceClaim` TypeScript interfaces in
`@flowglad/shared`
- Implemented Zod schemas for resource claim operations with mutual
exclusivity rules
        -   Integrated schemas into `flowgladActionValidators` map
        -   Exported all new types and schemas from shared package

- [cfaf9e5](cfaf9e5d): Add
Resource feature type to setup schema (#1372)
- Added Resource variant to feature discriminated union with
`resourceSlug` references
- Added `resources` array in setup schema with uniqueness validation
- Resource reference validation for features that use Resource type
        -   Full test coverage for Resource feature type support

    ### Better Auth Integration Enhancements

- [90725b6](90725b60):
Better Auth plugin endpoints (Patch 1 - GP-51) (#1342)

- Exposed all 11 Flowglad billing endpoints through Better Auth plugin
with automatic session authentication
- Added automatic customer ID resolution for Better Auth sessions
- Added `betterAuthBasePath` prop to React SDK for routing API calls
through Better Auth endpoints
        -   Configured public API exports for Better Auth functionality

- [67b36aa](67b36aa9): Use
Better Auth routes for Flowglad API calls in playground (#1390)
- Updated `FlowgladProviderWrapper` to use
`betterAuthBasePath="/api/auth"`
- All Flowglad API routes now go through Better Auth endpoints at
`/api/auth/flowglad/*`

    ### Supabase Edge Functions Support

- [1fed5c4](1fed5c4a): Add
Supabase edge handler implementation (#1353)
- New `supabaseEdgeHandler` for seamless integration with Supabase Edge
Functions
- Supports explicit `basePath` configuration or auto-detects
`/functions/v1/<function-name>/` pattern
- Extracts query parameters for GET requests and JSON bodies for other
methods
- Returns consistent JSON responses with `data` and `error` fields
        -   Exported via `@flowglad/server/supabase` subexport

    ### Subscription Management Improvements

- [43c30e5](43c30e53):
Refactor adjustSubscription API to use flexible parameter forms (#1284)

- Replaced single signature with three mutually exclusive parameter
forms validated at type level
- Forms: `{ priceSlug, quantity?, ... }`, `{ priceId, quantity?, ... }`,
`{ subscriptionItems, ... }`
- Maintains backward compatibility with server and client-side
auto-resolution of `subscriptionId`
- Comprehensive test coverage for all three forms and validation rules

- [720c8b7](720c8b73): Add
adjustSubscription SDK method with terse positional API (#1178)
- Terse API: `adjustSubscription('pro-monthly')` or
`adjustSubscription('pro-monthly', { quantity: 5 })`
        -   Accepts price ID or slug interchangeably via `priceIdOrSlug`
- Auto-resolves subscriptionId when customer has exactly one
subscription
- Server-side price resolution: tries slug first, falls back to ID
        -   Timing options: 'immediately', 'at_end_of_period', or 'auto'

    ### Bug Fixes

- [cf60b48](cf60b48f):
Default error status to 500 when undefined (#1253)

- Fixed bug where errors with message but no status property caused
Express to crash
- Request handler now defaults to HTTP 500 instead of passing
`undefined` to Express
- Ensures clients receive clean JSON error responses instead of HTML
error pages

- [d87ceb8](d87ceb80):
Validate subscription ownership in createUsageEvent (#1224)
- Added subscription ownership validation to prevent unauthorized usage
event creation
- Validates that `subscriptionId` belongs to the requesting customer
before creating usage event
- Returns 403 Forbidden error if subscription is not found among
customer's current subscriptions
        -   Aligns with existing validation in `bulkCreateUsageEvents`

    ### Updated Dependencies

- [b0159e7](b0159e7f):
Upgrade `@flowglad/node` from 0.24.0 to 0.26.0 (#1415)
- Updated React context to include new subscription fields (`isUpgrade`,
`resolvedTiming`) for API compatibility
- All packages (nextjs, react, server, shared) aligned with 0.26.0

    ## Breaking Changes

⚠️ **None** - All changes are additive or bug fixes. Existing
functionality remains unchanged.

-   Updated dependencies [f6ae438]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   f6ae438: ### Resource Management Support

- [5067fd7](5067fd7d): Add
resource claim types and validation schemas (#1416)

- Added `GetResources`, `ClaimResource`, `ReleaseResource`, and
`ListResourceClaims` to `FlowgladActionKey` enum
- Defined `ResourceUsage` and `ResourceClaim` TypeScript interfaces in
`@flowglad/shared`
- Implemented Zod schemas for resource claim operations with mutual
exclusivity rules
        -   Integrated schemas into `flowgladActionValidators` map
        -   Exported all new types and schemas from shared package

- [cfaf9e5](cfaf9e5d): Add
Resource feature type to setup schema (#1372)
- Added Resource variant to feature discriminated union with
`resourceSlug` references
- Added `resources` array in setup schema with uniqueness validation
- Resource reference validation for features that use Resource type
        -   Full test coverage for Resource feature type support

    ### Better Auth Integration Enhancements

- [90725b6](90725b60):
Better Auth plugin endpoints (Patch 1 - GP-51) (#1342)

- Exposed all 11 Flowglad billing endpoints through Better Auth plugin
with automatic session authentication
- Added automatic customer ID resolution for Better Auth sessions
- Added `betterAuthBasePath` prop to React SDK for routing API calls
through Better Auth endpoints
        -   Configured public API exports for Better Auth functionality

- [67b36aa](67b36aa9): Use
Better Auth routes for Flowglad API calls in playground (#1390)
- Updated `FlowgladProviderWrapper` to use
`betterAuthBasePath="/api/auth"`
- All Flowglad API routes now go through Better Auth endpoints at
`/api/auth/flowglad/*`

    ### Supabase Edge Functions Support

- [1fed5c4](1fed5c4a): Add
Supabase edge handler implementation (#1353)
- New `supabaseEdgeHandler` for seamless integration with Supabase Edge
Functions
- Supports explicit `basePath` configuration or auto-detects
`/functions/v1/<function-name>/` pattern
- Extracts query parameters for GET requests and JSON bodies for other
methods
- Returns consistent JSON responses with `data` and `error` fields
        -   Exported via `@flowglad/server/supabase` subexport

    ### Subscription Management Improvements

- [43c30e5](43c30e53):
Refactor adjustSubscription API to use flexible parameter forms (#1284)

- Replaced single signature with three mutually exclusive parameter
forms validated at type level
- Forms: `{ priceSlug, quantity?, ... }`, `{ priceId, quantity?, ... }`,
`{ subscriptionItems, ... }`
- Maintains backward compatibility with server and client-side
auto-resolution of `subscriptionId`
- Comprehensive test coverage for all three forms and validation rules

- [720c8b7](720c8b73): Add
adjustSubscription SDK method with terse positional API (#1178)
- Terse API: `adjustSubscription('pro-monthly')` or
`adjustSubscription('pro-monthly', { quantity: 5 })`
        -   Accepts price ID or slug interchangeably via `priceIdOrSlug`
- Auto-resolves subscriptionId when customer has exactly one
subscription
- Server-side price resolution: tries slug first, falls back to ID
        -   Timing options: 'immediately', 'at_end_of_period', or 'auto'

    ### Bug Fixes

- [cf60b48](cf60b48f):
Default error status to 500 when undefined (#1253)

- Fixed bug where errors with message but no status property caused
Express to crash
- Request handler now defaults to HTTP 500 instead of passing
`undefined` to Express
- Ensures clients receive clean JSON error responses instead of HTML
error pages

- [d87ceb8](d87ceb80):
Validate subscription ownership in createUsageEvent (#1224)
- Added subscription ownership validation to prevent unauthorized usage
event creation
- Validates that `subscriptionId` belongs to the requesting customer
before creating usage event
- Returns 403 Forbidden error if subscription is not found among
customer's current subscriptions
        -   Aligns with existing validation in `bulkCreateUsageEvents`

    ### Updated Dependencies

- [b0159e7](b0159e7f):
Upgrade `@flowglad/node` from 0.24.0 to 0.26.0 (#1415)
- Updated React context to include new subscription fields (`isUpgrade`,
`resolvedTiming`) for API compatibility
- All packages (nextjs, react, server, shared) aligned with 0.26.0

    ## Breaking Changes

⚠️ **None** - All changes are additive or bug fixes. Existing
functionality remains unchanged.

-   Updated dependencies [f6ae438]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   f6ae438: ### Resource Management Support

- [5067fd7](5067fd7d): Add
resource claim types and validation schemas (#1416)

- Added `GetResources`, `ClaimResource`, `ReleaseResource`, and
`ListResourceClaims` to `FlowgladActionKey` enum
- Defined `ResourceUsage` and `ResourceClaim` TypeScript interfaces in
`@flowglad/shared`
- Implemented Zod schemas for resource claim operations with mutual
exclusivity rules
        -   Integrated schemas into `flowgladActionValidators` map
        -   Exported all new types and schemas from shared package

- [cfaf9e5](cfaf9e5d): Add
Resource feature type to setup schema (#1372)
- Added Resource variant to feature discriminated union with
`resourceSlug` references
- Added `resources` array in setup schema with uniqueness validation
- Resource reference validation for features that use Resource type
        -   Full test coverage for Resource feature type support

    ### Better Auth Integration Enhancements

- [90725b6](90725b60):
Better Auth plugin endpoints (Patch 1 - GP-51) (#1342)

- Exposed all 11 Flowglad billing endpoints through Better Auth plugin
with automatic session authentication
- Added automatic customer ID resolution for Better Auth sessions
- Added `betterAuthBasePath` prop to React SDK for routing API calls
through Better Auth endpoints
        -   Configured public API exports for Better Auth functionality

- [67b36aa](67b36aa9): Use
Better Auth routes for Flowglad API calls in playground (#1390)
- Updated `FlowgladProviderWrapper` to use
`betterAuthBasePath="/api/auth"`
- All Flowglad API routes now go through Better Auth endpoints at
`/api/auth/flowglad/*`

    ### Supabase Edge Functions Support

- [1fed5c4](1fed5c4a): Add
Supabase edge handler implementation (#1353)
- New `supabaseEdgeHandler` for seamless integration with Supabase Edge
Functions
- Supports explicit `basePath` configuration or auto-detects
`/functions/v1/<function-name>/` pattern
- Extracts query parameters for GET requests and JSON bodies for other
methods
- Returns consistent JSON responses with `data` and `error` fields
        -   Exported via `@flowglad/server/supabase` subexport

    ### Subscription Management Improvements

- [43c30e5](43c30e53):
Refactor adjustSubscription API to use flexible parameter forms (#1284)

- Replaced single signature with three mutually exclusive parameter
forms validated at type level
- Forms: `{ priceSlug, quantity?, ... }`, `{ priceId, quantity?, ... }`,
`{ subscriptionItems, ... }`
- Maintains backward compatibility with server and client-side
auto-resolution of `subscriptionId`
- Comprehensive test coverage for all three forms and validation rules

- [720c8b7](720c8b73): Add
adjustSubscription SDK method with terse positional API (#1178)
- Terse API: `adjustSubscription('pro-monthly')` or
`adjustSubscription('pro-monthly', { quantity: 5 })`
        -   Accepts price ID or slug interchangeably via `priceIdOrSlug`
- Auto-resolves subscriptionId when customer has exactly one
subscription
- Server-side price resolution: tries slug first, falls back to ID
        -   Timing options: 'immediately', 'at_end_of_period', or 'auto'

    ### Bug Fixes

- [cf60b48](cf60b48f):
Default error status to 500 when undefined (#1253)

- Fixed bug where errors with message but no status property caused
Express to crash
- Request handler now defaults to HTTP 500 instead of passing
`undefined` to Express
- Ensures clients receive clean JSON error responses instead of HTML
error pages

- [d87ceb8](d87ceb80):
Validate subscription ownership in createUsageEvent (#1224)
- Added subscription ownership validation to prevent unauthorized usage
event creation
- Validates that `subscriptionId` belongs to the requesting customer
before creating usage event
- Returns 403 Forbidden error if subscription is not found among
customer's current subscriptions
        -   Aligns with existing validation in `bulkCreateUsageEvents`

    ### Updated Dependencies

- [b0159e7](b0159e7f):
Upgrade `@flowglad/node` from 0.24.0 to 0.26.0 (#1415)
- Updated React context to include new subscription fields (`isUpgrade`,
`resolvedTiming`) for API compatibility
- All packages (nextjs, react, server, shared) aligned with 0.26.0

    ## Breaking Changes

⚠️ **None** - All changes are additive or bug fixes. Existing
functionality remains unchanged.


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Publish 0.16.3 patch release for @flowglad/nextjs, @flowglad/react,
@flowglad/server, and @flowglad/shared. Adds resource management, Better
Auth routing, Supabase Edge support, and subscription API improvements.
No breaking changes.

- **New Features**
- Resource management: new claim types and Zod schemas; setup schema
adds Resource feature and a unique resources list.
- Better Auth: all billing endpoints exposed with session auth; React
SDK supports betterAuthBasePath; routes updated to /api/auth/flowglad/*.
- Supabase Edge: new supabaseEdgeHandler with base path auto-detect and
consistent JSON responses.
- Subscriptions: flexible adjustSubscription forms and a terse SDK
method; auto-resolves subscriptionId; timing options; React context adds
isUpgrade and resolvedTiming.

- **Bug Fixes**
  - Default HTTP 500 when error status is missing.
- Validate subscription ownership in createUsageEvent to prevent
unauthorized events.

<sup>Written for commit 727b43b.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

v0.16.2

Toggle v0.16.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1173)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Patch Changes

-   6c71a71: ### Client-Side Usage Event Creation

- [acb9c0e](acb9c0e4):
Add server handler and client hook for createUsageEvent (#1134)

- New `createUsageEvent` handler in server that validates POST method
and auto-resolves subscriptionId from current subscription
        -   Defaults `amount` to 1 if not provided
        -   Auto-generates `transactionId` using nanoid if not provided
        -   Returns 400 if no subscription can be resolved
        -   Added `createUsageEvent` to React's `useBilling()` hook
        -   POSTs to `/api/flowglad/usage-events/create`
- Returns `{ usageEvent: { id } }` on success or `{ error: { code, json
} }` on failure
        -   Supports dev mode with mock implementation
- Exported `ClientCreateUsageEventParams` type from shared package
- Added nanoid ^3.3.11 dependency to server for CJS compatibility

- [23f4c6b](23f4c6bd):
Add clientCreateUsageEvent schema and action key (#1133)
- Introduced `FlowgladActionKey.CreateUsageEvent` and
`clientCreateUsageEventSchema`
- Schema requires exactly one identifier (priceId | priceSlug |
usageMeterId | usageMeterSlug)
- Auto-resolves subscriptionId, amount (default 1), and transactionId on
the server
- Enables client-side usage event creation with sensible defaults

    ### Bulk Usage Events Support

- [7e0091e](7e0091e0):
Add bulk usage events to SDK (#1093)
        -   New `bulkCreateUsageEvents(params)` method in server SDK
- Validates all subscriptionIds belong to the authenticated customer's
current subscriptions
        -   Normalizes properties and usageDate to undefined when absent
        -   Calls POST `/api/v1/usage-events/bulk` endpoint
        -   New `bulkCreateUsageEvents(params)` method in admin SDK
- Added `bulkCreateUsageEventsSchema` and `BulkCreateUsageEventsParams`
to shared package
- Allows multiple usage events to be created in one request to reduce
API calls
- Includes ownership checks on the customer-scoped path for safety

    ## Updated Dependencies

- `@flowglad/server`: Added nanoid ^3.3.11 for transaction ID generation

    ## Breaking Changes

⚠️ **None** - All changes are additive. Existing functionality remains
unchanged.

-   Updated dependencies [6c71a71]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   6c71a71: ### Client-Side Usage Event Creation

- [acb9c0e](acb9c0e4):
Add server handler and client hook for createUsageEvent (#1134)

- New `createUsageEvent` handler in server that validates POST method
and auto-resolves subscriptionId from current subscription
        -   Defaults `amount` to 1 if not provided
        -   Auto-generates `transactionId` using nanoid if not provided
        -   Returns 400 if no subscription can be resolved
        -   Added `createUsageEvent` to React's `useBilling()` hook
        -   POSTs to `/api/flowglad/usage-events/create`
- Returns `{ usageEvent: { id } }` on success or `{ error: { code, json
} }` on failure
        -   Supports dev mode with mock implementation
- Exported `ClientCreateUsageEventParams` type from shared package
- Added nanoid ^3.3.11 dependency to server for CJS compatibility

- [23f4c6b](23f4c6bd):
Add clientCreateUsageEvent schema and action key (#1133)
- Introduced `FlowgladActionKey.CreateUsageEvent` and
`clientCreateUsageEventSchema`
- Schema requires exactly one identifier (priceId | priceSlug |
usageMeterId | usageMeterSlug)
- Auto-resolves subscriptionId, amount (default 1), and transactionId on
the server
- Enables client-side usage event creation with sensible defaults

    ### Bulk Usage Events Support

- [7e0091e](7e0091e0):
Add bulk usage events to SDK (#1093)
        -   New `bulkCreateUsageEvents(params)` method in server SDK
- Validates all subscriptionIds belong to the authenticated customer's
current subscriptions
        -   Normalizes properties and usageDate to undefined when absent
        -   Calls POST `/api/v1/usage-events/bulk` endpoint
        -   New `bulkCreateUsageEvents(params)` method in admin SDK
- Added `bulkCreateUsageEventsSchema` and `BulkCreateUsageEventsParams`
to shared package
- Allows multiple usage events to be created in one request to reduce
API calls
- Includes ownership checks on the customer-scoped path for safety

    ## Updated Dependencies

- `@flowglad/server`: Added nanoid ^3.3.11 for transaction ID generation

    ## Breaking Changes

⚠️ **None** - All changes are additive. Existing functionality remains
unchanged.

-   Updated dependencies [6c71a71]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   6c71a71: ### Client-Side Usage Event Creation

- [acb9c0e](acb9c0e4):
Add server handler and client hook for createUsageEvent (#1134)

- New `createUsageEvent` handler in server that validates POST method
and auto-resolves subscriptionId from current subscription
        -   Defaults `amount` to 1 if not provided
        -   Auto-generates `transactionId` using nanoid if not provided
        -   Returns 400 if no subscription can be resolved
        -   Added `createUsageEvent` to React's `useBilling()` hook
        -   POSTs to `/api/flowglad/usage-events/create`
- Returns `{ usageEvent: { id } }` on success or `{ error: { code, json
} }` on failure
        -   Supports dev mode with mock implementation
- Exported `ClientCreateUsageEventParams` type from shared package
- Added nanoid ^3.3.11 dependency to server for CJS compatibility

- [23f4c6b](23f4c6bd):
Add clientCreateUsageEvent schema and action key (#1133)
- Introduced `FlowgladActionKey.CreateUsageEvent` and
`clientCreateUsageEventSchema`
- Schema requires exactly one identifier (priceId | priceSlug |
usageMeterId | usageMeterSlug)
- Auto-resolves subscriptionId, amount (default 1), and transactionId on
the server
- Enables client-side usage event creation with sensible defaults

    ### Bulk Usage Events Support

- [7e0091e](7e0091e0):
Add bulk usage events to SDK (#1093)
        -   New `bulkCreateUsageEvents(params)` method in server SDK
- Validates all subscriptionIds belong to the authenticated customer's
current subscriptions
        -   Normalizes properties and usageDate to undefined when absent
        -   Calls POST `/api/v1/usage-events/bulk` endpoint
        -   New `bulkCreateUsageEvents(params)` method in admin SDK
- Added `bulkCreateUsageEventsSchema` and `BulkCreateUsageEventsParams`
to shared package
- Allows multiple usage events to be created in one request to reduce
API calls
- Includes ownership checks on the customer-scoped path for safety

    ## Updated Dependencies

- `@flowglad/server`: Added nanoid ^3.3.11 for transaction ID generation

    ## Breaking Changes

⚠️ **None** - All changes are additive. Existing functionality remains
unchanged.

-   Updated dependencies [6c71a71]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   6c71a71: ### Client-Side Usage Event Creation

- [acb9c0e](acb9c0e4):
Add server handler and client hook for createUsageEvent (#1134)

- New `createUsageEvent` handler in server that validates POST method
and auto-resolves subscriptionId from current subscription
        -   Defaults `amount` to 1 if not provided
        -   Auto-generates `transactionId` using nanoid if not provided
        -   Returns 400 if no subscription can be resolved
        -   Added `createUsageEvent` to React's `useBilling()` hook
        -   POSTs to `/api/flowglad/usage-events/create`
- Returns `{ usageEvent: { id } }` on success or `{ error: { code, json
} }` on failure
        -   Supports dev mode with mock implementation
- Exported `ClientCreateUsageEventParams` type from shared package
- Added nanoid ^3.3.11 dependency to server for CJS compatibility

- [23f4c6b](23f4c6bd):
Add clientCreateUsageEvent schema and action key (#1133)
- Introduced `FlowgladActionKey.CreateUsageEvent` and
`clientCreateUsageEventSchema`
- Schema requires exactly one identifier (priceId | priceSlug |
usageMeterId | usageMeterSlug)
- Auto-resolves subscriptionId, amount (default 1), and transactionId on
the server
- Enables client-side usage event creation with sensible defaults

    ### Bulk Usage Events Support

- [7e0091e](7e0091e0):
Add bulk usage events to SDK (#1093)
        -   New `bulkCreateUsageEvents(params)` method in server SDK
- Validates all subscriptionIds belong to the authenticated customer's
current subscriptions
        -   Normalizes properties and usageDate to undefined when absent
        -   Calls POST `/api/v1/usage-events/bulk` endpoint
        -   New `bulkCreateUsageEvents(params)` method in admin SDK
- Added `bulkCreateUsageEventsSchema` and `BulkCreateUsageEventsParams`
to shared package
- Allows multiple usage events to be created in one request to reduce
API calls
- Includes ownership checks on the customer-scoped path for safety

    ## Updated Dependencies

- `@flowglad/server`: Added nanoid ^3.3.11 for transaction ID generation

    ## Breaking Changes

⚠️ **None** - All changes are additive. Existing functionality remains
unchanged.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

v0.16.1

Toggle v0.16.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#1078)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Patch Changes

-   23d20a5: ### SDK Helper Functions

- [17e3942](17e39425):
Add `hasPurchased` helper function to SDK
- New `hasPurchased` helper function available in `@flowglad/react` and
`@flowglad/server`
        -   Checks if a customer has purchased a product by slug
- Exposed via `FlowgladContext` and `FlowgladServer` through
`BillingWithChecks`
        -   Added to SDK types and re-exported for TypeScript support
        -   Playground UI updated to show purchase state for top-ups

    ### Usage Meter Support

- [f01bc21](f01bc21d):
Add usage meter support to `createUsageEvent`
- `createUsageEvent` now accepts `usageMeterId` or `usageMeterSlug`
parameters
- Validation ensures exactly one identifier is provided (either price or
usage meter)
- Prevents mixing price and meter identifiers in the same request
- Added comprehensive test coverage for valid inputs and invalid
combinations

    ### Request Handler Standardization

- [e3c8066](e3c8066c):
Standardize request handling across Next.js and Express
- Introduced unified `requestHandler<TRequest>` API that extracts
`customerExternalId` via `getCustomerExternalId`
- Updated Next.js handlers: `nextRouteHandler` and `pagesRouteHandler`
now use `requestHandler` pattern
- Removed deprecated `createAppRouterRouteHandler` and
`createPagesRouterRouteHandler` functions
- Added `expressRouter` in `@flowglad/server/express` with optional
middleware support
- Replaced `createRequestHandler` exports with `requestHandler` in
server/next packages
- Removed deprecated `@flowglad/express` package (CHANGELOG and README
removed)

    ## Breaking Changes

    ⚠️ **Request Handler API Changes**

The request handler API has been standardized across all frameworks. If
you're using Express or Next.js route handlers, you'll need to update
your code:

    **Express Migration:**

    **Before:**

    ```typescript
    import { createFlowgladExpressRouter } from "@flowglad/express";
    ```

    **After:**

    ```typescript
    import { expressRouter } from "@flowglad/server/express";
    // Provide getCustomerExternalId(req) and flowglad(id)
    ```

    **Next.js Migration:**

    **Before:**

    ```typescript
    import { createAppRouterRouteHandler } from "@flowglad/nextjs";
    // or
    import { createPagesRouterRouteHandler } from "@flowglad/nextjs";
    ```

    **After:**

    ```typescript
    import { nextRouteHandler } from "@flowglad/nextjs";
    // or
    import { pagesRouteHandler } from "@flowglad/nextjs";
    // Use with getCustomerExternalId and flowglad factory
    ```

    **General Migration:**

If you were using `createRequestHandler` directly, update to
`requestHandler`:

    -   Update imports from `createRequestHandler` to `requestHandler`
- Request handlers now require `getCustomerExternalId` and a `flowglad`
factory
- Handlers receive both route payload and the original request object

    ## Updated Dependencies

    -   `@flowglad/express` package has been removed from the repository
- All functionality moved to `@flowglad/server/express` subpath export

-   Updated dependencies [23d20a5]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   23d20a5: ### SDK Helper Functions

- [17e3942](17e39425):
Add `hasPurchased` helper function to SDK
- New `hasPurchased` helper function available in `@flowglad/react` and
`@flowglad/server`
        -   Checks if a customer has purchased a product by slug
- Exposed via `FlowgladContext` and `FlowgladServer` through
`BillingWithChecks`
        -   Added to SDK types and re-exported for TypeScript support
        -   Playground UI updated to show purchase state for top-ups

    ### Usage Meter Support

- [f01bc21](f01bc21d):
Add usage meter support to `createUsageEvent`
- `createUsageEvent` now accepts `usageMeterId` or `usageMeterSlug`
parameters
- Validation ensures exactly one identifier is provided (either price or
usage meter)
- Prevents mixing price and meter identifiers in the same request
- Added comprehensive test coverage for valid inputs and invalid
combinations

    ### Request Handler Standardization

- [e3c8066](e3c8066c):
Standardize request handling across Next.js and Express
- Introduced unified `requestHandler<TRequest>` API that extracts
`customerExternalId` via `getCustomerExternalId`
- Updated Next.js handlers: `nextRouteHandler` and `pagesRouteHandler`
now use `requestHandler` pattern
- Removed deprecated `createAppRouterRouteHandler` and
`createPagesRouterRouteHandler` functions
- Added `expressRouter` in `@flowglad/server/express` with optional
middleware support
- Replaced `createRequestHandler` exports with `requestHandler` in
server/next packages
- Removed deprecated `@flowglad/express` package (CHANGELOG and README
removed)

    ## Breaking Changes

    ⚠️ **Request Handler API Changes**

The request handler API has been standardized across all frameworks. If
you're using Express or Next.js route handlers, you'll need to update
your code:

    **Express Migration:**

    **Before:**

    ```typescript
    import { createFlowgladExpressRouter } from "@flowglad/express";
    ```

    **After:**

    ```typescript
    import { expressRouter } from "@flowglad/server/express";
    // Provide getCustomerExternalId(req) and flowglad(id)
    ```

    **Next.js Migration:**

    **Before:**

    ```typescript
    import { createAppRouterRouteHandler } from "@flowglad/nextjs";
    // or
    import { createPagesRouterRouteHandler } from "@flowglad/nextjs";
    ```

    **After:**

    ```typescript
    import { nextRouteHandler } from "@flowglad/nextjs";
    // or
    import { pagesRouteHandler } from "@flowglad/nextjs";
    // Use with getCustomerExternalId and flowglad factory
    ```

    **General Migration:**

If you were using `createRequestHandler` directly, update to
`requestHandler`:

    -   Update imports from `createRequestHandler` to `requestHandler`
- Request handlers now require `getCustomerExternalId` and a `flowglad`
factory
- Handlers receive both route payload and the original request object

    ## Updated Dependencies

    -   `@flowglad/express` package has been removed from the repository
- All functionality moved to `@flowglad/server/express` subpath export

-   Updated dependencies [23d20a5]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   23d20a5: ### SDK Helper Functions

- [17e3942](17e39425):
Add `hasPurchased` helper function to SDK
- New `hasPurchased` helper function available in `@flowglad/react` and
`@flowglad/server`
        -   Checks if a customer has purchased a product by slug
- Exposed via `FlowgladContext` and `FlowgladServer` through
`BillingWithChecks`
        -   Added to SDK types and re-exported for TypeScript support
        -   Playground UI updated to show purchase state for top-ups

    ### Usage Meter Support

- [f01bc21](f01bc21d):
Add usage meter support to `createUsageEvent`
- `createUsageEvent` now accepts `usageMeterId` or `usageMeterSlug`
parameters
- Validation ensures exactly one identifier is provided (either price or
usage meter)
- Prevents mixing price and meter identifiers in the same request
- Added comprehensive test coverage for valid inputs and invalid
combinations

    ### Request Handler Standardization

- [e3c8066](e3c8066c):
Standardize request handling across Next.js and Express
- Introduced unified `requestHandler<TRequest>` API that extracts
`customerExternalId` via `getCustomerExternalId`
- Updated Next.js handlers: `nextRouteHandler` and `pagesRouteHandler`
now use `requestHandler` pattern
- Removed deprecated `createAppRouterRouteHandler` and
`createPagesRouterRouteHandler` functions
- Added `expressRouter` in `@flowglad/server/express` with optional
middleware support
- Replaced `createRequestHandler` exports with `requestHandler` in
server/next packages
- Removed deprecated `@flowglad/express` package (CHANGELOG and README
removed)

    ## Breaking Changes

    ⚠️ **Request Handler API Changes**

The request handler API has been standardized across all frameworks. If
you're using Express or Next.js route handlers, you'll need to update
your code:

    **Express Migration:**

    **Before:**

    ```typescript
    import { createFlowgladExpressRouter } from "@flowglad/express";
    ```

    **After:**

    ```typescript
    import { expressRouter } from "@flowglad/server/express";
    // Provide getCustomerExternalId(req) and flowglad(id)
    ```

    **Next.js Migration:**

    **Before:**

    ```typescript
    import { createAppRouterRouteHandler } from "@flowglad/nextjs";
    // or
    import { createPagesRouterRouteHandler } from "@flowglad/nextjs";
    ```

    **After:**

    ```typescript
    import { nextRouteHandler } from "@flowglad/nextjs";
    // or
    import { pagesRouteHandler } from "@flowglad/nextjs";
    // Use with getCustomerExternalId and flowglad factory
    ```

    **General Migration:**

If you were using `createRequestHandler` directly, update to
`requestHandler`:

    -   Update imports from `createRequestHandler` to `requestHandler`
- Request handlers now require `getCustomerExternalId` and a `flowglad`
factory
- Handlers receive both route payload and the original request object

    ## Updated Dependencies

    -   `@flowglad/express` package has been removed from the repository
- All functionality moved to `@flowglad/server/express` subpath export

-   Updated dependencies [23d20a5]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Patch Changes

-   23d20a5: ### SDK Helper Functions

- [17e3942](17e39425):
Add `hasPurchased` helper function to SDK
- New `hasPurchased` helper function available in `@flowglad/react` and
`@flowglad/server`
        -   Checks if a customer has purchased a product by slug
- Exposed via `FlowgladContext` and `FlowgladServer` through
`BillingWithChecks`
        -   Added to SDK types and re-exported for TypeScript support
        -   Playground UI updated to show purchase state for top-ups

    ### Usage Meter Support

- [f01bc21](f01bc21d):
Add usage meter support to `createUsageEvent`
- `createUsageEvent` now accepts `usageMeterId` or `usageMeterSlug`
parameters
- Validation ensures exactly one identifier is provided (either price or
usage meter)
- Prevents mixing price and meter identifiers in the same request
- Added comprehensive test coverage for valid inputs and invalid
combinations

    ### Request Handler Standardization

- [e3c8066](e3c8066c):
Standardize request handling across Next.js and Express
- Introduced unified `requestHandler<TRequest>` API that extracts
`customerExternalId` via `getCustomerExternalId`
- Updated Next.js handlers: `nextRouteHandler` and `pagesRouteHandler`
now use `requestHandler` pattern
- Removed deprecated `createAppRouterRouteHandler` and
`createPagesRouterRouteHandler` functions
- Added `expressRouter` in `@flowglad/server/express` with optional
middleware support
- Replaced `createRequestHandler` exports with `requestHandler` in
server/next packages
- Removed deprecated `@flowglad/express` package (CHANGELOG and README
removed)

    ## Breaking Changes

    ⚠️ **Request Handler API Changes**

The request handler API has been standardized across all frameworks. If
you're using Express or Next.js route handlers, you'll need to update
your code:

    **Express Migration:**

    **Before:**

    ```typescript
    import { createFlowgladExpressRouter } from "@flowglad/express";
    ```

    **After:**

    ```typescript
    import { expressRouter } from "@flowglad/server/express";
    // Provide getCustomerExternalId(req) and flowglad(id)
    ```

    **Next.js Migration:**

    **Before:**

    ```typescript
    import { createAppRouterRouteHandler } from "@flowglad/nextjs";
    // or
    import { createPagesRouterRouteHandler } from "@flowglad/nextjs";
    ```

    **After:**

    ```typescript
    import { nextRouteHandler } from "@flowglad/nextjs";
    // or
    import { pagesRouteHandler } from "@flowglad/nextjs";
    // Use with getCustomerExternalId and flowglad factory
    ```

    **General Migration:**

If you were using `createRequestHandler` directly, update to
`requestHandler`:

    -   Update imports from `createRequestHandler` to `requestHandler`
- Request handlers now require `getCustomerExternalId` and a `flowglad`
factory
- Handlers receive both route payload and the original request object

    ## Updated Dependencies

    -   `@flowglad/express` package has been removed from the repository
- All functionality moved to `@flowglad/server/express` subpath export


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Versioned Flowglad packages to 0.16.1. This release adds a
purchase-check helper, usage meter support, and a unified request
handler API across Next.js and Express.

- **New Features**
- hasPurchased helper in React/Server to check purchases by product
slug.
- createUsageEvent supports usageMeterId or usageMeterSlug with
validation.
- Unified requestHandler used by nextRouteHandler/pagesRouteHandler and
new expressRouter.

- **Migration**
- Replace createRequestHandler with requestHandler and provide
getCustomerExternalId + flowglad factory.
- Switch from createFlowgladExpressRouter to expressRouter from
@flowglad/server/express.
- Use nextRouteHandler or pagesRouteHandler; @flowglad/express is
removed.

<sup>Written for commit 9f5ef18.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

v0.16.0

Toggle v0.16.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: publish release workflow node compatibility issue (#1039)

## What Does this PR Do?
<!-- Please provide a clear and concise description of the changes in
this PR -->







<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Switch the publish-release workflow to Node.js 20 to fix Node 18 issues
and stabilize releases. Add manual dispatch with branch input and update
checkout/conditions to publish from the selected branch or the merge
commit.

<sup>Written for commit 967c5b2.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->









<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Release workflow now supports manual triggers with a selectable branch
for flexible deployments.
* Checkout logic updated to determine the correct ref for manual or
merged-release runs.
  * Upgraded Node.js runtime from 18 to 20.
  * Workflow permissions adjusted for required write access.
* Bun setup retained; checkout behavior preserved for full repository
context.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

v0.15.0

Toggle v0.15.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: version packages (#953)

This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @flowglad/[email protected]

### Minor Changes

-   562490d: - add subscription uncancel
    -   bump @flowglad/node dependency to v0.24

### Patch Changes

-   Updated dependencies [562490d]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   562490d: - add subscription uncancel
    -   bump @flowglad/node dependency to v0.24

### Patch Changes

-   Updated dependencies [562490d]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   562490d: - add subscription uncancel
    -   bump @flowglad/node dependency to v0.24

### Patch Changes

-   Updated dependencies [562490d]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   562490d: - add subscription uncancel
    -   bump @flowglad/node dependency to v0.24

### Patch Changes

-   Updated dependencies [562490d]
    -   @flowglad/[email protected]

## @flowglad/[email protected]

### Minor Changes

-   562490d: - add subscription uncancel
    -   bump @flowglad/node dependency to v0.24




<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Release v0.15.0 for @flowglad/express, @flowglad/nextjs,
@flowglad/react, @flowglad/server, and @flowglad/shared. Adds
subscription uncancel and upgrades @flowglad/node to v0.24.

<sup>Written for commit 45ec6b2.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: angihe93 <[email protected]>