@fiduswriter/frontend 0.1.72 → 0.1.73

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.
Files changed (53) hide show
  1. package/css/login.css +268 -0
  2. package/css/show_profile.css +111 -40
  3. package/dist/app/index.d.ts.map +1 -1
  4. package/dist/app/index.js +1 -0
  5. package/dist/app/index.js.map +1 -1
  6. package/dist/common/user_util.d.ts +8 -1
  7. package/dist/common/user_util.d.ts.map +1 -1
  8. package/dist/common/user_util.js +24 -0
  9. package/dist/common/user_util.js.map +1 -1
  10. package/dist/css/fwtoolkit/data_table.css +31 -6
  11. package/dist/css/fwtoolkit/dialog.css +51 -0
  12. package/dist/css/fwtoolkit/fwtoolkit.css +157 -26
  13. package/dist/css/fwtoolkit/inline_tools.css +5 -8
  14. package/dist/css/fwtoolkit/overview_menu.css +70 -12
  15. package/dist/css/login.css +268 -0
  16. package/dist/css/manifest.json +1 -0
  17. package/dist/css/show_profile.css +111 -40
  18. package/dist/feedback/index.d.ts.map +1 -1
  19. package/dist/feedback/index.js +6 -1
  20. package/dist/feedback/index.js.map +1 -1
  21. package/dist/menu/index.d.ts.map +1 -1
  22. package/dist/menu/index.js +16 -2
  23. package/dist/menu/index.js.map +1 -1
  24. package/dist/user/auth/login.d.ts +14 -0
  25. package/dist/user/auth/login.d.ts.map +1 -1
  26. package/dist/user/auth/login.js +253 -131
  27. package/dist/user/auth/login.js.map +1 -1
  28. package/dist/user/profile/dialog.d.ts +72 -0
  29. package/dist/user/profile/dialog.d.ts.map +1 -0
  30. package/dist/user/profile/dialog.js +436 -0
  31. package/dist/user/profile/dialog.js.map +1 -0
  32. package/dist/user/profile/dialogs.d.ts +6 -6
  33. package/dist/user/profile/dialogs.d.ts.map +1 -1
  34. package/dist/user/profile/dialogs.js +29 -14
  35. package/dist/user/profile/dialogs.js.map +1 -1
  36. package/dist/user/profile/index.d.ts +12 -14
  37. package/dist/user/profile/index.d.ts.map +1 -1
  38. package/dist/user/profile/index.js +35 -236
  39. package/dist/user/profile/index.js.map +1 -1
  40. package/dist/user/profile/templates.d.ts +14 -1
  41. package/dist/user/profile/templates.d.ts.map +1 -1
  42. package/dist/user/profile/templates.js +178 -191
  43. package/dist/user/profile/templates.js.map +1 -1
  44. package/package.json +3 -2
  45. package/src/app/index.ts +1 -0
  46. package/src/common/user_util.ts +26 -1
  47. package/src/feedback/index.ts +8 -1
  48. package/src/menu/index.ts +19 -2
  49. package/src/user/auth/login.ts +338 -153
  50. package/src/user/profile/dialog.ts +609 -0
  51. package/src/user/profile/dialogs.ts +51 -14
  52. package/src/user/profile/index.ts +37 -334
  53. package/src/user/profile/templates.ts +222 -223
