qarpeo 0.1.34 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/README.md +114 -26
  2. package/dist/apps/cms.d.ts +4 -0
  3. package/dist/apps/comments.d.ts +4 -0
  4. package/dist/apps/payments.d.ts +4 -0
  5. package/dist/apps/store.d.ts +4 -0
  6. package/dist/chunks/auth-schema.mjs +169 -30
  7. package/dist/chunks/tools.mjs +1680 -0
  8. package/dist/cli/index.mjs +1256 -221
  9. package/dist/core/aliases.d.ts +5 -0
  10. package/dist/core/context.d.ts +10 -0
  11. package/dist/core/cross-drive.d.ts +2 -0
  12. package/dist/core/d1-migrate.d.ts +4 -0
  13. package/dist/core/devtools.d.ts +4 -0
  14. package/dist/core/nitro.d.ts +4 -0
  15. package/dist/core/schema.d.ts +4 -0
  16. package/dist/core/server-utils.d.ts +4 -0
  17. package/dist/core/wrangler.d.ts +4 -0
  18. package/dist/dev/wrangler.d.ts +1 -0
  19. package/dist/fate/index.d.ts +8 -8
  20. package/dist/features/agents.d.ts +4 -0
  21. package/dist/features/auth.d.ts +4 -0
  22. package/dist/features/bots.d.ts +4 -0
  23. package/dist/features/fate.d.ts +4 -0
  24. package/dist/features/mail.d.ts +4 -0
  25. package/dist/features/mcp.d.ts +4 -0
  26. package/dist/features/multitenant.d.ts +4 -0
  27. package/dist/features/notifications.d.ts +4 -0
  28. package/dist/features/realtime.d.ts +4 -0
  29. package/dist/module.d.ts +10 -2
  30. package/dist/module.mjs +6313 -5114
  31. package/dist/primitives/ai.d.ts +4 -0
  32. package/dist/primitives/analytics.d.ts +4 -0
  33. package/dist/primitives/blob.d.ts +4 -0
  34. package/dist/primitives/browser.d.ts +4 -0
  35. package/dist/primitives/cache.d.ts +4 -0
  36. package/dist/primitives/d1.d.ts +4 -0
  37. package/dist/primitives/do.d.ts +4 -0
  38. package/dist/primitives/email.d.ts +4 -0
  39. package/dist/primitives/hyperdrive.d.ts +4 -0
  40. package/dist/primitives/kv.d.ts +4 -0
  41. package/dist/primitives/queue.d.ts +4 -0
  42. package/dist/primitives/ratelimit.d.ts +4 -0
  43. package/dist/primitives/vectorize.d.ts +4 -0
  44. package/dist/primitives/workflows.d.ts +4 -0
  45. package/dist/runtime/ai.d.ts +3 -3
  46. package/dist/runtime/ai.mjs +8 -1
  47. package/dist/runtime/app/components/RealtimeCursors.vue +2 -2
  48. package/dist/runtime/app/composables/ai.d.ts +56 -29
  49. package/dist/runtime/app/composables/analytics.d.ts +26 -106
  50. package/dist/runtime/app/composables/api-tokens.d.ts +31 -34
  51. package/dist/runtime/app/composables/auth.d.ts +147 -51
  52. package/dist/runtime/app/composables/auth.mjs +0 -7
  53. package/dist/runtime/app/composables/chat.d.ts +38 -35
  54. package/dist/runtime/app/composables/cms-preview.d.ts +30 -25
  55. package/dist/runtime/app/composables/cms.d.ts +57 -282
  56. package/dist/runtime/app/composables/cms.mjs +0 -35
  57. package/dist/runtime/app/composables/comments.d.ts +32 -5
  58. package/dist/runtime/app/composables/comments.mjs +29 -1
  59. package/dist/runtime/app/composables/docs-version.d.ts +25 -28
  60. package/dist/runtime/app/composables/impersonation.d.ts +22 -5
  61. package/dist/runtime/app/composables/organization.d.ts +38 -91
  62. package/dist/runtime/app/composables/passkey.d.ts +22 -6
  63. package/dist/runtime/app/composables/passwordless.d.ts +24 -7
  64. package/dist/runtime/app/composables/payments.d.ts +50 -34
  65. package/dist/runtime/app/composables/payments.mjs +1 -0
  66. package/dist/runtime/app/composables/sse.d.ts +76 -0
  67. package/dist/runtime/app/composables/sse.mjs +152 -0
  68. package/dist/runtime/app/composables/storage.d.ts +53 -65
  69. package/dist/runtime/app/composables/storage.mjs +17 -0
  70. package/dist/runtime/app/composables/store.d.ts +198 -0
  71. package/dist/runtime/app/composables/store.mjs +414 -0
  72. package/dist/runtime/app/composables/tenant.d.ts +31 -72
  73. package/dist/runtime/app/composables/turnstile.d.ts +16 -3
  74. package/dist/runtime/app/composables/two-factor.d.ts +23 -6
  75. package/dist/runtime/app/pages/devtools/notifications.vue +30 -27
  76. package/dist/runtime/app/pages/devtools/realtime.vue +19 -31
  77. package/dist/runtime/app/pages/devtools.vue +0 -7
  78. package/dist/runtime/auth.d.ts +9 -9
  79. package/dist/runtime/blob.d.ts +10 -1
  80. package/dist/runtime/blob.mjs +83 -0
  81. package/dist/runtime/cache.d.ts +48 -0
  82. package/dist/runtime/cache.mjs +92 -0
  83. package/dist/runtime/comments.d.ts +4 -0
  84. package/dist/runtime/comments.mjs +2 -0
  85. package/dist/runtime/db.d.ts +21 -1
  86. package/dist/runtime/db.mjs +54 -0
  87. package/dist/runtime/drizzle.d.ts +4 -2
  88. package/dist/runtime/drizzle.mjs +68 -1
  89. package/dist/runtime/durable-object.d.ts +2 -0
  90. package/dist/runtime/durable-object.mjs +2 -0
  91. package/dist/runtime/email.d.ts +1 -1
  92. package/dist/runtime/email.mjs +1 -1
  93. package/dist/runtime/kv.mjs +50 -1
  94. package/dist/runtime/mcp.d.ts +2 -0
  95. package/dist/runtime/mcp.mjs +2 -0
  96. package/dist/runtime/queue.d.ts +12 -2
  97. package/dist/runtime/queue.mjs +19 -1
  98. package/dist/runtime/ratelimit.d.ts +1 -0
  99. package/dist/runtime/ratelimit.mjs +7 -0
  100. package/dist/runtime/schema.d.ts +313 -0
  101. package/dist/runtime/schema.mjs +259 -0
  102. package/dist/runtime/server/db/cms-schema.d.ts +1225 -171
  103. package/dist/runtime/server/db/cms-schema.mjs +69 -70
  104. package/dist/runtime/server/db/store-schema.d.ts +4344 -0
  105. package/dist/runtime/server/db/store-schema.mjs +266 -0
  106. package/dist/runtime/server/durable-objects/agent.mjs +35 -0
  107. package/dist/runtime/server/durable-objects/room.mjs +0 -1
  108. package/dist/runtime/server/middleware/ratelimit.mjs +10 -8
  109. package/dist/runtime/server/plugins/comments.d.ts +7 -0
  110. package/dist/runtime/server/plugins/comments.mjs +7 -0
  111. package/dist/runtime/server/plugins/email-inbound.d.ts +5 -0
  112. package/dist/runtime/server/plugins/email-inbound.mjs +17 -0
  113. package/dist/runtime/server/plugins/store.d.ts +7 -0
  114. package/dist/runtime/server/plugins/store.mjs +7 -0
  115. package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +2 -2
  116. package/dist/runtime/server/routes/atom.xml.get.mjs +3 -1
  117. package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +13 -2
  118. package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +9 -3
  119. package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +11 -3
  120. package/dist/runtime/server/routes/auth/account.delete.mjs +2 -1
  121. package/dist/runtime/server/routes/auth/audit-logs.get.mjs +1 -1
  122. package/dist/runtime/server/routes/auth/magic-link/send.post.d.ts +1 -9
  123. package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +8 -0
  124. package/dist/runtime/server/routes/auth/organization/sso/[id].delete.mjs +1 -1
  125. package/dist/runtime/server/routes/auth/organization/sso/index.get.mjs +1 -1
  126. package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +1 -1
  127. package/dist/runtime/server/routes/auth/otp/send.post.d.ts +1 -9
  128. package/dist/runtime/server/routes/auth/otp/send.post.mjs +8 -0
  129. package/dist/runtime/server/routes/auth/sso/login.get.mjs +3 -3
  130. package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +1 -1
  131. package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +2 -2
  132. package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
  133. package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +1 -1
  134. package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +2 -2
  135. package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +1 -1
  136. package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +1 -1
  137. package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.mjs +3 -1
  138. package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.mjs +3 -1
  139. package/dist/runtime/server/routes/cms/bookmarks/[id].delete.mjs +1 -1
  140. package/dist/runtime/server/routes/cms/bookmarks/check.post.mjs +1 -1
  141. package/dist/runtime/server/routes/cms/bookmarks/index.get.mjs +1 -1
  142. package/dist/runtime/server/routes/cms/bookmarks/index.post.mjs +1 -1
  143. package/dist/runtime/server/routes/cms/deploy.post.mjs +1 -1
  144. package/dist/runtime/server/routes/cms/export.post.mjs +4 -3
  145. package/dist/runtime/server/routes/cms/search.get.mjs +7 -5
  146. package/dist/runtime/server/routes/cms/sync.post.mjs +2 -1
  147. package/dist/runtime/server/routes/comments/[id]/react.post.mjs +1 -2
  148. package/dist/runtime/server/routes/comments/[id]/report.post.d.ts +1 -1
  149. package/dist/runtime/server/routes/comments/[id]/report.post.mjs +0 -2
  150. package/dist/runtime/server/routes/comments/[id].delete.mjs +8 -4
  151. package/dist/runtime/server/routes/comments/[id].get.d.ts +1 -1
  152. package/dist/runtime/server/routes/comments/[id].get.mjs +1 -2
  153. package/dist/runtime/server/routes/comments/[id].patch.d.ts +1 -1
  154. package/dist/runtime/server/routes/comments/[id].patch.mjs +6 -3
  155. package/dist/runtime/server/routes/comments/batch.post.d.ts +2 -0
  156. package/dist/runtime/server/routes/comments/batch.post.mjs +33 -0
  157. package/dist/runtime/server/routes/comments/index.get.d.ts +1 -1
  158. package/dist/runtime/server/routes/comments/index.get.mjs +6 -4
  159. package/dist/runtime/server/routes/comments/index.post.d.ts +1 -1
  160. package/dist/runtime/server/routes/comments/index.post.mjs +6 -2
  161. package/dist/runtime/server/routes/feed.xml.get.mjs +3 -1
  162. package/dist/runtime/server/routes/sitemap.xml.get.mjs +3 -1
  163. package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +17 -0
  164. package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +29 -0
  165. package/dist/runtime/server/routes/store/cart/index.delete.d.ts +6 -0
  166. package/dist/runtime/server/routes/store/cart/index.delete.mjs +11 -0
  167. package/dist/runtime/server/routes/store/cart/index.get.d.ts +5 -0
  168. package/dist/runtime/server/routes/store/cart/index.get.mjs +14 -0
  169. package/dist/runtime/server/routes/store/cart/items/[id].delete.d.ts +6 -0
  170. package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +25 -0
  171. package/dist/runtime/server/routes/store/cart/items/[id].patch.d.ts +6 -0
  172. package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +29 -0
  173. package/dist/runtime/server/routes/store/cart/items.post.d.ts +6 -0
  174. package/dist/runtime/server/routes/store/cart/items.post.mjs +36 -0
  175. package/dist/runtime/server/routes/store/categories/index.get.d.ts +2 -0
  176. package/dist/runtime/server/routes/store/categories/index.get.mjs +8 -0
  177. package/dist/runtime/server/routes/store/checkout.post.d.ts +6 -0
  178. package/dist/runtime/server/routes/store/checkout.post.mjs +21 -0
  179. package/dist/runtime/server/routes/store/coupons/apply.post.d.ts +7 -0
  180. package/dist/runtime/server/routes/store/coupons/apply.post.mjs +18 -0
  181. package/dist/runtime/server/routes/store/currencies.get.d.ts +15 -0
  182. package/dist/runtime/server/routes/store/currencies.get.mjs +13 -0
  183. package/dist/runtime/server/routes/store/orders/[id].get.d.ts +2 -0
  184. package/dist/runtime/server/routes/store/orders/[id].get.mjs +26 -0
  185. package/dist/runtime/server/routes/store/orders/download/[token].get.d.ts +7 -0
  186. package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +57 -0
  187. package/dist/runtime/server/routes/store/orders/index.get.d.ts +5 -0
  188. package/dist/runtime/server/routes/store/orders/index.get.mjs +30 -0
  189. package/dist/runtime/server/routes/store/products/[slug].get.d.ts +2 -0
  190. package/dist/runtime/server/routes/store/products/[slug].get.mjs +18 -0
  191. package/dist/runtime/server/routes/store/products/index.get.d.ts +5 -0
  192. package/dist/runtime/server/routes/store/products/index.get.mjs +33 -0
  193. package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +9 -0
  194. package/dist/runtime/server/routes/store/tax/calculate.post.mjs +18 -0
  195. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +14 -1
  196. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +14 -1
  197. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +24 -1
  198. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +6 -0
  199. package/dist/runtime/server/utils/ai.d.ts +146 -21
  200. package/dist/runtime/server/utils/ai.mjs +406 -11
  201. package/dist/runtime/server/utils/analytics-query.d.ts +13 -58
  202. package/dist/runtime/server/utils/audit.d.ts +5 -4
  203. package/dist/runtime/server/utils/audit.mjs +25 -14
  204. package/dist/runtime/server/utils/auth.d.ts +29 -12
  205. package/dist/runtime/server/utils/auth.mjs +88 -70
  206. package/dist/runtime/server/utils/bots.d.ts +20 -4
  207. package/dist/runtime/server/utils/bots.mjs +7 -3
  208. package/dist/runtime/server/utils/browser-utils.d.ts +23 -23
  209. package/dist/runtime/server/utils/cache.d.ts +31 -10
  210. package/dist/runtime/server/utils/cache.mjs +130 -53
  211. package/dist/runtime/server/utils/cms/collections.d.ts +23 -0
  212. package/dist/runtime/server/utils/cms/collections.mjs +143 -0
  213. package/dist/runtime/server/utils/cms/common.d.ts +9 -0
  214. package/dist/runtime/server/utils/cms/common.mjs +28 -0
  215. package/dist/runtime/server/utils/cms/git.mjs +2 -2
  216. package/dist/runtime/server/utils/cms/navigation.d.ts +46 -0
  217. package/dist/runtime/server/utils/cms/navigation.mjs +683 -0
  218. package/dist/runtime/server/utils/cms/preview.d.ts +11 -0
  219. package/dist/runtime/server/utils/cms/preview.mjs +50 -0
  220. package/dist/runtime/server/utils/cms/search.d.ts +1 -1
  221. package/dist/runtime/server/utils/cms/search.mjs +11 -7
  222. package/dist/runtime/server/utils/cms/sync.d.ts +34 -0
  223. package/dist/runtime/server/utils/cms/sync.mjs +1082 -0
  224. package/dist/runtime/server/utils/cms/taxonomy.d.ts +103 -0
  225. package/dist/runtime/server/utils/cms/taxonomy.mjs +348 -0
  226. package/dist/runtime/server/utils/cms.d.ts +13 -249
  227. package/dist/runtime/server/utils/cms.mjs +108 -2350
  228. package/dist/runtime/server/utils/comments-filter.d.ts +45 -0
  229. package/dist/runtime/server/utils/comments-filter.mjs +541 -0
  230. package/dist/runtime/server/utils/comments.d.ts +71 -0
  231. package/dist/runtime/server/utils/comments.mjs +137 -61
  232. package/dist/runtime/server/utils/config.d.ts +4 -3
  233. package/dist/runtime/server/utils/config.mjs +7 -6
  234. package/dist/runtime/server/utils/context.d.ts +14 -0
  235. package/dist/runtime/server/utils/context.mjs +2 -2
  236. package/dist/runtime/server/utils/crypto.d.ts +44 -5
  237. package/dist/runtime/server/utils/crypto.mjs +18 -0
  238. package/dist/runtime/server/utils/domains.mjs +9 -5
  239. package/dist/runtime/server/utils/drizzle.d.ts +35 -3
  240. package/dist/runtime/server/utils/drizzle.mjs +115 -6
  241. package/dist/runtime/server/utils/durable-object.d.ts +106 -0
  242. package/dist/runtime/server/utils/durable-object.mjs +628 -0
  243. package/dist/runtime/server/utils/email-inbound.d.ts +29 -0
  244. package/dist/runtime/server/utils/email-inbound.mjs +76 -0
  245. package/dist/runtime/server/utils/impersonation.d.ts +32 -2
  246. package/dist/runtime/server/utils/impersonation.mjs +16 -13
  247. package/dist/runtime/server/utils/lock.d.ts +71 -0
  248. package/dist/runtime/server/utils/lock.mjs +139 -0
  249. package/dist/runtime/server/utils/mail-suppression.mjs +7 -7
  250. package/dist/runtime/server/utils/mail.d.ts +30 -19
  251. package/dist/runtime/server/utils/mcp.d.ts +44 -0
  252. package/dist/runtime/server/utils/mcp.mjs +308 -0
  253. package/dist/runtime/server/utils/notifications.d.ts +72 -7
  254. package/dist/runtime/server/utils/notifications.mjs +67 -55
  255. package/dist/runtime/server/utils/oauth.d.ts +27 -4
  256. package/dist/runtime/server/utils/organization.d.ts +63 -7
  257. package/dist/runtime/server/utils/organization.mjs +26 -21
  258. package/dist/runtime/server/utils/passwordless.d.ts +62 -33
  259. package/dist/runtime/server/utils/payments.d.ts +51 -12
  260. package/dist/runtime/server/utils/payments.mjs +472 -282
  261. package/dist/runtime/server/utils/queue.d.ts +106 -13
  262. package/dist/runtime/server/utils/queue.mjs +313 -28
  263. package/dist/runtime/server/utils/rag.d.ts +42 -14
  264. package/dist/runtime/server/utils/rag.mjs +169 -4
  265. package/dist/runtime/server/utils/ratelimit.d.ts +34 -5
  266. package/dist/runtime/server/utils/ratelimit.mjs +95 -14
  267. package/dist/runtime/server/utils/realtime.d.ts +68 -52
  268. package/dist/runtime/server/utils/scheduled-task.d.ts +42 -1
  269. package/dist/runtime/server/utils/scheduled-task.mjs +29 -0
  270. package/dist/runtime/server/utils/schema-fallback.d.ts +1 -1
  271. package/dist/runtime/server/utils/schema-fallback.mjs +1 -1
  272. package/dist/runtime/server/utils/session.d.ts +84 -10
  273. package/dist/runtime/server/utils/session.mjs +12 -10
  274. package/dist/runtime/server/utils/sse.d.ts +75 -0
  275. package/dist/runtime/server/utils/sse.mjs +147 -0
  276. package/dist/runtime/server/utils/sso.d.ts +1 -1
  277. package/dist/runtime/server/utils/storage.d.ts +53 -4
  278. package/dist/runtime/server/utils/storage.mjs +15 -11
  279. package/dist/runtime/server/utils/store-localization.d.ts +51 -0
  280. package/dist/runtime/server/utils/store-localization.mjs +417 -0
  281. package/dist/runtime/server/utils/store.d.ts +207 -0
  282. package/dist/runtime/server/utils/store.mjs +2227 -0
  283. package/dist/runtime/server/utils/table-names.d.ts +51 -0
  284. package/dist/runtime/server/utils/table-names.mjs +69 -0
  285. package/dist/runtime/server/utils/tenant.d.ts +26 -2
  286. package/dist/runtime/server/utils/tenant.mjs +16 -12
  287. package/dist/runtime/server/utils/tools-registry-fallback.d.ts +1 -0
  288. package/dist/runtime/server/utils/tools-registry-fallback.mjs +1 -0
  289. package/dist/runtime/server/utils/totp.d.ts +45 -2
  290. package/dist/runtime/server/utils/tracker.d.ts +10 -11
  291. package/dist/runtime/server/utils/turnstile.d.ts +16 -1
  292. package/dist/runtime/server/utils/workflows.d.ts +92 -0
  293. package/dist/runtime/server/utils/workflows.mjs +299 -0
  294. package/dist/runtime/server.d.ts +8 -1
  295. package/dist/runtime/server.mjs +8 -5
  296. package/dist/runtime/service.d.ts +10 -10
  297. package/dist/runtime/storage.d.ts +1 -0
  298. package/dist/runtime/storage.mjs +1 -0
  299. package/dist/runtime/store.d.ts +4 -0
  300. package/dist/runtime/store.mjs +2 -0
  301. package/dist/runtime/test-utils.d.ts +11 -10
  302. package/dist/runtime/test-utils.mjs +64 -4
  303. package/dist/runtime/types/ai.d.ts +21 -2
  304. package/dist/runtime/types/d1.d.ts +17 -0
  305. package/dist/runtime/types/drizzle.d.ts +2 -2
  306. package/dist/runtime/types/durable-object.d.ts +62 -2
  307. package/dist/runtime/types/email.d.ts +46 -0
  308. package/dist/runtime/types/imports.d.ts +6 -1
  309. package/dist/runtime/types/index.d.ts +58 -0
  310. package/dist/runtime/types/index.mjs +3 -0
  311. package/dist/runtime/types/mcp.d.ts +83 -0
  312. package/dist/runtime/types/mcp.mjs +0 -0
  313. package/dist/runtime/types/queue.d.ts +36 -0
  314. package/dist/runtime/types/r2.d.ts +41 -0
  315. package/dist/runtime/types/store.d.ts +313 -0
  316. package/dist/runtime/types/store.mjs +0 -0
  317. package/dist/runtime/types/workflows.d.ts +98 -0
  318. package/dist/runtime/types/workflows.mjs +0 -0
  319. package/dist/runtime/workflows.d.ts +5 -0
  320. package/dist/runtime/workflows.mjs +2 -0
  321. package/dist/types/ai.d.ts +721 -0
  322. package/dist/types/cms.d.ts +710 -0
  323. package/dist/types.d.ts +430 -1292
  324. package/dist/utils/auth-schema.d.ts +3 -2
  325. package/dist/utils/bots.d.ts +20 -0
  326. package/dist/utils/comments-schema.d.ts +5 -4
  327. package/dist/utils/drizzle.d.ts +83 -3
  328. package/dist/utils/durable-objects.d.ts +10 -0
  329. package/dist/utils/email-inbound.d.ts +10 -0
  330. package/dist/utils/local-db.d.ts +1 -3
  331. package/dist/utils/mcp.d.ts +24 -0
  332. package/dist/utils/notifications-schema.d.ts +5 -4
  333. package/dist/utils/payments-schema.d.ts +4 -3
  334. package/dist/utils/store-schema.d.ts +14 -0
  335. package/dist/utils/table-names.d.ts +1 -0
  336. package/dist/utils/tenants-schema.d.ts +4 -3
  337. package/dist/utils/tools.d.ts +20 -0
  338. package/dist/utils/workflows.d.ts +8 -0
  339. package/package.json +34 -4
  340. package/dist/chunks/wrangler.mjs +0 -897
  341. package/dist/runtime/app/components/AuthRegister.vue +0 -306
  342. package/dist/runtime/app/components/AuthSessionsList.vue +0 -137
  343. package/dist/runtime/app/components/AuthSignIn.vue +0 -298
  344. package/dist/runtime/app/components/CMSBookmarkButton.vue +0 -59
  345. package/dist/runtime/app/components/CMSImage.vue +0 -47
  346. package/dist/runtime/app/components/CMSLocaleSwitcher.vue +0 -110
  347. package/dist/runtime/app/components/CMSNewsletter.vue +0 -81
  348. package/dist/runtime/app/components/CMSPreviewBanner.vue +0 -83
  349. package/dist/runtime/app/components/CMSTableOfContents.vue +0 -84
  350. package/dist/runtime/app/components/CMSVersionBanner.vue +0 -53
  351. package/dist/runtime/app/components/CMSVersionSwitcher.vue +0 -140
  352. package/dist/runtime/app/components/Comments.vue +0 -411
  353. package/dist/runtime/app/components/FileUpload.vue +0 -200
  354. package/dist/runtime/app/components/ImpersonationBanner.vue +0 -61
  355. package/dist/runtime/app/components/NotificationBell.vue +0 -263
  356. package/dist/runtime/app/components/NotificationList.vue +0 -205
  357. package/dist/runtime/app/components/NotificationPrompt.vue +0 -133
  358. package/dist/runtime/app/components/PricingGated.vue +0 -81
  359. package/dist/runtime/app/components/PricingTable.vue +0 -274
  360. package/dist/runtime/app/components/RealtimeChat.vue +0 -164
  361. package/dist/runtime/app/components/RealtimePresence.vue +0 -129
  362. package/dist/runtime/app/components/RealtimeStatus.vue +0 -79
  363. package/dist/runtime/app/components/SubscriptionCard.vue +0 -207
  364. package/dist/runtime/app/components/UserProfile.vue +0 -558
