# Changelog

All notable changes to `@poince/auth` are documented here, following
[Keep a Changelog](https://keepachangelog.com) and [Semantic Versioning](https://semver.org).

## 3.9.13

Live app settings and risk tokens. Breaking: `useOAuthTokens`, its types and the `oAuthTokenGranted` event are removed — delete those imports and listeners.
### Added
- `usePoince().getRiskToken()` and `verifyRiskToken` from the new `@poince/auth/server`: your server asks how risky the device is (`"fatal"`, `"alert"`, `"warning"` or `null`) before a payment. A missing token or a thrown `RiskTokenError` means unverified.
### Changed
- Open pages pick up changes to your app's settings without a reload (including the WalletConnect project id and RPC endpoints), and a payment re-checks them right before it is sent. An RPC set in the developer portal now takes precedence over `addRpcUrlOverrideToChain()`. Some devices may be asked for a captcha before they sign in.
### Fixed
- An OAuth sign-in or link that returns with a code completes, a deleted or suspended app signs open tabs out, and an expired token refreshes in the React client.

## 3.9.12

Terms consent and sign-in fixes. Breaking: Solana Ledger sign-in is removed, x402 pays only in USDC, and `loginWithSiws()` links the wallet for a signed-in user.
### Removed
- `useSolanaLedgerPlugin`, `useSolanaFundingPlugin`, `isSigningInWithLedgerSolana`, SIWS `messageType: "transaction"` and the Ledger text keys.
### Changed
- Apps that require their terms sign users in only after they accept: `login()` shows the consent screen; headless apps use `useAcceptTerms()`. `useX402Fetch()` pays USDC on the Base, Avalanche or Polygon networks you enable, with `maxValue` in USDC base units. `refreshUser()` can resolve `null`, some user fields are optional, and `err.message` is a readable sentence (branch on `err.code`).
### Fixed
- Captcha sign-ins no longer fail with `invalid_captcha`, Telegram sign-in and `useUpdateEmail().verifyCode` work, the provider no longer hangs after an `appId` change, `user.wallet` is stable, and `<PoinceAccountPortal>` shows new `payment_params` while open.

## 3.9.11

Payment and signing fixes. Breaking: unused APIs are removed, `payment_params` drops `address`, and embedded wallets sign EVM transactions only by sending them.
### Removed
- `clientId` (use `appId`), `useSign7702Authorization`, `getSplTokenMetadata()`, `revokeDelegatedWallet()`, `useImportWallet`, `useRecoverEmbeddedWallet`, `useMigrateWallets`, `useSessionSigners`, the `sponsor` option and 37 unused text keys.
### Changed
- `payment_params` is typed `PaymentParams`: `to_address` for a direct transfer, `order_ref_id` with `usd_amount` for an order. With an embedded wallet, send EVM transactions with `useSendTransaction()` and use an external wallet for Solana transactions; signing without sending rejects with the new `custody_signing_unsupported` code, and `toViemAccount(…).sign` rejects.
### Fixed
- Account Portal payments converted to USDC go through, and orders paid that way reach `payment.received` with their `order_ref_id`. `sendTransaction()` sends the exact amount, external wallets switch chain first, and a double click pays once.

## 3.9.10

Sign-in components for your own page, and Appearance and theming upgrades. Breaking: `PoinceModal` and `AppConfig.render` are removed, and `--poince-*` values set on `:root` no longer reach the sign-in UI (set them on `.poince-styles-wrapper`).
### Added
- `<PoinceSignIn />`, `<PoinceConnectWallet />` and `<PoinceAccountPortal />` render inside your page, with `onComplete` and `onError`. `setTheme("system")` follows the operating system and a viewer's choice is remembered. Your dashboard's surface colour, corner radius and font now apply, icon tiles follow the surface, and `?poince_theme_preview=` links show a draft theme on your own site.
### Changed
- The sign-in UI follows your page's light or dark marker (a `dark`/`light` class, `data-theme`, `data-bs-theme` or `color-scheme` on `<html>` or `<body>`); a `setTheme()` call always wins. Themes are fetched: with a Content-Security-Policy, add `https://cdn.poince.com` to `connect-src`.
### Fixed
- Signing, export and MFA promises always settle (a superseded request rejects with `auth_flow_superseded`); several hCaptcha, logout and theme-change glitches are gone; importing the package no longer touches `localStorage`.

## 3.9.9

Fixes a sign-in regression in 3.9.8. No changes to the public API, types, or supported entry points — a drop-in update from 3.9.8.

### Fixed

- Signing in with an account that has only some sign-in methods linked (for example an email-only account) no longer fails with a false "Incorrect code" after the code was accepted.

## 3.9.8

Reliability and error-handling fixes. No changes to the public API, types, or supported entry points — a drop-in update from 3.9.6.

### Fixed

- Switching between apps in the same browser session no longer leaves sign-in stuck loading.
- Clearer errors when an app can't complete sign-in (for example an app that can't be provisioned, or a verification email that can't be delivered) instead of the code screen silently resetting.

## 3.9.6

> **Breaking** — review before upgrading.

### Added

- `setTheme` / `useTheme` — switch the sign-in UI between light and dark at runtime, alongside `setLocale`.

### Removed

- `createWallet()` no longer takes options (`createAdditional`, `walletIndex`); `CreateWalletOptions` is removed — drop either option if you passed it.

### Changed

- The email / SMS code screen shows a countdown before a code can be resent, and the verification / MFA screens show how long to wait after too many attempts.

## 3.9.5

Internal reliability improvements. No changes to the public API, types, or supported entry points — a drop-in update from 3.9.4.

## 3.9.4

> **Breaking** — review before upgrading.

### Removed

- `getAllUserEmbeddedBitcoinWallets` and the embedded-Bitcoin / curve-signing wallet types — use `getAllUserEmbeddedEthereumWallets` / `getAllUserEmbeddedSolanaWallets`.
- `setCustomMetadata` (and `UserSetCustomMetadataParams`) — use the tags / attributes writers; `FundingConfig.recipient_wallet` is removed.

### Changed

- `custom_metadata` → `{ tags?: string[]; attributes?: { [key: string]: unknown } }`; account-unlink params → a per-identifier shape; `recovery_method` → `'poince-v2'`.
- `verified_at` / `first_verified_at` / `latest_verified_at` are now optional; `User.created_at` is documented as Unix **seconds**.

## 3.9.3

### Fixed

- A consumer build no longer needs a `next.config` or bundler workaround for the WalletConnect logging stack. `@poince/auth` now declares `pino-pretty`, `lokijs`, and `encoding` as dependencies, so the bundler (webpack included) resolves WalletConnect's optional `require`s automatically — a plain install plus build just works. Previously a `next build` (notably on Vercel) could fail with `Module not found: Can't resolve 'pino-pretty'`.

## 3.9.2

Integration and diagnostics fixes for the first public release.

### Fixed

- `error.name` on the public error family (`PoinceApiError`, `PoinceClientError`, `PoinceConnectorError`) now reads as the class name instead of a minified identifier, so a caught error is legible in logs and `catch` blocks.
- An invalid or unknown `appId` no longer blanks the host page — `<PoinceProvider>` renders its built-in diagnostic in place, still routed through `onProviderError` / `providerErrorFallback`.
- `login()` and `connectOrCreateWallet()` reject with a clear error when the app's configuration cannot load (for example an unknown `appId`), instead of waiting indefinitely.

### Documentation

- README: how to clear pnpm's blocked build scripts (`ERR_PNPM_IGNORED_BUILDS`, from transitive native dependencies) and a quick-start example showing how to open the sign-in UI with `useLogin`.

## 3.9.1

First public release — the React SDK for Poince authentication, embedded wallets, and payments.

### Added

- React `PoinceProvider` and hooks, configured with the app credentials from your [Poince developer portal](https://dashboard.poince.com).
- Authentication: passkeys, email and SMS, social sign-in (OAuth), Sign-In with Ethereum, and MFA.
- Self-custodial embedded wallets on EVM and Solana, with funding and payment flows.
- User attributes and activity events (`setUserAttribute`, `sendEvent`) for your own backend or CRM.
- Ambient events (`onPoinceEvent` / `usePoinceEvent`) and locale control with full string overrides — seven locales ship built in: English, Chinese (Simplified and Traditional), Japanese, Spanish, Portuguese, and French.
- Four entry points — `@poince/auth`, `@poince/auth/solana`, `@poince/auth/internal`, `@poince/auth/skin-contract` — ESM only, with TypeScript types.

### Not included

- Smart-wallet / account abstraction (ERC-4337) and custom / JWT authentication are not part of this SDK.
