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,417 @@
|
|
|
1
|
+
import { getRequestHeader, getCookie } from "nuxt/server";
|
|
2
|
+
export const DEFAULT_STORE_RATES = {
|
|
3
|
+
USD: 1,
|
|
4
|
+
EUR: 0.92,
|
|
5
|
+
GBP: 0.79,
|
|
6
|
+
CAD: 1.36,
|
|
7
|
+
AUD: 1.52,
|
|
8
|
+
JPY: 155,
|
|
9
|
+
CHF: 0.89,
|
|
10
|
+
CNY: 7.24,
|
|
11
|
+
INR: 83.5,
|
|
12
|
+
BRL: 5.15,
|
|
13
|
+
MXN: 16.8,
|
|
14
|
+
SEK: 10.7,
|
|
15
|
+
NOK: 10.6,
|
|
16
|
+
NZD: 1.64,
|
|
17
|
+
SGD: 1.35,
|
|
18
|
+
HKD: 7.82
|
|
19
|
+
};
|
|
20
|
+
export const SUPPORTED_STORE_CURRENCIES = {
|
|
21
|
+
USD: { code: "USD", symbol: "$", decimals: 2, name: "US Dollar" },
|
|
22
|
+
EUR: { code: "EUR", symbol: "\u20AC", decimals: 2, name: "Euro" },
|
|
23
|
+
GBP: { code: "GBP", symbol: "\xA3", decimals: 2, name: "British Pound" },
|
|
24
|
+
CAD: { code: "CAD", symbol: "CA$", decimals: 2, name: "Canadian Dollar" },
|
|
25
|
+
AUD: { code: "AUD", symbol: "AU$", decimals: 2, name: "Australian Dollar" },
|
|
26
|
+
JPY: { code: "JPY", symbol: "\xA5", decimals: 0, name: "Japanese Yen" },
|
|
27
|
+
CHF: { code: "CHF", symbol: "CHF", decimals: 2, name: "Swiss Franc" },
|
|
28
|
+
CNY: { code: "CNY", symbol: "\xA5", decimals: 2, name: "Chinese Yuan" },
|
|
29
|
+
INR: { code: "INR", symbol: "\u20B9", decimals: 2, name: "Indian Rupee" },
|
|
30
|
+
BRL: { code: "BRL", symbol: "R$", decimals: 2, name: "Brazilian Real" },
|
|
31
|
+
MXN: { code: "MXN", symbol: "MX$", decimals: 2, name: "Mexican Peso" },
|
|
32
|
+
SEK: { code: "SEK", symbol: "kr", decimals: 2, name: "Swedish Krona" },
|
|
33
|
+
NOK: { code: "NOK", symbol: "kr", decimals: 2, name: "Norwegian Krone" },
|
|
34
|
+
NZD: { code: "NZD", symbol: "NZ$", decimals: 2, name: "New Zealand Dollar" },
|
|
35
|
+
SGD: { code: "SGD", symbol: "SG$", decimals: 2, name: "Singapore Dollar" },
|
|
36
|
+
HKD: { code: "HKD", symbol: "HK$", decimals: 2, name: "Hong Kong Dollar" }
|
|
37
|
+
};
|
|
38
|
+
export const COUNTRY_TO_CURRENCY_MAP = {
|
|
39
|
+
US: "USD",
|
|
40
|
+
GB: "GBP",
|
|
41
|
+
CA: "CAD",
|
|
42
|
+
AU: "AUD",
|
|
43
|
+
JP: "JPY",
|
|
44
|
+
CH: "CHF",
|
|
45
|
+
LI: "CHF",
|
|
46
|
+
CN: "CNY",
|
|
47
|
+
IN: "INR",
|
|
48
|
+
BR: "BRL",
|
|
49
|
+
MX: "MXN",
|
|
50
|
+
SE: "SEK",
|
|
51
|
+
NO: "NOK",
|
|
52
|
+
NZ: "NZD",
|
|
53
|
+
SG: "SGD",
|
|
54
|
+
HK: "HKD",
|
|
55
|
+
// EU Member States (Eurozone)
|
|
56
|
+
DE: "EUR",
|
|
57
|
+
FR: "EUR",
|
|
58
|
+
IT: "EUR",
|
|
59
|
+
ES: "EUR",
|
|
60
|
+
NL: "EUR",
|
|
61
|
+
BE: "EUR",
|
|
62
|
+
AT: "EUR",
|
|
63
|
+
IE: "EUR",
|
|
64
|
+
PT: "EUR",
|
|
65
|
+
FI: "EUR",
|
|
66
|
+
GR: "EUR",
|
|
67
|
+
SK: "EUR",
|
|
68
|
+
SI: "EUR",
|
|
69
|
+
LT: "EUR",
|
|
70
|
+
LV: "EUR",
|
|
71
|
+
EE: "EUR",
|
|
72
|
+
CY: "EUR",
|
|
73
|
+
MT: "EUR",
|
|
74
|
+
LU: "EUR",
|
|
75
|
+
HR: "EUR",
|
|
76
|
+
MC: "EUR",
|
|
77
|
+
SM: "EUR",
|
|
78
|
+
VA: "EUR",
|
|
79
|
+
AD: "EUR",
|
|
80
|
+
ME: "EUR",
|
|
81
|
+
XK: "EUR"
|
|
82
|
+
};
|
|
83
|
+
function safeGetHeader(event, name) {
|
|
84
|
+
if (!event || !name) return void 0;
|
|
85
|
+
try {
|
|
86
|
+
const val = getRequestHeader(event, name);
|
|
87
|
+
if (val) return val;
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
const req = event.node?.req;
|
|
91
|
+
const headers = req?.headers || event.headers;
|
|
92
|
+
if (headers) {
|
|
93
|
+
if (typeof headers.get === "function") {
|
|
94
|
+
return headers.get(name) || void 0;
|
|
95
|
+
}
|
|
96
|
+
const direct = headers[name.toLowerCase()] || headers[name];
|
|
97
|
+
return Array.isArray(direct) ? direct[0] : direct;
|
|
98
|
+
}
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
function safeGetCookie(event, name) {
|
|
102
|
+
if (!event || !name) return void 0;
|
|
103
|
+
try {
|
|
104
|
+
return getCookie(event, name);
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
return void 0;
|
|
108
|
+
}
|
|
109
|
+
export function detectStoreCountry(event) {
|
|
110
|
+
if (!event) return "US";
|
|
111
|
+
const cfCountry = safeGetHeader(event, "cf-ipcountry") || event.context?.cloudflare?.cf?.country || safeGetHeader(event, "x-country-code");
|
|
112
|
+
return cfCountry && cfCountry.length === 2 ? cfCountry.toUpperCase() : "US";
|
|
113
|
+
}
|
|
114
|
+
export function detectStoreCurrency(event, options) {
|
|
115
|
+
const allowed = options?.currencies && options.currencies.length > 0 ? options.currencies : Object.keys(DEFAULT_STORE_RATES);
|
|
116
|
+
if (event) {
|
|
117
|
+
const cookie = safeGetCookie(event, "qarpeo_currency")?.toUpperCase();
|
|
118
|
+
if (cookie && allowed.includes(cookie)) {
|
|
119
|
+
return cookie;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (options?.autoDetect !== false && event) {
|
|
123
|
+
const country = detectStoreCountry(event);
|
|
124
|
+
const geoCurrency = COUNTRY_TO_CURRENCY_MAP[country];
|
|
125
|
+
if (geoCurrency && allowed.includes(geoCurrency)) {
|
|
126
|
+
return geoCurrency;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return options?.defaultCurrency || "USD";
|
|
130
|
+
}
|
|
131
|
+
export function convertStoreCurrency(amountInCents, fromCurrency, toCurrency, rates = DEFAULT_STORE_RATES, rounding = "none") {
|
|
132
|
+
const from = fromCurrency.toUpperCase();
|
|
133
|
+
const to = toCurrency.toUpperCase();
|
|
134
|
+
if (from === to) return amountInCents;
|
|
135
|
+
const fromRate = rates[from] ?? DEFAULT_STORE_RATES[from] ?? 1;
|
|
136
|
+
const toRate = rates[to] ?? DEFAULT_STORE_RATES[to] ?? 1;
|
|
137
|
+
const fromDecimals = SUPPORTED_STORE_CURRENCIES[from]?.decimals ?? 2;
|
|
138
|
+
const toDecimals = SUPPORTED_STORE_CURRENCIES[to]?.decimals ?? 2;
|
|
139
|
+
const baseUnits = amountInCents / Math.pow(10, fromDecimals) / fromRate;
|
|
140
|
+
const targetUnits = baseUnits * toRate;
|
|
141
|
+
let targetCents = Math.round(targetUnits * Math.pow(10, toDecimals));
|
|
142
|
+
if (toDecimals === 2) {
|
|
143
|
+
if (rounding === "charm-99") {
|
|
144
|
+
const dollars = Math.floor(targetCents / 100);
|
|
145
|
+
targetCents = Math.max(99, dollars * 100 + 99);
|
|
146
|
+
} else if (rounding === "charm-95") {
|
|
147
|
+
const dollars = Math.floor(targetCents / 100);
|
|
148
|
+
targetCents = Math.max(95, dollars * 100 + 95);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return targetCents;
|
|
152
|
+
}
|
|
153
|
+
export function formatStorePrice(amountInCents, currency = "USD", locale = "en-US") {
|
|
154
|
+
const curr = currency.toUpperCase();
|
|
155
|
+
const decimals = SUPPORTED_STORE_CURRENCIES[curr]?.decimals ?? 2;
|
|
156
|
+
const value = amountInCents / Math.pow(10, decimals);
|
|
157
|
+
try {
|
|
158
|
+
return new Intl.NumberFormat(locale, {
|
|
159
|
+
style: "currency",
|
|
160
|
+
currency: curr,
|
|
161
|
+
minimumFractionDigits: decimals,
|
|
162
|
+
maximumFractionDigits: decimals
|
|
163
|
+
}).format(value);
|
|
164
|
+
} catch {
|
|
165
|
+
const symbol = SUPPORTED_STORE_CURRENCIES[curr]?.symbol || curr;
|
|
166
|
+
return `${symbol}${value.toFixed(decimals)}`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export const EU_STANDARD_VAT_RATES = {
|
|
170
|
+
AT: { rate: 0.2, name: "Austrian VAT" },
|
|
171
|
+
BE: { rate: 0.21, name: "Belgian VAT" },
|
|
172
|
+
BG: { rate: 0.2, name: "Bulgarian VAT" },
|
|
173
|
+
HR: { rate: 0.25, name: "Croatian VAT" },
|
|
174
|
+
CY: { rate: 0.19, name: "Cyprus VAT" },
|
|
175
|
+
CZ: { rate: 0.21, name: "Czech VAT" },
|
|
176
|
+
DK: { rate: 0.25, name: "Danish Moms" },
|
|
177
|
+
EE: { rate: 0.22, name: "Estonian VAT" },
|
|
178
|
+
FI: { rate: 0.255, name: "Finnish ALV" },
|
|
179
|
+
FR: { rate: 0.2, name: "French TVA" },
|
|
180
|
+
DE: { rate: 0.19, name: "German MwSt" },
|
|
181
|
+
GR: { rate: 0.24, name: "Greek FPA" },
|
|
182
|
+
HU: { rate: 0.27, name: "Hungarian \xC1FA" },
|
|
183
|
+
IE: { rate: 0.23, name: "Irish VAT" },
|
|
184
|
+
IT: { rate: 0.22, name: "Italian IVA" },
|
|
185
|
+
LV: { rate: 0.21, name: "Latvian PVN" },
|
|
186
|
+
LT: { rate: 0.21, name: "Lithuanian PVM" },
|
|
187
|
+
LU: { rate: 0.17, name: "Luxembourg TVA" },
|
|
188
|
+
MT: { rate: 0.18, name: "Maltese VAT" },
|
|
189
|
+
NL: { rate: 0.21, name: "Dutch BTW" },
|
|
190
|
+
PL: { rate: 0.23, name: "Polish PTU" },
|
|
191
|
+
PT: { rate: 0.23, name: "Portuguese IVA" },
|
|
192
|
+
RO: { rate: 0.19, name: "Romanian TVA" },
|
|
193
|
+
SK: { rate: 0.2, name: "Slovak DPH" },
|
|
194
|
+
SI: { rate: 0.22, name: "Slovenian DDV" },
|
|
195
|
+
ES: { rate: 0.21, name: "Spanish IVA" },
|
|
196
|
+
SE: { rate: 0.25, name: "Swedish Moms" }
|
|
197
|
+
};
|
|
198
|
+
export const US_STATE_TAX_RATES = {
|
|
199
|
+
CA: 0.0725,
|
|
200
|
+
NY: 0.04,
|
|
201
|
+
TX: 0.0625,
|
|
202
|
+
FL: 0.06,
|
|
203
|
+
IL: 0.0625,
|
|
204
|
+
PA: 0.06,
|
|
205
|
+
OH: 0.0575,
|
|
206
|
+
GA: 0.04,
|
|
207
|
+
NC: 0.0475,
|
|
208
|
+
MI: 0.06,
|
|
209
|
+
NJ: 0.06625,
|
|
210
|
+
VA: 0.053,
|
|
211
|
+
WA: 0.065,
|
|
212
|
+
AZ: 0.056,
|
|
213
|
+
MA: 0.0625,
|
|
214
|
+
TN: 0.07,
|
|
215
|
+
IN: 0.07,
|
|
216
|
+
MO: 0.04225,
|
|
217
|
+
MD: 0.06,
|
|
218
|
+
WI: 0.05,
|
|
219
|
+
CO: 0.029,
|
|
220
|
+
MN: 0.06875,
|
|
221
|
+
SC: 0.06,
|
|
222
|
+
AL: 0.04,
|
|
223
|
+
LA: 0.0445,
|
|
224
|
+
KY: 0.06,
|
|
225
|
+
OR: 0,
|
|
226
|
+
MT: 0,
|
|
227
|
+
NH: 0,
|
|
228
|
+
DE: 0,
|
|
229
|
+
AK: 0
|
|
230
|
+
};
|
|
231
|
+
export const CANADA_PROVINCE_TAX_RATES = {
|
|
232
|
+
ON: { rate: 0.13, name: "Ontario HST" },
|
|
233
|
+
QC: { rate: 0.14975, name: "Quebec GST + QST" },
|
|
234
|
+
BC: { rate: 0.12, name: "BC GST + PST" },
|
|
235
|
+
AB: { rate: 0.05, name: "Alberta GST" },
|
|
236
|
+
MB: { rate: 0.12, name: "Manitoba GST + PST" },
|
|
237
|
+
SK: { rate: 0.11, name: "Saskatchewan GST + PST" },
|
|
238
|
+
NS: { rate: 0.15, name: "Nova Scotia HST" },
|
|
239
|
+
NB: { rate: 0.15, name: "New Brunswick HST" },
|
|
240
|
+
NL: { rate: 0.15, name: "Newfoundland HST" },
|
|
241
|
+
PE: { rate: 0.15, name: "PEI HST" },
|
|
242
|
+
NT: { rate: 0.05, name: "NWT GST" },
|
|
243
|
+
NU: { rate: 0.05, name: "Nunavut GST" },
|
|
244
|
+
YT: { rate: 0.05, name: "Yukon GST" }
|
|
245
|
+
};
|
|
246
|
+
export function validateEuVatNumber(vatNumber) {
|
|
247
|
+
if (!vatNumber) return { valid: false };
|
|
248
|
+
const clean = vatNumber.replace(/[\s.-]/g, "").toUpperCase();
|
|
249
|
+
if (clean.length < 4 || clean.length > 16) return { valid: false };
|
|
250
|
+
const country = clean.slice(0, 2);
|
|
251
|
+
const number = clean.slice(2);
|
|
252
|
+
const VAT_REGEXES = {
|
|
253
|
+
AT: /^U[0-9]{8}$/,
|
|
254
|
+
BE: /^(0|1)[0-9]{9}$/,
|
|
255
|
+
BG: /^[0-9]{9,10}$/,
|
|
256
|
+
CY: /^[0-9]{8}[A-Z]$/,
|
|
257
|
+
CZ: /^[0-9]{8,10}$/,
|
|
258
|
+
DE: /^[0-9]{9}$/,
|
|
259
|
+
DK: /^[0-9]{8}$/,
|
|
260
|
+
EE: /^[0-9]{9}$/,
|
|
261
|
+
GR: /^[0-9]{9}$/,
|
|
262
|
+
ES: /^[0-9A-Z][0-9]{7}[0-9A-Z]$/,
|
|
263
|
+
FI: /^[0-9]{8}$/,
|
|
264
|
+
FR: /^[0-9A-Z]{2}[0-9]{9}$/,
|
|
265
|
+
HR: /^[0-9]{11}$/,
|
|
266
|
+
HU: /^[0-9]{8}$/,
|
|
267
|
+
IE: /^[0-9]{7}[A-W][A-I]?$/,
|
|
268
|
+
IT: /^[0-9]{11}$/,
|
|
269
|
+
LT: /^([0-9]{9}|[0-9]{12})$/,
|
|
270
|
+
LU: /^[0-9]{8}$/,
|
|
271
|
+
LV: /^[0-9]{11}$/,
|
|
272
|
+
MT: /^[0-9]{8}$/,
|
|
273
|
+
NL: /^[0-9]{9}B[0-9]{2}$/,
|
|
274
|
+
PL: /^[0-9]{10}$/,
|
|
275
|
+
PT: /^[0-9]{9}$/,
|
|
276
|
+
RO: /^[0-9]{2,10}$/,
|
|
277
|
+
SE: /^[0-9]{12}$/,
|
|
278
|
+
SI: /^[0-9]{8}$/,
|
|
279
|
+
SK: /^[0-9]{10}$/
|
|
280
|
+
};
|
|
281
|
+
const regex = VAT_REGEXES[country];
|
|
282
|
+
if (!regex || !regex.test(number)) {
|
|
283
|
+
return { valid: false, countryCode: country, cleanNumber: clean };
|
|
284
|
+
}
|
|
285
|
+
return { valid: true, countryCode: country, cleanNumber: clean };
|
|
286
|
+
}
|
|
287
|
+
export function calculateStoreTax(input, options) {
|
|
288
|
+
const taxableAmount = Math.max(0, input.subtotal + (input.shippingTotal ?? 0));
|
|
289
|
+
const country = (input.country || "").toUpperCase();
|
|
290
|
+
const state = (input.state || "").toUpperCase();
|
|
291
|
+
const merchantCountry = (options?.merchantCountry || "US").toUpperCase();
|
|
292
|
+
if (options?.rates && options.rates[country] != null) {
|
|
293
|
+
const override = options.rates[country];
|
|
294
|
+
if (typeof override === "number") {
|
|
295
|
+
const taxTotal2 = Math.round(taxableAmount * override);
|
|
296
|
+
return {
|
|
297
|
+
taxRate: override,
|
|
298
|
+
taxTotal: taxTotal2,
|
|
299
|
+
taxName: `${country} Tax (${(override * 100).toFixed(1)}%)`,
|
|
300
|
+
isReverseCharge: false,
|
|
301
|
+
breakdown: [{ name: `${country} Tax`, rate: override, amount: taxTotal2 }]
|
|
302
|
+
};
|
|
303
|
+
} else if (typeof override === "object" && state && override[state] != null) {
|
|
304
|
+
const stateRate = override[state];
|
|
305
|
+
const taxTotal2 = Math.round(taxableAmount * stateRate);
|
|
306
|
+
return {
|
|
307
|
+
taxRate: stateRate,
|
|
308
|
+
taxTotal: taxTotal2,
|
|
309
|
+
taxName: `${country}-${state} Tax (${(stateRate * 100).toFixed(1)}%)`,
|
|
310
|
+
isReverseCharge: false,
|
|
311
|
+
breakdown: [{ name: `${country}-${state} Tax`, rate: stateRate, amount: taxTotal2 }]
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (options?.b2bReverseCharge !== false && input.vatNumber) {
|
|
316
|
+
const vatCheck = validateEuVatNumber(input.vatNumber);
|
|
317
|
+
if (vatCheck.valid) {
|
|
318
|
+
if (EU_STANDARD_VAT_RATES[country] && country !== merchantCountry) {
|
|
319
|
+
return {
|
|
320
|
+
taxRate: 0,
|
|
321
|
+
taxTotal: 0,
|
|
322
|
+
taxName: "EU VAT Reverse Charge (0%)",
|
|
323
|
+
isReverseCharge: true,
|
|
324
|
+
vatNumberValid: true,
|
|
325
|
+
breakdown: [{ name: "B2B Reverse Charge", rate: 0, amount: 0 }]
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (options?.euVat !== false && EU_STANDARD_VAT_RATES[country]) {
|
|
331
|
+
const vatInfo = EU_STANDARD_VAT_RATES[country];
|
|
332
|
+
const taxTotal2 = Math.round(taxableAmount * vatInfo.rate);
|
|
333
|
+
return {
|
|
334
|
+
taxRate: vatInfo.rate,
|
|
335
|
+
taxTotal: taxTotal2,
|
|
336
|
+
taxName: `${vatInfo.name} (${(vatInfo.rate * 100).toFixed(1)}%)`,
|
|
337
|
+
isReverseCharge: false,
|
|
338
|
+
breakdown: [{ name: vatInfo.name, rate: vatInfo.rate, amount: taxTotal2 }]
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
if (country === "GB") {
|
|
342
|
+
const rate = 0.2;
|
|
343
|
+
const taxTotal2 = Math.round(taxableAmount * rate);
|
|
344
|
+
return {
|
|
345
|
+
taxRate: rate,
|
|
346
|
+
taxTotal: taxTotal2,
|
|
347
|
+
taxName: "UK VAT (20%)",
|
|
348
|
+
isReverseCharge: false,
|
|
349
|
+
breakdown: [{ name: "UK Standard VAT", rate, amount: taxTotal2 }]
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
if (country === "US") {
|
|
353
|
+
const rate = state && US_STATE_TAX_RATES[state] != null ? US_STATE_TAX_RATES[state] : 0;
|
|
354
|
+
const taxTotal2 = Math.round(taxableAmount * rate);
|
|
355
|
+
const name = state ? `US (${state}) Sales Tax` : "US Sales Tax";
|
|
356
|
+
return {
|
|
357
|
+
taxRate: rate,
|
|
358
|
+
taxTotal: taxTotal2,
|
|
359
|
+
taxName: `${name} (${(rate * 100).toFixed(2)}%)`,
|
|
360
|
+
isReverseCharge: false,
|
|
361
|
+
breakdown: [{ name, rate, amount: taxTotal2 }]
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
if (country === "CA") {
|
|
365
|
+
const prov = state && CANADA_PROVINCE_TAX_RATES[state] ? CANADA_PROVINCE_TAX_RATES[state] : { rate: 0.05, name: "Canada GST" };
|
|
366
|
+
const taxTotal2 = Math.round(taxableAmount * prov.rate);
|
|
367
|
+
return {
|
|
368
|
+
taxRate: prov.rate,
|
|
369
|
+
taxTotal: taxTotal2,
|
|
370
|
+
taxName: `${prov.name} (${(prov.rate * 100).toFixed(1)}%)`,
|
|
371
|
+
isReverseCharge: false,
|
|
372
|
+
breakdown: [{ name: prov.name, rate: prov.rate, amount: taxTotal2 }]
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
if (country === "AU") {
|
|
376
|
+
const rate = 0.1;
|
|
377
|
+
const taxTotal2 = Math.round(taxableAmount * rate);
|
|
378
|
+
return {
|
|
379
|
+
taxRate: rate,
|
|
380
|
+
taxTotal: taxTotal2,
|
|
381
|
+
taxName: "Australia GST (10%)",
|
|
382
|
+
isReverseCharge: false,
|
|
383
|
+
breakdown: [{ name: "Australia GST", rate, amount: taxTotal2 }]
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
if (country === "NZ") {
|
|
387
|
+
const rate = 0.15;
|
|
388
|
+
const taxTotal2 = Math.round(taxableAmount * rate);
|
|
389
|
+
return {
|
|
390
|
+
taxRate: rate,
|
|
391
|
+
taxTotal: taxTotal2,
|
|
392
|
+
taxName: "New Zealand GST (15%)",
|
|
393
|
+
isReverseCharge: false,
|
|
394
|
+
breakdown: [{ name: "New Zealand GST", rate, amount: taxTotal2 }]
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
if (country === "JP") {
|
|
398
|
+
const rate = 0.1;
|
|
399
|
+
const taxTotal2 = Math.round(taxableAmount * rate);
|
|
400
|
+
return {
|
|
401
|
+
taxRate: rate,
|
|
402
|
+
taxTotal: taxTotal2,
|
|
403
|
+
taxName: "Japan Consumption Tax (10%)",
|
|
404
|
+
isReverseCharge: false,
|
|
405
|
+
breakdown: [{ name: "Japan JCT", rate, amount: taxTotal2 }]
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
const fallback = options?.defaultRate ?? 0;
|
|
409
|
+
const taxTotal = Math.round(taxableAmount * fallback);
|
|
410
|
+
return {
|
|
411
|
+
taxRate: fallback,
|
|
412
|
+
taxTotal,
|
|
413
|
+
taxName: fallback > 0 ? `Tax (${(fallback * 100).toFixed(1)}%)` : "No Tax",
|
|
414
|
+
isReverseCharge: false,
|
|
415
|
+
breakdown: fallback > 0 ? [{ name: "Standard Tax", rate: fallback, amount: taxTotal }] : []
|
|
416
|
+
};
|
|
417
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { RequestEvent } from "nuxt/server";
|
|
2
|
+
import type { StoreOptions } from "../../../types";
|
|
3
|
+
import type { StoreProduct, StoreProductVariant, StoreInventory, StoreCategory, StoreCart, StoreCartItem, StoreCartTotals, StoreCustomerAddress, StoreOrder, StoreOrderItem, StoreOrderStatus, StoreDiscount, StoreDiscountType, StoreAddressType, StoreQueryProductsOptions, StoreQueryOrdersOptions, StoreQueryDiscountsOptions, StoreLowStockItem, StoreMetrics, StoreVendorMetrics } from "../../types/store";
|
|
4
|
+
export declare function storeProductTbl(event?: RequestEvent): string;
|
|
5
|
+
export declare function storeVariantTbl(event?: RequestEvent): string;
|
|
6
|
+
export declare function storeInventoryTbl(event?: RequestEvent): string;
|
|
7
|
+
export declare function storeCategoryTbl(event?: RequestEvent): string;
|
|
8
|
+
export declare function storeCartTbl(event?: RequestEvent): string;
|
|
9
|
+
export declare function storeCartItemTbl(event?: RequestEvent): string;
|
|
10
|
+
export declare function storeOrderTbl(event?: RequestEvent): string;
|
|
11
|
+
export declare function storeOrderItemTbl(event?: RequestEvent): string;
|
|
12
|
+
export declare function storeDiscountTbl(event?: RequestEvent): string;
|
|
13
|
+
export declare function storeAddressTbl(event?: RequestEvent): string;
|
|
14
|
+
export declare function getStoreConfig(event?: RequestEvent): StoreOptions;
|
|
15
|
+
export declare function rowToProduct(row: Record<string, any>): StoreProduct;
|
|
16
|
+
export declare function rowToVariant(row: Record<string, any>): StoreProductVariant;
|
|
17
|
+
export declare function rowToInventory(row: Record<string, any>): StoreInventory;
|
|
18
|
+
export declare function rowToCategory(row: Record<string, any>): StoreCategory;
|
|
19
|
+
export declare function rowToCartItem(row: Record<string, any>): StoreCartItem;
|
|
20
|
+
export declare function rowToCart(row: Record<string, any>, items?: StoreCartItem[]): StoreCart;
|
|
21
|
+
export declare function rowToOrderItem(row: Record<string, any>): StoreOrderItem;
|
|
22
|
+
export declare function rowToOrder(row: Record<string, any>, items?: StoreOrderItem[]): StoreOrder;
|
|
23
|
+
export declare function rowToDiscount(row: Record<string, any>): StoreDiscount;
|
|
24
|
+
export declare function rowToAddress(row: Record<string, any>): StoreCustomerAddress;
|
|
25
|
+
export declare function ensureStoreTables(event?: RequestEvent): Promise<void>;
|
|
26
|
+
export declare function queryStoreProducts(opts?: StoreQueryProductsOptions, event?: RequestEvent): Promise<{
|
|
27
|
+
products: StoreProduct[];
|
|
28
|
+
total: number;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function getStoreProduct(idOrSlug: string, event?: RequestEvent, opts?: {
|
|
31
|
+
tenantId?: string;
|
|
32
|
+
}): Promise<StoreProduct | null>;
|
|
33
|
+
export declare function createStoreProduct(data: Partial<StoreProduct> & {
|
|
34
|
+
title: string;
|
|
35
|
+
basePrice: number;
|
|
36
|
+
slug?: string;
|
|
37
|
+
}, event?: RequestEvent): Promise<StoreProduct>;
|
|
38
|
+
export declare function updateStoreProduct(id: string, data: Partial<StoreProduct>, event?: RequestEvent): Promise<StoreProduct | null>;
|
|
39
|
+
export declare function deleteStoreProduct(id: string, event?: RequestEvent): Promise<boolean>;
|
|
40
|
+
export declare function createStoreVariant(productId: string, data: Partial<StoreProductVariant> & {
|
|
41
|
+
sku: string;
|
|
42
|
+
title: string;
|
|
43
|
+
}, event?: RequestEvent): Promise<StoreProductVariant>;
|
|
44
|
+
export declare function updateStoreVariant(id: string, data: Partial<StoreProductVariant>, event?: RequestEvent): Promise<StoreProductVariant | null>;
|
|
45
|
+
export declare function deleteStoreVariant(id: string, event?: RequestEvent): Promise<boolean>;
|
|
46
|
+
export declare function queryStoreCategories(opts?: {
|
|
47
|
+
parentId?: string | null;
|
|
48
|
+
tenantId?: string;
|
|
49
|
+
}, event?: RequestEvent): Promise<StoreCategory[]>;
|
|
50
|
+
export declare function getStoreCategory(idOrSlug: string, event?: RequestEvent, opts?: {
|
|
51
|
+
tenantId?: string;
|
|
52
|
+
}): Promise<StoreCategory | null>;
|
|
53
|
+
export declare function createStoreCategory(data: Partial<StoreCategory> & {
|
|
54
|
+
name: string;
|
|
55
|
+
slug?: string;
|
|
56
|
+
}, event?: RequestEvent): Promise<StoreCategory>;
|
|
57
|
+
export declare function updateStoreCategory(id: string, data: Partial<StoreCategory>, event?: RequestEvent): Promise<StoreCategory | null>;
|
|
58
|
+
export declare function deleteStoreCategory(id: string, event?: RequestEvent): Promise<boolean>;
|
|
59
|
+
export declare function getStoreInventory(variantId: string, event?: RequestEvent): Promise<StoreInventory | null>;
|
|
60
|
+
export declare function adjustStoreStock(variantId: string, delta: number, event?: RequestEvent): Promise<StoreInventory>;
|
|
61
|
+
export declare function setStoreStock(variantId: string, quantity: number, reservedQuantity?: number, event?: RequestEvent): Promise<StoreInventory>;
|
|
62
|
+
export declare function updateStoreInventory(variantId: string, updates: {
|
|
63
|
+
stockQuantity?: number;
|
|
64
|
+
reservedQuantity?: number;
|
|
65
|
+
allowBackorder?: boolean;
|
|
66
|
+
lowStockThreshold?: number;
|
|
67
|
+
}, event?: RequestEvent): Promise<StoreInventory>;
|
|
68
|
+
export declare function getStoreProductInventory(productId: string, event?: RequestEvent): Promise<StoreInventory[]>;
|
|
69
|
+
export declare function queryLowStockInventory(opts?: {
|
|
70
|
+
threshold?: number;
|
|
71
|
+
tenantId?: string;
|
|
72
|
+
limit?: number;
|
|
73
|
+
offset?: number;
|
|
74
|
+
}, event?: RequestEvent): Promise<{
|
|
75
|
+
items: StoreLowStockItem[];
|
|
76
|
+
total: number;
|
|
77
|
+
}>;
|
|
78
|
+
export declare function reserveStoreStock(cartId: string, event?: RequestEvent): Promise<boolean>;
|
|
79
|
+
export declare function releaseStoreStock(cartId: string, event?: RequestEvent): Promise<boolean>;
|
|
80
|
+
export declare function commitStoreStock(orderId: string, event?: RequestEvent): Promise<boolean>;
|
|
81
|
+
export declare function releaseStoreOrderStock(orderId: string, event?: RequestEvent): Promise<boolean>;
|
|
82
|
+
export declare function getOrCreateStoreCart(sessionToken?: string, event?: RequestEvent): Promise<StoreCart>;
|
|
83
|
+
export declare function getStoreCart(cartIdOrToken: string, event?: RequestEvent): Promise<StoreCart | null>;
|
|
84
|
+
export declare function addToStoreCart(cartId: string, item: {
|
|
85
|
+
productId: string;
|
|
86
|
+
variantId: string;
|
|
87
|
+
quantity: number;
|
|
88
|
+
customAttributes?: Record<string, any>;
|
|
89
|
+
}, event?: RequestEvent): Promise<StoreCartItem>;
|
|
90
|
+
export declare function updateStoreCartItem(itemId: string, quantity: number, event?: RequestEvent): Promise<StoreCartItem | null>;
|
|
91
|
+
export declare function removeStoreCartItem(itemId: string, event?: RequestEvent): Promise<boolean>;
|
|
92
|
+
export declare function clearStoreCart(cartId: string, event?: RequestEvent): Promise<boolean>;
|
|
93
|
+
export declare function calculateStoreCartTotals(cartId: string, event?: RequestEvent): Promise<StoreCartTotals>;
|
|
94
|
+
export declare function mergeGuestCartOnLogin(guestSessionToken: string, userId: string, event?: RequestEvent): Promise<StoreCart>;
|
|
95
|
+
export declare function validateStoreDiscount(code: string, subtotal: number, event?: RequestEvent, opts?: {
|
|
96
|
+
tenantId?: string;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
valid: boolean;
|
|
99
|
+
discount?: StoreDiscount;
|
|
100
|
+
discountAmount: number;
|
|
101
|
+
message?: string;
|
|
102
|
+
}>;
|
|
103
|
+
export declare function applyStoreDiscount(cartId: string, code: string, event?: RequestEvent): Promise<{
|
|
104
|
+
success: boolean;
|
|
105
|
+
totals: StoreCartTotals;
|
|
106
|
+
message?: string;
|
|
107
|
+
}>;
|
|
108
|
+
export declare function createStoreDiscount(data: Partial<StoreDiscount> & {
|
|
109
|
+
code: string;
|
|
110
|
+
type: StoreDiscountType;
|
|
111
|
+
value: number;
|
|
112
|
+
}, event?: RequestEvent): Promise<StoreDiscount>;
|
|
113
|
+
export declare function getStoreDiscount(idOrCode: string, event?: RequestEvent): Promise<StoreDiscount | null>;
|
|
114
|
+
export declare function updateStoreDiscount(id: string, updates: Partial<StoreDiscount>, event?: RequestEvent): Promise<StoreDiscount | null>;
|
|
115
|
+
export declare function deleteStoreDiscount(id: string, event?: RequestEvent): Promise<boolean>;
|
|
116
|
+
export declare function queryStoreDiscounts(opts?: StoreQueryDiscountsOptions, event?: RequestEvent): Promise<{
|
|
117
|
+
discounts: StoreDiscount[];
|
|
118
|
+
total: number;
|
|
119
|
+
}>;
|
|
120
|
+
export declare function removeStoreDiscount(cartId: string, event?: RequestEvent): Promise<{
|
|
121
|
+
success: boolean;
|
|
122
|
+
totals: StoreCartTotals;
|
|
123
|
+
}>;
|
|
124
|
+
export declare function createStoreOrder(input: {
|
|
125
|
+
cartId: string;
|
|
126
|
+
customerEmail: string;
|
|
127
|
+
customerName?: string;
|
|
128
|
+
shippingAddress?: StoreCustomerAddress;
|
|
129
|
+
billingAddress?: StoreCustomerAddress;
|
|
130
|
+
metadata?: Record<string, any>;
|
|
131
|
+
}, event?: RequestEvent): Promise<StoreOrder>;
|
|
132
|
+
export declare function getStoreOrder(idOrNumber: string, event?: RequestEvent, opts?: {
|
|
133
|
+
tenantId?: string;
|
|
134
|
+
}): Promise<StoreOrder | null>;
|
|
135
|
+
export declare function queryStoreOrders(opts?: StoreQueryOrdersOptions, event?: RequestEvent): Promise<{
|
|
136
|
+
orders: StoreOrder[];
|
|
137
|
+
total: number;
|
|
138
|
+
}>;
|
|
139
|
+
export declare function updateStoreOrderStatus(id: string, status: StoreOrderStatus, optsOrEvent?: RequestEvent | {
|
|
140
|
+
paymentProvider?: string;
|
|
141
|
+
paymentIntentId?: string;
|
|
142
|
+
event?: RequestEvent;
|
|
143
|
+
}, maybeEvent?: RequestEvent): Promise<StoreOrder | null>;
|
|
144
|
+
export declare function refundStoreOrder(orderId: string, opts?: {
|
|
145
|
+
reason?: string;
|
|
146
|
+
amount?: number;
|
|
147
|
+
restock?: boolean;
|
|
148
|
+
}, event?: RequestEvent): Promise<StoreOrder | null>;
|
|
149
|
+
export declare function fulfillStoreOrder(orderId: string, opts?: {
|
|
150
|
+
trackingNumber?: string;
|
|
151
|
+
carrier?: string;
|
|
152
|
+
trackingUrl?: string;
|
|
153
|
+
notifyCustomer?: boolean;
|
|
154
|
+
}, event?: RequestEvent): Promise<StoreOrder | null>;
|
|
155
|
+
export declare function cancelStoreOrder(orderId: string, opts?: {
|
|
156
|
+
reason?: string;
|
|
157
|
+
restock?: boolean;
|
|
158
|
+
}, event?: RequestEvent): Promise<StoreOrder | null>;
|
|
159
|
+
export declare function deleteStoreOrder(orderId: string, event?: RequestEvent): Promise<boolean>;
|
|
160
|
+
export declare function generateDownloadUrl(orderItemId: string, event?: RequestEvent): Promise<{
|
|
161
|
+
downloadUrl: string;
|
|
162
|
+
expiresAt: number;
|
|
163
|
+
}>;
|
|
164
|
+
export declare function getStoreAddresses(userId: string, event?: RequestEvent): Promise<StoreCustomerAddress[]>;
|
|
165
|
+
export declare function saveStoreAddress(address: Partial<StoreCustomerAddress> & {
|
|
166
|
+
userId: string;
|
|
167
|
+
line1: string;
|
|
168
|
+
city: string;
|
|
169
|
+
postalCode: string;
|
|
170
|
+
country: string;
|
|
171
|
+
}, event?: RequestEvent): Promise<StoreCustomerAddress>;
|
|
172
|
+
export declare function deleteStoreAddress(id: string, userId: string, event?: RequestEvent): Promise<boolean>;
|
|
173
|
+
export declare function setDefaultStoreAddress(id: string, userId: string, type: StoreAddressType, event?: RequestEvent): Promise<boolean>;
|
|
174
|
+
export declare function getStoreDefaultAddress(userId: string, type: StoreAddressType, event?: RequestEvent): Promise<StoreCustomerAddress | null>;
|
|
175
|
+
export declare function getStoreMetrics(opts?: {
|
|
176
|
+
tenantId?: string;
|
|
177
|
+
startDate?: number;
|
|
178
|
+
endDate?: number;
|
|
179
|
+
}, event?: RequestEvent): Promise<StoreMetrics>;
|
|
180
|
+
export declare function createStoreCheckoutSession(cartId: string, opts?: {
|
|
181
|
+
customerEmail?: string;
|
|
182
|
+
customerName?: string;
|
|
183
|
+
shippingAddress?: StoreCustomerAddress;
|
|
184
|
+
billingAddress?: StoreCustomerAddress;
|
|
185
|
+
successUrl?: string;
|
|
186
|
+
cancelUrl?: string;
|
|
187
|
+
}, event?: RequestEvent): Promise<{
|
|
188
|
+
sessionId: string;
|
|
189
|
+
checkoutUrl?: string;
|
|
190
|
+
order: StoreOrder;
|
|
191
|
+
}>;
|
|
192
|
+
export declare function isMultiVendorStore(event?: RequestEvent): boolean;
|
|
193
|
+
export declare function getStoreVendorMetrics(vendorId: string, opts?: {
|
|
194
|
+
tenantId?: string;
|
|
195
|
+
}, event?: RequestEvent): Promise<StoreVendorMetrics>;
|
|
196
|
+
export declare function queryVendorProducts(vendorId: string, opts?: Omit<StoreQueryProductsOptions, "vendorId">, event?: RequestEvent): Promise<{
|
|
197
|
+
products: StoreProduct[];
|
|
198
|
+
total: number;
|
|
199
|
+
}>;
|
|
200
|
+
export declare function queryVendorOrderItems(vendorId: string, opts?: {
|
|
201
|
+
tenantId?: string;
|
|
202
|
+
limit?: number;
|
|
203
|
+
offset?: number;
|
|
204
|
+
}, event?: RequestEvent): Promise<{
|
|
205
|
+
items: StoreOrderItem[];
|
|
206
|
+
total: number;
|
|
207
|
+
}>;
|