@molecule/app-pricing-page-svelte 0.0.1-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,11 +1,200 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-21T12:46:59.701Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
1
9
|
# @molecule/app-pricing-page-svelte
|
|
2
10
|
|
|
3
|
-
|
|
11
|
+
Svelte drop-in pricing page used by every paid molecule.dev flagship app.
|
|
12
|
+
|
|
13
|
+
Components:
|
|
14
|
+
`<PricingPage />` — Renders one card per tier, with optional
|
|
15
|
+
monthly/yearly toggle and Stripe Checkout
|
|
16
|
+
CTA. Reads tiers from `usePricingTiers()`
|
|
17
|
+
unless an explicit `tiers` prop is passed.
|
|
18
|
+
|
|
19
|
+
`<PlanUpdatedPage />` — Post-checkout success page rendered at
|
|
20
|
+
Stripe's `success_url` redirect target.
|
|
21
|
+
|
|
22
|
+
It is the Svelte counterpart of `@molecule/app-pricing-page-react`: the
|
|
23
|
+
same exports, the same props (React names) and the same DOM for the same
|
|
24
|
+
input.
|
|
25
|
+
|
|
26
|
+
Translations live in the companion locale bond
|
|
27
|
+
`@molecule/app-locales-pricing-page`. The checkout transport lives in
|
|
28
|
+
`@molecule/app-billing-svelte` (`usePricingTiers()` calls
|
|
29
|
+
`GET /api/billing/tiers`; `useStartCheckout()` posts to
|
|
30
|
+
`/api/billing/checkout`) — your API must serve those routes and the HTTP
|
|
31
|
+
client must be wired. NOTE: `@molecule/app-billing-svelte` also exports its
|
|
32
|
+
own different `PricingPage` (compound LimitsList/LimitsItem layout); import
|
|
33
|
+
from the package whose API you are using. The default checkout redirects
|
|
34
|
+
with `window.location.assign(checkoutUrl)` — pass `onCheckout` to route
|
|
35
|
+
through an SPA router or a non-Stripe flow. `<PlanUpdatedPage />` here is
|
|
36
|
+
the pricing-page-flavored success page; `@molecule/app-legal-pages-svelte`
|
|
37
|
+
also exports a same-named `PlanUpdatedPage`, and a standalone plan-updated
|
|
38
|
+
page lives in `@molecule/app-plan-updated-page-svelte` — import the one
|
|
39
|
+
whose kit you are using.
|
|
40
|
+
|
|
41
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
42
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
43
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```svelte
|
|
48
|
+
<script lang="ts">
|
|
49
|
+
import { PricingPage } from '@molecule/app-pricing-page-svelte'
|
|
50
|
+
import { addTranslations } from '@molecule/app-i18n'
|
|
51
|
+
import { en } from '@molecule/app-locales-pricing-page'
|
|
52
|
+
|
|
53
|
+
addTranslations('en', en)
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<PricingPage />
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Type
|
|
60
|
+
|
|
61
|
+
`feature`
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install @molecule/app-pricing-page-svelte @molecule/app-billing-svelte @molecule/app-subscription-plan-card-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
### Interfaces
|
|
72
|
+
|
|
73
|
+
#### `PricingPageProps`
|
|
74
|
+
|
|
75
|
+
Props for `<PricingPage />`.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
interface PricingPageProps<TLimits = unknown> {
|
|
79
|
+
/**
|
|
80
|
+
* Optional pre-fetched tiers. When omitted the component fetches them
|
|
81
|
+
* via `usePricingTiers()` (which calls `GET /api/billing/tiers`).
|
|
82
|
+
*/
|
|
83
|
+
tiers?: PricingTierEntry<TLimits>[]
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Optional override for the checkout handler. The default posts to
|
|
87
|
+
* `/api/billing/checkout` via `useStartCheckout()` and redirects the
|
|
88
|
+
* browser to the returned `checkoutUrl`. Custom apps can pass a
|
|
89
|
+
* function that performs Stripe checkout via a different transport,
|
|
90
|
+
* navigates within a router, etc.
|
|
91
|
+
*/
|
|
92
|
+
onCheckout?: (tier: PricingTierEntry<TLimits>, price: PricingTierPrice) => void | Promise<void>
|
|
93
|
+
|
|
94
|
+
/** When true (default), renders a monthly/yearly toggle. */
|
|
95
|
+
showPeriodToggle?: boolean
|
|
96
|
+
|
|
97
|
+
/** Default billing period for the toggle. Defaults to `'month'`. */
|
|
98
|
+
defaultPeriod?: PricingPagePeriod
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Optional render snippet for the tier-specific limits block. When
|
|
102
|
+
* omitted, `limits` are rendered as a `<dl>` of key-value pairs.
|
|
103
|
+
*/
|
|
104
|
+
renderLimits?: Snippet<[TLimits]>
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Optional translation key for the page heading. Defaults to
|
|
108
|
+
* `'pricingPage.heading'`.
|
|
109
|
+
*/
|
|
110
|
+
headingKey?: string
|
|
4
111
|
|
|
112
|
+
/** Optional English fallback for the heading. */
|
|
113
|
+
headingDefault?: string
|
|
114
|
+
|
|
115
|
+
/** Optional className applied to the outer wrapper. */
|
|
116
|
+
className?: string
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### `PlanUpdatedPageProps`
|
|
121
|
+
|
|
122
|
+
Props for `<PlanUpdatedPage />`.
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
interface PlanUpdatedPageProps {
|
|
126
|
+
/**
|
|
127
|
+
* Optional new plan name to include in the heading (e.g. `'Pro'`).
|
|
128
|
+
* When omitted, a generic heading is rendered.
|
|
129
|
+
*/
|
|
130
|
+
planName?: string
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Optional CTA label / target. Renders a primary button when both
|
|
134
|
+
* `ctaLabel` and one of `onCta` / `ctaHref` are supplied. A typical
|
|
135
|
+
* use is "Continue to dashboard". A string renders as text; a snippet
|
|
136
|
+
* renders its content.
|
|
137
|
+
*/
|
|
138
|
+
ctaLabel?: string | Snippet
|
|
139
|
+
|
|
140
|
+
/** Click handler for the CTA. Mutually exclusive with `ctaHref`. */
|
|
141
|
+
onCta?: (event: unknown) => void
|
|
142
|
+
|
|
143
|
+
/** Anchor target for the CTA. Mutually exclusive with `onCta`. */
|
|
144
|
+
ctaHref?: string
|
|
145
|
+
|
|
146
|
+
/** Optional className applied to the outer wrapper. */
|
|
147
|
+
className?: string
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Types
|
|
152
|
+
|
|
153
|
+
#### `PricingPagePeriod`
|
|
154
|
+
|
|
155
|
+
Billing period selector — currently `'month'` or `'year'`. Mirrors the
|
|
156
|
+
upstream `PricingTierPrice['period']` literal for type-safety.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
type PricingPagePeriod = PricingTierPrice['period']
|
|
5
160
|
```
|
|
6
|
-
|
|
161
|
+
|
|
162
|
+
### Constants
|
|
163
|
+
|
|
164
|
+
#### `PlanUpdatedPage`
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const PlanUpdatedPage: LegacyComponentType
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### `PricingPage`
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
const PricingPage: LegacyComponentType
|
|
7
174
|
```
|
|
8
175
|
|
|
9
|
-
|
|
176
|
+
## Injection Notes
|
|
177
|
+
|
|
178
|
+
### Requirements
|
|
179
|
+
|
|
180
|
+
Peer dependencies:
|
|
181
|
+
|
|
182
|
+
- `@molecule/app-billing-svelte` ^1.0.0
|
|
183
|
+
- `@molecule/app-subscription-plan-card-svelte` ^1.0.0
|
|
184
|
+
- `@molecule/app-svelte` ^3.5.0
|
|
185
|
+
- `@molecule/app-ui` ^1.1.0
|
|
186
|
+
- `@molecule/app-ui-svelte` ^1.1.0
|
|
187
|
+
- `svelte` ^5.0.0
|
|
188
|
+
|
|
189
|
+
### Runtime Dependencies
|
|
190
|
+
|
|
191
|
+
- `@molecule/app-billing-svelte`
|
|
192
|
+
- `@molecule/app-subscription-plan-card-svelte`
|
|
193
|
+
- `@molecule/app-svelte`
|
|
194
|
+
- `@molecule/app-ui`
|
|
195
|
+
- `@molecule/app-ui-svelte`
|
|
196
|
+
- `svelte`
|
|
197
|
+
|
|
198
|
+
## Translations
|
|
10
199
|
|
|
11
|
-
|
|
200
|
+
Translation strings are provided by `@molecule/app-locales-pricing-page`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-pricing-page-svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Standalone public pricing page — tier cards, period toggle, checkout handoff (distinct from billing-react's PricingPage)",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-pricing-page-svelte",
|
|
6
6
|
"type": "module",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"svelte": "^5.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@molecule/app-billing-svelte": "1.
|
|
61
|
+
"@molecule/app-billing-svelte": "1.1.0",
|
|
62
62
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
63
63
|
"@molecule/app-i18n": "1.2.2",
|
|
64
64
|
"@molecule/app-icons": "1.0.4",
|
|
65
65
|
"@molecule/app-subscription-plan-card-svelte": "1.1.0",
|
|
66
|
-
"@molecule/app-svelte": "3.
|
|
67
|
-
"@molecule/app-ui": "1.
|
|
68
|
-
"@molecule/app-ui-svelte": "1.1
|
|
66
|
+
"@molecule/app-svelte": "3.9.0",
|
|
67
|
+
"@molecule/app-ui": "1.5.0",
|
|
68
|
+
"@molecule/app-ui-svelte": "1.2.1",
|
|
69
69
|
"@sveltejs/package": "3.0.2",
|
|
70
70
|
"@sveltejs/vite-plugin-svelte": "7.1.2",
|
|
71
71
|
"@types/node": "26.6.5",
|