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.
- package/README.md +114 -26
- package/dist/apps/cms.d.ts +4 -0
- package/dist/apps/comments.d.ts +4 -0
- package/dist/apps/payments.d.ts +4 -0
- package/dist/apps/store.d.ts +4 -0
- package/dist/chunks/auth-schema.mjs +169 -30
- package/dist/chunks/tools.mjs +1680 -0
- package/dist/cli/index.mjs +1256 -221
- package/dist/core/aliases.d.ts +5 -0
- package/dist/core/context.d.ts +10 -0
- package/dist/core/cross-drive.d.ts +2 -0
- package/dist/core/d1-migrate.d.ts +4 -0
- package/dist/core/devtools.d.ts +4 -0
- package/dist/core/nitro.d.ts +4 -0
- package/dist/core/schema.d.ts +4 -0
- package/dist/core/server-utils.d.ts +4 -0
- package/dist/core/wrangler.d.ts +4 -0
- package/dist/dev/wrangler.d.ts +1 -0
- package/dist/fate/index.d.ts +8 -8
- package/dist/features/agents.d.ts +4 -0
- package/dist/features/auth.d.ts +4 -0
- package/dist/features/bots.d.ts +4 -0
- package/dist/features/fate.d.ts +4 -0
- package/dist/features/mail.d.ts +4 -0
- package/dist/features/mcp.d.ts +4 -0
- package/dist/features/multitenant.d.ts +4 -0
- package/dist/features/notifications.d.ts +4 -0
- package/dist/features/realtime.d.ts +4 -0
- package/dist/module.d.ts +10 -2
- package/dist/module.mjs +6313 -5114
- package/dist/primitives/ai.d.ts +4 -0
- package/dist/primitives/analytics.d.ts +4 -0
- package/dist/primitives/blob.d.ts +4 -0
- package/dist/primitives/browser.d.ts +4 -0
- package/dist/primitives/cache.d.ts +4 -0
- package/dist/primitives/d1.d.ts +4 -0
- package/dist/primitives/do.d.ts +4 -0
- package/dist/primitives/email.d.ts +4 -0
- package/dist/primitives/hyperdrive.d.ts +4 -0
- package/dist/primitives/kv.d.ts +4 -0
- package/dist/primitives/queue.d.ts +4 -0
- package/dist/primitives/ratelimit.d.ts +4 -0
- package/dist/primitives/vectorize.d.ts +4 -0
- package/dist/primitives/workflows.d.ts +4 -0
- package/dist/runtime/ai.d.ts +3 -3
- package/dist/runtime/ai.mjs +8 -1
- package/dist/runtime/app/components/RealtimeCursors.vue +2 -2
- package/dist/runtime/app/composables/ai.d.ts +56 -29
- package/dist/runtime/app/composables/analytics.d.ts +26 -106
- package/dist/runtime/app/composables/api-tokens.d.ts +31 -34
- package/dist/runtime/app/composables/auth.d.ts +147 -51
- package/dist/runtime/app/composables/auth.mjs +0 -7
- package/dist/runtime/app/composables/chat.d.ts +38 -35
- package/dist/runtime/app/composables/cms-preview.d.ts +30 -25
- package/dist/runtime/app/composables/cms.d.ts +57 -282
- package/dist/runtime/app/composables/cms.mjs +0 -35
- package/dist/runtime/app/composables/comments.d.ts +32 -5
- package/dist/runtime/app/composables/comments.mjs +29 -1
- package/dist/runtime/app/composables/docs-version.d.ts +25 -28
- package/dist/runtime/app/composables/impersonation.d.ts +22 -5
- package/dist/runtime/app/composables/organization.d.ts +38 -91
- package/dist/runtime/app/composables/passkey.d.ts +22 -6
- package/dist/runtime/app/composables/passwordless.d.ts +24 -7
- package/dist/runtime/app/composables/payments.d.ts +50 -34
- package/dist/runtime/app/composables/payments.mjs +1 -0
- package/dist/runtime/app/composables/sse.d.ts +76 -0
- package/dist/runtime/app/composables/sse.mjs +152 -0
- package/dist/runtime/app/composables/storage.d.ts +53 -65
- package/dist/runtime/app/composables/storage.mjs +17 -0
- package/dist/runtime/app/composables/store.d.ts +198 -0
- package/dist/runtime/app/composables/store.mjs +414 -0
- package/dist/runtime/app/composables/tenant.d.ts +31 -72
- package/dist/runtime/app/composables/turnstile.d.ts +16 -3
- package/dist/runtime/app/composables/two-factor.d.ts +23 -6
- package/dist/runtime/app/pages/devtools/notifications.vue +30 -27
- package/dist/runtime/app/pages/devtools/realtime.vue +19 -31
- package/dist/runtime/app/pages/devtools.vue +0 -7
- package/dist/runtime/auth.d.ts +9 -9
- package/dist/runtime/blob.d.ts +10 -1
- package/dist/runtime/blob.mjs +83 -0
- package/dist/runtime/cache.d.ts +48 -0
- package/dist/runtime/cache.mjs +92 -0
- package/dist/runtime/comments.d.ts +4 -0
- package/dist/runtime/comments.mjs +2 -0
- package/dist/runtime/db.d.ts +21 -1
- package/dist/runtime/db.mjs +54 -0
- package/dist/runtime/drizzle.d.ts +4 -2
- package/dist/runtime/drizzle.mjs +68 -1
- package/dist/runtime/durable-object.d.ts +2 -0
- package/dist/runtime/durable-object.mjs +2 -0
- package/dist/runtime/email.d.ts +1 -1
- package/dist/runtime/email.mjs +1 -1
- package/dist/runtime/kv.mjs +50 -1
- package/dist/runtime/mcp.d.ts +2 -0
- package/dist/runtime/mcp.mjs +2 -0
- package/dist/runtime/queue.d.ts +12 -2
- package/dist/runtime/queue.mjs +19 -1
- package/dist/runtime/ratelimit.d.ts +1 -0
- package/dist/runtime/ratelimit.mjs +7 -0
- package/dist/runtime/schema.d.ts +313 -0
- package/dist/runtime/schema.mjs +259 -0
- package/dist/runtime/server/db/cms-schema.d.ts +1225 -171
- package/dist/runtime/server/db/cms-schema.mjs +69 -70
- package/dist/runtime/server/db/store-schema.d.ts +4344 -0
- package/dist/runtime/server/db/store-schema.mjs +266 -0
- package/dist/runtime/server/durable-objects/agent.mjs +35 -0
- package/dist/runtime/server/durable-objects/room.mjs +0 -1
- package/dist/runtime/server/middleware/ratelimit.mjs +10 -8
- package/dist/runtime/server/plugins/comments.d.ts +7 -0
- package/dist/runtime/server/plugins/comments.mjs +7 -0
- package/dist/runtime/server/plugins/email-inbound.d.ts +5 -0
- package/dist/runtime/server/plugins/email-inbound.mjs +17 -0
- package/dist/runtime/server/plugins/store.d.ts +7 -0
- package/dist/runtime/server/plugins/store.mjs +7 -0
- package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +2 -2
- package/dist/runtime/server/routes/atom.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +13 -2
- package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +9 -3
- package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +11 -3
- package/dist/runtime/server/routes/auth/account.delete.mjs +2 -1
- package/dist/runtime/server/routes/auth/audit-logs.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/magic-link/send.post.d.ts +1 -9
- package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +8 -0
- package/dist/runtime/server/routes/auth/organization/sso/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/sso/index.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +1 -1
- package/dist/runtime/server/routes/auth/otp/send.post.d.ts +1 -9
- package/dist/runtime/server/routes/auth/otp/send.post.mjs +8 -0
- package/dist/runtime/server/routes/auth/sso/login.get.mjs +3 -3
- package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +1 -1
- package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +2 -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 +1 -1
- package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +2 -2
- package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/cms/bookmarks/[id].delete.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/check.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/index.get.mjs +1 -1
- package/dist/runtime/server/routes/cms/bookmarks/index.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/deploy.post.mjs +1 -1
- package/dist/runtime/server/routes/cms/export.post.mjs +4 -3
- package/dist/runtime/server/routes/cms/search.get.mjs +7 -5
- package/dist/runtime/server/routes/cms/sync.post.mjs +2 -1
- package/dist/runtime/server/routes/comments/[id]/react.post.mjs +1 -2
- package/dist/runtime/server/routes/comments/[id]/report.post.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id]/report.post.mjs +0 -2
- package/dist/runtime/server/routes/comments/[id].delete.mjs +8 -4
- package/dist/runtime/server/routes/comments/[id].get.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id].get.mjs +1 -2
- package/dist/runtime/server/routes/comments/[id].patch.d.ts +1 -1
- package/dist/runtime/server/routes/comments/[id].patch.mjs +6 -3
- package/dist/runtime/server/routes/comments/batch.post.d.ts +2 -0
- package/dist/runtime/server/routes/comments/batch.post.mjs +33 -0
- package/dist/runtime/server/routes/comments/index.get.d.ts +1 -1
- package/dist/runtime/server/routes/comments/index.get.mjs +6 -4
- package/dist/runtime/server/routes/comments/index.post.d.ts +1 -1
- package/dist/runtime/server/routes/comments/index.post.mjs +6 -2
- package/dist/runtime/server/routes/feed.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +3 -1
- package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +17 -0
- package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +29 -0
- package/dist/runtime/server/routes/store/cart/index.delete.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/index.delete.mjs +11 -0
- package/dist/runtime/server/routes/store/cart/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/cart/index.get.mjs +14 -0
- package/dist/runtime/server/routes/store/cart/items/[id].delete.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +25 -0
- package/dist/runtime/server/routes/store/cart/items/[id].patch.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +29 -0
- package/dist/runtime/server/routes/store/cart/items.post.d.ts +6 -0
- package/dist/runtime/server/routes/store/cart/items.post.mjs +36 -0
- package/dist/runtime/server/routes/store/categories/index.get.d.ts +2 -0
- package/dist/runtime/server/routes/store/categories/index.get.mjs +8 -0
- package/dist/runtime/server/routes/store/checkout.post.d.ts +6 -0
- package/dist/runtime/server/routes/store/checkout.post.mjs +21 -0
- package/dist/runtime/server/routes/store/coupons/apply.post.d.ts +7 -0
- package/dist/runtime/server/routes/store/coupons/apply.post.mjs +18 -0
- package/dist/runtime/server/routes/store/currencies.get.d.ts +15 -0
- package/dist/runtime/server/routes/store/currencies.get.mjs +13 -0
- package/dist/runtime/server/routes/store/orders/[id].get.d.ts +2 -0
- package/dist/runtime/server/routes/store/orders/[id].get.mjs +26 -0
- package/dist/runtime/server/routes/store/orders/download/[token].get.d.ts +7 -0
- package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +57 -0
- package/dist/runtime/server/routes/store/orders/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/orders/index.get.mjs +30 -0
- package/dist/runtime/server/routes/store/products/[slug].get.d.ts +2 -0
- package/dist/runtime/server/routes/store/products/[slug].get.mjs +18 -0
- package/dist/runtime/server/routes/store/products/index.get.d.ts +5 -0
- package/dist/runtime/server/routes/store/products/index.get.mjs +33 -0
- package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +9 -0
- package/dist/runtime/server/routes/store/tax/calculate.post.mjs +18 -0
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +14 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +14 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +24 -1
- package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +6 -0
- package/dist/runtime/server/utils/ai.d.ts +146 -21
- package/dist/runtime/server/utils/ai.mjs +406 -11
- package/dist/runtime/server/utils/analytics-query.d.ts +13 -58
- package/dist/runtime/server/utils/audit.d.ts +5 -4
- package/dist/runtime/server/utils/audit.mjs +25 -14
- package/dist/runtime/server/utils/auth.d.ts +29 -12
- package/dist/runtime/server/utils/auth.mjs +88 -70
- package/dist/runtime/server/utils/bots.d.ts +20 -4
- package/dist/runtime/server/utils/bots.mjs +7 -3
- package/dist/runtime/server/utils/browser-utils.d.ts +23 -23
- package/dist/runtime/server/utils/cache.d.ts +31 -10
- package/dist/runtime/server/utils/cache.mjs +130 -53
- package/dist/runtime/server/utils/cms/collections.d.ts +23 -0
- package/dist/runtime/server/utils/cms/collections.mjs +143 -0
- package/dist/runtime/server/utils/cms/common.d.ts +9 -0
- package/dist/runtime/server/utils/cms/common.mjs +28 -0
- package/dist/runtime/server/utils/cms/git.mjs +2 -2
- package/dist/runtime/server/utils/cms/navigation.d.ts +46 -0
- package/dist/runtime/server/utils/cms/navigation.mjs +683 -0
- package/dist/runtime/server/utils/cms/preview.d.ts +11 -0
- package/dist/runtime/server/utils/cms/preview.mjs +50 -0
- package/dist/runtime/server/utils/cms/search.d.ts +1 -1
- package/dist/runtime/server/utils/cms/search.mjs +11 -7
- package/dist/runtime/server/utils/cms/sync.d.ts +34 -0
- package/dist/runtime/server/utils/cms/sync.mjs +1082 -0
- package/dist/runtime/server/utils/cms/taxonomy.d.ts +103 -0
- package/dist/runtime/server/utils/cms/taxonomy.mjs +348 -0
- package/dist/runtime/server/utils/cms.d.ts +13 -249
- package/dist/runtime/server/utils/cms.mjs +108 -2350
- package/dist/runtime/server/utils/comments-filter.d.ts +45 -0
- package/dist/runtime/server/utils/comments-filter.mjs +541 -0
- package/dist/runtime/server/utils/comments.d.ts +71 -0
- package/dist/runtime/server/utils/comments.mjs +137 -61
- package/dist/runtime/server/utils/config.d.ts +4 -3
- package/dist/runtime/server/utils/config.mjs +7 -6
- package/dist/runtime/server/utils/context.d.ts +14 -0
- package/dist/runtime/server/utils/context.mjs +2 -2
- package/dist/runtime/server/utils/crypto.d.ts +44 -5
- package/dist/runtime/server/utils/crypto.mjs +18 -0
- package/dist/runtime/server/utils/domains.mjs +9 -5
- package/dist/runtime/server/utils/drizzle.d.ts +35 -3
- package/dist/runtime/server/utils/drizzle.mjs +115 -6
- package/dist/runtime/server/utils/durable-object.d.ts +106 -0
- package/dist/runtime/server/utils/durable-object.mjs +628 -0
- package/dist/runtime/server/utils/email-inbound.d.ts +29 -0
- package/dist/runtime/server/utils/email-inbound.mjs +76 -0
- package/dist/runtime/server/utils/impersonation.d.ts +32 -2
- package/dist/runtime/server/utils/impersonation.mjs +16 -13
- package/dist/runtime/server/utils/lock.d.ts +71 -0
- package/dist/runtime/server/utils/lock.mjs +139 -0
- package/dist/runtime/server/utils/mail-suppression.mjs +7 -7
- package/dist/runtime/server/utils/mail.d.ts +30 -19
- package/dist/runtime/server/utils/mcp.d.ts +44 -0
- package/dist/runtime/server/utils/mcp.mjs +308 -0
- package/dist/runtime/server/utils/notifications.d.ts +72 -7
- package/dist/runtime/server/utils/notifications.mjs +67 -55
- package/dist/runtime/server/utils/oauth.d.ts +27 -4
- package/dist/runtime/server/utils/organization.d.ts +63 -7
- package/dist/runtime/server/utils/organization.mjs +26 -21
- package/dist/runtime/server/utils/passwordless.d.ts +62 -33
- package/dist/runtime/server/utils/payments.d.ts +51 -12
- package/dist/runtime/server/utils/payments.mjs +472 -282
- package/dist/runtime/server/utils/queue.d.ts +106 -13
- package/dist/runtime/server/utils/queue.mjs +313 -28
- package/dist/runtime/server/utils/rag.d.ts +42 -14
- package/dist/runtime/server/utils/rag.mjs +169 -4
- package/dist/runtime/server/utils/ratelimit.d.ts +34 -5
- package/dist/runtime/server/utils/ratelimit.mjs +95 -14
- package/dist/runtime/server/utils/realtime.d.ts +68 -52
- package/dist/runtime/server/utils/scheduled-task.d.ts +42 -1
- package/dist/runtime/server/utils/scheduled-task.mjs +29 -0
- package/dist/runtime/server/utils/schema-fallback.d.ts +1 -1
- package/dist/runtime/server/utils/schema-fallback.mjs +1 -1
- package/dist/runtime/server/utils/session.d.ts +84 -10
- package/dist/runtime/server/utils/session.mjs +12 -10
- package/dist/runtime/server/utils/sse.d.ts +75 -0
- package/dist/runtime/server/utils/sse.mjs +147 -0
- package/dist/runtime/server/utils/sso.d.ts +1 -1
- package/dist/runtime/server/utils/storage.d.ts +53 -4
- package/dist/runtime/server/utils/storage.mjs +15 -11
- package/dist/runtime/server/utils/store-localization.d.ts +51 -0
- package/dist/runtime/server/utils/store-localization.mjs +417 -0
- package/dist/runtime/server/utils/store.d.ts +207 -0
- package/dist/runtime/server/utils/store.mjs +2227 -0
- package/dist/runtime/server/utils/table-names.d.ts +51 -0
- package/dist/runtime/server/utils/table-names.mjs +69 -0
- package/dist/runtime/server/utils/tenant.d.ts +26 -2
- package/dist/runtime/server/utils/tenant.mjs +16 -12
- package/dist/runtime/server/utils/tools-registry-fallback.d.ts +1 -0
- package/dist/runtime/server/utils/tools-registry-fallback.mjs +1 -0
- package/dist/runtime/server/utils/totp.d.ts +45 -2
- package/dist/runtime/server/utils/tracker.d.ts +10 -11
- package/dist/runtime/server/utils/turnstile.d.ts +16 -1
- package/dist/runtime/server/utils/workflows.d.ts +92 -0
- package/dist/runtime/server/utils/workflows.mjs +299 -0
- package/dist/runtime/server.d.ts +8 -1
- package/dist/runtime/server.mjs +8 -5
- package/dist/runtime/service.d.ts +10 -10
- package/dist/runtime/storage.d.ts +1 -0
- package/dist/runtime/storage.mjs +1 -0
- package/dist/runtime/store.d.ts +4 -0
- package/dist/runtime/store.mjs +2 -0
- package/dist/runtime/test-utils.d.ts +11 -10
- package/dist/runtime/test-utils.mjs +64 -4
- package/dist/runtime/types/ai.d.ts +21 -2
- package/dist/runtime/types/d1.d.ts +17 -0
- package/dist/runtime/types/drizzle.d.ts +2 -2
- package/dist/runtime/types/durable-object.d.ts +62 -2
- package/dist/runtime/types/email.d.ts +46 -0
- package/dist/runtime/types/imports.d.ts +6 -1
- package/dist/runtime/types/index.d.ts +58 -0
- package/dist/runtime/types/index.mjs +3 -0
- package/dist/runtime/types/mcp.d.ts +83 -0
- package/dist/runtime/types/mcp.mjs +0 -0
- package/dist/runtime/types/queue.d.ts +36 -0
- package/dist/runtime/types/r2.d.ts +41 -0
- package/dist/runtime/types/store.d.ts +313 -0
- package/dist/runtime/types/store.mjs +0 -0
- package/dist/runtime/types/workflows.d.ts +98 -0
- package/dist/runtime/types/workflows.mjs +0 -0
- package/dist/runtime/workflows.d.ts +5 -0
- package/dist/runtime/workflows.mjs +2 -0
- package/dist/types/ai.d.ts +721 -0
- package/dist/types/cms.d.ts +710 -0
- package/dist/types.d.ts +430 -1292
- package/dist/utils/auth-schema.d.ts +3 -2
- package/dist/utils/bots.d.ts +20 -0
- package/dist/utils/comments-schema.d.ts +5 -4
- package/dist/utils/drizzle.d.ts +83 -3
- package/dist/utils/durable-objects.d.ts +10 -0
- package/dist/utils/email-inbound.d.ts +10 -0
- package/dist/utils/local-db.d.ts +1 -3
- package/dist/utils/mcp.d.ts +24 -0
- package/dist/utils/notifications-schema.d.ts +5 -4
- package/dist/utils/payments-schema.d.ts +4 -3
- package/dist/utils/store-schema.d.ts +14 -0
- package/dist/utils/table-names.d.ts +1 -0
- package/dist/utils/tenants-schema.d.ts +4 -3
- package/dist/utils/tools.d.ts +20 -0
- package/dist/utils/workflows.d.ts +8 -0
- package/package.json +34 -4
- package/dist/chunks/wrangler.mjs +0 -897
- package/dist/runtime/app/components/AuthRegister.vue +0 -306
- package/dist/runtime/app/components/AuthSessionsList.vue +0 -137
- package/dist/runtime/app/components/AuthSignIn.vue +0 -298
- package/dist/runtime/app/components/CMSBookmarkButton.vue +0 -59
- package/dist/runtime/app/components/CMSImage.vue +0 -47
- package/dist/runtime/app/components/CMSLocaleSwitcher.vue +0 -110
- package/dist/runtime/app/components/CMSNewsletter.vue +0 -81
- package/dist/runtime/app/components/CMSPreviewBanner.vue +0 -83
- package/dist/runtime/app/components/CMSTableOfContents.vue +0 -84
- package/dist/runtime/app/components/CMSVersionBanner.vue +0 -53
- package/dist/runtime/app/components/CMSVersionSwitcher.vue +0 -140
- package/dist/runtime/app/components/Comments.vue +0 -411
- package/dist/runtime/app/components/FileUpload.vue +0 -200
- package/dist/runtime/app/components/ImpersonationBanner.vue +0 -61
- package/dist/runtime/app/components/NotificationBell.vue +0 -263
- package/dist/runtime/app/components/NotificationList.vue +0 -205
- package/dist/runtime/app/components/NotificationPrompt.vue +0 -133
- package/dist/runtime/app/components/PricingGated.vue +0 -81
- package/dist/runtime/app/components/PricingTable.vue +0 -274
- package/dist/runtime/app/components/RealtimeChat.vue +0 -164
- package/dist/runtime/app/components/RealtimePresence.vue +0 -129
- package/dist/runtime/app/components/RealtimeStatus.vue +0 -79
- package/dist/runtime/app/components/SubscriptionCard.vue +0 -207
- package/dist/runtime/app/components/UserProfile.vue +0 -558
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref } from "vue"
|
|
3
|
-
|
|
4
|
-
import type { NotificationRecord } from "../../../types"
|
|
5
|
-
import { useNotifications } from "../composables/notifications"
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
title?: string
|
|
9
|
-
showControls?: boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
withDefaults(defineProps<Props>(), {
|
|
13
|
-
title: "Notifications",
|
|
14
|
-
showControls: true,
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const { notifications, unreadCount, pending, markAsRead, markAllAsRead, remove, refresh } =
|
|
18
|
-
useNotifications()
|
|
19
|
-
|
|
20
|
-
const filter = ref<"all" | "unread">("all")
|
|
21
|
-
|
|
22
|
-
const filteredNotifications = computed(() => {
|
|
23
|
-
if (filter.value === "unread") {
|
|
24
|
-
return notifications.value.filter((n) => !n.read)
|
|
25
|
-
}
|
|
26
|
-
return notifications.value
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
function handleNotificationClick(item: NotificationRecord) {
|
|
30
|
-
if (!item.read) {
|
|
31
|
-
markAsRead(item.id)
|
|
32
|
-
}
|
|
33
|
-
if (item.actionUrl && typeof window !== "undefined") {
|
|
34
|
-
window.location.href = item.actionUrl
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function formatDate(ts: number) {
|
|
39
|
-
return new Date(ts).toLocaleString(undefined, {
|
|
40
|
-
dateStyle: "medium",
|
|
41
|
-
timeStyle: "short",
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<div
|
|
48
|
-
class="mx-auto w-full max-w-2xl rounded-2xl border border-neutral-200 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-900"
|
|
49
|
-
>
|
|
50
|
-
<!-- Header -->
|
|
51
|
-
<div
|
|
52
|
-
class="flex items-center justify-between border-b border-neutral-100 p-5 dark:border-neutral-800"
|
|
53
|
-
>
|
|
54
|
-
<div>
|
|
55
|
-
<h2 class="text-lg font-bold tracking-tight text-neutral-900 dark:text-neutral-50">
|
|
56
|
-
{{ title }}
|
|
57
|
-
</h2>
|
|
58
|
-
<p class="text-xs text-neutral-500 dark:text-neutral-400">
|
|
59
|
-
You have {{ unreadCount }} unread
|
|
60
|
-
{{ unreadCount === 1 ? "notification" : "notifications" }}
|
|
61
|
-
</p>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div v-if="showControls" class="flex items-center gap-2">
|
|
65
|
-
<button
|
|
66
|
-
v-if="unreadCount > 0"
|
|
67
|
-
type="button"
|
|
68
|
-
class="rounded-lg border border-neutral-200 px-3 py-1.5 text-xs font-medium text-neutral-700 hover:bg-neutral-50 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"
|
|
69
|
-
@click="markAllAsRead"
|
|
70
|
-
>
|
|
71
|
-
Mark all as read
|
|
72
|
-
</button>
|
|
73
|
-
<button
|
|
74
|
-
type="button"
|
|
75
|
-
class="rounded-lg border border-neutral-200 p-1.5 text-neutral-600 hover:bg-neutral-50 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"
|
|
76
|
-
title="Refresh notifications"
|
|
77
|
-
@click="refresh"
|
|
78
|
-
>
|
|
79
|
-
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
80
|
-
<path
|
|
81
|
-
stroke-linecap="round"
|
|
82
|
-
stroke-linejoin="round"
|
|
83
|
-
stroke-width="2"
|
|
84
|
-
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
|
85
|
-
/>
|
|
86
|
-
</svg>
|
|
87
|
-
</button>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<!-- Filter Bar -->
|
|
92
|
-
<div
|
|
93
|
-
class="flex border-b border-neutral-100 bg-neutral-50/50 px-5 py-2 text-xs dark:border-neutral-800 dark:bg-neutral-850/40"
|
|
94
|
-
>
|
|
95
|
-
<div class="flex gap-1 rounded-lg bg-neutral-200/60 p-0.5 dark:bg-neutral-800">
|
|
96
|
-
<button
|
|
97
|
-
type="button"
|
|
98
|
-
class="rounded-md px-3 py-1 font-semibold transition"
|
|
99
|
-
:class="
|
|
100
|
-
filter === 'all'
|
|
101
|
-
? 'bg-white text-neutral-900 shadow-sm dark:bg-neutral-700 dark:text-white'
|
|
102
|
-
: 'text-neutral-500 hover:text-neutral-800 dark:text-neutral-400'
|
|
103
|
-
"
|
|
104
|
-
@click="filter = 'all'"
|
|
105
|
-
>
|
|
106
|
-
All ({{ notifications.length }})
|
|
107
|
-
</button>
|
|
108
|
-
<button
|
|
109
|
-
type="button"
|
|
110
|
-
class="rounded-md px-3 py-1 font-semibold transition"
|
|
111
|
-
:class="
|
|
112
|
-
filter === 'unread'
|
|
113
|
-
? 'bg-white text-neutral-900 shadow-sm dark:bg-neutral-700 dark:text-white'
|
|
114
|
-
: 'text-neutral-500 hover:text-neutral-800 dark:text-neutral-400'
|
|
115
|
-
"
|
|
116
|
-
@click="filter = 'unread'"
|
|
117
|
-
>
|
|
118
|
-
Unread ({{ unreadCount }})
|
|
119
|
-
</button>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<!-- Notification List -->
|
|
124
|
-
<div class="divide-y divide-neutral-100 dark:divide-neutral-800">
|
|
125
|
-
<div
|
|
126
|
-
v-if="pending && notifications.length === 0"
|
|
127
|
-
class="py-12 text-center text-sm text-neutral-400"
|
|
128
|
-
>
|
|
129
|
-
Loading notifications...
|
|
130
|
-
</div>
|
|
131
|
-
|
|
132
|
-
<div
|
|
133
|
-
v-else-if="filteredNotifications.length === 0"
|
|
134
|
-
class="py-16 text-center text-sm text-neutral-400"
|
|
135
|
-
>
|
|
136
|
-
<p class="font-medium text-neutral-600 dark:text-neutral-300">
|
|
137
|
-
{{ filter === "unread" ? "No unread notifications" : "All caught up!" }}
|
|
138
|
-
</p>
|
|
139
|
-
<p class="mt-1 text-xs text-neutral-400">
|
|
140
|
-
When you receive new updates, they will appear right here.
|
|
141
|
-
</p>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<div
|
|
145
|
-
v-for="item in filteredNotifications"
|
|
146
|
-
v-else
|
|
147
|
-
:key="item.id"
|
|
148
|
-
class="group flex cursor-pointer items-start justify-between gap-4 p-5 transition hover:bg-neutral-50/70 dark:hover:bg-neutral-850/60"
|
|
149
|
-
:class="!item.read ? 'bg-blue-50/25 dark:bg-blue-950/15' : ''"
|
|
150
|
-
@click="handleNotificationClick(item)"
|
|
151
|
-
>
|
|
152
|
-
<div class="flex items-start gap-3">
|
|
153
|
-
<!-- Dot Indicator -->
|
|
154
|
-
<span
|
|
155
|
-
class="mt-1.5 h-2 w-2 shrink-0 rounded-full"
|
|
156
|
-
:class="!item.read ? 'bg-blue-600 dark:bg-blue-400' : 'bg-transparent'"
|
|
157
|
-
/>
|
|
158
|
-
|
|
159
|
-
<!-- Content -->
|
|
160
|
-
<div>
|
|
161
|
-
<p
|
|
162
|
-
class="text-sm font-medium text-neutral-900 dark:text-neutral-100"
|
|
163
|
-
:class="!item.read ? 'font-semibold' : ''"
|
|
164
|
-
>
|
|
165
|
-
{{ item.title }}
|
|
166
|
-
</p>
|
|
167
|
-
<p v-if="item.body" class="mt-1 text-xs text-neutral-500 dark:text-neutral-400">
|
|
168
|
-
{{ item.body }}
|
|
169
|
-
</p>
|
|
170
|
-
<p class="mt-2 text-[11px] text-neutral-400 dark:text-neutral-500">
|
|
171
|
-
{{ formatDate(item.createdAt) }}
|
|
172
|
-
</p>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<!-- Actions -->
|
|
177
|
-
<div class="flex items-center gap-2 shrink-0">
|
|
178
|
-
<button
|
|
179
|
-
v-if="!item.read"
|
|
180
|
-
type="button"
|
|
181
|
-
class="rounded-md px-2 py-1 text-xs text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-950/40"
|
|
182
|
-
@click.stop="markAsRead(item.id)"
|
|
183
|
-
>
|
|
184
|
-
Mark read
|
|
185
|
-
</button>
|
|
186
|
-
<button
|
|
187
|
-
type="button"
|
|
188
|
-
class="rounded-md p-1 text-neutral-400 opacity-0 group-hover:opacity-100 hover:bg-neutral-100 hover:text-neutral-700 dark:hover:bg-neutral-800 dark:hover:text-neutral-200"
|
|
189
|
-
title="Delete notification"
|
|
190
|
-
@click.stop="remove(item.id)"
|
|
191
|
-
>
|
|
192
|
-
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
193
|
-
<path
|
|
194
|
-
stroke-linecap="round"
|
|
195
|
-
stroke-linejoin="round"
|
|
196
|
-
stroke-width="2"
|
|
197
|
-
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
198
|
-
/>
|
|
199
|
-
</svg>
|
|
200
|
-
</button>
|
|
201
|
-
</div>
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
</template>
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ref } from "vue"
|
|
3
|
-
|
|
4
|
-
import { useNotifications } from "../composables/notifications"
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
title?: string
|
|
8
|
-
description?: string
|
|
9
|
-
allowDismiss?: boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
withDefaults(defineProps<Props>(), {
|
|
13
|
-
title: "Enable Web Push Notifications",
|
|
14
|
-
description: "Stay in the loop with instant updates delivered right to your device.",
|
|
15
|
-
allowDismiss: true,
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const { isPushSubscribed, subscribeToWebPush, unsubscribeFromWebPush } = useNotifications()
|
|
19
|
-
|
|
20
|
-
const loading = ref(false)
|
|
21
|
-
const dismissed = ref(false)
|
|
22
|
-
const error = ref("")
|
|
23
|
-
|
|
24
|
-
async function handleEnablePush() {
|
|
25
|
-
loading.value = true
|
|
26
|
-
error.value = ""
|
|
27
|
-
try {
|
|
28
|
-
const success = await subscribeToWebPush()
|
|
29
|
-
if (!success) {
|
|
30
|
-
error.value = "Notification permission was denied or is not supported."
|
|
31
|
-
}
|
|
32
|
-
} catch (err: any) {
|
|
33
|
-
error.value = err?.message || "Failed to subscribe to web push"
|
|
34
|
-
} finally {
|
|
35
|
-
loading.value = false
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function handleDisablePush() {
|
|
40
|
-
loading.value = true
|
|
41
|
-
try {
|
|
42
|
-
await unsubscribeFromWebPush()
|
|
43
|
-
} finally {
|
|
44
|
-
loading.value = false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<template>
|
|
50
|
-
<div
|
|
51
|
-
v-if="!dismissed"
|
|
52
|
-
class="relative rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm dark:border-neutral-800 dark:bg-neutral-900"
|
|
53
|
-
>
|
|
54
|
-
<div class="flex items-start justify-between gap-4">
|
|
55
|
-
<div class="flex items-start gap-3.5">
|
|
56
|
-
<!-- Bell Icon with ring -->
|
|
57
|
-
<div
|
|
58
|
-
class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-neutral-100 text-neutral-800 dark:bg-neutral-800 dark:text-neutral-200"
|
|
59
|
-
>
|
|
60
|
-
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
61
|
-
<path
|
|
62
|
-
stroke-linecap="round"
|
|
63
|
-
stroke-linejoin="round"
|
|
64
|
-
stroke-width="2"
|
|
65
|
-
d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
|
|
66
|
-
/>
|
|
67
|
-
</svg>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div>
|
|
71
|
-
<h4 class="text-sm font-semibold text-neutral-900 dark:text-neutral-50">
|
|
72
|
-
{{ title }}
|
|
73
|
-
</h4>
|
|
74
|
-
<p class="mt-0.5 text-xs text-neutral-500 dark:text-neutral-400">
|
|
75
|
-
{{ description }}
|
|
76
|
-
</p>
|
|
77
|
-
|
|
78
|
-
<div v-if="error" class="mt-2 text-xs text-red-600 dark:text-red-400">
|
|
79
|
-
{{ error }}
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<!-- Dismiss Button -->
|
|
85
|
-
<button
|
|
86
|
-
v-if="allowDismiss"
|
|
87
|
-
type="button"
|
|
88
|
-
class="text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300"
|
|
89
|
-
title="Dismiss"
|
|
90
|
-
@click="dismissed = true"
|
|
91
|
-
>
|
|
92
|
-
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
93
|
-
<path
|
|
94
|
-
stroke-linecap="round"
|
|
95
|
-
stroke-linejoin="round"
|
|
96
|
-
stroke-width="2"
|
|
97
|
-
d="M6 18L18 6M6 6l12 12"
|
|
98
|
-
/>
|
|
99
|
-
</svg>
|
|
100
|
-
</button>
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
<div class="mt-4 flex items-center gap-2 pl-13">
|
|
104
|
-
<button
|
|
105
|
-
v-if="!isPushSubscribed"
|
|
106
|
-
type="button"
|
|
107
|
-
:disabled="loading"
|
|
108
|
-
class="rounded-lg bg-neutral-900 px-4 py-2 text-xs font-medium text-white transition hover:bg-neutral-800 disabled:opacity-50 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-white"
|
|
109
|
-
@click="handleEnablePush"
|
|
110
|
-
>
|
|
111
|
-
{{ loading ? "Enabling..." : "Enable Push Notifications" }}
|
|
112
|
-
</button>
|
|
113
|
-
<button
|
|
114
|
-
v-else
|
|
115
|
-
type="button"
|
|
116
|
-
:disabled="loading"
|
|
117
|
-
class="rounded-lg border border-neutral-200 px-3 py-1.5 text-xs font-medium text-neutral-700 hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"
|
|
118
|
-
@click="handleDisablePush"
|
|
119
|
-
>
|
|
120
|
-
{{ loading ? "Disabling..." : "Disable Push" }}
|
|
121
|
-
</button>
|
|
122
|
-
|
|
123
|
-
<button
|
|
124
|
-
v-if="allowDismiss && !isPushSubscribed"
|
|
125
|
-
type="button"
|
|
126
|
-
class="rounded-lg px-3 py-2 text-xs font-medium text-neutral-500 hover:text-neutral-800 dark:text-neutral-400 dark:hover:text-neutral-200"
|
|
127
|
-
@click="dismissed = true"
|
|
128
|
-
>
|
|
129
|
-
Maybe later
|
|
130
|
-
</button>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
</template>
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed } from "vue"
|
|
3
|
-
|
|
4
|
-
import { useSubscription } from "../composables/payments"
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
requiredPlan?: string | string[]
|
|
8
|
-
requireSubscribed?: boolean
|
|
9
|
-
pricingUrl?: string
|
|
10
|
-
fallbackTitle?: string
|
|
11
|
-
fallbackDescription?: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
-
requiredPlan: undefined,
|
|
16
|
-
requireSubscribed: true,
|
|
17
|
-
pricingUrl: "/pricing",
|
|
18
|
-
fallbackTitle: "Pro feature",
|
|
19
|
-
fallbackDescription: "This feature requires an active subscription to access.",
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const { isSubscribed, plan, loading } = useSubscription()
|
|
23
|
-
|
|
24
|
-
const isAllowed = computed(() => {
|
|
25
|
-
if (loading.value) return false
|
|
26
|
-
if (props.requireSubscribed && !isSubscribed.value) return false
|
|
27
|
-
|
|
28
|
-
if (props.requiredPlan) {
|
|
29
|
-
const allowed = Array.isArray(props.requiredPlan) ? props.requiredPlan : [props.requiredPlan]
|
|
30
|
-
if (!plan.value || !allowed.includes(plan.value)) {
|
|
31
|
-
return false
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true
|
|
36
|
-
})
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<template>
|
|
40
|
-
<div>
|
|
41
|
-
<!-- Entitled content -->
|
|
42
|
-
<slot v-if="isAllowed" />
|
|
43
|
-
|
|
44
|
-
<!-- Fallback when unentitled -->
|
|
45
|
-
<slot v-else name="fallback">
|
|
46
|
-
<div
|
|
47
|
-
class="relative overflow-hidden rounded-2xl border border-neutral-200 bg-white p-6 text-center shadow-sm dark:border-neutral-800 dark:bg-neutral-900"
|
|
48
|
-
>
|
|
49
|
-
<div
|
|
50
|
-
class="mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-amber-50 text-amber-600 dark:bg-amber-950 dark:text-amber-400"
|
|
51
|
-
>
|
|
52
|
-
<!-- Lock SVG Icon -->
|
|
53
|
-
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
54
|
-
<path
|
|
55
|
-
stroke-linecap="round"
|
|
56
|
-
stroke-linejoin="round"
|
|
57
|
-
stroke-width="2"
|
|
58
|
-
d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
|
|
59
|
-
/>
|
|
60
|
-
</svg>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<h3 class="mt-3 text-sm font-bold text-neutral-900 dark:text-neutral-50">
|
|
64
|
-
{{ fallbackTitle }}
|
|
65
|
-
</h3>
|
|
66
|
-
<p class="mx-auto mt-1 max-w-sm text-xs text-neutral-500 dark:text-neutral-400">
|
|
67
|
-
{{ fallbackDescription }}
|
|
68
|
-
</p>
|
|
69
|
-
|
|
70
|
-
<div class="mt-4">
|
|
71
|
-
<a
|
|
72
|
-
:href="pricingUrl"
|
|
73
|
-
class="inline-block rounded-lg bg-neutral-900 px-4 py-2 text-xs font-semibold text-white transition hover:bg-neutral-800 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-white"
|
|
74
|
-
>
|
|
75
|
-
Upgrade Now →
|
|
76
|
-
</a>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
</slot>
|
|
80
|
-
</div>
|
|
81
|
-
</template>
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref } from "vue"
|
|
3
|
-
|
|
4
|
-
import { useSubscription } from "../composables/payments"
|
|
5
|
-
|
|
6
|
-
export interface PricingPlan {
|
|
7
|
-
id: string
|
|
8
|
-
name: string
|
|
9
|
-
description?: string
|
|
10
|
-
priceMonthly: number | string
|
|
11
|
-
priceYearly?: number | string
|
|
12
|
-
currency?: string
|
|
13
|
-
priceIdMonthly?: string
|
|
14
|
-
priceIdYearly?: string
|
|
15
|
-
features: string[]
|
|
16
|
-
highlighted?: boolean
|
|
17
|
-
ctaText?: string
|
|
18
|
-
disabled?: boolean
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Props {
|
|
22
|
-
title?: string
|
|
23
|
-
description?: string
|
|
24
|
-
plans?: PricingPlan[]
|
|
25
|
-
allowBillingToggle?: boolean
|
|
26
|
-
defaultBilling?: "monthly" | "yearly"
|
|
27
|
-
yearlyDiscountLabel?: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
31
|
-
title: "Simple, transparent pricing",
|
|
32
|
-
description: "Choose the plan that's right for you. Upgrade or cancel anytime.",
|
|
33
|
-
allowBillingToggle: true,
|
|
34
|
-
defaultBilling: "monthly",
|
|
35
|
-
yearlyDiscountLabel: "Save 20%",
|
|
36
|
-
plans: () => [
|
|
37
|
-
{
|
|
38
|
-
id: "starter",
|
|
39
|
-
name: "Starter",
|
|
40
|
-
description: "Everything you need to get your project off the ground.",
|
|
41
|
-
priceMonthly: 0,
|
|
42
|
-
priceYearly: 0,
|
|
43
|
-
features: ["Up to 3 projects", "Community support", "Basic analytics", "1 GB storage"],
|
|
44
|
-
ctaText: "Get Started Free",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: "pro",
|
|
48
|
-
name: "Pro",
|
|
49
|
-
description: "For professionals and growing teams who need power and scale.",
|
|
50
|
-
priceMonthly: 29,
|
|
51
|
-
priceYearly: 24,
|
|
52
|
-
highlighted: true,
|
|
53
|
-
features: [
|
|
54
|
-
"Unlimited projects",
|
|
55
|
-
"Priority edge network",
|
|
56
|
-
"Durable Objects realtime",
|
|
57
|
-
"100 GB R2 storage",
|
|
58
|
-
"Custom domains",
|
|
59
|
-
"24/7 Priority support",
|
|
60
|
-
],
|
|
61
|
-
ctaText: "Start 14-day Free Trial",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: "enterprise",
|
|
65
|
-
name: "Enterprise",
|
|
66
|
-
description: "Dedicated infrastructure, SLA guarantees, and custom limits.",
|
|
67
|
-
priceMonthly: 99,
|
|
68
|
-
priceYearly: 79,
|
|
69
|
-
features: [
|
|
70
|
-
"Everything in Pro",
|
|
71
|
-
"Dedicated VPC peering",
|
|
72
|
-
"99.99% uptime SLA",
|
|
73
|
-
"Unlimited storage & egress",
|
|
74
|
-
"Custom SAML SSO & RBAC",
|
|
75
|
-
"Dedicated support engineer",
|
|
76
|
-
],
|
|
77
|
-
ctaText: "Contact Sales",
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
const billingCycle = ref<"monthly" | "yearly">(props.defaultBilling)
|
|
83
|
-
const loadingPlanId = ref<string | null>(null)
|
|
84
|
-
|
|
85
|
-
const { subscription, isSubscribed, checkout } = useSubscription()
|
|
86
|
-
|
|
87
|
-
const currentPlanId = computed(() => subscription.value?.planId || null)
|
|
88
|
-
|
|
89
|
-
async function handleSelectPlan(plan: PricingPlan) {
|
|
90
|
-
if (plan.disabled) return
|
|
91
|
-
if (currentPlanId.value === plan.id) return
|
|
92
|
-
|
|
93
|
-
loadingPlanId.value = plan.id
|
|
94
|
-
try {
|
|
95
|
-
const priceId =
|
|
96
|
-
billingCycle.value === "yearly"
|
|
97
|
-
? plan.priceIdYearly || plan.priceIdMonthly
|
|
98
|
-
: plan.priceIdMonthly
|
|
99
|
-
await checkout(plan.id, {
|
|
100
|
-
priceId,
|
|
101
|
-
mode: Number(plan.priceMonthly) === 0 ? "setup" : "subscription",
|
|
102
|
-
})
|
|
103
|
-
} catch (err) {
|
|
104
|
-
console.error("[PricingTable] Checkout error:", err)
|
|
105
|
-
} finally {
|
|
106
|
-
loadingPlanId.value = null
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getPriceDisplay(plan: PricingPlan) {
|
|
111
|
-
const price =
|
|
112
|
-
billingCycle.value === "yearly" ? (plan.priceYearly ?? plan.priceMonthly) : plan.priceMonthly
|
|
113
|
-
|
|
114
|
-
if (price === 0 || price === "0") return "Free"
|
|
115
|
-
const symbol = plan.currency === "EUR" ? "€" : plan.currency === "GBP" ? "£" : "$"
|
|
116
|
-
return `${symbol}${price}`
|
|
117
|
-
}
|
|
118
|
-
</script>
|
|
119
|
-
|
|
120
|
-
<template>
|
|
121
|
-
<div class="mx-auto w-full max-w-7xl px-4 py-12 sm:px-6 lg:px-8">
|
|
122
|
-
<!-- Header -->
|
|
123
|
-
<div class="text-center">
|
|
124
|
-
<h2
|
|
125
|
-
class="text-3xl font-extrabold tracking-tight text-neutral-900 dark:text-neutral-50 sm:text-4xl"
|
|
126
|
-
>
|
|
127
|
-
{{ title }}
|
|
128
|
-
</h2>
|
|
129
|
-
<p class="mx-auto mt-3 max-w-2xl text-base text-neutral-500 dark:text-neutral-400 sm:text-lg">
|
|
130
|
-
{{ description }}
|
|
131
|
-
</p>
|
|
132
|
-
|
|
133
|
-
<!-- Billing Cycle Switcher -->
|
|
134
|
-
<div v-if="allowBillingToggle" class="mt-8 flex justify-center">
|
|
135
|
-
<div class="relative flex items-center rounded-full bg-neutral-100 p-1 dark:bg-neutral-800">
|
|
136
|
-
<button
|
|
137
|
-
type="button"
|
|
138
|
-
class="rounded-full px-4 py-1.5 text-xs font-semibold transition"
|
|
139
|
-
:class="
|
|
140
|
-
billingCycle === 'monthly'
|
|
141
|
-
? 'bg-white text-neutral-900 shadow-sm dark:bg-neutral-700 dark:text-white'
|
|
142
|
-
: 'text-neutral-500 hover:text-neutral-800 dark:text-neutral-400'
|
|
143
|
-
"
|
|
144
|
-
@click="billingCycle = 'monthly'"
|
|
145
|
-
>
|
|
146
|
-
Monthly billing
|
|
147
|
-
</button>
|
|
148
|
-
<button
|
|
149
|
-
type="button"
|
|
150
|
-
class="flex items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-semibold transition"
|
|
151
|
-
:class="
|
|
152
|
-
billingCycle === 'yearly'
|
|
153
|
-
? 'bg-white text-neutral-900 shadow-sm dark:bg-neutral-700 dark:text-white'
|
|
154
|
-
: 'text-neutral-500 hover:text-neutral-800 dark:text-neutral-400'
|
|
155
|
-
"
|
|
156
|
-
@click="billingCycle = 'yearly'"
|
|
157
|
-
>
|
|
158
|
-
<span>Annual billing</span>
|
|
159
|
-
<span
|
|
160
|
-
class="rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-bold text-emerald-800 dark:bg-emerald-950 dark:text-emerald-300"
|
|
161
|
-
>
|
|
162
|
-
{{ yearlyDiscountLabel }}
|
|
163
|
-
</span>
|
|
164
|
-
</button>
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<!-- Pricing Cards Grid -->
|
|
170
|
-
<div class="mt-12 grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-3">
|
|
171
|
-
<div
|
|
172
|
-
v-for="plan in plans"
|
|
173
|
-
:key="plan.id"
|
|
174
|
-
class="relative flex flex-col justify-between rounded-3xl border bg-white p-8 shadow-sm transition hover:shadow-md dark:bg-neutral-900"
|
|
175
|
-
:class="[
|
|
176
|
-
plan.highlighted
|
|
177
|
-
? 'border-neutral-900 ring-2 ring-neutral-900 dark:border-neutral-100 dark:ring-neutral-100'
|
|
178
|
-
: 'border-neutral-200 dark:border-neutral-800',
|
|
179
|
-
]"
|
|
180
|
-
>
|
|
181
|
-
<!-- Highlight / Popular Badge -->
|
|
182
|
-
<div
|
|
183
|
-
v-if="plan.highlighted"
|
|
184
|
-
class="absolute -top-3.5 left-1/2 -translate-x-1/2 rounded-full bg-neutral-900 px-3.5 py-1 text-[11px] font-bold tracking-wider uppercase text-white shadow-sm dark:bg-neutral-100 dark:text-neutral-900"
|
|
185
|
-
>
|
|
186
|
-
Most Popular
|
|
187
|
-
</div>
|
|
188
|
-
|
|
189
|
-
<div>
|
|
190
|
-
<!-- Plan Name & Description -->
|
|
191
|
-
<div class="flex items-center justify-between">
|
|
192
|
-
<h3 class="text-xl font-bold text-neutral-900 dark:text-neutral-50">
|
|
193
|
-
{{ plan.name }}
|
|
194
|
-
</h3>
|
|
195
|
-
<span
|
|
196
|
-
v-if="isSubscribed && currentPlanId === plan.id"
|
|
197
|
-
class="rounded-full bg-emerald-50 px-2.5 py-0.5 text-xs font-semibold text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300"
|
|
198
|
-
>
|
|
199
|
-
Current plan
|
|
200
|
-
</span>
|
|
201
|
-
</div>
|
|
202
|
-
<p class="mt-2 text-xs text-neutral-500 dark:text-neutral-400">
|
|
203
|
-
{{ plan.description }}
|
|
204
|
-
</p>
|
|
205
|
-
|
|
206
|
-
<!-- Price -->
|
|
207
|
-
<div class="mt-6 flex items-baseline gap-1">
|
|
208
|
-
<span
|
|
209
|
-
class="text-4xl font-extrabold tracking-tight text-neutral-900 dark:text-neutral-50"
|
|
210
|
-
>
|
|
211
|
-
{{ getPriceDisplay(plan) }}
|
|
212
|
-
</span>
|
|
213
|
-
<span
|
|
214
|
-
v-if="plan.priceMonthly !== 0 && plan.priceMonthly !== '0'"
|
|
215
|
-
class="text-xs text-neutral-500 dark:text-neutral-400"
|
|
216
|
-
>
|
|
217
|
-
/ month
|
|
218
|
-
</span>
|
|
219
|
-
</div>
|
|
220
|
-
<p
|
|
221
|
-
v-if="billingCycle === 'yearly' && plan.priceYearly"
|
|
222
|
-
class="mt-1 text-[11px] text-neutral-400"
|
|
223
|
-
>
|
|
224
|
-
Billed annually
|
|
225
|
-
</p>
|
|
226
|
-
|
|
227
|
-
<!-- Feature Bullets -->
|
|
228
|
-
<ul class="mt-8 space-y-3 text-xs text-neutral-600 dark:text-neutral-300">
|
|
229
|
-
<li v-for="feature in plan.features" :key="feature" class="flex items-center gap-2.5">
|
|
230
|
-
<!-- Check icon -->
|
|
231
|
-
<svg
|
|
232
|
-
class="h-4 w-4 shrink-0 text-emerald-500"
|
|
233
|
-
fill="none"
|
|
234
|
-
viewBox="0 0 24 24"
|
|
235
|
-
stroke="currentColor"
|
|
236
|
-
>
|
|
237
|
-
<path
|
|
238
|
-
stroke-linecap="round"
|
|
239
|
-
stroke-linejoin="round"
|
|
240
|
-
stroke-width="2.5"
|
|
241
|
-
d="M5 13l4 4L19 7"
|
|
242
|
-
/>
|
|
243
|
-
</svg>
|
|
244
|
-
<span>{{ feature }}</span>
|
|
245
|
-
</li>
|
|
246
|
-
</ul>
|
|
247
|
-
</div>
|
|
248
|
-
|
|
249
|
-
<!-- CTA Action Button -->
|
|
250
|
-
<div class="mt-8">
|
|
251
|
-
<button
|
|
252
|
-
type="button"
|
|
253
|
-
:disabled="
|
|
254
|
-
plan.disabled ||
|
|
255
|
-
(isSubscribed && currentPlanId === plan.id) ||
|
|
256
|
-
loadingPlanId === plan.id
|
|
257
|
-
"
|
|
258
|
-
class="w-full rounded-xl py-3 text-center text-xs font-semibold transition disabled:opacity-50"
|
|
259
|
-
:class="[
|
|
260
|
-
plan.highlighted
|
|
261
|
-
? 'bg-neutral-900 text-white hover:bg-neutral-800 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-white'
|
|
262
|
-
: 'border border-neutral-200 bg-white text-neutral-900 hover:bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:hover:bg-neutral-750',
|
|
263
|
-
]"
|
|
264
|
-
@click="handleSelectPlan(plan)"
|
|
265
|
-
>
|
|
266
|
-
<span v-if="loadingPlanId === plan.id">Redirecting...</span>
|
|
267
|
-
<span v-else-if="isSubscribed && currentPlanId === plan.id">Active Plan</span>
|
|
268
|
-
<span v-else>{{ plan.ctaText || "Select Plan" }}</span>
|
|
269
|
-
</button>
|
|
270
|
-
</div>
|
|
271
|
-
</div>
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
</template>
|