@molecule/app-pricing-page-angular 0.0.0-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 CHANGED
@@ -1,3 +1,539 @@
1
- # Temporary Holding Version
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.259Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-pricing-page-angular
10
+
11
+ Angular 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 Angular counterpart of `@molecule/app-pricing-page-react`: the
23
+ same exports, the same inputs (React prop names) and the same DOM for the
24
+ same 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-angular` (`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-angular` also exports
32
+ its own different pricing page (compound LimitsList/LimitsItem layout);
33
+ import from the package whose API you are using. The default checkout
34
+ redirects with `window.location.assign(checkoutUrl)` — pass `onCheckout`
35
+ to route through an SPA router or a non-Stripe flow. `<PlanUpdatedPage />`
36
+ here is the pricing-page-flavored success page; a standalone plan-updated
37
+ page lives in `@molecule/app-plan-updated-page-angular` — import the one
38
+ whose kit you are using.
39
+
40
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
41
+ > It is written to be read by coding agents as much as by people, and is generated from this
42
+ > package's source — edit `src/index.ts` JSDoc, not this file.
43
+
44
+ ## Quick Start
45
+
46
+ ```ts
47
+ import { Component } from '@angular/core'
48
+ import { PlanUpdatedPage, PricingPage } from '@molecule/app-pricing-page-angular'
49
+
50
+ @Component({
51
+ selector: 'app-pricing',
52
+ standalone: true,
53
+ imports: [PlanUpdatedPage, PricingPage],
54
+ template: `
55
+ <section mol-pricing-page />
56
+ <section mol-plan-updated-page planName="Pro" ctaHref="/dashboard" ctaLabel="Go to dashboard" />
57
+ `,
58
+ })
59
+ export class PricingRoute {}
60
+ ```
61
+
62
+ ## Type
63
+
64
+ `feature`
65
+
66
+ ## Installation
67
+
68
+ ```bash
69
+ npm install @molecule/app-pricing-page-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-billing-angular @molecule/app-subscription-plan-card-angular @molecule/app-ui @molecule/app-ui-angular
70
+ ```
71
+
72
+ ## API
73
+
74
+ ### Interfaces
75
+
76
+ #### `PricingPageProps`
77
+
78
+ Props for `<PricingPage />` (the component's inputs).
79
+
80
+ ```typescript
81
+ interface PricingPageProps<TLimits = unknown> {
82
+ /**
83
+ * Optional pre-fetched tiers. When omitted the component fetches them
84
+ * via `usePricingTiers()` (which calls `GET /api/billing/tiers`).
85
+ */
86
+ tiers?: PricingTierEntry<TLimits>[]
87
+
88
+ /**
89
+ * Optional override for the checkout handler. The default posts to
90
+ * `/api/billing/checkout` via `useStartCheckout()` and redirects the
91
+ * browser to the returned `checkoutUrl`. Custom apps can pass a
92
+ * function that performs Stripe checkout via a different transport,
93
+ * navigates within a router, etc.
94
+ */
95
+ onCheckout?: (tier: PricingTierEntry<TLimits>, price: PricingTierPrice) => void | Promise<void>
96
+
97
+ /** When true (default), renders a monthly/yearly toggle. */
98
+ showPeriodToggle?: boolean
99
+
100
+ /** Default billing period for the toggle. Defaults to `'month'`. */
101
+ defaultPeriod?: PricingPagePeriod
102
+
103
+ /**
104
+ * Optional template for the tier-specific limits block (React's
105
+ * `renderLimits` render function; its context carries the tier's limits
106
+ * as `$implicit` and `a0`). When omitted, `limits` are rendered as a
107
+ * `<dl>` of key-value pairs.
108
+ */
109
+ renderLimits?: TemplateRef<TLimits> | null
110
+
111
+ /**
112
+ * Optional translation key for the page heading. Defaults to
113
+ * `'pricingPage.heading'`.
114
+ */
115
+ headingKey?: string
116
+
117
+ /** Optional English fallback for the heading. */
118
+ headingDefault?: string
119
+
120
+ /** Optional className applied to the outer wrapper (the host element). */
121
+ className?: string
122
+ }
123
+ ```
124
+
125
+ #### `PlanUpdatedPageProps`
126
+
127
+ Props for `<PlanUpdatedPage />` (the component's inputs).
128
+
129
+ ```typescript
130
+ interface PlanUpdatedPageProps {
131
+ /**
132
+ * Optional new plan name to include in the heading (e.g. `'Pro'`).
133
+ * When omitted, a generic heading is rendered.
134
+ */
135
+ planName?: string
136
+
137
+ /**
138
+ * Optional CTA label / target. Renders a primary button when both
139
+ * `ctaLabel` and one of `onCta` / `ctaHref` are supplied. A typical
140
+ * use is "Continue to dashboard". A string input renders as text;
141
+ * `[slot=ctaLabel]` projected content renders in its place.
142
+ */
143
+ ctaLabel?: string
144
+
145
+ /** Click handler for the CTA. Mutually exclusive with `ctaHref`. */
146
+ onCta?: (event: unknown) => void
147
+
148
+ /** Anchor target for the CTA. Mutually exclusive with `onCta`. */
149
+ ctaHref?: string
150
+
151
+ /** Optional className applied to the outer wrapper (the host element). */
152
+ className?: string
153
+ }
154
+ ```
155
+
156
+ ### Types
157
+
158
+ #### `PricingPagePeriod`
159
+
160
+ Billing period selector — currently `'month'` or `'year'`. Mirrors the
161
+ upstream `PricingTierPrice['period']` literal for type-safety.
162
+
163
+ ```typescript
164
+ type PricingPagePeriod = PricingTierPrice['period']
165
+ ```
166
+
167
+ ### Classes
168
+
169
+ #### `PlanUpdatedPage`
170
+
171
+ PlanUpdatedPage component.
172
+
173
+ Post-checkout success page. Rendered after Stripe redirects the user back
174
+ from Checkout (the standard `success_url` route in mlcl flagship apps).
175
+ The host IS the outer `<section>` React renders, so its class list and
176
+ `data-mol-id` are host bindings. The node-valued `ctaLabel` prop is
177
+ projected content (`[slot=ctaLabel]`) or a plain string input.
178
+
179
+ This is the Angular counterpart of `@molecule/app-pricing-page-react`'s
180
+ `PlanUpdatedPage`.
181
+
182
+ ```typescript
183
+ @Component({
184
+ selector: 'section[mol-plan-updated-page]',
185
+ standalone: true,
186
+ inputs: ['planName', 'ctaLabel', 'onCta', 'ctaHref', 'className'],
187
+ host: {
188
+ '[class]': 'className ?? null',
189
+ 'data-mol-id': 'plan-updated-page',
190
+ },
191
+ // prettier-ignore
192
+ template: `
193
+ <header [class]="cm.cardHeader">
194
+ <h1 [class]="cm.cardTitle">@if (planName) {{{ t('pricingPage.planUpdated.headingNamed', { planName: planName }, { defaultValue: "You're now on the {{planName}} plan" }) }}}@else {{{ t('pricingPage.planUpdated.heading', undefined, { defaultValue: 'Your plan has been updated' }) }}}</h1>
195
+ <p [class]="cm.cardDescription">{{ t('pricingPage.planUpdated.body', undefined, { defaultValue: 'Thanks for upgrading. Your new plan is active immediately and a receipt has been emailed to you.' }) }}</p>
196
+ </header>
197
+ @if (showCta) {
198
+ <footer [class]="cm.cardFooter">
199
+ @if (ctaHref) {
200
+ <a [href]="ctaHref" [class]="cm.button({ variant: 'solid', size: 'md' })" data-mol-id="plan-updated-cta" #ctaLabelEl>@if (hasCtaLabel) {{{ ctaLabel }}}<ng-content select="[slot=ctaLabel]" /></a>
201
+ } @else {
202
+ <button type="button" [class]="cm.button({ variant: 'solid', size: 'md' })" (click)="fireCta($event)" data-mol-id="plan-updated-cta" #ctaLabelEl>@if (hasCtaLabel) {{{ ctaLabel }}}<ng-content select="[slot=ctaLabel]" /></button>
203
+ }
204
+ </footer>
205
+ }
206
+ `,
207
+ })
208
+ export class PlanUpdatedPage implements AfterViewInit, PlanUpdatedPageProps {
209
+ /**
210
+ * Optional new plan name to include in the heading (e.g. `'Pro'`).
211
+ * When omitted, a generic heading is rendered.
212
+ */
213
+ planName?: string
214
+
215
+ /**
216
+ * Optional CTA label. A string input renders as text; `[slot=ctaLabel]`
217
+ * projected content renders in its place.
218
+ */
219
+ ctaLabel?: string
220
+
221
+ /** Click handler for the CTA. Mutually exclusive with `ctaHref`. */
222
+ onCta?: (event: unknown) => void
223
+
224
+ /** Anchor target for the CTA. Mutually exclusive with `onCta`. */
225
+ ctaHref?: string
226
+
227
+ /** Optional className applied to the outer wrapper (the host element). */
228
+ className?: string
229
+
230
+ /** The i18n handle (locale-reactive), read in an injection context. */
231
+ private readonly i18n = useTranslation()
232
+
233
+ /** The translation function for the template. */
234
+ protected t = this.i18n.t
235
+
236
+ /** The bonded ClassMap (styling tokens resolve at render time). */
237
+ protected readonly cm: UIClassMap = getClassMap()
238
+
239
+ /** The CTA's label region (projected content lands here; read once). */
240
+ @ViewChild('ctaLabelEl') private ctaLabelEl?: ElementRef<HTMLElement>
241
+
242
+ /**
243
+ * Whether a `[slot=ctaLabel]` projection landed: true (optimistically)
244
+ * until the first view proves otherwise.
245
+ */
246
+ private readonly ctaProjected = signal(true)
247
+
248
+ /**
249
+ * Reads the CTA label region's first render: when neither a text input nor
250
+ * projected content landed, React would not render the CTA at all, so the
251
+ * optimistic render is withdrawn.
252
+ */
253
+ ngAfterViewInit(): void {
254
+ const el = this.ctaLabelEl?.nativeElement
255
+ if (el) this.ctaProjected.set(hasRenderableContent(el))
256
+ }
257
+
258
+ /**
259
+ * Whether a text CTA label input renders (a projected label is not).
260
+ *
261
+ * @returns True when the label renders as text.
262
+ */
263
+ get hasCtaLabel(): boolean {
264
+ return this.ctaLabel !== undefined && this.ctaLabel !== null && this.ctaLabel !== ''
265
+ }
266
+
267
+ /**
268
+ * Whether the CTA renders: a truthy string input or a projected
269
+ * `[slot=ctaLabel]` element.
270
+ *
271
+ * @returns True when the CTA shows.
272
+ */
273
+ get showCta(): boolean {
274
+ return this.hasCtaLabel || this.ctaProjected()
275
+ }
276
+
277
+ /**
278
+ * Passes the click event to the caller's handler, as React's
279
+ * `onClick={onCta}` does.
280
+ *
281
+ * @param event - The DOM click event.
282
+ */
283
+ fireCta(event: unknown): void {
284
+ this.onCta?.(event)
285
+ }
286
+ }
287
+ ```
288
+
289
+ #### `PricingPage`
290
+
291
+ PricingPage component.
292
+
293
+ Drop-in pricing page: one card per tier from `tiers` (or
294
+ `usePricingTiers()` when not supplied), with an optional monthly/yearly
295
+ toggle and a Stripe Checkout CTA per card. The host IS the outer
296
+ `<section>` React renders, so its class list and state-dependent
297
+ `data-mol-id` are host bindings. The `renderLimits` render function
298
+ arrives as a template (its context carries the tier's limits as
299
+ `$implicit` and `a0`).
300
+
301
+ This is the Angular counterpart of `@molecule/app-pricing-page-react`'s
302
+ `PricingPage`.
303
+
304
+ ```typescript
305
+ @Component({
306
+ selector: 'section[mol-pricing-page]',
307
+ standalone: true,
308
+ imports: [NgTemplateOutlet],
309
+ inputs: [
310
+ 'tiers',
311
+ 'onCheckout',
312
+ 'showPeriodToggle',
313
+ 'defaultPeriod',
314
+ 'renderLimits',
315
+ 'headingKey',
316
+ 'headingDefault',
317
+ 'className',
318
+ ],
319
+ host: {
320
+ '[class]': 'className ?? null',
321
+ '[attr.data-mol-id]': 'molId()',
322
+ },
323
+ // prettier-ignore
324
+ template: `
325
+ @if (showLoading()) {
326
+ <p>{{ t('pricingPage.loading', undefined, { defaultValue: 'Loading plans…' }) }}</p>
327
+ } @else if (showError()) {
328
+ <p [class]="cm.formError" role="alert">{{ t('pricingPage.error', undefined, { defaultValue: 'Could not load pricing. Try again later.' }) }}</p>
329
+ } @else {
330
+ <header [class]="cm.cardHeader">
331
+ <h1 [class]="cm.cardTitle">{{ t(headingKey ?? 'pricingPage.heading', undefined, { defaultValue: headingDefault ?? 'Choose your plan' }) }}</h1>
332
+ </header>
333
+ @if (showPeriodToggle !== false && hasYearly()) {
334
+ <div [class]="cm.flex({ direction: 'row', gap: 'sm', justify: 'center' })" data-mol-id="pricing-page-period-toggle" role="tablist" [attr.aria-label]="t('pricingPage.periodToggle.label', undefined, { defaultValue: 'Billing period' })">
335
+ <button type="button" role="tab" [attr.aria-selected]="period === 'month'" [class]="cm.button({ variant: period === 'month' ? 'solid' : 'outline', size: 'sm' })" (click)="period = 'month'" data-mol-id="pricing-page-period-month">{{ t('pricingPage.periodToggle.monthly', undefined, { defaultValue: 'Monthly' }) }}</button>
336
+ <button type="button" role="tab" [attr.aria-selected]="period === 'year'" [class]="cm.button({ variant: period === 'year' ? 'solid' : 'outline', size: 'sm' })" (click)="period = 'year'" data-mol-id="pricing-page-period-year">{{ t('pricingPage.periodToggle.yearly', undefined, { defaultValue: 'Yearly' }) }}</button>
337
+ </div>
338
+ }
339
+ <div [class]="cm.flex({ direction: 'row', wrap: 'wrap', gap: 'md', justify: 'center' })" data-mol-id="pricing-page-grid">
340
+ @for (tier of tiersList(); track tier.key) {
341
+ <article [class]="cm.card({ variant: 'default' })" [attr.data-mol-id]="'pricing-page-tier-' + tier.key">
342
+ <header [class]="cm.cardHeader">
343
+ <h2 [class]="cm.cardTitle">{{ tier.name }}</h2>
344
+ <p [class]="cm.cardDescription">{{ priceFor(tier)?.price ?? '—' }}@if (tier.perSeat) {<span>{{ ' ' + t('pricingPage.perSeat', undefined, { defaultValue: 'per seat' }) }}</span>}</p>
345
+ @if (priceFor(tier)?.savings) {
346
+ <p [class]="cm.cardDescription">{{ priceFor(tier)?.savings }}</p>
347
+ }
348
+ </header>
349
+ <div [class]="cm.cardContent">
350
+ @if (renderLimits) {
351
+ <ng-container [ngTemplateOutlet]="renderLimits" [ngTemplateOutletContext]="limitsContext(tier.limits)" />
352
+ } @else if (isObjectLimits(tier.limits)) {
353
+ <dl>
354
+ @for (entry of entries(tier.limits); track entry[0]) {
355
+ <div>
356
+ <dt>{{ entry[0] }}</dt>
357
+ <dd>{{ limitValue(entry[1]) }}</dd>
358
+ </div>
359
+ }
360
+ </dl>
361
+ }
362
+ </div>
363
+ <footer [class]="cm.cardFooter">
364
+ <button type="button" [class]="cm.cn(cm.button({ variant: 'solid', color: 'primary', size: 'lg', fullWidth: true }), cm.touchTargetCompact)" [disabled]="!priceFor(tier)?.stripePriceId || startState.loading()" (click)="fireCheckout(tier)" [attr.data-mol-id]="'pricing-page-cta-' + tier.key">@if (priceFor(tier)?.stripePriceId) {{{ t('pricingPage.upgradeCta', { tierName: tier.name }, { defaultValue: 'Upgrade to {{tierName}}' }) }}}@else {{{ t('pricingPage.currentCta', undefined, { defaultValue: 'Current plan' }) }}}</button>
365
+ </footer>
366
+ </article>
367
+ }
368
+ </div>
369
+ @if (startState.error()) {
370
+ <p [class]="cm.formError" role="alert" data-mol-id="pricing-page-checkout-error">{{ t('pricingPage.checkoutError', undefined, { defaultValue: 'Could not start checkout. Please try again.' }) }}</p>
371
+ }
372
+ }
373
+ `,
374
+ })
375
+ export class PricingPage implements OnInit, PricingPageProps {
376
+ /** Optional pre-fetched tiers. */
377
+ tiers?: PricingTierEntry<unknown>[]
378
+
379
+ /** Optional override for the checkout handler. */
380
+ onCheckout?: (tier: PricingTierEntry<unknown>, price: PricingTierPrice) => void | Promise<void>
381
+
382
+ /** When true (default), renders a monthly/yearly toggle. */
383
+ showPeriodToggle?: boolean
384
+
385
+ /** Default billing period for the toggle. */
386
+ defaultPeriod?: PricingPagePeriod
387
+
388
+ renderLimits?: TemplateRef<unknown> | null
389
+
390
+ /** Optional translation key for the page heading. */
391
+ headingKey?: string
392
+
393
+ /** Optional English fallback for the heading. */
394
+ headingDefault?: string
395
+
396
+ className?: string
397
+
398
+ private readonly i18n = useTranslation()
399
+
400
+ /** The translation function for the template. */
401
+ protected t = this.i18n.t
402
+
403
+ /** The bonded ClassMap (styling tokens resolve at render time). */
404
+ protected readonly cm: UIClassMap = getClassMap()
405
+
406
+ protected readonly tiersState = usePricingTiers<unknown>()
407
+
408
+ /** The checkout action and its async state. */
409
+ protected readonly startState = useStartCheckout()
410
+
411
+ protected period: PricingPagePeriod = 'month'
412
+
413
+ ngOnInit(): void {
414
+ this.period = this.defaultPeriod ?? 'month'
415
+ }
416
+
417
+ usingFetched(): boolean {
418
+ return this.tiers === undefined
419
+ }
420
+
421
+ tiersList(): PricingTierEntry<unknown>[] | null {
422
+ return this.tiers ?? this.tiersState.data()?.data ?? null
423
+ }
424
+
425
+ /** Whether the loading line shows (React's first early return). */
426
+ showLoading(): boolean {
427
+ return this.usingFetched() && this.tiersState.loading() && !this.tiersList()
428
+ }
429
+
430
+ /** Whether the error line shows (React's second early return). */
431
+ showError(): boolean {
432
+ return this.usingFetched() && (this.tiersState.error() != null || !this.tiersList())
433
+ }
434
+
435
+ molId(): string {
436
+ if (this.showLoading()) return 'pricing-page-loading'
437
+ if (this.showError()) return 'pricing-page-error'
438
+ return 'pricing-page'
439
+ }
440
+
441
+ /** Whether any tier carries a yearly price (the toggle needs one). */
442
+ hasYearly(): boolean {
443
+ return (this.tiersList() ?? []).some((tier) => tier.prices.some((p) => p.period === 'year'))
444
+ }
445
+
446
+ priceFor(tier: PricingTierEntry<unknown>): PricingTierPrice | undefined {
447
+ return tier.prices.find((p) => p.period === this.period) ?? tier.prices[0]
448
+ }
449
+
450
+ isObjectLimits(limits: unknown): limits is Record<string, unknown> {
451
+ return limits != null && typeof limits === 'object'
452
+ }
453
+
454
+ /** The entries of a limits object, in insertion order. */
455
+ entries(limits: Record<string, unknown>): [string, unknown][] {
456
+ return Object.entries(limits)
457
+ }
458
+
459
+ limitValue(value: unknown): string {
460
+ if (typeof value === 'boolean') return value ? '✓' : '—'
461
+ if (typeof value === 'number') {
462
+ if (value >= 999_999) return '∞'
463
+ return value.toLocaleString()
464
+ }
465
+ if (value == null) return '—'
466
+ if (typeof value === 'string') return value
467
+ try {
468
+ return JSON.stringify(value)
469
+ } catch (_error) {
470
+ return String(value)
471
+ }
472
+ }
473
+
474
+ limitsContext(limits: unknown): { $implicit: unknown; a0: unknown } {
475
+ return { $implicit: limits, a0: limits }
476
+ }
477
+
478
+ fireCheckout(tier: PricingTierEntry<unknown>): void {
479
+ const price = this.priceFor(tier)
480
+ if (price) void this.handleCheckout(tier, price)
481
+ }
482
+
483
+ private async handleCheckout(
484
+ tier: PricingTierEntry<unknown>,
485
+ price: PricingTierPrice,
486
+ ): Promise<void> {
487
+ if (!price.stripePriceId) return
488
+ if (this.onCheckout) {
489
+ await this.onCheckout(tier, price)
490
+ return
491
+ }
492
+ const response = await this.startState.start(price.stripePriceId)
493
+ if (response?.checkoutUrl && typeof window !== 'undefined') {
494
+ window.location.assign(response.checkoutUrl)
495
+ } else if (response?.updated && typeof window !== 'undefined') {
496
+ window.location.reload()
497
+ }
498
+ }
499
+ }
500
+ ```
501
+
502
+ _(Member comments are shortened to their first sentence, and the 16 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-pricing-page-angular/dist/pricing-page.component.d.ts`.)_
503
+
504
+ ## Injection Notes
505
+
506
+ ### Requirements
507
+
508
+ Peer dependencies:
509
+
510
+ - `@angular/common` ^22.0.0
511
+ - `@angular/core` ^22.0.0
512
+ - `@angular/platform-browser` ^22.0.0
513
+ - `@molecule/app-angular` ^3.5.0
514
+ - `@molecule/app-billing-angular` ^1.0.0
515
+ - `@molecule/app-subscription-plan-card-angular` ^1.0.0
516
+ - `@molecule/app-ui` ^1.1.0
517
+ - `@molecule/app-ui-angular` ^1.1.0
518
+
519
+ ### Runtime Dependencies
520
+
521
+ - `@angular/common`
522
+ - `@angular/core`
523
+ - `@angular/platform-browser`
524
+ - `@molecule/app-angular`
525
+ - `@molecule/app-billing-angular`
526
+ - `@molecule/app-subscription-plan-card-angular`
527
+ - `@molecule/app-ui`
528
+ - `@molecule/app-ui-angular`
529
+
530
+ - Inputs are React's prop names; the `renderLimits` render function is a
531
+ template whose context carries the tier's limits as `$implicit` and
532
+ `a0`, and the node-valued `ctaLabel` is projected content
533
+ (`[slot=ctaLabel]`) or a string input.
534
+ - Each page's host IS the `<section>` React renders, so its class list and
535
+ `data-mol-id` are host bindings.
536
+
537
+ ## Translations
538
+
539
+ Translation strings are provided by `@molecule/app-locales-pricing-page`.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Angular drop-in pricing page used by every paid molecule.dev flagship app.
3
+ *
4
+ * Components:
5
+ * `<PricingPage />` — Renders one card per tier, with optional
6
+ * monthly/yearly toggle and Stripe Checkout
7
+ * CTA. Reads tiers from `usePricingTiers()`
8
+ * unless an explicit `tiers` prop is passed.
9
+ *
10
+ * `<PlanUpdatedPage />` — Post-checkout success page rendered at
11
+ * Stripe's `success_url` redirect target.
12
+ *
13
+ * It is the Angular counterpart of `@molecule/app-pricing-page-react`: the
14
+ * same exports, the same inputs (React prop names) and the same DOM for the
15
+ * same input.
16
+ *
17
+ * Translations live in the companion locale bond
18
+ * `@molecule/app-locales-pricing-page`. The checkout transport lives in
19
+ * `@molecule/app-billing-angular` (`usePricingTiers()` calls
20
+ * `GET /api/billing/tiers`; `useStartCheckout()` posts to
21
+ * `/api/billing/checkout`) — your API must serve those routes and the HTTP
22
+ * client must be wired. NOTE: `@molecule/app-billing-angular` also exports
23
+ * its own different pricing page (compound LimitsList/LimitsItem layout);
24
+ * import from the package whose API you are using. The default checkout
25
+ * redirects with `window.location.assign(checkoutUrl)` — pass `onCheckout`
26
+ * to route through an SPA router or a non-Stripe flow. `<PlanUpdatedPage />`
27
+ * here is the pricing-page-flavored success page; a standalone plan-updated
28
+ * page lives in `@molecule/app-plan-updated-page-angular` — import the one
29
+ * whose kit you are using.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * import { Component } from '@angular/core'
34
+ * import { PlanUpdatedPage, PricingPage } from '@molecule/app-pricing-page-angular'
35
+ *
36
+ * @Component({
37
+ * selector: 'app-pricing',
38
+ * standalone: true,
39
+ * imports: [PlanUpdatedPage, PricingPage],
40
+ * template: `
41
+ * <section mol-pricing-page />
42
+ * <section mol-plan-updated-page planName="Pro" ctaHref="/dashboard" ctaLabel="Go to dashboard" />
43
+ * `,
44
+ * })
45
+ * export class PricingRoute {}
46
+ * ```
47
+ *
48
+ * @remarks
49
+ * - Inputs are React's prop names; the `renderLimits` render function is a
50
+ * template whose context carries the tier's limits as `$implicit` and
51
+ * `a0`, and the node-valued `ctaLabel` is projected content
52
+ * (`[slot=ctaLabel]`) or a string input.
53
+ * - Each page's host IS the `<section>` React renders, so its class list and
54
+ * `data-mol-id` are host bindings.
55
+ *
56
+ * @module
57
+ */
58
+ export * from './plan-updated-page.component.js';
59
+ export * from './pricing-page.component.js';
60
+ export * from './types.js';
61
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,cAAc,kCAAkC,CAAA;AAChD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Angular drop-in pricing page used by every paid molecule.dev flagship app.
3
+ *
4
+ * Components:
5
+ * `<PricingPage />` — Renders one card per tier, with optional
6
+ * monthly/yearly toggle and Stripe Checkout
7
+ * CTA. Reads tiers from `usePricingTiers()`
8
+ * unless an explicit `tiers` prop is passed.
9
+ *
10
+ * `<PlanUpdatedPage />` — Post-checkout success page rendered at
11
+ * Stripe's `success_url` redirect target.
12
+ *
13
+ * It is the Angular counterpart of `@molecule/app-pricing-page-react`: the
14
+ * same exports, the same inputs (React prop names) and the same DOM for the
15
+ * same input.
16
+ *
17
+ * Translations live in the companion locale bond
18
+ * `@molecule/app-locales-pricing-page`. The checkout transport lives in
19
+ * `@molecule/app-billing-angular` (`usePricingTiers()` calls
20
+ * `GET /api/billing/tiers`; `useStartCheckout()` posts to
21
+ * `/api/billing/checkout`) — your API must serve those routes and the HTTP
22
+ * client must be wired. NOTE: `@molecule/app-billing-angular` also exports
23
+ * its own different pricing page (compound LimitsList/LimitsItem layout);
24
+ * import from the package whose API you are using. The default checkout
25
+ * redirects with `window.location.assign(checkoutUrl)` — pass `onCheckout`
26
+ * to route through an SPA router or a non-Stripe flow. `<PlanUpdatedPage />`
27
+ * here is the pricing-page-flavored success page; a standalone plan-updated
28
+ * page lives in `@molecule/app-plan-updated-page-angular` — import the one
29
+ * whose kit you are using.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * import { Component } from '@angular/core'
34
+ * import { PlanUpdatedPage, PricingPage } from '@molecule/app-pricing-page-angular'
35
+ *
36
+ * @Component({
37
+ * selector: 'app-pricing',
38
+ * standalone: true,
39
+ * imports: [PlanUpdatedPage, PricingPage],
40
+ * template: `
41
+ * <section mol-pricing-page />
42
+ * <section mol-plan-updated-page planName="Pro" ctaHref="/dashboard" ctaLabel="Go to dashboard" />
43
+ * `,
44
+ * })
45
+ * export class PricingRoute {}
46
+ * ```
47
+ *
48
+ * @remarks
49
+ * - Inputs are React's prop names; the `renderLimits` render function is a
50
+ * template whose context carries the tier's limits as `$implicit` and
51
+ * `a0`, and the node-valued `ctaLabel` is projected content
52
+ * (`[slot=ctaLabel]`) or a string input.
53
+ * - Each page's host IS the `<section>` React renders, so its class list and
54
+ * `data-mol-id` are host bindings.
55
+ *
56
+ * @module
57
+ */
58
+ export * from './plan-updated-page.component.js';
59
+ export * from './pricing-page.component.js';
60
+ export * from './types.js';
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,cAAc,kCAAkC,CAAA;AAChD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,YAAY,CAAA"}