@molecule/app-settings-panel-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 +1992 -2
- package/dist/account-section.component.d.ts +123 -0
- package/dist/account-section.component.d.ts.map +1 -0
- package/dist/account-section.component.js +350 -0
- package/dist/account-section.component.js.map +1 -0
- package/dist/appearance-section.component.d.ts +52 -0
- package/dist/appearance-section.component.d.ts.map +1 -0
- package/dist/appearance-section.component.js +128 -0
- package/dist/appearance-section.component.js.map +1 -0
- package/dist/auth-section.component.d.ts +125 -0
- package/dist/auth-section.component.d.ts.map +1 -0
- package/dist/auth-section.component.js +667 -0
- package/dist/auth-section.component.js.map +1 -0
- package/dist/billing-section.component.d.ts +52 -0
- package/dist/billing-section.component.d.ts.map +1 -0
- package/dist/billing-section.component.js +137 -0
- package/dist/billing-section.component.js.map +1 -0
- package/dist/context.d.ts +46 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +73 -0
- package/dist/context.js.map +1 -0
- package/dist/controlled-switch.d.ts +38 -0
- package/dist/controlled-switch.d.ts.map +1 -0
- package/dist/controlled-switch.js +56 -0
- package/dist/controlled-switch.js.map +1 -0
- package/dist/devices-section.component.d.ts +88 -0
- package/dist/devices-section.component.d.ts.map +1 -0
- package/dist/devices-section.component.js +374 -0
- package/dist/devices-section.component.js.map +1 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/log-out-delete-section.component.d.ts +50 -0
- package/dist/log-out-delete-section.component.d.ts.map +1 -0
- package/dist/log-out-delete-section.component.js +249 -0
- package/dist/log-out-delete-section.component.js.map +1 -0
- package/dist/notifications-section.component.d.ts +78 -0
- package/dist/notifications-section.component.d.ts.map +1 -0
- package/dist/notifications-section.component.js +256 -0
- package/dist/notifications-section.component.js.map +1 -0
- package/dist/push-toggle.d.ts +12 -0
- package/dist/push-toggle.d.ts.map +1 -0
- package/dist/push-toggle.js +11 -0
- package/dist/push-toggle.js.map +1 -0
- package/dist/settings-container.component.d.ts +33 -0
- package/dist/settings-container.component.d.ts.map +1 -0
- package/dist/settings-container.component.js +64 -0
- package/dist/settings-container.component.js.map +1 -0
- package/dist/this-device-section.component.d.ts +40 -0
- package/dist/this-device-section.component.d.ts.map +1 -0
- package/dist/this-device-section.component.js +149 -0
- package/dist/this-device-section.component.js.map +1 -0
- package/dist/tiers-upgrade-section.component.d.ts +89 -0
- package/dist/tiers-upgrade-section.component.d.ts.map +1 -0
- package/dist/tiers-upgrade-section.component.js +407 -0
- package/dist/tiers-upgrade-section.component.js.map +1 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +78 -4
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DevicesSection component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, DestroyRef, inject, signal } from '@angular/core';
|
|
8
|
+
import { useHttpClient, useTranslation } from '@molecule/app-angular';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import { Button, Flex, Icon, Spinner } from '@molecule/app-ui-angular';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
const _c0 = () => ({ defaultValue: "Devices" });
|
|
13
|
+
const _c1 = () => ({ defaultValue: "This Device" });
|
|
14
|
+
const _c2 = () => ({ defaultValue: "Cancel" });
|
|
15
|
+
const _c3 = () => ({ defaultValue: "Sign out" });
|
|
16
|
+
const _c4 = () => ({ defaultValue: "This device's access will be revoked shortly. Sign it out?" });
|
|
17
|
+
const _c5 = () => ({ defaultValue: "No devices found" });
|
|
18
|
+
const _forTrack0 = ($index, $item) => $item.id;
|
|
19
|
+
function DevicesSection_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
20
|
+
i0.ɵɵelement(0, "div", 1);
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
i0.ɵɵproperty("size", "xs");
|
|
23
|
+
} }
|
|
24
|
+
function DevicesSection_Conditional_4_For_2_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
25
|
+
i0.ɵɵelementStart(0, "span");
|
|
26
|
+
i0.ɵɵtext(1);
|
|
27
|
+
i0.ɵɵelementEnd();
|
|
28
|
+
} if (rf & 2) {
|
|
29
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
30
|
+
i0.ɵɵclassMap(ctx_r0.cm.cn(ctx_r0.cm.textSize("xs"), ctx_r0.cm.textSubtle, ctx_r0.cm.sp("ml", 2)));
|
|
31
|
+
i0.ɵɵadvance();
|
|
32
|
+
i0.ɵɵtextInterpolate(ctx_r0.t("settings.thisDevice", undefined, i0.ɵɵpureFunction0(3, _c1)));
|
|
33
|
+
} }
|
|
34
|
+
function DevicesSection_Conditional_4_For_2_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
35
|
+
i0.ɵɵelementContainer(0, 4);
|
|
36
|
+
} if (rf & 2) {
|
|
37
|
+
const device_r2 = i0.ɵɵnextContext().$implicit;
|
|
38
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
39
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.renderRowIcon)("ngTemplateOutletContext", ctx_r0.rowContext(device_r2));
|
|
40
|
+
} }
|
|
41
|
+
function DevicesSection_Conditional_4_For_2_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
42
|
+
i0.ɵɵnamespaceSVG();
|
|
43
|
+
i0.ɵɵelement(0, "svg", 5);
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
46
|
+
i0.ɵɵproperty("name", "chevron-right")("size", 16)("className", ctx_r0.cm.textSubtle);
|
|
47
|
+
} }
|
|
48
|
+
function DevicesSection_Conditional_4_For_2_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
49
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
50
|
+
i0.ɵɵelementStart(0, "div", 6)(1, "button", 8);
|
|
51
|
+
i0.ɵɵlistener("click", function DevicesSection_Conditional_4_For_2_Conditional_7_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r0.confirmingId.set(null)); });
|
|
52
|
+
i0.ɵɵtext(2);
|
|
53
|
+
i0.ɵɵelementEnd();
|
|
54
|
+
i0.ɵɵelementStart(3, "button", 9);
|
|
55
|
+
i0.ɵɵlistener("click", function DevicesSection_Conditional_4_For_2_Conditional_7_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r3); const device_r2 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.revoke(device_r2.id)); });
|
|
56
|
+
i0.ɵɵtext(4);
|
|
57
|
+
i0.ɵɵelementEnd()();
|
|
58
|
+
} if (rf & 2) {
|
|
59
|
+
const device_r2 = i0.ɵɵnextContext().$implicit;
|
|
60
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
61
|
+
i0.ɵɵproperty("align", "center")("gap", "sm");
|
|
62
|
+
i0.ɵɵadvance();
|
|
63
|
+
i0.ɵɵproperty("variant", "ghost")("size", "sm")("disabled", ctx_r0.isRevoking(device_r2));
|
|
64
|
+
i0.ɵɵadvance();
|
|
65
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.t("common.cancel", undefined, i0.ɵɵpureFunction0(10, _c2)), " ");
|
|
66
|
+
i0.ɵɵadvance();
|
|
67
|
+
i0.ɵɵproperty("color", "error")("size", "sm")("loading", ctx_r0.isRevoking(device_r2));
|
|
68
|
+
i0.ɵɵadvance();
|
|
69
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.t("settings.signOutDevice", undefined, i0.ɵɵpureFunction0(11, _c3)), " ");
|
|
70
|
+
} }
|
|
71
|
+
function DevicesSection_Conditional_4_For_2_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
72
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
73
|
+
i0.ɵɵelementStart(0, "button", 10);
|
|
74
|
+
i0.ɵɵlistener("click", function DevicesSection_Conditional_4_For_2_Conditional_8_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r4); const device_r2 = i0.ɵɵnextContext().$implicit; const ctx_r0 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r0.confirmingId.set(device_r2.id)); });
|
|
75
|
+
i0.ɵɵtext(1);
|
|
76
|
+
i0.ɵɵelementEnd();
|
|
77
|
+
} if (rf & 2) {
|
|
78
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
79
|
+
i0.ɵɵproperty("variant", "ghost")("size", "sm");
|
|
80
|
+
i0.ɵɵadvance();
|
|
81
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.t("settings.signOutDevice", undefined, i0.ɵɵpureFunction0(3, _c3)), " ");
|
|
82
|
+
} }
|
|
83
|
+
function DevicesSection_Conditional_4_For_2_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
84
|
+
i0.ɵɵelementStart(0, "p");
|
|
85
|
+
i0.ɵɵtext(1);
|
|
86
|
+
i0.ɵɵelementEnd();
|
|
87
|
+
} if (rf & 2) {
|
|
88
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
89
|
+
i0.ɵɵclassMap(ctx_r0.cm.cn(ctx_r0.cm.textSize("xs"), ctx_r0.cm.textMuted, ctx_r0.cm.sp("mt", 1)));
|
|
90
|
+
i0.ɵɵadvance();
|
|
91
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.t("settings.revokeDeviceWarning", undefined, i0.ɵɵpureFunction0(3, _c4)), " ");
|
|
92
|
+
} }
|
|
93
|
+
function DevicesSection_Conditional_4_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
94
|
+
i0.ɵɵelementStart(0, "li")(1, "div", 3)(2, "span");
|
|
95
|
+
i0.ɵɵtext(3);
|
|
96
|
+
i0.ɵɵconditionalCreate(4, DevicesSection_Conditional_4_For_2_Conditional_4_Template, 2, 4, "span", 2);
|
|
97
|
+
i0.ɵɵelementEnd();
|
|
98
|
+
i0.ɵɵconditionalCreate(5, DevicesSection_Conditional_4_For_2_Conditional_5_Template, 1, 2, "ng-container", 4)(6, DevicesSection_Conditional_4_For_2_Conditional_6_Template, 1, 3, "svg", 5)(7, DevicesSection_Conditional_4_For_2_Conditional_7_Template, 5, 12, "div", 6)(8, DevicesSection_Conditional_4_For_2_Conditional_8_Template, 2, 4, "button", 7);
|
|
99
|
+
i0.ɵɵelementEnd();
|
|
100
|
+
i0.ɵɵconditionalCreate(9, DevicesSection_Conditional_4_For_2_Conditional_9_Template, 2, 4, "p", 2);
|
|
101
|
+
i0.ɵɵelementEnd();
|
|
102
|
+
} if (rf & 2) {
|
|
103
|
+
const device_r2 = ctx.$implicit;
|
|
104
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
105
|
+
i0.ɵɵadvance();
|
|
106
|
+
i0.ɵɵproperty("align", "center")("justify", "between")("className", ctx_r0.cm.cn(ctx_r0.cm.textSize("sm"), ctx_r0.cm.sp("py", 1)));
|
|
107
|
+
i0.ɵɵadvance(2);
|
|
108
|
+
i0.ɵɵtextInterpolate(device_r2.name || device_r2.platform);
|
|
109
|
+
i0.ɵɵadvance();
|
|
110
|
+
i0.ɵɵconditional(device_r2.isCurrent ? 4 : -1);
|
|
111
|
+
i0.ɵɵadvance();
|
|
112
|
+
i0.ɵɵconditional(ctx_r0.renderRowIcon ? 5 : device_r2.isCurrent ? 6 : ctx_r0.isConfirming(device_r2) ? 7 : 8);
|
|
113
|
+
i0.ɵɵadvance(4);
|
|
114
|
+
i0.ɵɵconditional(ctx_r0.isConfirming(device_r2) ? 9 : -1);
|
|
115
|
+
} }
|
|
116
|
+
function DevicesSection_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
117
|
+
i0.ɵɵelementStart(0, "ul");
|
|
118
|
+
i0.ɵɵrepeaterCreate(1, DevicesSection_Conditional_4_For_2_Template, 10, 7, "li", null, _forTrack0);
|
|
119
|
+
i0.ɵɵelementEnd();
|
|
120
|
+
} if (rf & 2) {
|
|
121
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
122
|
+
i0.ɵɵclassMap(ctx_r0.cm.stack(2));
|
|
123
|
+
i0.ɵɵadvance();
|
|
124
|
+
i0.ɵɵrepeater(ctx_r0.devices());
|
|
125
|
+
} }
|
|
126
|
+
function DevicesSection_Conditional_5_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
127
|
+
i0.ɵɵelementStart(0, "p");
|
|
128
|
+
i0.ɵɵtext(1);
|
|
129
|
+
i0.ɵɵelementEnd();
|
|
130
|
+
} if (rf & 2) {
|
|
131
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
132
|
+
i0.ɵɵclassMap(ctx_r0.cm.cn(ctx_r0.cm.textSize("sm"), ctx_r0.cm.textMuted));
|
|
133
|
+
i0.ɵɵadvance();
|
|
134
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.t("settings.noDevices", undefined, i0.ɵɵpureFunction0(3, _c5)), " ");
|
|
135
|
+
} }
|
|
136
|
+
function DevicesSection_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
137
|
+
i0.ɵɵconditionalCreate(0, DevicesSection_Conditional_5_Conditional_0_Template, 2, 4, "p", 2);
|
|
138
|
+
} if (rf & 2) {
|
|
139
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
140
|
+
i0.ɵɵconditional(!ctx_r0.loading() ? 0 : -1);
|
|
141
|
+
} }
|
|
142
|
+
/**
|
|
143
|
+
* DevicesSection component.
|
|
144
|
+
*
|
|
145
|
+
* Devices section — lists the user's registered devices and lets them
|
|
146
|
+
* revoke (sign out) any device other than the one they're currently using.
|
|
147
|
+
* The host IS the `<section>` React renders.
|
|
148
|
+
*
|
|
149
|
+
* Revoking deletes the device row (`DELETE /api/devices/:id`). The API's
|
|
150
|
+
* authorization layer enforces server-side revocation: it rejects that
|
|
151
|
+
* device's session the next time it makes a request (within the
|
|
152
|
+
* device-exists cache TTL), so the removed device is actually signed out —
|
|
153
|
+
* not just hidden from the list. The current device is labelled
|
|
154
|
+
* "This device" and is not revocable here (use Sign out for the current
|
|
155
|
+
* session). Recreates molecule v1's device-revocation behaviour.
|
|
156
|
+
*
|
|
157
|
+
* Apps that want a different trailing element per row can pass a
|
|
158
|
+
* `renderRowIcon` template (its context carries the device as `$implicit`
|
|
159
|
+
* and `a0`, the way the conformance kit maps a React render function), which
|
|
160
|
+
* then replaces the built-in revoke control; pass an empty template to
|
|
161
|
+
* suppress it entirely.
|
|
162
|
+
*/
|
|
163
|
+
export class DevicesSection {
|
|
164
|
+
/**
|
|
165
|
+
* A custom trailing element per row (React's `renderRowIcon` callback).
|
|
166
|
+
* The template's context carries the device as `$implicit` / `a0`; giving
|
|
167
|
+
* one replaces the built-in revoke control.
|
|
168
|
+
*/
|
|
169
|
+
renderRowIcon;
|
|
170
|
+
/** Reactive translation, read in the injection context. */
|
|
171
|
+
i18n = useTranslation();
|
|
172
|
+
/** The translation function for the template. */
|
|
173
|
+
t = this.i18n.t;
|
|
174
|
+
http = useHttpClient();
|
|
175
|
+
/** The registered devices. */
|
|
176
|
+
devices = signal([], /* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "devices" }] : /* istanbul ignore next */ []));
|
|
178
|
+
/** Whether the device list is loading. */
|
|
179
|
+
loading = signal(true, /* @ts-ignore */
|
|
180
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
181
|
+
/** The id of the row showing its revoke confirmation. */
|
|
182
|
+
confirmingId = signal(null, /* @ts-ignore */
|
|
183
|
+
...(ngDevMode ? [{ debugName: "confirmingId" }] : /* istanbul ignore next */ []));
|
|
184
|
+
/** The id of the device whose revoke request is running. */
|
|
185
|
+
revokingId = signal(null, /* @ts-ignore */
|
|
186
|
+
...(ngDevMode ? [{ debugName: "revokingId" }] : /* istanbul ignore next */ []));
|
|
187
|
+
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
188
|
+
cm = getClassMap();
|
|
189
|
+
/**
|
|
190
|
+
* Whether one row shows its revoke confirmation.
|
|
191
|
+
* @param device - The row's device.
|
|
192
|
+
* @returns True when the row is confirming.
|
|
193
|
+
*/
|
|
194
|
+
isConfirming(device) {
|
|
195
|
+
return this.confirmingId() === device.id;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Whether one row's revoke request is running.
|
|
199
|
+
* @param device - The row's device.
|
|
200
|
+
* @returns True when the row is revoking.
|
|
201
|
+
*/
|
|
202
|
+
isRevoking(device) {
|
|
203
|
+
return this.revokingId() === device.id;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The template context for one row's custom renderer (the way the
|
|
207
|
+
* conformance kit maps a React render function: `$implicit` = the first
|
|
208
|
+
* argument, `a0`… the argument list).
|
|
209
|
+
* @param device - The row's device.
|
|
210
|
+
* @returns The template context.
|
|
211
|
+
*/
|
|
212
|
+
rowContext(device) {
|
|
213
|
+
return { $implicit: device, a0: device, a1: undefined, a2: undefined };
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Loads the devices (React's `load`): GET /api/devices responds with the
|
|
217
|
+
* ARRAY itself (see the device resource's query handler) — response.data IS
|
|
218
|
+
* the rows. This used to read `response.data.data`, which is always
|
|
219
|
+
* undefined for that shape, so the section rendered "No devices" for
|
|
220
|
+
* everyone. Devices endpoint is optional; the section renders empty when
|
|
221
|
+
* unavailable.
|
|
222
|
+
*/
|
|
223
|
+
async load() {
|
|
224
|
+
try {
|
|
225
|
+
const response = await this.http.get('/api/devices');
|
|
226
|
+
this.devices.set(Array.isArray(response.data) ? response.data : []);
|
|
227
|
+
}
|
|
228
|
+
catch (_error) {
|
|
229
|
+
// Devices endpoint is optional; the section renders empty when unavailable.
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
this.loading.set(false);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/** Loads once on mount (React's mount effect). */
|
|
236
|
+
constructor() {
|
|
237
|
+
inject(DestroyRef);
|
|
238
|
+
void this.load();
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Signs one device out and reloads (React's `revoke`); best-effort — the
|
|
242
|
+
* row is kept so the user can retry the revoke.
|
|
243
|
+
* @param id - The device row's id.
|
|
244
|
+
*/
|
|
245
|
+
async revoke(id) {
|
|
246
|
+
this.revokingId.set(id);
|
|
247
|
+
try {
|
|
248
|
+
await this.http.delete(`/api/devices/${id}`);
|
|
249
|
+
this.confirmingId.set(null);
|
|
250
|
+
await this.load();
|
|
251
|
+
}
|
|
252
|
+
catch (_error) {
|
|
253
|
+
// Best-effort — keep the row so the user can retry the revoke.
|
|
254
|
+
}
|
|
255
|
+
finally {
|
|
256
|
+
this.revokingId.set(null);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
static ɵfac = function DevicesSection_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DevicesSection)(); };
|
|
260
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DevicesSection, selectors: [["section", "mol-settings-devices", ""]], inputs: { renderRowIcon: "renderRowIcon" }, decls: 6, vars: 9, consts: [["mol-flex", "", 3, "align", "gap", "className"], ["mol-spinner", "", 3, "size"], [3, "class"], ["mol-flex", "", 3, "align", "justify", "className"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], ["mol-icon-root", "", 3, "name", "size", "className"], ["mol-flex", "", 3, "align", "gap"], ["mol-button", "", "data-mol-id", "device-revoke", 3, "variant", "size"], ["mol-button", "", 3, "click", "variant", "size", "disabled"], ["mol-button", "", "data-mol-id", "device-revoke-confirm", 3, "click", "color", "size", "loading"], ["mol-button", "", "data-mol-id", "device-revoke", 3, "click", "variant", "size"]], template: function DevicesSection_Template(rf, ctx) { if (rf & 1) {
|
|
261
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "h3");
|
|
262
|
+
i0.ɵɵtext(2);
|
|
263
|
+
i0.ɵɵelementEnd();
|
|
264
|
+
i0.ɵɵconditionalCreate(3, DevicesSection_Conditional_3_Template, 1, 1, "div", 1);
|
|
265
|
+
i0.ɵɵelementEnd();
|
|
266
|
+
i0.ɵɵconditionalCreate(4, DevicesSection_Conditional_4_Template, 3, 2, "ul", 2)(5, DevicesSection_Conditional_5_Template, 1, 1);
|
|
267
|
+
} if (rf & 2) {
|
|
268
|
+
i0.ɵɵproperty("align", "center")("gap", "sm")("className", ctx.cm.sp("mb", 3));
|
|
269
|
+
i0.ɵɵadvance();
|
|
270
|
+
i0.ɵɵclassMap(ctx.cm.sectionHeading);
|
|
271
|
+
i0.ɵɵadvance();
|
|
272
|
+
i0.ɵɵtextInterpolate1(" ", ctx.t("settings.devices", undefined, i0.ɵɵpureFunction0(8, _c0)), " ");
|
|
273
|
+
i0.ɵɵadvance();
|
|
274
|
+
i0.ɵɵconditional(ctx.loading() ? 3 : -1);
|
|
275
|
+
i0.ɵɵadvance();
|
|
276
|
+
i0.ɵɵconditional(ctx.devices().length > 0 ? 4 : 5);
|
|
277
|
+
} }, dependencies: [Button, Flex, Icon, NgTemplateOutlet, Spinner], encapsulation: 2 });
|
|
278
|
+
}
|
|
279
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DevicesSection, [{
|
|
280
|
+
type: Component,
|
|
281
|
+
args: [{
|
|
282
|
+
selector: 'section[mol-settings-devices]',
|
|
283
|
+
standalone: true,
|
|
284
|
+
imports: [Button, Flex, Icon, NgTemplateOutlet, Spinner],
|
|
285
|
+
inputs: ['renderRowIcon'],
|
|
286
|
+
// prettier-ignore
|
|
287
|
+
template: `<div mol-flex [align]="'center'" [gap]="'sm'" [className]="cm.sp('mb', 3)">
|
|
288
|
+
<h3 [class]="cm.sectionHeading">
|
|
289
|
+
{{ t('settings.devices', undefined, { defaultValue: 'Devices' }) }}
|
|
290
|
+
</h3>
|
|
291
|
+
@if (loading()) {
|
|
292
|
+
<div mol-spinner [size]="'xs'"></div>
|
|
293
|
+
}
|
|
294
|
+
</div>
|
|
295
|
+
@if (devices().length > 0) {
|
|
296
|
+
<ul [class]="cm.stack(2)">
|
|
297
|
+
@for (device of devices(); track device.id) {
|
|
298
|
+
<li>
|
|
299
|
+
<div
|
|
300
|
+
mol-flex
|
|
301
|
+
[align]="'center'"
|
|
302
|
+
[justify]="'between'"
|
|
303
|
+
[className]="cm.cn(cm.textSize('sm'), cm.sp('py', 1))"
|
|
304
|
+
>
|
|
305
|
+
<span>{{ device.name || device.platform }}@if (device.isCurrent) {<span [class]="cm.cn(cm.textSize('xs'), cm.textSubtle, cm.sp('ml', 2))">{{ t('settings.thisDevice', undefined, { defaultValue: 'This Device' }) }}</span>}</span>
|
|
306
|
+
@if (renderRowIcon) {
|
|
307
|
+
<ng-container
|
|
308
|
+
[ngTemplateOutlet]="renderRowIcon"
|
|
309
|
+
[ngTemplateOutletContext]="rowContext(device)"
|
|
310
|
+
/>
|
|
311
|
+
} @else if (device.isCurrent) {
|
|
312
|
+
<svg
|
|
313
|
+
mol-icon-root
|
|
314
|
+
[name]="'chevron-right'"
|
|
315
|
+
[size]="16"
|
|
316
|
+
[className]="cm.textSubtle"
|
|
317
|
+
></svg>
|
|
318
|
+
} @else if (isConfirming(device)) {
|
|
319
|
+
<div mol-flex [align]="'center'" [gap]="'sm'">
|
|
320
|
+
<button
|
|
321
|
+
mol-button
|
|
322
|
+
[variant]="'ghost'"
|
|
323
|
+
[size]="'sm'"
|
|
324
|
+
[disabled]="isRevoking(device)"
|
|
325
|
+
(click)="confirmingId.set(null)"
|
|
326
|
+
>
|
|
327
|
+
{{ t('common.cancel', undefined, { defaultValue: 'Cancel' }) }}
|
|
328
|
+
</button>
|
|
329
|
+
<button
|
|
330
|
+
mol-button
|
|
331
|
+
[color]="'error'"
|
|
332
|
+
[size]="'sm'"
|
|
333
|
+
[loading]="isRevoking(device)"
|
|
334
|
+
(click)="revoke(device.id)"
|
|
335
|
+
data-mol-id="device-revoke-confirm"
|
|
336
|
+
>
|
|
337
|
+
{{ t('settings.signOutDevice', undefined, { defaultValue: 'Sign out' }) }}
|
|
338
|
+
</button>
|
|
339
|
+
</div>
|
|
340
|
+
} @else {
|
|
341
|
+
<button
|
|
342
|
+
mol-button
|
|
343
|
+
[variant]="'ghost'"
|
|
344
|
+
[size]="'sm'"
|
|
345
|
+
(click)="confirmingId.set(device.id)"
|
|
346
|
+
data-mol-id="device-revoke"
|
|
347
|
+
>
|
|
348
|
+
{{ t('settings.signOutDevice', undefined, { defaultValue: 'Sign out' }) }}
|
|
349
|
+
</button>
|
|
350
|
+
}
|
|
351
|
+
</div>
|
|
352
|
+
@if (isConfirming(device)) {
|
|
353
|
+
<p [class]="cm.cn(cm.textSize('xs'), cm.textMuted, cm.sp('mt', 1))">
|
|
354
|
+
{{
|
|
355
|
+
t('settings.revokeDeviceWarning', undefined, {
|
|
356
|
+
defaultValue: "This device's access will be revoked shortly. Sign it out?",
|
|
357
|
+
})
|
|
358
|
+
}}
|
|
359
|
+
</p>
|
|
360
|
+
}
|
|
361
|
+
</li>
|
|
362
|
+
}
|
|
363
|
+
</ul>
|
|
364
|
+
} @else {
|
|
365
|
+
@if (!loading()) {
|
|
366
|
+
<p [class]="cm.cn(cm.textSize('sm'), cm.textMuted)">
|
|
367
|
+
{{ t('settings.noDevices', undefined, { defaultValue: 'No devices found' }) }}
|
|
368
|
+
</p>
|
|
369
|
+
}
|
|
370
|
+
}`,
|
|
371
|
+
}]
|
|
372
|
+
}], () => [], null); })();
|
|
373
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(DevicesSection, { className: "DevicesSection", filePath: "devices-section.component.ts", lineNumber: 129 }); })();
|
|
374
|
+
//# sourceMappingURL=devices-section.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices-section.component.js","sourceRoot":"","sources":["../src/devices-section.component.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@molecule/app-settings-panel-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-settings-panel-react`: the same runtime export names, the
|
|
4
|
+
* same props, and the same DOM for the same input. A composable,
|
|
5
|
+
* batteries-included settings panel.
|
|
6
|
+
*
|
|
7
|
+
* `<SettingsContainer [onClose]="…">` owns the layout and publishes `onClose`
|
|
8
|
+
* via the settings-panel context; each section component is standalone and
|
|
9
|
+
* loads its own data through the binding's hooks:
|
|
10
|
+
* - `AccountSection` (as `<section mol-settings-account>`) — name/email edit
|
|
11
|
+
* (`PATCH /api/users/:id` over the auth client's profile transport).
|
|
12
|
+
* - `AppearanceSection` — dark-mode toggle (`useTheme()`).
|
|
13
|
+
* - `AuthSection` — password change + TOTP two-factor
|
|
14
|
+
* (`POST /api/users/:id/verify-two-factor`).
|
|
15
|
+
* - `NotificationsSection` — web-push toggle (see the exported
|
|
16
|
+
* `enablePushOnCurrentDevice` / `disablePushOnCurrentDevice` helpers and
|
|
17
|
+
* their documented device-row contract).
|
|
18
|
+
* - `BillingSection` — read-only plan display (`GET /api/billing/status`),
|
|
19
|
+
* or `TiersUpgradeSection` — full Stripe upgrade/cancel flow
|
|
20
|
+
* (`/api/billing/tiers|checkout|cancel`). Use one or the other, not both.
|
|
21
|
+
* - `DevicesSection` / `ThisDeviceSection` — device list + current device
|
|
22
|
+
* (`GET/DELETE /api/devices`).
|
|
23
|
+
* - `LogOutDeleteSection` — sign out + delete account
|
|
24
|
+
* (`DELETE /api/users/:id`).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { Component } from '@angular/core'
|
|
29
|
+
* import {
|
|
30
|
+
* AccountSection,
|
|
31
|
+
* AppearanceSection,
|
|
32
|
+
* AuthSection,
|
|
33
|
+
* BillingSection,
|
|
34
|
+
* DevicesSection,
|
|
35
|
+
* LogOutDeleteSection,
|
|
36
|
+
* NotificationsSection,
|
|
37
|
+
* SettingsContainer,
|
|
38
|
+
* ThisDeviceSection,
|
|
39
|
+
* } from '@molecule/app-settings-panel-angular'
|
|
40
|
+
*
|
|
41
|
+
* @Component({
|
|
42
|
+
* selector: 'app-settings-panel',
|
|
43
|
+
* standalone: true,
|
|
44
|
+
* imports: [
|
|
45
|
+
* AccountSection,
|
|
46
|
+
* AppearanceSection,
|
|
47
|
+
* AuthSection,
|
|
48
|
+
* BillingSection,
|
|
49
|
+
* DevicesSection,
|
|
50
|
+
* LogOutDeleteSection,
|
|
51
|
+
* NotificationsSection,
|
|
52
|
+
* SettingsContainer,
|
|
53
|
+
* ThisDeviceSection,
|
|
54
|
+
* ],
|
|
55
|
+
* template: `
|
|
56
|
+
* <!-- Pick sections, order them, and interleave custom ones. -->
|
|
57
|
+
* <div mol-settings-container [onClose]="close">
|
|
58
|
+
* <section mol-settings-account></section>
|
|
59
|
+
* <section mol-settings-appearance></section>
|
|
60
|
+
* <mol-auth-section></mol-auth-section>
|
|
61
|
+
* <section mol-settings-notifications></section>
|
|
62
|
+
* <section mol-settings-billing></section>
|
|
63
|
+
* <section mol-settings-devices></section>
|
|
64
|
+
* <section mol-settings-this-device></section>
|
|
65
|
+
* <mol-log-out-delete-section></mol-log-out-delete-section>
|
|
66
|
+
* </div>
|
|
67
|
+
* `,
|
|
68
|
+
* })
|
|
69
|
+
* export class SettingsPanel {
|
|
70
|
+
* close(): void {
|
|
71
|
+
* // dismiss the drawer / panel hosting the settings
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* - Wiring prereqs: sections need the standard `@molecule/app-angular`
|
|
78
|
+
* provider stack — `provideI18n`, `provideHttp` (authenticated client),
|
|
79
|
+
* `provideAuth`, `provideTheme` (AppearanceSection), the bonded device and
|
|
80
|
+
* push providers (NotificationsSection/ThisDeviceSection) — plus a bonded
|
|
81
|
+
* ClassMap. `BillingSection` and `LogOutDeleteSection` also need the
|
|
82
|
+
* binding's router (`provideRouter`) and throw outside one.
|
|
83
|
+
* - Section components throw if rendered outside `<SettingsContainer>`
|
|
84
|
+
* (they read its context for `onClose`).
|
|
85
|
+
* - Server contract: the molecule API surface from
|
|
86
|
+
* `@molecule/api-resource-user`, `@molecule/api-resource-device`,
|
|
87
|
+
* `@molecule/api-two-factor`, and the billing endpoints
|
|
88
|
+
* (`/api/billing/*`) wired by the payments stack. Missing read endpoints
|
|
89
|
+
* degrade gracefully (sections render empty); the mutating actions do not.
|
|
90
|
+
* - Translations: `@molecule/app-locales-settings-panel` companion bond.
|
|
91
|
+
*
|
|
92
|
+
* @module
|
|
93
|
+
*/
|
|
94
|
+
export * from './account-section.component.js';
|
|
95
|
+
export * from './appearance-section.component.js';
|
|
96
|
+
export * from './auth-section.component.js';
|
|
97
|
+
export * from './billing-section.component.js';
|
|
98
|
+
export * from './context.js';
|
|
99
|
+
export * from './devices-section.component.js';
|
|
100
|
+
export * from './log-out-delete-section.component.js';
|
|
101
|
+
export * from './notifications-section.component.js';
|
|
102
|
+
export * from './push-toggle.js';
|
|
103
|
+
export * from './settings-container.component.js';
|
|
104
|
+
export * from './this-device-section.component.js';
|
|
105
|
+
export * from './tiers-upgrade-section.component.js';
|
|
106
|
+
export * from './types.js';
|
|
107
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AAEH,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,cAAc,CAAA;AAC5B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,uCAAuC,CAAA;AACrD,cAAc,sCAAsC,CAAA;AACpD,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,sCAAsC,CAAA;AACpD,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@molecule/app-settings-panel-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-settings-panel-react`: the same runtime export names, the
|
|
4
|
+
* same props, and the same DOM for the same input. A composable,
|
|
5
|
+
* batteries-included settings panel.
|
|
6
|
+
*
|
|
7
|
+
* `<SettingsContainer [onClose]="…">` owns the layout and publishes `onClose`
|
|
8
|
+
* via the settings-panel context; each section component is standalone and
|
|
9
|
+
* loads its own data through the binding's hooks:
|
|
10
|
+
* - `AccountSection` (as `<section mol-settings-account>`) — name/email edit
|
|
11
|
+
* (`PATCH /api/users/:id` over the auth client's profile transport).
|
|
12
|
+
* - `AppearanceSection` — dark-mode toggle (`useTheme()`).
|
|
13
|
+
* - `AuthSection` — password change + TOTP two-factor
|
|
14
|
+
* (`POST /api/users/:id/verify-two-factor`).
|
|
15
|
+
* - `NotificationsSection` — web-push toggle (see the exported
|
|
16
|
+
* `enablePushOnCurrentDevice` / `disablePushOnCurrentDevice` helpers and
|
|
17
|
+
* their documented device-row contract).
|
|
18
|
+
* - `BillingSection` — read-only plan display (`GET /api/billing/status`),
|
|
19
|
+
* or `TiersUpgradeSection` — full Stripe upgrade/cancel flow
|
|
20
|
+
* (`/api/billing/tiers|checkout|cancel`). Use one or the other, not both.
|
|
21
|
+
* - `DevicesSection` / `ThisDeviceSection` — device list + current device
|
|
22
|
+
* (`GET/DELETE /api/devices`).
|
|
23
|
+
* - `LogOutDeleteSection` — sign out + delete account
|
|
24
|
+
* (`DELETE /api/users/:id`).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { Component } from '@angular/core'
|
|
29
|
+
* import {
|
|
30
|
+
* AccountSection,
|
|
31
|
+
* AppearanceSection,
|
|
32
|
+
* AuthSection,
|
|
33
|
+
* BillingSection,
|
|
34
|
+
* DevicesSection,
|
|
35
|
+
* LogOutDeleteSection,
|
|
36
|
+
* NotificationsSection,
|
|
37
|
+
* SettingsContainer,
|
|
38
|
+
* ThisDeviceSection,
|
|
39
|
+
* } from '@molecule/app-settings-panel-angular'
|
|
40
|
+
*
|
|
41
|
+
* @Component({
|
|
42
|
+
* selector: 'app-settings-panel',
|
|
43
|
+
* standalone: true,
|
|
44
|
+
* imports: [
|
|
45
|
+
* AccountSection,
|
|
46
|
+
* AppearanceSection,
|
|
47
|
+
* AuthSection,
|
|
48
|
+
* BillingSection,
|
|
49
|
+
* DevicesSection,
|
|
50
|
+
* LogOutDeleteSection,
|
|
51
|
+
* NotificationsSection,
|
|
52
|
+
* SettingsContainer,
|
|
53
|
+
* ThisDeviceSection,
|
|
54
|
+
* ],
|
|
55
|
+
* template: `
|
|
56
|
+
* <!-- Pick sections, order them, and interleave custom ones. -->
|
|
57
|
+
* <div mol-settings-container [onClose]="close">
|
|
58
|
+
* <section mol-settings-account></section>
|
|
59
|
+
* <section mol-settings-appearance></section>
|
|
60
|
+
* <mol-auth-section></mol-auth-section>
|
|
61
|
+
* <section mol-settings-notifications></section>
|
|
62
|
+
* <section mol-settings-billing></section>
|
|
63
|
+
* <section mol-settings-devices></section>
|
|
64
|
+
* <section mol-settings-this-device></section>
|
|
65
|
+
* <mol-log-out-delete-section></mol-log-out-delete-section>
|
|
66
|
+
* </div>
|
|
67
|
+
* `,
|
|
68
|
+
* })
|
|
69
|
+
* export class SettingsPanel {
|
|
70
|
+
* close(): void {
|
|
71
|
+
* // dismiss the drawer / panel hosting the settings
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* - Wiring prereqs: sections need the standard `@molecule/app-angular`
|
|
78
|
+
* provider stack — `provideI18n`, `provideHttp` (authenticated client),
|
|
79
|
+
* `provideAuth`, `provideTheme` (AppearanceSection), the bonded device and
|
|
80
|
+
* push providers (NotificationsSection/ThisDeviceSection) — plus a bonded
|
|
81
|
+
* ClassMap. `BillingSection` and `LogOutDeleteSection` also need the
|
|
82
|
+
* binding's router (`provideRouter`) and throw outside one.
|
|
83
|
+
* - Section components throw if rendered outside `<SettingsContainer>`
|
|
84
|
+
* (they read its context for `onClose`).
|
|
85
|
+
* - Server contract: the molecule API surface from
|
|
86
|
+
* `@molecule/api-resource-user`, `@molecule/api-resource-device`,
|
|
87
|
+
* `@molecule/api-two-factor`, and the billing endpoints
|
|
88
|
+
* (`/api/billing/*`) wired by the payments stack. Missing read endpoints
|
|
89
|
+
* degrade gracefully (sections render empty); the mutating actions do not.
|
|
90
|
+
* - Translations: `@molecule/app-locales-settings-panel` companion bond.
|
|
91
|
+
*
|
|
92
|
+
* @module
|
|
93
|
+
*/
|
|
94
|
+
export * from './account-section.component.js';
|
|
95
|
+
export * from './appearance-section.component.js';
|
|
96
|
+
export * from './auth-section.component.js';
|
|
97
|
+
export * from './billing-section.component.js';
|
|
98
|
+
export * from './context.js';
|
|
99
|
+
export * from './devices-section.component.js';
|
|
100
|
+
export * from './log-out-delete-section.component.js';
|
|
101
|
+
export * from './notifications-section.component.js';
|
|
102
|
+
export * from './push-toggle.js';
|
|
103
|
+
export * from './settings-container.component.js';
|
|
104
|
+
export * from './this-device-section.component.js';
|
|
105
|
+
export * from './tiers-upgrade-section.component.js';
|
|
106
|
+
export * from './types.js';
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AAEH,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,cAAc,CAAA;AAC5B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,uCAAuC,CAAA;AACrD,cAAc,sCAAsC,CAAA;AACpD,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,oCAAoC,CAAA;AAClD,cAAc,sCAAsC,CAAA;AACpD,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* LogOutDeleteSection component.
|
|
5
|
+
*
|
|
6
|
+
* Bottom actions section — Log out + Delete account. React's root is a
|
|
7
|
+
* fragment (the `<section>` plus the delete-account modal), so the host is
|
|
8
|
+
* unwrapped by the DOM normalizer and `display: contents` keeps the layout
|
|
9
|
+
* fragment-like.
|
|
10
|
+
*
|
|
11
|
+
* Owns the delete-account modal internally (the trigger lives in the
|
|
12
|
+
* same section so the modal lives here too). Reads `onClose` from
|
|
13
|
+
* the `<SettingsContainer>` context to dismiss the panel after either
|
|
14
|
+
* action and navigates to `/login`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class LogOutDeleteSection {
|
|
17
|
+
/** Reactive translation, read in the injection context. */
|
|
18
|
+
protected readonly i18n: import("@molecule/app-angular").UseTranslationResult;
|
|
19
|
+
/** The translation function for the template. */
|
|
20
|
+
protected t: (key: string, values?: import("@molecule/app-i18n").InterpolationValues, options?: import("@molecule/app-i18n").TranslateOptions) => string;
|
|
21
|
+
/** The binding's router (throws outside one, like react-router's useNavigate). */
|
|
22
|
+
private readonly router;
|
|
23
|
+
/** The signed-in user and the auth actions. */
|
|
24
|
+
private readonly auth;
|
|
25
|
+
private readonly http;
|
|
26
|
+
/** The container's `onClose` (throws outside a `<SettingsContainer>`). */
|
|
27
|
+
private readonly panel;
|
|
28
|
+
/** Whether the delete-account modal is open. */
|
|
29
|
+
protected readonly showModal: import("@angular/core").WritableSignal<boolean>;
|
|
30
|
+
/** The delete-account password field's value. */
|
|
31
|
+
protected readonly password: import("@angular/core").WritableSignal<string>;
|
|
32
|
+
/** Whether the delete request is running. */
|
|
33
|
+
protected readonly loading: import("@angular/core").WritableSignal<boolean>;
|
|
34
|
+
/** The delete-account modal's error message. */
|
|
35
|
+
protected readonly deleteError: import("@angular/core").WritableSignal<string>;
|
|
36
|
+
/** The bonded ClassMap (styling tokens resolve at render time). */
|
|
37
|
+
protected readonly cm: UIClassMap;
|
|
38
|
+
/** Signs out, closes the panel and returns to `/login` (React's `handleLogout`). */
|
|
39
|
+
protected logout(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Deletes the account (React's `handleDelete`): submits the password,
|
|
42
|
+
* signs out, closes the panel and returns to `/login`; a failure shows the
|
|
43
|
+
* server's message and keeps the modal.
|
|
44
|
+
* @param event - The native submit event.
|
|
45
|
+
*/
|
|
46
|
+
protected deleteAccount(event: Event): Promise<void>;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LogOutDeleteSection, never>;
|
|
48
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LogOutDeleteSection, "mol-log-out-delete-section", never, {}, {}, never, never, true, never>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=log-out-delete-section.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-out-delete-section.component.d.ts","sourceRoot":"","sources":["../src/log-out-delete-section.component.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;;AAMlD;;;;;;;;;;;;GAYG;AACH,qBAuEa,mBAAmB;IAC9B,2DAA2D;IAC3D,SAAS,CAAC,QAAQ,CAAC,IAAI,uDAAmB;IAE1C,iDAAiD;IACjD,SAAS,CAAC,CAAC,8IAAc;IAEzB,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,+CAA+C;IAC/C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyB;IAE9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IAEvC,0EAA0E;IAC1E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;IAElD,gDAAgD;IAChD,SAAS,CAAC,QAAQ,CAAC,SAAS,kDAAgB;IAC5C,iDAAiD;IACjD,SAAS,CAAC,QAAQ,CAAC,QAAQ,iDAAa;IACxC,6CAA6C;IAC7C,SAAS,CAAC,QAAQ,CAAC,OAAO,kDAAgB;IAC1C,gDAAgD;IAChD,SAAS,CAAC,QAAQ,CAAC,WAAW,iDAAa;IAE3C,mEAAmE;IACnE,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAgB;IAEjD,oFAAoF;cACpE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAMvC;;;;;OAKG;cACa,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;yCA3C/C,mBAAmB;2CAAnB,mBAAmB;CAiE/B"}
|