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
|
@@ -35,6 +35,18 @@ export type NotificationAudience = 'subject' | 'inviter' | 'entity'
|
|
|
35
35
|
/** The ready-made page a notification links to, resolved by `pages.<key>` in the app's config. */
|
|
36
36
|
export type NotificationDestination = 'profile' | 'security' | 'settings'
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* The billing feature a kind comes from, which an app may never use:
|
|
40
|
+
* - `gifts`: a gift someone bought (a credit pack, or a plan as a pass);
|
|
41
|
+
* - `passes`: a plan pass, gifted, a reverse trial's or a referral reward's;
|
|
42
|
+
* - `trialPasses`: a reverse trial (a catalog plan's `trial: { pass: true }`);
|
|
43
|
+
* - `referrals`: the referral program (`setupReferrals`).
|
|
44
|
+
*/
|
|
45
|
+
export type NotificationFeature = 'gifts' | 'passes' | 'trialPasses' | 'referrals'
|
|
46
|
+
|
|
47
|
+
/** Which billing features a deployment has used, as the channel list reads them. */
|
|
48
|
+
export type NotificationFeatures = Record<NotificationFeature, boolean>
|
|
49
|
+
|
|
38
50
|
/** What one kind of the package's catalog does as a notification. */
|
|
39
51
|
export interface NotificationKind {
|
|
40
52
|
audience: NotificationAudience
|
|
@@ -42,12 +54,16 @@ export interface NotificationKind {
|
|
|
42
54
|
page: NotificationDestination
|
|
43
55
|
/** Nobody hears of what they did themselves (a role they changed, a plan they switched). */
|
|
44
56
|
skipSelf?: true
|
|
57
|
+
/** News about the account's own safety or money: its email and push skip the weekly cap and the quiet hours ({@link NotifyKind.transactional}). */
|
|
58
|
+
transactional?: true
|
|
59
|
+
/** The billing feature that records it: the channel list leaves the kind out while the deployment has never used it. */
|
|
60
|
+
feature?: NotificationFeature
|
|
45
61
|
}
|
|
46
62
|
|
|
47
63
|
/** The kinds of the catalog that declare the `in-app` channel. */
|
|
48
64
|
type InAppKind = { [K in BackendEventType]: 'in-app' extends (typeof BACKEND_EVENTS)[K]['channels'][number] ? K : never }[BackendEventType]
|
|
49
65
|
|
|
50
|
-
const SUBJECT_SECURITY = { audience: 'subject', page: 'security' } as const
|
|
66
|
+
const SUBJECT_SECURITY = { audience: 'subject', page: 'security', transactional: true } as const
|
|
51
67
|
const BILLING_ENTITY = { audience: 'entity', page: 'settings' } as const
|
|
52
68
|
|
|
53
69
|
/**
|
|
@@ -70,25 +86,74 @@ export const NOTIFICATION_KINDS = {
|
|
|
70
86
|
'billing.subscription_created': BILLING_ENTITY,
|
|
71
87
|
'billing.subscription_canceled': BILLING_ENTITY,
|
|
72
88
|
'billing.subscription_revoked': BILLING_ENTITY,
|
|
73
|
-
'billing.subscription_past_due': BILLING_ENTITY,
|
|
74
|
-
'billing.order_paid': BILLING_ENTITY,
|
|
75
|
-
'billing.order_refunded': BILLING_ENTITY,
|
|
89
|
+
'billing.subscription_past_due': { ...BILLING_ENTITY, transactional: true },
|
|
90
|
+
'billing.order_paid': { ...BILLING_ENTITY, transactional: true },
|
|
91
|
+
'billing.order_refunded': { ...BILLING_ENTITY, transactional: true },
|
|
76
92
|
'billing.credits_low': BILLING_ENTITY,
|
|
77
93
|
'billing.credits_exhausted': BILLING_ENTITY,
|
|
78
94
|
'billing.save_offer_accepted': { ...BILLING_ENTITY, skipSelf: true },
|
|
79
95
|
'billing.contract_withdrawn': { ...BILLING_ENTITY, skipSelf: true },
|
|
80
|
-
'billing.trial_pass_started': BILLING_ENTITY,
|
|
81
|
-
'gift.purchased': BILLING_ENTITY,
|
|
82
|
-
'gift.claimed': BILLING_ENTITY,
|
|
83
|
-
'gift.pass_started': BILLING_ENTITY,
|
|
84
|
-
'gift.pass_ending': BILLING_ENTITY,
|
|
85
|
-
'gift.pass_ended': BILLING_ENTITY,
|
|
86
|
-
'gift.refunded': BILLING_ENTITY,
|
|
87
|
-
'referral.claimed': BILLING_ENTITY,
|
|
88
|
-
'referral.rewarded': BILLING_ENTITY,
|
|
96
|
+
'billing.trial_pass_started': { ...BILLING_ENTITY, feature: 'trialPasses' },
|
|
97
|
+
'gift.purchased': { ...BILLING_ENTITY, feature: 'gifts' },
|
|
98
|
+
'gift.claimed': { ...BILLING_ENTITY, feature: 'gifts' },
|
|
99
|
+
'gift.pass_started': { ...BILLING_ENTITY, feature: 'gifts' },
|
|
100
|
+
'gift.pass_ending': { ...BILLING_ENTITY, feature: 'passes' },
|
|
101
|
+
'gift.pass_ended': { ...BILLING_ENTITY, feature: 'passes' },
|
|
102
|
+
'gift.refunded': { ...BILLING_ENTITY, feature: 'gifts' },
|
|
103
|
+
'referral.claimed': { ...BILLING_ENTITY, feature: 'referrals' },
|
|
104
|
+
'referral.rewarded': { ...BILLING_ENTITY, feature: 'referrals' },
|
|
89
105
|
'email.bounced': { audience: 'subject', page: 'profile' },
|
|
90
106
|
} as const satisfies Record<InAppKind, NotificationKind>
|
|
91
107
|
|
|
108
|
+
/** A kind of the package's catalog that notifies, by its event type (`billing.order_paid`). */
|
|
109
|
+
export type NotificationType = keyof typeof NOTIFICATION_KINDS
|
|
110
|
+
|
|
111
|
+
/** The policy of a package kind, or `undefined` for any other type. */
|
|
112
|
+
export function notificationKind(type: string): NotificationKind | undefined {
|
|
113
|
+
return Object.hasOwn(NOTIFICATION_KINDS, type) ? NOTIFICATION_KINDS[type as NotificationType] : undefined
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Whose plan, credits or gift a billing kind is about: `account` the
|
|
118
|
+
* reader's own (`billTo: 'user'`, where the person is the billing entity),
|
|
119
|
+
* `workspace` one they manage.
|
|
120
|
+
*/
|
|
121
|
+
export type NotificationEntity = 'account' | 'workspace'
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The billing entity a notification is about, from its row: a kind told to
|
|
125
|
+
* a billing entity (audience `entity`) names the workspace when the entity
|
|
126
|
+
* is one, and none when it is the account itself, which billing records as
|
|
127
|
+
* the event's subject instead. `null` for every other kind.
|
|
128
|
+
*/
|
|
129
|
+
export function notificationEntity(type: string, workspaceId: string | null | undefined): NotificationEntity | null {
|
|
130
|
+
if (notificationKind(type)?.audience !== 'entity') return null
|
|
131
|
+
return workspaceId ? 'workspace' : 'account'
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The label keys of one part of a kind's words, in the order they are
|
|
136
|
+
* tried: for the person's own account, the words written for it
|
|
137
|
+
* (`titleYours`, `bodyYours`) before the ones about a workspace, which a
|
|
138
|
+
* part with no workspace in it keeps for both.
|
|
139
|
+
*/
|
|
140
|
+
export function notificationWordKeys(part: 'title' | 'body', entity: NotificationEntity | null): string[] {
|
|
141
|
+
return entity === 'account' ? [`${part}Yours`, part] : [part]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Whether a kind is on the channel list: an app's own always is; a package
|
|
146
|
+
* kind when the app's `kinds` lists it, or, without that list, unless it
|
|
147
|
+
* comes from a billing feature the deployment has never used
|
|
148
|
+
* ({@link NotificationKind.feature}).
|
|
149
|
+
*/
|
|
150
|
+
export function listedKind(type: string, kinds: ReadonlySet<string> | null, features: NotificationFeatures | null): boolean {
|
|
151
|
+
const kind = notificationKind(type)
|
|
152
|
+
if (!kind) return true
|
|
153
|
+
if (kinds) return kinds.has(type)
|
|
154
|
+
return !kind.feature || !features || features[kind.feature]
|
|
155
|
+
}
|
|
156
|
+
|
|
92
157
|
/** The most people one event notifies: a workspace's owners and admins, up to this many. */
|
|
93
158
|
export const NOTIFICATION_RECIPIENTS_MAX = 25
|
|
94
159
|
|
|
@@ -168,6 +233,15 @@ export interface NotifyKind {
|
|
|
168
233
|
channels: readonly NotificationChannel[]
|
|
169
234
|
/** Where the notification links, from the event; a path of the app. Left out, it links nowhere. */
|
|
170
235
|
link?: (event: NotifyEvent) => string | null | undefined
|
|
236
|
+
/**
|
|
237
|
+
* News the person is waiting for (a print they ordered is ready, a job of
|
|
238
|
+
* theirs failed): its email and push skip the weekly cap and the quiet
|
|
239
|
+
* hours, and its email does not count toward the cap, as a transactional
|
|
240
|
+
* email does not. The person's choice of channels still holds, and so
|
|
241
|
+
* does the email provider's suppression list. Leave it off for anything a person
|
|
242
|
+
* could read tomorrow.
|
|
243
|
+
*/
|
|
244
|
+
transactional?: boolean
|
|
171
245
|
}
|
|
172
246
|
|
|
173
247
|
/** The events of an app's own that notify: each type under `app.`, with what it becomes. */
|
|
@@ -179,6 +253,17 @@ export interface NotificationPlan {
|
|
|
179
253
|
link?: string
|
|
180
254
|
}
|
|
181
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Whether a kind's email and push skip the weekly cap and the quiet hours:
|
|
258
|
+
* a package kind by its row ({@link NOTIFICATION_KINDS}), one of the app's
|
|
259
|
+
* own by its `notify` entry.
|
|
260
|
+
*/
|
|
261
|
+
export function isTransactional(notify: NotifyOptions, type: string): boolean {
|
|
262
|
+
const kind = notificationKind(type)
|
|
263
|
+
if (kind) return kind.transactional === true
|
|
264
|
+
return Object.hasOwn(notify, type) && notify[type as `app.${string}`]!.transactional === true
|
|
265
|
+
}
|
|
266
|
+
|
|
182
267
|
/** The longest link a notification keeps. */
|
|
183
268
|
export const NOTIFICATION_LINK_MAX = 512
|
|
184
269
|
|
|
@@ -208,6 +293,7 @@ export function notifyProblem(notify: NotifyOptions): string | null {
|
|
|
208
293
|
if (kind.channels.length === 0 || kind.channels.some(channel => !NOTIFICATION_CHANNELS.includes(channel))) {
|
|
209
294
|
return `${type}: channels are ${NOTIFICATION_CHANNELS.map(channel => `\`${channel}\``).join(', ')}, and a kind uses at least one.`
|
|
210
295
|
}
|
|
296
|
+
if (kind.transactional !== undefined && typeof kind.transactional !== 'boolean') return `${type}: \`transactional\` is true or false.`
|
|
211
297
|
if (packageKeys.has(notificationLabelKey(type))) return `${type}: its words (\`${notificationLabelKey(type)}\`) would replace a package kind's. Name it otherwise.`
|
|
212
298
|
}
|
|
213
299
|
return null
|
package/src/convex/proof.ts
CHANGED
|
@@ -225,6 +225,49 @@ export function newVisitorId(): string {
|
|
|
225
225
|
*/
|
|
226
226
|
export const VISITOR_METHOD = 'VISITOR'
|
|
227
227
|
|
|
228
|
+
/**
|
|
229
|
+
* The header the app's server passes the client's address to the
|
|
230
|
+
* deployment in: `<address>;<proof>`, signed under the proof secret. The
|
|
231
|
+
* deployment sees only the app's server connect (its `x-forwarded-for` is
|
|
232
|
+
* the server's address, written by the platform), so without it every
|
|
233
|
+
* visitor through the app's server would share one address.
|
|
234
|
+
*/
|
|
235
|
+
export const CLIENT_ADDRESS_HEADER = 'x-backend-client'
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The header Better Auth reads the client's address from first
|
|
239
|
+
* (`advanced.ipAddress.ipAddressHeaders`): set by the deployment itself,
|
|
240
|
+
* from a {@link CLIENT_ADDRESS_HEADER} whose proof holds, and taken off
|
|
241
|
+
* every request that arrives with one.
|
|
242
|
+
*/
|
|
243
|
+
export const CLIENT_IP_HEADER = 'x-backend-client-ip'
|
|
244
|
+
|
|
245
|
+
/** The method a client address is signed with, so no other proof passes for one. */
|
|
246
|
+
export const CLIENT_METHOD = 'CLIENT'
|
|
247
|
+
|
|
248
|
+
/** An IPv4 or IPv6 address as a header carries it: nothing a list or a second value could hide in. */
|
|
249
|
+
const ADDRESS_FORMAT = /^[\da-f.:]{2,45}$/i
|
|
250
|
+
|
|
251
|
+
/** Sign the client's address for one deployment: the {@link CLIENT_ADDRESS_HEADER} value. */
|
|
252
|
+
export async function signClientAddress(secret: string, address: string, audience: string, now?: number): Promise<string> {
|
|
253
|
+
const proof = await signProof(secret, { method: CLIENT_METHOD, path: CLIENT_METHOD, audience, subject: address, ...(now === undefined ? {} : { now }) })
|
|
254
|
+
return `${address};${proof}`
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The address a {@link CLIENT_ADDRESS_HEADER} value names, when its proof
|
|
259
|
+
* holds under `secret` for this deployment and is fresh; `null` for one
|
|
260
|
+
* that is missing, malformed, stale or signed for another deployment.
|
|
261
|
+
*/
|
|
262
|
+
export async function readClientAddress(secret: string, value: string | null | undefined, audience: string, now?: number): Promise<string | null> {
|
|
263
|
+
const at = value?.indexOf(';') ?? -1
|
|
264
|
+
if (!value || at === -1) return null
|
|
265
|
+
const address = value.slice(0, at)
|
|
266
|
+
if (!ADDRESS_FORMAT.test(address)) return null
|
|
267
|
+
const check = await verifyProof(secret, value.slice(at + 1), { method: CLIENT_METHOD, path: CLIENT_METHOD, audience, subject: address, ...(now === undefined ? {} : { now }) })
|
|
268
|
+
return check.ok ? address : null
|
|
269
|
+
}
|
|
270
|
+
|
|
228
271
|
/** The visitor a proof is bound to, or `undefined` for a proof bound to a subject (or none). Says nothing of its signature. */
|
|
229
272
|
export function proofVisitor(proof: string): string | undefined {
|
|
230
273
|
return PROOF_FORMAT.exec(proof)?.[3]
|
|
@@ -22,8 +22,6 @@ export const REFERRAL_CLAIM_WINDOW_MS = DAY_MS
|
|
|
22
22
|
export const REFERRAL_BURST = { count: 5, windowMs: 60 * 60 * 1000 } as const
|
|
23
23
|
/** The most referrals a console read or an export lists. */
|
|
24
24
|
export const REFERRAL_ROWS = 200
|
|
25
|
-
/** The longest code a request may carry (a pasted link is cut to its code before this). */
|
|
26
|
-
export const REFERRAL_CODE_INPUT_MAX = 32
|
|
27
25
|
|
|
28
26
|
/** What the person referred gets: a catalog discount without a code, or trial days, on their first paid checkout. */
|
|
29
27
|
export type ReferredReward = { discount: string } | { trialDays: number }
|
|
@@ -30,9 +30,8 @@ export const WAITLIST_CONSOLE_ROWS = 200
|
|
|
30
30
|
/** How many of a status's oldest entries a filtered console read looks through. */
|
|
31
31
|
export const WAITLIST_FILTER_SCAN = 1000
|
|
32
32
|
|
|
33
|
-
// The
|
|
34
|
-
|
|
35
|
-
export { mailboxOf, newShareCode, normalizeShareCode } from './referral-rules.js'
|
|
33
|
+
// The mailbox rule is the referral program's, one for every sharer.
|
|
34
|
+
export { mailboxOf } from './referral-rules.js'
|
|
36
35
|
|
|
37
36
|
/** The source of an entry made on the sign-in page. */
|
|
38
37
|
export const SOURCE_SIGN_IN = 'sign-in'
|
|
@@ -42,14 +41,6 @@ export const SOURCE_FORM = 'form'
|
|
|
42
41
|
/** How many friends move a person up, by default, and how far each moves them. */
|
|
43
42
|
export const DEFAULT_BOOST = { cap: 10, days: 1 } as const
|
|
44
43
|
|
|
45
|
-
/** What a boost is set to: a cap of friends per person, and the days each one moves a person up. */
|
|
46
|
-
export interface WaitlistBoost {
|
|
47
|
-
/** The most friends that count for one person. Default 10. */
|
|
48
|
-
cap?: number
|
|
49
|
-
/** The days each friend moves a person up the line. Default 1. */
|
|
50
|
-
days?: number
|
|
51
|
-
}
|
|
52
|
-
|
|
53
44
|
const DAY_MS = 24 * 60 * 60 * 1000
|
|
54
45
|
|
|
55
46
|
/**
|
|
@@ -111,17 +102,6 @@ export function checkedQuestions(questions: WaitlistQuestions | undefined): Wait
|
|
|
111
102
|
return Object.fromEntries(entries)
|
|
112
103
|
}
|
|
113
104
|
|
|
114
|
-
/** The boost as `setupWaitlist` takes it, with defaults; `false` turns the referral boost off. */
|
|
115
|
-
export function checkedBoost(boost: WaitlistBoost | false | undefined): { cap: number, days: number } {
|
|
116
|
-
if (boost === false) return { cap: 0, days: DEFAULT_BOOST.days }
|
|
117
|
-
const cap = boost?.cap ?? DEFAULT_BOOST.cap
|
|
118
|
-
const days = boost?.days ?? DEFAULT_BOOST.days
|
|
119
|
-
if (!Number.isInteger(cap) || cap < 0 || cap > 1000 || !(days > 0) || days > 365) {
|
|
120
|
-
throw new TypeError('[nuxt-backend] setupWaitlist: boost.cap is a whole number from 0 to 1000, and boost.days a number of days above 0, up to 365.')
|
|
121
|
-
}
|
|
122
|
-
return { cap, days }
|
|
123
|
-
}
|
|
124
|
-
|
|
125
105
|
// ── The signed status link ───────────────────────────────────────────────
|
|
126
106
|
|
|
127
107
|
const encoder = new TextEncoder()
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* through the --bk-* tokens (tokens.css) or the hooks themselves: every rule
|
|
4
4
|
* sits in `@layer nuxt-backend`, so any rule of the app's wins. The offer's
|
|
5
5
|
* two buttons are one style: accepting never looks like the way forward.
|
|
6
|
+
* Where no offer can stand, the question's "Cancel my plan" and the
|
|
7
|
+
* confirmation's button carry the danger colour, as a destructive action.
|
|
6
8
|
*/
|
|
7
9
|
@layer nuxt-backend {
|
|
8
10
|
[data-cancel-flow='root'] {
|
|
@@ -22,6 +24,7 @@
|
|
|
22
24
|
|
|
23
25
|
[data-cancel-flow='question'],
|
|
24
26
|
[data-cancel-flow='offer'],
|
|
27
|
+
[data-cancel-flow='confirm'],
|
|
25
28
|
[data-cancel-flow='end'] {
|
|
26
29
|
display: grid;
|
|
27
30
|
gap: 0.6rem;
|
|
@@ -61,6 +64,8 @@
|
|
|
61
64
|
[data-cancel-flow='continue'],
|
|
62
65
|
[data-cancel-flow='accept'],
|
|
63
66
|
[data-cancel-flow='cancel'],
|
|
67
|
+
[data-cancel-flow='confirm-cancel'],
|
|
68
|
+
[data-cancel-flow='back'],
|
|
64
69
|
[data-cancel-flow='keep'],
|
|
65
70
|
[data-cancel-flow='close'] {
|
|
66
71
|
flex: 1 1 10rem;
|
|
@@ -73,7 +78,18 @@
|
|
|
73
78
|
font-size: 0.88rem;
|
|
74
79
|
}
|
|
75
80
|
|
|
81
|
+
[data-cancel-flow='continue'][data-intent='cancel'] {
|
|
82
|
+
border-color: color-mix(in srgb, var(--bk-error) 50%, transparent);
|
|
83
|
+
color: var(--bk-error);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[data-cancel-flow='confirm-cancel'] {
|
|
87
|
+
border-color: var(--bk-error);
|
|
88
|
+
color: var(--bk-error);
|
|
89
|
+
}
|
|
90
|
+
|
|
76
91
|
[data-cancel-flow='offer-terms'],
|
|
92
|
+
[data-cancel-flow='confirm-ends'],
|
|
77
93
|
[data-cancel-flow='ends'],
|
|
78
94
|
[data-cancel-flow='kept'] {
|
|
79
95
|
margin: 0;
|
|
@@ -13,10 +13,13 @@ import { type CancelFlowSlots, useCancelFlow } from './cancel-flow'
|
|
|
13
13
|
* offer's. Which offer, and whether one may be made at all (none in the
|
|
14
14
|
* withdrawal period, on a past-due plan or a trial, one per customer in 12
|
|
15
15
|
* months), is the server's: `setupBilling({ lifecycle: { saveOffers } })`.
|
|
16
|
+
* When none can stand for the reason, the question's button is "Cancel my
|
|
17
|
+
* plan" itself, and a confirmation comes before the plan ends.
|
|
16
18
|
*
|
|
17
|
-
* Its steps are the parts `CancelFlowQuestion`, `CancelFlowOffer
|
|
18
|
-
* `CancelFlowEnd`, each given `useCancelFlow()`;
|
|
19
|
-
* replace them here. Its words are the
|
|
19
|
+
* Its steps are the parts `CancelFlowQuestion`, `CancelFlowOffer`,
|
|
20
|
+
* `CancelFlowConfirm` and `CancelFlowEnd`, each given `useCancelFlow()`;
|
|
21
|
+
* slots of the same names replace them here. Its words are the
|
|
22
|
+
* `cancelFlow` labels.
|
|
20
23
|
*
|
|
21
24
|
* @example
|
|
22
25
|
* ```vue
|
|
@@ -87,6 +90,13 @@ function keydown(event: KeyboardEvent) {
|
|
|
87
90
|
>
|
|
88
91
|
<CancelFlowOffer :flow="flow" />
|
|
89
92
|
</slot>
|
|
93
|
+
<slot
|
|
94
|
+
v-else-if="step === 'confirm'"
|
|
95
|
+
name="confirm"
|
|
96
|
+
v-bind="flow"
|
|
97
|
+
>
|
|
98
|
+
<CancelFlowConfirm :flow="flow" />
|
|
99
|
+
</slot>
|
|
90
100
|
<slot
|
|
91
101
|
v-else
|
|
92
102
|
name="end"
|
|
@@ -94,9 +104,9 @@ function keydown(event: KeyboardEvent) {
|
|
|
94
104
|
>
|
|
95
105
|
<CancelFlowEnd :flow="flow" />
|
|
96
106
|
</slot>
|
|
97
|
-
<!-- "Cancel my plan"
|
|
107
|
+
<!-- "Cancel my plan" before the end, finishing at once, unless the question's own button is it (or the confirmation's); "Close" after it. -->
|
|
98
108
|
<button
|
|
99
|
-
v-if="step === 'question' || step === 'offer'"
|
|
109
|
+
v-if="(step === 'question' && flow.offers.value) || step === 'offer'"
|
|
100
110
|
data-cancel-flow="cancel"
|
|
101
111
|
type="button"
|
|
102
112
|
v-bind="flow.busy('cancel')"
|
|
@@ -105,7 +115,7 @@ function keydown(event: KeyboardEvent) {
|
|
|
105
115
|
{{ flow.running.value === 'cancel' ? t('canceling') : t('cancel') }}
|
|
106
116
|
</button>
|
|
107
117
|
<button
|
|
108
|
-
v-else
|
|
118
|
+
v-else-if="step === 'ended' || step === 'kept'"
|
|
109
119
|
data-cancel-flow="close"
|
|
110
120
|
type="button"
|
|
111
121
|
@click="emit('close')"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CancelFlowConfirmProps } from '../../parts'
|
|
3
|
+
|
|
4
|
+
/** `<CancelFlow>`'s confirmation, when no offer can stand and "Cancel my plan" ends the plan: what ends when, the button that cancels and "Back". */
|
|
5
|
+
defineOptions({ name: 'CancelFlowConfirm' })
|
|
6
|
+
const props = defineProps<CancelFlowConfirmProps>()
|
|
7
|
+
const { t } = props.flow.labels
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div
|
|
12
|
+
data-cancel-flow="confirm"
|
|
13
|
+
role="group"
|
|
14
|
+
:aria-labelledby="flow.id('title')"
|
|
15
|
+
>
|
|
16
|
+
<p data-cancel-flow="confirm-ends">
|
|
17
|
+
{{ t('confirmEnds') }}
|
|
18
|
+
</p>
|
|
19
|
+
<button
|
|
20
|
+
data-cancel-flow="confirm-cancel"
|
|
21
|
+
type="button"
|
|
22
|
+
v-bind="flow.busy('cancel')"
|
|
23
|
+
@click="flow.cancelNow()"
|
|
24
|
+
>
|
|
25
|
+
{{ flow.running.value === 'cancel' ? t('canceling') : t('confirmCancel') }}
|
|
26
|
+
</button>
|
|
27
|
+
<button
|
|
28
|
+
data-cancel-flow="back"
|
|
29
|
+
type="button"
|
|
30
|
+
@click="flow.back()"
|
|
31
|
+
>
|
|
32
|
+
{{ t('back') }}
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { CancelFlowQuestionProps } from '../../parts'
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* `<CancelFlow>`'s optional question: the main reason, a comment and
|
|
6
|
+
* "Continue". When no offer can stand for the reason, the button reads
|
|
7
|
+
* "Cancel my plan" with `data-intent="cancel"`, and the confirmation comes
|
|
8
|
+
* next. "Cancel my plan" is otherwise the flow's own, beside every step.
|
|
9
|
+
*/
|
|
5
10
|
defineOptions({ name: 'CancelFlowQuestion' })
|
|
6
11
|
const props = defineProps<CancelFlowQuestionProps>()
|
|
7
12
|
const { t } = props.flow.labels
|
|
@@ -44,9 +49,10 @@ const { t } = props.flow.labels
|
|
|
44
49
|
<button
|
|
45
50
|
data-cancel-flow="continue"
|
|
46
51
|
type="submit"
|
|
52
|
+
:data-intent="flow.offers.value ? undefined : 'cancel'"
|
|
47
53
|
v-bind="flow.busy('continue')"
|
|
48
54
|
>
|
|
49
|
-
{{ flow.running.value === 'continue' ? t('canceling') : t('continue') }}
|
|
55
|
+
{{ flow.running.value === 'continue' ? t('canceling') : flow.offers.value ? t('continue') : t('cancel') }}
|
|
50
56
|
</button>
|
|
51
57
|
</form>
|
|
52
58
|
</template>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { busyAttributes } from '../../a11y'
|
|
4
4
|
import type { PricingPackCardProps } from '../../parts'
|
|
5
|
+
import { useMeterUnit } from '../../utils/meter-unit'
|
|
5
6
|
import { usePricingView } from './pricing-table'
|
|
6
7
|
import PricingPromotion from './PricingPromotion.vue'
|
|
7
8
|
|
|
@@ -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 !== undefined"
|
|
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 !== undefined"
|
|
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 !== undefined"
|
|
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"
|
|
@@ -3,6 +3,7 @@ import { computed } from 'vue'
|
|
|
3
3
|
import { busyAttributes } from '../../a11y'
|
|
4
4
|
import type { BackendLabels, LabelKey } from '../../composables/use-labels'
|
|
5
5
|
import type { PricingPlanCardProps } from '../../parts'
|
|
6
|
+
import { useMeterUnit } from '../../utils/meter-unit'
|
|
6
7
|
import { VNodes } from '../../utils/vnodes'
|
|
7
8
|
import { usePricingView } from './pricing-table'
|
|
8
9
|
import PricingPromotion from './PricingPromotion.vue'
|
|
@@ -23,6 +24,7 @@ const busy = computed(() => props.pricing.pending.value === props.plan.key)
|
|
|
23
24
|
const canceling = computed(() => props.plan.isCurrentPrice && view.context.value.billing.cancelAtPeriodEnd.value)
|
|
24
25
|
const period = computed(() => t(`period.${props.plan.interval}` as LabelKey<BackendLabels['pricing']>))
|
|
25
26
|
const promotion = computed(() => view.planPromotion(props.plan))
|
|
27
|
+
const unit = useMeterUnit()
|
|
26
28
|
</script>
|
|
27
29
|
|
|
28
30
|
<template>
|
|
@@ -84,7 +86,7 @@ const promotion = computed(() => view.planPromotion(props.plan))
|
|
|
84
86
|
data-pricing="plan-feature"
|
|
85
87
|
data-feature="credits"
|
|
86
88
|
>
|
|
87
|
-
{{ t(`credits.${plan.interval}` as never, { count: plan.credits.units }) }}
|
|
89
|
+
{{ t(`credits.${plan.interval}` as never, { count: plan.credits.units, unit: unit.word(plan.credits.unit, plan.credits.units) }) }}
|
|
88
90
|
</li>
|
|
89
91
|
<li
|
|
90
92
|
v-for="feature in plan.features ?? []"
|
|
@@ -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 type { CreditPack, PricingContact, PricingPlan } from '../../../config'
|
|
20
21
|
import { providePricingView, type PlanAction, type PlanTrial, type PricingSlotContext, type PricingTableSlots, type ResolvedPack, type ResolvedPlan } from './pricing-table'
|
|
@@ -112,6 +113,7 @@ const { isAuthenticated } = useAuthSession()
|
|
|
112
113
|
const config = useBackendConfig()
|
|
113
114
|
const labels = useLabels('pricing', () => props.labels)
|
|
114
115
|
const { t, locale } = labels
|
|
116
|
+
const unit = useMeterUnit()
|
|
115
117
|
const login = useBackendPagePath('login')
|
|
116
118
|
const uid = useId()
|
|
117
119
|
|
|
@@ -638,7 +640,7 @@ const statusText = computed(() => progress.value?.() ?? (billing.isFinishingChec
|
|
|
638
640
|
data-pricing="managed"
|
|
639
641
|
role="note"
|
|
640
642
|
>
|
|
641
|
-
{{ t('managed') }}
|
|
643
|
+
{{ t('managed', { unit: unit.word(credits.unit.value ?? resolvedPacks[0]?.offer.credits?.unit) }) }}
|
|
642
644
|
</p>
|
|
643
645
|
<template v-if="showPacks && resolvedPacks.length > 0">
|
|
644
646
|
<slot
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import { formatBillingDate } from '../../composables/billing-format'
|
|
3
3
|
import { useLabels } from '../../composables/use-labels'
|
|
4
4
|
import type { UsageHistoryEventProps } from '../../parts'
|
|
5
|
+
import { useMeterUnit } from '../../utils/meter-unit'
|
|
5
6
|
import { useUsageLabels } from './usage-history'
|
|
6
7
|
|
|
7
8
|
/** One metered event of `<UsageHistory>`: its time, its name, and the units the meter priced it at. */
|
|
8
9
|
defineOptions({ name: 'UsageHistoryEvent' })
|
|
9
10
|
defineProps<UsageHistoryEventProps>()
|
|
10
11
|
const { t, locale } = useUsageLabels() ?? useLabels('usage')
|
|
12
|
+
const unit = useMeterUnit()
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
<template>
|
|
@@ -18,6 +20,6 @@ const { t, locale } = useUsageLabels() ?? useLabels('usage')
|
|
|
18
20
|
<span
|
|
19
21
|
v-if="typeof event.units === 'number'"
|
|
20
22
|
data-usage="event-units"
|
|
21
|
-
>{{ t('units', { count: event.units }) }}</span>
|
|
23
|
+
>{{ t('units', { count: event.units, unit: unit.word(event.unit, event.units) }) }}</span>
|
|
22
24
|
</article>
|
|
23
25
|
</template>
|
|
@@ -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 { type LowCreditsNoticeContext, turnedOff } from './notices'
|
|
15
16
|
|
|
@@ -68,6 +69,7 @@ const billing = useBilling()
|
|
|
68
69
|
const config = useBackendConfig()
|
|
69
70
|
const labels = useLabels('credits')
|
|
70
71
|
const { t, rich } = labels
|
|
72
|
+
const unit = useMeterUnit()
|
|
71
73
|
const pricingPath = useBackendPagePath('pricing')
|
|
72
74
|
const dismissed = ref(false)
|
|
73
75
|
const pending: Ref<boolean> = ref(false)
|
|
@@ -132,7 +134,7 @@ const context = computed<LowCreditsNoticeContext | null>(() => {
|
|
|
132
134
|
return { credits, balance, threshold: threshold.value, pricingPath: pricingPath.value ?? '', preselected: preselected.value, pending: pending.value, topUp, dismiss }
|
|
133
135
|
})
|
|
134
136
|
// `{balance}` becomes its own element so the number can be styled apart from the sentence.
|
|
135
|
-
const message = computed(() => context.value ? rich('low', { balance: h('span', { 'data-credits': 'balance' }, String(context.value.balance)), count: context.value.balance }) : [])
|
|
137
|
+
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) }) : [])
|
|
136
138
|
</script>
|
|
137
139
|
|
|
138
140
|
<template>
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The shared `--bk-*` tokens of every packaged component and page, on
|
|
3
|
-
* `:root` inside `@layer nuxt-backend
|
|
4
|
-
* stylesheet of the app re-themes everything,
|
|
5
|
-
*
|
|
6
|
-
* scope a change to
|
|
3
|
+
* `:root` inside `@layer nuxt-backend-tokens`, the lowest layer there is:
|
|
4
|
+
* one override of a token in any stylesheet of the app re-themes everything,
|
|
5
|
+
* in any layer or none, with no specificity to match. Family tokens
|
|
6
|
+
* (`--auth-*`) default to these on their family roots and scope a change to
|
|
7
|
+
* one component.
|
|
7
8
|
*
|
|
8
|
-
* The layer order comes first, so wherever this file lands,
|
|
9
|
-
* and reset (and a `reset`
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* The layer order comes first, so wherever this file lands, the token
|
|
10
|
+
* defaults sit below everything; Tailwind's theme and reset (and a `reset`
|
|
11
|
+
* layer of the app's) sit below the package's rules, so a preflight never
|
|
12
|
+
* strips its buttons; and every layer declared after it, and any rule
|
|
13
|
+
* outside a layer, sits above them. The module adds this file first, then the
|
|
14
|
+
* stylesheets of the detected capabilities' components (src/nuxt/styles.ts);
|
|
15
|
+
* `css: false` adds none.
|
|
13
16
|
*/
|
|
14
|
-
@layer theme, base, reset, nuxt-backend;
|
|
17
|
+
@layer nuxt-backend-tokens, theme, base, reset, nuxt-backend;
|
|
15
18
|
|
|
16
|
-
@layer nuxt-backend {
|
|
19
|
+
@layer nuxt-backend-tokens {
|
|
17
20
|
:root {
|
|
18
21
|
/* Package default: the three-signal vocabulary, not a brand colour. Green
|
|
19
22
|
is "go", so it is both the accent (primary actions, focus rings) and the
|
|
@@ -27,7 +30,7 @@
|
|
|
27
30
|
follows the page; with no scheme declared, `light-dark()` resolves to
|
|
28
31
|
its light value. A production build rewrites each pair for browsers
|
|
29
32
|
that predate `light-dark()`, into variables only a `color-scheme` rule
|
|
30
|
-
defines; the `
|
|
33
|
+
defines; the `:where(:root)` block at the end of this file gives
|
|
31
34
|
them the light default.
|
|
32
35
|
|
|
33
36
|
The website does not use these values — it maps every `--bk-*` token
|
|
@@ -85,10 +88,11 @@
|
|
|
85
88
|
* two variables only in rules that declare `color-scheme`. On a page that
|
|
86
89
|
* declares none, both stay undefined and every colour would read `a b`;
|
|
87
90
|
* with these, the light value stands, as `light-dark()` itself resolves
|
|
88
|
-
* without a scheme. In the lowest layer, so any rule of
|
|
89
|
-
* declares `color-scheme` wins; `nuxt dev` never rewrites,
|
|
91
|
+
* without a scheme. In the lowest layer, beside the tokens, so any rule of
|
|
92
|
+
* the app's that declares `color-scheme` wins; `nuxt dev` never rewrites,
|
|
93
|
+
* so there they do nothing.
|
|
90
94
|
*/
|
|
91
|
-
@layer
|
|
95
|
+
@layer nuxt-backend-tokens {
|
|
92
96
|
:where(:root) {
|
|
93
97
|
--lightningcss-light: initial;
|
|
94
98
|
--lightningcss-dark: ;
|