@anker-in/campaign-ui 0.5.0-beta.25 → 0.5.0-beta.26
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/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.js +1 -1
- package/dist/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.js.map +2 -2
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +1 -1
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +2 -2
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js +1 -1
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js.map +2 -2
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js +1 -1
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +2 -2
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +1 -1
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +2 -2
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +1 -1
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +2 -2
- package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js +1 -1
- package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js.map +3 -3
- package/dist/cjs/components/memberPopup/panels/Referral/index.js +1 -1
- package/dist/cjs/components/memberPopup/panels/Referral/index.js.map +2 -2
- package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.js +1 -1
- package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.js.map +3 -3
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +1 -1
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +2 -2
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js +1 -1
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js.map +2 -2
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js +1 -1
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +2 -2
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +1 -1
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +2 -2
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +1 -1
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +3 -3
- package/dist/esm/components/memberPopup/panels/EarnCredits/index.js +1 -1
- package/dist/esm/components/memberPopup/panels/EarnCredits/index.js.map +3 -3
- package/dist/esm/components/memberPopup/panels/Referral/index.js +1 -1
- package/dist/esm/components/memberPopup/panels/Referral/index.js.map +3 -3
- package/package.json +1 -1
- package/src/components/memberPopup/panels/ActivitiesSubscribePanel.tsx +2 -9
- package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.tsx +2 -19
- package/src/components/memberPopup/panels/ConsumeCredits/index.tsx +2 -5
- package/src/components/memberPopup/panels/EarnCredits/ActivatePanel.tsx +1 -1
- package/src/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.tsx +2 -2
- package/src/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.tsx +16 -15
- package/src/components/memberPopup/panels/EarnCredits/index.tsx +9 -17
- package/src/components/memberPopup/panels/Referral/index.tsx +5 -7
- package/src/components/memberPopup/panels/EarnCredits/CompleteProfileModal.tsx +0 -191
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/memberPopup/panels/EarnCredits/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useMemo } from 'react'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useViewStack } from '../../context/viewStack'\nimport { useSubscribed } from './hooks/useSubscribed'\nimport { EarnCreditsTaskType, MemberPopupPanelType, type EarnCreditsCopy } from '../../type'\nimport { IconBag, IconLock, IconSubscription, IconOrders } from '../../icons'\nimport { numberFormat } from '../../../credits/context/utils'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\nfunction TaskIcon({ id, className }: { id: EarnCreditsTaskType; className?: string }) {\n switch (id) {\n case EarnCreditsTaskType.Activate:\n return <IconLock className={className} />\n case EarnCreditsTaskType.Subscribe:\n return <IconSubscription className={className} />\n case EarnCreditsTaskType.Shop:\n return <IconBag className={className} />\n case EarnCreditsTaskType.CompleteProfile:\n return <IconOrders className={className} />\n }\n}\n\ntype Props = {\n copy: EarnCreditsCopy\n}\n\nfunction EarnCredits({ copy }: Props) {\n const {\n profile,\n openSignUpPopup,\n alpcConfig,\n creditInfo,\n fetchCreditInfo,\n isSubscribeSuccess,\n isActivateSuccess,\n isProfileCompleteSuccess,\n } = useMemberPopupContext()\n const { pushView } = useViewStack()\n const { locale } = alpcConfig\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n useEffect(() => {\n if (profile?.user_id) fetchCreditInfo(profile.user_id)\n }, [])\n\n const isLogin = !!profile\n\n const isSubscribed = useSubscribed({\n userId: profile?.user_id,\n brand: brand,\n email: profile?.email,\n locale,\n apiBaseUrl: alpcConfig.apiBaseUrl,\n })\n\n const profileCompleted = useMemo(() => {\n return (\n isProfileCompleteSuccess ||\n (!!(profile?.first_name || profile?.last_name) && !!profile?.phone_number && !!profile?.dob)\n )\n }, [profile, isProfileCompleteSuccess])\n\n function trackTaskButton(taskId: EarnCreditsTaskType) {\n const taskButtonNameMap: Record<EarnCreditsTaskType, string> = {\n [EarnCreditsTaskType.Activate]: 'activate',\n [EarnCreditsTaskType.CompleteProfile]: 'complete_profile',\n [EarnCreditsTaskType.Subscribe]: 'subscribe',\n [EarnCreditsTaskType.Shop]: 'shop',\n }\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position: 'earn_credits',\n button_name: taskButtonNameMap[taskId],\n info: 'Member Floating Window',\n },\n })\n }\n\n const taskStates: Record<EarnCreditsTaskType, { finished: boolean; onClick?: () => void; link?: string }> = useMemo(\n () => ({\n [EarnCreditsTaskType.Activate]: {\n finished: !!profile?.activated || isActivateSuccess,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.Activate)\n pushView({\n type: MemberPopupPanelType.Activate,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.CompleteProfile]: {\n finished: profileCompleted,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.CompleteProfile)\n pushView({\n type: MemberPopupPanelType.CompleteProfile,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Subscribe]: {\n finished: isSubscribed || isSubscribeSuccess,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.Subscribe)\n pushView({\n type: MemberPopupPanelType.SubscribeEmail,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Shop]: {\n finished: false,\n link: copy.goShopLink,\n onClick: isLogin ? () => trackTaskButton(EarnCreditsTaskType.Shop) : openSignUpPopup,\n },\n }),\n [\n profile,\n isLogin,\n isActivateSuccess,\n isProfileCompleteSuccess,\n profileCompleted,\n isSubscribed,\n isSubscribeSuccess,\n openSignUpPopup,\n pushView,\n copy.goShopLink,\n ]\n )\n\n const list = useMemo(() => {\n return copy.list\n .map(item => {\n const state = taskStates[item.id]\n if (!state) return null\n const buttonLabel = state.finished\n ? copy.completed\n : isLogin\n ? getNotFinishedLabel(item.id, copy)\n : copy.joinNow\n return { ...item, ...state, buttonLabel }\n })\n .filter(Boolean) as ((typeof copy.list)[number] & {\n finished: boolean\n onClick?: () => void\n link?: string\n buttonLabel: string\n })[]\n }, [copy, taskStates, isLogin])\n\n return (\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[8px]\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n </div>\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.balanceLabel ?? 'AnkerCredits Balance'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.available_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n <div className=\"h-full w-px bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.comingSoonLabel ?? 'Coming Soon'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.pending_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex flex-col gap-[16px]\">\n {copy.subtitle && <p className=\"text-[16px] font-[700] text-[#1e2024]\">{copy.subtitle}</p>}\n\n <div className=\"flex flex-col\">\n {list.map((item, idx) => (\n <div key={idx} className=\"relative py-[16px]\">\n {idx > 0 && <div className=\"absolute left-0 right-0 top-0 h-px bg-[#dadce0]\" />}\n <div className={cn('flex items-center gap-[12px]')}>\n <TaskIcon id={item.id} className=\"size-[24px] shrink-0\" />\n <div className=\"flex-1\">\n <div className=\"text-[16px] font-[700] text-[#1e2024]\">{item.title}</div>\n {item.credits &&
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "useEffect", "useMemo", "gaTrack", "cn", "useHeadlessContext", "useMemberPopupContext", "useViewStack", "useSubscribed", "EarnCreditsTaskType", "MemberPopupPanelType", "IconBag", "IconLock", "IconSubscription", "IconOrders", "numberFormat", "ROUNDED_BRANDS", "TaskIcon", "id", "className", "EarnCredits", "copy", "profile", "openSignUpPopup", "alpcConfig", "creditInfo", "fetchCreditInfo", "isSubscribeSuccess", "isActivateSuccess", "isProfileCompleteSuccess", "pushView", "locale", "brand", "rounded", "isLogin", "isSubscribed", "profileCompleted", "trackTaskButton", "taskId", "taskButtonNameMap", "taskStates", "list", "item", "state", "buttonLabel", "getNotFinishedLabel", "idx", "EarnCredits_default"]
|
|
4
|
+
"sourcesContent": ["import { useEffect, useMemo } from 'react'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useViewStack } from '../../context/viewStack'\nimport { useSubscribed } from './hooks/useSubscribed'\nimport { EarnCreditsTaskType, MemberPopupPanelType, type EarnCreditsCopy } from '../../type'\nimport { IconBag, IconLock, IconSubscription, IconOrders } from '../../icons'\nimport { numberFormat } from '../../../credits/context/utils'\nimport { ROUNDED_BRANDS } from '../../../../constants'\nimport { Button } from '@anker-in/headless-ui'\n\nfunction TaskIcon({ id, className }: { id: EarnCreditsTaskType; className?: string }) {\n switch (id) {\n case EarnCreditsTaskType.Activate:\n return <IconLock className={className} />\n case EarnCreditsTaskType.Subscribe:\n return <IconSubscription className={className} />\n case EarnCreditsTaskType.Shop:\n return <IconBag className={className} />\n case EarnCreditsTaskType.CompleteProfile:\n return <IconOrders className={className} />\n }\n}\n\ntype Props = {\n copy: EarnCreditsCopy\n}\n\nfunction EarnCredits({ copy }: Props) {\n const {\n profile,\n openSignUpPopup,\n alpcConfig,\n creditInfo,\n fetchCreditInfo,\n isSubscribeSuccess,\n isActivateSuccess,\n isProfileCompleteSuccess,\n } = useMemberPopupContext()\n const { pushView } = useViewStack()\n const { locale } = alpcConfig\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n useEffect(() => {\n if (profile?.user_id) fetchCreditInfo(profile.user_id)\n }, [])\n\n const isLogin = !!profile\n\n const isSubscribed = useSubscribed({\n userId: profile?.user_id,\n brand: brand,\n email: profile?.email,\n locale,\n apiBaseUrl: alpcConfig.apiBaseUrl,\n })\n\n const profileCompleted = useMemo(() => {\n return (\n isProfileCompleteSuccess ||\n (!!(profile?.first_name || profile?.last_name) && !!profile?.phone_number && !!profile?.dob)\n )\n }, [profile, isProfileCompleteSuccess])\n\n function trackTaskButton(taskId: EarnCreditsTaskType) {\n const taskButtonNameMap: Record<EarnCreditsTaskType, string> = {\n [EarnCreditsTaskType.Activate]: 'activate',\n [EarnCreditsTaskType.CompleteProfile]: 'complete_profile',\n [EarnCreditsTaskType.Subscribe]: 'subscribe',\n [EarnCreditsTaskType.Shop]: 'shop',\n }\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position: 'earn_credits',\n button_name: taskButtonNameMap[taskId],\n info: 'Member Floating Window',\n },\n })\n }\n\n const taskStates: Record<EarnCreditsTaskType, { finished: boolean; onClick?: () => void; link?: string }> = useMemo(\n () => ({\n [EarnCreditsTaskType.Activate]: {\n finished: !!profile?.activated || isActivateSuccess,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.Activate)\n pushView({\n type: MemberPopupPanelType.Activate,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.CompleteProfile]: {\n finished: profileCompleted,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.CompleteProfile)\n pushView({\n type: MemberPopupPanelType.CompleteProfile,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Subscribe]: {\n finished: isSubscribed || isSubscribeSuccess,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.Subscribe)\n pushView({\n type: MemberPopupPanelType.SubscribeEmail,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Shop]: {\n finished: false,\n link: copy.goShopLink,\n onClick: isLogin ? () => trackTaskButton(EarnCreditsTaskType.Shop) : openSignUpPopup,\n },\n }),\n [\n profile,\n isLogin,\n isActivateSuccess,\n isProfileCompleteSuccess,\n profileCompleted,\n isSubscribed,\n isSubscribeSuccess,\n openSignUpPopup,\n pushView,\n copy.goShopLink,\n ]\n )\n\n const list = useMemo(() => {\n return copy.list\n .map(item => {\n const state = taskStates[item.id]\n if (!state) return null\n const buttonLabel = state.finished\n ? copy.completed\n : isLogin\n ? getNotFinishedLabel(item.id, copy)\n : copy.joinNow\n return { ...item, ...state, buttonLabel }\n })\n .filter(Boolean) as ((typeof copy.list)[number] & {\n finished: boolean\n onClick?: () => void\n link?: string\n buttonLabel: string\n })[]\n }, [copy, taskStates, isLogin])\n\n return (\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[8px]\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n </div>\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.balanceLabel ?? 'AnkerCredits Balance'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.available_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n <div className=\"h-full w-px bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.comingSoonLabel ?? 'Coming Soon'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.pending_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex flex-col gap-[16px]\">\n {copy.subtitle && <p className=\"text-[16px] font-[700] text-[#1e2024]\">{copy.subtitle}</p>}\n\n <div className=\"flex flex-col\">\n {list.map((item, idx) => (\n <div key={idx} className=\"relative py-[16px]\">\n {idx > 0 && <div className=\"absolute left-0 right-0 top-0 h-px bg-[#dadce0]\" />}\n <div className={cn('flex items-center gap-[12px]')}>\n <TaskIcon id={item.id} className=\"size-[24px] shrink-0\" />\n <div className=\"flex-1\">\n <div className=\"text-[16px] font-[700] text-[#1e2024]\">{item.title}</div>\n {item.credits && <div className=\"mt-[4px] text-[14px] font-bold text-[#4A4C56]\">{item.credits}</div>}\n </div>\n {!item.finished && item.link && isLogin ? (\n <Button\n as=\"a\"\n className=\"w-full\"\n href={item.link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={() => trackTaskButton(item.id)}\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button\n className=\"w-full\"\n disabled={item.finished}\n onClick={!item.finished ? item.onClick : undefined}\n >\n {item.buttonLabel}\n </Button>\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\nfunction getNotFinishedLabel(id: EarnCreditsTaskType, copy: EarnCreditsCopy): string {\n switch (id) {\n case EarnCreditsTaskType.Activate:\n return copy.activate\n case EarnCreditsTaskType.CompleteProfile:\n return copy.completeProfileLabel\n case EarnCreditsTaskType.Subscribe:\n return copy.subscribeLabel\n case EarnCreditsTaskType.Shop:\n return copy.shopNow\n }\n}\n\nexport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["jsx", "jsxs", "useEffect", "useMemo", "gaTrack", "cn", "useHeadlessContext", "useMemberPopupContext", "useViewStack", "useSubscribed", "EarnCreditsTaskType", "MemberPopupPanelType", "IconBag", "IconLock", "IconSubscription", "IconOrders", "numberFormat", "ROUNDED_BRANDS", "Button", "TaskIcon", "id", "className", "EarnCredits", "copy", "profile", "openSignUpPopup", "alpcConfig", "creditInfo", "fetchCreditInfo", "isSubscribeSuccess", "isActivateSuccess", "isProfileCompleteSuccess", "pushView", "locale", "brand", "rounded", "isLogin", "isSubscribed", "profileCompleted", "trackTaskButton", "taskId", "taskButtonNameMap", "taskStates", "list", "item", "state", "buttonLabel", "getNotFinishedLabel", "idx", "EarnCredits_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as a}from"react/jsx-runtime";import{Picture as
|
|
1
|
+
import{jsx as t,jsxs as a}from"react/jsx-runtime";import{Button as b,Picture as N}from"@anker-in/headless-ui";import{gaTrack as w,classNames as x,useHeadlessContext as C}from"@anker-in/lib";import{useMemberPopupContext as L}from"../../context/provider";import{useReferralOverview as T}from"./hooks/useReferralOverview";import{formatPrice as c}from"../../../credits/context/utils";import{ROUNDED_BRANDS as R}from"../../../../constants";function _({copy:e,onClose:P}){const{profile:m,alpcConfig:r,pageHandle:n}=L(),p=!!m,{brand:g,currencyCode:o="USD"}=C(),s=R.includes(g),{data:i}=T(),u=i?.data?.data?.available??0,v=i?.data?.data?.pending??0;function f(l){try{if(!n)return l;const d=new URL(l,window.location.href);return d.searchParams.set("ref",`${n}_referral`),d.toString()}catch{return l}}function h(){w({event:"ga4Event",event_name:"lp_button",event_parameters:{position:"referral",button_name:"referral_cta",info:"Member Floating Window"}})}return a("div",{className:"flex flex-col",children:[e.title&&t("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:e.title}),p&&a("div",{className:x("flex items-center mt-[16px] gap-[12px] bg-[#f5f6f7] p-[16px]",s?"rounded-[8px]":"rounded-none"),children:[a("div",{className:"flex flex-1 flex-col gap-[4px]",children:[t("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashAvailableLabel}),t("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:c({amount:u,currencyCode:o,locale:r.locale})})]}),t("div",{className:"h-full w-px self-stretch bg-[#dadce0]"}),a("div",{className:"flex flex-1 flex-col gap-[4px]",children:[t("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashPendingLabel}),t("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:c({amount:v,currencyCode:o,locale:r.locale})})]})]}),(e.howToTitle||e.howToDescription)&&a("div",{className:"flex mt-[32px] flex-col gap-[8px]",children:[e.howToTitle&&t("h3",{className:"text-[20px] font-bold leading-[1.2] text-[#080a0f]",children:e.howToTitle}),e.howToDescription&&t("p",{className:"text-[14px] font-bold leading-[1.4] text-[#080A0F]",children:e.howToDescription}),e.learnMoreLabel&&e.learnMoreUrl&&a("a",{href:f(e.learnMoreUrl),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline",children:[e.learnMoreLabel,t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:t("path",{d:"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z",fill:"#080A0F"})})]})]}),e.image?.url&&t(N,{source:e.image.url,alt:e.image.alt??"",className:x("mt-[8px] w-full",s?"rounded-[8px]":"rounded-none")}),e.ctaButton&&t(b,{size:"base",as:"a",href:e.ctaUrl?f(e.ctaUrl):"#",target:"_blank",rel:"noopener noreferrer",onClick:h,children:e.ctaButton})]})}var F=_;export{F as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/memberPopup/panels/Referral/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Picture } from '@anker-in/headless-ui'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useReferralOverview } from './hooks/useReferralOverview'\nimport { formatPrice } from '../../../credits/context/utils'\n\nimport type { ReferralCopy } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n copy: ReferralCopy\n onClose: () => void\n}\n\nfunction Referral({ copy, onClose }: Props) {\n const { profile, alpcConfig, pageHandle } = useMemberPopupContext()\n const isLogin = !!profile\n const { brand, currencyCode = 'USD' as string } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const { data } = useReferralOverview()\n\n const cashAvailable = data?.data?.data?.available ?? 0\n const cashPending = data?.data?.data?.pending ?? 0\n\n function buildRefUrl(url: string) {\n try {\n if (!pageHandle) return url\n const target = new URL(url, window.location.href)\n target.searchParams.set('ref', `${pageHandle}_referral`)\n return target.toString()\n } catch {\n return url\n }\n }\n\n function trackReferralCta() {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position: 'referral',\n button_name: 'referral_cta',\n info: 'Member Floating Window',\n },\n })\n }\n\n return (\n <div className=\"flex flex-col\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center mt-[16px] gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashAvailableLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashAvailable, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n <div className=\"h-full w-px self-stretch bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashPendingLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashPending, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n </div>\n )}\n\n {(copy.howToTitle || copy.howToDescription) && (\n <div className=\"flex mt-[32px] flex-col gap-[8px]\">\n {copy.howToTitle && <h3 className=\"text-[20px] font-bold leading-[1.2] text-[#080a0f]\">{copy.howToTitle}</h3>}\n {copy.howToDescription && (\n <p className=\"text-[14px] font-bold leading-[1.4] text-[#080A0F]\">{copy.howToDescription}</p>\n )}\n {copy.learnMoreLabel && copy.learnMoreUrl && (\n <a\n href={buildRefUrl(copy.learnMoreUrl)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline\"\n >\n {copy.learnMoreLabel}\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z\"\n fill=\"#080A0F\"\n />\n </svg>\n </a>\n )}\n </div>\n )}\n\n {copy.image?.url && (\n <Picture\n source={copy.image.url}\n alt={copy.image.alt ?? ''}\n className={cn('mt-[8px] w-full', rounded ? 'rounded-[8px]' : 'rounded-none')}\n />\n )}\n\n {copy.ctaButton && (\n <a\n href={copy.ctaUrl ? buildRefUrl(copy.ctaUrl) : '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n
|
|
5
|
-
"mappings": "AAkDqB,cAAAA,EASX,QAAAC,MATW,oBAlDrB,OAAS,WAAAC,MAAe,
|
|
6
|
-
"names": ["jsx", "jsxs", "Picture", "gaTrack", "cn", "useHeadlessContext", "useMemberPopupContext", "useReferralOverview", "formatPrice", "ROUNDED_BRANDS", "Referral", "copy", "onClose", "profile", "alpcConfig", "pageHandle", "isLogin", "brand", "currencyCode", "rounded", "data", "cashAvailable", "cashPending", "buildRefUrl", "url", "target", "trackReferralCta", "Referral_default"]
|
|
4
|
+
"sourcesContent": ["import { Button, Picture } from '@anker-in/headless-ui'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useReferralOverview } from './hooks/useReferralOverview'\nimport { formatPrice } from '../../../credits/context/utils'\n\nimport type { ReferralCopy } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n copy: ReferralCopy\n onClose: () => void\n}\n\nfunction Referral({ copy, onClose }: Props) {\n const { profile, alpcConfig, pageHandle } = useMemberPopupContext()\n const isLogin = !!profile\n const { brand, currencyCode = 'USD' as string } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const { data } = useReferralOverview()\n\n const cashAvailable = data?.data?.data?.available ?? 0\n const cashPending = data?.data?.data?.pending ?? 0\n\n function buildRefUrl(url: string) {\n try {\n if (!pageHandle) return url\n const target = new URL(url, window.location.href)\n target.searchParams.set('ref', `${pageHandle}_referral`)\n return target.toString()\n } catch {\n return url\n }\n }\n\n function trackReferralCta() {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position: 'referral',\n button_name: 'referral_cta',\n info: 'Member Floating Window',\n },\n })\n }\n\n return (\n <div className=\"flex flex-col\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center mt-[16px] gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashAvailableLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashAvailable, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n <div className=\"h-full w-px self-stretch bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashPendingLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashPending, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n </div>\n )}\n\n {(copy.howToTitle || copy.howToDescription) && (\n <div className=\"flex mt-[32px] flex-col gap-[8px]\">\n {copy.howToTitle && <h3 className=\"text-[20px] font-bold leading-[1.2] text-[#080a0f]\">{copy.howToTitle}</h3>}\n {copy.howToDescription && (\n <p className=\"text-[14px] font-bold leading-[1.4] text-[#080A0F]\">{copy.howToDescription}</p>\n )}\n {copy.learnMoreLabel && copy.learnMoreUrl && (\n <a\n href={buildRefUrl(copy.learnMoreUrl)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline\"\n >\n {copy.learnMoreLabel}\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z\"\n fill=\"#080A0F\"\n />\n </svg>\n </a>\n )}\n </div>\n )}\n\n {copy.image?.url && (\n <Picture\n source={copy.image.url}\n alt={copy.image.alt ?? ''}\n className={cn('mt-[8px] w-full', rounded ? 'rounded-[8px]' : 'rounded-none')}\n />\n )}\n\n {copy.ctaButton && (\n <Button\n size=\"base\"\n as=\"a\"\n href={copy.ctaUrl ? buildRefUrl(copy.ctaUrl) : '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={trackReferralCta}\n >\n {copy.ctaButton}\n </Button>\n )}\n </div>\n )\n}\n\nexport default Referral\n"],
|
|
5
|
+
"mappings": "AAkDqB,cAAAA,EASX,QAAAC,MATW,oBAlDrB,OAAS,UAAAC,EAAQ,WAAAC,MAAe,wBAChC,OAAS,WAAAC,EAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBAC9D,OAAS,yBAAAC,MAA6B,yBACtC,OAAS,uBAAAC,MAA2B,8BACpC,OAAS,eAAAC,MAAmB,iCAG5B,OAAS,kBAAAC,MAAsB,wBAO/B,SAASC,EAAS,CAAE,KAAAC,EAAM,QAAAC,CAAQ,EAAU,CAC1C,KAAM,CAAE,QAAAC,EAAS,WAAAC,EAAY,WAAAC,CAAW,EAAIT,EAAsB,EAC5DU,EAAU,CAAC,CAACH,EACZ,CAAE,MAAAI,EAAO,aAAAC,EAAe,KAAgB,EAAIb,EAAmB,EAC/Dc,EAAUV,EAAe,SAASQ,CAAK,EAEvC,CAAE,KAAAG,CAAK,EAAIb,EAAoB,EAE/Bc,EAAgBD,GAAM,MAAM,MAAM,WAAa,EAC/CE,EAAcF,GAAM,MAAM,MAAM,SAAW,EAEjD,SAASG,EAAYC,EAAa,CAChC,GAAI,CACF,GAAI,CAACT,EAAY,OAAOS,EACxB,MAAMC,EAAS,IAAI,IAAID,EAAK,OAAO,SAAS,IAAI,EAChD,OAAAC,EAA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AAK,OACnD,SAAAA,EAAC,QACC,EAAE,kUACF,KAAK,UACP,EACF,GACF,GAEJ,EAGDY,EAAK,OAAO,KACXZ,EAACG,EAAA,CACC,OAAQS,EAAK,MAAM,IACnB,IAAKA,EAAK,MAAM,KAAO,GACvB,UAAWP,EAAG,kBAAmBe,EAAU,gBAAkB,cAAc,EAC7E,EAGDR,EAAK,WACJZ,EAACE,EAAA,CACC,KAAK,OACL,GAAG,IACH,KAAMU,EAAK,OAASY,EAAYZ,EAAK,MAAM,EAAI,IAC/C,OAAO,SACP,IAAI,sBACJ,QAASe,EAER,SAAAf,EAAK,UACR,GAEJ,CAEJ,CAEA,IAAOgB,EAAQjB",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Picture", "gaTrack", "cn", "useHeadlessContext", "useMemberPopupContext", "useReferralOverview", "formatPrice", "ROUNDED_BRANDS", "Referral", "copy", "onClose", "profile", "alpcConfig", "pageHandle", "isLogin", "brand", "currencyCode", "rounded", "data", "cashAvailable", "cashPending", "buildRefUrl", "url", "target", "trackReferralCta", "Referral_default"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -127,16 +127,9 @@ export default function ActivitiesSubscribeModal({ copy, email: initialEmail }:
|
|
|
127
127
|
/>
|
|
128
128
|
</div>
|
|
129
129
|
|
|
130
|
-
<
|
|
131
|
-
className={cn(
|
|
132
|
-
'w-full cursor-pointer bg-[#080a0f] mt-[16px] py-[14px] text-[14px] font-[700] text-white disabled:opacity-60',
|
|
133
|
-
rounded ? 'rounded-[4px]' : 'rounded-none'
|
|
134
|
-
)}
|
|
135
|
-
disabled={loading}
|
|
136
|
-
onClick={handleSubmit}
|
|
137
|
-
>
|
|
130
|
+
<Button className={'w-full mt-[16px]'} loading={loading} onClick={handleSubmit}>
|
|
138
131
|
{copy.buttonLabel ?? 'Subscribe'}
|
|
139
|
-
</
|
|
132
|
+
</Button>
|
|
140
133
|
|
|
141
134
|
{errorMessage && (
|
|
142
135
|
<div className="text-left mt-[4px] text-[16px] font-semibold text-[#f84d4f]">
|
|
@@ -133,16 +133,7 @@ export default function RedeemCouponPanel({ onClose, item, copy, onError }: Prop
|
|
|
133
133
|
</div>
|
|
134
134
|
<Text className="text-[20px] font-[700]" html={redeemModal.successTitle} />
|
|
135
135
|
<Text className="text-[14px] font-[700] text-[#6d6d6f]" html={redeemModal.successDesc} />
|
|
136
|
-
<Button
|
|
137
|
-
className={cn(
|
|
138
|
-
'w-full py-[12px] text-[14px] font-[700] text-white bg-[#080a0f]',
|
|
139
|
-
rounded ? 'rounded-[4px]' : 'rounded-none'
|
|
140
|
-
)}
|
|
141
|
-
onClick={() => {
|
|
142
|
-
if (redeemModal.successButtonUrl) window.location.href = redeemModal.successButtonUrl
|
|
143
|
-
onClose()
|
|
144
|
-
}}
|
|
145
|
-
>
|
|
136
|
+
<Button as="a" href={redeemModal.successButtonUrl} className="w-full">
|
|
146
137
|
{redeemModal.successButton}
|
|
147
138
|
</Button>
|
|
148
139
|
</div>
|
|
@@ -152,15 +143,7 @@ export default function RedeemCouponPanel({ onClose, item, copy, onError }: Prop
|
|
|
152
143
|
<div className="sticky bottom-0 bg-white border-t border-[#e5e5e5] pt-[10px]">
|
|
153
144
|
<div className="flex flex-col gap-[8px] text-center">
|
|
154
145
|
<Text className="block text-[16px] font-[700] leading-[1.3]" html={redeemModal.confirmTitle} />
|
|
155
|
-
<Button
|
|
156
|
-
className={cn(
|
|
157
|
-
'w-full py-[12px] text-[14px] font-[700] text-white disabled:opacity-60 bg-[#080a0f]',
|
|
158
|
-
rounded ? 'rounded-[4px]' : 'rounded-none'
|
|
159
|
-
)}
|
|
160
|
-
disabled={disabled}
|
|
161
|
-
loading={loading}
|
|
162
|
-
onClick={handleConfirm}
|
|
163
|
-
>
|
|
146
|
+
<Button className="w-full" disabled={disabled} loading={loading} onClick={handleConfirm}>
|
|
164
147
|
{redeemModal.confirmButton}
|
|
165
148
|
</Button>
|
|
166
149
|
</div>
|
|
@@ -278,7 +278,7 @@ function ConsumeCredits({ copy }: Props) {
|
|
|
278
278
|
{Number(item.price).toFixed(2)}
|
|
279
279
|
</div>
|
|
280
280
|
{item.variant?.price?.amount && (
|
|
281
|
-
<div className="text-[12px] text-[#999] line-through">
|
|
281
|
+
<div className="text-[12px] ml-1 text-[#999] line-through">
|
|
282
282
|
${Number(item.variant.price.amount).toFixed(2)}
|
|
283
283
|
</div>
|
|
284
284
|
)}
|
|
@@ -290,10 +290,7 @@ function ConsumeCredits({ copy }: Props) {
|
|
|
290
290
|
</div>
|
|
291
291
|
<div className="relative group">
|
|
292
292
|
<Button
|
|
293
|
-
|
|
294
|
-
'bg-[#080a0f] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',
|
|
295
|
-
rounded ? 'rounded-[4px]' : 'rounded-none'
|
|
296
|
-
)}
|
|
293
|
+
size="base"
|
|
297
294
|
disabled={isDisabled(item)}
|
|
298
295
|
loading={loadingId === item.redeemId}
|
|
299
296
|
onClick={() => handleRedeem(item)}
|
|
@@ -326,7 +326,7 @@ export default function ActivatePanel({ copy, onClose }: Props) {
|
|
|
326
326
|
<Button
|
|
327
327
|
type="submit"
|
|
328
328
|
loading={emailValidationLoading}
|
|
329
|
-
className="mt-6
|
|
329
|
+
className="mt-6 w-full min-l:mt-8"
|
|
330
330
|
onClick={handleAuthCodeSubmit}
|
|
331
331
|
>
|
|
332
332
|
{copy.buttonText}
|
|
@@ -197,10 +197,10 @@ export default function CompleteProfilePanel({ copy, onClose }: Props) {
|
|
|
197
197
|
</div>
|
|
198
198
|
|
|
199
199
|
<div className="flex gap-[12px]">
|
|
200
|
-
<Button variant="secondary" size="
|
|
200
|
+
<Button variant="secondary" size="base" className="flex-1" onClick={onClose} disabled={isLoading}>
|
|
201
201
|
{copy.cancel}
|
|
202
202
|
</Button>
|
|
203
|
-
<Button variant="primary" size="
|
|
203
|
+
<Button variant="primary" size="base" className="flex-1" loading={isLoading} onClick={handleSubmit}>
|
|
204
204
|
{copy.save}
|
|
205
205
|
</Button>
|
|
206
206
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react'
|
|
2
|
-
import { Checkbox, Text } from '@anker-in/headless-ui'
|
|
2
|
+
import { Button, Checkbox, Text } from '@anker-in/headless-ui'
|
|
3
3
|
import { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'
|
|
4
4
|
import Cookies from 'js-cookie'
|
|
5
5
|
import { parse } from 'query-string'
|
|
@@ -91,12 +91,8 @@ export default function SubscribeEmailPanel({ copy, email: initialEmail, onClose
|
|
|
91
91
|
return (
|
|
92
92
|
<div className="flex flex-col gap-[12px]">
|
|
93
93
|
<div className="flex flex-col gap-[8px]">
|
|
94
|
-
{copy.title &&
|
|
95
|
-
|
|
96
|
-
)}
|
|
97
|
-
{copy.desc && (
|
|
98
|
-
<Text className="text-[16px] text-[#1e2024]" html={copy.desc} />
|
|
99
|
-
)}
|
|
94
|
+
{copy.title && <h2 className="text-[24px] font-[700] leading-[1.2] text-[#080a0f]">{copy.title}</h2>}
|
|
95
|
+
{copy.desc && <Text className="text-[16px] text-[#1e2024]" html={copy.desc} />}
|
|
100
96
|
</div>
|
|
101
97
|
|
|
102
98
|
<div className="flex flex-col gap-[16px]">
|
|
@@ -108,7 +104,10 @@ export default function SubscribeEmailPanel({ copy, email: initialEmail, onClose
|
|
|
108
104
|
)}
|
|
109
105
|
placeholder={copy.placeholder}
|
|
110
106
|
value={email}
|
|
111
|
-
onChange={e => {
|
|
107
|
+
onChange={e => {
|
|
108
|
+
setErrorMessage('')
|
|
109
|
+
setEmail(e.target.value.trim())
|
|
110
|
+
}}
|
|
112
111
|
/>
|
|
113
112
|
|
|
114
113
|
<div className="flex w-full items-start gap-[8px]">
|
|
@@ -121,18 +120,20 @@ export default function SubscribeEmailPanel({ copy, email: initialEmail, onClose
|
|
|
121
120
|
</div>
|
|
122
121
|
|
|
123
122
|
{(errorMessage || successMessage) && (
|
|
124
|
-
<div
|
|
123
|
+
<div
|
|
124
|
+
className={cn(
|
|
125
|
+
'text-[14px] font-[700]',
|
|
126
|
+
errorMessage && 'text-[#f84d4f]',
|
|
127
|
+
successMessage && 'text-[#52c41a]'
|
|
128
|
+
)}
|
|
129
|
+
>
|
|
125
130
|
<Text html={successMessage || errorMessage} />
|
|
126
131
|
</div>
|
|
127
132
|
)}
|
|
128
133
|
|
|
129
|
-
<
|
|
130
|
-
className={cn('w-full cursor-pointer bg-[#080a0f] py-[14px] text-[14px] font-[700] text-white disabled:opacity-60', rounded ? 'rounded-[4px]' : 'rounded-none')}
|
|
131
|
-
disabled={loading}
|
|
132
|
-
onClick={handleSubmit}
|
|
133
|
-
>
|
|
134
|
+
<Button className="w-full" loading={loading} onClick={handleSubmit}>
|
|
134
135
|
{copy.buttonLabel ?? 'Subscribe'}
|
|
135
|
-
</
|
|
136
|
+
</Button>
|
|
136
137
|
</div>
|
|
137
138
|
</div>
|
|
138
139
|
)
|
|
@@ -7,6 +7,7 @@ import { EarnCreditsTaskType, MemberPopupPanelType, type EarnCreditsCopy } from
|
|
|
7
7
|
import { IconBag, IconLock, IconSubscription, IconOrders } from '../../icons'
|
|
8
8
|
import { numberFormat } from '../../../credits/context/utils'
|
|
9
9
|
import { ROUNDED_BRANDS } from '../../../../constants'
|
|
10
|
+
import { Button } from '@anker-in/headless-ui'
|
|
10
11
|
|
|
11
12
|
function TaskIcon({ id, className }: { id: EarnCreditsTaskType; className?: string }) {
|
|
12
13
|
switch (id) {
|
|
@@ -207,36 +208,27 @@ function EarnCredits({ copy }: Props) {
|
|
|
207
208
|
<TaskIcon id={item.id} className="size-[24px] shrink-0" />
|
|
208
209
|
<div className="flex-1">
|
|
209
210
|
<div className="text-[16px] font-[700] text-[#1e2024]">{item.title}</div>
|
|
210
|
-
{item.credits &&
|
|
211
|
-
<div className="mt-[4px] text-[14px] font-bold text-[#4A4C56]">{item.credits}</div>
|
|
212
|
-
)}
|
|
211
|
+
{item.credits && <div className="mt-[4px] text-[14px] font-bold text-[#4A4C56]">{item.credits}</div>}
|
|
213
212
|
</div>
|
|
214
213
|
{!item.finished && item.link && isLogin ? (
|
|
215
|
-
<
|
|
214
|
+
<Button
|
|
215
|
+
as="a"
|
|
216
|
+
className="w-full"
|
|
216
217
|
href={item.link}
|
|
217
218
|
target="_blank"
|
|
218
219
|
rel="noopener noreferrer"
|
|
219
|
-
className={cn(
|
|
220
|
-
'cursor-pointer bg-[#080a0f] min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',
|
|
221
|
-
rounded ? 'rounded-[4px]' : 'rounded-none'
|
|
222
|
-
)}
|
|
223
220
|
onClick={() => trackTaskButton(item.id)}
|
|
224
221
|
>
|
|
225
222
|
{item.buttonLabel}
|
|
226
|
-
</
|
|
223
|
+
</Button>
|
|
227
224
|
) : (
|
|
228
|
-
<
|
|
229
|
-
className=
|
|
230
|
-
'cursor-pointer min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',
|
|
231
|
-
item.finished ? 'bg-[#767880]' : 'bg-[#080a0f]',
|
|
232
|
-
rounded ? 'rounded-[4px]' : 'rounded-none',
|
|
233
|
-
item.finished && 'opacity-60'
|
|
234
|
-
)}
|
|
225
|
+
<Button
|
|
226
|
+
className="w-full"
|
|
235
227
|
disabled={item.finished}
|
|
236
228
|
onClick={!item.finished ? item.onClick : undefined}
|
|
237
229
|
>
|
|
238
230
|
{item.buttonLabel}
|
|
239
|
-
</
|
|
231
|
+
</Button>
|
|
240
232
|
)}
|
|
241
233
|
</div>
|
|
242
234
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Picture } from '@anker-in/headless-ui'
|
|
1
|
+
import { Button, Picture } from '@anker-in/headless-ui'
|
|
2
2
|
import { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'
|
|
3
3
|
import { useMemberPopupContext } from '../../context/provider'
|
|
4
4
|
import { useReferralOverview } from './hooks/useReferralOverview'
|
|
@@ -107,18 +107,16 @@ function Referral({ copy, onClose }: Props) {
|
|
|
107
107
|
)}
|
|
108
108
|
|
|
109
109
|
{copy.ctaButton && (
|
|
110
|
-
<
|
|
110
|
+
<Button
|
|
111
|
+
size="base"
|
|
112
|
+
as="a"
|
|
111
113
|
href={copy.ctaUrl ? buildRefUrl(copy.ctaUrl) : '#'}
|
|
112
114
|
target="_blank"
|
|
113
115
|
rel="noopener noreferrer"
|
|
114
|
-
className={cn(
|
|
115
|
-
'block w-full mt-[16px] cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white',
|
|
116
|
-
rounded ? 'rounded-[4px]' : 'rounded-none'
|
|
117
|
-
)}
|
|
118
116
|
onClick={trackReferralCta}
|
|
119
117
|
>
|
|
120
118
|
{copy.ctaButton}
|
|
121
|
-
</
|
|
119
|
+
</Button>
|
|
122
120
|
)}
|
|
123
121
|
</div>
|
|
124
122
|
)
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from 'react'
|
|
2
|
-
import { Button, Text } from '@anker-in/headless-ui'
|
|
3
|
-
import { classNames as cn } from '@anker-in/lib'
|
|
4
|
-
import { CreditsModalContainer } from '../../../credits/modal/ModalContainer'
|
|
5
|
-
import type { CompleteProfileCopy } from '../../type'
|
|
6
|
-
import { useUpdateProfile } from './hooks/useUpdateProfile'
|
|
7
|
-
import useCountries from '../../../credits/context/hooks/useCountries'
|
|
8
|
-
import { useMemberPopupContext } from '../../context/provider'
|
|
9
|
-
|
|
10
|
-
type Props = {
|
|
11
|
-
isOpen: boolean
|
|
12
|
-
onClose: () => void
|
|
13
|
-
onSuccess?: () => void
|
|
14
|
-
copy: CompleteProfileCopy
|
|
15
|
-
shopifyStoreDomain?: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function CompleteProfileModal({ isOpen, onClose, onSuccess, copy, shopifyStoreDomain = '' }: Props) {
|
|
19
|
-
const { profile, fetchCreditInfo, alpcConfig } = useMemberPopupContext()
|
|
20
|
-
const { locale } = alpcConfig
|
|
21
|
-
|
|
22
|
-
const [firstName, setFirstName] = useState('')
|
|
23
|
-
const [lastName, setLastName] = useState('')
|
|
24
|
-
const [phone, setPhone] = useState('')
|
|
25
|
-
const [birthDay, setBirthDay] = useState('')
|
|
26
|
-
const [country, setCountry] = useState('')
|
|
27
|
-
const [firstNameError, setFirstNameError] = useState('')
|
|
28
|
-
const [lastNameError, setLastNameError] = useState('')
|
|
29
|
-
|
|
30
|
-
const { updateProfile, isLoading } = useUpdateProfile({ locale, appName: alpcConfig.appName })
|
|
31
|
-
const { countries } = useCountries({ shopifyStoreDomain })
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (profile) {
|
|
35
|
-
setFirstName(profile.first_name ?? '')
|
|
36
|
-
setLastName(profile.last_name ?? '')
|
|
37
|
-
setPhone(profile.phone_number ?? '')
|
|
38
|
-
setBirthDay(profile.dob ?? '')
|
|
39
|
-
setCountry(profile.country?.id ?? '')
|
|
40
|
-
}
|
|
41
|
-
}, [profile])
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (countries.length > 0 && !country) {
|
|
45
|
-
setCountry(countries[0].id)
|
|
46
|
-
}
|
|
47
|
-
}, [countries])
|
|
48
|
-
|
|
49
|
-
const validate = useCallback(() => {
|
|
50
|
-
let hasError = false
|
|
51
|
-
if (!firstName.trim()) {
|
|
52
|
-
setFirstNameError(copy.required)
|
|
53
|
-
hasError = true
|
|
54
|
-
} else {
|
|
55
|
-
setFirstNameError('')
|
|
56
|
-
}
|
|
57
|
-
if (!lastName.trim()) {
|
|
58
|
-
setLastNameError(copy.required)
|
|
59
|
-
hasError = true
|
|
60
|
-
} else {
|
|
61
|
-
setLastNameError('')
|
|
62
|
-
}
|
|
63
|
-
return hasError
|
|
64
|
-
}, [firstName, lastName, copy.required])
|
|
65
|
-
|
|
66
|
-
const handleSubmit = useCallback(async () => {
|
|
67
|
-
if (validate()) return
|
|
68
|
-
const success = await updateProfile({
|
|
69
|
-
first_name: firstName.trim(),
|
|
70
|
-
last_name: lastName.trim(),
|
|
71
|
-
phone_number: phone,
|
|
72
|
-
country,
|
|
73
|
-
dob: birthDay,
|
|
74
|
-
})
|
|
75
|
-
if (success) {
|
|
76
|
-
fetchCreditInfo(profile?.user_id)
|
|
77
|
-
onSuccess?.()
|
|
78
|
-
onClose()
|
|
79
|
-
}
|
|
80
|
-
}, [validate, updateProfile, firstName, lastName, phone, country, birthDay, fetchCreditInfo, profile, onSuccess, onClose])
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<CreditsModalContainer
|
|
84
|
-
isOpen={isOpen}
|
|
85
|
-
onClose={onClose}
|
|
86
|
-
title={copy.title}
|
|
87
|
-
titleClassName="!h-auto !border-b-0 !pb-0"
|
|
88
|
-
className="w-[540px] md:h-auto"
|
|
89
|
-
useAnimation
|
|
90
|
-
animationClassName="md:translate-y-[100vh]"
|
|
91
|
-
>
|
|
92
|
-
<div className="flex flex-col gap-[20px]">
|
|
93
|
-
{copy.subtitle && (
|
|
94
|
-
<Text className="text-[14px] text-[#1d1d1f]" html={copy.subtitle} />
|
|
95
|
-
)}
|
|
96
|
-
|
|
97
|
-
<div>
|
|
98
|
-
<label className="block text-[14px] font-semibold text-[#1d1d1f]">{copy.email}</label>
|
|
99
|
-
<input
|
|
100
|
-
className="mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] bg-[#f5f5f5] px-[12px] text-[14px] text-[#999]"
|
|
101
|
-
value={profile?.email ?? ''}
|
|
102
|
-
disabled
|
|
103
|
-
/>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<div>
|
|
107
|
-
<label className="block text-[14px] font-semibold text-[#1d1d1f]">
|
|
108
|
-
{copy.firstName} <span className="text-[#f84d4f]">*</span>
|
|
109
|
-
</label>
|
|
110
|
-
<input
|
|
111
|
-
className={cn(
|
|
112
|
-
'mt-[8px] h-[46px] w-full rounded-[4px] border px-[12px] text-[14px] outline-none',
|
|
113
|
-
firstNameError ? 'border-[#f84d4f]' : 'border-[#d8d8d8]'
|
|
114
|
-
)}
|
|
115
|
-
value={firstName}
|
|
116
|
-
onChange={e => { setFirstName(e.target.value); setFirstNameError('') }}
|
|
117
|
-
/>
|
|
118
|
-
{firstNameError && <Text className="mt-[4px] text-[12px] text-[#f84d4f]" html={firstNameError} />}
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<div>
|
|
122
|
-
<label className="block text-[14px] font-semibold text-[#1d1d1f]">
|
|
123
|
-
{copy.lastName} <span className="text-[#f84d4f]">*</span>
|
|
124
|
-
</label>
|
|
125
|
-
<input
|
|
126
|
-
className={cn(
|
|
127
|
-
'mt-[8px] h-[46px] w-full rounded-[4px] border px-[12px] text-[14px] outline-none',
|
|
128
|
-
lastNameError ? 'border-[#f84d4f]' : 'border-[#d8d8d8]'
|
|
129
|
-
)}
|
|
130
|
-
value={lastName}
|
|
131
|
-
onChange={e => { setLastName(e.target.value); setLastNameError('') }}
|
|
132
|
-
/>
|
|
133
|
-
{lastNameError && <Text className="mt-[4px] text-[12px] text-[#f84d4f]" html={lastNameError} />}
|
|
134
|
-
</div>
|
|
135
|
-
|
|
136
|
-
<div>
|
|
137
|
-
<label className="block text-[14px] font-semibold text-[#1d1d1f]">{copy.birthday}</label>
|
|
138
|
-
<input
|
|
139
|
-
className="mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none"
|
|
140
|
-
type="date"
|
|
141
|
-
value={birthDay}
|
|
142
|
-
onChange={e => setBirthDay(e.target.value)}
|
|
143
|
-
/>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<div>
|
|
147
|
-
<label className="block text-[14px] font-semibold text-[#1d1d1f]">{copy.phone}</label>
|
|
148
|
-
<input
|
|
149
|
-
className="mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none"
|
|
150
|
-
value={phone}
|
|
151
|
-
onChange={e => setPhone(e.target.value)}
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
154
|
-
|
|
155
|
-
<div>
|
|
156
|
-
<label className="block text-[14px] font-semibold text-[#1d1d1f]">{copy.country}</label>
|
|
157
|
-
<select
|
|
158
|
-
className="mt-[8px] h-[46px] w-full rounded-[4px] border border-[#d8d8d8] px-[12px] text-[14px] outline-none"
|
|
159
|
-
value={country}
|
|
160
|
-
onChange={e => setCountry(e.target.value)}
|
|
161
|
-
>
|
|
162
|
-
{countries.map((c: { id: string; name: string }) => (
|
|
163
|
-
<option key={c.id} value={c.id}>{c.name}</option>
|
|
164
|
-
))}
|
|
165
|
-
</select>
|
|
166
|
-
</div>
|
|
167
|
-
|
|
168
|
-
<div className="flex gap-[12px]">
|
|
169
|
-
<Button
|
|
170
|
-
variant="secondary"
|
|
171
|
-
size="lg"
|
|
172
|
-
className="flex-1"
|
|
173
|
-
onClick={onClose}
|
|
174
|
-
disabled={isLoading}
|
|
175
|
-
>
|
|
176
|
-
{copy.cancel}
|
|
177
|
-
</Button>
|
|
178
|
-
<Button
|
|
179
|
-
variant="primary"
|
|
180
|
-
size="lg"
|
|
181
|
-
className="flex-1"
|
|
182
|
-
loading={isLoading}
|
|
183
|
-
onClick={handleSubmit}
|
|
184
|
-
>
|
|
185
|
-
{copy.save}
|
|
186
|
-
</Button>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
</CreditsModalContainer>
|
|
190
|
-
)
|
|
191
|
-
}
|