@molecule/app-settings-panel-angular 2.0.2 → 3.0.1
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 +130 -96
- package/dist/auth-section.component.d.ts +24 -7
- package/dist/auth-section.component.d.ts.map +1 -1
- package/dist/auth-section.component.js +144 -105
- package/dist/auth-section.component.js.map +1 -1
- package/dist/billing-section.component.d.ts +10 -7
- package/dist/billing-section.component.d.ts.map +1 -1
- package/dist/billing-section.component.js +38 -23
- package/dist/billing-section.component.js.map +1 -1
- package/dist/tiers-upgrade-section.component.d.ts +26 -15
- package/dist/tiers-upgrade-section.component.d.ts.map +1 -1
- package/dist/tiers-upgrade-section.component.js +167 -132
- package/dist/tiers-upgrade-section.component.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-24T16:37:01.091Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-settings-panel-angular
|
|
@@ -217,6 +217,21 @@ interface Device {
|
|
|
217
217
|
}
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
+
#### `AuthSectionProps`
|
|
221
|
+
|
|
222
|
+
Props for `AuthSection`. Same name and meaning as the React component's.
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
interface AuthSectionProps {
|
|
226
|
+
/**
|
|
227
|
+
* Show the two-factor row. Set false when the API has no two-factor provider
|
|
228
|
+
* (no `POST /users/:id/verify-two-factor` route). Default true. Bound in a template as
|
|
229
|
+
* `[twoFactor]="false"`.
|
|
230
|
+
*/
|
|
231
|
+
twoFactor?: boolean
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
220
235
|
#### `TiersUpgradeSectionProps`
|
|
221
236
|
|
|
222
237
|
Props for `TiersUpgradeSection` — the same props
|
|
@@ -644,8 +659,9 @@ Two-factor uses the real enrollment flow against the user resource's
|
|
|
644
659
|
handler deliberately ignores — so it never actually enrolled 2FA.)
|
|
645
660
|
|
|
646
661
|
Auto-hides for OAuth-only users (`user.oauthServer` truthy) since
|
|
647
|
-
password / 2FA wouldn't apply.
|
|
648
|
-
provider
|
|
662
|
+
password / 2FA wouldn't apply. Pass `[twoFactor]="false"` when the app's API
|
|
663
|
+
has no two-factor provider: it then serves no `verify-two-factor` route, so
|
|
664
|
+
the section shows only the password change and reads no 2FA status.
|
|
649
665
|
|
|
650
666
|
`useChangePassword`'s state is a live getter over a plain object (the
|
|
651
667
|
Angular binding's `usePromise` port), so the pending/error reads are
|
|
@@ -670,6 +686,7 @@ mediated by a version signal the handlers bump at React's re-render points.
|
|
|
670
686
|
>
|
|
671
687
|
{{ t('settings.changePassword', undefined, { defaultValue: 'Change password' }) }}
|
|
672
688
|
</button>
|
|
689
|
+
@if (showTwoFactor()) {
|
|
673
690
|
<div mol-flex [align]="'center'" [justify]="'between'">
|
|
674
691
|
<span [class]="cm.textSize('sm')">{{ t('settings.twoFactor', undefined, { defaultValue: 'Two-factor authentication' }) }}@if (twoFactorEnabled()) {<span [class]="cm.cn(cm.textSize('xs'), cm.textSubtle, cm.sp('ml', 2))">{{ t('settings.twoFactorOn', undefined, { defaultValue: 'On' }) }}</span>}</span>
|
|
675
692
|
@if (twoFactorEnabled()) {
|
|
@@ -694,6 +711,7 @@ mediated by a version signal the handlers bump at React's re-render points.
|
|
|
694
711
|
</button>
|
|
695
712
|
}
|
|
696
713
|
</div>
|
|
714
|
+
}
|
|
697
715
|
</div>
|
|
698
716
|
</section>
|
|
699
717
|
<mol-modal
|
|
@@ -750,6 +768,7 @@ mediated by a version signal the handlers bump at React's re-render points.
|
|
|
750
768
|
</button>
|
|
751
769
|
</form>
|
|
752
770
|
</mol-modal>
|
|
771
|
+
@if (showTwoFactor()) {
|
|
753
772
|
<mol-modal [open]="tfModal() !== null" (close)="closeTf()" [title]="tfTitle()">
|
|
754
773
|
@if (tfError(); as tfFailure) {
|
|
755
774
|
<div mol-alert [status]="'error'" [className]="cm.sp('mb', 4)">{{ tfFailure }}</div>
|
|
@@ -809,9 +828,15 @@ mediated by a version signal the handlers bump at React's re-render points.
|
|
|
809
828
|
</button>
|
|
810
829
|
</form>
|
|
811
830
|
}
|
|
812
|
-
</mol-modal>}`,
|
|
831
|
+
</mol-modal>}}`,
|
|
813
832
|
})
|
|
814
|
-
export class AuthSection {
|
|
833
|
+
export class AuthSection implements OnInit {
|
|
834
|
+
@InputProperty() set twoFactor(value: boolean) {
|
|
835
|
+
this.showTwoFactor.set(value)
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
protected readonly showTwoFactor = signal(true)
|
|
839
|
+
|
|
815
840
|
protected readonly auth = useAuth<UserProfile>()
|
|
816
841
|
|
|
817
842
|
protected readonly i18n = useTranslation()
|
|
@@ -862,17 +887,7 @@ export class AuthSection {
|
|
|
862
887
|
protected isOauthOnly(): boolean {
|
|
863
888
|
return !!this.auth.user()?.oauthServer
|
|
864
889
|
}
|
|
865
|
-
|
|
866
|
-
protected tfTitle(): string {
|
|
867
|
-
return this.tfModal() === 'disable'
|
|
868
|
-
? this.t('settings.twoFactorDisableTitle', undefined, {
|
|
869
|
-
defaultValue: 'Disable two-factor authentication',
|
|
870
|
-
})
|
|
871
|
-
: this.t('settings.twoFactorEnableTitle', undefined, {
|
|
872
|
-
defaultValue: 'Enable two-factor authentication',
|
|
873
|
-
})
|
|
874
|
-
}
|
|
875
|
-
// … truncated — 8 more members: constructor, closePasswordModal, openDisableTf, startEnable, submitTf, submitTfForm, closeTf, submitPassword; the full declaration is in node_modules/@molecule/app-settings-panel-angular/dist/auth-section.component.d.ts
|
|
890
|
+
// … truncated — 10 more members: tfTitle, constructor, ngOnInit, closePasswordModal, openDisableTf, startEnable, submitTf, submitTfForm, closeTf, submitPassword; the full declaration is in node_modules/@molecule/app-settings-panel-angular/dist/auth-section.component.d.ts
|
|
876
891
|
```
|
|
877
892
|
|
|
878
893
|
_(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-settings-panel-angular/dist/auth-section.component.d.ts`.)_
|
|
@@ -889,17 +904,20 @@ more accurate label than the parent-supplied default. The `plan` input
|
|
|
889
904
|
remains a fallback (e.g. for offline rendering or apps that don't expose
|
|
890
905
|
`/billing/status`).
|
|
891
906
|
|
|
892
|
-
The Upgrade button
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
`TiersUpgradeSection
|
|
907
|
+
The Upgrade button opens `upgradeTo`, the app's page for choosing a plan
|
|
908
|
+
(`/pricing`, `/billing`). It has no default: no one route is right for
|
|
909
|
+
every app, and the settings page this section sits in has no plans to
|
|
910
|
+
choose. An app with no such page renders `TiersUpgradeSection`, which lists
|
|
911
|
+
the tiers and starts the checkout itself. A section given no `upgradeTo`
|
|
912
|
+
anyway (from JavaScript, or a template the compiler does not check) shows the
|
|
913
|
+
plan without the button.
|
|
896
914
|
|
|
897
915
|
```typescript
|
|
898
916
|
@Component({
|
|
899
917
|
selector: 'section[mol-settings-billing]',
|
|
900
918
|
standalone: true,
|
|
901
919
|
imports: [Button, Flex],
|
|
902
|
-
inputs: ['plan', 'upgradeTo'],
|
|
920
|
+
inputs: ['plan', { name: 'upgradeTo', required: true }],
|
|
903
921
|
template: `<h3 [class]="cm.cn(cm.sectionHeading, cm.sp('mb', 3))">
|
|
904
922
|
{{ t('settings.billing', undefined, { defaultValue: 'Billing' }) }}
|
|
905
923
|
</h3>
|
|
@@ -908,16 +926,18 @@ elsewhere. Apps with a multi-tier checkout flow should use
|
|
|
908
926
|
>{{ t('settings.plan', undefined, { defaultValue: 'Plan: ' })
|
|
909
927
|
}}<strong>{{ planLabel() }}</strong></span
|
|
910
928
|
>
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
929
|
+
@if (upgradeTo) {
|
|
930
|
+
<button mol-button [variant]="'outline'" [size]="'sm'" (click)="upgrade()">
|
|
931
|
+
{{ t('settings.upgrade', undefined, { defaultValue: 'Upgrade' }) }}
|
|
932
|
+
</button>
|
|
933
|
+
}
|
|
914
934
|
</div>`,
|
|
915
935
|
})
|
|
916
936
|
export class BillingSection {
|
|
917
937
|
/** Fallback plan name when `/api/billing/status` is unavailable. */
|
|
918
|
-
plan
|
|
919
|
-
/**
|
|
920
|
-
upgradeTo
|
|
938
|
+
plan?: string
|
|
939
|
+
/** The app's page for choosing a plan, which the Upgrade button opens. */
|
|
940
|
+
upgradeTo!: string
|
|
921
941
|
|
|
922
942
|
/** Reactive translation, read in the injection context. */
|
|
923
943
|
protected readonly i18n = useTranslation()
|
|
@@ -941,7 +961,11 @@ export class BillingSection {
|
|
|
941
961
|
* @returns The plan name.
|
|
942
962
|
*/
|
|
943
963
|
protected planLabel(): string {
|
|
944
|
-
return
|
|
964
|
+
return (
|
|
965
|
+
this.livePlan() ??
|
|
966
|
+
this.plan ??
|
|
967
|
+
this.t('settings.billing.freePlan', undefined, { defaultValue: 'Free' })
|
|
968
|
+
)
|
|
945
969
|
}
|
|
946
970
|
|
|
947
971
|
/**
|
|
@@ -1707,8 +1731,10 @@ Replaces the simpler `BillingSection` for apps backed by
|
|
|
1707
1731
|
`@molecule/api-payments-stripe` + `@molecule/api-resource-payment` — loads
|
|
1708
1732
|
the user's current plan from `/api/billing/status`, loads available tiers
|
|
1709
1733
|
from `/api/billing/tiers`, and renders an Upgrade modal with a Subscribe
|
|
1710
|
-
button per
|
|
1711
|
-
|
|
1734
|
+
button per price that is for sale (one the server lists with a price id).
|
|
1735
|
+
Upgrade appears only for a free user and only when something is for sale.
|
|
1736
|
+
Subscribe POSTs to `/api/billing/checkout` and redirects to the checkout
|
|
1737
|
+
URL; a paid user (`isFree: false` in the status) sees a Cancel button that
|
|
1712
1738
|
POSTs to `/api/billing/cancel`. A refused request shows the server's
|
|
1713
1739
|
message.
|
|
1714
1740
|
|
|
@@ -1724,14 +1750,21 @@ message.
|
|
|
1724
1750
|
{{ t('settings.billing', undefined, { defaultValue: 'Billing' }) }}
|
|
1725
1751
|
</h3>
|
|
1726
1752
|
<div mol-flex [align]="'center'" [justify]="'between'">
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1753
|
+
<!-- The plan line waits for the server: there is no plan name to guess. -->
|
|
1754
|
+
@if (plan(); as planName) {
|
|
1755
|
+
<span [class]="cm.textSize('sm')"
|
|
1756
|
+
>{{ t('settings.plan', undefined, { defaultValue: 'Plan: ' })
|
|
1757
|
+
}}<strong>{{ planName }}</strong></span
|
|
1758
|
+
>
|
|
1759
|
+
} @else {
|
|
1760
|
+
<span></span>
|
|
1761
|
+
}
|
|
1762
|
+
@if (isFree()) {
|
|
1763
|
+
@if (forSale().length > 0) {
|
|
1764
|
+
<button mol-button [variant]="'outline'" [size]="'sm'" (click)="showUpgrade.set(true)">
|
|
1765
|
+
{{ t('settings.upgrade', undefined, { defaultValue: 'Upgrade' }) }}
|
|
1766
|
+
</button>
|
|
1767
|
+
}
|
|
1735
1768
|
} @else {
|
|
1736
1769
|
<button
|
|
1737
1770
|
mol-confirm-button
|
|
@@ -1751,6 +1784,9 @@ message.
|
|
|
1751
1784
|
</button>
|
|
1752
1785
|
}
|
|
1753
1786
|
</div>
|
|
1787
|
+
@if (cancelError(); as cancelMessage) {
|
|
1788
|
+
<div mol-alert [status]="'error'" [className]="cm.sp('mt', 3)">{{ cancelMessage }}</div>
|
|
1789
|
+
}
|
|
1754
1790
|
</section>
|
|
1755
1791
|
<mol-modal
|
|
1756
1792
|
[open]="showUpgrade()"
|
|
@@ -1760,42 +1796,33 @@ message.
|
|
|
1760
1796
|
@if (upgradeError(); as checkoutError) {
|
|
1761
1797
|
<div mol-alert [status]="'error'" [className]="cm.sp('mb', 4)">{{ checkoutError }}</div>
|
|
1762
1798
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
<div>
|
|
1775
|
-
<p [class]="cm.fontWeight('semibold')">
|
|
1776
|
-
{{ entry.tier.name }} ({{ entry.price.interval }})
|
|
1777
|
-
</p>
|
|
1778
|
-
<p [class]="cm.cn(cm.textSize('xs'), cm.textMuted)">
|
|
1779
|
-
{{ entry.price.priceLabel }}
|
|
1780
|
-
</p>
|
|
1781
|
-
</div>
|
|
1782
|
-
<button
|
|
1783
|
-
mol-button
|
|
1784
|
-
[size]="'sm'"
|
|
1785
|
-
[loading]="upgradeLoading() === entry.price.stripePriceId"
|
|
1786
|
-
(click)="startCheckout(entry.price.stripePriceId)"
|
|
1787
|
-
>
|
|
1788
|
-
{{ t('settings.billing.subscribe', undefined, { defaultValue: 'Subscribe' }) }}
|
|
1789
|
-
</button>
|
|
1799
|
+
<ul [class]="cm.stack(3)">
|
|
1800
|
+
@for (entry of forSale(); track entry.key) {
|
|
1801
|
+
<li [class]="cm.sp('p', 4)">
|
|
1802
|
+
<div mol-flex [align]="'center'" [justify]="'between'">
|
|
1803
|
+
<div>
|
|
1804
|
+
<p [class]="cm.fontWeight('semibold')">
|
|
1805
|
+
{{ entry.tier.name }} ({{ entry.price.interval }})
|
|
1806
|
+
</p>
|
|
1807
|
+
<p [class]="cm.cn(cm.textSize('xs'), cm.textMuted)">
|
|
1808
|
+
{{ entry.price.priceLabel }}
|
|
1809
|
+
</p>
|
|
1790
1810
|
</div>
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1811
|
+
<button
|
|
1812
|
+
mol-button
|
|
1813
|
+
[size]="'sm'"
|
|
1814
|
+
[loading]="upgradeLoading() === entry.priceId"
|
|
1815
|
+
(click)="startCheckout(entry.priceId)"
|
|
1816
|
+
>
|
|
1817
|
+
{{ t('settings.billing.subscribe', undefined, { defaultValue: 'Subscribe' }) }}
|
|
1818
|
+
</button>
|
|
1819
|
+
</div>
|
|
1820
|
+
</li>
|
|
1821
|
+
}
|
|
1822
|
+
</ul>
|
|
1795
1823
|
</mol-modal>`,
|
|
1796
1824
|
})
|
|
1797
1825
|
export class TiersUpgradeSection {
|
|
1798
|
-
/** How the page leaves for the checkout URL the server returns. */
|
|
1799
1826
|
redirectToCheckout: (checkoutUrl: string) => void = openUrl
|
|
1800
1827
|
|
|
1801
1828
|
/** Reactive translation, read in the injection context. */
|
|
@@ -1806,10 +1833,9 @@ export class TiersUpgradeSection {
|
|
|
1806
1833
|
|
|
1807
1834
|
private readonly http = useHttpClient()
|
|
1808
1835
|
|
|
1809
|
-
|
|
1810
|
-
protected readonly
|
|
1811
|
-
|
|
1812
|
-
protected readonly planKey = signal('free')
|
|
1836
|
+
protected readonly plan = signal<string | null>(null)
|
|
1837
|
+
protected readonly planKey = signal<string | null>(null)
|
|
1838
|
+
protected readonly isFree = signal(true)
|
|
1813
1839
|
/** The tiers loaded from `/api/billing/tiers`. */
|
|
1814
1840
|
protected readonly tiers = signal<Tier[]>([])
|
|
1815
1841
|
/** Whether the upgrade modal is open. */
|
|
@@ -1818,38 +1844,50 @@ export class TiersUpgradeSection {
|
|
|
1818
1844
|
protected readonly upgradeLoading = signal<string | null>(null)
|
|
1819
1845
|
/** The upgrade modal's error message. */
|
|
1820
1846
|
protected readonly upgradeError = signal('')
|
|
1847
|
+
protected readonly cancelError = signal('')
|
|
1821
1848
|
|
|
1822
|
-
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
1823
1849
|
protected readonly cm: UIClassMap = getClassMap()
|
|
1824
1850
|
|
|
1825
1851
|
private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
|
|
1826
1852
|
|
|
1827
|
-
|
|
1828
|
-
|
|
1853
|
+
private loads = 0
|
|
1854
|
+
private destroyed = false
|
|
1855
|
+
|
|
1856
|
+
protected forSale(): { key: string; tier: Tier; price: TierPrice; priceId: string }[] {
|
|
1857
|
+
const entries: { key: string; tier: Tier; price: TierPrice; priceId: string }[] = []
|
|
1829
1858
|
for (const tier of this.tiers()) {
|
|
1830
|
-
if (tier.planKey ===
|
|
1859
|
+
if (tier.planKey === this.planKey()) continue
|
|
1831
1860
|
for (const price of tier.prices) {
|
|
1832
1861
|
if (!price.stripePriceId) continue
|
|
1833
|
-
entries.push({
|
|
1862
|
+
entries.push({
|
|
1863
|
+
key: `${tier.planKey}-${price.stripePriceId}`,
|
|
1864
|
+
tier,
|
|
1865
|
+
price,
|
|
1866
|
+
priceId: price.stripePriceId,
|
|
1867
|
+
})
|
|
1834
1868
|
}
|
|
1835
1869
|
}
|
|
1836
1870
|
return entries
|
|
1837
1871
|
}
|
|
1838
1872
|
|
|
1873
|
+
/** Loads the current plan and the available tiers on mount. */
|
|
1839
1874
|
constructor() {
|
|
1840
1875
|
usePlacement(() => {
|
|
1841
1876
|
// host's place; the host itself leaves the page.
|
|
1842
1877
|
placeContentBefore(this.host.nativeElement, this.host.nativeElement)
|
|
1843
1878
|
setElementPresent(this.host.nativeElement, false)
|
|
1844
1879
|
})
|
|
1845
|
-
let cancelled = false
|
|
1846
1880
|
inject(DestroyRef).onDestroy(() => {
|
|
1847
|
-
|
|
1881
|
+
this.destroyed = true
|
|
1848
1882
|
})
|
|
1883
|
+
this.load()
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
private load(): void {
|
|
1887
|
+
const seq = ++this.loads
|
|
1849
1888
|
void Promise.all([
|
|
1850
|
-
// defaults ('Free', empty tier list) instead of throwing.
|
|
1851
1889
|
this.http
|
|
1852
|
-
.get<{ planKey?: string; name?: string }>('/api/billing/status')
|
|
1890
|
+
.get<{ planKey?: string; name?: string; isFree?: boolean }>('/api/billing/status')
|
|
1853
1891
|
.catch((_error) => null),
|
|
1854
1892
|
this.http
|
|
1855
1893
|
.get<{
|
|
@@ -1862,11 +1900,12 @@ export class TiersUpgradeSection {
|
|
|
1862
1900
|
.catch((_error) => null),
|
|
1863
1901
|
])
|
|
1864
1902
|
.then(([statusRes, tiersRes]) => {
|
|
1865
|
-
if (
|
|
1903
|
+
if (this.destroyed || seq !== this.loads) return
|
|
1866
1904
|
const status = statusRes?.data ?? null
|
|
1867
1905
|
if (status?.name) this.plan.set(status.name)
|
|
1868
1906
|
if (status?.planKey) this.planKey.set(status.planKey)
|
|
1869
|
-
|
|
1907
|
+
if (typeof status?.isFree === 'boolean') this.isFree.set(status.isFree)
|
|
1908
|
+
const list = tiersRes?.data?.data
|
|
1870
1909
|
if (Array.isArray(list)) {
|
|
1871
1910
|
this.tiers.set(
|
|
1872
1911
|
list.map((tier) => ({
|
|
@@ -1881,14 +1920,10 @@ export class TiersUpgradeSection {
|
|
|
1881
1920
|
)
|
|
1882
1921
|
}
|
|
1883
1922
|
})
|
|
1884
|
-
.catch((_error) => {
|
|
1885
|
-
// Fetch failures already resolve to null above; this only guards the
|
|
1886
|
-
// mapping, keeping the section on its defaults rather than throwing.
|
|
1887
|
-
})
|
|
1923
|
+
.catch((_error) => {})
|
|
1888
1924
|
}
|
|
1889
1925
|
|
|
1890
|
-
protected async startCheckout(stripePriceId: string
|
|
1891
|
-
if (!stripePriceId) return
|
|
1926
|
+
protected async startCheckout(stripePriceId: string): Promise<void> {
|
|
1892
1927
|
this.upgradeError.set('')
|
|
1893
1928
|
this.upgradeLoading.set(stripePriceId)
|
|
1894
1929
|
try {
|
|
@@ -1923,13 +1958,12 @@ export class TiersUpgradeSection {
|
|
|
1923
1958
|
}
|
|
1924
1959
|
|
|
1925
1960
|
protected cancelSubscription = async (): Promise<void> => {
|
|
1926
|
-
this.
|
|
1961
|
+
this.cancelError.set('')
|
|
1927
1962
|
try {
|
|
1928
1963
|
await this.http.post('/api/billing/cancel', {})
|
|
1929
|
-
this.
|
|
1930
|
-
this.planKey.set('free')
|
|
1964
|
+
this.load()
|
|
1931
1965
|
} catch (err) {
|
|
1932
|
-
this.
|
|
1966
|
+
this.cancelError.set(
|
|
1933
1967
|
serverErrorMessage(err) ??
|
|
1934
1968
|
this.t('settings.billing.cancelFailed', undefined, {
|
|
1935
1969
|
defaultValue: 'Could not cancel.',
|
|
@@ -1940,7 +1974,7 @@ export class TiersUpgradeSection {
|
|
|
1940
1974
|
}
|
|
1941
1975
|
```
|
|
1942
1976
|
|
|
1943
|
-
_(
|
|
1977
|
+
_(The 16 longest member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-settings-panel-angular/dist/tiers-upgrade-section.component.d.ts`.)_
|
|
1944
1978
|
|
|
1945
1979
|
### Functions
|
|
1946
1980
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuthSection component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { type OnInit } from '@angular/core';
|
|
1
7
|
import type { UserProfile } from '@molecule/app-auth';
|
|
2
8
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
3
9
|
import * as i0 from "@angular/core";
|
|
@@ -26,14 +32,22 @@ export interface TwoFactorSetup {
|
|
|
26
32
|
* handler deliberately ignores — so it never actually enrolled 2FA.)
|
|
27
33
|
*
|
|
28
34
|
* Auto-hides for OAuth-only users (`user.oauthServer` truthy) since
|
|
29
|
-
* password / 2FA wouldn't apply.
|
|
30
|
-
* provider
|
|
35
|
+
* password / 2FA wouldn't apply. Pass `[twoFactor]="false"` when the app's API
|
|
36
|
+
* has no two-factor provider: it then serves no `verify-two-factor` route, so
|
|
37
|
+
* the section shows only the password change and reads no 2FA status.
|
|
31
38
|
*
|
|
32
39
|
* `useChangePassword`'s state is a live getter over a plain object (the
|
|
33
40
|
* Angular binding's `usePromise` port), so the pending/error reads are
|
|
34
41
|
* mediated by a version signal the handlers bump at React's re-render points.
|
|
35
42
|
*/
|
|
36
|
-
export declare class AuthSection {
|
|
43
|
+
export declare class AuthSection implements OnInit {
|
|
44
|
+
/**
|
|
45
|
+
* Show the two-factor row. Set false when the API has no two-factor provider
|
|
46
|
+
* (no `POST /users/:id/verify-two-factor` route). Default true.
|
|
47
|
+
*/
|
|
48
|
+
set twoFactor(value: boolean);
|
|
49
|
+
/** The `twoFactor` input, as a signal the template reads. */
|
|
50
|
+
protected readonly showTwoFactor: import("@angular/core").WritableSignal<boolean>;
|
|
37
51
|
/** The signed-in user (React's `useAuth().user`). */
|
|
38
52
|
protected readonly auth: import("@molecule/app-angular").UseAuthResult<UserProfile, Record<never, never>>;
|
|
39
53
|
/** Reactive translation, read in the injection context. */
|
|
@@ -82,12 +96,15 @@ export declare class AuthSection {
|
|
|
82
96
|
* @returns The title text.
|
|
83
97
|
*/
|
|
84
98
|
protected tfTitle(): string;
|
|
99
|
+
/** Places the section's content in the host's position and drops a late status read. */
|
|
100
|
+
constructor();
|
|
85
101
|
/**
|
|
86
102
|
* Reads the persisted 2FA status from `/users/me` on mount (React's mount
|
|
87
|
-
* effect); status read is best-effort and defaults
|
|
88
|
-
* that lands after unmount is dropped like React's
|
|
103
|
+
* effect), once the inputs are set; status read is best-effort and defaults
|
|
104
|
+
* to disabled. A result that lands after unmount is dropped like React's
|
|
105
|
+
* cancelled one. Without the two-factor row there is nothing to read.
|
|
89
106
|
*/
|
|
90
|
-
|
|
107
|
+
ngOnInit(): void;
|
|
91
108
|
/**
|
|
92
109
|
* Closes the change-password modal (React's `onClose`): hides it and
|
|
93
110
|
* returns the change-password flow to idle.
|
|
@@ -122,6 +139,6 @@ export declare class AuthSection {
|
|
|
122
139
|
*/
|
|
123
140
|
protected submitPassword(event: Event): Promise<void>;
|
|
124
141
|
static ɵfac: i0.ɵɵFactoryDeclaration<AuthSection, never>;
|
|
125
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AuthSection, "mol-auth-section", never, {}, {}, never, never, true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
142
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AuthSection, "mol-auth-section", never, { "twoFactor": { "alias": "twoFactor"; "required": false; }; }, {}, never, never, true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
126
143
|
}
|
|
127
144
|
//# sourceMappingURL=auth-section.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-section.component.d.ts","sourceRoot":"","sources":["../src/auth-section.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-section.component.d.ts","sourceRoot":"","sources":["../src/auth-section.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAQL,KAAK,MAAM,EAEZ,MAAM,eAAe,CAAA;AAYtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;;AAIlD,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAmKa,WAAY,YAAW,MAAM;IACxC;;;OAGG;IACH,IAAqB,SAAS,CAAC,KAAK,EAAE,OAAO,EAE5C;IAED,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,CAAC,aAAa,kDAAe;IAE/C,qDAAqD;IACrD,SAAS,CAAC,QAAQ,CAAC,IAAI,mFAAyB;IAEhD,2DAA2D;IAC3D,SAAS,CAAC,QAAQ,CAAC,IAAI,uDAAmB;IAE1C,iDAAiD;IACjD,SAAS,CAAC,CAAC,8IAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IAEvC,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAsB;IAEzC,iDAAiD;IACjD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,kDAAgB;IACpD,0CAA0C;IAC1C,SAAS,CAAC,QAAQ,CAAC,eAAe,iDAAa;IAC/C,sCAAsC;IACtC,SAAS,CAAC,QAAQ,CAAC,WAAW,iDAAa;IAE3C,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,kDAAgB;IACnD,kEAAkE;IAClE,SAAS,CAAC,QAAQ,CAAC,OAAO,sEAA4C;IACtE,qDAAqD;IACrD,SAAS,CAAC,QAAQ,CAAC,OAAO,gEAAsC;IAChE,yCAAyC;IACzC,SAAS,CAAC,QAAQ,CAAC,OAAO,iDAAa;IACvC,+CAA+C;IAC/C,SAAS,CAAC,QAAQ,CAAC,SAAS,kDAAgB;IAC5C,4CAA4C;IAC5C,SAAS,CAAC,QAAQ,CAAC,OAAO,iDAAa;IAEvC,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC,mEAAmE;IACnE,SAAS,CAAC,QAAQ,CAAC,QAAQ,kFAGzB;IAEF,2DAA2D;IAC3D,SAAS,CAAC,QAAQ,CAAC,OAAO,gDAUxB;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAuB;IAErD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;IAEnE,8CAA8C;IAE9C,mEAAmE;IACnE,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAgB;IAEjD;;;OAGG;IACH,SAAS,CAAC,WAAW,IAAI,OAAO;IAIhC;;;OAGG;IACH,SAAS,CAAC,OAAO,IAAI,MAAM;IAU3B,wFAAwF;;IAcxF;;;;;OAKG;IACH,QAAQ,IAAI,IAAI;IAkBhB;;;OAGG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAMpC;;OAEG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;IAM/B;;;OAGG;cACa,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB5C;;;OAGG;YACW,QAAQ;IAqBtB;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK1C;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;IAOzB;;;OAGG;cACa,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;yCAvOhD,WAAW;2CAAX,WAAW;CAsPvB"}
|