@@ -0,0 +1,436 @@
1
+ import { BooleanSwitch, Dialog, DialogTabs, activateWait, addAlert, deactivateWait, dropdownSelect, ensureCSS, findTarget, initFloatingLabels } from "fwtoolkit";
2
+ import { refreshUserChrome } from "../../common/user_util.js";
3
+ import { DeleteUserDialog } from "./delete_user.js";
4
+ import { addEmailDialog, changeAvatarDialog, changePrimaryEmailDialog, changePwdDialog, deleteAvatarDialog, deleteEmailDialog, deleteSocialaccountDialog } from "./dialogs.js";
5
+ import { profileAvatarTemplate, profileBasicsTemplate, profileEditorTemplate, profileEmailsTemplate, profileLanguageTemplate, profilePluginTemplate, profileSocialAccountsTemplate } from "./templates.js";
6
+ /**
7
+ * Design 5 "Configure profile" dialog.
8
+ *
9
+ * A tab dialog whose action buttons ("Delete account" and the primary
10
+ * "Confirm") sit in the title bar (`buttonsTop`), matching the design.
11
+ *
12
+ * The class also provides the plugin host surface used by profile plugins
13
+ * (`pluginTemplates`, `clickTargets`, `postRenderHandlers`, `save`, `dom`,
14
+ * `user`, `app`), so existing plugins keep working unchanged.
15
+ */
16
+ export class ProfileDialog {
17
+ app;
18
+ user;
19
+ socialaccount_providers;
20
+ pluginTemplates;
21
+ clickTargets;
22
+ postRenderHandlers;
23
+ plugins;
24
+ dom;
25
+ profilePlugins;
26
+ dialog;
27
+ dialogTabs;
28
+ dirty;
29
+ twoFactorSwitch;
30
+ twoFactorEnabled;
31
+ onClose;
32
+ activeTab;
33
+ redraw = () => this.refreshContent();
34
+ constructor({ app, user, socialaccount_providers, profilePlugins = [], onClose }) {
35
+ this.app = app;
36
+ this.user = user;
37
+ this.socialaccount_providers = socialaccount_providers;
38
+ this.profilePlugins = profilePlugins;
39
+ this.pluginTemplates = [];
40
+ this.plugins = null;
41
+ this.dialog = null;
42
+ this.dialogTabs = null;
43
+ this.dirty = false;
44
+ this.twoFactorSwitch = null;
45
+ this.twoFactorEnabled = false;
46
+ this.onClose = onClose || false;
47
+ this.activeTab = 0;
48
+ this.clickTargets = {
49
+ "#add-profile-email": (_el, _event) => addEmailDialog(this.app, this.redraw),
50
+ "#fw-edit-profile-pwd": (_el, _event) => changePwdDialog({ username: this.user.username, app: this.app }),
51
+ ".delete-email": (el, _event) => deleteEmailDialog(el.target, this.app, this.redraw),
52
+ ".delete-socialaccount": (el, _event) => deleteSocialaccountDialog(el.target, this.app, this.redraw)
53
+ };
54
+ this.postRenderHandlers = [
55
+ () => {
56
+ dropdownSelect(this.dom.querySelector("#edit-avatar-pulldown"), {
57
+ onChange: (value) => {
58
+ switch (value) {
59
+ case "change":
60
+ changeAvatarDialog(this.app, this.redraw);
61
+ break;
62
+ case "delete":
63
+ deleteAvatarDialog(this.app, this.redraw);
64
+ break;
65
+ }
66
+ },
67
+ button: this.dom.querySelector("#edit-avatar-btn")
68
+ });
69
+ },
70
+ () => {
71
+ this.dom
72
+ .querySelectorAll(".primary-email-radio")
73
+ .forEach(el => el.addEventListener("change", () => changePrimaryEmailDialog(this.app, this.redraw)));
74
+ }
75
+ ];
76
+ if (this.app.settings.TWO_FACTOR_ENABLED) {
77
+ this.postRenderHandlers.push(() => this.initTwoFactorSwitch());
78
+ this.postRenderHandlers.push(() => this.updateTwoFactorStatus());
79
+ }
80
+ if (this.app.settings.E2EE_MODE &&
81
+ this.app.settings.E2EE_MODE !== "disabled") {
82
+ this.clickTargets["#setup-e2ee-passphrase"] = (_el, _event) => {
83
+ this.setupE2EEPassphrase();
84
+ };
85
+ this.clickTargets["#change-e2ee-passphrase"] = (_el, _event) => {
86
+ this.changeE2EEPassphrase();
87
+ };
88
+ this.clickTargets["#recover-e2ee-passphrase"] = (_el, _event) => {
89
+ this.recoverE2EEPassphrase();
90
+ };
91
+ this.postRenderHandlers.push(() => this.updateE2EEPassphraseStatus());
92
+ }
93
+ }
94
+ activateFidusPlugins() {
95
+ if (this.plugins) {
96
+ return;
97
+ }
98
+ this.plugins = {};
99
+ this.profilePlugins.forEach(([app, plugin]) => {
100
+ if (!this.app.settings.APPS.includes(app)) {
101
+ return;
102
+ }
103
+ Object.values(plugin).forEach(pluginExport => {
104
+ if (typeof pluginExport === "function") {
105
+ const name = pluginExport.name;
106
+ this.plugins[name] = new pluginExport(this);
107
+ this.plugins[name].init();
108
+ }
109
+ });
110
+ });
111
+ }
112
+ open() {
113
+ this.activateFidusPlugins();
114
+ ensureCSS([
115
+ staticUrl("css/show_profile.css"),
116
+ staticUrl("css/two_factor.css")
117
+ ]);
118
+ this.dialogTabs = new DialogTabs(this.buildTabs(), {
119
+ containerId: "profile-tabs",
120
+ onShow: index => {
121
+ this.activeTab = index;
122
+ }
123
+ });
124
+ const dialog = new Dialog({
125
+ id: "profile-dialog",
126
+ title: gettext("Configure profile"),
127
+ width: 720,
128
+ scroll: true,
129
+ buttonsTop: true,
130
+ body: this.dialogTabs.render(),
131
+ onClose: this.onClose,
132
+ buttons: [
133
+ {
134
+ id: "delete-account",
135
+ text: gettext("Delete account"),
136
+ classes: "fw-dialog-button-link",
137
+ click: () => this.deleteAccount()
138
+ },
139
+ {
140
+ id: "submit-profile",
141
+ text: gettext("Confirm"),
142
+ classes: "fw-green fw-dialog-button-primary",
143
+ disabled: true,
144
+ click: () => this.save()
145
+ }
146
+ ]
147
+ });
148
+ this.dialog = dialog;
149
+ dialog.open();
150
+ this.dom = dialog.dialogEl.querySelector(".fw-dialog-content");
151
+ this.dialogTabs.bind(this.dom.querySelector("#profile-tabs"));
152
+ initFloatingLabels(this.dom);
153
+ this.dom.addEventListener("click", (event) => {
154
+ const el = {};
155
+ Object.entries(this.clickTargets).find(([selector, handler]) => {
156
+ if (findTarget(event, selector, el)) {
157
+ handler(el, event);
158
+ return true;
159
+ }
160
+ return false;
161
+ });
162
+ });
163
+ const markDirty = () => this.markDirty();
164
+ this.dom.addEventListener("input", markDirty);
165
+ this.dom.addEventListener("change", markDirty);
166
+ this.postRenderHandlers.forEach(handler => handler());
167
+ }
168
+ buildTabs() {
169
+ const settings = this.app.settings;
170
+ const tabs = [
171
+ {
172
+ id: "profile-tab-basics",
173
+ title: gettext("Basics"),
174
+ template: () => profileBasicsTemplate(this.user, settings)
175
+ },
176
+ {
177
+ id: "profile-tab-avatar",
178
+ title: gettext("Profile image"),
179
+ template: () => profileAvatarTemplate(this.user)
180
+ },
181
+ {
182
+ id: "profile-tab-emails",
183
+ title: gettext("Email address"),
184
+ template: () => profileEmailsTemplate(this.user)
185
+ },
186
+ {
187
+ id: "profile-tab-language",
188
+ title: gettext("Language"),
189
+ template: () => profileLanguageTemplate(this.user, settings)
190
+ },
191
+ {
192
+ id: "profile-tab-editor",
193
+ title: gettext("Editor"),
194
+ template: () => profileEditorTemplate(this.user)
195
+ }
196
+ ];
197
+ if (this.socialaccount_providers.length) {
198
+ tabs.push({
199
+ id: "profile-tab-social",
200
+ title: gettext("Social Account Providers"),
201
+ template: () => profileSocialAccountsTemplate(this.user, this.socialaccount_providers)
202
+ });
203
+ }
204
+ if (this.pluginTemplates.length) {
205
+ tabs.push({
206
+ id: "profile-tab-extensions",
207
+ title: gettext("Extensions"),
208
+ template: () => profilePluginTemplate(this.pluginTemplates)
209
+ });
210
+ }
211
+ return tabs;
212
+ }
213
+ /**
214
+ * Redraw the tab contents in place after a sub-dialog changed something
215
+ * (avatar, e-mail addresses, …), keeping the dialog open on the tab the
216
+ * user was looking at.
217
+ */
218
+ refreshContent() {
219
+ if (!this.dialog || !this.dialogTabs) {
220
+ return;
221
+ }
222
+ this.updateUserData();
223
+ this.dom.innerHTML = this.dialogTabs.render();
224
+ const tabsEl = this.dom.querySelector("#profile-tabs");
225
+ this.dialogTabs.bind(tabsEl);
226
+ if (this.activeTab) {
227
+ this.dialogTabs.showTab(this.activeTab, tabsEl);
228
+ }
229
+ initFloatingLabels(this.dom);
230
+ this.postRenderHandlers.forEach(handler => handler());
231
+ }
232
+ markDirty() {
233
+ if (this.dirty || !this.dialog) {
234
+ return;
235
+ }
236
+ this.dirty = true;
237
+ this.dialog.buttons.forEach(button => {
238
+ if (button.id === "submit-profile") {
239
+ button.disabled = false;
240
+ }
241
+ });
242
+ this.dialog.refreshButtons();
243
+ }
244
+ resetDirty() {
245
+ this.dirty = false;
246
+ if (!this.dialog) {
247
+ return;
248
+ }
249
+ this.dialog.buttons.forEach(button => {
250
+ if (button.id === "submit-profile") {
251
+ button.disabled = true;
252
+ }
253
+ });
254
+ this.dialog.refreshButtons();
255
+ }
256
+ deleteAccount() {
257
+ const dialog = new DeleteUserDialog(this.user.username, this.app);
258
+ dialog.init();
259
+ }
260
+ initTwoFactorSwitch() {
261
+ const host = this.dom.querySelector("#two-factor-switch-host");
262
+ if (!host) {
263
+ return;
264
+ }
265
+ this.twoFactorSwitch = new BooleanSwitch({
266
+ id: "setup-two-factor",
267
+ label: "",
268
+ checked: this.twoFactorEnabled,
269
+ onChange: (checked) => {
270
+ if (checked === this.twoFactorEnabled) {
271
+ return;
272
+ }
273
+ // The real enable/disable flows reload the page on success or
274
+ // leave the account state untouched on cancel; tie the switch
275
+ // back to the actual status while the dialog is open.
276
+ this.twoFactorSwitch.input.checked = this.twoFactorEnabled;
277
+ if (checked) {
278
+ import("../auth/two_factor.js").then(({ twoFactorSetupDialog }) => {
279
+ twoFactorSetupDialog(this.app);
280
+ });
281
+ }
282
+ else {
283
+ import("../auth/two_factor.js").then(({ twoFactorDisableDialog }) => {
284
+ twoFactorDisableDialog(this.app);
285
+ });
286
+ }
287
+ }
288
+ });
289
+ host.replaceChildren(this.twoFactorSwitch.element);
290
+ }
291
+ updateTwoFactorStatus() {
292
+ import("../auth/two_factor.js").then(({ checkTwoFactorStatus }) => {
293
+ checkTwoFactorStatus(this.app).then((enabled) => {
294
+ const enabledStatus = this.dom.querySelector("#two-factor-enabled-status");
295
+ const disabledStatus = this.dom.querySelector("#two-factor-disabled-status");
296
+ if (enabledStatus) {
297
+ enabledStatus.style.display = enabled ? "inline" : "none";
298
+ }
299
+ if (disabledStatus) {
300
+ disabledStatus.style.display = enabled ? "none" : "inline";
301
+ }
302
+ if (this.twoFactorSwitch) {
303
+ this.twoFactorSwitch.input.checked = enabled;
304
+ }
305
+ this.twoFactorEnabled = enabled;
306
+ });
307
+ });
308
+ }
309
+ updateE2EEPassphraseStatus() {
310
+ import("fwtoolkit/e2ee/passphrase-manager").then(({ PassphraseManager }) => {
311
+ PassphraseManager.hasEncryptionKeys().then((hasKeys) => {
312
+ const enabledStatus = this.dom.querySelector("#e2ee-passphrase-enabled-status");
313
+ const disabledStatus = this.dom.querySelector("#e2ee-passphrase-disabled-status");
314
+ const setupBtn = this.dom.querySelector("#setup-e2ee-passphrase");
315
+ const changeBtn = this.dom.querySelector("#change-e2ee-passphrase");
316
+ const recoverBtn = this.dom.querySelector("#recover-e2ee-passphrase");
317
+ if (hasKeys) {
318
+ enabledStatus.style.display = "inline";
319
+ disabledStatus.style.display = "none";
320
+ setupBtn.style.display = "none";
321
+ changeBtn.style.display = "inline";
322
+ recoverBtn.style.display = "inline";
323
+ }
324
+ else {
325
+ enabledStatus.style.display = "none";
326
+ disabledStatus.style.display = "inline";
327
+ setupBtn.style.display = "inline";
328
+ changeBtn.style.display = "none";
329
+ recoverBtn.style.display = "none";
330
+ }
331
+ });
332
+ });
333
+ }
334
+ async setupE2EEPassphrase() {
335
+ const { PassphraseManager } = await import("fwtoolkit/e2ee/passphrase-manager");
336
+ const { setupPassphraseDialog } = await import("fwtoolkit/e2ee/passphrase-dialog");
337
+ setupPassphraseDialog(async (passphrase) => {
338
+ try {
339
+ const { recoveryKey } = await PassphraseManager.setupEncryption(passphrase);
340
+ const { showRecoveryKeyDialog } = await import("fwtoolkit/e2ee/passphrase-dialog");
341
+ await showRecoveryKeyDialog(recoveryKey, () => { });
342
+ this.updateE2EEPassphraseStatus();
343
+ }
344
+ catch (e) {
345
+ addAlert("error", gettext("Failed to set up passphrase: ") + e.message);
346
+ }
347
+ });
348
+ }
349
+ async recoverE2EEPassphrase() {
350
+ const { PassphraseManager } = await import("fwtoolkit/e2ee/passphrase-manager");
351
+ const { recoverWithKeyDialog, showRecoveryKeyDialog } = await import("fwtoolkit/e2ee/passphrase-dialog");
352
+ const recoverResult = await new Promise(resolve => {
353
+ recoverWithKeyDialog(resolve);
354
+ });
355
+ if (!recoverResult) {
356
+ return;
357
+ }
358
+ try {
359
+ const { newRecoveryKey } = await PassphraseManager.recoverWithRecoveryKey(recoverResult.recoveryKey, recoverResult.newPassphrase, recoverResult.accountPassword);
360
+ await new Promise(resolve => {
361
+ showRecoveryKeyDialog(newRecoveryKey, resolve);
362
+ });
363
+ this.updateE2EEPassphraseStatus();
364
+ }
365
+ catch (e) {
366
+ addAlert("error", gettext("Recovery failed: ") + e.message);
367
+ }
368
+ }
369
+ async changeE2EEPassphrase() {
370
+ const { PassphraseManager } = await import("fwtoolkit/e2ee/passphrase-manager");
371
+ const { changePassphraseDialog } = await import("fwtoolkit/e2ee/passphrase-dialog");
372
+ const changeResult = await new Promise(resolve => {
373
+ changePassphraseDialog(resolve);
374
+ });
375
+ if (!changeResult) {
376
+ return;
377
+ }
378
+ try {
379
+ await PassphraseManager.changePassphrase(changeResult.oldPassphrase, changeResult.newPassphrase, changeResult.accountPassword);
380
+ addAlert("success", gettext("Passphrase changed successfully."));
381
+ }
382
+ catch (e) {
383
+ addAlert("error", gettext("Failed to change passphrase: ") + e.message);
384
+ }
385
+ }
386
+ save() {
387
+ activateWait();
388
+ const newLang = this.dom.querySelector("#language").value;
389
+ const inlineReferences = this.dom.querySelector("#inline-references").checked;
390
+ const inlineMath = this.dom.querySelector("#inline-math").checked;
391
+ const grammarCheckContinuous = this.dom.querySelector("#grammar-check-continuous").checked;
392
+ let languageChange = false;
393
+ return this.app.apiConnectors.userProfile
394
+ .save({
395
+ username: this.dom.querySelector("#username").value,
396
+ first_name: this.dom.querySelector("#first_name").value,
397
+ last_name: this.dom.querySelector("#last_name").value,
398
+ language: newLang
399
+ })
400
+ .catch(() => addAlert("error", gettext("Could not save profile data")))
401
+ .then(() => this.app.apiConnectors.userProfile.updatePreferences({
402
+ inline_references: inlineReferences,
403
+ inline_math: inlineMath,
404
+ grammar_check_continuous: grammarCheckContinuous
405
+ }))
406
+ .catch(() => addAlert("error", gettext("Could not save preferences")))
407
+ .then(() => {
408
+ deactivateWait();
409
+ return this.app.getConfiguration();
410
+ })
411
+ .then(() => {
412
+ const currentLang = document.documentElement.lang;
413
+ languageChange = currentLang !== newLang;
414
+ if (languageChange) {
415
+ window.location.reload();
416
+ return;
417
+ }
418
+ // Keep the dialog open (mirrors the old stay-on-page
419
+ // behaviour); only the header chrome and dirty state update.
420
+ refreshUserChrome(this.app);
421
+ this.updateUserData();
422
+ this.resetDirty();
423
+ addAlert("info", gettext("Profile saved."));
424
+ });
425
+ }
426
+ updateUserData() {
427
+ const configUser = this.app.user;
428
+ if (configUser) {
429
+ this.user = configUser;
430
+ }
431
+ }
432
+ close() {
433
+ this.dialog?.close();
434
+ }
435
+ }
436
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/user/profile/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,MAAM,EACN,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,kBAAkB,EACrB,MAAM,WAAW,CAAA;AAIlB,OAAO,EAAC,iBAAiB,EAAC,MAAM,2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;QACV,MAAM,UAAU,GAAI,IAAI,CAAC,GAAW,CAAC,IAEtB,CAAA;QACf,IAAI,UAAU,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QAC1B,CAAC;IACL,CAAC;IAED,KAAK;QACD,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAA;IACxB,CAAC;CACJ"}
@@ -1,12 +1,12 @@
1
1
  import type { FrontendApp } from "../../types.js";
