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C,SAASC,KACd,+BAAiCF,OAAOC,SAASC,IAEvD,EACA7B,SAAUL,EAAiBe,EAAMM,QAASN,EAAMb,MAAMG,SAAS,UAE/D,iBAAM8B,UAAU,cAAa,SAC1BnC,EAAiBe,EAAMM,QAASN,EAAMb,MAAME,aAGjD,SAACgC,EAAA,QAAmB,CAElBnB,OAAQA,EACRhB,OAAQc,EAAMM,QACdnB,KAAMa,EAAMb,KACZmC,SAAU,WACRnB,GAAU,EACZ,IANKoB,EAAAA,EAAAA,SAUb,C","sources":["webpack:///./src/components/VipUpgrades/VipUpgradesButton.tsx"],"sourcesContent":["import baseBtn from '@/static/imgs/vipUpgrades/btn.png';\nimport VipUpgradesPayModal from './VipUpgradesPayModal';\n\nimport { nanoid } from 'nanoid';\nimport { useState } from 'react';\n\ntype VipType = 'base' | 'super' | 'founding';\n\ntype User = API.User.UserProfileForGet & {\n is_base_vip: boolean;\n is_founding_vip: boolean;\n super_vip_status: '未开通' | '生效中' | '已过期';\n super_vip_expires_at: number | null;\n founding_number: null | number;\n};\n\ntype OpenVipButtonType = {\n vipType: VipType;\n user: User | null;\n};\n\nconst showBtnByVipType = (vipUid: VipType, user: User | null) => {\n let btnObj: {\n message: string;\n disabled: boolean;\n bg: string;\n width?: number;\n height?: number;\n top?: number;\n opacity?: number;\n } = {\n message: '',\n disabled: false,\n bg: '',\n width: 304,\n height: 48,\n top: 0,\n };\n if (vipUid === 'base') {\n if (!!user && user.is_base_vip) {\n btnObj.message = '已认证';\n btnObj.disabled = true;\n btnObj.opacity = 0.5;\n } else {\n btnObj.message = '立即认证';\n btnObj.disabled = false;\n }\n } else if (vipUid === 'super') {\n if (!!user && user.is_founding_vip) {\n btnObj.message = '您已成为创始会员';\n btnObj.disabled = true;\n btnObj.opacity = 0.5;\n } else {\n if (!!user && user.super_vip_status === '生效中') {\n btnObj.message = '立即续费';\n btnObj.disabled = false;\n } else {\n btnObj.message = '立即开通';\n btnObj.disabled = false;\n }\n }\n } else {\n btnObj.message = '立即开通';\n btnObj.disabled = false;\n }\n btnObj.bg = `url(${baseBtn})`;\n btnObj.width = 540;\n btnObj.height = 105;\n btnObj.top = -24;\n return btnObj;\n};\n\nconst VipUpgradesButton: React.FC<OpenVipButtonType> = (props) => {\n const [isOpen, setIsOpen] = useState(false);\n return (\n <>\n <button\n type=\"button\"\n style={{\n width: showBtnByVipType(props.vipType, props.user).width,\n height: showBtnByVipType(props.vipType, props.user).height,\n color: '#562D09',\n background: showBtnByVipType(props.vipType, props.user).bg,\n backgroundSize: 'cover',\n backgroundPosition: '50%',\n borderRadius: '8px',\n border: 'none',\n position: 'relative',\n top: showBtnByVipType(props.vipType, props.user).top,\n cursor: 'pointer',\n fontSize: '16px',\n opacity: showBtnByVipType(props.vipType, props.user).opacity,\n }}\n onClick={() => {\n if (!!props.user) {\n setIsOpen(true);\n } else {\n window.location.href =\n '/community/auth/login/?next=' + window.location.href;\n }\n }}\n disabled={showBtnByVipType(props.vipType, props.user).disabled}\n >\n <span className=\"align-super\">\n {showBtnByVipType(props.vipType, props.user).message}\n </span>\n </button>\n <VipUpgradesPayModal\n key={nanoid()}\n isOpen={isOpen}\n vipUid={props.vipType}\n user={props.user}\n onCancel={() => {\n setIsOpen(false);\n }}\n />\n </>\n );\n};\n\nexport default VipUpgradesButton;\n"],"names":["showBtnByVipType","vipUid","user","btnObj","message","disabled","bg","width","height","top","is_base_vip","opacity","is_founding_vip","super_vip_status","baseBtn","props","useState","isOpen","setIsOpen","type","style","vipType","color","background","backgroundSize","backgroundPosition","borderRadius","border","position","cursor","fontSize","onClick","window","location","href","className","VipUpgradesPayModal","onCancel","nanoid"],"sourceRoot":""}