2.x 版本更新
提示
版本号请查看
package.json
文件的version
字段
2.0.0
优化
- 更通用的落地页模板
- 内置完整的支付需求:月订阅、年订阅、一次性付款
2.1.0
优化
- 优化 Supabase 数据库初始化和更新方法
- 原来在
data/
文件夹下的 sql 文件迁移到supabase/migrations
- 新的初始化和更新方法请查看详情
- 原来在
- 优化部分组件的样式
2.2.0
新增特性
- 执行数据库文件
supabase/migrations/20250802164211_users_add_referral.sql
,并更新types.ts
文件 - 执行数据库文件
supabase/migrations/20250803113600_update_my_profile_add_referral.sql
,并更新types.ts
文件 middleware.ts
:根据 URL 参数在 Cookie 记录用户来源components/providers/AuthProvider.tsx
:将用户来源携带到登录参数重app/auth/callback/route.ts
:将用户来源记录到 users 表
- 简化已有的邮件模板,邮件内容仅保留英文,查看更新记录:
emails/invoice-payment-failed.tsx
:删除非英语内容emails/newsletter-welcome.tsx
:删除非英语内容actions/newsletter/index.ts
:更新传入的邮件参数
- 统一邮件发送函数,查看更新记录:
actions/resend/index.ts
:统一处理邮件发送、订阅取消actions/newsletter/index.ts
:调用统一发送邮件的方法lib/stripe/actions.ts
:调用统一发送邮件的方法
- 可配置是否向新用户发送欢迎邮件,查看更新记录
.env.example
:新增环境变量NEXT_PUBLIC_USER_WELCOME
用于配置是否开启新用户欢迎邮件app/auth/callback/route.ts
:在新用户登录时,发送新用户邮件通知emails/user-welcome.tsx
:新用户欢迎邮件模板
优化
- 优化部分组件样式:
components/LanguageDetectionAlert.tsx
components/ui/rainbow-button.tsx
- 优化动态图标的处理方式:
components/DynamicIcon.tsx
- 优化登录弹框关闭时机:
components/auth/LoginForm.tsx
2.2.1
优化
- 优化定价管理表单的
lang_json
字段的 JSON 验证和预览卡片的 JSON 解析
app/[locale]/(protected)/dashboard/(admin)/prices/PricePlanForm.tsx
app/[locale]/(protected)/dashboard/(admin)/prices/PricingCardPreview.tsx
lib/safeJson.ts
2.2.2
优化
- 优化语言切换提示器样式
components/LanguageDetectionAlert.tsx
- 多语言包
LanguageDetection
字段:i18n/messages/en/common.json
i18n/messages/ja/common.json
i18n/messages/zh/common.json
2.3.0
优化用户权益获取链路,并实现可靠的 SSG 方案。
优化
- 将
AuthProvider.tsx
里调用useSearchParams
下移到登录组件,保持 layout 服务端渲染,查看更新记录
- 更新
components/providers/AuthProvider.tsx
- 更新
components/auth/LoginForm.tsx
- 更新
app/[locale]/login/page.tsx
- 原有的用户权益获取链路复杂,对新手不够友好,且会影响 SSG,所以针对权益获取与使用的方式进行优化,查看更新记录
- 安装依赖
swr
:pnpm i swr
- 更新
app/[locale]/layout.tsx
- 更新
actions/usage/benefits.ts
,添加客户端获取用户权益的方法getClientUserBenefits
- 新增
hooks/useUserBenefits.ts
,共享用户权益请求、更新方法和数据状态 - 更新
components/layout/CurrentUserBenefitsDisplay.tsx
,由原来调用@/stores/benefitsStore
修改为调用@/hooks/useUserBenefits
,两个文件提供的方法名一样,所以该文件里其他代码无需修改 - 更新
components/header/UserInfo.tsx
- 更新
app/[locale]/payment/success/page.tsx
,使用重新获取数据的方法mutate(revalidateBenefits)
立即更新权益 - 删除
components/layout/BenefitsErrorBoundary.tsx
- 删除
components/providers/BenefitsProvider.tsx
二开的功能,无论新增积分或者扣除积分,都应当调用 mutate(revalidateBenefits)
立即同步数据库的积分。
- 修复 SSG 实现,查看更新记录
- 更新
app/[locale]/layout.tsx
- 更新
app/[locale]/blogs/[slug]/page.tsx
,从params
取出locale
,而不是使用getLocale()
2.3.1
修复
components/auth/GoogleOneTap.tsx
2.3.2
优化
- 登录按钮、支付按钮重定向到登录页,携带页面路径到 URL,用于登录后重定向,查看更新记录
components/home/PricingCTA.tsx
components/header/UserInfo.tsx
lib/utils.ts
修复
- 修复 URL 参数
next
为空字符串时无法登录的问题,该 bug 由 2.3.0 修改LoginForm.tsx
引起,本次变更做了兜底处理。查看更新记录
app/auth/callback/route.ts
app/auth/confirm/route.ts