2
- export declare const changeAvatarDialog: (app: FrontendApp) => void;
3
- export declare const deleteAvatarDialog: (app: FrontendApp) => void;
2
+ export declare const changeAvatarDialog: (app: FrontendApp, refresh?: () => void) => void;
3
+ export declare const deleteAvatarDialog: (app: FrontendApp, refresh?: () => void) => void;
4
4
  export declare const changePwdDialog: ({ username, app }: {
5
5
  username: string;
6
6
  app: FrontendApp;
7
7
  }) => void;
8
- export declare const addEmailDialog: (app: FrontendApp) => void;
9
- export declare const deleteEmailDialog: (target: HTMLElement, app: FrontendApp) => void;
10
- export declare const deleteSocialaccountDialog: (target: HTMLElement, app: FrontendApp) => void;
11
- export declare const changePrimaryEmailDialog: (app: FrontendApp) => void;
8
+ export declare const addEmailDialog: (app: FrontendApp, refresh?: () => void) => void;
9
+ export declare const deleteEmailDialog: (target: HTMLElement, app: FrontendApp, refresh?: () => void) => void;
10
+ export declare const deleteSocialaccountDialog: (target: HTMLElement, app: FrontendApp, refresh?: () => void) => void;
11
+ export declare const changePrimaryEmailDialog: (app: FrontendApp, refresh?: () => void) => void;
12
12
  //# sourceMappingURL=dialogs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../../src/user/profile/dialogs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAU/C,eAAO,MAAM,kBAAkB,QAAS,WAAW,KAAG,IA4DrD,CAAA;AAeD,eAAO,MAAM,kBAAkB,QAAS,WAAW,KAAG,IAoBrD,CAAA;AAED,eAAO,MAAM,eAAe,sBAAqB;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,WAAW,CAAA;CAAC,KAAG,IAgEvF,CAAA;AAED,eAAO,MAAM,cAAc,QAAS,WAAW,KAAG,IAsDjD,CAAA;AAED,eAAO,MAAM,iBAAiB,WAAY,WAAW,OAAO,WAAW,KAAG,IAuCzE,CAAA;AAED,eAAO,MAAM,yBAAyB,WAAY,WAAW,OAAO,WAAW,KAAG,IA2CjF,CAAA;AAED,eAAO,MAAM,wBAAwB,QAAS,WAAW,KAAG,IA2C3D,CAAA"}
