@molecule/app-pricing-page-angular 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/plan-updated-page.component.d.ts +86 -0
- package/dist/plan-updated-page.component.d.ts.map +1 -0
- package/dist/plan-updated-page.component.js +236 -0
- package/dist/plan-updated-page.component.js.map +1 -0
- package/dist/pricing-page.component.d.ts +161 -0
- package/dist/pricing-page.component.d.ts.map +1 -0
- package/dist/pricing-page.component.js +518 -0
- package/dist/pricing-page.component.js.map +1 -0
- package/dist/types.d.ts +72 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +75 -4
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { Component, signal, ViewChild } from '@angular/core';
|
|
2
|
+
import { useTranslation } from '@molecule/app-angular';
|
|
3
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
const _c0 = ["ctaLabelEl"];
|
|
6
|
+
const _c1 = [[["", "slot", "ctalabel"]], [["", "slot", "ctalabel"]]];
|
|
7
|
+
const _c2 = ["[slot=ctaLabel]", "[slot=ctaLabel]"];
|
|
8
|
+
const _c3 = () => ({ defaultValue: "Thanks for upgrading. Your new plan is active immediately and a receipt has been emailed to you." });
|
|
9
|
+
const _c4 = a0 => ({ planName: a0 });
|
|
10
|
+
const _c5 = () => ({ defaultValue: "You're now on the {{planName}} plan" });
|
|
11
|
+
const _c6 = () => ({ defaultValue: "Your plan has been updated" });
|
|
12
|
+
const _c7 = () => ({ variant: "solid", size: "md" });
|
|
13
|
+
function PlanUpdatedPage_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
14
|
+
i0.ɵɵtext(0);
|
|
15
|
+
} if (rf & 2) {
|
|
16
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
17
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.planUpdated.headingNamed", i0.ɵɵpureFunction1(1, _c4, ctx_r0.planName), i0.ɵɵpureFunction0(3, _c5)));
|
|
18
|
+
} }
|
|
19
|
+
function PlanUpdatedPage_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
20
|
+
i0.ɵɵtext(0);
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
23
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.planUpdated.heading", undefined, i0.ɵɵpureFunction0(1, _c6)));
|
|
24
|
+
} }
|
|
25
|
+
function PlanUpdatedPage_Conditional_6_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
26
|
+
i0.ɵɵtext(0);
|
|
27
|
+
} if (rf & 2) {
|
|
28
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
29
|
+
i0.ɵɵtextInterpolate(ctx_r0.ctaLabel);
|
|
30
|
+
} }
|
|
31
|
+
function PlanUpdatedPage_Conditional_6_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
32
|
+
i0.ɵɵdomElementStart(0, "a", 4, 0);
|
|
33
|
+
i0.ɵɵconditionalCreate(2, PlanUpdatedPage_Conditional_6_Conditional_1_Conditional_2_Template, 1, 1);
|
|
34
|
+
i0.ɵɵprojection(3);
|
|
35
|
+
i0.ɵɵdomElementEnd();
|
|
36
|
+
} if (rf & 2) {
|
|
37
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
38
|
+
i0.ɵɵclassMap(ctx_r0.cm.button(i0.ɵɵpureFunction0(4, _c7)));
|
|
39
|
+
i0.ɵɵdomProperty("href", ctx_r0.ctaHref, i0.ɵɵsanitizeUrl);
|
|
40
|
+
i0.ɵɵadvance(2);
|
|
41
|
+
i0.ɵɵconditional(ctx_r0.hasCtaLabel ? 2 : -1);
|
|
42
|
+
} }
|
|
43
|
+
function PlanUpdatedPage_Conditional_6_Conditional_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
44
|
+
i0.ɵɵtext(0);
|
|
45
|
+
} if (rf & 2) {
|
|
46
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
47
|
+
i0.ɵɵtextInterpolate(ctx_r0.ctaLabel);
|
|
48
|
+
} }
|
|
49
|
+
function PlanUpdatedPage_Conditional_6_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
50
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
51
|
+
i0.ɵɵdomElementStart(0, "button", 5, 0);
|
|
52
|
+
i0.ɵɵdomListener("click", function PlanUpdatedPage_Conditional_6_Conditional_2_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.fireCta($event)); });
|
|
53
|
+
i0.ɵɵconditionalCreate(2, PlanUpdatedPage_Conditional_6_Conditional_2_Conditional_2_Template, 1, 1);
|
|
54
|
+
i0.ɵɵprojection(3, 1);
|
|
55
|
+
i0.ɵɵdomElementEnd();
|
|
56
|
+
} if (rf & 2) {
|
|
57
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
58
|
+
i0.ɵɵclassMap(ctx_r0.cm.button(i0.ɵɵpureFunction0(3, _c7)));
|
|
59
|
+
i0.ɵɵadvance(2);
|
|
60
|
+
i0.ɵɵconditional(ctx_r0.hasCtaLabel ? 2 : -1);
|
|
61
|
+
} }
|
|
62
|
+
function PlanUpdatedPage_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
63
|
+
i0.ɵɵdomElementStart(0, "footer");
|
|
64
|
+
i0.ɵɵconditionalCreate(1, PlanUpdatedPage_Conditional_6_Conditional_1_Template, 4, 5, "a", 2)(2, PlanUpdatedPage_Conditional_6_Conditional_2_Template, 4, 4, "button", 3);
|
|
65
|
+
i0.ɵɵdomElementEnd();
|
|
66
|
+
} if (rf & 2) {
|
|
67
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
68
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardFooter);
|
|
69
|
+
i0.ɵɵadvance();
|
|
70
|
+
i0.ɵɵconditional(ctx_r0.ctaHref ? 1 : 2);
|
|
71
|
+
} }
|
|
72
|
+
/**
|
|
73
|
+
* Whether a node is something a caller can see (an element, or a non-blank
|
|
74
|
+
* text node).
|
|
75
|
+
*
|
|
76
|
+
* @param node - The DOM node.
|
|
77
|
+
* @returns True when it renders anything.
|
|
78
|
+
*/
|
|
79
|
+
const hasRenderable = (node) => node.nodeType === Node.ELEMENT_NODE ||
|
|
80
|
+
(node.nodeType === Node.TEXT_NODE && (node.textContent ?? '').trim().length > 0);
|
|
81
|
+
/**
|
|
82
|
+
* Whether an element carries renderable content (a projected slot landed, or
|
|
83
|
+
* its text input rendered).
|
|
84
|
+
*
|
|
85
|
+
* @param el - The element.
|
|
86
|
+
* @returns True when its children render anything.
|
|
87
|
+
*/
|
|
88
|
+
const hasRenderableContent = (el) => Array.from(el.childNodes).some(hasRenderable);
|
|
89
|
+
/**
|
|
90
|
+
* PlanUpdatedPage component.
|
|
91
|
+
*
|
|
92
|
+
* Post-checkout success page. Rendered after Stripe redirects the user back
|
|
93
|
+
* from Checkout (the standard `success_url` route in mlcl flagship apps).
|
|
94
|
+
* The host IS the outer `<section>` React renders, so its class list and
|
|
95
|
+
* `data-mol-id` are host bindings. The node-valued `ctaLabel` prop is
|
|
96
|
+
* projected content (`[slot=ctaLabel]`) or a plain string input.
|
|
97
|
+
*
|
|
98
|
+
* This is the Angular counterpart of `@molecule/app-pricing-page-react`'s
|
|
99
|
+
* `PlanUpdatedPage`.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* Angular projection needs the `<ng-content>` capture point mounted, so the
|
|
103
|
+
* CTA renders optimistically and {@link PlanUpdatedPage.ngAfterViewInit}
|
|
104
|
+
* withdraws it when nothing was supplied (React would not render it at all).
|
|
105
|
+
*/
|
|
106
|
+
export class PlanUpdatedPage {
|
|
107
|
+
/**
|
|
108
|
+
* Optional new plan name to include in the heading (e.g. `'Pro'`).
|
|
109
|
+
* When omitted, a generic heading is rendered.
|
|
110
|
+
*/
|
|
111
|
+
planName;
|
|
112
|
+
/**
|
|
113
|
+
* Optional CTA label. A string input renders as text; `[slot=ctaLabel]`
|
|
114
|
+
* projected content renders in its place.
|
|
115
|
+
*/
|
|
116
|
+
ctaLabel;
|
|
117
|
+
/** Click handler for the CTA. Mutually exclusive with `ctaHref`. */
|
|
118
|
+
onCta;
|
|
119
|
+
/** Anchor target for the CTA. Mutually exclusive with `onCta`. */
|
|
120
|
+
ctaHref;
|
|
121
|
+
/** Optional className applied to the outer wrapper (the host element). */
|
|
122
|
+
className;
|
|
123
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
124
|
+
i18n = useTranslation();
|
|
125
|
+
/** The translation function for the template. */
|
|
126
|
+
t = this.i18n.t;
|
|
127
|
+
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
128
|
+
cm = getClassMap();
|
|
129
|
+
/** The CTA's label region (projected content lands here; read once). */
|
|
130
|
+
ctaLabelEl;
|
|
131
|
+
/**
|
|
132
|
+
* Whether a `[slot=ctaLabel]` projection landed: true (optimistically)
|
|
133
|
+
* until the first view proves otherwise.
|
|
134
|
+
*/
|
|
135
|
+
ctaProjected = signal(true, /* @ts-ignore */
|
|
136
|
+
...(ngDevMode ? [{ debugName: "ctaProjected" }] : /* istanbul ignore next */ []));
|
|
137
|
+
/**
|
|
138
|
+
* Reads the CTA label region's first render: when neither a text input nor
|
|
139
|
+
* projected content landed, React would not render the CTA at all, so the
|
|
140
|
+
* optimistic render is withdrawn.
|
|
141
|
+
*/
|
|
142
|
+
ngAfterViewInit() {
|
|
143
|
+
const el = this.ctaLabelEl?.nativeElement;
|
|
144
|
+
if (el)
|
|
145
|
+
this.ctaProjected.set(hasRenderableContent(el));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Whether a text CTA label input renders (a projected label is not).
|
|
149
|
+
*
|
|
150
|
+
* @returns True when the label renders as text.
|
|
151
|
+
*/
|
|
152
|
+
get hasCtaLabel() {
|
|
153
|
+
return this.ctaLabel !== undefined && this.ctaLabel !== null && this.ctaLabel !== '';
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Whether the CTA renders: a truthy string input or a projected
|
|
157
|
+
* `[slot=ctaLabel]` element.
|
|
158
|
+
*
|
|
159
|
+
* @returns True when the CTA shows.
|
|
160
|
+
*/
|
|
161
|
+
get showCta() {
|
|
162
|
+
return this.hasCtaLabel || this.ctaProjected();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Passes the click event to the caller's handler, as React's
|
|
166
|
+
* `onClick={onCta}` does.
|
|
167
|
+
*
|
|
168
|
+
* @param event - The DOM click event.
|
|
169
|
+
*/
|
|
170
|
+
fireCta(event) {
|
|
171
|
+
this.onCta?.(event);
|
|
172
|
+
}
|
|
173
|
+
static ɵfac = function PlanUpdatedPage_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PlanUpdatedPage)(); };
|
|
174
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PlanUpdatedPage, selectors: [["section", "mol-plan-updated-page", ""]], viewQuery: function PlanUpdatedPage_Query(rf, ctx) { if (rf & 1) {
|
|
175
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
176
|
+
} if (rf & 2) {
|
|
177
|
+
let _t;
|
|
178
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.ctaLabelEl = _t.first);
|
|
179
|
+
} }, hostAttrs: ["data-mol-id", "plan-updated-page"], hostVars: 2, hostBindings: function PlanUpdatedPage_HostBindings(rf, ctx) { if (rf & 2) {
|
|
180
|
+
i0.ɵɵclassMap(ctx.className ?? null);
|
|
181
|
+
} }, inputs: { planName: "planName", ctaLabel: "ctaLabel", onCta: "onCta", ctaHref: "ctaHref", className: "className" }, ngContentSelectors: _c2, decls: 7, vars: 10, consts: [["ctaLabelEl", ""], [3, "class"], ["data-mol-id", "plan-updated-cta", 3, "href", "class"], ["type", "button", "data-mol-id", "plan-updated-cta", 3, "class"], ["data-mol-id", "plan-updated-cta", 3, "href"], ["type", "button", "data-mol-id", "plan-updated-cta", 3, "click"]], template: function PlanUpdatedPage_Template(rf, ctx) { if (rf & 1) {
|
|
182
|
+
i0.ɵɵprojectionDef(_c1);
|
|
183
|
+
i0.ɵɵdomElementStart(0, "header")(1, "h1");
|
|
184
|
+
i0.ɵɵconditionalCreate(2, PlanUpdatedPage_Conditional_2_Template, 1, 4)(3, PlanUpdatedPage_Conditional_3_Template, 1, 2);
|
|
185
|
+
i0.ɵɵdomElementEnd();
|
|
186
|
+
i0.ɵɵdomElementStart(4, "p");
|
|
187
|
+
i0.ɵɵtext(5);
|
|
188
|
+
i0.ɵɵdomElementEnd()();
|
|
189
|
+
i0.ɵɵconditionalCreate(6, PlanUpdatedPage_Conditional_6_Template, 3, 3, "footer", 1);
|
|
190
|
+
} if (rf & 2) {
|
|
191
|
+
i0.ɵɵclassMap(ctx.cm.cardHeader);
|
|
192
|
+
i0.ɵɵadvance();
|
|
193
|
+
i0.ɵɵclassMap(ctx.cm.cardTitle);
|
|
194
|
+
i0.ɵɵadvance();
|
|
195
|
+
i0.ɵɵconditional(ctx.planName ? 2 : 3);
|
|
196
|
+
i0.ɵɵadvance(2);
|
|
197
|
+
i0.ɵɵclassMap(ctx.cm.cardDescription);
|
|
198
|
+
i0.ɵɵadvance();
|
|
199
|
+
i0.ɵɵtextInterpolate(ctx.t("pricingPage.planUpdated.body", undefined, i0.ɵɵpureFunction0(9, _c3)));
|
|
200
|
+
i0.ɵɵadvance();
|
|
201
|
+
i0.ɵɵconditional(ctx.showCta ? 6 : -1);
|
|
202
|
+
} }, encapsulation: 2 });
|
|
203
|
+
}
|
|
204
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PlanUpdatedPage, [{
|
|
205
|
+
type: Component,
|
|
206
|
+
args: [{
|
|
207
|
+
selector: 'section[mol-plan-updated-page]',
|
|
208
|
+
standalone: true,
|
|
209
|
+
inputs: ['planName', 'ctaLabel', 'onCta', 'ctaHref', 'className'],
|
|
210
|
+
host: {
|
|
211
|
+
'[class]': 'className ?? null',
|
|
212
|
+
'data-mol-id': 'plan-updated-page',
|
|
213
|
+
},
|
|
214
|
+
// prettier-ignore
|
|
215
|
+
template: `
|
|
216
|
+
<header [class]="cm.cardHeader">
|
|
217
|
+
<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>
|
|
218
|
+
<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>
|
|
219
|
+
</header>
|
|
220
|
+
@if (showCta) {
|
|
221
|
+
<footer [class]="cm.cardFooter">
|
|
222
|
+
@if (ctaHref) {
|
|
223
|
+
<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>
|
|
224
|
+
} @else {
|
|
225
|
+
<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>
|
|
226
|
+
}
|
|
227
|
+
</footer>
|
|
228
|
+
}
|
|
229
|
+
`,
|
|
230
|
+
}]
|
|
231
|
+
}], null, { ctaLabelEl: [{
|
|
232
|
+
type: ViewChild,
|
|
233
|
+
args: ['ctaLabelEl']
|
|
234
|
+
}] }); })();
|
|
235
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PlanUpdatedPage, { className: "PlanUpdatedPage", filePath: "plan-updated-page.component.ts", lineNumber: 79 }); })();
|
|
236
|
+
//# sourceMappingURL=plan-updated-page.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-updated-page.component.js","sourceRoot":"","sources":["../src/plan-updated-page.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;;;;;;;;;;;IAqDG,YAAgI;;;IAAhI,+IAAgI;;;IAAQ,YAAqG;;;IAArG,wGAAqG;;;IAM5I,YAAc;;;IAAd,qCAAc;;;IAAtJ,kCAAqH;IAAA,mGAAmB;IAAe,kBAAuC;IAAA,oBAAI;;;IAA9K,2DAAqD;IAAtE,0DAAgB;IAAkG,eAAkC;IAAlC,6CAAkC;;;IAEa,YAAc;;;IAAd,qCAAc;;;;IAAlL,uCAAiJ;IAArE,2MAAS,sBAAe,KAAC;IAA4C,mGAAmB;IAAe,qBAAuC;IAAA,oBAAS;;;IAA7M,2DAAqD;IAAsE,eAAkC;IAAlC,6CAAkC;;;IAJvL,iCAAgC;IAG5B,AAFF,6FAAe,4EAEN;IAGX,oBAAS;;;IAND,mCAAuB;IAC7B,cAIC;IAJD,wCAIC;;AA1DT;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,IAAU,EAAW,EAAE,CAC5C,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;IACnC,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,WA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AC,KAAc;QACpB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC;yGA7EU,eAAe;6DAAf,eAAe;;;;;;YAAf,+BAAa,IAAI,CAAF;;;YAdtB,AADF,iCAAgC,SACH;YAAiJ,AAAjJ,uEAAgB,iDAAwI;YAAsG,oBAAK;YAC9R,4BAAgC;YAAA,YAAwK;YAC1M,AAD0M,oBAAI,EACrM;YACT,oFAAe;;YAJP,gCAAuB;YACzB,cAAsB;YAAtB,+BAAsB;YAAC,cAA8P;YAA9P,sCAA8P;YACtR,eAA4B;YAA5B,qCAA4B;YAAC,cAAwK;YAAxK,kGAAwK;YAE1M,cAQC;YARD,sCAQC;;;iFAGQ,eAAe;cAzB3B,SAAS;eAAC;gBACT,QAAQ,EAAE,gCAAgC;gBAC1C,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC;gBACjE,IAAI,EAAE;oBACJ,SAAS,EAAE,mBAAmB;oBAC9B,aAAa,EAAE,mBAAmB;iBACnC;gBACD,kBAAkB;gBAClB,QAAQ,EAAE;;;;;;;;;;;;;;GAcT;aACF;;kBAiCE,SAAS;mBAAC,YAAY;;kFAhCZ,eAAe"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { type OnInit, type TemplateRef } from '@angular/core';
|
|
2
|
+
import { type PricingTierEntry, type PricingTierPrice } from '@molecule/app-billing-angular';
|
|
3
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
4
|
+
import type { PricingPagePeriod, PricingPageProps } from './types.js';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* PricingPage component.
|
|
8
|
+
*
|
|
9
|
+
* Drop-in pricing page: one card per tier from `tiers` (or
|
|
10
|
+
* `usePricingTiers()` when not supplied), with an optional monthly/yearly
|
|
11
|
+
* toggle and a Stripe Checkout CTA per card. The host IS the outer
|
|
12
|
+
* `<section>` React renders, so its class list and state-dependent
|
|
13
|
+
* `data-mol-id` are host bindings. The `renderLimits` render function
|
|
14
|
+
* arrives as a template (its context carries the tier's limits as
|
|
15
|
+
* `$implicit` and `a0`).
|
|
16
|
+
*
|
|
17
|
+
* This is the Angular counterpart of `@molecule/app-pricing-page-react`'s
|
|
18
|
+
* `PricingPage`.
|
|
19
|
+
*/
|
|
20
|
+
export declare class PricingPage implements OnInit, PricingPageProps {
|
|
21
|
+
/**
|
|
22
|
+
* Optional pre-fetched tiers. When omitted the component fetches them
|
|
23
|
+
* via `usePricingTiers()` (which calls `GET /api/billing/tiers`).
|
|
24
|
+
*/
|
|
25
|
+
tiers?: PricingTierEntry<unknown>[];
|
|
26
|
+
/**
|
|
27
|
+
* Optional override for the checkout handler. The default posts to
|
|
28
|
+
* `/api/billing/checkout` via `useStartCheckout()` and redirects the
|
|
29
|
+
* browser to the returned `checkoutUrl`.
|
|
30
|
+
*/
|
|
31
|
+
onCheckout?: (tier: PricingTierEntry<unknown>, price: PricingTierPrice) => void | Promise<void>;
|
|
32
|
+
/** When true (default), renders a monthly/yearly toggle. */
|
|
33
|
+
showPeriodToggle?: boolean;
|
|
34
|
+
/** Default billing period for the toggle. Defaults to `'month'`. */
|
|
35
|
+
defaultPeriod?: PricingPagePeriod;
|
|
36
|
+
/**
|
|
37
|
+
* Optional template for the tier-specific limits block (React's
|
|
38
|
+
* `renderLimits`; its context carries the tier's limits as `$implicit`
|
|
39
|
+
* and `a0`).
|
|
40
|
+
*/
|
|
41
|
+
renderLimits?: TemplateRef<unknown> | null;
|
|
42
|
+
/** Optional translation key for the page heading. */
|
|
43
|
+
headingKey?: string;
|
|
44
|
+
/** Optional English fallback for the heading. */
|
|
45
|
+
headingDefault?: string;
|
|
46
|
+
/** Optional className applied to the outer wrapper (the host element). */
|
|
47
|
+
className?: string;
|
|
48
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
49
|
+
private readonly i18n;
|
|
50
|
+
/** The translation function for the template. */
|
|
51
|
+
protected t: (key: string, values?: import("@molecule/app-i18n").InterpolationValues, options?: import("@molecule/app-i18n").TranslateOptions) => string;
|
|
52
|
+
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
53
|
+
protected readonly cm: UIClassMap;
|
|
54
|
+
/** The public tier list (`GET /api/billing/tiers`, fired on mount). */
|
|
55
|
+
protected readonly tiersState: import("@molecule/app-angular").UseHttpResult<import("@molecule/app-billing-angular").PricingTiersResponse<unknown>>;
|
|
56
|
+
/** The checkout action and its async state. */
|
|
57
|
+
protected readonly startState: import("@molecule/app-billing-angular").BillingActionState<import("@molecule/app-billing-angular").CheckoutResponse> & {
|
|
58
|
+
start: (priceId: string) => Promise<import("@molecule/app-billing-angular").CheckoutResponse | null>;
|
|
59
|
+
};
|
|
60
|
+
/** The mounted billing period (React's `useState(defaultPeriod)` initial). */
|
|
61
|
+
protected period: PricingPagePeriod;
|
|
62
|
+
/**
|
|
63
|
+
* Reads the initial period from the `defaultPeriod` input, which Angular
|
|
64
|
+
* assigns before `ngOnInit` (React reads it once at mount).
|
|
65
|
+
*/
|
|
66
|
+
ngOnInit(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the page reads the fetched tiers rather than the `tiers` prop.
|
|
69
|
+
*
|
|
70
|
+
* @returns True when no `tiers` input is set.
|
|
71
|
+
*/
|
|
72
|
+
usingFetched(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The tiers the page renders, from the prop or the fetched response.
|
|
75
|
+
*
|
|
76
|
+
* @returns The tier list, or null while the fetched read has none.
|
|
77
|
+
*/
|
|
78
|
+
tiersList(): PricingTierEntry<unknown>[] | null;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the loading line shows (React's first early return).
|
|
81
|
+
*
|
|
82
|
+
* @returns True while the fetched read is pending with nothing to render.
|
|
83
|
+
*/
|
|
84
|
+
showLoading(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the error line shows (React's second early return).
|
|
87
|
+
*
|
|
88
|
+
* @returns True when the fetched read failed with nothing to render.
|
|
89
|
+
*/
|
|
90
|
+
showError(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* The host's `data-mol-id`, which follows the state React's three returns
|
|
93
|
+
* name.
|
|
94
|
+
*
|
|
95
|
+
* @returns The `data-mol-id` for the current state.
|
|
96
|
+
*/
|
|
97
|
+
molId(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Whether any tier carries a yearly price (the toggle needs one).
|
|
100
|
+
*
|
|
101
|
+
* @returns True when a yearly price exists.
|
|
102
|
+
*/
|
|
103
|
+
hasYearly(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The price a card shows for the page's period, falling back to the tier's first.
|
|
106
|
+
*
|
|
107
|
+
* @param tier - The tier to resolve a price for.
|
|
108
|
+
* @returns The price, or undefined for a tier without any.
|
|
109
|
+
*/
|
|
110
|
+
priceFor(tier: PricingTierEntry<unknown>): PricingTierPrice | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Whether a limits value is an object the default rows can enumerate.
|
|
113
|
+
*
|
|
114
|
+
* @param limits - The tier's limits value.
|
|
115
|
+
* @returns True for a non-null object.
|
|
116
|
+
*/
|
|
117
|
+
isObjectLimits(limits: unknown): limits is Record<string, unknown>;
|
|
118
|
+
/**
|
|
119
|
+
* The entries of a limits object, in insertion order.
|
|
120
|
+
*
|
|
121
|
+
* @param limits - The tier's limits object.
|
|
122
|
+
* @returns Its `[key, value]` pairs.
|
|
123
|
+
*/
|
|
124
|
+
entries(limits: Record<string, unknown>): [string, unknown][];
|
|
125
|
+
/**
|
|
126
|
+
* A default limit row's value: the display string ("✓", "—", "1,000",
|
|
127
|
+
* "∞", etc.), exactly as React's `formatLimitValue` formats it.
|
|
128
|
+
*
|
|
129
|
+
* @param value - The limit's raw value.
|
|
130
|
+
* @returns The display string.
|
|
131
|
+
*/
|
|
132
|
+
limitValue(value: unknown): string;
|
|
133
|
+
/**
|
|
134
|
+
* The template context a `renderLimits` call receives (React passes the
|
|
135
|
+
* tier's limits as its only argument).
|
|
136
|
+
*
|
|
137
|
+
* @param limits - The tier's limits.
|
|
138
|
+
* @returns The `ngTemplateOutlet` context.
|
|
139
|
+
*/
|
|
140
|
+
limitsContext(limits: unknown): {
|
|
141
|
+
$implicit: unknown;
|
|
142
|
+
a0: unknown;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* The card CTA's click handler: React's `onClick={() => price && onCheckout(tier, price)}`.
|
|
146
|
+
*
|
|
147
|
+
* @param tier - The tier whose CTA was clicked.
|
|
148
|
+
*/
|
|
149
|
+
fireCheckout(tier: PricingTierEntry<unknown>): void;
|
|
150
|
+
/**
|
|
151
|
+
* Internal default checkout handler — posts to `/api/billing/checkout`
|
|
152
|
+
* and either navigates to `checkoutUrl` or reloads on in-place update.
|
|
153
|
+
*
|
|
154
|
+
* @param tier - The tier the user selected.
|
|
155
|
+
* @param price - The selected price for that tier.
|
|
156
|
+
*/
|
|
157
|
+
private handleCheckout;
|
|
158
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PricingPage, never>;
|
|
159
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PricingPage, "section[mol-pricing-page]", never, { "tiers": { "alias": "tiers"; "required": false; }; "onCheckout": { "alias": "onCheckout"; "required": false; }; "showPeriodToggle": { "alias": "showPeriodToggle"; "required": false; }; "defaultPeriod": { "alias": "defaultPeriod"; "required": false; }; "renderLimits": { "alias": "renderLimits"; "required": false; }; "headingKey": { "alias": "headingKey"; "required": false; }; "headingDefault": { "alias": "headingDefault"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=pricing-page.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing-page.component.d.ts","sourceRoot":"","sources":["../src/pricing-page.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,KAAK,MAAM,EAAE,KAAK,WAAW,EAA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