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
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { computed, ref, toValue, watch } from "vue";
|
|
2
|
+
import { useRuntimeConfig, useState, useCookie } from "#imports";
|
|
3
|
+
function getStorePrefix() {
|
|
4
|
+
try {
|
|
5
|
+
const cfg = useRuntimeConfig();
|
|
6
|
+
return cfg.public?.qarpeo?.store?.prefix || "/api/store";
|
|
7
|
+
} catch {
|
|
8
|
+
return "/api/store";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function useCart() {
|
|
12
|
+
const prefix = getStorePrefix();
|
|
13
|
+
const cart = useState("qarpeo_store_cart", () => null);
|
|
14
|
+
const totals = useState("qarpeo_store_totals", () => ({
|
|
15
|
+
subtotal: 0,
|
|
16
|
+
taxTotal: 0,
|
|
17
|
+
shippingTotal: 0,
|
|
18
|
+
discountTotal: 0,
|
|
19
|
+
total: 0,
|
|
20
|
+
currency: "USD",
|
|
21
|
+
itemCount: 0
|
|
22
|
+
}));
|
|
23
|
+
const loading = ref(false);
|
|
24
|
+
const error = ref(null);
|
|
25
|
+
const itemCount = computed(() => totals.value.itemCount || 0);
|
|
26
|
+
async function fetchCart() {
|
|
27
|
+
loading.value = true;
|
|
28
|
+
error.value = null;
|
|
29
|
+
try {
|
|
30
|
+
const res = await $fetch(`${prefix}/cart`);
|
|
31
|
+
if (res) {
|
|
32
|
+
cart.value = res.cart;
|
|
33
|
+
totals.value = res.totals;
|
|
34
|
+
}
|
|
35
|
+
} catch (e) {
|
|
36
|
+
error.value = e instanceof Error ? e : new Error(String(e));
|
|
37
|
+
} finally {
|
|
38
|
+
loading.value = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function addToCart(productId, variantId, quantity = 1, customAttributes = {}) {
|
|
42
|
+
loading.value = true;
|
|
43
|
+
error.value = null;
|
|
44
|
+
try {
|
|
45
|
+
const res = await $fetch(`${prefix}/cart/items`, {
|
|
46
|
+
method: "POST",
|
|
47
|
+
body: {
|
|
48
|
+
cartId: cart.value?.id,
|
|
49
|
+
productId,
|
|
50
|
+
variantId,
|
|
51
|
+
quantity,
|
|
52
|
+
customAttributes
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
if (res) {
|
|
56
|
+
cart.value = res.cart;
|
|
57
|
+
totals.value = res.totals;
|
|
58
|
+
return res.item;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
} catch (e) {
|
|
62
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
63
|
+
error.value = err;
|
|
64
|
+
throw err;
|
|
65
|
+
} finally {
|
|
66
|
+
loading.value = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function updateQuantity(itemId, quantity) {
|
|
70
|
+
loading.value = true;
|
|
71
|
+
error.value = null;
|
|
72
|
+
try {
|
|
73
|
+
const res = await $fetch(`${prefix}/cart/items/${itemId}`, {
|
|
74
|
+
method: "PATCH",
|
|
75
|
+
body: { quantity }
|
|
76
|
+
});
|
|
77
|
+
if (res) {
|
|
78
|
+
cart.value = res.cart;
|
|
79
|
+
totals.value = res.totals;
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
83
|
+
error.value = err;
|
|
84
|
+
throw err;
|
|
85
|
+
} finally {
|
|
86
|
+
loading.value = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function removeItem(itemId) {
|
|
90
|
+
loading.value = true;
|
|
91
|
+
error.value = null;
|
|
92
|
+
try {
|
|
93
|
+
const res = await $fetch(`${prefix}/cart/items/${itemId}`, {
|
|
94
|
+
method: "DELETE"
|
|
95
|
+
});
|
|
96
|
+
if (res) {
|
|
97
|
+
cart.value = res.cart;
|
|
98
|
+
totals.value = res.totals;
|
|
99
|
+
}
|
|
100
|
+
} catch (e) {
|
|
101
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
102
|
+
error.value = err;
|
|
103
|
+
throw err;
|
|
104
|
+
} finally {
|
|
105
|
+
loading.value = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function clearCart() {
|
|
109
|
+
loading.value = true;
|
|
110
|
+
error.value = null;
|
|
111
|
+
try {
|
|
112
|
+
const res = await $fetch(`${prefix}/cart`, {
|
|
113
|
+
method: "DELETE"
|
|
114
|
+
});
|
|
115
|
+
if (res) {
|
|
116
|
+
cart.value = res.cart;
|
|
117
|
+
totals.value = res.totals;
|
|
118
|
+
} else if (cart.value) {
|
|
119
|
+
cart.value.items = [];
|
|
120
|
+
cart.value.couponCode = void 0;
|
|
121
|
+
cart.value.discountTotal = 0;
|
|
122
|
+
totals.value = {
|
|
123
|
+
subtotal: 0,
|
|
124
|
+
taxTotal: 0,
|
|
125
|
+
shippingTotal: 0,
|
|
126
|
+
discountTotal: 0,
|
|
127
|
+
total: 0,
|
|
128
|
+
currency: totals.value.currency || "USD",
|
|
129
|
+
itemCount: 0
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
} catch (e) {
|
|
133
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
134
|
+
error.value = err;
|
|
135
|
+
throw err;
|
|
136
|
+
} finally {
|
|
137
|
+
loading.value = false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async function applyCoupon(code) {
|
|
141
|
+
if (!cart.value?.id) return { success: false, message: "Cart is empty." };
|
|
142
|
+
loading.value = true;
|
|
143
|
+
error.value = null;
|
|
144
|
+
try {
|
|
145
|
+
const res = await $fetch(`${prefix}/coupons/apply`, {
|
|
146
|
+
method: "POST",
|
|
147
|
+
body: { cartId: cart.value.id, code }
|
|
148
|
+
});
|
|
149
|
+
if (res?.cart) {
|
|
150
|
+
cart.value = res.cart;
|
|
151
|
+
totals.value = res.totals;
|
|
152
|
+
}
|
|
153
|
+
return { success: Boolean(res?.success), message: res?.message };
|
|
154
|
+
} catch (e) {
|
|
155
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
156
|
+
error.value = err;
|
|
157
|
+
return { success: false, message: err.message || "Failed to apply coupon." };
|
|
158
|
+
} finally {
|
|
159
|
+
loading.value = false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!cart.value && typeof window !== "undefined") {
|
|
163
|
+
fetchCart().catch(() => {
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
cart,
|
|
168
|
+
totals,
|
|
169
|
+
itemCount,
|
|
170
|
+
loading,
|
|
171
|
+
error,
|
|
172
|
+
fetchCart,
|
|
173
|
+
addToCart,
|
|
174
|
+
updateQuantity,
|
|
175
|
+
removeItem,
|
|
176
|
+
clearCart,
|
|
177
|
+
applyCoupon
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
export function useProducts(options = {}) {
|
|
181
|
+
const prefix = getStorePrefix();
|
|
182
|
+
const products = ref([]);
|
|
183
|
+
const total = ref(0);
|
|
184
|
+
const loading = ref(false);
|
|
185
|
+
const error = ref(null);
|
|
186
|
+
const offset = ref(0);
|
|
187
|
+
const limitVal = computed(() => toValue(options.limit) ?? 20);
|
|
188
|
+
const hasMore = computed(() => products.value.length < total.value);
|
|
189
|
+
async function fetchProducts(append = false) {
|
|
190
|
+
loading.value = true;
|
|
191
|
+
error.value = null;
|
|
192
|
+
try {
|
|
193
|
+
const queryParams = {
|
|
194
|
+
limit: limitVal.value,
|
|
195
|
+
offset: offset.value
|
|
196
|
+
};
|
|
197
|
+
const cat = toValue(options.category);
|
|
198
|
+
if (cat) queryParams.category = cat;
|
|
199
|
+
const s = toValue(options.search);
|
|
200
|
+
if (s) queryParams.search = s;
|
|
201
|
+
const sb = toValue(options.sortBy);
|
|
202
|
+
if (sb) queryParams.sortBy = sb;
|
|
203
|
+
const minP = toValue(options.minPrice);
|
|
204
|
+
if (minP !== void 0) queryParams.minPrice = minP;
|
|
205
|
+
const maxP = toValue(options.maxPrice);
|
|
206
|
+
if (maxP !== void 0) queryParams.maxPrice = maxP;
|
|
207
|
+
const inStock = toValue(options.inStockOnly);
|
|
208
|
+
if (inStock !== void 0) queryParams.inStockOnly = inStock;
|
|
209
|
+
const res = await $fetch(`${prefix}/products`, { query: queryParams });
|
|
210
|
+
if (res) {
|
|
211
|
+
products.value = append ? [...products.value, ...res.products || []] : res.products || [];
|
|
212
|
+
total.value = res.total || 0;
|
|
213
|
+
}
|
|
214
|
+
} catch (e) {
|
|
215
|
+
error.value = e instanceof Error ? e : new Error(String(e));
|
|
216
|
+
} finally {
|
|
217
|
+
loading.value = false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
async function refresh() {
|
|
221
|
+
offset.value = 0;
|
|
222
|
+
await fetchProducts(false);
|
|
223
|
+
}
|
|
224
|
+
async function loadMore() {
|
|
225
|
+
if (!hasMore.value || loading.value) return;
|
|
226
|
+
offset.value += limitVal.value;
|
|
227
|
+
await fetchProducts(true);
|
|
228
|
+
}
|
|
229
|
+
watch(
|
|
230
|
+
[
|
|
231
|
+
() => toValue(options.category),
|
|
232
|
+
() => toValue(options.search),
|
|
233
|
+
() => toValue(options.sortBy)
|
|
234
|
+
],
|
|
235
|
+
() => {
|
|
236
|
+
refresh().catch(() => {
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
{ immediate: true }
|
|
240
|
+
);
|
|
241
|
+
return {
|
|
242
|
+
products,
|
|
243
|
+
total,
|
|
244
|
+
loading,
|
|
245
|
+
error,
|
|
246
|
+
hasMore,
|
|
247
|
+
refresh,
|
|
248
|
+
loadMore
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
export function useProduct(slugOrId) {
|
|
252
|
+
const prefix = getStorePrefix();
|
|
253
|
+
const product = ref(null);
|
|
254
|
+
const selectedVariant = ref(null);
|
|
255
|
+
const loading = ref(false);
|
|
256
|
+
const error = ref(null);
|
|
257
|
+
const currentPrice = computed(() => {
|
|
258
|
+
if (selectedVariant.value?.priceOverride != null) {
|
|
259
|
+
return selectedVariant.value.priceOverride;
|
|
260
|
+
}
|
|
261
|
+
return product.value?.basePrice ?? 0;
|
|
262
|
+
});
|
|
263
|
+
const inStock = computed(() => {
|
|
264
|
+
const inv = selectedVariant.value?.inventory;
|
|
265
|
+
if (!inv) return true;
|
|
266
|
+
if (inv.allowBackorder) return true;
|
|
267
|
+
return inv.stockQuantity - inv.reservedQuantity > 0;
|
|
268
|
+
});
|
|
269
|
+
async function fetchProduct() {
|
|
270
|
+
const id = toValue(slugOrId);
|
|
271
|
+
if (!id) return;
|
|
272
|
+
loading.value = true;
|
|
273
|
+
error.value = null;
|
|
274
|
+
try {
|
|
275
|
+
const res = await $fetch(`${prefix}/products/${id}`);
|
|
276
|
+
product.value = res;
|
|
277
|
+
if (res?.variants && res.variants.length > 0) {
|
|
278
|
+
selectedVariant.value = res.variants[0];
|
|
279
|
+
}
|
|
280
|
+
} catch (e) {
|
|
281
|
+
error.value = e instanceof Error ? e : new Error(String(e));
|
|
282
|
+
} finally {
|
|
283
|
+
loading.value = false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function selectVariant(variantId) {
|
|
287
|
+
const found = product.value?.variants?.find((v) => v.id === variantId);
|
|
288
|
+
if (found) {
|
|
289
|
+
selectedVariant.value = found;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
watch(
|
|
293
|
+
() => toValue(slugOrId),
|
|
294
|
+
() => {
|
|
295
|
+
fetchProduct().catch(() => {
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
{ immediate: true }
|
|
299
|
+
);
|
|
300
|
+
return {
|
|
301
|
+
product,
|
|
302
|
+
selectedVariant,
|
|
303
|
+
currentPrice,
|
|
304
|
+
inStock,
|
|
305
|
+
loading,
|
|
306
|
+
error,
|
|
307
|
+
selectVariant,
|
|
308
|
+
refresh: fetchProduct
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
export function useCheckout() {
|
|
312
|
+
const prefix = getStorePrefix();
|
|
313
|
+
const { cart } = useCart();
|
|
314
|
+
const loading = ref(false);
|
|
315
|
+
const error = ref(null);
|
|
316
|
+
async function submitCheckout(input) {
|
|
317
|
+
if (!cart.value?.id) {
|
|
318
|
+
throw new Error("No active cart found for checkout.");
|
|
319
|
+
}
|
|
320
|
+
loading.value = true;
|
|
321
|
+
error.value = null;
|
|
322
|
+
try {
|
|
323
|
+
const res = await $fetch(`${prefix}/checkout`, {
|
|
324
|
+
method: "POST",
|
|
325
|
+
body: {
|
|
326
|
+
cartId: cart.value.id,
|
|
327
|
+
...input
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
if (res?.checkoutUrl && typeof window !== "undefined") {
|
|
331
|
+
window.location.href = res.checkoutUrl;
|
|
332
|
+
}
|
|
333
|
+
return res;
|
|
334
|
+
} catch (e) {
|
|
335
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
336
|
+
error.value = err;
|
|
337
|
+
throw err;
|
|
338
|
+
} finally {
|
|
339
|
+
loading.value = false;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return {
|
|
343
|
+
loading,
|
|
344
|
+
error,
|
|
345
|
+
submitCheckout
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
export const useStoreCheckout = useCheckout;
|
|
349
|
+
export function useCurrency() {
|
|
350
|
+
const runtimeConfig = useRuntimeConfig();
|
|
351
|
+
const locCfg = runtimeConfig.public?.qarpeo?.store?.localization ?? {};
|
|
352
|
+
const defaultCurrency = locCfg.defaultCurrency ?? "USD";
|
|
353
|
+
const supportedCurrencies = locCfg.currencies ?? ["USD"];
|
|
354
|
+
const FALLBACK_RATES = {
|
|
355
|
+
USD: 1,
|
|
356
|
+
EUR: 0.92,
|
|
357
|
+
GBP: 0.79,
|
|
358
|
+
CAD: 1.36,
|
|
359
|
+
AUD: 1.52,
|
|
360
|
+
JPY: 155,
|
|
361
|
+
CHF: 0.89,
|
|
362
|
+
CNY: 7.24,
|
|
363
|
+
INR: 83.5,
|
|
364
|
+
BRL: 5.15,
|
|
365
|
+
MXN: 16.8,
|
|
366
|
+
SEK: 10.7,
|
|
367
|
+
NOK: 10.6,
|
|
368
|
+
NZD: 1.64,
|
|
369
|
+
SGD: 1.35,
|
|
370
|
+
HKD: 7.82
|
|
371
|
+
};
|
|
372
|
+
const ZERO_DECIMAL = { JPY: true, KRW: true, VND: true };
|
|
373
|
+
const currencyCookie = useCookie("qarpeo_currency", {
|
|
374
|
+
maxAge: 60 * 60 * 24 * 365,
|
|
375
|
+
path: "/",
|
|
376
|
+
sameSite: "lax"
|
|
377
|
+
});
|
|
378
|
+
const currency = ref(
|
|
379
|
+
currencyCookie.value && supportedCurrencies.includes(currencyCookie.value) ? currencyCookie.value : defaultCurrency
|
|
380
|
+
);
|
|
381
|
+
const currencies = computed(() => supportedCurrencies);
|
|
382
|
+
const rate = computed(() => FALLBACK_RATES[currency.value] ?? 1);
|
|
383
|
+
function setCurrency(code) {
|
|
384
|
+
if (!supportedCurrencies.includes(code)) return;
|
|
385
|
+
currency.value = code;
|
|
386
|
+
currencyCookie.value = code;
|
|
387
|
+
}
|
|
388
|
+
function convert(amountInCents, fromCurrency = "USD") {
|
|
389
|
+
const fromRate = FALLBACK_RATES[fromCurrency] ?? 1;
|
|
390
|
+
const toRate = FALLBACK_RATES[currency.value] ?? 1;
|
|
391
|
+
const inUsd = amountInCents / fromRate;
|
|
392
|
+
const converted = inUsd * toRate;
|
|
393
|
+
if (ZERO_DECIMAL[currency.value]) {
|
|
394
|
+
return Math.round(converted);
|
|
395
|
+
}
|
|
396
|
+
return Math.round(converted);
|
|
397
|
+
}
|
|
398
|
+
function format(amountInCents, overrideCurrency) {
|
|
399
|
+
const code = overrideCurrency ?? currency.value;
|
|
400
|
+
const isZeroDecimal = ZERO_DECIMAL[code] ?? false;
|
|
401
|
+
const amount = isZeroDecimal ? amountInCents : amountInCents / 100;
|
|
402
|
+
try {
|
|
403
|
+
return new Intl.NumberFormat(void 0, {
|
|
404
|
+
style: "currency",
|
|
405
|
+
currency: code,
|
|
406
|
+
minimumFractionDigits: isZeroDecimal ? 0 : 2,
|
|
407
|
+
maximumFractionDigits: isZeroDecimal ? 0 : 2
|
|
408
|
+
}).format(amount);
|
|
409
|
+
} catch {
|
|
410
|
+
return `${code} ${amount.toFixed(isZeroDecimal ? 0 : 2)}`;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return { currency, currencies, setCurrency, convert, format, rate };
|
|
414
|
+
}
|
|
@@ -2,81 +2,40 @@
|
|
|
2
2
|
* @file Composables/tenant.ts Client-side multi-tenancy and custom domains composable. Provides
|
|
3
3
|
* reactive access to the active tenant and domain management functions.
|
|
4
4
|
*/
|
|
5
|
+
import { type Ref, type ComputedRef } from "vue";
|
|
5
6
|
import type { TenantRecord, CustomDomainRecord } from "../../../types";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
readonly plan?: string | undefined;
|
|
19
|
-
readonly organizationId?: string | undefined;
|
|
20
|
-
readonly customDomain?: string | undefined;
|
|
21
|
-
readonly logoUrl?: string | undefined;
|
|
22
|
-
readonly metadata?: {
|
|
23
|
-
readonly [x: string]: any;
|
|
24
|
-
} | undefined;
|
|
25
|
-
readonly createdAt: number;
|
|
26
|
-
readonly updatedAt: number;
|
|
27
|
-
} | null, {
|
|
28
|
-
readonly id: string;
|
|
29
|
-
readonly slug: string;
|
|
30
|
-
readonly name: string;
|
|
31
|
-
readonly plan?: string | undefined;
|
|
32
|
-
readonly organizationId?: string | undefined;
|
|
33
|
-
readonly customDomain?: string | undefined;
|
|
34
|
-
readonly logoUrl?: string | undefined;
|
|
35
|
-
readonly metadata?: {
|
|
36
|
-
readonly [x: string]: any;
|
|
37
|
-
} | undefined;
|
|
38
|
-
readonly createdAt: number;
|
|
39
|
-
readonly updatedAt: number;
|
|
40
|
-
} | null>>;
|
|
41
|
-
domains: Readonly<import("vue").Ref<readonly {
|
|
42
|
-
readonly id: string;
|
|
43
|
-
readonly tenantId: string;
|
|
44
|
-
readonly domain: string;
|
|
45
|
-
readonly status: import("../../../types").DomainStatus;
|
|
46
|
-
readonly sslStatus: import("../../../types").DomainSslStatus;
|
|
47
|
-
readonly verificationRecords?: readonly {
|
|
48
|
-
readonly type: "cname" | "txt";
|
|
49
|
-
readonly name: string;
|
|
50
|
-
readonly value: string;
|
|
51
|
-
readonly target?: string | undefined;
|
|
52
|
-
}[] | undefined;
|
|
53
|
-
readonly cnameTarget?: string | undefined;
|
|
54
|
-
readonly cloudflareHostnameId?: string | undefined;
|
|
55
|
-
readonly errorMessage?: string | undefined;
|
|
56
|
-
readonly createdAt: number;
|
|
57
|
-
readonly updatedAt: number;
|
|
58
|
-
}[], readonly {
|
|
59
|
-
readonly id: string;
|
|
60
|
-
readonly tenantId: string;
|
|
61
|
-
readonly domain: string;
|
|
62
|
-
readonly status: import("../../../types").DomainStatus;
|
|
63
|
-
readonly sslStatus: import("../../../types").DomainSslStatus;
|
|
64
|
-
readonly verificationRecords?: readonly {
|
|
65
|
-
readonly type: "cname" | "txt";
|
|
66
|
-
readonly name: string;
|
|
67
|
-
readonly value: string;
|
|
68
|
-
readonly target?: string | undefined;
|
|
69
|
-
}[] | undefined;
|
|
70
|
-
readonly cnameTarget?: string | undefined;
|
|
71
|
-
readonly cloudflareHostnameId?: string | undefined;
|
|
72
|
-
readonly errorMessage?: string | undefined;
|
|
73
|
-
readonly createdAt: number;
|
|
74
|
-
readonly updatedAt: number;
|
|
75
|
-
}[]>>;
|
|
76
|
-
isCustomDomain: import("vue").ComputedRef<boolean>;
|
|
7
|
+
export interface UseTenantReturn {
|
|
8
|
+
/** Whether a tenant or domain request is in flight. */
|
|
9
|
+
loading: Readonly<Ref<boolean>>;
|
|
10
|
+
/** Most recent error encountered during tenant operations. */
|
|
11
|
+
error: Readonly<Ref<Error | null>>;
|
|
12
|
+
/** Resolved active tenant record. */
|
|
13
|
+
tenant: Readonly<Ref<TenantRecord | null>>;
|
|
14
|
+
/** List of registered custom domains for the tenant. */
|
|
15
|
+
domains: Readonly<Ref<CustomDomainRecord[]>>;
|
|
16
|
+
/** Whether the current request is served from a custom domain. */
|
|
17
|
+
isCustomDomain: ComputedRef<boolean>;
|
|
18
|
+
/** Fetches the current tenant resolved from the incoming host/header. */
|
|
77
19
|
fetchCurrentTenant: () => Promise<TenantRecord | null>;
|
|
20
|
+
/** List custom domains registered for the current (or specified) tenant. */
|
|
78
21
|
fetchDomains: (targetTenant?: string) => Promise<CustomDomainRecord[]>;
|
|
22
|
+
/** Register a new custom domain for the tenant via Cloudflare for SaaS. */
|
|
79
23
|
addDomain: (domain: string, targetTenant?: string) => Promise<CustomDomainRecord | null>;
|
|
24
|
+
/** Trigger re-verification of custom domain DNS / SSL status. */
|
|
80
25
|
verifyDomain: (domain: string, targetTenant?: string) => Promise<CustomDomainRecord | null>;
|
|
26
|
+
/** Remove a custom domain from Cloudflare and edge cache. */
|
|
81
27
|
removeDomain: (domain: string, targetTenant?: string) => Promise<boolean>;
|
|
82
|
-
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Headless multi-tenancy and Cloudflare for SaaS custom domains composable.
|
|
31
|
+
*
|
|
32
|
+
* @param basePath - API prefix for tenant endpoints (default: '/api/tenants')
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```vue
|
|
36
|
+
* <script setup lang="ts">
|
|
37
|
+
* const { tenant, domains, addDomain, isCustomDomain } = useTenant()
|
|
38
|
+
* </script>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function useTenant(basePath?: string): UseTenantReturn;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type ComputedRef } from "vue";
|
|
2
|
+
export interface UseTurnstileReturn {
|
|
3
|
+
/** Configured public Cloudflare Turnstile sitekey. */
|
|
4
|
+
siteKey: ComputedRef<string>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Headless Cloudflare Turnstile bot protection composable.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```vue
|
|
11
|
+
* <script setup lang="ts">
|
|
12
|
+
* const { siteKey } = useTurnstile()
|
|
13
|
+
* </script>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function useTurnstile(): UseTurnstileReturn;
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
import { type Ref } from "vue";
|
|
1
2
|
export interface TwoFactorSetupResult {
|
|
2
3
|
secret: string;
|
|
3
4
|
otpauthUrl: string;
|
|
4
5
|
backupCodes: string[];
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
export interface UseTwoFactorReturn {
|
|
8
|
+
/** Whether a 2FA setup, verify, or disable request is loading. */
|
|
9
|
+
loading: Ref<boolean>;
|
|
10
|
+
/** Error message from the last 2FA action or null. */
|
|
11
|
+
error: Ref<string | null>;
|
|
12
|
+
/** Generates a new TOTP secret, QR code URI, and backup codes for enrollment. */
|
|
9
13
|
setup2FA: () => Promise<TwoFactorSetupResult>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
/** Confirms TOTP setup or verifies a code during two-factor challenge. */
|
|
15
|
+
verify2FA: (code: string, secret?: string) => Promise<unknown>;
|
|
16
|
+
/** Disables two-factor authentication after validating a TOTP code. */
|
|
17
|
+
disable2FA: (code: string) => Promise<unknown>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Headless Two-Factor Authentication (TOTP / Authenticator App) composable.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```vue
|
|
24
|
+
* <script setup lang="ts">
|
|
25
|
+
* const { setup2FA, verify2FA, loading } = useTwoFactor()
|
|
26
|
+
* </script>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useTwoFactor(): UseTwoFactorReturn;
|
|
@@ -96,21 +96,20 @@ function formatDate(ts?: number) {
|
|
|
96
96
|
</p>
|
|
97
97
|
</div>
|
|
98
98
|
|
|
99
|
-
<div class="flex items-center gap-
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
<div class="flex items-center gap-2">
|
|
100
|
+
<UButton
|
|
101
|
+
label="Refresh"
|
|
102
|
+
variant="outline"
|
|
103
|
+
color="neutral"
|
|
104
|
+
size="xs"
|
|
103
105
|
@click="reloadNotifications"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
class="rounded-lg bg-neutral-900 px-3.5 py-1.5 text-xs font-medium text-white hover:bg-neutral-800 dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-white"
|
|
106
|
+
/>
|
|
107
|
+
<UButton
|
|
108
|
+
label="+ Send Test"
|
|
109
|
+
color="primary"
|
|
110
|
+
size="xs"
|
|
110
111
|
@click="showSendDialog = true"
|
|
111
|
-
|
|
112
|
-
+ Send Test
|
|
113
|
-
</button>
|
|
112
|
+
/>
|
|
114
113
|
</div>
|
|
115
114
|
</div>
|
|
116
115
|
|
|
@@ -141,11 +140,14 @@ function formatDate(ts?: number) {
|
|
|
141
140
|
</div>
|
|
142
141
|
|
|
143
142
|
<div v-else class="divide-y divide-neutral-100 dark:divide-neutral-800">
|
|
144
|
-
<
|
|
143
|
+
<UButton
|
|
145
144
|
v-for="item in notifications"
|
|
146
145
|
:key="item.id"
|
|
147
146
|
type="button"
|
|
148
|
-
|
|
147
|
+
variant="ghost"
|
|
148
|
+
color="neutral"
|
|
149
|
+
block
|
|
150
|
+
class="flex flex-col items-start p-3 text-left justify-start rounded-none"
|
|
149
151
|
:class="
|
|
150
152
|
selectedNotification?.id === item.id ? 'bg-neutral-100 dark:bg-neutral-800' : ''
|
|
151
153
|
"
|
|
@@ -180,7 +182,7 @@ function formatDate(ts?: number) {
|
|
|
180
182
|
<span>·</span>
|
|
181
183
|
<span class="capitalize">{{ item.channels.join(", ") }}</span>
|
|
182
184
|
</div>
|
|
183
|
-
</
|
|
185
|
+
</UButton>
|
|
184
186
|
</div>
|
|
185
187
|
</div>
|
|
186
188
|
|
|
@@ -333,20 +335,21 @@ function formatDate(ts?: number) {
|
|
|
333
335
|
</div>
|
|
334
336
|
|
|
335
337
|
<div class="mt-6 flex justify-end gap-2 pt-2">
|
|
336
|
-
<
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
<UButton
|
|
339
|
+
label="Cancel"
|
|
340
|
+
variant="outline"
|
|
341
|
+
color="neutral"
|
|
342
|
+
size="xs"
|
|
339
343
|
@click="showSendDialog = false"
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
</button>
|
|
343
|
-
<button
|
|
344
|
+
/>
|
|
345
|
+
<UButton
|
|
344
346
|
type="submit"
|
|
347
|
+
color="primary"
|
|
348
|
+
size="xs"
|
|
349
|
+
:loading="sending"
|
|
345
350
|
:disabled="sending"
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
{{ sending ? "Sending..." : "Dispatch Notification" }}
|
|
349
|
-
</button>
|
|
351
|
+
:label="sending ? 'Sending...' : 'Dispatch Notification'"
|
|
352
|
+
/>
|
|
350
353
|
</div>
|
|
351
354
|
</form>
|
|
352
355
|
</div>
|