@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/LICENSE +202 -0
- package/README.md +538 -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,518 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PricingPage component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component } from '@angular/core';
|
|
8
|
+
import { useTranslation } from '@molecule/app-angular';
|
|
9
|
+
import { usePricingTiers, useStartCheckout, } from '@molecule/app-billing-angular';
|
|
10
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
const _c0 = () => ({ defaultValue: "Loading plans\u2026" });
|
|
13
|
+
const _c1 = () => ({ defaultValue: "Could not load pricing. Try again later." });
|
|
14
|
+
const _c2 = a0 => ({ defaultValue: a0 });
|
|
15
|
+
const _c3 = () => ({ direction: "row", wrap: "wrap", gap: "md", justify: "center" });
|
|
16
|
+
const _c4 = () => ({ direction: "row", gap: "sm", justify: "center" });
|
|
17
|
+
const _c5 = () => ({ defaultValue: "Billing period" });
|
|
18
|
+
const _c6 = a0 => ({ variant: a0, size: "sm" });
|
|
19
|
+
const _c7 = () => ({ defaultValue: "Monthly" });
|
|
20
|
+
const _c8 = () => ({ defaultValue: "Yearly" });
|
|
21
|
+
const _c9 = () => ({ variant: "default" });
|
|
22
|
+
const _c10 = () => ({ variant: "solid", color: "primary", size: "lg", fullWidth: true });
|
|
23
|
+
const _c11 = () => ({ defaultValue: "per seat" });
|
|
24
|
+
const _c12 = a0 => ({ tierName: a0 });
|
|
25
|
+
const _c13 = () => ({ defaultValue: "Upgrade to {{tierName}}" });
|
|
26
|
+
const _c14 = () => ({ defaultValue: "Current plan" });
|
|
27
|
+
const _c15 = () => ({ defaultValue: "Could not start checkout. Please try again." });
|
|
28
|
+
const _forTrack0 = ($index, $item) => $item.key;
|
|
29
|
+
const _forTrack1 = ($index, $item) => $item[0];
|
|
30
|
+
function PricingPage_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
31
|
+
i0.ɵɵelementStart(0, "p");
|
|
32
|
+
i0.ɵɵtext(1);
|
|
33
|
+
i0.ɵɵelementEnd();
|
|
34
|
+
} if (rf & 2) {
|
|
35
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
36
|
+
i0.ɵɵadvance();
|
|
37
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.loading", undefined, i0.ɵɵpureFunction0(1, _c0)));
|
|
38
|
+
} }
|
|
39
|
+
function PricingPage_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
40
|
+
i0.ɵɵelementStart(0, "p", 1);
|
|
41
|
+
i0.ɵɵtext(1);
|
|
42
|
+
i0.ɵɵelementEnd();
|
|
43
|
+
} if (rf & 2) {
|
|
44
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
45
|
+
i0.ɵɵclassMap(ctx_r0.cm.formError);
|
|
46
|
+
i0.ɵɵadvance();
|
|
47
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.error", undefined, i0.ɵɵpureFunction0(3, _c1)));
|
|
48
|
+
} }
|
|
49
|
+
function PricingPage_Conditional_2_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
50
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
51
|
+
i0.ɵɵelementStart(0, "div", 6)(1, "button", 7);
|
|
52
|
+
i0.ɵɵlistener("click", function PricingPage_Conditional_2_Conditional_3_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.period = "month"); });
|
|
53
|
+
i0.ɵɵtext(2);
|
|
54
|
+
i0.ɵɵelementEnd();
|
|
55
|
+
i0.ɵɵelementStart(3, "button", 8);
|
|
56
|
+
i0.ɵɵlistener("click", function PricingPage_Conditional_2_Conditional_3_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.period = "year"); });
|
|
57
|
+
i0.ɵɵtext(4);
|
|
58
|
+
i0.ɵɵelementEnd()();
|
|
59
|
+
} if (rf & 2) {
|
|
60
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
61
|
+
i0.ɵɵclassMap(ctx_r0.cm.flex(i0.ɵɵpureFunction0(11, _c4)));
|
|
62
|
+
i0.ɵɵattribute("aria-label", ctx_r0.t("pricingPage.periodToggle.label", undefined, i0.ɵɵpureFunction0(12, _c5)));
|
|
63
|
+
i0.ɵɵadvance();
|
|
64
|
+
i0.ɵɵclassMap(ctx_r0.cm.button(i0.ɵɵpureFunction1(13, _c6, ctx_r0.period === "month" ? "solid" : "outline")));
|
|
65
|
+
i0.ɵɵattribute("aria-selected", ctx_r0.period === "month");
|
|
66
|
+
i0.ɵɵadvance();
|
|
67
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.periodToggle.monthly", undefined, i0.ɵɵpureFunction0(15, _c7)));
|
|
68
|
+
i0.ɵɵadvance();
|
|
69
|
+
i0.ɵɵclassMap(ctx_r0.cm.button(i0.ɵɵpureFunction1(16, _c6, ctx_r0.period === "year" ? "solid" : "outline")));
|
|
70
|
+
i0.ɵɵattribute("aria-selected", ctx_r0.period === "year");
|
|
71
|
+
i0.ɵɵadvance();
|
|
72
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.periodToggle.yearly", undefined, i0.ɵɵpureFunction0(18, _c8)));
|
|
73
|
+
} }
|
|
74
|
+
function PricingPage_Conditional_2_For_6_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
75
|
+
i0.ɵɵelementStart(0, "span");
|
|
76
|
+
i0.ɵɵtext(1);
|
|
77
|
+
i0.ɵɵelementEnd();
|
|
78
|
+
} if (rf & 2) {
|
|
79
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
80
|
+
i0.ɵɵadvance();
|
|
81
|
+
i0.ɵɵtextInterpolate(" " + ctx_r0.t("pricingPage.perSeat", undefined, i0.ɵɵpureFunction0(1, _c11)));
|
|
82
|
+
} }
|
|
83
|
+
function PricingPage_Conditional_2_For_6_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
84
|
+
i0.ɵɵelementStart(0, "p");
|
|
85
|
+
i0.ɵɵtext(1);
|
|
86
|
+
i0.ɵɵelementEnd();
|
|
87
|
+
} if (rf & 2) {
|
|
88
|
+
const tier_r4 = i0.ɵɵnextContext().$implicit;
|
|
89
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
90
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardDescription);
|
|
91
|
+
i0.ɵɵadvance();
|
|
92
|
+
i0.ɵɵtextInterpolate(ctx_r0.priceFor(tier_r4)?.savings);
|
|
93
|
+
} }
|
|
94
|
+
function PricingPage_Conditional_2_For_6_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
95
|
+
i0.ɵɵelementContainer(0, 9);
|
|
96
|
+
} if (rf & 2) {
|
|
97
|
+
const tier_r4 = i0.ɵɵnextContext().$implicit;
|
|
98
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
99
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.renderLimits)("ngTemplateOutletContext", ctx_r0.limitsContext(tier_r4.limits));
|
|
100
|
+
} }
|
|
101
|
+
function PricingPage_Conditional_2_For_6_Conditional_10_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
102
|
+
i0.ɵɵelementStart(0, "div")(1, "dt");
|
|
103
|
+
i0.ɵɵtext(2);
|
|
104
|
+
i0.ɵɵelementEnd();
|
|
105
|
+
i0.ɵɵelementStart(3, "dd");
|
|
106
|
+
i0.ɵɵtext(4);
|
|
107
|
+
i0.ɵɵelementEnd()();
|
|
108
|
+
} if (rf & 2) {
|
|
109
|
+
const entry_r5 = ctx.$implicit;
|
|
110
|
+
const ctx_r0 = i0.ɵɵnextContext(4);
|
|
111
|
+
i0.ɵɵadvance(2);
|
|
112
|
+
i0.ɵɵtextInterpolate(entry_r5[0]);
|
|
113
|
+
i0.ɵɵadvance(2);
|
|
114
|
+
i0.ɵɵtextInterpolate(ctx_r0.limitValue(entry_r5[1]));
|
|
115
|
+
} }
|
|
116
|
+
function PricingPage_Conditional_2_For_6_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
117
|
+
i0.ɵɵelementStart(0, "dl");
|
|
118
|
+
i0.ɵɵrepeaterCreate(1, PricingPage_Conditional_2_For_6_Conditional_10_For_2_Template, 5, 2, "div", null, _forTrack1);
|
|
119
|
+
i0.ɵɵelementEnd();
|
|
120
|
+
} if (rf & 2) {
|
|
121
|
+
const tier_r4 = i0.ɵɵnextContext().$implicit;
|
|
122
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
123
|
+
i0.ɵɵadvance();
|
|
124
|
+
i0.ɵɵrepeater(ctx_r0.entries(tier_r4.limits));
|
|
125
|
+
} }
|
|
126
|
+
function PricingPage_Conditional_2_For_6_Conditional_13_Template(rf, ctx) { if (rf & 1) {
|
|
127
|
+
i0.ɵɵtext(0);
|
|
128
|
+
} if (rf & 2) {
|
|
129
|
+
const tier_r4 = i0.ɵɵnextContext().$implicit;
|
|
130
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
131
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.upgradeCta", i0.ɵɵpureFunction1(1, _c12, tier_r4.name), i0.ɵɵpureFunction0(3, _c13)));
|
|
132
|
+
} }
|
|
133
|
+
function PricingPage_Conditional_2_For_6_Conditional_14_Template(rf, ctx) { if (rf & 1) {
|
|
134
|
+
i0.ɵɵtext(0);
|
|
135
|
+
} if (rf & 2) {
|
|
136
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
137
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.currentCta", undefined, i0.ɵɵpureFunction0(1, _c14)));
|
|
138
|
+
} }
|
|
139
|
+
function PricingPage_Conditional_2_For_6_Template(rf, ctx) { if (rf & 1) {
|
|
140
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
141
|
+
i0.ɵɵelementStart(0, "article")(1, "header")(2, "h2");
|
|
142
|
+
i0.ɵɵtext(3);
|
|
143
|
+
i0.ɵɵelementEnd();
|
|
144
|
+
i0.ɵɵelementStart(4, "p");
|
|
145
|
+
i0.ɵɵtext(5);
|
|
146
|
+
i0.ɵɵconditionalCreate(6, PricingPage_Conditional_2_For_6_Conditional_6_Template, 2, 2, "span");
|
|
147
|
+
i0.ɵɵelementEnd();
|
|
148
|
+
i0.ɵɵconditionalCreate(7, PricingPage_Conditional_2_For_6_Conditional_7_Template, 2, 3, "p", 4);
|
|
149
|
+
i0.ɵɵelementEnd();
|
|
150
|
+
i0.ɵɵelementStart(8, "div");
|
|
151
|
+
i0.ɵɵconditionalCreate(9, PricingPage_Conditional_2_For_6_Conditional_9_Template, 1, 2, "ng-container", 9)(10, PricingPage_Conditional_2_For_6_Conditional_10_Template, 3, 0, "dl");
|
|
152
|
+
i0.ɵɵelementEnd();
|
|
153
|
+
i0.ɵɵelementStart(11, "footer")(12, "button", 10);
|
|
154
|
+
i0.ɵɵlistener("click", function PricingPage_Conditional_2_For_6_Template_button_click_12_listener() { const tier_r4 = i0.ɵɵrestoreView(_r3).$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.fireCheckout(tier_r4)); });
|
|
155
|
+
i0.ɵɵconditionalCreate(13, PricingPage_Conditional_2_For_6_Conditional_13_Template, 1, 4)(14, PricingPage_Conditional_2_For_6_Conditional_14_Template, 1, 2);
|
|
156
|
+
i0.ɵɵelementEnd()()();
|
|
157
|
+
} if (rf & 2) {
|
|
158
|
+
const tier_r4 = ctx.$implicit;
|
|
159
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
160
|
+
i0.ɵɵclassMap(ctx_r0.cm.card(i0.ɵɵpureFunction0(23, _c9)));
|
|
161
|
+
i0.ɵɵattribute("data-mol-id", "pricing-page-tier-" + tier_r4.key);
|
|
162
|
+
i0.ɵɵadvance();
|
|
163
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardHeader);
|
|
164
|
+
i0.ɵɵadvance();
|
|
165
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardTitle);
|
|
166
|
+
i0.ɵɵadvance();
|
|
167
|
+
i0.ɵɵtextInterpolate(tier_r4.name);
|
|
168
|
+
i0.ɵɵadvance();
|
|
169
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardDescription);
|
|
170
|
+
i0.ɵɵadvance();
|
|
171
|
+
i0.ɵɵtextInterpolate(ctx_r0.priceFor(tier_r4)?.price ?? "\u2014");
|
|
172
|
+
i0.ɵɵadvance();
|
|
173
|
+
i0.ɵɵconditional(tier_r4.perSeat ? 6 : -1);
|
|
174
|
+
i0.ɵɵadvance();
|
|
175
|
+
i0.ɵɵconditional(ctx_r0.priceFor(tier_r4)?.savings ? 7 : -1);
|
|
176
|
+
i0.ɵɵadvance();
|
|
177
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardContent);
|
|
178
|
+
i0.ɵɵadvance();
|
|
179
|
+
i0.ɵɵconditional(ctx_r0.renderLimits ? 9 : ctx_r0.isObjectLimits(tier_r4.limits) ? 10 : -1);
|
|
180
|
+
i0.ɵɵadvance(2);
|
|
181
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardFooter);
|
|
182
|
+
i0.ɵɵadvance();
|
|
183
|
+
i0.ɵɵclassMap(ctx_r0.cm.cn(ctx_r0.cm.button(i0.ɵɵpureFunction0(24, _c10)), ctx_r0.cm.touchTargetCompact));
|
|
184
|
+
i0.ɵɵproperty("disabled", !ctx_r0.priceFor(tier_r4)?.stripePriceId || ctx_r0.startState.loading());
|
|
185
|
+
i0.ɵɵattribute("data-mol-id", "pricing-page-cta-" + tier_r4.key);
|
|
186
|
+
i0.ɵɵadvance();
|
|
187
|
+
i0.ɵɵconditional(ctx_r0.priceFor(tier_r4)?.stripePriceId ? 13 : 14);
|
|
188
|
+
} }
|
|
189
|
+
function PricingPage_Conditional_2_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
190
|
+
i0.ɵɵelementStart(0, "p", 11);
|
|
191
|
+
i0.ɵɵtext(1);
|
|
192
|
+
i0.ɵɵelementEnd();
|
|
193
|
+
} if (rf & 2) {
|
|
194
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
195
|
+
i0.ɵɵclassMap(ctx_r0.cm.formError);
|
|
196
|
+
i0.ɵɵadvance();
|
|
197
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("pricingPage.checkoutError", undefined, i0.ɵɵpureFunction0(3, _c15)));
|
|
198
|
+
} }
|
|
199
|
+
function PricingPage_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
200
|
+
i0.ɵɵelementStart(0, "header")(1, "h1");
|
|
201
|
+
i0.ɵɵtext(2);
|
|
202
|
+
i0.ɵɵelementEnd()();
|
|
203
|
+
i0.ɵɵconditionalCreate(3, PricingPage_Conditional_2_Conditional_3_Template, 5, 19, "div", 2);
|
|
204
|
+
i0.ɵɵelementStart(4, "div", 3);
|
|
205
|
+
i0.ɵɵrepeaterCreate(5, PricingPage_Conditional_2_For_6_Template, 15, 25, "article", 4, _forTrack0);
|
|
206
|
+
i0.ɵɵelementEnd();
|
|
207
|
+
i0.ɵɵconditionalCreate(7, PricingPage_Conditional_2_Conditional_7_Template, 2, 4, "p", 5);
|
|
208
|
+
} if (rf & 2) {
|
|
209
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
210
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardHeader);
|
|
211
|
+
i0.ɵɵadvance();
|
|
212
|
+
i0.ɵɵclassMap(ctx_r0.cm.cardTitle);
|
|
213
|
+
i0.ɵɵadvance();
|
|
214
|
+
i0.ɵɵtextInterpolate(ctx_r0.t(ctx_r0.headingKey ?? "pricingPage.heading", undefined, i0.ɵɵpureFunction1(9, _c2, ctx_r0.headingDefault ?? "Choose your plan")));
|
|
215
|
+
i0.ɵɵadvance();
|
|
216
|
+
i0.ɵɵconditional(ctx_r0.showPeriodToggle !== false && ctx_r0.hasYearly() ? 3 : -1);
|
|
217
|
+
i0.ɵɵadvance();
|
|
218
|
+
i0.ɵɵclassMap(ctx_r0.cm.flex(i0.ɵɵpureFunction0(11, _c3)));
|
|
219
|
+
i0.ɵɵadvance();
|
|
220
|
+
i0.ɵɵrepeater(ctx_r0.tiersList());
|
|
221
|
+
i0.ɵɵadvance(2);
|
|
222
|
+
i0.ɵɵconditional(ctx_r0.startState.error() ? 7 : -1);
|
|
223
|
+
} }
|
|
224
|
+
/**
|
|
225
|
+
* PricingPage component.
|
|
226
|
+
*
|
|
227
|
+
* Drop-in pricing page: one card per tier from `tiers` (or
|
|
228
|
+
* `usePricingTiers()` when not supplied), with an optional monthly/yearly
|
|
229
|
+
* toggle and a Stripe Checkout CTA per card. The host IS the outer
|
|
230
|
+
* `<section>` React renders, so its class list and state-dependent
|
|
231
|
+
* `data-mol-id` are host bindings. The `renderLimits` render function
|
|
232
|
+
* arrives as a template (its context carries the tier's limits as
|
|
233
|
+
* `$implicit` and `a0`).
|
|
234
|
+
*
|
|
235
|
+
* This is the Angular counterpart of `@molecule/app-pricing-page-react`'s
|
|
236
|
+
* `PricingPage`.
|
|
237
|
+
*/
|
|
238
|
+
export class PricingPage {
|
|
239
|
+
/**
|
|
240
|
+
* Optional pre-fetched tiers. When omitted the component fetches them
|
|
241
|
+
* via `usePricingTiers()` (which calls `GET /api/billing/tiers`).
|
|
242
|
+
*/
|
|
243
|
+
tiers;
|
|
244
|
+
/**
|
|
245
|
+
* Optional override for the checkout handler. The default posts to
|
|
246
|
+
* `/api/billing/checkout` via `useStartCheckout()` and redirects the
|
|
247
|
+
* browser to the returned `checkoutUrl`.
|
|
248
|
+
*/
|
|
249
|
+
onCheckout;
|
|
250
|
+
/** When true (default), renders a monthly/yearly toggle. */
|
|
251
|
+
showPeriodToggle;
|
|
252
|
+
/** Default billing period for the toggle. Defaults to `'month'`. */
|
|
253
|
+
defaultPeriod;
|
|
254
|
+
/**
|
|
255
|
+
* Optional template for the tier-specific limits block (React's
|
|
256
|
+
* `renderLimits`; its context carries the tier's limits as `$implicit`
|
|
257
|
+
* and `a0`).
|
|
258
|
+
*/
|
|
259
|
+
renderLimits;
|
|
260
|
+
/** Optional translation key for the page heading. */
|
|
261
|
+
headingKey;
|
|
262
|
+
/** Optional English fallback for the heading. */
|
|
263
|
+
headingDefault;
|
|
264
|
+
/** Optional className applied to the outer wrapper (the host element). */
|
|
265
|
+
className;
|
|
266
|
+
/** The i18n handle (locale-reactive), read in an injection context. */
|
|
267
|
+
i18n = useTranslation();
|
|
268
|
+
/** The translation function for the template. */
|
|
269
|
+
t = this.i18n.t;
|
|
270
|
+
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
271
|
+
cm = getClassMap();
|
|
272
|
+
/** The public tier list (`GET /api/billing/tiers`, fired on mount). */
|
|
273
|
+
tiersState = usePricingTiers();
|
|
274
|
+
/** The checkout action and its async state. */
|
|
275
|
+
startState = useStartCheckout();
|
|
276
|
+
/** The mounted billing period (React's `useState(defaultPeriod)` initial). */
|
|
277
|
+
period = 'month';
|
|
278
|
+
/**
|
|
279
|
+
* Reads the initial period from the `defaultPeriod` input, which Angular
|
|
280
|
+
* assigns before `ngOnInit` (React reads it once at mount).
|
|
281
|
+
*/
|
|
282
|
+
ngOnInit() {
|
|
283
|
+
this.period = this.defaultPeriod ?? 'month';
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Whether the page reads the fetched tiers rather than the `tiers` prop.
|
|
287
|
+
*
|
|
288
|
+
* @returns True when no `tiers` input is set.
|
|
289
|
+
*/
|
|
290
|
+
usingFetched() {
|
|
291
|
+
return this.tiers === undefined;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The tiers the page renders, from the prop or the fetched response.
|
|
295
|
+
*
|
|
296
|
+
* @returns The tier list, or null while the fetched read has none.
|
|
297
|
+
*/
|
|
298
|
+
tiersList() {
|
|
299
|
+
return this.tiers ?? this.tiersState.data()?.data ?? null;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Whether the loading line shows (React's first early return).
|
|
303
|
+
*
|
|
304
|
+
* @returns True while the fetched read is pending with nothing to render.
|
|
305
|
+
*/
|
|
306
|
+
showLoading() {
|
|
307
|
+
return this.usingFetched() && this.tiersState.loading() && !this.tiersList();
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Whether the error line shows (React's second early return).
|
|
311
|
+
*
|
|
312
|
+
* @returns True when the fetched read failed with nothing to render.
|
|
313
|
+
*/
|
|
314
|
+
showError() {
|
|
315
|
+
return this.usingFetched() && (this.tiersState.error() != null || !this.tiersList());
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* The host's `data-mol-id`, which follows the state React's three returns
|
|
319
|
+
* name.
|
|
320
|
+
*
|
|
321
|
+
* @returns The `data-mol-id` for the current state.
|
|
322
|
+
*/
|
|
323
|
+
molId() {
|
|
324
|
+
if (this.showLoading())
|
|
325
|
+
return 'pricing-page-loading';
|
|
326
|
+
if (this.showError())
|
|
327
|
+
return 'pricing-page-error';
|
|
328
|
+
return 'pricing-page';
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Whether any tier carries a yearly price (the toggle needs one).
|
|
332
|
+
*
|
|
333
|
+
* @returns True when a yearly price exists.
|
|
334
|
+
*/
|
|
335
|
+
hasYearly() {
|
|
336
|
+
return (this.tiersList() ?? []).some((tier) => tier.prices.some((p) => p.period === 'year'));
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The price a card shows for the page's period, falling back to the tier's first.
|
|
340
|
+
*
|
|
341
|
+
* @param tier - The tier to resolve a price for.
|
|
342
|
+
* @returns The price, or undefined for a tier without any.
|
|
343
|
+
*/
|
|
344
|
+
priceFor(tier) {
|
|
345
|
+
return tier.prices.find((p) => p.period === this.period) ?? tier.prices[0];
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Whether a limits value is an object the default rows can enumerate.
|
|
349
|
+
*
|
|
350
|
+
* @param limits - The tier's limits value.
|
|
351
|
+
* @returns True for a non-null object.
|
|
352
|
+
*/
|
|
353
|
+
isObjectLimits(limits) {
|
|
354
|
+
return limits != null && typeof limits === 'object';
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* The entries of a limits object, in insertion order.
|
|
358
|
+
*
|
|
359
|
+
* @param limits - The tier's limits object.
|
|
360
|
+
* @returns Its `[key, value]` pairs.
|
|
361
|
+
*/
|
|
362
|
+
entries(limits) {
|
|
363
|
+
return Object.entries(limits);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* A default limit row's value: the display string ("✓", "—", "1,000",
|
|
367
|
+
* "∞", etc.), exactly as React's `formatLimitValue` formats it.
|
|
368
|
+
*
|
|
369
|
+
* @param value - The limit's raw value.
|
|
370
|
+
* @returns The display string.
|
|
371
|
+
*/
|
|
372
|
+
limitValue(value) {
|
|
373
|
+
if (typeof value === 'boolean')
|
|
374
|
+
return value ? '✓' : '—';
|
|
375
|
+
if (typeof value === 'number') {
|
|
376
|
+
if (value >= 999_999)
|
|
377
|
+
return '∞';
|
|
378
|
+
return value.toLocaleString();
|
|
379
|
+
}
|
|
380
|
+
if (value == null)
|
|
381
|
+
return '—';
|
|
382
|
+
if (typeof value === 'string')
|
|
383
|
+
return value;
|
|
384
|
+
try {
|
|
385
|
+
return JSON.stringify(value);
|
|
386
|
+
}
|
|
387
|
+
catch (_error) {
|
|
388
|
+
// JSON.stringify only throws for circular references or BigInt — fall back to String()
|
|
389
|
+
return String(value);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* The template context a `renderLimits` call receives (React passes the
|
|
394
|
+
* tier's limits as its only argument).
|
|
395
|
+
*
|
|
396
|
+
* @param limits - The tier's limits.
|
|
397
|
+
* @returns The `ngTemplateOutlet` context.
|
|
398
|
+
*/
|
|
399
|
+
limitsContext(limits) {
|
|
400
|
+
return { $implicit: limits, a0: limits };
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* The card CTA's click handler: React's `onClick={() => price && onCheckout(tier, price)}`.
|
|
404
|
+
*
|
|
405
|
+
* @param tier - The tier whose CTA was clicked.
|
|
406
|
+
*/
|
|
407
|
+
fireCheckout(tier) {
|
|
408
|
+
const price = this.priceFor(tier);
|
|
409
|
+
if (price)
|
|
410
|
+
void this.handleCheckout(tier, price);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Internal default checkout handler — posts to `/api/billing/checkout`
|
|
414
|
+
* and either navigates to `checkoutUrl` or reloads on in-place update.
|
|
415
|
+
*
|
|
416
|
+
* @param tier - The tier the user selected.
|
|
417
|
+
* @param price - The selected price for that tier.
|
|
418
|
+
*/
|
|
419
|
+
async handleCheckout(tier, price) {
|
|
420
|
+
if (!price.stripePriceId)
|
|
421
|
+
return;
|
|
422
|
+
if (this.onCheckout) {
|
|
423
|
+
await this.onCheckout(tier, price);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const response = await this.startState.start(price.stripePriceId);
|
|
427
|
+
if (response?.checkoutUrl && typeof window !== 'undefined') {
|
|
428
|
+
window.location.assign(response.checkoutUrl);
|
|
429
|
+
}
|
|
430
|
+
else if (response?.updated && typeof window !== 'undefined') {
|
|
431
|
+
window.location.reload();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
static ɵfac = function PricingPage_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PricingPage)(); };
|
|
435
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PricingPage, selectors: [["section", "mol-pricing-page", ""]], hostVars: 3, hostBindings: function PricingPage_HostBindings(rf, ctx) { if (rf & 2) {
|
|
436
|
+
i0.ɵɵattribute("data-mol-id", ctx.molId());
|
|
437
|
+
i0.ɵɵclassMap(ctx.className ?? null);
|
|
438
|
+
} }, inputs: { tiers: "tiers", onCheckout: "onCheckout", showPeriodToggle: "showPeriodToggle", defaultPeriod: "defaultPeriod", renderLimits: "renderLimits", headingKey: "headingKey", headingDefault: "headingDefault", className: "className" }, decls: 3, vars: 1, consts: [["role", "alert", 3, "class"], ["role", "alert"], ["data-mol-id", "pricing-page-period-toggle", "role", "tablist", 3, "class"], ["data-mol-id", "pricing-page-grid"], [3, "class"], ["role", "alert", "data-mol-id", "pricing-page-checkout-error", 3, "class"], ["data-mol-id", "pricing-page-period-toggle", "role", "tablist"], ["type", "button", "role", "tab", "data-mol-id", "pricing-page-period-month", 3, "click"], ["type", "button", "role", "tab", "data-mol-id", "pricing-page-period-year", 3, "click"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], ["type", "button", 3, "click", "disabled"], ["role", "alert", "data-mol-id", "pricing-page-checkout-error"]], template: function PricingPage_Template(rf, ctx) { if (rf & 1) {
|
|
439
|
+
i0.ɵɵconditionalCreate(0, PricingPage_Conditional_0_Template, 2, 2, "p")(1, PricingPage_Conditional_1_Template, 2, 4, "p", 0)(2, PricingPage_Conditional_2_Template, 8, 12);
|
|
440
|
+
} if (rf & 2) {
|
|
441
|
+
i0.ɵɵconditional(ctx.showLoading() ? 0 : ctx.showError() ? 1 : 2);
|
|
442
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
443
|
+
}
|
|
444
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PricingPage, [{
|
|
445
|
+
type: Component,
|
|
446
|
+
args: [{
|
|
447
|
+
selector: 'section[mol-pricing-page]',
|
|
448
|
+
standalone: true,
|
|
449
|
+
imports: [NgTemplateOutlet],
|
|
450
|
+
inputs: [
|
|
451
|
+
'tiers',
|
|
452
|
+
'onCheckout',
|
|
453
|
+
'showPeriodToggle',
|
|
454
|
+
'defaultPeriod',
|
|
455
|
+
'renderLimits',
|
|
456
|
+
'headingKey',
|
|
457
|
+
'headingDefault',
|
|
458
|
+
'className',
|
|
459
|
+
],
|
|
460
|
+
host: {
|
|
461
|
+
'[class]': 'className ?? null',
|
|
462
|
+
'[attr.data-mol-id]': 'molId()',
|
|
463
|
+
},
|
|
464
|
+
// prettier-ignore
|
|
465
|
+
template: `
|
|
466
|
+
@if (showLoading()) {
|
|
467
|
+
<p>{{ t('pricingPage.loading', undefined, { defaultValue: 'Loading plans…' }) }}</p>
|
|
468
|
+
} @else if (showError()) {
|
|
469
|
+
<p [class]="cm.formError" role="alert">{{ t('pricingPage.error', undefined, { defaultValue: 'Could not load pricing. Try again later.' }) }}</p>
|
|
470
|
+
} @else {
|
|
471
|
+
<header [class]="cm.cardHeader">
|
|
472
|
+
<h1 [class]="cm.cardTitle">{{ t(headingKey ?? 'pricingPage.heading', undefined, { defaultValue: headingDefault ?? 'Choose your plan' }) }}</h1>
|
|
473
|
+
</header>
|
|
474
|
+
@if (showPeriodToggle !== false && hasYearly()) {
|
|
475
|
+
<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' })">
|
|
476
|
+
<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>
|
|
477
|
+
<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>
|
|
478
|
+
</div>
|
|
479
|
+
}
|
|
480
|
+
<div [class]="cm.flex({ direction: 'row', wrap: 'wrap', gap: 'md', justify: 'center' })" data-mol-id="pricing-page-grid">
|
|
481
|
+
@for (tier of tiersList(); track tier.key) {
|
|
482
|
+
<article [class]="cm.card({ variant: 'default' })" [attr.data-mol-id]="'pricing-page-tier-' + tier.key">
|
|
483
|
+
<header [class]="cm.cardHeader">
|
|
484
|
+
<h2 [class]="cm.cardTitle">{{ tier.name }}</h2>
|
|
485
|
+
<p [class]="cm.cardDescription">{{ priceFor(tier)?.price ?? '—' }}@if (tier.perSeat) {<span>{{ ' ' + t('pricingPage.perSeat', undefined, { defaultValue: 'per seat' }) }}</span>}</p>
|
|
486
|
+
@if (priceFor(tier)?.savings) {
|
|
487
|
+
<p [class]="cm.cardDescription">{{ priceFor(tier)?.savings }}</p>
|
|
488
|
+
}
|
|
489
|
+
</header>
|
|
490
|
+
<div [class]="cm.cardContent">
|
|
491
|
+
@if (renderLimits) {
|
|
492
|
+
<ng-container [ngTemplateOutlet]="renderLimits" [ngTemplateOutletContext]="limitsContext(tier.limits)" />
|
|
493
|
+
} @else if (isObjectLimits(tier.limits)) {
|
|
494
|
+
<dl>
|
|
495
|
+
@for (entry of entries(tier.limits); track entry[0]) {
|
|
496
|
+
<div>
|
|
497
|
+
<dt>{{ entry[0] }}</dt>
|
|
498
|
+
<dd>{{ limitValue(entry[1]) }}</dd>
|
|
499
|
+
</div>
|
|
500
|
+
}
|
|
501
|
+
</dl>
|
|
502
|
+
}
|
|
503
|
+
</div>
|
|
504
|
+
<footer [class]="cm.cardFooter">
|
|
505
|
+
<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>
|
|
506
|
+
</footer>
|
|
507
|
+
</article>
|
|
508
|
+
}
|
|
509
|
+
</div>
|
|
510
|
+
@if (startState.error()) {
|
|
511
|
+
<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>
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
`,
|
|
515
|
+
}]
|
|
516
|
+
}], null, null); })();
|
|
517
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PricingPage, { className: "PricingPage", filePath: "pricing-page.component.ts", lineNumber: 106 }); })();
|
|
518
|
+
//# sourceMappingURL=pricing-page.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing-page.component.js","sourceRoot":"","sources":["../src/pricing-page.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAiC,MAAM,eAAe,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAGL,eAAe,EACf,gBAAgB,GACjB,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,AAFF,wEAAqB,qDAEK,8CAEjB;;YAJT,iEA+CC;4BAhEO,gBAAgB;;iFAmEf,WAAW;cAtEvB,SAAS;eAAC;gBACT,QAAQ,EAAE,2BAA2B;gBACrC,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE;oBACN,OAAO;oBACP,YAAY;oBACZ,kBAAkB;oBAClB,eAAe;oBACf,cAAc;oBACd,YAAY;oBACZ,gBAAgB;oBAChB,WAAW;iBACZ;gBACD,IAAI,EAAE;oBACJ,SAAS,EAAE,mBAAmB;oBAC9B,oBAAoB,EAAE,SAAS;iBAChC;gBACD,kBAAkB;gBAClB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDT;aACF;;kFACY,WAAW"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Angular pricing page — the same shapes (React prop names) as
|
|
3
|
+
* `@molecule/app-pricing-page-react`, with Angular's types where React takes
|
|
4
|
+
* a `ReactNode`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { TemplateRef } from '@angular/core';
|
|
9
|
+
import type { PricingTierEntry, PricingTierPrice } from '@molecule/app-billing-angular';
|
|
10
|
+
/**
|
|
11
|
+
* Billing period selector — currently `'month'` or `'year'`. Mirrors the
|
|
12
|
+
* upstream `PricingTierPrice['period']` literal for type-safety.
|
|
13
|
+
*/
|
|
14
|
+
export type PricingPagePeriod = PricingTierPrice['period'];
|
|
15
|
+
/** Props for `<PricingPage />` (the component's inputs). */
|
|
16
|
+
export interface PricingPageProps<TLimits = unknown> {
|
|
17
|
+
/**
|
|
18
|
+
* Optional pre-fetched tiers. When omitted the component fetches them
|
|
19
|
+
* via `usePricingTiers()` (which calls `GET /api/billing/tiers`).
|
|
20
|
+
*/
|
|
21
|
+
tiers?: PricingTierEntry<TLimits>[];
|
|
22
|
+
/**
|
|
23
|
+
* Optional override for the checkout handler. The default posts to
|
|
24
|
+
* `/api/billing/checkout` via `useStartCheckout()` and redirects the
|
|
25
|
+
* browser to the returned `checkoutUrl`. Custom apps can pass a
|
|
26
|
+
* function that performs Stripe checkout via a different transport,
|
|
27
|
+
* navigates within a router, etc.
|
|
28
|
+
*/
|
|
29
|
+
onCheckout?: (tier: PricingTierEntry<TLimits>, price: PricingTierPrice) => void | Promise<void>;
|
|
30
|
+
/** When true (default), renders a monthly/yearly toggle. */
|
|
31
|
+
showPeriodToggle?: boolean;
|
|
32
|
+
/** Default billing period for the toggle. Defaults to `'month'`. */
|
|
33
|
+
defaultPeriod?: PricingPagePeriod;
|
|
34
|
+
/**
|
|
35
|
+
* Optional template for the tier-specific limits block (React's
|
|
36
|
+
* `renderLimits` render function; its context carries the tier's limits
|
|
37
|
+
* as `$implicit` and `a0`). When omitted, `limits` are rendered as a
|
|
38
|
+
* `<dl>` of key-value pairs.
|
|
39
|
+
*/
|
|
40
|
+
renderLimits?: TemplateRef<TLimits> | null;
|
|
41
|
+
/**
|
|
42
|
+
* Optional translation key for the page heading. Defaults to
|
|
43
|
+
* `'pricingPage.heading'`.
|
|
44
|
+
*/
|
|
45
|
+
headingKey?: string;
|
|
46
|
+
/** Optional English fallback for the heading. */
|
|
47
|
+
headingDefault?: string;
|
|
48
|
+
/** Optional className applied to the outer wrapper (the host element). */
|
|
49
|
+
className?: string;
|
|
50
|
+
}
|
|
51
|
+
/** Props for `<PlanUpdatedPage />` (the component's inputs). */
|
|
52
|
+
export interface PlanUpdatedPageProps {
|
|
53
|
+
/**
|
|
54
|
+
* Optional new plan name to include in the heading (e.g. `'Pro'`).
|
|
55
|
+
* When omitted, a generic heading is rendered.
|
|
56
|
+
*/
|
|
57
|
+
planName?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Optional CTA label / target. Renders a primary button when both
|
|
60
|
+
* `ctaLabel` and one of `onCta` / `ctaHref` are supplied. A typical
|
|
61
|
+
* use is "Continue to dashboard". A string input renders as text;
|
|
62
|
+
* `[slot=ctaLabel]` projected content renders in its place.
|
|
63
|
+
*/
|
|
64
|
+
ctaLabel?: string;
|
|
65
|
+
/** Click handler for the CTA. Mutually exclusive with `ctaHref`. */
|
|
66
|
+
onCta?: (event: unknown) => void;
|
|
67
|
+
/** Anchor target for the CTA. Mutually exclusive with `onCta`. */
|
|
68
|
+
ctaHref?: string;
|
|
69
|
+
/** Optional className applied to the outer wrapper (the host element). */
|
|
70
|
+
className?: string;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEvF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AAE1D,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB,CAAC,OAAO,GAAG,OAAO;IACjD;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAA;IAEnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/F,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAE1B,oEAAoE;IACpE,aAAa,CAAC,EAAE,iBAAiB,CAAA;IAEjC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAE1C;;;OAGG;IACH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