1
+ {"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../../src/user/profile/dialogs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAqB/C,eAAO,MAAM,kBAAkB,QACtB,WAAW,YACN,MAAM,IAAI,KACrB,IA6DF,CAAA;AAgBD,eAAO,MAAM,kBAAkB,QACtB,WAAW,YACN,MAAM,IAAI,KACrB,IAoBF,CAAA;AAED,eAAO,MAAM,eAAe,sBAAqB;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,WAAW,CAAA;CAAC,KAAG,IAgEvF,CAAA;AAED,eAAO,MAAM,cAAc,QAClB,WAAW,YACN,MAAM,IAAI,KACrB,IAuDF,CAAA;AAED,eAAO,MAAM,iBAAiB,WAClB,WAAW,OACd,WAAW,YACN,MAAM,IAAI,KACrB,IAwCF,CAAA;AAED,eAAO,MAAM,yBAAyB,WAC1B,WAAW,OACd,WAAW,YACN,MAAM,IAAI,KACrB,IA4CF,CAAA;AAED,eAAO,MAAM,wBAAwB,QAC5B,WAAW,YACN,MAAM,IAAI,KACrB,IA4CF,CAAA"}
@@ -1,6 +1,16 @@
1
1
  import { Dialog, activateWait, addAlert, deactivateWait, escapeText } from "fwtoolkit";
