Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions build_log_verify.txt
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CodenRust why do we have to commit these files?

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

> billingsdk@0.0.0 build
> next build

[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
ÔÜá Warning: Next.js inferred your workspace root, but it may not be correct.
We detected multiple lockfiles and selected the directory of C:\Users\srini\package-lock.json as the root directory.
To silence this warning, set `turbopack.root` in your Next.js config, or consider removing one of the lockfiles if it's not needed.
See https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory for more information.
Detected additional lockfiles:
* C:\Users\srini\Downloads\billingsdk\package-lock.json

Ôû▓ Next.js 16.0.10 (Turbopack)

[MDX] generated files in 89.94050000000061ms
Creating an optimized production build ...
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
Ô£ô Compiled successfully in 63s
Running TypeScript ...
Collecting page data using 7 workers ...
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
ÔÜá Using edge runtime on a page currently disables static generation for that page
Generating static pages using 7 workers (0/94) ...
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
Error occurred prerendering page "/llms.mdx/components/payment-details-two". Read more: https://nextjs.org/docs/messages/prerender-error
Error: ENOENT: no such file or directory, open 'C:\Users\srini\Downloads\billingsdk\contentdocs\components\payment-details-two\index.mdx'
at async Object.getText (C:\Users\srini\Downloads\billingsdk\.next\server\chunks\Downloads_billingsdk_e35021e6._.js:1:4375435)
at async l (C:\Users\srini\Downloads\billingsdk\.next\server\chunks\Downloads_billingsdk_f9402a61._.js:21:167137)
at async l (C:\Users\srini\Downloads\billingsdk\.next\server\chunks\Downloads_billingsdk_745e94af._.js:1:9951) {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\srini\\Downloads\\billingsdk\\contentdocs\\components\\payment-details-two\\index.mdx'
}
Export encountered an error on /llms.mdx/[[...slug]]/route: /llms.mdx/components/payment-details-two, exiting the build.
Error occurred prerendering page "/llms.mdx/cli". Read more: https://nextjs.org/docs/messages/prerender-error
Ô¿» Next.js build worker exited with code: 1 and signal: null
45 changes: 45 additions & 0 deletions build_log_verify_2.txt
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

> billingsdk@0.0.0 build
> next build

[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
ÔÜá Warning: Next.js inferred your workspace root, but it may not be correct.
We detected multiple lockfiles and selected the directory of C:\Users\srini\package-lock.json as the root directory.
To silence this warning, set `turbopack.root` in your Next.js config, or consider removing one of the lockfiles if it's not needed.
See https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#root-directory for more information.
Detected additional lockfiles:
* C:\Users\srini\Downloads\billingsdk\package-lock.json

Ôû▓ Next.js 16.0.10 (Turbopack)

[MDX] generated files in 40.96280000000024ms
Creating an optimized production build ...
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
Ô£ô Compiled successfully in 37.2s
Running TypeScript ...
Collecting page data using 7 workers ...
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
ÔÜá Using edge runtime on a page currently disables static generation for that page
Generating static pages using 7 workers (0/94) ...
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
Error occurred prerendering page "/llms-full.txt". Read more: https://nextjs.org/docs/messages/prerender-error
Error: ENOENT: no such file or directory, open 'C:\Users\srini\Downloads\billingsdk\contentdocs\cli.mdx'
at async Object.getText (C:\Users\srini\Downloads\billingsdk\.next\server\chunks\Downloads_billingsdk_16fdf67a._.js:1:4375200)
at async l (C:\Users\srini\Downloads\billingsdk\.next\server\chunks\Downloads_billingsdk_f9402a61._.js:21:167137)
at async i (C:\Users\srini\Downloads\billingsdk\.next\server\chunks\[root-of-the-server]__742aafed._.js:1:1513) {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\srini\\Downloads\\billingsdk\\contentdocs\\cli.mdx'
}
Export encountered an error on /llms-full.txt/route: /llms-full.txt, exiting the build.
Ô¿» Next.js build worker exited with code: 1 and signal: null
101 changes: 101 additions & 0 deletions content/docs/components/billing-settings-three/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: Billing Settings 3
description: A user-centric billing dashboard featuring wallet balance, spend visualization, and liquid UI payment methods.
---

import { BillingSettingsThree } from "@/components/billingsdk/billing-settings-three";
import BillingSettingsThreeDemo from "@/registry/billingsdk/demo/billing-settings-three-demo";
Comment on lines +6 to +7
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

fd 'index.mdx' --full-path 'content/docs/components/billing-settings-three' --type f

Repository: dodopayments/billingsdk

Length of output: 123


🏁 Script executed:

cat -n content/docs/components/billing-settings-three/index.mdx

Repository: dodopayments/billingsdk

Length of output: 4943


Remove unused import: BillingSettingsThree is never referenced in the MDX body.

Only BillingSettingsThreeDemo is used in the Preview tab (line 16). The component is referenced in the usage code example block but that's static documentation content, not rendered JSX.

✏️ Proposed fix
-import { BillingSettingsThree } from "@/components/billingsdk/billing-settings-three";
 import BillingSettingsThreeDemo from "@/registry/billingsdk/demo/billing-settings-three-demo";
🤖 Prompt for AI Agents
In `@content/docs/components/billing-settings-three/index.mdx` around lines 6 - 7,
Remove the unused import by deleting the import statement that references
BillingSettingsThree; specifically remove or stop importing the symbol
BillingSettingsThree from "@/components/billingsdk/billing-settings-three" since
only BillingSettingsThreeDemo is actually used in the MDX content and the static
code block does not require an actual import. Ensure only
BillingSettingsThreeDemo remains imported to avoid dead imports and linter
warnings.


A user-facing dashboard component `BillingSettingsThree` for managing billing, wallet balance, and payment methods.

## Preview

<Tabs items={['Preview', 'Code']} className="bg-transparent border-none">
<Tab value="Preview" className="border-none bg-transparent p-0 mt-3">
<PreviewComponents registryName="billing-settings-3">
<BillingSettingsThreeDemo />
</PreviewComponents>
</Tab>

<Tab value="Code" className="mt-3">
<include cwd lang="tsx" meta='title="src/registry/billingsdk/demo/billing-settings-three-demo.tsx"'>src/registry/billingsdk/demo/billing-settings-three-demo.tsx</include>
</Tab>
</Tabs>

## Features

- **Minimalist Metrics**: Clean, static display of wallet balances, spend amounts, and trend percentages for maximum stability and clarity.
- **Trend Indicators**: Built-in support for displaying positive/negative trends with automatic color coding and icons.
- **Liquid Payment Methods**: Smooth, animated "liquid" list for adding/removing payment methods with high-fidelity transitions.
- **Smart Brand Recognition**: Automatically displays high-quality icons for Visa, Mastercard, AMEX, and Rupay, with a fallback to standard card icons if external assets fail to load.
- **Flexible "Add New" Logic**: Support for both in-app modal callbacks (`onAddNew`) and direct external redirects (`addNewHref`).
- **Minimalist Aesthetic**: Features a zero-animation `minimal` mode that removes background decorative elements for a clean dashboard look.
Comment on lines +27 to +32
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Documentation contradicts PR description regarding animations.

Line 29 describes "Smooth, animated 'liquid' list… with high-fidelity transitions," while line 32 mentions "zero-animation minimal mode." The PR description explicitly states "no animations" for BillingSettingsThree. These claims are inconsistent—clarify whether the classic theme includes animations or if the feature descriptions should be corrected.

🤖 Prompt for AI Agents
In `@content/docs/components/billing-settings-three/index.mdx` around lines 27 -
32, The doc text contradicts the PR description about animations; update the
component docs for BillingSettingsThree to be consistent by clarifying whether
the classic theme uses animated transitions or is strictly no-animation: change
the "Liquid Payment Methods" bullet and the "Minimalist Aesthetic" bullet to
reflect the authoritative behavior (use the component name BillingSettingsThree
and the prop minimal/onAddNew/addNewHref to guide readers), e.g., state that
liquid list uses animated transitions only when minimal is false (or state "no
animations" if PR dictates) and that minimal mode disables all
decorative/transition animations; ensure both bullets and any mention of
animations match the PR claim exactly.


## Usage

```tsx
import { BillingSettingsThree } from "@/components/billingsdk/billing-settings-three";
import { BillingProvider } from "@/lib/i18n-provider";

export default function BillingPage() {
const handleAddNew = () => {
console.log("Open payment method modal");
};

return (
<BillingProvider>
<BillingSettingsThree
balance={1250.00}
balanceTrend={15.4}
spend={432.50}
spendTrend={-5.2}
theme="classic"
onAddNew={handleAddNew}
// Or use addNewHref="/billing/payment-methods/new"
/>
</BillingProvider>
);
}
```

## Props

| Prop | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `balance` | `number` | `1250.00` | The current wallet balance to display. |
| `balanceTrend` | `number` | `12.5` | Percentage change in balance (e.g., `15.4` for +15.4%). |
| `balanceTrendLabel` | `string` | `"from last month"` | Label shown next to the balance trend. |
| `spend` | `number` | `432.50` | The total spend for the current period. |
| `spendTrend` | `number` | `-2.4` | Percentage change in spend (e.g., `-5.2` for -5.2%). |
| `spendTrendLabel` | `string` | `"Current billing cycle"` | Label shown next to the spend trend. |
| `currency` | `string` | `"USD"` | The currency code (e.g., "USD", "EUR"). |
| `theme` | `"minimal" \| "classic"` | `"minimal"` | The visual theme variant. |
| `paymentMethods` | `PaymentMethod[]` | `[...]` | Array of payment objects: `{ id, type, last4, expiry, isDefault }`. |
| `transactions` | `Transaction[]` | `[...]` | Array of transactions: `{ id, description, amount, date, status }`. |
| `onAddNew` | `() => void` | `undefined` | Callback for "Add New" button (e.g., to open a modal). |
| `addNewHref` | `string` | `undefined` | URL for "Add New" button redirect (fallback if `onAddNew` is not provided). |

## Installation

<Tabs defaultValue="manual">

<TabsList>
<TabsTrigger value="manual">Manual</TabsTrigger>
<TabsTrigger value="cli">CLI</TabsTrigger>
</TabsList>

<TabsContent value="manual">

Copy the code from `src/components/billingsdk/billing-settings-three.tsx` into your project.

</TabsContent>

<TabsContent value="cli">

```bash
npx shadcn@latest add "https://billingsdk.com/r/billing-settings-3.json"
```

</TabsContent>

</Tabs>
92 changes: 92 additions & 0 deletions content/docs/i18n-provider.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
title: i18n Provider
description: Global currency conversion and localized formatting for billing components.
---

import I18nDemo from "@/registry/billingsdk/demo/i18n-demo";

The `BillingProvider` is the core of the SDK's internationalization system. It manages global state for locales, currencies, and real-time exchange rates.

## Interactive Demo

<Tabs items={['Preview', 'Code']} className="bg-transparent border-none">
<Tab value="Preview" className="border-none bg-transparent p-0 mt-3">
<PreviewComponents registryName="i18n-provider">
<I18nDemo />
</PreviewComponents>
</Tab>

<Tab value="Code" className="mt-3">
<include cwd lang="tsx" meta='title="src/registry/billingsdk/demo/i18n-demo.tsx"'>src/registry/billingsdk/demo/i18n-demo.tsx</include>
</Tab>
</Tabs>

## Features

- **Real-time Conversion**: Fetches latest rates from the Frankfurter API and caches them.
- **Static Fallbacks**: Includes a robust set of initial exchange rates to ensure functionality works offline or before the first fetch.
- **Localized Formatting**: Leverages the native `Intl.NumberFormat` API for accurate currency symbols, grouping, and decimal placement.
- **Auto-Conversion**: Components can automatically convert values from a base currency (e.g., USD) to the user's active currency.

## Setup

Wrap your application with the `BillingProvider` at the root level.

```tsx title="app/layout.tsx"
import { BillingProvider } from "@/lib/i18n-provider";

export default function RootLayout({ children }) {
return (
<BillingProvider defaultCurrency="USD" defaultLocale="en-US">
{children}
</BillingProvider>
);
}
```
Comment on lines +35 to +45
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Setup code example is missing TypeScript types.

The RootLayout example omits prop types for children, which is inconsistent with a TypeScript-oriented SDK. This is the first code snippet users will copy.

✏️ Suggested fix
-export default function RootLayout({ children }) {
+export default function RootLayout({ children }: { children: React.ReactNode }) {
🤖 Prompt for AI Agents
In `@content/docs/i18n-provider.mdx` around lines 35 - 45, The RootLayout example
omits TypeScript types for its props; update the RootLayout signature to declare
the children prop type (e.g., { children: React.ReactNode } or
React.PropsWithChildren) so the snippet is TypeScript-safe—adjust imports if
needed—and keep the existing BillingProvider usage with defaultCurrency and
defaultLocale unchanged.


## useBilling Hook

Use the `useBilling` hook to access formatting utilities and currency state.

### Properties

| Property | Type | Description |
| :--- | :--- | :--- |
| `currency` | `string` | The currently active currency code (e.g., "EUR"). |
| `locale` | `string` | The active locale (e.g., "de-DE"). |
| `setCurrency` | `(c: string) => void` | Updates the active currency and triggers re-renders. |
| `formatCurrency` | `(val, opts) => string` | Formats a number with currency symbols and local rules. |
| `convert` | `(val, from, to) => number` | Low-level utility for converting numbers between currencies. |

### Example: Manual Formatting

```tsx
import { useBilling } from "@/lib/i18n-provider";

export function CustomPrice({ amount }) {
const { formatCurrency } = useBilling();

return (
<p>
Trial ends in: {formatCurrency(amount, { from: "USD" })}
</p>
);
}
```
Comment on lines +63 to +75
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Same missing types in the CustomPrice example.

✏️ Suggested fix
-export function CustomPrice({ amount }) {
+export function CustomPrice({ amount }: { amount: number }) {
🤖 Prompt for AI Agents
In `@content/docs/i18n-provider.mdx` around lines 63 - 75, The example CustomPrice
component is missing TypeScript types for its props; update the function
signature to explicitly type the props (e.g., define an interface or inline type
for amount as number) and annotate the component return type if desired so
CustomPrice({ amount }: { amount: number }) uses a typed amount passed into
useBilling().formatCurrency; ensure references to the useBilling import and the
CustomPrice function name remain consistent.


## Static Rates Fallback

The provider ships with a `STATIC_RATES` map to ensure reliable performance. These rates are used as a fallback if the API is unreachable or while rates are being fetched.

```json
{
"AUD": 1.4312,
"BRL": 5.2372,
"CAD": 1.3666,
"EUR": 0.84789,
"GBP": 0.73588,
"INR": 90.66,
"JPY": 157.09,
...
}
```
4 changes: 2 additions & 2 deletions content/docs/interfaces.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: TypeScript Interfaces
description: Complete TypeScript definitions for all Billing SDK components and data structures
description: Complete TypeScript definitions for all Billing SDK components and data structures.
---

## Plan Interface
Expand Down Expand Up @@ -197,4 +197,4 @@ export const plans: Plan[] = [
],
}
];
```
```
16 changes: 8 additions & 8 deletions content/docs/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"---Getting Started---",
"index",
"quick-start",
"i18n-provider",
"cli",
"shadcn-cli-3",
"contribution-open-source",
Expand All @@ -19,22 +20,21 @@
"components/manage-subscription/index",
"components/manage-subscription/usage-based-pricing",
"components/invoice-history/index",
"components/usage-table/index",
"components/limited-offer-dialog/index",
"---Update Plan---",
"components/update-plan/update-plan-card",
"components/update-plan/update-plan-dialog",
"---Cancel Subscription---",
"components/cancel-subscription/cancel-subscription-card",
"components/cancel-subscription/cancel-subscription-dialog",
"---Billing & Usage Analytics---",
"components/billing-screen/index",
"components/billing-setting/index",
"components/billing-settings-2/index",
"components/billing-settings-three/index",
"components/usage-meter/usage-meter-circle",
"components/usage-meter/usage-meter-linear",
"components/detailed-usage-table/index",
"components/upcoming-charges/index",
"---Update Plan---",
"components/update-plan/update-plan-card",
"components/update-plan/update-plan-dialog",
"---Cancel Subscription---",
"components/cancel-subscription/cancel-subscription-card",
"components/cancel-subscription/cancel-subscription-dialog",
"---Banner---",
"components/banner/index",
"---Trial Management---",
Expand Down
Loading
Loading