@panomc/theme-core 1.0.0-dev.39
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/bin/bundle-internal-libs.js +104 -0
- package/bin/check.js +253 -0
- package/bin/generate-licenses.js +125 -0
- package/bin/generate-runtime-shims.js +180 -0
- package/bin/license/file-fingerprint.js +74 -0
- package/bin/license/finalize-fingerprint.js +72 -0
- package/bin/license/generate-license-constants.js +335 -0
- package/bin/new.js +281 -0
- package/bin/package-zip.js +57 -0
- package/bin/sync.js +326 -0
- package/bin/templates/app.html +59 -0
- package/bin/theme-core.js +103 -0
- package/package.json +77 -0
- package/src/index.js +15 -0
- package/src/kit/hooks-client.js +128 -0
- package/src/kit/hooks-server.js +319 -0
- package/src/kit/license-runtime.js +373 -0
- package/src/kit/resolve.js +71 -0
- package/src/kit/specifiers.js +62 -0
- package/src/kit/svelte-config.js +74 -0
- package/src/kit/vite-config.js +249 -0
- package/src/lib/NotificationManager.js +1 -0
- package/src/lib/PluginAPI.js +368 -0
- package/src/lib/PluginManager.js +1 -0
- package/src/lib/Store.js +43 -0
- package/src/lib/api.util.js +5 -0
- package/src/lib/auth.util.js +77 -0
- package/src/lib/components/App.svelte +10 -0
- package/src/lib/components/Breadcrumb.svelte +88 -0
- package/src/lib/components/CardHeader.svelte +42 -0
- package/src/lib/components/Date.svelte +34 -0
- package/src/lib/components/DefaultToast.svelte +11 -0
- package/src/lib/components/ErrorAlert.svelte +16 -0
- package/src/lib/components/Footer.svelte +223 -0
- package/src/lib/components/Header.svelte +122 -0
- package/src/lib/components/Hook.svelte +71 -0
- package/src/lib/components/LinkCodeInput.svelte +129 -0
- package/src/lib/components/LoginFormBody.svelte +90 -0
- package/src/lib/components/Main.svelte +76 -0
- package/src/lib/components/Navbar.svelte +462 -0
- package/src/lib/components/NoContent.svelte +14 -0
- package/src/lib/components/NotificationContainer.svelte +304 -0
- package/src/lib/components/OnlineAdmins.svelte +64 -0
- package/src/lib/components/PageActions.svelte +39 -0
- package/src/lib/components/PageTitle.svelte +36 -0
- package/src/lib/components/Pagination.svelte +65 -0
- package/src/lib/components/PlayerHead.svelte +58 -0
- package/src/lib/components/PlayerPermissionBadge.svelte +19 -0
- package/src/lib/components/PlayerStatusBadge.svelte +63 -0
- package/src/lib/components/Post.svelte +240 -0
- package/src/lib/components/Posts.svelte +19 -0
- package/src/lib/components/RegisterForm.svelte +125 -0
- package/src/lib/components/Sidebar.svelte +12 -0
- package/src/lib/components/SuccessAlert.svelte +14 -0
- package/src/lib/components/TicketRow.svelte +61 -0
- package/src/lib/components/TicketStatus.svelte +24 -0
- package/src/lib/components/Tickets.svelte +43 -0
- package/src/lib/components/Toast.svelte +13 -0
- package/src/lib/components/ToastContainer.svelte +83 -0
- package/src/lib/components/ViewComponent.svelte +8 -0
- package/src/lib/components/modals/CloseTicketConfirmModal.svelte +121 -0
- package/src/lib/components/modals/ConfirmRemoveAllNotificationsModal.svelte +93 -0
- package/src/lib/components/modals/LogoutSessionConfirmModal.svelte +61 -0
- package/src/lib/components/sidebars/HomeSidebar.svelte +333 -0
- package/src/lib/components/sidebars/PlayerDetailSidebar.svelte +124 -0
- package/src/lib/components/sidebars/ProfileSidebar.svelte +149 -0
- package/src/lib/components/sidebars/SupportSidebar.svelte +54 -0
- package/src/lib/components/sidebars/TicketCreateAndDetailSidebar.svelte +84 -0
- package/src/lib/csrf.js +5 -0
- package/src/lib/init.libs.js +2 -0
- package/src/lib/language.util.js +154 -0
- package/src/lib/layouts/AppLayout.svelte +59 -0
- package/src/lib/layouts/AuthLayout.svelte +29 -0
- package/src/lib/layouts/MainLayout.svelte +60 -0
- package/src/lib/layouts/ProfileLayout.svelte +29 -0
- package/src/lib/layouts/ThemeSettingsLayout.svelte +37 -0
- package/src/lib/layouts/TicketsLayout.svelte +31 -0
- package/src/lib/loginInput.util.js +4 -0
- package/src/lib/orderNavLinks.util.js +58 -0
- package/src/lib/pages/ActivateEmailPage.svelte +48 -0
- package/src/lib/pages/ConfirmNewEmailPage.svelte +48 -0
- package/src/lib/pages/ErrorPage.svelte +41 -0
- package/src/lib/pages/HomePage.svelte +35 -0
- package/src/lib/pages/LoginPage.svelte +448 -0
- package/src/lib/pages/NotificationsPage.svelte +70 -0
- package/src/lib/pages/PlayerDetailPage.svelte +29 -0
- package/src/lib/pages/PostDetailPage.svelte +36 -0
- package/src/lib/pages/PreviewPostPage.svelte +38 -0
- package/src/lib/pages/RegisterPage.svelte +144 -0
- package/src/lib/pages/RenewPasswordPage.svelte +49 -0
- package/src/lib/pages/ResetPasswordPage.svelte +55 -0
- package/src/lib/pages/RulesPage.svelte +52 -0
- package/src/lib/pages/SupportPage.svelte +36 -0
- package/src/lib/pages/ThemeSettingsPage.svelte +551 -0
- package/src/lib/pages/profile/ProfilePage.svelte +32 -0
- package/src/lib/pages/profile/SettingsPage.svelte +163 -0
- package/src/lib/pages/profile/TicketsPage.svelte +54 -0
- package/src/lib/pages/ticket/CreateTicketPage.svelte +48 -0
- package/src/lib/pages/ticket/TicketDetailPage.svelte +59 -0
- package/src/lib/services/auth.js +85 -0
- package/src/lib/services/posts.js +152 -0
- package/src/lib/services/profile.js +37 -0
- package/src/lib/services/theme-setting.js +22 -0
- package/src/lib/services/tickets.js +95 -0
- package/src/lib/siteRealtime.js +244 -0
- package/src/lib/string.util.js +27 -0
- package/src/lib/tooltip.util.js +5 -0
- package/src/lib/ui-logics/layout-logics/AppLayoutLogics.js +321 -0
- package/src/lib/ui-logics/layout-logics/AuthLayoutLogics.js +10 -0
- package/src/lib/ui-logics/layout-logics/MainLayoutLogics.js +19 -0
- package/src/lib/ui-logics/layout-logics/ProfileLayoutLogics.js +10 -0
- package/src/lib/ui-logics/layout-logics/ThemeSettingsLayoutLogics.js +215 -0
- package/src/lib/ui-logics/layout-logics/TicketsLayoutLogics.js +10 -0
- package/src/lib/ui-logics/page-logics/ActiveEmailPageLogics.js +45 -0
- package/src/lib/ui-logics/page-logics/ConfirmNewEmailPageLogics.js +42 -0
- package/src/lib/ui-logics/page-logics/CreateTicketPageLogics.js +83 -0
- package/src/lib/ui-logics/page-logics/HomePageLogics.js +65 -0
- package/src/lib/ui-logics/page-logics/NotificationsPageLogics.js +264 -0
- package/src/lib/ui-logics/page-logics/PlayerDetailPageLogics.js +40 -0
- package/src/lib/ui-logics/page-logics/PostDetailPageLogics.js +58 -0
- package/src/lib/ui-logics/page-logics/PreviewPostPageLogics.js +53 -0
- package/src/lib/ui-logics/page-logics/ProfilePageLogics.js +44 -0
- package/src/lib/ui-logics/page-logics/RenewPasswordPageLogics.js +44 -0
- package/src/lib/ui-logics/page-logics/ResetPasswordPageLogics.js +53 -0
- package/src/lib/ui-logics/page-logics/SettingsPageLogics.js +230 -0
- package/src/lib/ui-logics/page-logics/SupportPageLogics.js +60 -0
- package/src/lib/ui-logics/page-logics/TicketDetailPageLogics.js +160 -0
- package/src/lib/ui-logics/page-logics/TicketsPageLogics.js +132 -0
- package/src/lib/variables.js +1 -0
- package/src/lib/views/ActivateEmailView.svelte +71 -0
- package/src/lib/views/AppLayoutView.svelte +31 -0
- package/src/lib/views/AuthLayoutView.svelte +23 -0
- package/src/lib/views/ConfirmNewEmailView.svelte +71 -0
- package/src/lib/views/CreateTicketView.svelte +73 -0
- package/src/lib/views/ErrorView.svelte +38 -0
- package/src/lib/views/HomeView.svelte +72 -0
- package/src/lib/views/LoginView.svelte +372 -0
- package/src/lib/views/MainLayoutView.svelte +86 -0
- package/src/lib/views/NotificationsView.svelte +129 -0
- package/src/lib/views/PlayerDetailView.svelte +31 -0
- package/src/lib/views/PostDetailView.svelte +199 -0
- package/src/lib/views/PreviewPostView.svelte +151 -0
- package/src/lib/views/ProfileLayoutView.svelte +16 -0
- package/src/lib/views/ProfileView.svelte +68 -0
- package/src/lib/views/RegisterView.svelte +113 -0
- package/src/lib/views/RenewPasswordView.svelte +98 -0
- package/src/lib/views/ResetPasswordView.svelte +88 -0
- package/src/lib/views/RulesView.svelte +26 -0
- package/src/lib/views/SettingsView.svelte +471 -0
- package/src/lib/views/SupportView.svelte +79 -0
- package/src/lib/views/ThemeSettingsLayoutView.svelte +19 -0
- package/src/lib/views/ThemeSettingsView.svelte +1508 -0
- package/src/lib/views/TicketDetailView.svelte +185 -0
- package/src/lib/views/TicketsLayoutView.svelte +21 -0
- package/src/lib/views/TicketsView.svelte +87 -0
- package/src/plugin-engine/engine.js +484 -0
- package/src/registry/index.js +86 -0
- package/src/routes/RootLayout.svelte +21 -0
- package/src/routes/plugin-ui/Layout.svelte +291 -0
- package/src/routes/plugin-ui/Page.svelte +117 -0
- package/src/routes/plugin-ui/layout.js +8 -0
- package/src/routes/plugin-ui/page.js +8 -0
- package/src/routes/plugins-client-file.js +76 -0
- package/src/routes/root-layout-load.js +15 -0
- package/src/routes/theme-api-languages.js +52 -0
- package/src/routes/theme-api-licenses.js +28 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { get, writable } from "svelte/store";
|
|
2
|
+
|
|
3
|
+
import { sendChangeEmail, sendResetPassword, sendUpdateProfile } from "$pano/lib/services/profile";
|
|
4
|
+
|
|
5
|
+
import ApiUtil, { NETWORK_ERROR } from "$pano/lib/api.util";
|
|
6
|
+
import { executeLifecycle, executeViewLoad, panoApiServer } from "$pano/lib/PluginAPI";
|
|
7
|
+
|
|
8
|
+
import ProfileSidebar, { load as loadSidebar } from "$pano/lib/components/sidebars/ProfileSidebar.svelte";
|
|
9
|
+
import { changeLanguage, getLanguageByLocale } from "$pano/lib/language.util.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @type {import("@sveltejs/kit").Load}
|
|
13
|
+
*/
|
|
14
|
+
export async function processLoad(event) {
|
|
15
|
+
const { parent } = event;
|
|
16
|
+
await parent();
|
|
17
|
+
|
|
18
|
+
// Initialize settings content
|
|
19
|
+
panoApiServer.ui.settings.content.edit((items) => {
|
|
20
|
+
items.push(
|
|
21
|
+
{ id: "settings-cards", priority: 300, hidden: false },
|
|
22
|
+
{ id: "sessions-card", priority: 100, hidden: false }
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Initialize settings card rows
|
|
27
|
+
panoApiServer.ui.settings.cardRows.edit((items) => {
|
|
28
|
+
items.push(
|
|
29
|
+
{ id: "change-password", priority: 100, hidden: false },
|
|
30
|
+
{ id: "change-email", priority: 90, hidden: false },
|
|
31
|
+
{ id: "display-language", priority: 80, hidden: false },
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
await executeLifecycle("theme:settings:load", {}, event);
|
|
36
|
+
|
|
37
|
+
// View loads, sidebar, and sessions API call are all independent — run in parallel
|
|
38
|
+
const [, , , sessionsBody] = await Promise.all([
|
|
39
|
+
executeViewLoad("settings-content", event),
|
|
40
|
+
executeViewLoad("settings-card-rows", event),
|
|
41
|
+
loadSidebar(event),
|
|
42
|
+
ApiUtil.get({ path: "/api/profile/sessions", request: event })
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
const sessions = !sessionsBody.error ? sessionsBody.sessions : [];
|
|
46
|
+
|
|
47
|
+
return { sidebar: ProfileSidebar, sessions, pageTitle: "pages.settings.title" };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function sendResetPasswordLink(
|
|
51
|
+
resetPasswordError,
|
|
52
|
+
resetPasswordLoading,
|
|
53
|
+
resetPasswordSuccess,
|
|
54
|
+
) {
|
|
55
|
+
resetPasswordError.set(null);
|
|
56
|
+
resetPasswordLoading.set(true);
|
|
57
|
+
resetPasswordSuccess.set(false);
|
|
58
|
+
|
|
59
|
+
await sendResetPassword()
|
|
60
|
+
.then((body) => {
|
|
61
|
+
resetPasswordLoading.set(false);
|
|
62
|
+
|
|
63
|
+
if (body.result === "ok") {
|
|
64
|
+
resetPasswordSuccess.set(true);
|
|
65
|
+
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
resetPasswordError.set(body.error || NETWORK_ERROR);
|
|
70
|
+
})
|
|
71
|
+
.catch(() => {
|
|
72
|
+
resetPasswordLoading.set(false);
|
|
73
|
+
resetPasswordError.set(NETWORK_ERROR);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function sendChangeEmailLink(
|
|
78
|
+
changingEmailError,
|
|
79
|
+
changingEmailLoading,
|
|
80
|
+
changingEmailSuccess,
|
|
81
|
+
currentPassword,
|
|
82
|
+
newEmail,
|
|
83
|
+
changingEmail,
|
|
84
|
+
changingEmail2ndStep
|
|
85
|
+
) {
|
|
86
|
+
const next = get(newEmail);
|
|
87
|
+
if (next == null || String(next).trim() === "") {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
changingEmailError.set(null);
|
|
92
|
+
changingEmailLoading.set(true);
|
|
93
|
+
changingEmailSuccess.set(false);
|
|
94
|
+
|
|
95
|
+
await sendChangeEmail(get(currentPassword), get(newEmail))
|
|
96
|
+
.then((body) => {
|
|
97
|
+
changingEmailLoading.set(false);
|
|
98
|
+
|
|
99
|
+
if (body.result === "ok") {
|
|
100
|
+
changingEmail.set(false);
|
|
101
|
+
changingEmail2ndStep.set(false);
|
|
102
|
+
|
|
103
|
+
changingEmailSuccess.set(true);
|
|
104
|
+
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const err = body.error || NETWORK_ERROR;
|
|
109
|
+
if (err === "CURRENT_PASSWORD_NOT_CORRECT") {
|
|
110
|
+
changingEmail2ndStep.set(false);
|
|
111
|
+
}
|
|
112
|
+
changingEmailError.set(err);
|
|
113
|
+
})
|
|
114
|
+
.catch(() => {
|
|
115
|
+
changingEmailLoading.set(false);
|
|
116
|
+
|
|
117
|
+
changingEmailError.set(NETWORK_ERROR);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function startChangingEmail(changingEmail, changingEmailError) {
|
|
122
|
+
changingEmailError.set(null);
|
|
123
|
+
changingEmail.set(true);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function startChangingEmail2ndStep(
|
|
127
|
+
changingEmail2ndStep,
|
|
128
|
+
currentPassword,
|
|
129
|
+
changingEmailError
|
|
130
|
+
) {
|
|
131
|
+
const pwd = get(currentPassword);
|
|
132
|
+
if (pwd == null || String(pwd).trim() === "") {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
changingEmailError.set(null);
|
|
136
|
+
changingEmail2ndStep.set(true);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function stopChangingEmail(
|
|
140
|
+
currentPassword,
|
|
141
|
+
newEmail,
|
|
142
|
+
changingEmail,
|
|
143
|
+
changingEmail2ndStep,
|
|
144
|
+
changingEmailError
|
|
145
|
+
) {
|
|
146
|
+
currentPassword.set("");
|
|
147
|
+
newEmail.set("");
|
|
148
|
+
changingEmailError.set(null);
|
|
149
|
+
changingEmail2ndStep.set(false);
|
|
150
|
+
changingEmail.set(false);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function stopChangingEmail2ndStep(
|
|
154
|
+
changingEmail2ndStep,
|
|
155
|
+
changingEmailError
|
|
156
|
+
) {
|
|
157
|
+
changingEmail2ndStep.set(false);
|
|
158
|
+
changingEmailError.set(null);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export async function saveSettings(userLocale, saveButtonLoading) {
|
|
162
|
+
saveButtonLoading.set(true)
|
|
163
|
+
|
|
164
|
+
await sendUpdateProfile({ localeCode: get(userLocale) }).then((body) => {
|
|
165
|
+
if (body.error) {
|
|
166
|
+
location.reload();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
changeLanguage(getLanguageByLocale(get(userLocale)))
|
|
171
|
+
saveButtonLoading.set(false)
|
|
172
|
+
}).catch(() => {
|
|
173
|
+
location.reload();
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export async function onLogoutSession(sessionId, loadingSessionId, showToast, invalidateAll) {
|
|
178
|
+
loadingSessionId.set(sessionId);
|
|
179
|
+
|
|
180
|
+
ApiUtil.delete({
|
|
181
|
+
path: `/api/profile/sessions/${sessionId}`,
|
|
182
|
+
handler: async (body) => {
|
|
183
|
+
loadingSessionId.set(null);
|
|
184
|
+
|
|
185
|
+
if (body.error) {
|
|
186
|
+
await showToast('errors.' + body.error);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
await showToast('toasts.session-logged-out-successful');
|
|
191
|
+
invalidateAll();
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function init(session) {
|
|
197
|
+
const resetPasswordError = writable();
|
|
198
|
+
const resetPasswordLoading = writable();
|
|
199
|
+
const resetPasswordSuccess = writable();
|
|
200
|
+
|
|
201
|
+
const currentPassword = writable();
|
|
202
|
+
const newEmail = writable();
|
|
203
|
+
|
|
204
|
+
const changingEmail = writable();
|
|
205
|
+
const changingEmail2ndStep = writable();
|
|
206
|
+
|
|
207
|
+
const changingEmailError = writable();
|
|
208
|
+
const changingEmailLoading = writable();
|
|
209
|
+
const changingEmailSuccess = writable();
|
|
210
|
+
|
|
211
|
+
const userLocale = writable(session.siteInfo.locale)
|
|
212
|
+
const saveButtonLoading = writable()
|
|
213
|
+
const loadingSessionId = writable(null)
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
resetPasswordError,
|
|
217
|
+
resetPasswordLoading,
|
|
218
|
+
resetPasswordSuccess,
|
|
219
|
+
currentPassword,
|
|
220
|
+
newEmail,
|
|
221
|
+
changingEmail,
|
|
222
|
+
changingEmail2ndStep,
|
|
223
|
+
changingEmailError,
|
|
224
|
+
changingEmailLoading,
|
|
225
|
+
changingEmailSuccess,
|
|
226
|
+
userLocale,
|
|
227
|
+
saveButtonLoading,
|
|
228
|
+
loadingSessionId
|
|
229
|
+
};
|
|
230
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import SupportSidebar, { load as loadSidebar } from "$pano/lib/components/sidebars/SupportSidebar.svelte";
|
|
2
|
+
import { executeHookLoad, executeLifecycle, executeViewLoad, panoApi } from "$pano/lib/PluginAPI.js";
|
|
3
|
+
|
|
4
|
+
export async function processLoad(event) {
|
|
5
|
+
const { parent } = event;
|
|
6
|
+
const { session, hookProps: parentHookProps } = await parent();
|
|
7
|
+
const themeSettings = session.siteInfo.themeSettings;
|
|
8
|
+
|
|
9
|
+
const onlineAdminsEnabled =
|
|
10
|
+
typeof themeSettings.sidebarCarts?.onlineAdmins === "undefined"
|
|
11
|
+
? true
|
|
12
|
+
: themeSettings.sidebarCarts.onlineAdmins;
|
|
13
|
+
|
|
14
|
+
if (onlineAdminsEnabled) {
|
|
15
|
+
await loadSidebar(event);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const data = {
|
|
19
|
+
hookProps: { ...parentHookProps },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Register main content sections
|
|
23
|
+
panoApi.ui.view.register({
|
|
24
|
+
viewId: "support-content",
|
|
25
|
+
id: "support-options",
|
|
26
|
+
priority: 100,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Register buttons inside the options group
|
|
30
|
+
panoApi.ui.view.register({
|
|
31
|
+
viewId: "support-options",
|
|
32
|
+
id: "create-ticket",
|
|
33
|
+
component: "local:create-ticket",
|
|
34
|
+
priority: 100,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
panoApi.ui.view.register({
|
|
38
|
+
viewId: "support-options",
|
|
39
|
+
id: "send-email",
|
|
40
|
+
component: "local:send-email",
|
|
41
|
+
priority: 90,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Execute lifecycles
|
|
45
|
+
await executeLifecycle("theme:support:load", data, event);
|
|
46
|
+
|
|
47
|
+
// View loads and hook load are independent — run in parallel
|
|
48
|
+
const [, , supportHookProps] = await Promise.all([
|
|
49
|
+
executeViewLoad("support-content", event),
|
|
50
|
+
executeViewLoad("support-options", event),
|
|
51
|
+
executeHookLoad("theme:support:content", event)
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
data.hookProps["theme:support:content"] = {
|
|
55
|
+
...data.hookProps["theme:support:content"],
|
|
56
|
+
...supportHookProps
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return { ...data, sidebar: onlineAdminsEnabled ? SupportSidebar : null, pageTitle: "pages.support.title" };
|
|
60
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { afterUpdate, onMount } from "svelte";
|
|
2
|
+
import { get, writable } from "svelte/store";
|
|
3
|
+
import { error } from "@sveltejs/kit";
|
|
4
|
+
|
|
5
|
+
import { getTicketDetail, loadMoreTicketMessages, sendTicketMessage } from "$pano/lib/services/tickets";
|
|
6
|
+
|
|
7
|
+
import TicketCreateAndDetailSidebar, {
|
|
8
|
+
load as loadSidebar,
|
|
9
|
+
update as updateSidebar
|
|
10
|
+
} from "$pano/lib/components/sidebars/TicketCreateAndDetailSidebar.svelte";
|
|
11
|
+
|
|
12
|
+
import { setCallback as setCloseTicketConfirmCallback } from "$pano/lib/components/modals/CloseTicketConfirmModal.svelte";
|
|
13
|
+
|
|
14
|
+
import { TicketStatuses } from "$pano/lib/components/TicketStatus.svelte";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @type {import("@sveltejs/kit").Load}
|
|
18
|
+
*/
|
|
19
|
+
export async function processLoad(event) {
|
|
20
|
+
const { parent } = event;
|
|
21
|
+
await parent();
|
|
22
|
+
|
|
23
|
+
let data = {
|
|
24
|
+
ticket: {
|
|
25
|
+
id: -1,
|
|
26
|
+
username: "",
|
|
27
|
+
title: "",
|
|
28
|
+
category: "-",
|
|
29
|
+
messages: [],
|
|
30
|
+
status: 1,
|
|
31
|
+
date: 0,
|
|
32
|
+
messageCount: 0
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
await getTicketDetail({
|
|
37
|
+
id: event.params.id,
|
|
38
|
+
request: event
|
|
39
|
+
}).then((body) => {
|
|
40
|
+
if (body.error) {
|
|
41
|
+
if (body.error === "NOT_EXISTS" || body.error === "BAD_REQUEST") {
|
|
42
|
+
throw error(404, body.error);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw error(500, body.error);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
data = body;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await loadSidebar(event, data.ticket);
|
|
52
|
+
|
|
53
|
+
data.pageTitle = {
|
|
54
|
+
title: "pages.ticket-detail.tab-title",
|
|
55
|
+
titleValues: {
|
|
56
|
+
ticketId: `#${data.ticket.id}`,
|
|
57
|
+
title: data.ticket.title,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return { ...data, sidebar: TicketCreateAndDetailSidebar };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function loadMore(loadMoreLoading, messages, data) {
|
|
65
|
+
loadMoreLoading.set(true);
|
|
66
|
+
|
|
67
|
+
await loadMoreTicketMessages({
|
|
68
|
+
id: data.ticket.id,
|
|
69
|
+
lastMessageId: get(messages)[0].id
|
|
70
|
+
}).then((body) => {
|
|
71
|
+
if (body.error) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
body.messages.reverse().forEach((message) => {
|
|
76
|
+
messages.update(messages => {
|
|
77
|
+
messages.unshift(message);
|
|
78
|
+
|
|
79
|
+
return messages;
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
loadMoreLoading.set(false);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export async function sendMessage(messageSendLoading, sentMessageCount, shouldScroll, messages, message, data) {
|
|
88
|
+
messageSendLoading.set(true);
|
|
89
|
+
|
|
90
|
+
await sendTicketMessage({
|
|
91
|
+
ticketId: data.ticket.id,
|
|
92
|
+
message: get(message)
|
|
93
|
+
}).then((body) => {
|
|
94
|
+
if (body.error) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
shouldScroll.set(true);
|
|
99
|
+
|
|
100
|
+
messages.update(messages => {
|
|
101
|
+
messages.push(body.message);
|
|
102
|
+
|
|
103
|
+
return messages;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
sentMessageCount.update(sentMessageCount => {
|
|
107
|
+
sentMessageCount++;
|
|
108
|
+
return sentMessageCount;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
message.set("");
|
|
113
|
+
|
|
114
|
+
messageSendLoading.set(false);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function init(data) {
|
|
119
|
+
const shouldScroll = writable(true);
|
|
120
|
+
const message = writable("");
|
|
121
|
+
const messages = writable(data.ticket.messages);
|
|
122
|
+
|
|
123
|
+
const messagesSectionDiv = writable();
|
|
124
|
+
const loadMoreLoading = writable(false);
|
|
125
|
+
const messageSendLoading = writable(false);
|
|
126
|
+
|
|
127
|
+
const sentMessageCount = writable(0);
|
|
128
|
+
const ticket = writable(data.ticket);
|
|
129
|
+
|
|
130
|
+
afterUpdate(() => {
|
|
131
|
+
if (get(shouldScroll) && get(messagesSectionDiv).scrollHeight > 0) {
|
|
132
|
+
get(messagesSectionDiv).scrollTo(0, get(messagesSectionDiv).scrollHeight);
|
|
133
|
+
|
|
134
|
+
shouldScroll.set(false);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
onMount(() => {
|
|
139
|
+
shouldScroll.set(true);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
setCloseTicketConfirmCallback(() => {
|
|
143
|
+
ticket.update(ticket => {
|
|
144
|
+
ticket.status = TicketStatuses.CLOSED;
|
|
145
|
+
return ticket;
|
|
146
|
+
});
|
|
147
|
+
updateSidebar(get(ticket));
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
shouldScroll,
|
|
152
|
+
message,
|
|
153
|
+
messagesSectionDiv,
|
|
154
|
+
loadMoreLoading,
|
|
155
|
+
messageSendLoading,
|
|
156
|
+
sentMessageCount,
|
|
157
|
+
messages,
|
|
158
|
+
ticket
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { error } from "@sveltejs/kit";
|
|
2
|
+
import { writable } from "svelte/store";
|
|
3
|
+
|
|
4
|
+
import { goto } from "$app/navigation";
|
|
5
|
+
|
|
6
|
+
import { buildQueryParams } from "$pano/lib/api.util";
|
|
7
|
+
import { executeLifecycle, executeViewLoad, panoApiServer } from "$pano/lib/PluginAPI";
|
|
8
|
+
|
|
9
|
+
import { getTickets } from "$pano/lib/services/tickets";
|
|
10
|
+
|
|
11
|
+
import { TicketStatuses } from "$pano/lib/components/TicketStatus.svelte";
|
|
12
|
+
import ProfileSidebar, { load as loadSidebar } from "$pano/lib/components/sidebars/ProfileSidebar.svelte";
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
onHide as setCloseTicketConfirmOnHideCallback,
|
|
16
|
+
setCallback as setCloseTicketConfirmCallback,
|
|
17
|
+
show as showCloseTicketConfirmModal
|
|
18
|
+
} from "$pano/lib/components/modals/CloseTicketConfirmModal.svelte";
|
|
19
|
+
|
|
20
|
+
export const PageTypes = Object.freeze({
|
|
21
|
+
ALL: "ALL",
|
|
22
|
+
CLOSED: "CLOSED"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const DefaultPageType = PageTypes.ALL;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @type {import("@sveltejs/kit").Load}
|
|
29
|
+
*/
|
|
30
|
+
export async function processLoad(event) {
|
|
31
|
+
const { parent, url: { searchParams } } = event;
|
|
32
|
+
await parent();
|
|
33
|
+
|
|
34
|
+
const page = parseInt(searchParams.get("page")) || 1;
|
|
35
|
+
const pageType = searchParams.get("pageType") || DefaultPageType;
|
|
36
|
+
const categoryUrl = searchParams.get("category");
|
|
37
|
+
|
|
38
|
+
const data = await getTickets({
|
|
39
|
+
page,
|
|
40
|
+
pageType,
|
|
41
|
+
categoryUrl,
|
|
42
|
+
request: event
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
if (data.error) {
|
|
46
|
+
if (data.error === "PAGE_NOT_FOUND" || data.error === "NOT_EXISTS" || data.error === "BAD_REQUEST") {
|
|
47
|
+
throw error(404, data.error);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
throw error(500, data.error);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
data.pageType = pageType;
|
|
54
|
+
data.categoryUrl = categoryUrl;
|
|
55
|
+
|
|
56
|
+
// Initialize tickets content
|
|
57
|
+
panoApiServer.ui.tickets.content.edit((items) => {
|
|
58
|
+
items.push({ id: "tickets-card", priority: 100, hidden: false });
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
await executeLifecycle("theme:tickets:load", {}, event);
|
|
62
|
+
await executeViewLoad("tickets-content", event);
|
|
63
|
+
|
|
64
|
+
await loadSidebar(event);
|
|
65
|
+
|
|
66
|
+
data.pageTitle = {
|
|
67
|
+
title: categoryUrl ? "pages.category-tickets.title" : "pages.tickets.title",
|
|
68
|
+
titleValues: categoryUrl ? {
|
|
69
|
+
categoryName: `"${data.category.title}"`
|
|
70
|
+
} : null
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return { ...data, sidebar: ProfileSidebar };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function refreshData(data) {
|
|
77
|
+
const queryParams = buildQueryParams({
|
|
78
|
+
page: data.page,
|
|
79
|
+
pageType: data.pageType,
|
|
80
|
+
category: data.categoryUrl
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
await goto(queryParams, { invalidateAll: true });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function onPageClick(data, page) {
|
|
87
|
+
data.page = page;
|
|
88
|
+
|
|
89
|
+
await refreshData(data);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const onCloseTicketClick = (tickets, updatedTicket) => {
|
|
93
|
+
tickets.update(tickets => {
|
|
94
|
+
tickets.forEach((ticket) => {
|
|
95
|
+
if (ticket.id === updatedTicket.id) {
|
|
96
|
+
ticket.selected = true;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return tickets;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
showCloseTicketConfirmModal(updatedTicket);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export function init(data) {
|
|
106
|
+
const tickets = writable(data.tickets);
|
|
107
|
+
|
|
108
|
+
setCloseTicketConfirmCallback((updatedTicket) => {
|
|
109
|
+
tickets.update(tickets => {
|
|
110
|
+
tickets.forEach((ticket) => {
|
|
111
|
+
if (ticket.id === updatedTicket.id) {
|
|
112
|
+
ticket.status = TicketStatuses.CLOSED;
|
|
113
|
+
ticket.selected = false;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return tickets;
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
setCloseTicketConfirmOnHideCallback(() => {
|
|
121
|
+
tickets.update(tickets => {
|
|
122
|
+
tickets.forEach((ticket) => {
|
|
123
|
+
if (ticket.selected) {
|
|
124
|
+
ticket.selected = false;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return tickets;
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
return { tickets };
|
|
132
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@panomc/sdk/core/js/variables.js";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@view ActivateEmailView
|
|
3
|
+
Controller: $pano/lib/pages/ActivateEmailPage.svelte
|
|
4
|
+
Props:
|
|
5
|
+
data object — page data (data.token: e-mail activation token from the URL)
|
|
6
|
+
error writable store — error code rendered by ErrorAlert (e.g. "INVALID_LINK")
|
|
7
|
+
successMessage writable store — success code rendered by SuccessAlert ("VALIDATION_SUCCESSFUL")
|
|
8
|
+
loading writable store — true while the verification request is in flight
|
|
9
|
+
activateContentItems readable store — plugin-injected content items for the activate page
|
|
10
|
+
verifyEmail function(error, successMessage, loading, data) — runs the e-mail verification request
|
|
11
|
+
Override from a theme:
|
|
12
|
+
theme.config.js → views: { ActivateEmailView: () => import("./src/views/ActivateEmailView.svelte") }
|
|
13
|
+
-->
|
|
14
|
+
<div class="col-lg-4 col-md-6 mx-auto">
|
|
15
|
+
<div class="vstack gap-3">
|
|
16
|
+
|
|
17
|
+
<div class="card">
|
|
18
|
+
<div class="card-body">
|
|
19
|
+
<div class="vstack gap-3">
|
|
20
|
+
<img
|
|
21
|
+
alt="Allay"
|
|
22
|
+
class="d-block mx-auto"
|
|
23
|
+
src="https://cdn3.emoji.gg/emojis/8182-allay-dancing.gif" />
|
|
24
|
+
<ErrorAlert error={$error} />
|
|
25
|
+
<SuccessAlert message={$successMessage} />
|
|
26
|
+
{#each $activateContentItems as item (item.id)}
|
|
27
|
+
{#if item.component}
|
|
28
|
+
<ViewComponent
|
|
29
|
+
component={item.component}
|
|
30
|
+
data={{ pageType: 'activate' }} />
|
|
31
|
+
{/if}
|
|
32
|
+
{/each}
|
|
33
|
+
<button
|
|
34
|
+
class="btn btn-secondary w-100"
|
|
35
|
+
class:disabled={$loading ||
|
|
36
|
+
$error === "INVALID_LINK" ||
|
|
37
|
+
$successMessage !== null}
|
|
38
|
+
disabled={$loading ||
|
|
39
|
+
$error === "INVALID_LINK" ||
|
|
40
|
+
$successMessage !== null}
|
|
41
|
+
on:click={() => verifyEmail(error, successMessage, loading, data)}>
|
|
42
|
+
{#if $loading}
|
|
43
|
+
<span
|
|
44
|
+
class="spinner-border spinner-border-sm me-2"
|
|
45
|
+
role="status"
|
|
46
|
+
aria-label="Loading"></span>
|
|
47
|
+
<span>{$_("buttons.activate-email")}...</span>
|
|
48
|
+
{:else}
|
|
49
|
+
{$_("buttons.activate-email")}
|
|
50
|
+
{/if}
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
import { _ } from "svelte-i18n";
|
|
60
|
+
|
|
61
|
+
import ErrorAlert from "$pano/lib/components/ErrorAlert.svelte";
|
|
62
|
+
import SuccessAlert from "$pano/lib/components/SuccessAlert.svelte";
|
|
63
|
+
import ViewComponent from "$pano/lib/components/ViewComponent.svelte";
|
|
64
|
+
|
|
65
|
+
export let data;
|
|
66
|
+
export let error;
|
|
67
|
+
export let successMessage;
|
|
68
|
+
export let loading;
|
|
69
|
+
export let activateContentItems;
|
|
70
|
+
export let verifyEmail;
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@view AppLayoutView
|
|
3
|
+
Controller: $pano/lib/layouts/AppLayout.svelte
|
|
4
|
+
Props:
|
|
5
|
+
data object — root layout load data (session payload, _pageTitleStore, View)
|
|
6
|
+
session store — writable session store ({ user, csrfToken, siteInfo }) created by init(data)
|
|
7
|
+
pageTitle store — current page title: null, an i18n key string, or { title, titleValues }
|
|
8
|
+
getTitle function — (pageTitle, siteName) => formatted document <title> string
|
|
9
|
+
Override from a theme:
|
|
10
|
+
theme.config.js → views: { AppLayoutView: () => import("./src/views/AppLayoutView.svelte") }
|
|
11
|
+
-->
|
|
12
|
+
<App>
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</App>
|
|
15
|
+
|
|
16
|
+
<ToastContainer />
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import App from "$pano/lib/components/App.svelte";
|
|
20
|
+
import ToastContainer from "$pano/lib/components/ToastContainer.svelte";
|
|
21
|
+
|
|
22
|
+
export let data;
|
|
23
|
+
export let session;
|
|
24
|
+
export let pageTitle;
|
|
25
|
+
export let getTitle;
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<svelte:head>
|
|
29
|
+
<link href="/api/favicon?hash={$session.siteInfo.faviconHash}" rel="icon" />
|
|
30
|
+
<title>{getTitle($pageTitle, $session.siteInfo.websiteName)}</title>
|
|
31
|
+
</svelte:head>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@view AuthLayoutView
|
|
3
|
+
Controller: $pano/lib/layouts/AuthLayout.svelte
|
|
4
|
+
Props:
|
|
5
|
+
data object — layout load data from processLoad (AuthLayoutLogics)
|
|
6
|
+
Slot:
|
|
7
|
+
default — the auth page content forwarded by the controller
|
|
8
|
+
Override from a theme:
|
|
9
|
+
theme.config.js → views: { AuthLayoutView: () => import("./src/views/AuthLayoutView.svelte") }
|
|
10
|
+
-->
|
|
11
|
+
<style>
|
|
12
|
+
.container {
|
|
13
|
+
max-width: 400px !important;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
|
|
17
|
+
<div class="container mx-auto">
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export let data;
|
|
23
|
+
</script>
|