PageSourceSearch

https://www.aibookwriter.org/_next/static/chunks/4290-a7221f66c3499d23.js

js aibookwriter.org collected 2026-10-07 16:20:49 UTC 15,378 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4290],{94290:function(e,r,t){t.d(r,{default:function(){return w}});var n=t(57437),o=t(2265),a=t(62869),s=t(66070),l=t(12339),i=t(86595),c=t(37829),d=t(30401),u=t(76721),m=t(512),f=t(40257);function g(){var e;let r=null===(e=f.env.CREEM_ENV)||void 0===e?void 0:e.toLowerCase();return"production"===r||"prod"===r||"live"===r?"production":"test"}let p={0:{monthly:"prod_3NVFdnvoa3u4aqn9SdQU3G",yearly:"test_prod_starter_yearly"},1:{monthly:"prod_3NVFdnvoa3u4aqn9SdQU3G",yearly:"test_prod_starter_yearly"},2:{monthly:"test_prod_pro_monthly",yearly:"test_prod_pro_yearly"},3:{monthly:"test_prod_premium_monthly",yearly:"test_prod_premium_yearly"}},x={0:{monthly:"prod_2lgTScFVR8sPPBzjB6oqE",yearly:"prod_7Uo2dGf2ABkQUaF0kf0vV5"},1:{monthly:"prod_4XSIUqhMmoxbWMCqqHXfJe",yearly:"prod_5bXst3Df7hSXVfji9WasNJ"},2:{monthly:"prod_4s9ZlOKLc64uuE6xbq3rL7",yearly:"prod_7NYQviykhtn0KJKsG21i2l"}};function h(){return"production"===g()?x:p}function y(e){let{onReady:r}=e;return r&&setTimeout(r,0),null}g(),h(),g(),y.openCheckout=async e=>{try{console.log("创建 Creem checkout session:",e);let r=await fetch("/api/creem/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let e=await r.json();throw Error(e.error||"创建 checkout session 失败")}let t=await r.json();if(!t.checkout_url)throw Error("未收到 checkout URL");console.log("重定向到 Creem checkout:",t.checkout_url),window.location.href=t.checkout_url}catch(e){console.error("打开 Creem checkout 时出错:",e),alert(e instanceof Error?e.message:"支付初始化失败,请稍后重试")}},y.getPriceId=function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=h(),n=t[e];if(!n)return console.error("未找到套餐 ID ".concat(e," 对应的 Creem 产品")),console.error("可用的套餐 ID:",Object.keys(t)),null;let o=r?n.yearly:n.monthly;return console.log("Creem 产品 ID: ".concat(o," (套餐: ").concat(e,", 年付: ").concat(r,")")),o};var b=t(4971),v=t(42586),N=t(40257);function w(){let e=(0,v.useTranslations)("pricing"),r=(0,b.Z)(e=>e.userlogindata),{loginOpen:t,setLoginOpen:f}=(0,u.a)(),[g,p]=(0,o.useState)(!1),[x,h]=(0,o.useState)("annually"),[w,j]=(0,o.useState)("test"),_=(0,v.useLocale)(),k=e.raw("plans"),C=(Array.isArray(k)?k:[]).sort((e,r)=>e.id-r.id);(0,o.useEffect)(()=>{var e;let r=null===(e=N.env.CREEM_ENV)||void 0===e?void 0:e.toLowerCase();"production"===r||"prod"===r||"live"===r?j("production"):j("test")},[]),console.log("CREEM_ENV:",N.env.CREEM_ENV),console.log("CREEM_API_KEY_TEST:",N.env.CREEM_API_KEY_TEST);let E=()=>{f(!0)},P=e=>{if(console.log("handleSubscribe with Creem"),console.log(r),console.log(e),(0,m.B)(r))console.log("userlogindata is null"),E();else{console.log("Opening Creem checkout");let t=y.getPriceId(e.id,"annually"===x);if(console.log("Creem Product ID:",t),!t){console.error("没有找到计划ID ".concat(e.id," 对应的 Creem 产品ID")),alert("暂时无法使用此支付方式,请稍后重试");return}y.openCheckout({product_id:t,user_id:r.user_id,locale:_})}},L=(e,r)=>y.getPriceId(e,r);return(0,n.jsxs)("section",{id:"pricing",className:"py-20 md:py-32 bg-background",children:[(0,n.jsx)(y,{onReady:()=>p(!0)}),(0,n.jsx)("div",{className:"container px-4 md:px-6",children:("production"===w||!(0,m.B)(r)&&1===r.user_id)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 text-center",children:[(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3",children:[(0,n.jsxs)("div",{className:"inline-flex items-center rounded-full bg-primary/10 border border-primary/20 px-4 py-2 text-sm font-medium text-primary",children:[(0,n.jsx)(i.Z,{className:"mr-2 h-4 w-4"}),"Pricing Plans"]}),"test"===w&&(0,n.jsxs)("div",{className:"inline-flex items-center rounded-full bg-yellow-500/10 border border-yellow-500/30 px-4 py-2 text-sm font-medium text-yellow-600 dark:text-yellow-400",children:[(0,n.jsx)(c.Z,{className:"mr-2 h-4 w-4"}),"测试模式"]})]}),(0,n.jsx)("h2",{className:"text-4xl font-bold tracking-tight sm:text-5xl md:text-6xl text-foreground",children:e("title")}),(0,n.jsx)("p",{className:"max-w-6xl mx-auto text-lg text-muted-foreground md:text-xl/relaxed",children:e("description")})]}),(0,n.jsx)(l.Tabs,{defaultValue:x,onValueChange:h,className:"w-full max-w-sm mx-auto pt-4",children:(0,n.jsxs)(l.TabsList,{className:"grid w-full grid-cols-2 bg-muted p-1",children:[(0,n.jsx)(l.TabsTrigger,{value:"monthly",className:"data-[state=active]:bg-primary data-[state=active]:text-card-foreground data-[state=active]:shadow-sm transition-all duration-200",children:"Monthly"}),(0,n.jsx)(l.TabsTrigger,{value:"annually",className:"data-[state=active]:bg-primary data-[state=active]:text-card-foreground data-[state=active]:shadow-sm transition-all duration-200",children:"Annually"})]})})]}),(0,n.jsx)("div",{className:"mx-auto grid max-w-6xl grid-cols-1 gap-8 md:grid-cols-4 lg:gap-10 mt-16",children:C.map((e,t)=>{let o="annually"===x,l=o&&e.priceYearMonthly?e.priceYearMonthly:e.price,i=e.period,c=null;o&&e.yearlySavingsPercentage?c="Save ".concat(e.yearlySavingsPercentage,"%"):!o&&e.bonusPointsMonth&&(c="+".concat(e.bonusPointsMonth," bonus points"));let u=3===e.id;return(0,n.jsxs)(s.Zb,{className:"relative overflow-hidden transition-all duration-300 hover:scale-105 hover:shadow-2xl border ".concat(e.popular?"border-primary shadow-2xl ring-2 ring-primary/20 bg-card":"border-border shadow-lg hover:border-primary/50 bg-card"),children:[e.popular&&(0,n.jsx)("div",{className:"absolute top-0 left-0 right-0 bg-primary text-primary-foreground text-center py-2 text-sm font-semibold",children:"Most Popular"}),(0,n.jsxs)(s.Ol,{className:"flex flex-col items-center justify-center space-y-4 p-8 ".concat(e.popular?"pt-12 bg-primary/5":""),children:[(0,n.jsxs)("div",{className:"flex items-center justify-center gap-3 whitespace-nowrap",children:[(0,n.jsx)(s.ll,{className:"text-2xl font-bold text-card-foreground",children:e.name}),c&&(0,n.jsx)("div",{className:"inline-flex items-center rounded-full bg-secondary text-secondary-foreground px-3 py-1 text-xs font-semibold shadow-lg",children:c})]}),(0,n.jsxs)("div",{className:"text-center space-y-2",children:[(0,n.jsxs)("div",{className:"text-5xl font-bold text-foreground whitespace-nowrap",children:[l,(0,n.jsx)("span",{className:"text-lg font-normal text-muted-foreground",children:i})]}),o&&e.priceYear&&(0,n.jsxs)("p",{className:"text-sm text-muted-foreground font-medium",children:["Billed as ",e.priceYear]})]}),(0,n.jsx)(s.SZ,{className:"text-center text-muted-foreground text-base",children:e.description})]}),(0,n.jsx)(s.aY,{className:"p-8 pt-4",children:(0,n.jsx)("ul",{className:"space-y-4",children:e.features.map((r,t)=>(0,n.jsxs)("li",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-secondary/20 flex items-center justify-center mt-0.5",children:(0,n.jsx)(d.Z,{className:"h-3 w-3 text-secondary"})}),(0,n.jsx)("span",{className:"text-card-foreground text-sm leading-relaxed",children:0===t&&(o?e.creditsYear:e.creditsMonth)?o?e.creditsYear:e.creditsMonth:r})]},t))})}),(0,n.jsxs)(s.eW,{className:"p-8 pt-4 flex-col space-y-3",children:[u?(0,n.jsx)("div",{className:"w-full text-center",children:(0,n.jsx)("p",{className:"text-lg font-medium text-muted-foreground",children:"Login to use"})}):(0,m.B)(r)?(0,n.jsx)(a.z,{size:"lg",className:"w-full h-12 text-base font-semibold transition-all duration-200 ".concat(e.popular?"bg-primary hover:bg-primary/90 text-primary-foreground shadow-lg":"bg-secondary hover:bg-secondary/90 text-secondary-foreground"),onClick:E,children:e.buttonText}):(0,n.jsx)(a.z,{size:"lg",className:"w-full h-12 text-base font-semibold transition-all duration-200 ".concat(e.popular?"bg-primary hover:bg-primary/90 text-primary-foreground shadow-lg":"bg-secondary hover:bg-secondary/90 text-secondary-foreground"),variant:"Enterprise"===e.title?"outline":"default",onClick:()=>P(e),children:e.buttonText}),!u&&"test"===w&&(0,n.jsx)("div",{className:"w-full p-3 rounded-md bg-yellow-500/5 border border-yellow-500/20",children:(0,n.jsxs)("p",{className:"text-xs text-yellow-600 dark:text-yellow-400 font-mono text-center break-all",children:[(0,n.jsx)("span",{className:"font-semibold",children:"产品ID: "}),L(e.id,o)||"N/A"]})}),e.note&&(0,n.jsx)("p",{className:"text-xs text-center text-muted-foreground",children:e.note})]})]},t)})})]})})]})}},62869:function(e,r,t){t.d(r,{z:function(){return c}});var n=t(57437),o=t(2265),a=t(98482),s=t(90535),l=t(94508);let i=(0,s.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=o.forwardRef((e,r)=>{let{className:t,variant:o,size:s,asChild:c=!1,...d}=e,u=c?a.g7:"button";return(0,n.jsx)(u,{className:(0,l.cn)(i({variant:o,size:s,className:t})),ref:r,...d})});c.displayName="Button"},66070:function(e,r,t){t.d(r,{Ol:function(){return l},SZ:function(){return c},Zb:function(){return s},aY:function(){return d},eW:function(){return u},ll:function(){return i}});var n=t(57437),o=t(2265),a=t(94508);let s=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)("div",{ref:r,className:(0,a.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...o})});
1s.displayName="Card";let l=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)("div",{ref:r,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",t),...o})});l.displayName="CardHeader";let i=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)("h3",{ref:r,className:(0,a.cn)("text-2xl font-semibold leading-none tracking-tight",t),...o})});i.displayName="CardTitle";let c=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)("p",{ref:r,className:(0,a.cn)("text-sm text-muted-foreground",t),...o})});c.displayName="CardDescription";let d=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)("div",{ref:r,className:(0,a.cn)("p-6 pt-0",t),...o})});d.displayName="CardContent";let u=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)("div",{ref:r,className:(0,a.cn)("flex items-center p-6 pt-0",t),...o})});u.displayName="CardFooter"},12339:function(e,r,t){t.d(r,{Tabs:function(){return l},TabsContent:function(){return d},TabsList:function(){return i},TabsTrigger:function(){return c}});var n=t(57437),o=t(2265),a=t(20271),s=t(94508);let l=a.fC,i=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)(a.aV,{ref:r,className:(0,s.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...o})});i.displayName=a.aV.displayName;let c=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)(a.xz,{ref:r,className:(0,s.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...o})});c.displayName=a.xz.displayName;let d=o.forwardRef((e,r)=>{let{className:t,...o}=e;return(0,n.jsx)(a.VY,{ref:r,className:(0,s.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...o})});d.displayName=a.VY.displayName},94508:function(e,r,t){t.d(r,{cn:function(){return a}});var n=t(61994),o=t(53335);function a(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return(0,o.m6)((0,n.W)(r))}},4971:function(e,r,t){var n=t(3011),o=t(64131);let a=(0,n.U)(e=>({userlogindata:null,loginLoading:!0,checkAuth:async()=>{e({loginLoading:!0});try{let r=await fetch("/api/user/refresh");if(!r.ok)return e({userlogindata:null,loginLoading:!1}),null;let t=await r.json();if(t.success)return e({userlogindata:t.user,loginLoading:!1}),t.user;return e({userlogindata:null,loginLoading:!1}),null}catch(r){return console.error("Error during checkAuth:",r),e({userlogindata:null,loginLoading:!1}),null}},login:r=>{e({userlogindata:r,loginLoading:!1})},refreshUserData:async()=>{e({loginLoading:!0});try{let r=await fetch("/api/user/refresh");if(!r.ok)return e({userlogindata:null,loginLoading:!1}),401===r.status&&o.Z.remove("jwt"),null;let t=await r.json();if(t.success)return e({userlogindata:t.user,loginLoading:!1}),t.user;return e({userlogindata:null,loginLoading:!1}),o.Z.remove("jwt"),null}catch(r){return console.error("Error refreshing user data:",r),e({userlogindata:null,loginLoading:!1}),o.Z.remove("jwt"),null}},logout:async()=>{try{await fetch("/api/user/logout",{method:"POST"})}catch(e){console.error("Logout error:",e)}try{o.Z.remove("jwt",{path:"/",domain:".story321.com"}),o.Z.remove("jwt",{path:"/"})}catch(e){console.error("Client cookie removal error:",e)}e({userlogindata:null,loginLoading:!1})},updateUserPoints:(r,t)=>{e(e=>{if(!e.userlogindata)return e;let n={...e.userlogindata,..."member_point"===t?{member_point:r}:{point:r}};return console.log("\uD83D\uDCB0 更新前端积分显示:",{type:t,newBalance:r,oldMemberPoint:e.userlogindata.member_point,oldPoint:e.userlogindata.point}),{userlogindata:n}})},refreshPoints:async()=>{try{let r=await fetch("/api/user/refresh");if(!r.ok){console.error("[authStore] refreshPoints: response not ok",r.status);return}let t=await r.json();t.success&&t.user&&e(e=>e.userlogindata?(console.log("\uD83D\uDCB0 refreshPoints: 积分刷新成功",{oldPoint:e.userlogindata.point,
1newPoint:t.user.point,oldMemberPoint:e.userlogindata.member_point,newMemberPoint:t.user.member_point}),{userlogindata:{...e.userlogindata,point:t.user.point,member_point:t.user.member_point}}):e)}catch(e){console.error("[authStore] refreshPoints error:",e)}}}));r.Z=a},76721:function(e,r,t){t.d(r,{a:function(){return n}});let n=(0,t(3011).U)(e=>({isOpen:!1,isMinimized:!1,pendingQuestion:null,priceOpen:!1,loginOpen:!1,setIsOpen:r=>e({isOpen:r}),setIsMinimized:r=>e({isMinimized:r}),setPendingQuestion:r=>e({pendingQuestion:r}),setPriceOpen:r=>e({priceOpen:r}),setLoginOpen:r=>e({loginOpen:r})}))},512:function(e,r,t){t.d(r,{B:function(){return n}});function n(e,r){return(console.log(r),void 0===e||"undefined"==e)?(console.log("为undefined"),!0):null==e?(console.log("为null"),!0):""==e||Number.isNaN(e)||"string"==typeof e&&""==e.trim()||void 0===e||e==[]||e=={}?(console.log("为空"),!0):(console.log("不为空"),!1)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.