2
2
  import { changeAvatarDialogTemplate, changeEmailDialogTemplate, changePrimaryEmailDialogTemplate, changePwdDialogTemplate, confirmDeleteAvatarTemplate, deleteEmailDialogTemplate } from "./templates.js";
3
- export const changeAvatarDialog = (app) => {
3
+ /**
4
+ * Sub-dialogs of the profile dialog.
5
+ *
6
+ * `refresh` redraws the profile UI after a successful change. When the dialog
7
+ * is hosted by a {@link ProfileDialog} it passes its own in-place re-render so
8
+ * the dialog (and the active tab) survives; hosts without a profile dialog fall
9
+ * back to re-selecting the current page.
10
+ */
11
+ const pageRefresh = (app, refresh) => refresh || (() => app.selectPage());
12
+ export const changeAvatarDialog = (app, refresh) => {
13
+ const redraw = pageRefresh(app, refresh);
4
14
  const buttons = [
5
15
  {
6
16
  text: gettext("Upload"),
@@ -19,7 +29,7 @@ export const changeAvatarDialog = (app) => {
19
29
  })
20
30
  .then(() => deactivateWait())
21
31
  .then(() => app.getConfiguration())
22
- .then(() => app.selectPage())
32
+ .then(() => redraw())
23
33
  .catch(() => {
24
34
  deactivateWait();
25
35
  addAlert("error", gettext("Could not update profile avatar"));
@@ -55,24 +65,25 @@ export const changeAvatarDialog = (app) => {
55
65
  });
56
66
  }
57
67
  };
58
- const deleteAvatar = (app) => {
68
+ const deleteAvatar = (app, refresh) => {
69
+ const redraw = pageRefresh(app, refresh);
59
70
  activateWait();
60
71
  app.apiConnectors.userProfile.avatarDelete()
61
72
  .then(() => deactivateWait())
62
73
  .then(() => app.getConfiguration())
63
- .then(() => app.selectPage())
74
+ .then(() => redraw())
64
75
  .catch(() => {
65
76
  deactivateWait();
66
77
  addAlert("error", gettext("Could not delete avatar"));
67
78
  });
68
79
  };
69
- export const deleteAvatarDialog = (app) => {
80
+ export const deleteAvatarDialog = (app, refresh) => {
70
81
  const buttons = [
71
82
  {
72
83
  text: gettext("Delete"),
73
84
  classes: "fw-dark",
74
85
  click: () => {
75
- deleteAvatar(app);
86
+ deleteAvatar(app, refresh);
76
87
  dialog.close();
77
88
  }
78
89
  },
@@ -152,7 +163,8 @@ export const changePwdDialog = ({ username, app }) => {
152
163
  });
153
164
  dialog.open();
154
165
  };
155
- export const addEmailDialog = (app) => {
166
+ export const addEmailDialog = (app, refresh) => {
167
+ const redraw = pageRefresh(app, refresh);
156
168
  const buttons = [
157
169
  {
158
170
  text: gettext("Submit"),
@@ -177,7 +189,7 @@ export const addEmailDialog = (app) => {
177
189
  dialog.close();
178
190
  return app
179
191
  .getConfiguration()
180
- .then(() => app.selectPage())
192
+ .then(() => redraw())
181
193
  .then(() => addAlert("info", `${gettext("Confirmation e-mail sent to")}: ${email}`));
182
194
  }
183
195
  if (errorEl)
@@ -201,8 +213,9 @@ export const addEmailDialog = (app) => {
201
213
  });
202
214
  dialog.open();
203
215
  };
204
- export const deleteEmailDialog = (target, app) => {
216
+ export const deleteEmailDialog = (target, app, refresh) => {
205
217
  const email = target.dataset.email;
218
+ const redraw = pageRefresh(app, refresh);
206
219
  const buttons = [
207
220
  {
208
221
  text: gettext("Remove"),
@@ -215,7 +228,7 @@ export const deleteEmailDialog = (target, app) => {
215
228
  deactivateWait();
216
229
  })
217
230
  .then(() => app.getConfiguration())
218
- .then(() => app.selectPage())
231
+ .then(() => redraw())
219
232
  .then(() => addAlert("info", gettext("Email successfully deleted!")))
220
233
  .catch(() => {
221
234
  deactivateWait();
@@ -236,9 +249,10 @@ export const deleteEmailDialog = (target, app) => {
236
249
  });
237
250
  dialog.open();
238
251
  };
239
- export const deleteSocialaccountDialog = (target, app) => {
252
+ export const deleteSocialaccountDialog = (target, app, refresh) => {
240
253
  const socialaccount = Number.parseInt(target.dataset.socialaccount);
241
254
  const provider = target.dataset.provider;
255
+ const redraw = pageRefresh(app, refresh);
242
256
  const buttons = [
243
257
  {
244
258
  text: gettext("Remove"),
@@ -251,7 +265,7 @@ export const deleteSocialaccountDialog = (target, app) => {
251
265
  deactivateWait();
252
266
  })
253
267
  .then(() => app.getConfiguration())
254
- .then(() => app.selectPage())
268
+ .then(() => redraw())
255
269
  .then(() => addAlert("info", `${escapeText(provider)} ${gettext("account successfully deleted!")}`))
256
270
  .catch(() => {
257
271
  deactivateWait();
@@ -272,9 +286,10 @@ export const deleteSocialaccountDialog = (target, app) => {
272
286
  });
273
287
  dialog.open();
274
288
  };
275
- export const changePrimaryEmailDialog = (app) => {
289
+ export const changePrimaryEmailDialog = (app, refresh) => {
276
290
  const primEmailRadio = document.querySelector(".primary-email-radio:checked");
277
291
  const email = primEmailRadio.value;
292
+ const redraw = pageRefresh(app, refresh);
278
293
  const buttons = [
279
294
  {
280
295
  text: gettext("Submit"),
@@ -287,7 +302,7 @@ export const changePrimaryEmailDialog = (app) => {
287
302
  deactivateWait();
288
303
  return app.getConfiguration();
289
304
  })
290
- .then(() => app.selectPage())
305
+ .then(() => redraw())
291
306
  .then(() => addAlert("info", gettext("The primary email has been updated.")))
292
307
  .catch((_error) => {
293
308
  deactivateWait();