@@ -1,298 +0,0 @@
1
- <script lang="ts" setup>
2
- import { navigateTo, useRuntimeConfig } from "nuxt/app"
3
- import { computed, ref } from "vue"
4
-
5
- import { useAuth } from "../composables/auth"
6
- import { usePasskey } from "../composables/passkey"
7
- import { usePasswordless } from "../composables/passwordless"
8
-
9
- interface Props {
10
- title?: string
11
- description?: string
12
- redirect?: string
13
- signUpUrl?: string
14
- providers?: string[]
15
- allowMagicLink?: boolean
16
- allowPasskey?: boolean
17
- }
18
-
19
- const props = withDefaults(defineProps<Props>(), {
20
- title: "Welcome back",
21
- description: "Sign in to your account",
22
- redirect: "/",
23
- signUpUrl: "/register",
24
- providers: () => ["github", "google"],
25
- allowMagicLink: true,
26
- allowPasskey: true,
27
- })
28
-
29
- const emit = defineEmits<{
30
- success: [session: any]
31
- error: [err: any]
32
- }>()
33
-
34
- const runtimeConfig = useRuntimeConfig()
35
- const authConfig = (runtimeConfig.public as any)?.qarpeo?.auth || {}
36
- const authPrefix = authConfig.prefix || "/api/auth"
37
-
38
- const { signIn, fetch: refreshSession } = useAuth()
39
- const { loginWithPasskey, loading: passkeyLoading } = usePasskey()
40
- const { sendMagicLink, loading: magicLinkLoading } = usePasswordless()
41
-
42
- // Form mode: 'password' | 'magic-link'
43
- const mode = ref<"password" | "magic-link">("password")
44
- const email = ref("")
45
- const password = ref("")
46
- const rememberMe = ref(true)
47
- const loading = ref(false)
48
- const errorMessage = ref("")
49
- const successMessage = ref("")
50
-
51
- const isLoading = computed(() => loading.value || passkeyLoading.value || magicLinkLoading.value)
52
-
53
- async function handlePasswordSignIn() {
54
- if (!email.value || !password.value) {
55
- errorMessage.value = "Please fill in all fields"
56
- return
57
- }
58
- loading.value = true
59
- errorMessage.value = ""
60
- try {
61
- const res = await signIn.email({
62
- email: email.value,
63
- password: password.value,
64
- rememberMe: rememberMe.value,
65
- })
66
- if ((res as any)?.error) {
67
- throw new Error((res as any).error.message || "Failed to sign in")
68
- }
69
- await refreshSession()
70
- emit("success", res)
71
- if (props.redirect) {
72
- await navigateTo(props.redirect)
73
- }
74
- } catch (err: any) {
75
- errorMessage.value = err?.data?.message || err?.message || "Invalid credentials"
76
- emit("error", err)
77
- } finally {
78
- loading.value = false
79
- }
80
- }
81
-
82
- async function handleMagicLinkSignIn() {
83
- if (!email.value) {
84
- errorMessage.value = "Please enter your email"
85
- return
86
- }
87
- errorMessage.value = ""
88
- successMessage.value = ""
89
- try {
90
- await sendMagicLink(email.value)
91
- successMessage.value = "Check your email for the magic sign-in link!"
92
- } catch (err: any) {
93
- errorMessage.value = err?.data?.message || err?.message || "Failed to send magic link"
94
- emit("error", err)
95
- }
96
- }
97
-
98
- async function handlePasskeySignIn() {
99
- errorMessage.value = ""
100
- try {
101
- const res = await loginWithPasskey()
102
- await refreshSession()
103
- emit("success", res)
104
- if (props.redirect) {
105
- await navigateTo(props.redirect)
106
- }
107
- } catch (err: any) {
108
- errorMessage.value = err?.data?.message || err?.message || "Passkey sign-in cancelled or failed"
109
- emit("error", err)
110
- }
111
- }
112
-
113
- function handleOAuthSignIn(provider: string) {
114
- if (typeof window !== "undefined") {
115
- const callbackUrl = encodeURIComponent(window.location.origin + props.redirect)
116
- window.location.href = `${authPrefix}/sign-in/social?provider=${provider}&callbackURL=${callbackUrl}`
117
- }
118
- }
119
- </script>
120
-
121
- <template>
122
- <div
123
- class="mx-auto w-full max-w-md rounded-2xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900"
124
- >
125
- <div class="mb-6 text-center">
126
- <h2 class="text-2xl font-bold tracking-tight text-neutral-900 dark:text-neutral-50">
127
- {{ title }}
128
- </h2>
129
- <p class="mt-1 text-sm text-neutral-500 dark:text-neutral-400">
130
- {{ description }}
131
- </p>
132
- </div>
133
-
134
- <!-- Error & Success Banners -->
135
- <div
136
- v-if="errorMessage"
137
- class="mb-4 rounded-lg bg-red-50 p-3 text-sm text-red-700 dark:bg-red-950/50 dark:text-red-400"
138
- >
139
- {{ errorMessage }}
140
- </div>
141
- <div
142
- v-if="successMessage"
143
- class="mb-4 rounded-lg bg-emerald-50 p-3 text-sm text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-400"
144
- >
145
- {{ successMessage }}
146
- </div>
147
-
148
- <!-- Social OAuth Providers -->
149
- <div v-if="providers.length > 0" class="space-y-3">
150
- <div class="grid grid-cols-1 gap-2" :class="providers.length > 1 ? 'sm:grid-cols-2' : ''">
151
- <button
152
- v-for="provider in providers"
153
- :key="provider"
154
- type="button"
155
- class="flex items-center justify-center gap-2 rounded-lg border border-neutral-200 bg-white px-4 py-2 text-sm font-medium text-neutral-700 hover:bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-200 dark:hover:bg-neutral-700"
156
- @click="handleOAuthSignIn(provider)"
157
- >
158
- <span class="capitalize">{{ provider }}</span>
159
- </button>
160
- </div>
161
-
162
- <div class="relative my-4 flex items-center justify-center">
163
- <div class="w-full border-t border-neutral-200 dark:border-neutral-700" />
164
- <span class="absolute bg-white px-3 text-xs text-neutral-400 dark:bg-neutral-900"
165
- >or continue with</span
166
- >
167
- </div>
168
- </div>
169
-
170
- <!-- Form Mode Tabs (Password vs Magic Link) -->
171
- <div v-if="allowMagicLink" class="mb-4 flex rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800">
172
- <button
173
- type="button"
174
- class="flex-1 rounded-md py-1.5 text-xs font-semibold transition"
175
- :class="
176
- mode === 'password'
177
- ? 'bg-white shadow text-neutral-900 dark:bg-neutral-700 dark:text-white'
178
- : 'text-neutral-500 hover:text-neutral-700 dark:text-neutral-400'
179
- "
180
- @click="mode = 'password'"
181
- >
182
- Password
183
- </button>
184
- <button
185
- type="button"
186
- class="flex-1 rounded-md py-1.5 text-xs font-semibold transition"
187
- :class="
188
- mode === 'magic-link'
189
- ? 'bg-white shadow text-neutral-900 dark:bg-neutral-700 dark:text-white'
190
- : 'text-neutral-500 hover:text-neutral-700 dark:text-neutral-400'
191
- "
192
- @click="mode = 'magic-link'"
193
- >
194
- Magic Link
195
- </button>
196
- </div>
197
-
198
- <!-- Password Sign In Form -->
199
- <form v-if="mode === 'password'" class="space-y-4" @submit.prevent="handlePasswordSignIn">
200
- <div>
201
- <label class="block text-xs font-medium text-neutral-700 dark:text-neutral-300"
202
- >Email Address</label
203
- >
204
- <input
205
- v-model="email"
206
- type="email"
207
- required
208
- autocomplete="email"
209
- placeholder="you@example.com"
210
- class="mt-1 block w-full rounded-lg border border-neutral-200 bg-white px-3 py-2 text-sm text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-900 focus:outline-none dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:focus:border-neutral-400"
211
- />
212
- </div>
213
-
214
- <div>
215
- <label class="block text-xs font-medium text-neutral-700 dark:text-neutral-300"
216
- >Password</label
217
- >
218
- <input
219
- v-model="password"
220
- type="password"
221
- required
222
- autocomplete="current-password"
223
- placeholder="••••••••"
224
- class="mt-1 block w-full rounded-lg border border-neutral-200 bg-white px-3 py-2 text-sm text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-900 focus:outline-none dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:focus:border-neutral-400"
225
- />
226
- </div>
227
-
228
- <div class="flex items-center justify-between text-xs">
229
- <label class="flex items-center gap-2 text-neutral-600 dark:text-neutral-400">
230
- <input
231
- v-model="rememberMe"
232
- type="checkbox"
233
- class="rounded border-neutral-300 dark:border-neutral-700"
234
- />
235
- <span>Remember me</span>
236
- </label>
237
- </div>
238
-
239
- <button
240
- type="submit"
241
- :disabled="isLoading"
242
- class="flex w-full items-center justify-center rounded-lg bg-neutral-900 py-2.5 text-sm font-medium text-white transition hover:bg-neutral-800 disabled:opacity-50 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-white"
243
- >
244
- <span v-if="loading">Signing in...</span>
245
- <span v-else>Sign In</span>
246
- </button>
247
- </form>
248
-
249
- <!-- Magic Link Form -->
250
- <form v-else class="space-y-4" @submit.prevent="handleMagicLinkSignIn">
251
- <div>
252
- <label class="block text-xs font-medium text-neutral-700 dark:text-neutral-300"
253
- >Email Address</label
254
- >
255
- <input
256
- v-model="email"
257
- type="email"
258
- required
259
- autocomplete="email"
260
- placeholder="you@example.com"
261
- class="mt-1 block w-full rounded-lg border border-neutral-200 bg-white px-3 py-2 text-sm text-neutral-900 placeholder:text-neutral-400 focus:border-neutral-900 focus:outline-none dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:focus:border-neutral-400"
262
- />
263
- </div>
264
-
265
- <button
266
- type="submit"
267
- :disabled="isLoading"
268
- class="flex w-full items-center justify-center rounded-lg bg-neutral-900 py-2.5 text-sm font-medium text-white transition hover:bg-neutral-800 disabled:opacity-50 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-white"
269
- >
270
- <span v-if="magicLinkLoading">Sending link...</span>
271
- <span v-else>Send Magic Sign-in Link</span>
272
- </button>
273
- </form>
274
-
275
- <!-- Passkey Button -->
276
- <div v-if="allowPasskey" class="mt-4 pt-4 border-t border-neutral-100 dark:border-neutral-800">
277
- <button
278
- type="button"
279
- :disabled="isLoading"
280
- class="flex w-full items-center justify-center gap-2 rounded-lg border border-neutral-200 bg-neutral-50 py-2 text-xs font-medium text-neutral-700 hover:bg-neutral-100 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-750"
281
- @click="handlePasskeySignIn"
282
- >
283
- <span>Sign in with Passkey / Biometrics</span>
284
- </button>
285
- </div>
286
-
287
- <!-- Sign up footer -->
288
- <div v-if="signUpUrl" class="mt-6 text-center text-xs text-neutral-500 dark:text-neutral-400">
289
- Don't have an account?
290
- <a
291
- :href="signUpUrl"
292
- class="font-medium text-neutral-900 underline hover:text-neutral-700 dark:text-neutral-100"
293
- >
294
- Create an account
295
- </a>
296
- </div>
297
- </div>
298
- </template>
@@ -1,59 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref, onMounted } from "vue"
3
-
4
- import { useCMSBookmarks } from "../composables/cms"
5
-
6
- const props = withDefaults(
7
- defineProps<{
8
- entryId: string
9
- showLabel?: boolean
10
- }>(),
11
- {
12
- showLabel: false,
13
- },
14
- )
15
-
16
- const { toggle, check, loading } = useCMSBookmarks()
17
- const isBookmarked = ref(false)
18
-
19
- onMounted(async () => {
20
- if (props.entryId) {
21
- isBookmarked.value = await check(props.entryId)
22
- }
23
- })
24
-
25
- async function handleToggle() {
26
- if (loading.value) return
27
- isBookmarked.value = await toggle(props.entryId)
28
- }
29
- </script>
30
-
31
- <template>
32
- <button
33
- type="button"
34
- :disabled="loading"
35
- class="qarpeo-bookmark-btn inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs font-medium transition hover:bg-neutral-100 disabled:opacity-50 dark:hover:bg-neutral-800"
36
- :class="
37
- isBookmarked
38
- ? 'border-primary-500 text-primary-600 bg-primary-50/50 dark:bg-primary-950/20'
39
- : 'text-neutral-600 dark:text-neutral-300'
40
- "
41
- @click="handleToggle"
42
- >
43
- <svg
44
- xmlns="http://www.w3.org/2000/svg"
45
- class="h-4 w-4"
46
- :fill="isBookmarked ? 'currentColor' : 'none'"
47
- viewBox="0 0 24 24"
48
- stroke="currentColor"
49
- stroke-width="2"
50
- >
51
- <path
52
- stroke-linecap="round"
53
- stroke-linejoin="round"
54
- d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
55
- />
56
- </svg>
57
- <span v-if="showLabel">{{ isBookmarked ? "Saved" : "Save" }}</span>
58
- </button>
59
- </template>
@@ -1,47 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed } from "vue"
3
-
4
- import { getOptimizedImageUrl } from "../composables/storage"
5
-
6
- /**
7
- * `<CMSImage>` — Renders an optimized CMS-managed image via Qarpeo blob storage. Similar to
8
- * `<BlobImage>` but focused on CMS content images.
9
- */
10
- const props = withDefaults(
11
- defineProps<{
12
- src?: string
13
- preset?: string
14
- width?: number | string
15
- height?: number | string
16
- quality?: number | string
17
- format?: string
18
- fit?: string
19
- alt?: string
20
- loading?: "lazy" | "eager"
21
- }>(),
22
- {
23
- src: "",
24
- alt: "",
25
- loading: "lazy",
26
- },
27
- )
28
-
29
- const resolvedUrl = computed(() => {
30
- if (!props.src) return ""
31
- if ((props.src.startsWith("http://") || props.src.startsWith("https://")) && !props.preset) {
32
- return props.src
33
- }
34
- return getOptimizedImageUrl(props.src, {
35
- preset: props.preset,
36
- width: props.width ? Number(props.width) : undefined,
37
- height: props.height ? Number(props.height) : undefined,
38
- quality: props.quality ? Number(props.quality) : undefined,
39
- format: props.format as any,
40
- fit: props.fit as any,
41
- })
42
- })
43
- </script>
44
-
45
- <template>
46
- <img :src="resolvedUrl" :alt="alt" :loading="loading" />
47
- </template>
@@ -1,110 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed } from "vue"
3
-
4
- import { useCMSLocale } from "../composables/cms"
5
-
6
- /**
7
- * `<CMSLocaleSwitcher>` — Nuxt UI selector for switching between configured CMS content locales.
8
- * Updates `useCMSLocale()` state, persists preference in cookie, and updates page content.
9
- */
10
- const props = withDefaults(
11
- defineProps<{
12
- variant?: "dropdown" | "select" | "buttons"
13
- size?: "xs" | "sm" | "md"
14
- color?: "neutral" | "primary"
15
- showFlags?: boolean
16
- class?: string
17
- }>(),
18
- {
19
- variant: "dropdown",
20
- size: "xs",
21
- color: "neutral",
22
- showFlags: true,
23
- class: "",
24
- },
25
- )
26
-
27
- const { locale, localeConfigs, setLocale } = useCMSLocale()
28
-
29
- const activeConfig = computed(
30
- () => localeConfigs.value?.find((c) => c.code === locale.value) || localeConfigs.value?.[0],
31
- )
32
-
33
- const dropdownItems = computed(() => [
34
- (localeConfigs.value || []).map((c) => ({
35
- label: `${props.showFlags && c.flag ? `${c.flag} ` : ""}${c.name}`,
36
- icon: c.code === locale.value ? "i-lucide-check" : undefined,
37
- onSelect: () => setLocale(c.code),
38
- })),
39
- ])
40
-
41
- const selectItems = computed(() =>
42
- (localeConfigs.value || []).map((c) => ({
43
- label: `${props.showFlags && c.flag ? `${c.flag} ` : ""}${c.name}`,
44
- value: c.code,
45
- })),
46
- )
47
- </script>
48
-
49
- <template>
50
- <template v-if="localeConfigs && localeConfigs.length > 1">
51
- <!-- Buttons variant -->
52
- <div
53
- v-if="variant === 'buttons'"
54
- :class="[
55
- 'inline-flex items-center gap-1 rounded-lg border border-gray-200 dark:border-gray-800 p-1 bg-gray-50/50 dark:bg-gray-900/50 text-xs font-medium',
56
- props.class,
57
- ]"
58
- role="group"
59
- aria-label="Language switcher"
60
- >
61
- <UButton
62
- v-for="c in localeConfigs"
63
- :key="c.code"
64
- :size="size"
65
- :variant="c.code === locale ? 'solid' : 'ghost'"
66
- :color="color"
67
- :label="c.name"
68
- :class="[
69
- 'flex items-center gap-1.5',
70
- c.code === locale
71
- ? 'bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-xs font-semibold'
72
- : 'text-gray-600 dark:text-gray-400',
73
- ]"
74
- @click="setLocale(c.code)"
75
- >
76
- <template v-if="showFlags && c.flag" #leading>
77
- <span class="text-sm leading-none">{{ c.flag }}</span>
78
- </template>
79
- </UButton>
80
- </div>
81
-
82
- <!-- Select variant: Nuxt UI USelect -->
83
- <USelect
84
- v-else-if="variant === 'select'"
85
- :model-value="locale"
86
- :items="selectItems"
87
- :size="size"
88
- :color="color"
89
- variant="subtle"
90
- :class="props.class"
91
- @update:model-value="setLocale($event)"
92
- />
93
-
94
- <!-- Dropdown variant (DEFAULT): Nuxt UI UDropdownMenu -->
95
- <UDropdownMenu v-else :items="dropdownItems" :content="{ align: 'start' }">
96
- <UButton
97
- :size="size"
98
- variant="outline"
99
- :color="color"
100
- :label="activeConfig?.name"
101
- trailing-icon="i-lucide-chevron-down"
102
- :class="props.class"
103
- >
104
- <template v-if="showFlags && activeConfig?.flag" #leading>
105
- <span class="text-sm leading-none">{{ activeConfig.flag }}</span>
106
- </template>
107
- </UButton>
108
- </UDropdownMenu>
109
- </template>
110
- </template>
@@ -1,81 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref } from "vue"
3
-
4
- import { useCMSNewsletter } from "../composables/cms"
5
-
6
- withDefaults(
7
- defineProps<{
8
- title?: string
9
- description?: string
10
- source?: string
11
- variant?: "card" | "inline"
12
- }>(),
13
- {
14
- title: "Subscribe to our Newsletter",
15
- description: "Get the latest articles, updates, and resources directly to your inbox.",
16
- source: "website",
17
- variant: "card",
18
- },
19
- )
20
-
21
- const email = ref("")
22
- const { loading, message, success, error, subscribe, reset } = useCMSNewsletter()
23
-
24
- async function handleSubscribe(sourceName: string) {
25
- if (!email.value) return
26
- const ok = await subscribe(email.value, sourceName)
27
- if (ok) {
28
- email.value = ""
29
- }
30
- }
31
- </script>
32
-
33
- <template>
34
- <div
35
- class="qarpeo-newsletter"
36
- :class="
37
- variant === 'card'
38
- ? 'rounded-2xl border bg-neutral-50/50 p-6 sm:p-8 text-center dark:bg-neutral-900/50'
39
- : 'space-y-3'
40
- "
41
- >
42
- <div v-if="variant === 'card'" class="mx-auto max-w-md space-y-2">
43
- <h3 class="text-xl font-bold tracking-tight text-neutral-900 dark:text-white">
44
- {{ title }}
45
- </h3>
46
- <p class="text-xs text-neutral-600 dark:text-neutral-400">
47
- {{ description }}
48
- </p>
49
- </div>
50
-
51
- <form
52
- class="mt-4 flex flex-col gap-2 sm:flex-row sm:items-center"
53
- :class="variant === 'card' ? 'mx-auto max-w-md' : ''"
54
- @submit.prevent="handleSubscribe(source)"
55
- >
56
- <input
57
- v-model="email"
58
- type="email"
59
- required
60
- placeholder="Enter your email"
61
- :disabled="loading"
62
- class="flex-1 rounded-lg border bg-white px-3.5 py-2 text-sm outline-none focus:ring-2 focus:ring-primary-500 disabled:opacity-50 dark:bg-neutral-800"
63
- @input="reset"
64
- />
65
- <button
66
- type="submit"
67
- :disabled="loading || !email"
68
- class="rounded-lg bg-neutral-900 px-5 py-2 text-sm font-semibold text-white transition hover:bg-neutral-800 disabled:opacity-50 dark:bg-white dark:text-neutral-900"
69
- >
70
- {{ loading ? "Joining..." : "Subscribe" }}
71
- </button>
72
- </form>
73
-
74
- <p v-if="success" class="mt-2 text-xs font-medium text-emerald-600 dark:text-emerald-400">
75
- {{ message }}
76
- </p>
77
- <p v-else-if="error" class="mt-2 text-xs font-medium text-red-500">
78
- {{ error }}
79
- </p>
80
- </div>
81
- </template>
@@ -1,83 +0,0 @@
1
- <script lang="ts" setup>
2
- import { computed } from "vue"
3
-
4
- import { useCMSPreview } from "../composables/cms-preview"
5
-
6
- /**
7
- * `<CMSPreviewBanner>` / `<DocsPreviewBanner>` — Warning banner displayed when a user is viewing an
8
- * unpublished CMS entry in Preview Mode. Provides an expiry notice and a one-click button to exit
9
- * preview mode.
10
- */
11
- withDefaults(
12
- defineProps<{
13
- class?: string
14
- adminUrl?: string
15
- }>(),
16
- {
17
- class: "",
18
- adminUrl: "/admin",
19
- },
20
- )
21
-
22
- const { isPreview, expires, disable } = useCMSPreview()
23
-
24
- const remainingTime = computed(() => {
25
- if (!expires.value) return null
26
- const exp = Number(expires.value)
27
- if (isNaN(exp)) return null
28
- const diffMs = exp - Date.now()
29
- if (diffMs <= 0) return "expired"
30
- const hours = Math.floor(diffMs / (1000 * 60 * 60))
31
- const minutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60))
32
- if (hours > 0) return `${hours}h ${minutes}m remaining`
33
- return `${minutes}m remaining`
34
- })
35
- </script>
36
-
37
- <template>
38
- <div
39
- v-if="isPreview"
40
- :class="[
41
- 'rounded-lg border border-amber-400/80 dark:border-amber-600/60 bg-amber-50/95 dark:bg-amber-950/40 p-3.5 text-xs text-amber-950 dark:text-amber-200 mb-6 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 shadow-xs',
42
- $props.class,
43
- ]"
44
- role="status"
45
- aria-live="polite"
46
- >
47
- <div class="flex items-center gap-2.5 flex-wrap">
48
- <UBadge
49
- color="warning"
50
- variant="solid"
51
- size="xs"
52
- class="text-[10px] font-bold tracking-wide uppercase"
53
- label="Draft Preview"
54
- />
55
- <span class="font-medium">You are viewing an unpublished preview.</span>
56
- <span v-if="remainingTime" class="text-amber-800 dark:text-amber-300/80">
57
- ({{ remainingTime }})
58
- </span>
59
- </div>
60
- <div class="flex items-center gap-2 shrink-0 w-full sm:w-auto justify-end">
61
- <UButton
62
- v-if="adminUrl"
63
- :to="adminUrl"
64
- size="xs"
65
- color="warning"
66
- variant="ghost"
67
- class="font-semibold"
68
- >
69
- Open in CMS
70
- </UButton>
71
- <UButton
72
- size="xs"
73
- color="warning"
74
- variant="subtle"
75
- class="font-semibold"
76
- trailing-icon="i-lucide-x"
77
- @click="disable()"
78
- >
79
- Exit Preview
80
- </UButton>
81
- </div>
82
- </div>
83
- </template>