qarpeo 0.1.18 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -96
- package/dist/chunks/auth-schema.mjs +3 -1
- package/dist/chunks/wrangler.mjs +22 -3
- package/dist/cli/index.mjs +448 -221
- package/dist/fate/index.d.ts +29 -22
- package/dist/fate/index.mjs +1 -3
- package/dist/module.d.ts +1 -1
- package/dist/module.mjs +103 -82
- package/dist/runtime/ai.d.ts +2 -2
- package/dist/runtime/app/components/BlobImage.vue +119 -107
- package/dist/runtime/app/components/CMSBlocks.vue +104 -93
- package/dist/runtime/app/components/CMSContent.vue +24 -23
- package/dist/runtime/app/components/CMSImage.vue +49 -49
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +110 -110
- package/dist/runtime/app/components/CMSPreviewBanner.vue +83 -79
- package/dist/runtime/app/components/CMSVersionBanner.vue +53 -49
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +140 -140
- package/dist/runtime/app/components/ContentRenderer.vue +83 -80
- package/dist/runtime/app/components/FileUpload.vue +200 -196
- package/dist/runtime/app/components/ImpersonationBanner.vue +61 -57
- package/dist/runtime/app/components/QarpeoWelcome.vue +84 -84
- package/dist/runtime/app/components/SignedIn.vue +13 -13
- package/dist/runtime/app/components/SignedOut.vue +13 -13
- package/dist/runtime/app/components/shiki.css +34 -34
- package/dist/runtime/app/composables/ai.d.ts +22 -22
- package/dist/runtime/app/composables/ai.mjs +3 -7
- package/dist/runtime/app/composables/analytics.mjs +1 -1
- package/dist/runtime/app/composables/api-tokens.mjs +1 -1
- package/dist/runtime/app/composables/auth.d.ts +6 -7
- package/dist/runtime/app/composables/auth.mjs +6 -3
- package/dist/runtime/app/composables/chat.mjs +3 -7
- package/dist/runtime/app/composables/cms-preview.d.ts +3 -3
- package/dist/runtime/app/composables/cms-preview.mjs +1 -1
- package/dist/runtime/app/composables/cms.d.ts +3 -5
- package/dist/runtime/app/composables/cms.mjs +2 -2
- package/dist/runtime/app/composables/docs-version.d.ts +8 -7
- package/dist/runtime/app/composables/docs-version.mjs +3 -3
- package/dist/runtime/app/composables/impersonation.mjs +1 -1
- package/dist/runtime/app/composables/notifications.d.ts +5 -5
- package/dist/runtime/app/composables/notifications.mjs +4 -5
- package/dist/runtime/app/composables/organization.mjs +1 -1
- package/dist/runtime/app/composables/passkey.mjs +1 -1
- package/dist/runtime/app/composables/passwordless.mjs +1 -1
- package/dist/runtime/app/composables/payments.d.ts +2 -1
- package/dist/runtime/app/composables/payments.mjs +1 -1
- package/dist/runtime/app/composables/realtime.d.ts +13 -13
- package/dist/runtime/app/composables/realtime.mjs +2 -2
- package/dist/runtime/app/composables/resumable-upload.d.ts +11 -11
- package/dist/runtime/app/composables/resumable-upload.mjs +1 -1
- package/dist/runtime/app/composables/site.mjs +1 -1
- package/dist/runtime/app/composables/storage.d.ts +151 -11
- package/dist/runtime/app/composables/storage.mjs +291 -33
- package/dist/runtime/app/composables/turnstile.mjs +1 -1
- package/dist/runtime/app/composables/two-factor.mjs +1 -1
- package/dist/runtime/app/pages/devtools/agents.vue +716 -716
- package/dist/runtime/app/pages/devtools/analytics.vue +616 -616
- package/dist/runtime/app/pages/devtools/auth.vue +381 -350
- package/dist/runtime/app/pages/devtools/blob.vue +743 -744
- package/dist/runtime/app/pages/devtools/db.vue +545 -545
- package/dist/runtime/app/pages/devtools/domains.vue +771 -771
- package/dist/runtime/app/pages/devtools/kv.vue +827 -828
- package/dist/runtime/app/pages/devtools/logs.vue +649 -653
- package/dist/runtime/app/pages/devtools/mail.vue +388 -388
- package/dist/runtime/app/pages/devtools/overview.vue +391 -389
- package/dist/runtime/app/pages/devtools/realtime.vue +89 -27
- package/dist/runtime/app/pages/devtools/security.vue +20 -5
- package/dist/runtime/app/pages/devtools/settings.vue +559 -559
- package/dist/runtime/app/pages/devtools/tasks.vue +26 -10
- package/dist/runtime/app/pages/devtools.vue +176 -176
- package/dist/runtime/app/plugins/seo.mjs +1 -1
- package/dist/runtime/app/plugins/shortcuts.client.d.ts +1 -4
- package/dist/runtime/app/public/sw-notifications.mjs +47 -52
- package/dist/runtime/blob.mjs +11 -4
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/browser.mjs +12 -2
- package/dist/runtime/cache.d.ts +2 -1
- package/dist/runtime/kv.mjs +4 -1
- package/dist/runtime/providers/qarpeo.d.ts +3 -3
- package/dist/runtime/server/durable-objects/agent.mjs +1 -1
- package/dist/runtime/server/durable-objects/room.d.ts +2 -2
- package/dist/runtime/server/durable-objects/room.mjs +5 -5
- package/dist/runtime/server/middleware/devtools.mjs +6 -2
- package/dist/runtime/server/plugins/cms.d.ts +4 -2
- package/dist/runtime/server/plugins/dev-proxy.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/agents/chat.post.mjs +4 -1
- package/dist/runtime/server/routes/__qarpeo/analytics/events.get.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.mjs +5 -1
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/logs.get.d.ts +4 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/mail/track/open/[id].get.mjs +2 -2
- package/dist/runtime/server/routes/__qarpeo/overview.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/broadcast.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/clear.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/realtime/disconnect.post.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/realtime/room.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/realtime/rooms.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/analytics.get.d.ts +2 -2
- package/dist/runtime/server/routes/__qarpeo/security/ban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/clear.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/security/unban.post.d.ts +1 -4
- package/dist/runtime/server/routes/__qarpeo/settings.get.mjs +1 -1
- package/dist/runtime/server/routes/__qarpeo/tasks/run.post.mjs +3 -1
- package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +8 -2
- package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +8 -2
- package/dist/runtime/server/routes/ai/embed.post.d.ts +1 -4
- package/dist/runtime/server/routes/ai/search.post.d.ts +2 -2
- package/dist/runtime/server/routes/auth/account.delete.mjs +1 -1
- package/dist/runtime/server/routes/auth/handler.mjs +6 -1
- package/dist/runtime/server/routes/auth/magic-link/verify.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/members/[id].delete.mjs +7 -1
- package/dist/runtime/server/routes/auth/otp/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/sso/login.get.mjs +7 -1
- package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +8 -2
- package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +7 -2
- package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +6 -1
- package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/crawl.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/invoice.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/og-image.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/pdf.post.d.ts +1 -2
- package/dist/runtime/server/routes/browser/pdf.post.mjs +6 -1
- package/dist/runtime/server/routes/browser/screenshot.post.d.ts +2 -2
- package/dist/runtime/server/routes/browser/screenshot.post.mjs +5 -1
- package/dist/runtime/server/routes/cms/components/index.get.d.ts +2 -2
- package/dist/runtime/server/routes/cms/preview/disable.get.d.ts +4 -3
- package/dist/runtime/server/routes/cms/preview/enable.get.d.ts +8 -8
- package/dist/runtime/server/routes/cms/search.get.mjs +1 -1
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.d.ts +7 -7
- package/dist/runtime/server/routes/cms/webhooks/[provider].post.mjs +9 -2
- package/dist/runtime/server/routes/docs/search.get.d.ts +9 -9
- package/dist/runtime/server/routes/fate.mjs +5 -8
- package/dist/runtime/server/routes/mail/bounce.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/unsubscribe.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.d.ts +2 -2
- package/dist/runtime/server/routes/mail/webhooks.post.mjs +7 -1
- package/dist/runtime/server/routes/payments/usage.get.d.ts +8 -8
- package/dist/runtime/server/routes/payments/usage.post.d.ts +2 -2
- package/dist/runtime/server/routes/realtime/history.delete.d.ts +4 -3
- package/dist/runtime/server/routes/realtime/history.get.d.ts +7 -6
- package/dist/runtime/server/routes/realtime/ws.get.mjs +6 -1
- package/dist/runtime/server/routes/robots.txt.get.mjs +1 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +2 -1
- package/dist/runtime/server/routes/storage/multipart/abort.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/complete.post.mjs +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/create.post.mjs +7 -3
- package/dist/runtime/server/routes/storage/multipart/part.put.d.ts +2 -2
- package/dist/runtime/server/routes/storage/multipart/part.put.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +2 -4
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +1 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +2 -4
- package/dist/runtime/server/tasks/cms/publish.mjs +1 -1
- package/dist/runtime/server/utils/ai.d.ts +9 -9
- package/dist/runtime/server/utils/ai.mjs +3 -3
- package/dist/runtime/server/utils/auth.d.ts +12 -16
- package/dist/runtime/server/utils/auth.mjs +15 -9
- package/dist/runtime/server/utils/bots.mjs +21 -7
- package/dist/runtime/server/utils/browser-utils.d.ts +44 -41
- package/dist/runtime/server/utils/browser-utils.mjs +14 -4
- package/dist/runtime/server/utils/cache.d.ts +5 -5
- package/dist/runtime/server/utils/cms/common.d.ts +26 -0
- package/dist/runtime/server/utils/cms/common.mjs +68 -0
- package/dist/runtime/server/utils/cms/git.d.ts +24 -0
- package/dist/runtime/server/utils/cms/git.mjs +240 -0
- package/dist/runtime/server/utils/cms/markdown.d.ts +22 -0
- package/dist/runtime/server/utils/cms/markdown.mjs +92 -0
- package/dist/runtime/server/utils/cms/path.d.ts +51 -0
- package/dist/runtime/server/utils/cms/path.mjs +127 -0
- package/dist/runtime/server/utils/cms/search.d.ts +22 -0
- package/dist/runtime/server/utils/cms/search.mjs +221 -0
- package/dist/runtime/server/utils/cms-events.d.ts +1 -1
- package/dist/runtime/server/utils/cms-events.mjs +2 -2
- package/dist/runtime/server/utils/cms-filter.mjs +2 -2
- package/dist/runtime/server/utils/cms.d.ts +17 -149
- package/dist/runtime/server/utils/cms.mjs +52 -761
- package/dist/runtime/server/utils/config.d.ts +5 -4
- package/dist/runtime/server/utils/domains.mjs +7 -4
- package/dist/runtime/server/utils/email-templates.d.ts +10 -7
- package/dist/runtime/server/utils/email-templates.mjs +20 -5
- package/dist/runtime/server/utils/feed.d.ts +2 -2
- package/dist/runtime/server/utils/feed.mjs +3 -1
- package/dist/runtime/server/utils/mail-suppression.d.ts +8 -24
- package/dist/runtime/server/utils/mail-suppression.mjs +2 -2
- package/dist/runtime/server/utils/mail.d.ts +7 -8
- package/dist/runtime/server/utils/mail.mjs +17 -12
- package/dist/runtime/server/utils/multipart-store.d.ts +2 -2
- package/dist/runtime/server/utils/notifications.d.ts +9 -23
- package/dist/runtime/server/utils/organization.mjs +4 -12
- package/dist/runtime/server/utils/passwordless.mjs +1 -1
- package/dist/runtime/server/utils/payments.d.ts +2 -6
- package/dist/runtime/server/utils/payments.mjs +1 -1
- package/dist/runtime/server/utils/queue.d.ts +21 -31
- package/dist/runtime/server/utils/rag.d.ts +4 -4
- package/dist/runtime/server/utils/rag.mjs +8 -8
- package/dist/runtime/server/utils/realtime-store.d.ts +2 -2
- package/dist/runtime/server/utils/realtime.d.ts +26 -28
- package/dist/runtime/server/utils/scheduled-task.d.ts +1 -3
- package/dist/runtime/server/utils/security-store.d.ts +2 -2
- package/dist/runtime/server/utils/session.d.ts +9 -11
- package/dist/runtime/server/utils/sso.d.ts +9 -15
- package/dist/runtime/server/utils/sso.mjs +4 -8
- package/dist/runtime/server/utils/storage.d.ts +19 -2
- package/dist/runtime/server/utils/storage.mjs +36 -7
- package/dist/runtime/server/utils/tenant.mjs +3 -1
- package/dist/runtime/server/utils/turnstile.d.ts +3 -5
- package/dist/runtime/server/utils/vapid.d.ts +5 -8
- package/dist/runtime/server/utils/vapid.mjs +26 -13
- package/dist/runtime/service.d.ts +13 -13
- package/dist/runtime/service.mjs +4 -2
- package/dist/runtime/test-utils.d.ts +20 -30
- package/dist/runtime/test-utils.mjs +5 -4
- package/dist/runtime/types/auth-globals.d.ts +14 -14
- package/dist/runtime/types/imports.d.ts +82 -82
- package/dist/runtime/types/index.d.ts +2 -2
- package/dist/runtime/types/r2.d.ts +5 -0
- package/dist/runtime/types/service.d.ts +11 -18
- package/dist/types.d.ts +100 -107
- package/dist/utils/auth-schema.d.ts +2 -2
- package/dist/utils/cms-sources.d.ts +3 -3
- package/dist/utils/local-db.d.ts +3 -3
- package/dist/utils/notifications-schema.d.ts +1 -3
- package/dist/utils/pkg.d.ts +7 -0
- package/dist/utils/queue.d.ts +3 -3
- package/dist/utils/tasks.d.ts +3 -2
- package/package.json +11 -8
|
@@ -1,196 +1,200 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ref, computed } from "vue"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
emit("update:modelValue",
|
|
90
|
-
emit("success",
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
event.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
:
|
|
146
|
-
:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, computed } from "vue"
|
|
3
|
+
|
|
4
|
+
import { useUpload, type UploadedFile } from "../composables/storage"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `<FileUpload>` — Drag-and-drop file upload dropzone with progress and v-model support. Supports
|
|
8
|
+
* custom slot for full UI control or uses a built-in dropzone UI.
|
|
9
|
+
*/
|
|
10
|
+
const props = withDefaults(
|
|
11
|
+
defineProps<{
|
|
12
|
+
/** File types accepted (e.g. "image/*", ".pdf,.docx"). */
|
|
13
|
+
accept?: string
|
|
14
|
+
/** Allow multiple file selection. */
|
|
15
|
+
multiple?: boolean
|
|
16
|
+
/** Maximum file size allowed in bytes. */
|
|
17
|
+
maxSize?: number
|
|
18
|
+
/** Whether the dropzone is disabled. */
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
/** Automatically trigger upload immediately on file selection. */
|
|
21
|
+
autoUpload?: boolean
|
|
22
|
+
/** Target upload endpoint URL (e.g. '/api/avatars'). Defaults to '/api/upload'. */
|
|
23
|
+
url?: string
|
|
24
|
+
/** Uploaded file(s) v-model. */
|
|
25
|
+
modelValue?: UploadedFile | UploadedFile[] | null
|
|
26
|
+
/** Additional CSS class for the wrapper container. */
|
|
27
|
+
dropzoneClass?: string
|
|
28
|
+
}>(),
|
|
29
|
+
{
|
|
30
|
+
url: "/api/upload",
|
|
31
|
+
multiple: false,
|
|
32
|
+
disabled: false,
|
|
33
|
+
autoUpload: true,
|
|
34
|
+
modelValue: null,
|
|
35
|
+
dropzoneClass: "",
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
const emit = defineEmits<{
|
|
40
|
+
"update:modelValue": [value: UploadedFile | UploadedFile[] | null]
|
|
41
|
+
change: [files: File | File[]]
|
|
42
|
+
upload: [files: File[]]
|
|
43
|
+
success: [result: UploadedFile | UploadedFile[]]
|
|
44
|
+
error: [err: Error]
|
|
45
|
+
progress: [percent: number]
|
|
46
|
+
}>()
|
|
47
|
+
|
|
48
|
+
const inputRef = ref<HTMLInputElement | null>(null)
|
|
49
|
+
const isDragging = ref(false)
|
|
50
|
+
const clientError = ref<string | null>(null)
|
|
51
|
+
|
|
52
|
+
const { isUploading, progress, error, upload, uploadMultiple, reset } = useUpload(() => props.url)
|
|
53
|
+
|
|
54
|
+
function open() {
|
|
55
|
+
if (props.disabled || isUploading.value) return
|
|
56
|
+
inputRef.value?.click()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function clear() {
|
|
60
|
+
reset()
|
|
61
|
+
clientError.value = null
|
|
62
|
+
if (inputRef.value) inputRef.value.value = ""
|
|
63
|
+
emit("update:modelValue", props.multiple ? [] : null)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function processFiles(files: FileList | File[]) {
|
|
67
|
+
clientError.value = null
|
|
68
|
+
const fileList = Array.from(files)
|
|
69
|
+
if (fileList.length === 0) return
|
|
70
|
+
|
|
71
|
+
if (props.maxSize) {
|
|
72
|
+
const oversized = fileList.find((f) => f.size > props.maxSize!)
|
|
73
|
+
if (oversized) {
|
|
74
|
+
const maxMb = (props.maxSize / (1024 * 1024)).toFixed(1)
|
|
75
|
+
const msg = `File "${oversized.name}" exceeds maximum size of ${maxMb}MB`
|
|
76
|
+
clientError.value = msg
|
|
77
|
+
emit("error", new Error(msg))
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
emit("change", props.multiple ? fileList : fileList[0]!)
|
|
83
|
+
if (!props.autoUpload) return
|
|
84
|
+
emit("upload", fileList)
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
if (props.multiple) {
|
|
88
|
+
const results = await uploadMultiple(fileList)
|
|
89
|
+
emit("update:modelValue", results)
|
|
90
|
+
emit("success", results)
|
|
91
|
+
} else {
|
|
92
|
+
const result = await upload(fileList[0]!)
|
|
93
|
+
emit("update:modelValue", result)
|
|
94
|
+
emit("success", result)
|
|
95
|
+
}
|
|
96
|
+
} catch (err: any) {
|
|
97
|
+
clientError.value = err?.message || "Upload failed"
|
|
98
|
+
emit("error", err)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function onDrop(event: DragEvent) {
|
|
103
|
+
event.preventDefault()
|
|
104
|
+
isDragging.value = false
|
|
105
|
+
if (props.disabled || isUploading.value) return
|
|
106
|
+
if (event.dataTransfer?.files) processFiles(event.dataTransfer.files)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function onDragOver(event: DragEvent) {
|
|
110
|
+
event.preventDefault()
|
|
111
|
+
if (!props.disabled && !isUploading.value) isDragging.value = true
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function onDragLeave(event: DragEvent) {
|
|
115
|
+
event.preventDefault()
|
|
116
|
+
isDragging.value = false
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function onInputChange(event: Event) {
|
|
120
|
+
const target = event.target as HTMLInputElement
|
|
121
|
+
if (target.files) processFiles(target.files)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const displayError = computed(() => clientError.value || error.value?.message || null)
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<template>
|
|
128
|
+
<!-- Custom slot: users take full UI control -->
|
|
129
|
+
<div
|
|
130
|
+
v-if="$slots.default"
|
|
131
|
+
:class="['qarpeo-file-upload', dropzoneClass]"
|
|
132
|
+
@drop="onDrop"
|
|
133
|
+
@dragover="onDragOver"
|
|
134
|
+
@dragleave="onDragLeave"
|
|
135
|
+
>
|
|
136
|
+
<input
|
|
137
|
+
ref="inputRef"
|
|
138
|
+
type="file"
|
|
139
|
+
:accept="accept"
|
|
140
|
+
:multiple="multiple"
|
|
141
|
+
class="hidden"
|
|
142
|
+
@change="onInputChange"
|
|
143
|
+
/>
|
|
144
|
+
<slot
|
|
145
|
+
:is-dragging="isDragging"
|
|
146
|
+
:is-uploading="isUploading"
|
|
147
|
+
:progress="progress"
|
|
148
|
+
:error="displayError"
|
|
149
|
+
:open="open"
|
|
150
|
+
:clear="clear"
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<!-- Built-in dropzone UI -->
|
|
155
|
+
<div
|
|
156
|
+
v-else
|
|
157
|
+
class="qarpeo-file-upload-wrapper"
|
|
158
|
+
@drop="onDrop"
|
|
159
|
+
@dragover="onDragOver"
|
|
160
|
+
@dragleave="onDragLeave"
|
|
161
|
+
>
|
|
162
|
+
<input
|
|
163
|
+
ref="inputRef"
|
|
164
|
+
type="file"
|
|
165
|
+
:accept="accept"
|
|
166
|
+
:multiple="multiple"
|
|
167
|
+
class="hidden"
|
|
168
|
+
@change="onInputChange"
|
|
169
|
+
/>
|
|
170
|
+
<div
|
|
171
|
+
:class="[
|
|
172
|
+
'rounded-lg border-2 border-dashed p-6 text-center transition-colors duration-200',
|
|
173
|
+
isDragging
|
|
174
|
+
? 'border-primary-500 bg-primary-50/50 dark:bg-primary-950/20'
|
|
175
|
+
: 'border-gray-300 dark:border-gray-700',
|
|
176
|
+
disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',
|
|
177
|
+
dropzoneClass,
|
|
178
|
+
]"
|
|
179
|
+
@click="open"
|
|
180
|
+
>
|
|
181
|
+
<!-- Uploading state -->
|
|
182
|
+
<div v-if="isUploading" class="space-y-2">
|
|
183
|
+
<p class="text-sm text-gray-500">Uploading... {{ progress }}%</p>
|
|
184
|
+
<UProgress :value="progress" size="xs" />
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
<!-- Idle / drag state -->
|
|
188
|
+
<div v-else class="space-y-1">
|
|
189
|
+
<UIcon name="i-lucide-upload-cloud" class="size-8 mx-auto text-gray-400" />
|
|
190
|
+
<p class="text-sm font-medium text-gray-700 dark:text-gray-300">
|
|
191
|
+
{{ isDragging ? "Drop files to upload" : "Click or drag files here to upload" }}
|
|
192
|
+
</p>
|
|
193
|
+
<p v-if="accept" class="text-xs text-gray-400">Accepted: {{ accept }}</p>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<!-- Error -->
|
|
197
|
+
<p v-if="displayError" class="mt-2 text-xs text-red-500">{{ displayError }}</p>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</template>
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed } from "vue"
|
|
3
|
-
|
|
4
|
-
import type { QarpeoUser, QarpeoSession } from "../../types/auth"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
|
|
4
|
+
import type { QarpeoUser, QarpeoSession } from "../../types/auth"
|
|
5
|
+
import { useUserSession } from "../composables/auth"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `<ImpersonationBanner>` Renders a dismissible banner when an admin is actively impersonating a
|
|
9
|
+
* user. Shows who is being impersonated and provides a "Stop Impersonating" button. Auto-hides when
|
|
10
|
+
* not in an impersonation session.
|
|
11
|
+
*
|
|
12
|
+
* @fires stopped — when impersonation is stopped successfully
|
|
13
|
+
*/
|
|
14
|
+
const emit = defineEmits<{ stopped: [] }>()
|
|
15
|
+
|
|
16
|
+
const { session, fetch: refreshSession } = useUserSession()
|
|
17
|
+
|
|
18
|
+
const isImpersonating = computed(() =>
|
|
19
|
+
Boolean((session.value as QarpeoSession | null)?.impersonator),
|
|
20
|
+
)
|
|
21
|
+
const impersonator = computed<QarpeoUser | null>(
|
|
22
|
+
() => ((session.value as QarpeoSession | null)?.impersonator as QarpeoUser) || null,
|
|
23
|
+
)
|
|
24
|
+
const impersonated = computed<QarpeoUser | null>(() => {
|
|
25
|
+
if (!isImpersonating.value) return null
|
|
26
|
+
return ((session.value as QarpeoSession | null)?.user as QarpeoUser) || null
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
async function stopImpersonating() {
|
|
30
|
+
try {
|
|
31
|
+
await $fetch("/api/auth/impersonate/stop", { method: "POST", credentials: "include" })
|
|
32
|
+
await refreshSession()
|
|
33
|
+
emit("stopped")
|
|
34
|
+
} catch {}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<Teleport to="body">
|
|
40
|
+
<div
|
|
41
|
+
v-if="isImpersonating"
|
|
42
|
+
class="fixed top-0 left-0 right-0 z-[9999] flex items-center justify-between gap-4 bg-amber-700 text-white px-4 py-2 text-sm font-sans"
|
|
43
|
+
>
|
|
44
|
+
<span>
|
|
45
|
+
⚠ Admin
|
|
46
|
+
<strong>{{ impersonator?.email || impersonator?.name || "Unknown" }}</strong>
|
|
47
|
+
is impersonating
|
|
48
|
+
<strong>{{ impersonated?.email || impersonated?.name || "Unknown" }}</strong>
|
|
49
|
+
</span>
|
|
50
|
+
<UButton
|
|
51
|
+
color="neutral"
|
|
52
|
+
variant="outline"
|
|
53
|
+
size="xs"
|
|
54
|
+
class="border-white/50 text-white hover:bg-white/20"
|
|
55
|
+
@click="stopImpersonating"
|
|
56
|
+
>
|
|
57
|
+
Stop Impersonating
|
|
58
|
+
</UButton>
|
|
59
|
+
</div>
|
|
60
|
+
</Teleport>
|
|
61
|
+
</template>
|