@fiduswriter/frontend 0.1.24 → 0.1.26
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/dist/api/index.d.ts +9 -3
- package/dist/api/index.d.ts.map +1 -1
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +10 -4
- package/dist/app/index.js.map +1 -1
- package/dist/document_templates/editor.js +1 -1
- package/dist/document_templates/editor.js.map +1 -1
- package/dist/document_templates/overview.js +1 -1
- package/dist/document_templates/overview.js.map +1 -1
- package/dist/documents/overview/index.js +1 -1
- package/dist/documents/overview/index.js.map +1 -1
- package/dist/documents/overview/menu.d.ts.map +1 -1
- package/dist/documents/overview/menu.js +6 -2
- package/dist/documents/overview/menu.js.map +1 -1
- package/dist/feedback/index.d.ts +2 -1
- package/dist/feedback/index.d.ts.map +1 -1
- package/dist/feedback/index.js +7 -4
- package/dist/feedback/index.js.map +1 -1
- package/dist/indexed_db/index.d.ts +1 -1
- package/dist/indexed_db/index.d.ts.map +1 -1
- package/dist/indexed_db/index.js +23 -8
- package/dist/indexed_db/index.js.map +1 -1
- package/dist/menu/index.js +5 -2
- package/dist/menu/index.js.map +1 -1
- package/dist/prelogin/index.js +1 -1
- package/dist/prelogin/index.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/user/auth/password_reset_change.d.ts +2 -2
- package/dist/user/auth/password_reset_change.d.ts.map +1 -1
- package/dist/user/auth/password_reset_change.js +6 -6
- package/dist/user/auth/password_reset_change.js.map +1 -1
- package/dist/user/contacts/index.js +1 -1
- package/dist/user/contacts/index.js.map +1 -1
- package/dist/user/profile/delete_user.d.ts +2 -1
- package/dist/user/profile/delete_user.d.ts.map +1 -1
- package/dist/user/profile/delete_user.js +7 -3
- package/dist/user/profile/delete_user.js.map +1 -1
- package/dist/user/profile/index.d.ts.map +1 -1
- package/dist/user/profile/index.js +2 -2
- package/dist/user/profile/index.js.map +1 -1
- package/package.json +2 -2
- package/src/api/index.ts +9 -1
- package/src/app/index.ts +9 -4
- package/src/document_templates/editor.ts +1 -1
- package/src/document_templates/overview.ts +1 -1
- package/src/documents/overview/index.ts +1 -1
- package/src/documents/overview/menu.ts +7 -2
- package/src/feedback/index.ts +7 -4
- package/src/indexed_db/index.ts +29 -8
- package/src/menu/index.ts +8 -8
- package/src/prelogin/index.ts +1 -1
- package/src/types.ts +1 -0
- package/src/user/auth/password_reset_change.ts +11 -7
- package/src/user/contacts/index.ts +1 -1
- package/src/user/profile/delete_user.ts +8 -4
- package/src/user/profile/index.ts +3 -2
package/src/feedback/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ensureCSS
|
|
1
|
+
import {ensureCSS} from "fwtoolkit"
|
|
2
2
|
|
|
3
3
|
// Creates the feedback tab. The tab is meant for user feedback to the developers while FW is still in
|
|
4
4
|
// a somewhat early stage. It is included in a way so it's easy to remove from all the templates.
|
|
@@ -6,9 +6,11 @@ import {ensureCSS, post} from "fwtoolkit"
|
|
|
6
6
|
|
|
7
7
|
export class FeedbackTab {
|
|
8
8
|
previousActiveElement: HTMLElement | null
|
|
9
|
+
app: any
|
|
9
10
|
|
|
10
|
-
constructor() {
|
|
11
|
+
constructor(app?: any) {
|
|
11
12
|
this.previousActiveElement = null
|
|
13
|
+
this.app = app
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
init(): void {
|
|
@@ -114,13 +116,14 @@ export class FeedbackTab {
|
|
|
114
116
|
closeFeedbackEl.style.display = "none"
|
|
115
117
|
feedbackFormEl.style.visibility = "hidden"
|
|
116
118
|
|
|
117
|
-
|
|
119
|
+
;(this.app as any).apiConnectors.feedback
|
|
120
|
+
.send({message: messageEl.value})
|
|
118
121
|
.then(() => {
|
|
119
122
|
messageEl.value = ""
|
|
120
123
|
closeFeedbackEl.style.display = "block"
|
|
121
124
|
responseEl.style.display = "block"
|
|
122
125
|
})
|
|
123
|
-
.catch(_error => {
|
|
126
|
+
.catch((_error: Error) => {
|
|
124
127
|
messageEl.value = ""
|
|
125
128
|
closeFeedbackEl.style.display = "block"
|
|
126
129
|
})
|
package/src/indexed_db/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Changing this number will make clients flush their database.
|
|
2
|
-
const DB_VERSION =
|
|
2
|
+
const DB_VERSION = 5
|
|
3
3
|
|
|
4
4
|
interface DbTableProperties {
|
|
5
5
|
keyPath?: string
|
|
@@ -62,19 +62,40 @@ export class IndexedDB {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
updateData(
|
|
65
|
+
updateData(
|
|
66
|
+
objectStoreName: string,
|
|
67
|
+
data: Record<string, unknown>,
|
|
68
|
+
retry: boolean = true
|
|
69
|
+
): void {
|
|
66
70
|
const request = window.indexedDB.open(this.dbName, DB_VERSION)
|
|
67
71
|
request.onerror = (event: Event) => {
|
|
68
|
-
this.reset(event).then(() => this.updateData(objectStoreName, data))
|
|
72
|
+
this.reset(event).then(() => this.updateData(objectStoreName, data, false))
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
request.onsuccess = (event: Event) => {
|
|
72
76
|
const db = (event.target as IDBOpenDBRequest).result
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
try {
|
|
78
|
+
const objectStore = db
|
|
79
|
+
.transaction(objectStoreName, "readwrite")
|
|
80
|
+
.objectStore(objectStoreName)
|
|
81
|
+
for (const d in data) {
|
|
82
|
+
objectStore.put(d)
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
// Before resetting IndexedDB make sure to close connections to
|
|
86
|
+
// avoid blocking the delete IndexedDB process
|
|
87
|
+
db.close()
|
|
88
|
+
if (
|
|
89
|
+
retry &&
|
|
90
|
+
error instanceof DOMException &&
|
|
91
|
+
error.name === "NotFoundError"
|
|
92
|
+
) {
|
|
93
|
+
this.reset().then(() =>
|
|
94
|
+
this.updateData(objectStoreName, data, false)
|
|
95
|
+
)
|
|
96
|
+
} else {
|
|
97
|
+
throw error
|
|
98
|
+
}
|
|
78
99
|
}
|
|
79
100
|
}
|
|
80
101
|
|
package/src/menu/index.ts
CHANGED
|
@@ -209,14 +209,14 @@ export class SiteMenu implements SiteMenuLike {
|
|
|
209
209
|
sessionStorage.removeItem(key)
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
)
|
|
212
|
+
;(this.app.apiConnectors as any).auth
|
|
213
|
+
.logout()
|
|
214
|
+
.then(() => {
|
|
215
|
+
window.location.href =
|
|
216
|
+
this.app.routes[""].app === "document"
|
|
217
|
+
? "/"
|
|
218
|
+
: "/documents/"
|
|
219
|
+
})
|
|
220
220
|
break
|
|
221
221
|
}
|
|
222
222
|
}
|
package/src/prelogin/index.ts
CHANGED
|
@@ -169,7 +169,7 @@ export class PreloginPage {
|
|
|
169
169
|
document.body = this.dom
|
|
170
170
|
ensureCSS([staticUrl("css/prelogin.css")])
|
|
171
171
|
setDocTitle(this.title, this.app)
|
|
172
|
-
const feedbackTab = new FeedbackTab()
|
|
172
|
+
const feedbackTab = new FeedbackTab(this.app)
|
|
173
173
|
feedbackTab.init()
|
|
174
174
|
}
|
|
175
175
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {escapeText
|
|
1
|
+
import {escapeText} from "fwtoolkit"
|
|
2
2
|
import {PreloginPage} from "../../prelogin/index.js"
|
|
3
3
|
|
|
4
4
|
export class PasswordResetChangePassword extends PreloginPage {
|
|
5
|
-
key: string
|
|
5
|
+
key: string
|
|
6
6
|
|
|
7
|
-
constructor({app, language}: {app: any; language: string}, key: string
|
|
7
|
+
constructor({app, language}: {app: any; language: string}, key: string) {
|
|
8
8
|
super({app, language})
|
|
9
9
|
this.title = gettext("Change Password")
|
|
10
10
|
this.key = key
|
|
@@ -76,10 +76,14 @@ export class PasswordResetChangePassword extends PreloginPage {
|
|
|
76
76
|
if (errors) {
|
|
77
77
|
return
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
;(this.app as any).apiConnectors.auth
|
|
80
|
+
.passwordResetKeyGet(this.key)
|
|
81
|
+
.then(({url}: {url: string}) =>
|
|
82
|
+
(this.app as any).apiConnectors.auth.passwordResetKeyPost(
|
|
83
|
+
url,
|
|
84
|
+
{password1, password2}
|
|
85
|
+
)
|
|
86
|
+
)
|
|
83
87
|
.then(() => {
|
|
84
88
|
if (document.body !== this.dom) {
|
|
85
89
|
return
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {Dialog, activateWait, addAlert, deactivateWait
|
|
1
|
+
import {Dialog, activateWait, addAlert, deactivateWait} from "fwtoolkit"
|
|
2
2
|
import {deleteUserDialogTemplate} from "./templates.js"
|
|
3
3
|
|
|
4
4
|
export class DeleteUserDialog {
|
|
5
5
|
username: string
|
|
6
|
+
app: any
|
|
6
7
|
dialog: any
|
|
7
8
|
|
|
8
|
-
constructor(username: string) {
|
|
9
|
+
constructor(username: string, app: any) {
|
|
9
10
|
this.username = username
|
|
11
|
+
this.app = app
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
init(): void {
|
|
@@ -45,8 +47,10 @@ export class DeleteUserDialog {
|
|
|
45
47
|
deleteCurrentUser(password: string): void {
|
|
46
48
|
activateWait()
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
this.app.apiConnectors.userProfile
|
|
51
|
+
.deleteUser({password})
|
|
52
|
+
.then((response: Response) => {
|
|
53
|
+
switch (response.status) {
|
|
50
54
|
case 200:
|
|
51
55
|
window.location.href = "/"
|
|
52
56
|
break
|
|
@@ -53,7 +53,8 @@ export class Profile {
|
|
|
53
53
|
changePwdDialog({username: this.user.username, app: this.app}),
|
|
54
54
|
"#delete-account": (_el, _event) => {
|
|
55
55
|
const dialog = new DeleteUserDialog(
|
|
56
|
-
(this.dom.querySelector("#delete-account") as HTMLElement).dataset.username
|
|
56
|
+
(this.dom.querySelector("#delete-account") as HTMLElement).dataset.username!,
|
|
57
|
+
this.app
|
|
57
58
|
)
|
|
58
59
|
dialog.init()
|
|
59
60
|
},
|
|
@@ -175,7 +176,7 @@ export class Profile {
|
|
|
175
176
|
])
|
|
176
177
|
|
|
177
178
|
setDocTitle(gettext("Configure profile"), this.app)
|
|
178
|
-
const feedbackTab = new FeedbackTab()
|
|
179
|
+
const feedbackTab = new FeedbackTab(this.app)
|
|
179
180
|
feedbackTab.init()
|
|
180
181
|
}
|
|
181
182
|
|