nuxt-backend 0.2.0 → 0.2.1
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/dist/chunks/catalog.mjs +1 -1
- package/dist/chunks/doctor.mjs +71 -12
- package/dist/chunks/email-previews.mjs +1 -1
- package/dist/chunks/health.mjs +2 -2
- package/dist/chunks/index.mjs +3 -3
- package/dist/chunks/install.mjs +4 -4
- package/dist/chunks/run.mjs +1 -1
- package/dist/chunks/server.mjs +7 -5
- package/dist/cli.mjs +122 -23
- package/dist/convex/account-data.d.ts +0 -2
- package/dist/convex/account-data.d.ts.map +1 -1
- package/dist/convex/account-data.js +0 -4
- package/dist/convex/account-data.js.map +1 -1
- package/dist/convex/catalog.d.ts +22 -0
- package/dist/convex/catalog.d.ts.map +1 -1
- package/dist/convex/catalog.js.map +1 -1
- package/dist/convex/client/better-auth-options.d.ts.map +1 -1
- package/dist/convex/client/better-auth-options.js +11 -1
- package/dist/convex/client/better-auth-options.js.map +1 -1
- package/dist/convex/client/client-address.d.ts +21 -0
- package/dist/convex/client/client-address.d.ts.map +1 -0
- package/dist/convex/client/client-address.js +37 -0
- package/dist/convex/client/client-address.js.map +1 -0
- package/dist/convex/client/index.d.ts +34 -2
- package/dist/convex/client/index.d.ts.map +1 -1
- package/dist/convex/components/backend/_generated/component.d.ts +6 -0
- package/dist/convex/components/backend/_generated/component.d.ts.map +1 -1
- package/dist/convex/components/backend/account.d.ts +6 -6
- package/dist/convex/components/backend/account.d.ts.map +1 -1
- package/dist/convex/components/backend/account.js +6 -2
- package/dist/convex/components/backend/account.js.map +1 -1
- package/dist/convex/components/backend/adapter.d.ts.map +1 -1
- package/dist/convex/components/backend/adapter.js +4 -1
- package/dist/convex/components/backend/adapter.js.map +1 -1
- package/dist/convex/components/backend/ai.d.ts +11 -3
- package/dist/convex/components/backend/ai.d.ts.map +1 -1
- package/dist/convex/components/backend/ai.js +18 -52
- package/dist/convex/components/backend/ai.js.map +1 -1
- package/dist/convex/components/backend/billing.d.ts.map +1 -1
- package/dist/convex/components/backend/billing.js +12 -32
- package/dist/convex/components/backend/billing.js.map +1 -1
- package/dist/convex/components/backend/consents.d.ts.map +1 -1
- package/dist/convex/components/backend/consents.js +2 -1
- package/dist/convex/components/backend/consents.js.map +1 -1
- package/dist/convex/components/backend/gifts.d.ts +1 -1
- package/dist/convex/components/backend/gifts.d.ts.map +1 -1
- package/dist/convex/components/backend/gifts.js +9 -4
- package/dist/convex/components/backend/gifts.js.map +1 -1
- package/dist/convex/components/backend/lifecycle.d.ts.map +1 -1
- package/dist/convex/components/backend/lifecycle.js +18 -14
- package/dist/convex/components/backend/lifecycle.js.map +1 -1
- package/dist/convex/components/backend/notifications.d.ts +13 -0
- package/dist/convex/components/backend/notifications.d.ts.map +1 -1
- package/dist/convex/components/backend/notifications.js +21 -0
- package/dist/convex/components/backend/notifications.js.map +1 -1
- package/dist/convex/components/backend/referrals.d.ts.map +1 -1
- package/dist/convex/components/backend/referrals.js +13 -16
- package/dist/convex/components/backend/referrals.js.map +1 -1
- package/dist/convex/components/backend/reports.js +7 -7
- package/dist/convex/components/backend/reports.js.map +1 -1
- package/dist/convex/components/backend/schema.d.ts +151 -35
- package/dist/convex/components/backend/schema.d.ts.map +1 -1
- package/dist/convex/components/backend/schema.js +127 -153
- package/dist/convex/components/backend/schema.js.map +1 -1
- package/dist/convex/components/backend/storage.d.ts.map +1 -1
- package/dist/convex/components/backend/storage.js +10 -10
- package/dist/convex/components/backend/storage.js.map +1 -1
- package/dist/convex/components/backend/subscriptions.d.ts +3 -3
- package/dist/convex/components/backend/subscriptions.d.ts.map +1 -1
- package/dist/convex/components/backend/subscriptions.js +6 -35
- package/dist/convex/components/backend/subscriptions.js.map +1 -1
- package/dist/convex/components/backend/waitlist.d.ts +1 -1
- package/dist/convex/components/backend/webhooks.d.ts +0 -1
- package/dist/convex/components/backend/webhooks.d.ts.map +1 -1
- package/dist/convex/components/backend/webhooks.js +1 -1
- package/dist/convex/components/backend/webhooks.js.map +1 -1
- package/dist/convex/consent-rules.d.ts +0 -2
- package/dist/convex/consent-rules.d.ts.map +1 -1
- package/dist/convex/consent-rules.js.map +1 -1
- package/dist/convex/constants.d.ts +0 -1
- package/dist/convex/constants.d.ts.map +1 -1
- package/dist/convex/constants.js +0 -1
- package/dist/convex/constants.js.map +1 -1
- package/dist/convex/email-templates.d.ts +0 -1
- package/dist/convex/email-templates.d.ts.map +1 -1
- package/dist/convex/email-templates.js +0 -1
- package/dist/convex/email-templates.js.map +1 -1
- package/dist/convex/integrations/admin.d.ts +2 -1
- package/dist/convex/integrations/admin.d.ts.map +1 -1
- package/dist/convex/integrations/admin.js.map +1 -1
- package/dist/convex/integrations/ai/job-errors.d.ts +7 -0
- package/dist/convex/integrations/ai/job-errors.d.ts.map +1 -1
- package/dist/convex/integrations/ai/job-errors.js +22 -0
- package/dist/convex/integrations/ai/job-errors.js.map +1 -1
- package/dist/convex/integrations/ai/metering.d.ts +12 -0
- package/dist/convex/integrations/ai/metering.d.ts.map +1 -1
- package/dist/convex/integrations/ai/metering.js +19 -10
- package/dist/convex/integrations/ai/metering.js.map +1 -1
- package/dist/convex/integrations/ai/models.d.ts.map +1 -1
- package/dist/convex/integrations/ai/models.js +3 -1
- package/dist/convex/integrations/ai/models.js.map +1 -1
- package/dist/convex/integrations/ai/moderation.d.ts +2 -0
- package/dist/convex/integrations/ai/moderation.d.ts.map +1 -1
- package/dist/convex/integrations/ai/moderation.js +29 -2
- package/dist/convex/integrations/ai/moderation.js.map +1 -1
- package/dist/convex/integrations/ai/stream.d.ts +1 -1
- package/dist/convex/integrations/ai/stream.d.ts.map +1 -1
- package/dist/convex/integrations/ai/stream.js +3 -11
- package/dist/convex/integrations/ai/stream.js.map +1 -1
- package/dist/convex/integrations/billing/context.d.ts +0 -1
- package/dist/convex/integrations/billing/context.d.ts.map +1 -1
- package/dist/convex/integrations/billing/context.js +1 -4
- package/dist/convex/integrations/billing/context.js.map +1 -1
- package/dist/convex/integrations/billing/credits.d.ts.map +1 -1
- package/dist/convex/integrations/billing/customers.d.ts.map +1 -1
- package/dist/convex/integrations/billing/customers.js +25 -5
- package/dist/convex/integrations/billing/customers.js.map +1 -1
- package/dist/convex/integrations/billing/features.d.ts.map +1 -1
- package/dist/convex/integrations/billing/free-plan.d.ts +1 -1
- package/dist/convex/integrations/billing/free-plan.d.ts.map +1 -1
- package/dist/convex/integrations/billing/free-plan.js +18 -4
- package/dist/convex/integrations/billing/free-plan.js.map +1 -1
- package/dist/convex/integrations/billing/functions.d.ts +5 -1
- package/dist/convex/integrations/billing/functions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/functions.js +16 -5
- package/dist/convex/integrations/billing/functions.js.map +1 -1
- package/dist/convex/integrations/billing/gifts.d.ts.map +1 -1
- package/dist/convex/integrations/billing/gifts.js +2 -2
- package/dist/convex/integrations/billing/gifts.js.map +1 -1
- package/dist/convex/integrations/billing/history.d.ts.map +1 -1
- package/dist/convex/integrations/billing/history.js +3 -1
- package/dist/convex/integrations/billing/history.js.map +1 -1
- package/dist/convex/integrations/billing/lifecycle.d.ts +4 -1
- package/dist/convex/integrations/billing/lifecycle.d.ts.map +1 -1
- package/dist/convex/integrations/billing/lifecycle.js +33 -2
- package/dist/convex/integrations/billing/lifecycle.js.map +1 -1
- package/dist/convex/integrations/billing/passes.d.ts +0 -2
- package/dist/convex/integrations/billing/passes.d.ts.map +1 -1
- package/dist/convex/integrations/billing/passes.js +2 -3
- package/dist/convex/integrations/billing/passes.js.map +1 -1
- package/dist/convex/integrations/billing/pricing.d.ts +4 -1
- package/dist/convex/integrations/billing/pricing.d.ts.map +1 -1
- package/dist/convex/integrations/billing/pricing.js +11 -9
- package/dist/convex/integrations/billing/pricing.js.map +1 -1
- package/dist/convex/integrations/billing/purchase.d.ts.map +1 -1
- package/dist/convex/integrations/billing/purchase.js +1 -2
- package/dist/convex/integrations/billing/purchase.js.map +1 -1
- package/dist/convex/integrations/billing/quotas.d.ts.map +1 -1
- package/dist/convex/integrations/billing/subscriptions.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/lifecycle.d.ts +12 -0
- package/dist/convex/integrations/billing/types/lifecycle.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/options.d.ts +4 -1
- package/dist/convex/integrations/billing/types/options.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/records.d.ts +7 -1
- package/dist/convex/integrations/billing/types/records.d.ts.map +1 -1
- package/dist/convex/integrations/billing/types/surface.d.ts +5 -1
- package/dist/convex/integrations/billing/types/surface.d.ts.map +1 -1
- package/dist/convex/integrations/billing.d.ts +2 -2
- package/dist/convex/integrations/billing.d.ts.map +1 -1
- package/dist/convex/integrations/billing.js +1 -0
- package/dist/convex/integrations/billing.js.map +1 -1
- package/dist/convex/integrations/email-preferences.d.ts +1 -1
- package/dist/convex/integrations/email-preferences.d.ts.map +1 -1
- package/dist/convex/integrations/email-sync.d.ts.map +1 -1
- package/dist/convex/integrations/email-sync.js +43 -1
- package/dist/convex/integrations/email-sync.js.map +1 -1
- package/dist/convex/integrations/notifications.d.ts +24 -4
- package/dist/convex/integrations/notifications.d.ts.map +1 -1
- package/dist/convex/integrations/notifications.js +30 -14
- package/dist/convex/integrations/notifications.js.map +1 -1
- package/dist/convex/integrations/rate-limit.d.ts +6 -5
- package/dist/convex/integrations/rate-limit.d.ts.map +1 -1
- package/dist/convex/integrations/rate-limit.js +6 -5
- package/dist/convex/integrations/rate-limit.js.map +1 -1
- package/dist/convex/integrations/reports.d.ts +1 -1
- package/dist/convex/integrations/reports.d.ts.map +1 -1
- package/dist/convex/integrations/reports.js +0 -11
- package/dist/convex/integrations/reports.js.map +1 -1
- package/dist/convex/integrations/webhooks.d.ts +1 -3
- package/dist/convex/integrations/webhooks.d.ts.map +1 -1
- package/dist/convex/integrations/webhooks.js.map +1 -1
- package/dist/convex/label-groups/cancelFlow.d.ts +3 -0
- package/dist/convex/label-groups/cancelFlow.d.ts.map +1 -1
- package/dist/convex/label-groups/cancelFlow.js +5 -0
- package/dist/convex/label-groups/cancelFlow.js.map +1 -1
- package/dist/convex/label-groups/credits.d.ts +14 -1
- package/dist/convex/label-groups/credits.d.ts.map +1 -1
- package/dist/convex/label-groups/credits.js +17 -2
- package/dist/convex/label-groups/credits.js.map +1 -1
- package/dist/convex/label-groups/notifications.d.ts +19 -2
- package/dist/convex/label-groups/notifications.d.ts.map +1 -1
- package/dist/convex/label-groups/notifications.js +19 -15
- package/dist/convex/label-groups/notifications.js.map +1 -1
- package/dist/convex/label-groups/pricing.js +8 -8
- package/dist/convex/label-groups/pricing.js.map +1 -1
- package/dist/convex/label-groups/settings.d.ts.map +1 -1
- package/dist/convex/label-groups/settings.js +4 -3
- package/dist/convex/label-groups/settings.js.map +1 -1
- package/dist/convex/label-groups/usage.d.ts +1 -1
- package/dist/convex/label-groups/usage.d.ts.map +1 -1
- package/dist/convex/label-groups/usage.js +2 -2
- package/dist/convex/label-groups/usage.js.map +1 -1
- package/dist/convex/label-translations.d.ts.map +1 -1
- package/dist/convex/label-translations.js +52 -0
- package/dist/convex/label-translations.js.map +1 -1
- package/dist/convex/labels.d.ts +23 -0
- package/dist/convex/labels.d.ts.map +1 -1
- package/dist/convex/log.js +2 -0
- package/dist/convex/log.js.map +1 -1
- package/dist/convex/notifications.d.ts +77 -0
- package/dist/convex/notifications.d.ts.map +1 -1
- package/dist/convex/notifications.js +64 -13
- package/dist/convex/notifications.js.map +1 -1
- package/dist/convex/proof.d.ts +25 -0
- package/dist/convex/proof.d.ts.map +1 -1
- package/dist/convex/proof.js +39 -0
- package/dist/convex/proof.js.map +1 -1
- package/dist/convex/referral-rules.d.ts +0 -2
- package/dist/convex/referral-rules.d.ts.map +1 -1
- package/dist/convex/referral-rules.js +0 -2
- package/dist/convex/referral-rules.js.map +1 -1
- package/dist/convex/waitlist-rules.d.ts +1 -13
- package/dist/convex/waitlist-rules.d.ts.map +1 -1
- package/dist/convex/waitlist-rules.js +2 -14
- package/dist/convex/waitlist-rules.js.map +1 -1
- package/dist/devtools-client/index.html +1 -1
- package/dist/module.js +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/locales/de.json +47 -24
- package/dist/runtime/locales/en.json +47 -24
- package/dist/runtime/locales/es.json +47 -24
- package/dist/runtime/locales/fr.json +47 -24
- package/dist/runtime/locales/ru.json +47 -24
- package/dist/runtime/server/protection/gate.d.ts +4 -2
- package/dist/runtime/server/protection/gate.js +14 -4
- package/dist/runtime/vue/admin-client.d.ts +18 -0
- package/dist/runtime/vue/admin-client.js +32 -0
- package/dist/runtime/vue/auth-client.d.ts +16 -11
- package/dist/runtime/vue/auth-client.js +3 -1
- package/dist/runtime/vue/components/admin/AdminUsers.d.vue.ts +1 -1
- package/dist/runtime/vue/components/admin/AdminUsers.vue.d.ts +1 -1
- package/dist/runtime/vue/components/billing/BillingCheckoutLink.d.vue.ts +1 -1
- package/dist/runtime/vue/components/billing/BillingCheckoutLink.vue.d.ts +1 -1
- package/dist/runtime/vue/components/billing/CancelFlow.css +1 -1
- package/dist/runtime/vue/components/billing/CancelFlow.d.vue.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlow.vue +10 -3
- package/dist/runtime/vue/components/billing/CancelFlow.vue.d.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlowConfirm.d.vue.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlowConfirm.vue +34 -0
- package/dist/runtime/vue/components/billing/CancelFlowConfirm.vue.d.ts +3 -0
- package/dist/runtime/vue/components/billing/CancelFlowQuestion.vue +2 -1
- package/dist/runtime/vue/components/billing/GiftSent.d.vue.ts +2 -2
- package/dist/runtime/vue/components/billing/GiftSent.vue.d.ts +2 -2
- package/dist/runtime/vue/components/billing/PricingPackCard.vue +6 -3
- package/dist/runtime/vue/components/billing/PricingPlanCard.vue +3 -1
- package/dist/runtime/vue/components/billing/PricingTable.d.vue.ts +2 -2
- package/dist/runtime/vue/components/billing/PricingTable.vue +3 -1
- package/dist/runtime/vue/components/billing/PricingTable.vue.d.ts +2 -2
- package/dist/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
- package/dist/runtime/vue/components/billing/cancel-flow.d.ts +28 -7
- package/dist/runtime/vue/components/billing/cancel-flow.js +25 -2
- package/dist/runtime/vue/components/shell/NoticeLowCredits.vue +3 -1
- package/dist/runtime/vue/components/tokens.css +1 -1
- package/dist/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.d.vue.ts +2 -2
- package/dist/runtime/vue/components/workspaces/WorkspaceSettings.vue.d.ts +2 -2
- package/dist/runtime/vue/composables/use-auth.d.ts +13 -1
- package/dist/runtime/vue/composables/use-auth.js +4 -1
- package/dist/runtime/vue/composables/use-billing.d.ts +10 -2
- package/dist/runtime/vue/composables/use-credits.d.ts +3 -0
- package/dist/runtime/vue/composables/use-credits.js +1 -0
- package/dist/runtime/vue/composables/use-notifications.d.ts +5 -1
- package/dist/runtime/vue/composables/use-notifications.js +12 -4
- package/dist/runtime/vue/composables/use-webhook-log.d.ts +4 -2
- package/dist/runtime/vue/organization-client.d.ts +15 -0
- package/dist/runtime/vue/organization-client.js +65 -0
- package/dist/runtime/vue/parts.d.ts +2 -1
- package/dist/runtime/vue/plugins/checkout-return.d.ts +3 -2
- package/dist/runtime/vue/plugins/checkout-return.js +2 -4
- package/dist/runtime/vue/plugins/first-touch.js +2 -4
- package/dist/runtime/vue/utils/checkout-return.d.ts +9 -2
- package/dist/runtime/vue/utils/checkout-return.js +2 -1
- package/dist/runtime/vue/utils/every-page.d.ts +10 -0
- package/dist/runtime/vue/utils/every-page.js +6 -0
- package/dist/runtime/vue/utils/meter-unit.d.ts +14 -0
- package/dist/runtime/vue/utils/meter-unit.js +18 -0
- package/dist/shared/{nuxt-backend.2YoiKo8j.mjs → nuxt-backend.2m535CLS.mjs} +6 -2
- package/dist/shared/{nuxt-backend.CPq101Wi.mjs → nuxt-backend.DXEf0rrv.mjs} +1 -1
- package/dist/shared/{nuxt-backend.-uB5CGw-.mjs → nuxt-backend.Dm1NkY7v.mjs} +1 -1
- package/dist/shared/{nuxt-backend.OQMX-0U7.mjs → nuxt-backend.KEzfHO2K.mjs} +6 -3
- package/dist/shared/{nuxt-backend.S5C2b-4I.mjs → nuxt-backend.ikObmtHs.mjs} +2 -2
- package/package.json +2 -2
- package/skills/nuxt-backend/references/api.md +13 -3
- package/skills/nuxt-backend/references/surface.json +12 -0
- package/skills/nuxt-backend-auth/SKILL.md +2 -1
- package/skills/nuxt-backend-billing/SKILL.md +7 -0
- package/skills/nuxt-backend-billing/references/api.md +12 -2
- package/skills/nuxt-backend-data/SKILL.md +4 -1
- package/skills/nuxt-backend-email/SKILL.md +4 -0
- package/skills/nuxt-backend-email/references/api.md +1 -1
- package/skills/nuxt-backend-ui/SKILL.md +6 -5
- package/src/convex/account-data.ts +0 -5
- package/src/convex/catalog.ts +23 -0
- package/src/convex/client/better-auth-options.ts +11 -1
- package/src/convex/client/client-address.ts +37 -0
- package/src/convex/components/backend/_generated/component.ts +12 -0
- package/src/convex/components/backend/account.ts +7 -2
- package/src/convex/components/backend/adapter.ts +4 -1
- package/src/convex/components/backend/ai.ts +20 -54
- package/src/convex/components/backend/billing.ts +14 -33
- package/src/convex/components/backend/consents.ts +2 -1
- package/src/convex/components/backend/gifts.ts +11 -5
- package/src/convex/components/backend/lifecycle.ts +17 -12
- package/src/convex/components/backend/notifications.ts +22 -0
- package/src/convex/components/backend/referrals.ts +14 -16
- package/src/convex/components/backend/reports.ts +7 -7
- package/src/convex/components/backend/schema.ts +143 -161
- package/src/convex/components/backend/storage.ts +11 -10
- package/src/convex/components/backend/subscriptions.ts +7 -35
- package/src/convex/components/backend/webhooks.ts +1 -10
- package/src/convex/consent-rules.ts +0 -3
- package/src/convex/constants.ts +0 -1
- package/src/convex/email-templates.ts +0 -1
- package/src/convex/integrations/admin.ts +2 -1
- package/src/convex/integrations/ai/job-errors.ts +21 -0
- package/src/convex/integrations/ai/metering.ts +24 -10
- package/src/convex/integrations/ai/models.ts +3 -1
- package/src/convex/integrations/ai/moderation.ts +31 -2
- package/src/convex/integrations/ai/stream.ts +3 -11
- package/src/convex/integrations/billing/context.ts +1 -9
- package/src/convex/integrations/billing/customers.ts +28 -5
- package/src/convex/integrations/billing/free-plan.ts +20 -5
- package/src/convex/integrations/billing/functions.ts +17 -5
- package/src/convex/integrations/billing/gifts.ts +2 -2
- package/src/convex/integrations/billing/history.ts +2 -1
- package/src/convex/integrations/billing/lifecycle.ts +30 -3
- package/src/convex/integrations/billing/passes.ts +2 -4
- package/src/convex/integrations/billing/pricing.ts +14 -10
- package/src/convex/integrations/billing/purchase.ts +1 -2
- package/src/convex/integrations/billing/types/lifecycle.ts +13 -0
- package/src/convex/integrations/billing/types/options.ts +4 -1
- package/src/convex/integrations/billing/types/records.ts +7 -1
- package/src/convex/integrations/billing/types/surface.ts +3 -1
- package/src/convex/integrations/billing.ts +3 -2
- package/src/convex/integrations/email-preferences.ts +1 -1
- package/src/convex/integrations/email-sync.ts +44 -1
- package/src/convex/integrations/notifications.ts +65 -16
- package/src/convex/integrations/rate-limit.ts +6 -5
- package/src/convex/integrations/reports.ts +1 -1
- package/src/convex/integrations/webhooks.ts +1 -4
- package/src/convex/label-groups/cancelFlow.ts +5 -0
- package/src/convex/label-groups/credits.ts +17 -2
- package/src/convex/label-groups/notifications.ts +19 -15
- package/src/convex/label-groups/pricing.ts +8 -8
- package/src/convex/label-groups/settings.ts +4 -3
- package/src/convex/label-groups/usage.ts +2 -2
- package/src/convex/label-translations.ts +52 -0
- package/src/convex/log.ts +2 -0
- package/src/convex/notifications.ts +99 -13
- package/src/convex/proof.ts +43 -0
- package/src/convex/referral-rules.ts +0 -2
- package/src/convex/waitlist-rules.ts +2 -22
- package/src/runtime/vue/components/billing/CancelFlow.css +16 -0
- package/src/runtime/vue/components/billing/CancelFlow.vue +16 -6
- package/src/runtime/vue/components/billing/CancelFlowConfirm.vue +35 -0
- package/src/runtime/vue/components/billing/CancelFlowQuestion.vue +8 -2
- package/src/runtime/vue/components/billing/PricingPackCard.vue +6 -3
- package/src/runtime/vue/components/billing/PricingPlanCard.vue +3 -1
- package/src/runtime/vue/components/billing/PricingTable.vue +3 -1
- package/src/runtime/vue/components/billing/UsageHistoryEvent.vue +3 -1
- package/src/runtime/vue/components/shell/NoticeLowCredits.vue +3 -1
- package/src/runtime/vue/components/tokens.css +19 -15
- package/src/runtime/vue/components/workspaces/WorkspaceCredits.vue +6 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({ name: "CancelFlowConfirm" });
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
flow: { type: Object, required: true }
|
|
5
|
+
});
|
|
6
|
+
const { t } = props.flow.labels;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div
|
|
11
|
+
data-cancel-flow="confirm"
|
|
12
|
+
role="group"
|
|
13
|
+
:aria-labelledby="flow.id('title')"
|
|
14
|
+
>
|
|
15
|
+
<p data-cancel-flow="confirm-ends">
|
|
16
|
+
{{ t("confirmEnds") }}
|
|
17
|
+
</p>
|
|
18
|
+
<button
|
|
19
|
+
data-cancel-flow="confirm-cancel"
|
|
20
|
+
type="button"
|
|
21
|
+
v-bind="flow.busy('cancel')"
|
|
22
|
+
@click="flow.cancelNow()"
|
|
23
|
+
>
|
|
24
|
+
{{ flow.running.value === "cancel" ? t("canceling") : t("confirmCancel") }}
|
|
25
|
+
</button>
|
|
26
|
+
<button
|
|
27
|
+
data-cancel-flow="back"
|
|
28
|
+
type="button"
|
|
29
|
+
@click="flow.back()"
|
|
30
|
+
>
|
|
31
|
+
{{ t("back") }}
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("../../parts.js").CancelFlowPartProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("../../parts.js").CancelFlowPartProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -43,9 +43,10 @@ const { t } = props.flow.labels;
|
|
|
43
43
|
<button
|
|
44
44
|
data-cancel-flow="continue"
|
|
45
45
|
type="submit"
|
|
46
|
+
:data-intent="flow.offers.value ? void 0 : 'cancel'"
|
|
46
47
|
v-bind="flow.busy('continue')"
|
|
47
48
|
>
|
|
48
|
-
{{ flow.running.value === "continue" ? t("canceling") : t("continue") }}
|
|
49
|
+
{{ flow.running.value === "continue" ? t("canceling") : flow.offers.value ? t("continue") : t("cancel") }}
|
|
49
50
|
</button>
|
|
50
51
|
</form>
|
|
51
52
|
</template>
|
|
@@ -17,11 +17,11 @@ type __VLS_Props = {
|
|
|
17
17
|
t: UseLabelsReturn<'gift'>['t'];
|
|
18
18
|
};
|
|
19
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
-
resend: () => any;
|
|
21
20
|
cancel: () => any;
|
|
21
|
+
resend: () => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
-
onResend?: (() => any) | undefined;
|
|
24
23
|
onCancel?: (() => any) | undefined;
|
|
24
|
+
onResend?: (() => any) | undefined;
|
|
25
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
27
27
|
export default _default;
|
|
@@ -17,11 +17,11 @@ type __VLS_Props = {
|
|
|
17
17
|
t: UseLabelsReturn<'gift'>['t'];
|
|
18
18
|
};
|
|
19
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
-
resend: () => any;
|
|
21
20
|
cancel: () => any;
|
|
21
|
+
resend: () => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
-
onResend?: (() => any) | undefined;
|
|
24
23
|
onCancel?: (() => any) | undefined;
|
|
24
|
+
onResend?: (() => any) | undefined;
|
|
25
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
27
27
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { busyAttributes } from "../../a11y";
|
|
4
|
+
import { useMeterUnit } from "../../utils/meter-unit";
|
|
4
5
|
import { usePricingView } from "./pricing-table";
|
|
5
6
|
import PricingPromotion from "./PricingPromotion.vue";
|
|
6
7
|
defineOptions({ name: "PricingPackCard" });
|
|
@@ -13,6 +14,8 @@ const { t } = view.labels;
|
|
|
13
14
|
const nameId = computed(() => view.nameId("pack", props.pack.key));
|
|
14
15
|
const busy = computed(() => props.pricing.pending.value === props.pack.key);
|
|
15
16
|
const promotion = computed(() => view.packPromotion(props.pack));
|
|
17
|
+
const unit = useMeterUnit();
|
|
18
|
+
const meterUnit = computed(() => props.pack.offer.credits?.unit);
|
|
16
19
|
</script>
|
|
17
20
|
|
|
18
21
|
<template>
|
|
@@ -42,16 +45,16 @@ const promotion = computed(() => view.packPromotion(props.pack));
|
|
|
42
45
|
v-if="pack.credits !== void 0"
|
|
43
46
|
data-pricing="pack-credits"
|
|
44
47
|
>
|
|
45
|
-
{{ t("packCredits", { count: pack.credits }) }}
|
|
48
|
+
{{ t("packCredits", { count: pack.credits, unit: unit.word(meterUnit, pack.credits) }) }}
|
|
46
49
|
</p>
|
|
47
50
|
<p
|
|
48
51
|
v-if="pack.perCredit !== void 0"
|
|
49
52
|
data-pricing="pack-per-credit"
|
|
50
53
|
>
|
|
51
|
-
{{ t("perCredit", { price: pack.perCredit }) }}<span
|
|
54
|
+
{{ t("perCredit", { price: pack.perCredit, unit: unit.word(meterUnit, 1) }) }}<span
|
|
52
55
|
v-if="pack.lessPerCredit !== void 0"
|
|
53
56
|
data-pricing="pack-saving"
|
|
54
|
-
>{{ t("lessPerCredit", { percent: pack.lessPerCredit }) }}</span>
|
|
57
|
+
>{{ t("lessPerCredit", { percent: pack.lessPerCredit, unit: unit.word(meterUnit, 1) }) }}</span>
|
|
55
58
|
</p>
|
|
56
59
|
<p
|
|
57
60
|
v-if="pack.blurb"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { busyAttributes } from "../../a11y";
|
|
4
|
+
import { useMeterUnit } from "../../utils/meter-unit";
|
|
4
5
|
import { VNodes } from "../../utils/vnodes";
|
|
5
6
|
import { usePricingView } from "./pricing-table";
|
|
6
7
|
import PricingPromotion from "./PricingPromotion.vue";
|
|
@@ -17,6 +18,7 @@ const busy = computed(() => props.pricing.pending.value === props.plan.key);
|
|
|
17
18
|
const canceling = computed(() => props.plan.isCurrentPrice && view.context.value.billing.cancelAtPeriodEnd.value);
|
|
18
19
|
const period = computed(() => t(`period.${props.plan.interval}`));
|
|
19
20
|
const promotion = computed(() => view.planPromotion(props.plan));
|
|
21
|
+
const unit = useMeterUnit();
|
|
20
22
|
</script>
|
|
21
23
|
|
|
22
24
|
<template>
|
|
@@ -78,7 +80,7 @@ const promotion = computed(() => view.planPromotion(props.plan));
|
|
|
78
80
|
data-pricing="plan-feature"
|
|
79
81
|
data-feature="credits"
|
|
80
82
|
>
|
|
81
|
-
{{ t(`credits.${plan.interval}`, { count: plan.credits.units }) }}
|
|
83
|
+
{{ t(`credits.${plan.interval}`, { count: plan.credits.units, unit: unit.word(plan.credits.unit, plan.credits.units) }) }}
|
|
82
84
|
</li>
|
|
83
85
|
<li
|
|
84
86
|
v-for="feature in plan.features ?? []"
|
|
@@ -41,18 +41,18 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
41
41
|
error: (_message: string) => void;
|
|
42
42
|
canceled: () => void;
|
|
43
43
|
checkout: (_url: string) => void;
|
|
44
|
-
"topped-up": (_key: string) => void;
|
|
45
44
|
"update:interval": (_interval: import("../../../../convex/catalog.js").CatalogInterval) => void;
|
|
46
45
|
"plan-changed": (_key: string) => void;
|
|
47
46
|
uncanceled: () => void;
|
|
47
|
+
"topped-up": (_key: string) => void;
|
|
48
48
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
49
49
|
onError?: ((_message: string) => any) | undefined;
|
|
50
50
|
onCanceled?: (() => any) | undefined;
|
|
51
51
|
onCheckout?: ((_url: string) => any) | undefined;
|
|
52
|
-
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
53
52
|
"onUpdate:interval"?: ((_interval: import("../../../../convex/catalog.js").CatalogInterval) => any) | undefined;
|
|
54
53
|
"onPlan-changed"?: ((_key: string) => any) | undefined;
|
|
55
54
|
onUncanceled?: (() => any) | undefined;
|
|
55
|
+
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
56
56
|
}>, {
|
|
57
57
|
redirect: boolean;
|
|
58
58
|
title: string;
|
|
@@ -15,6 +15,7 @@ import { useAuthSession } from "../../utils/auth-session";
|
|
|
15
15
|
import { getBackendError } from "../../utils/backend-error";
|
|
16
16
|
import { createCancelConfirm } from "../../utils/cancel-confirm";
|
|
17
17
|
import { returnFocus } from "../../utils/focus-return";
|
|
18
|
+
import { useMeterUnit } from "../../utils/meter-unit";
|
|
18
19
|
import { pricingBindings, shownInterval } from "../../utils/pricing-bindings";
|
|
19
20
|
import { providePricingView } from "./pricing-table";
|
|
20
21
|
defineOptions({ name: "PricingTable" });
|
|
@@ -51,6 +52,7 @@ const { isAuthenticated } = useAuthSession();
|
|
|
51
52
|
const config = useBackendConfig();
|
|
52
53
|
const labels = useLabels("pricing", () => props.labels);
|
|
53
54
|
const { t, locale } = labels;
|
|
55
|
+
const unit = useMeterUnit();
|
|
54
56
|
const login = useBackendPagePath("login");
|
|
55
57
|
const uid = useId();
|
|
56
58
|
const pending = ref(null);
|
|
@@ -469,7 +471,7 @@ const statusText = computed(() => progress.value?.() ?? (billing.isFinishingChec
|
|
|
469
471
|
data-pricing="managed"
|
|
470
472
|
role="note"
|
|
471
473
|
>
|
|
472
|
-
{{ t("managed") }}
|
|
474
|
+
{{ t("managed", { unit: unit.word(credits.unit.value ?? resolvedPacks[0]?.offer.credits?.unit) }) }}
|
|
473
475
|
</p>
|
|
474
476
|
<template v-if="showPacks && resolvedPacks.length > 0">
|
|
475
477
|
<slot
|
|
@@ -41,18 +41,18 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
41
41
|
error: (_message: string) => void;
|
|
42
42
|
canceled: () => void;
|
|
43
43
|
checkout: (_url: string) => void;
|
|
44
|
-
"topped-up": (_key: string) => void;
|
|
45
44
|
"update:interval": (_interval: import("../../../../convex/catalog.js").CatalogInterval) => void;
|
|
46
45
|
"plan-changed": (_key: string) => void;
|
|
47
46
|
uncanceled: () => void;
|
|
47
|
+
"topped-up": (_key: string) => void;
|
|
48
48
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
49
49
|
onError?: ((_message: string) => any) | undefined;
|
|
50
50
|
onCanceled?: (() => any) | undefined;
|
|
51
51
|
onCheckout?: ((_url: string) => any) | undefined;
|
|
52
|
-
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
53
52
|
"onUpdate:interval"?: ((_interval: import("../../../../convex/catalog.js").CatalogInterval) => any) | undefined;
|
|
54
53
|
"onPlan-changed"?: ((_key: string) => any) | undefined;
|
|
55
54
|
onUncanceled?: (() => any) | undefined;
|
|
55
|
+
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
56
56
|
}>, {
|
|
57
57
|
redirect: boolean;
|
|
58
58
|
title: string;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { formatBillingDate } from "../../composables/billing-format";
|
|
3
3
|
import { useLabels } from "../../composables/use-labels";
|
|
4
|
+
import { useMeterUnit } from "../../utils/meter-unit";
|
|
4
5
|
import { useUsageLabels } from "./usage-history";
|
|
5
6
|
defineOptions({ name: "UsageHistoryEvent" });
|
|
6
7
|
defineProps({
|
|
7
8
|
event: { type: Object, required: true }
|
|
8
9
|
});
|
|
9
10
|
const { t, locale } = useUsageLabels() ?? useLabels("usage");
|
|
11
|
+
const unit = useMeterUnit();
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
14
|
<template>
|
|
@@ -17,6 +19,6 @@ const { t, locale } = useUsageLabels() ?? useLabels("usage");
|
|
|
17
19
|
<span
|
|
18
20
|
v-if="typeof event.units === 'number'"
|
|
19
21
|
data-usage="event-units"
|
|
20
|
-
>{{ t("units", { count: event.units }) }}</span>
|
|
22
|
+
>{{ t("units", { count: event.units, unit: unit.word(event.unit, event.units) }) }}</span>
|
|
21
23
|
</article>
|
|
22
24
|
</template>
|
|
@@ -6,8 +6,12 @@ import { type BackendLabels, type LabelOverrides, type UseLabelsReturn } from '.
|
|
|
6
6
|
* asks them: the ones a save offer most often answers first.
|
|
7
7
|
*/
|
|
8
8
|
export declare const CANCELLATION_REASONS: readonly CancellationReason[];
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Where `<CancelFlow>` stands: the optional question, the one offer, the
|
|
11
|
+
* confirmation (when no offer can stand, so "Cancel my plan" ends the plan),
|
|
12
|
+
* the end, or the plan kept.
|
|
13
|
+
*/
|
|
14
|
+
export type CancelFlowStep = 'question' | 'offer' | 'confirm' | 'ended' | 'kept';
|
|
11
15
|
/** What `<CancelFlow>` is told by its owner. */
|
|
12
16
|
export interface CancelFlowOptions {
|
|
13
17
|
/** Copy for this flow, over `appConfig.backend.labels.cancelFlow`. */
|
|
@@ -23,10 +27,12 @@ export interface CancelFlowOptions {
|
|
|
23
27
|
}
|
|
24
28
|
/** `<CancelFlow>`'s slots: each step, handed the flow. */
|
|
25
29
|
export interface CancelFlowSlots {
|
|
26
|
-
/** The optional question: the reasons, the comment and "Continue". */
|
|
30
|
+
/** The optional question: the reasons, the comment and "Continue" (or "Cancel my plan", when no offer can stand). */
|
|
27
31
|
question: (flow: UseCancelFlowReturn) => unknown;
|
|
28
32
|
/** The one offer and the button that accepts it. */
|
|
29
33
|
offer: (flow: UseCancelFlowReturn) => unknown;
|
|
34
|
+
/** What cancelling ends, the button that confirms it and "Back". */
|
|
35
|
+
confirm: (flow: UseCancelFlowReturn) => unknown;
|
|
30
36
|
/** The end: when the plan ends and "Keep my plan", or that it stays. */
|
|
31
37
|
end: (flow: UseCancelFlowReturn) => unknown;
|
|
32
38
|
}
|
|
@@ -40,6 +46,17 @@ export interface UseCancelFlowReturn {
|
|
|
40
46
|
comment: Ref<string>;
|
|
41
47
|
/** The offer the server made for the reason, once it made one. */
|
|
42
48
|
offer: Ref<SaveOffer | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a save offer can stand for the reason picked (`getCancelFlow`),
|
|
51
|
+
* so the question's button reads "Continue". `false` inside the
|
|
52
|
+
* withdrawal period, on a past-due plan or a trial, after an offer in the
|
|
53
|
+
* last 12 months, with none configured for the reason, or with no reason
|
|
54
|
+
* picked: the button then
|
|
55
|
+
* reads "Cancel my plan", carries `data-intent="cancel"`, and `submit`
|
|
56
|
+
* asks to confirm first. `true` until the read lands, and with a backend
|
|
57
|
+
* that does not export `getCancelFlow`.
|
|
58
|
+
*/
|
|
59
|
+
offers: ComputedRef<boolean>;
|
|
43
60
|
/** When the plan ends, epoch ms, once it is canceled (`null` when the server did not say). */
|
|
44
61
|
endsAt: Ref<number | null>;
|
|
45
62
|
/** Which action runs: `continue`, `cancel`, `accept` or `keep`. */
|
|
@@ -57,10 +74,12 @@ export interface UseCancelFlowReturn {
|
|
|
57
74
|
acceptText: ComputedRef<string>;
|
|
58
75
|
/** When the plan ends, in the reader's words. */
|
|
59
76
|
endText: ComputedRef<string>;
|
|
60
|
-
/** Answer the question (or skip it): the server answers with an offer, or cancels. */
|
|
77
|
+
/** Answer the question (or skip it): the server answers with an offer, or cancels; with `offers` false, the confirmation first. */
|
|
61
78
|
submit: () => Promise<void>;
|
|
62
|
-
/** "Cancel my plan",
|
|
79
|
+
/** "Cancel my plan", beside the question and the offer, and the confirmation's own button: cancels at once, past any offer. */
|
|
63
80
|
cancelNow: () => Promise<void>;
|
|
81
|
+
/** Back from the confirmation to the question. */
|
|
82
|
+
back: () => void;
|
|
64
83
|
/** Accept the offer the server made. */
|
|
65
84
|
accept: () => Promise<void>;
|
|
66
85
|
/** Undo the cancellation before the plan ends: "Keep my plan". */
|
|
@@ -75,7 +94,9 @@ export interface UseCancelFlowReturn {
|
|
|
75
94
|
/**
|
|
76
95
|
* The headless cancel flow `<CancelFlow>` renders: one optional question,
|
|
77
96
|
* then at most one offer, then the end, with "Cancel my plan" on every
|
|
78
|
-
* screen.
|
|
79
|
-
*
|
|
97
|
+
* screen. When no offer can stand, the question's button is "Cancel my
|
|
98
|
+
* plan" itself, and a confirmation comes before the plan ends. Every rule
|
|
99
|
+
* that keeps an offer lawful is the server's (`useBilling().cancel`, read
|
|
100
|
+
* ahead by `getCancelFlow`): this only shows what it answered.
|
|
80
101
|
*/
|
|
81
102
|
export declare function useCancelFlow(options?: CancelFlowOptions): UseCancelFlowReturn;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { computed, nextTick, ref, useId } from "vue";
|
|
1
|
+
import { computed, inject, nextTick, ref, useId } from "vue";
|
|
2
|
+
import { ConvexAuthStateKey } from "nuxt-convex-module/client";
|
|
2
3
|
import { busyAttributes } from "../../a11y.js";
|
|
3
4
|
import { useBilling } from "../../composables/use-billing.js";
|
|
4
5
|
import { refusalText, useLabels } from "../../composables/use-labels.js";
|
|
6
|
+
import { useLiveQuery } from "../../utils/live-query.js";
|
|
7
|
+
import { useBackendNamespace } from "../../utils/namespace.js";
|
|
5
8
|
export const CANCELLATION_REASONS = ["too_expensive", "unused", "missing_features", "switched_service", "too_complex", "low_quality", "customer_service", "other"];
|
|
6
9
|
function money(amount, currency, locale) {
|
|
7
10
|
return new Intl.NumberFormat(locale, { style: "currency", currency: currency.toUpperCase() }).format(amount / 100);
|
|
8
11
|
}
|
|
9
12
|
export function useCancelFlow(options = {}) {
|
|
10
13
|
const billing = useBilling();
|
|
14
|
+
const api = useBackendNamespace("billing", "CancelFlow");
|
|
15
|
+
const auth = inject(ConvexAuthStateKey, null);
|
|
16
|
+
const signedOut = computed(() => auth != null && !auth.isAuthenticated.value);
|
|
17
|
+
const read = api.getCancelFlow ? useLiveQuery(api.getCancelFlow, () => signedOut.value ? "skip" : { subscriptionId: options.subscriptionId?.() }) : null;
|
|
11
18
|
const labels = useLabels("cancelFlow", () => options.labels?.());
|
|
12
19
|
const { t, locale } = labels;
|
|
13
20
|
const base = useId();
|
|
@@ -50,6 +57,11 @@ export function useCancelFlow(options = {}) {
|
|
|
50
57
|
await nextTick();
|
|
51
58
|
options.onCanceled?.(outcome.endsAt);
|
|
52
59
|
};
|
|
60
|
+
const offers = computed(() => {
|
|
61
|
+
const state = read?.data.value;
|
|
62
|
+
if (!state || read?.error.value) return true;
|
|
63
|
+
return reason.value === void 0 ? false : state.reasons.includes(reason.value);
|
|
64
|
+
});
|
|
53
65
|
const offerText = computed(() => {
|
|
54
66
|
const current = offer.value;
|
|
55
67
|
if (!current) return "";
|
|
@@ -71,6 +83,7 @@ export function useCancelFlow(options = {}) {
|
|
|
71
83
|
reason,
|
|
72
84
|
comment,
|
|
73
85
|
offer,
|
|
86
|
+
offers,
|
|
74
87
|
endsAt,
|
|
75
88
|
running,
|
|
76
89
|
error,
|
|
@@ -78,8 +91,18 @@ export function useCancelFlow(options = {}) {
|
|
|
78
91
|
offerText,
|
|
79
92
|
acceptText,
|
|
80
93
|
endText: computed(() => endsAt.value === null ? t("endsPeriod") : t("endsOn", { date: date(endsAt.value) })),
|
|
81
|
-
submit:
|
|
94
|
+
submit: async () => {
|
|
95
|
+
if (offers.value) return run("continue", () => send(false));
|
|
96
|
+
if (running.value) return;
|
|
97
|
+
error.value = null;
|
|
98
|
+
step.value = "confirm";
|
|
99
|
+
},
|
|
82
100
|
cancelNow: () => run("cancel", () => send(true)),
|
|
101
|
+
back: () => {
|
|
102
|
+
if (running.value) return;
|
|
103
|
+
error.value = null;
|
|
104
|
+
step.value = "question";
|
|
105
|
+
},
|
|
83
106
|
accept: () => run("accept", async () => {
|
|
84
107
|
await billing.acceptOffer(offer.value);
|
|
85
108
|
step.value = "kept";
|
|
@@ -10,6 +10,7 @@ import { useCredits } from "../../composables/use-credits";
|
|
|
10
10
|
import { refusalText, useLabels } from "../../composables/use-labels";
|
|
11
11
|
import { usePricing } from "../../composables/use-pricing";
|
|
12
12
|
import { holdsFocus, returnFocus } from "../../utils/focus-return";
|
|
13
|
+
import { useMeterUnit } from "../../utils/meter-unit";
|
|
13
14
|
import { VNodes } from "../../utils/vnodes";
|
|
14
15
|
import { turnedOff } from "./notices";
|
|
15
16
|
defineOptions({ name: "NoticeLowCredits" });
|
|
@@ -35,6 +36,7 @@ const billing = useBilling();
|
|
|
35
36
|
const config = useBackendConfig();
|
|
36
37
|
const labels = useLabels("credits");
|
|
37
38
|
const { t, rich } = labels;
|
|
39
|
+
const unit = useMeterUnit();
|
|
38
40
|
const pricingPath = useBackendPagePath("pricing");
|
|
39
41
|
const dismissed = ref(false);
|
|
40
42
|
const pending = ref(false);
|
|
@@ -81,7 +83,7 @@ const context = computed(() => {
|
|
|
81
83
|
if (!confirmed.value || balance === void 0 || dismissed.value || !isShort(balance)) return null;
|
|
82
84
|
return { credits, balance, threshold: threshold.value, pricingPath: pricingPath.value ?? "", preselected: preselected.value, pending: pending.value, topUp, dismiss };
|
|
83
85
|
});
|
|
84
|
-
const message = computed(() => context.value ? rich("low", { balance: h("span", { "data-credits": "balance" }, String(context.value.balance)), count: context.value.balance }) : []);
|
|
86
|
+
const message = computed(() => context.value ? rich("low", { balance: h("span", { "data-credits": "balance" }, String(context.value.balance)), count: context.value.balance, unit: unit.word(credits.unit.value, context.value.balance) }) : []);
|
|
85
87
|
</script>
|
|
86
88
|
|
|
87
89
|
<template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer theme, base, reset, nuxt-backend;@layer nuxt-backend{:root{--bk-accent:light-dark(#116632,#4ade80);--bk-on-accent:light-dark(#fff,#052912);--bk-ink:currentColor;--bk-muted:color-mix(in srgb,currentColor 55%,transparent);--bk-edge:color-mix(in srgb,currentColor 18%,transparent);--bk-surface:color-mix(in srgb,currentColor 5%,transparent);--bk-error:light-dark(#a1302d,#f87171);--bk-ok:light-dark(#116632,#4ade80);--bk-warn:light-dark(#6d5600,#facc15);--bk-radius:8px;--bk-radius-control:9999px}@media (color-gamut:p3){@supports (color:color(display-p3 0 0 0)){:root{--bk-accent:light-dark(color(display-p3 0.0431 0.4148 0.1546),color(display-p3 0.1468 0.9102 0.3985));--bk-ok:light-dark(color(display-p3 0.0431 0.4148 0.1546),color(display-p3 0.1468 0.9102 0.3985));--bk-warn:light-dark(color(display-p3 0.4201 0.3386 0.0346),color(display-p3 0.9683 0.8021 0.1389));--bk-error:light-dark(color(display-p3 0.6572 0.0638 0.0969),color(display-p3 0.9873 0.3890 0.3935))}}}@media (color-gamut:rec2020){@supports (color:color(rec2020 0 0 0)){:root{--bk-accent:light-dark(color(rec2020 0.0472 0.3714 0.0115),color(rec2020 0.1584 0.9331 0.0651));--bk-ok:light-dark(color(rec2020 0.0472 0.3714 0.0115),color(rec2020 0.1584 0.9331 0.0651));--bk-warn:light-dark(color(rec2020 0.3406 0.2817 0.0119),color(rec2020 0.9099 0.7830 0.0764));--bk-error:light-dark(color(rec2020 0.5544 0.0597 0.0131),color(rec2020 0.9849 0.2196 0.1954))}}}}@layer
|
|
1
|
+
@layer nuxt-backend-tokens, theme, base, reset, nuxt-backend;@layer nuxt-backend-tokens{:root{--bk-accent:light-dark(#116632,#4ade80);--bk-on-accent:light-dark(#fff,#052912);--bk-ink:currentColor;--bk-muted:color-mix(in srgb,currentColor 55%,transparent);--bk-edge:color-mix(in srgb,currentColor 18%,transparent);--bk-surface:color-mix(in srgb,currentColor 5%,transparent);--bk-error:light-dark(#a1302d,#f87171);--bk-ok:light-dark(#116632,#4ade80);--bk-warn:light-dark(#6d5600,#facc15);--bk-radius:8px;--bk-radius-control:9999px}@media (color-gamut:p3){@supports (color:color(display-p3 0 0 0)){:root{--bk-accent:light-dark(color(display-p3 0.0431 0.4148 0.1546),color(display-p3 0.1468 0.9102 0.3985));--bk-ok:light-dark(color(display-p3 0.0431 0.4148 0.1546),color(display-p3 0.1468 0.9102 0.3985));--bk-warn:light-dark(color(display-p3 0.4201 0.3386 0.0346),color(display-p3 0.9683 0.8021 0.1389));--bk-error:light-dark(color(display-p3 0.6572 0.0638 0.0969),color(display-p3 0.9873 0.3890 0.3935))}}}@media (color-gamut:rec2020){@supports (color:color(rec2020 0 0 0)){:root{--bk-accent:light-dark(color(rec2020 0.0472 0.3714 0.0115),color(rec2020 0.1584 0.9331 0.0651));--bk-ok:light-dark(color(rec2020 0.0472 0.3714 0.0115),color(rec2020 0.1584 0.9331 0.0651));--bk-warn:light-dark(color(rec2020 0.3406 0.2817 0.0119),color(rec2020 0.9099 0.7830 0.0764));--bk-error:light-dark(color(rec2020 0.5544 0.0597 0.0131),color(rec2020 0.9849 0.2196 0.1954))}}}}@layer nuxt-backend-tokens{:where(:root){--lightningcss-light:initial;--lightningcss-dark: }}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { busyAttributes } from "../../a11y";
|
|
3
|
+
import { useMeterUnit } from "../../utils/meter-unit";
|
|
3
4
|
import { useWorkspaceSettingsView } from "./workspace-settings";
|
|
4
5
|
defineOptions({ name: "WorkspaceCredits" });
|
|
5
|
-
defineProps({
|
|
6
|
+
const props = defineProps({
|
|
6
7
|
credits: { type: Object, required: true }
|
|
7
8
|
});
|
|
8
9
|
const view = useWorkspaceSettingsView("WorkspaceCredits");
|
|
9
10
|
const { t } = view.labels;
|
|
11
|
+
const unit = useMeterUnit();
|
|
12
|
+
const meterUnit = () => props.credits.unit.value;
|
|
10
13
|
const pending = (key) => view.context.value.pending === key;
|
|
11
14
|
</script>
|
|
12
15
|
|
|
@@ -16,10 +19,10 @@ const pending = (key) => view.context.value.pending === key;
|
|
|
16
19
|
:aria-busy="credits.isLoading.value ? 'true' : void 0"
|
|
17
20
|
>
|
|
18
21
|
<h3 data-settings="section-title">
|
|
19
|
-
{{ t("credits") }}
|
|
22
|
+
{{ t("credits", { unit: unit.title(meterUnit()) }) }}
|
|
20
23
|
</h3>
|
|
21
24
|
<p data-settings="balance">
|
|
22
|
-
{{ credits.balance.value === void 0 ? t("balanceUnknown") : t("balance", { count: credits.balance.value }) }}
|
|
25
|
+
{{ credits.balance.value === void 0 ? t("balanceUnknown", { unit: unit.word(meterUnit()) }) : t("balance", { count: credits.balance.value, unit: unit.word(meterUnit(), credits.balance.value) }) }}
|
|
23
26
|
</p>
|
|
24
27
|
<p data-settings="usage">
|
|
25
28
|
<span data-settings="credited">{{ t("credited", { count: credits.credited.value ?? "\u2014" }) }}</span>
|
|
@@ -12,21 +12,21 @@ type __VLS_Slots = WorkspaceSettingsSlots;
|
|
|
12
12
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
13
|
error: (_message: string) => void;
|
|
14
14
|
"workspace-created": (_workspace: Workspace) => void;
|
|
15
|
+
"topped-up": (_key: string) => void;
|
|
15
16
|
"plan-canceled": () => void;
|
|
16
17
|
"plan-uncanceled": () => void;
|
|
17
18
|
"plan-resumed": () => void;
|
|
18
19
|
"change-canceled": () => void;
|
|
19
20
|
"workspace-switched": (_id: string) => void;
|
|
20
|
-
"topped-up": (_key: string) => void;
|
|
21
21
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
22
|
onError?: ((_message: string) => any) | undefined;
|
|
23
23
|
"onWorkspace-created"?: ((_workspace: Workspace) => any) | undefined;
|
|
24
|
+
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
24
25
|
"onPlan-canceled"?: (() => any) | undefined;
|
|
25
26
|
"onPlan-uncanceled"?: (() => any) | undefined;
|
|
26
27
|
"onPlan-resumed"?: (() => any) | undefined;
|
|
27
28
|
"onChange-canceled"?: (() => any) | undefined;
|
|
28
29
|
"onWorkspace-switched"?: ((_id: string) => any) | undefined;
|
|
29
|
-
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
30
30
|
}>, {
|
|
31
31
|
labels: LabelOverrides<{
|
|
32
32
|
title: string;
|
|
@@ -12,21 +12,21 @@ type __VLS_Slots = WorkspaceSettingsSlots;
|
|
|
12
12
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
13
|
error: (_message: string) => void;
|
|
14
14
|
"workspace-created": (_workspace: Workspace) => void;
|
|
15
|
+
"topped-up": (_key: string) => void;
|
|
15
16
|
"plan-canceled": () => void;
|
|
16
17
|
"plan-uncanceled": () => void;
|
|
17
18
|
"plan-resumed": () => void;
|
|
18
19
|
"change-canceled": () => void;
|
|
19
20
|
"workspace-switched": (_id: string) => void;
|
|
20
|
-
"topped-up": (_key: string) => void;
|
|
21
21
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
22
|
onError?: ((_message: string) => any) | undefined;
|
|
23
23
|
"onWorkspace-created"?: ((_workspace: Workspace) => any) | undefined;
|
|
24
|
+
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
24
25
|
"onPlan-canceled"?: (() => any) | undefined;
|
|
25
26
|
"onPlan-uncanceled"?: (() => any) | undefined;
|
|
26
27
|
"onPlan-resumed"?: (() => any) | undefined;
|
|
27
28
|
"onChange-canceled"?: (() => any) | undefined;
|
|
28
29
|
"onWorkspace-switched"?: ((_id: string) => any) | undefined;
|
|
29
|
-
"onTopped-up"?: ((_key: string) => any) | undefined;
|
|
30
30
|
}>, {
|
|
31
31
|
labels: LabelOverrides<{
|
|
32
32
|
title: string;
|
|
@@ -19,6 +19,16 @@ export interface UseAuthReturn {
|
|
|
19
19
|
hasRole: (role: string | string[]) => boolean;
|
|
20
20
|
/** Whether someone is signed in, read from the base module's auth state. */
|
|
21
21
|
isSignedIn: ComputedRef<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a signed-in read can go: someone is signed in, and the backend
|
|
24
|
+
* connection holds their token. On every page load `isSignedIn` turns
|
|
25
|
+
* `true` a moment sooner, from the session, while the token is still on
|
|
26
|
+
* its way, and a query of a signed-in tier (`authed`, `workspace`,
|
|
27
|
+
* `admin`) started in that moment is refused `unauthenticated`. Skip
|
|
28
|
+
* such a query until this is `true`:
|
|
29
|
+
* `useQuery(api.strips.list, () => (isReady.value ? {} : 'skip'))`.
|
|
30
|
+
*/
|
|
31
|
+
isReady: ComputedRef<boolean>;
|
|
22
32
|
/** `true` while the session is still resolving. */
|
|
23
33
|
isLoading: ComputedRef<boolean>;
|
|
24
34
|
/**
|
|
@@ -44,7 +54,9 @@ export interface UseAuthReturn {
|
|
|
44
54
|
* @example
|
|
45
55
|
* ```vue
|
|
46
56
|
* <script setup lang="ts">
|
|
47
|
-
* const { user, isSignedIn, hasRole, signOut } = useAuth()
|
|
57
|
+
* const { user, isSignedIn, isReady, hasRole, signOut } = useAuth()
|
|
58
|
+
* // A read of your own signed-in functions waits for the backend to hold the token.
|
|
59
|
+
* const strips = useQuery(api.strips.list, () => (isReady.value ? {} : 'skip'))
|
|
48
60
|
* </script>
|
|
49
61
|
*
|
|
50
62
|
* <template>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
1
|
+
import { computed, inject } from "vue";
|
|
2
|
+
import { ConvexAuthStateKey } from "nuxt-convex-module/client";
|
|
2
3
|
import { useAuthSession } from "../utils/auth-session.js";
|
|
3
4
|
export function useAuth() {
|
|
4
5
|
const auth = useAuthSession();
|
|
6
|
+
const connection = inject(ConvexAuthStateKey, null);
|
|
5
7
|
return {
|
|
6
8
|
user: computed(() => auth.user.value),
|
|
7
9
|
session: computed(() => auth.session.value.data?.session ?? null),
|
|
8
10
|
role: auth.role,
|
|
9
11
|
hasRole: auth.hasRole,
|
|
10
12
|
isSignedIn: auth.isAuthenticated,
|
|
13
|
+
isReady: computed(() => auth.isAuthenticated.value && (connection ? connection.isAuthenticated.value : !auth.isLoading.value)),
|
|
11
14
|
isLoading: auth.isLoading,
|
|
12
15
|
impersonating: auth.isImpersonating,
|
|
13
16
|
signOut: auth.signOut
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { FunctionReference } from 'convex/server';
|
|
2
2
|
import { type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue';
|
|
3
3
|
import type { BackendError } from '../utils/backend-error.js';
|
|
4
|
+
import type { MeterUnit } from '../../../convex/catalog.js';
|
|
4
5
|
import type { QuotaUsage } from '../../../convex/integrations/billing/types/records.js';
|
|
5
|
-
import type { CancelOutcome, SaveOffer, WithdrawalPeriod } from '../../../convex/integrations/billing/types/lifecycle.js';
|
|
6
|
-
export type { CancelOutcome, SaveOffer, WithdrawalPeriod };
|
|
6
|
+
import type { CancelFlowState, CancelOutcome, SaveOffer, WithdrawalPeriod } from '../../../convex/integrations/billing/types/lifecycle.js';
|
|
7
|
+
export type { CancelFlowState, CancelOutcome, SaveOffer, WithdrawalPeriod };
|
|
7
8
|
export { formatBillingAmount, toBillingDate } from './billing-format.js';
|
|
8
9
|
export { createCheckout, createProviderPager } from './billing-provider.js';
|
|
9
10
|
/** A billing-provider product (loose — the provider owns the full shape; cast as needed). */
|
|
@@ -69,6 +70,8 @@ export type UsageEvent = {
|
|
|
69
70
|
/** The ingested event name (the one the meter filters on). */
|
|
70
71
|
name: string;
|
|
71
72
|
units?: number;
|
|
73
|
+
/** What the meter counts, beside `units` when the catalog names its unit. */
|
|
74
|
+
unit?: MeterUnit;
|
|
72
75
|
metadata?: Record<string, string | number | boolean>;
|
|
73
76
|
} & Record<string, unknown>;
|
|
74
77
|
/**
|
|
@@ -145,6 +148,8 @@ export interface EntitlementMeter {
|
|
|
145
148
|
meterId: string;
|
|
146
149
|
/** The configured friendly name (`setupBilling({ credits })` / catalog key). */
|
|
147
150
|
name?: string;
|
|
151
|
+
/** What the meter counts, when the catalog names its unit (`meters.<key>.unit`). */
|
|
152
|
+
unit?: MeterUnit;
|
|
148
153
|
consumedUnits: number;
|
|
149
154
|
creditedUnits: number;
|
|
150
155
|
balance: number;
|
|
@@ -270,6 +275,9 @@ export interface BillingApi {
|
|
|
270
275
|
comment?: string;
|
|
271
276
|
offer?: false;
|
|
272
277
|
}, CancelOutcome | null>;
|
|
278
|
+
getCancelFlow?: FunctionReference<'query', 'public', {
|
|
279
|
+
subscriptionId?: string;
|
|
280
|
+
}, CancelFlowState | null>;
|
|
273
281
|
acceptSaveOffer?: FunctionReference<'action', 'public', {
|
|
274
282
|
offerId: string;
|
|
275
283
|
}, null>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { MeterUnit } from '../../../convex/catalog.js';
|
|
2
3
|
import type { BackendError } from '../utils/backend-error.js';
|
|
3
4
|
import { type BillingApi, type CheckoutOptions } from './use-billing.js';
|
|
4
5
|
/** The billing period a meter's credited units belong to. */
|
|
@@ -52,6 +53,8 @@ export interface UseCreditsReturn {
|
|
|
52
53
|
expiresAtCycleEnd: ComputedRef<boolean | undefined>;
|
|
53
54
|
/** The resolved meter id (the one read above) — pass it to your server-side spend. */
|
|
54
55
|
meterId: ComputedRef<string | undefined>;
|
|
56
|
+
/** What the meter counts, as the catalog's `meters.<key>.unit` names it; `undefined` without one, or while loading (the packaged labels then say "credits"). */
|
|
57
|
+
unit: ComputedRef<MeterUnit | undefined>;
|
|
55
58
|
/** `true` until credit balances have loaded (`false` once the read failed). */
|
|
56
59
|
isLoading: ComputedRef<boolean>;
|
|
57
60
|
/** `true` while `topUp` or `refresh` runs. */
|
|
@@ -55,6 +55,7 @@ export function useCredits(options = {}) {
|
|
|
55
55
|
return m?.rollover === false && m.cycleEnd !== void 0;
|
|
56
56
|
}),
|
|
57
57
|
meterId: computed(() => meter.value?.meterId),
|
|
58
|
+
unit: computed(() => meter.value?.unit),
|
|
58
59
|
isLoading: read.isLoading,
|
|
59
60
|
isPending,
|
|
60
61
|
error: computed(() => failure.value ?? read.error.value),
|
|
@@ -28,6 +28,8 @@ export interface NotificationItem {
|
|
|
28
28
|
id: string;
|
|
29
29
|
name: string | null;
|
|
30
30
|
} | null;
|
|
31
|
+
/** Whose plan, credits or gift a billing kind is about: `account` the reader's own, `workspace` the one named; `null` for any other kind. */
|
|
32
|
+
entity: NotificationEntry['entity'];
|
|
31
33
|
/** The kind's own fields. */
|
|
32
34
|
data: NotificationEntry['data'];
|
|
33
35
|
}
|
|
@@ -90,7 +92,9 @@ export interface UseNotificationsReturn {
|
|
|
90
92
|
* with `loadMore`, with the unread count and the actions that mark them
|
|
91
93
|
* read. The words are labels, so each item reads in the active language
|
|
92
94
|
* (`backend.notifications.<kind>.title` and `.body`, the package's for its
|
|
93
|
-
* own kinds and yours for the kinds of your own).
|
|
95
|
+
* own kinds and yours for the kinds of your own). A billing kind about the
|
|
96
|
+
* reader's own account (`billTo: 'user'`) reads `.titleYours` and
|
|
97
|
+
* `.bodyYours` where the kind has them.
|
|
94
98
|
*
|
|
95
99
|
* @example
|
|
96
100
|
* ```vue
|