소스 검색

feat: add upgrade ga test (#1690)

tags/0.3.33
Joel 1 년 전
부모
커밋
b5dd948e56
No account linked to committer's email address
3개의 변경된 파일17개의 추가작업 그리고 5개의 파일을 삭제
  1. 2
    0
      web/app/components/billing/plan/index.tsx
  2. 14
    4
      web/app/components/billing/upgrade-btn/index.tsx
  3. 1
    1
      web/i18n/lang/billing.en.ts

+ 2
- 0
web/app/components/billing/plan/index.tsx 파일 보기

<UpgradeBtn <UpgradeBtn
className='flex-shrink-0' className='flex-shrink-0'
isPlain={type !== Plan.sandbox} isPlain={type !== Plan.sandbox}
gaEventName='click_header_upgrade_btn'
/> />
)} )}
</div> </div>
isFull isFull
size='lg' size='lg'
isPlain={type !== Plan.sandbox} isPlain={type !== Plan.sandbox}
gaEventName='click_header_upgrade_btn'
/> />
)} )}
</div> </div>

+ 14
- 4
web/app/components/billing/upgrade-btn/index.tsx 파일 보기

isPlain?: boolean isPlain?: boolean
isShort?: boolean isShort?: boolean
onClick?: () => void onClick?: () => void
gaEventName?: string
} }


const PlainBtn = ({ className, onClick }: { className?: string; onClick: () => {} }) => {
const PlainBtn = ({ className, onClick }: { className?: string; onClick: () => void }) => {
const { t } = useTranslation() const { t } = useTranslation()


return ( return (
isFull = false, isFull = false,
isShort = false, isShort = false,
size = 'md', size = 'md',
onClick,
onClick: _onClick,
gaEventName,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { setShowPricingModal } = useModalContext() const { setShowPricingModal } = useModalContext()
const onClick = () => {
if (gaEventName)
(window as any).dataLayer.push({ event: gaEventName })
if (_onClick)
_onClick()
else
(setShowPricingModal as any)()
}


if (isPlain) if (isPlain)
return <PlainBtn onClick={onClick || setShowPricingModal as any} className={className} />
return <PlainBtn onClick={onClick} className={className} />


return ( return (
<div <div
size === 'lg' ? 'h-10' : 'h-9', size === 'lg' ? 'h-10' : 'h-9',
'relative flex items-center cursor-pointer border rounded-[20px] border-[#0096EA] text-white', 'relative flex items-center cursor-pointer border rounded-[20px] border-[#0096EA] text-white',
)} )}
onClick={onClick || setShowPricingModal}
onClick={onClick}
> >
<GoldCoin className='mr-1 w-3.5 h-3.5' /> <GoldCoin className='mr-1 w-3.5 h-3.5' />
<div className='text-xs font-normal'>{t(`billing.upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}`)}</div> <div className='text-xs font-normal'>{t(`billing.upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}`)}</div>

+ 1
- 1
web/i18n/lang/billing.en.ts 파일 보기

year: 'year', year: 'year',
save: 'Save ', save: 'Save ',
free: 'Free', free: 'Free',
currentPlan: 'current plan',
currentPlan: 'Current Plan',
startForFree: 'Start for free', startForFree: 'Start for free',
getStartedWith: 'Get started with ', getStartedWith: 'Get started with ',
contactSales: 'Contact Sales', contactSales: 'Contact Sales',

Loading…
취소
저장