@anker-in/campaign-ui 0.5.0-beta.4 → 0.5.0-beta.6
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/credits/context/hooks/useCountries.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useCountries.js.map +3 -3
- package/dist/cjs/components/memberPopup/MemberPopup.js +1 -1
- package/dist/cjs/components/memberPopup/MemberPopup.js.map +3 -3
- package/dist/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.d.ts +10 -0
- package/dist/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.js +2 -0
- package/dist/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +2 -1
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +1 -1
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +3 -3
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js +1 -1
- package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js.map +3 -3
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.d.ts +11 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js +2 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js.map +7 -0
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.js +1 -1
- package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.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 +2 -2
- 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/cjs/components/memberPopup/type.d.ts +14 -2
- package/dist/cjs/components/memberPopup/type.js +1 -1
- package/dist/cjs/components/memberPopup/type.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useCountries.js +1 -1
- package/dist/esm/components/credits/context/hooks/useCountries.js.map +3 -3
- package/dist/esm/components/memberPopup/MemberPopup.js +1 -1
- package/dist/esm/components/memberPopup/MemberPopup.js.map +3 -3
- package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.d.ts +10 -0
- package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.js +2 -0
- package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +2 -1
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +1 -1
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +3 -3
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js +1 -1
- package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js.map +3 -3
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.d.ts +11 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js +2 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js.map +7 -0
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js +1 -1
- package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js.map +2 -2
- package/dist/esm/components/memberPopup/panels/EarnCredits/index.js +1 -1
- package/dist/esm/components/memberPopup/panels/EarnCredits/index.js.map +2 -2
- package/dist/esm/components/memberPopup/panels/Referral/index.js +1 -1
- package/dist/esm/components/memberPopup/panels/Referral/index.js.map +2 -2
- package/dist/esm/components/memberPopup/type.d.ts +14 -2
- package/dist/esm/components/memberPopup/type.js +1 -1
- package/dist/esm/components/memberPopup/type.js.map +2 -2
- package/package.json +1 -1
- package/src/components/credits/context/hooks/useCountries.ts +1 -2
- package/src/components/memberPopup/MemberPopup.tsx +18 -13
- package/src/components/memberPopup/panels/ActivitiesSubscribePanel.tsx +194 -0
- package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.tsx +61 -28
- package/src/components/memberPopup/panels/ConsumeCredits/index.tsx +40 -14
- package/src/components/memberPopup/panels/EarnCredits/index.tsx +94 -64
- package/src/components/memberPopup/panels/Referral/index.tsx +1 -1
- package/src/components/memberPopup/type.ts +10 -1
- package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.tsx +0 -150
- package/src/components/memberPopup/panels/EarnCredits/SubscribeModal.tsx +0 -144
- package/src/components/memberPopup/panels/EarnCredits/SubscribePanel.tsx +0 -147
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/memberPopup/panels/EarnCredits/SubscribeModal.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { Button, Checkbox, Text } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport Cookies from 'js-cookie'\nimport { parse } from 'query-string'\nimport { CreditsModalContainer } from '../../../credits/modal/ModalContainer'\nimport { emailValidate } from '../../../credits/context/utils'\nimport { useMemberPopupContext } from '../../context/provider'\nimport type { SubscribeModalCopy } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n isOpen: boolean\n onClose: () => void\n onSuccess?: () => void\n copy: SubscribeModalCopy\n email?: string\n}\n\nfunction getAdCookie() {\n if (typeof window === 'undefined') return { register_source: '' }\n const { search, href } = window.location\n const query = parse(search)\n return {\n fbuy_ref_code: Cookies.get('fbuy_ref_code'),\n ref: Cookies.get('ref_ads'),\n inviter_code: query.ic ?? query.inviter_code ?? Cookies.get('inviter_code'),\n register_source: query.redirect ?? Cookies.get('reg_source') ?? href,\n }\n}\n\nasync function getRecaptchaToken(sitekey: string): Promise<string> {\n if (typeof window === 'undefined' || !window?.grecaptcha?.execute) return ''\n if (!sitekey) return ''\n try {\n return await window.grecaptcha.execute(sitekey, { action: 'activity' })\n } catch {\n return ''\n }\n}\n\nexport function EarnCreditsSubscribeModal({ isOpen, onClose, onSuccess, copy, email: initialEmail }: Props) {\n const { alpcConfig } = useMemberPopupContext()\n const { locale } = alpcConfig\n const { brand: headlessBrand, storeDomain, recaptchaSitekey } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(headlessBrand)\n const [policy, setPolicy] = useState(false)\n const [email, setEmail] = useState(initialEmail ?? '')\n const [errorMessage, setErrorMessage] = useState('')\n const [successMessage, setSuccessMessage] = useState('')\n const [loading, setLoading] = useState(false)\n\n useEffect(() => {\n if (initialEmail) setEmail(initialEmail)\n }, [initialEmail])\n\n const handleSubmit = useCallback(async () => {\n setErrorMessage('')\n if (!email) return setErrorMessage('Please fill in your email')\n if (!emailValidate(email)) return setErrorMessage('Invalid email address')\n if (!policy) return setErrorMessage('Please agree to the policy')\n\n setLoading(true)\n const { register_source } = getAdCookie()\n const recaptchaToken = await getRecaptchaToken(recaptchaSitekey || '')\n try {\n const response = await fetch('/api/multipass/rainbowbridge/activities', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'current-language': locale,\n 'X-Recaptcha-Token': recaptchaToken,\n },\n body: JSON.stringify({\n email,\n register_source,\n shopify_domain: storeDomain,\n single_brand_subscribe: copy.single_brand_subscribe ?? true,\n genre: copy.genre ?? copy.dealsType ?? '',\n sub_brand_type: copy.sub_brand_type ?? '',\n }),\n })\n const result = await response.json()\n if (!result.errors) {\n setSuccessMessage(copy.successTips ?? 'Subscribed successfully!')\n onSuccess?.()\n setTimeout(() => {\n setSuccessMessage('')\n onClose()\n }, 3000)\n } else {\n setErrorMessage(result.errors ?? 'Error occurred')\n }\n } catch {\n setErrorMessage('Network error')\n } finally {\n setLoading(false)\n }\n }, [email, policy, locale, storeDomain, copy, onSuccess, onClose])\n\n return (\n <CreditsModalContainer\n isOpen={isOpen}\n onClose={onClose}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] md:mb-[24px]\"\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n >\n <div className=\"flex flex-col gap-[16px] text-center\">\n <Text className=\"text-[22px] font-bold\" html={copy.title} />\n {copy.desc &&
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { Button, Checkbox, Text } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport Cookies from 'js-cookie'\nimport { parse } from 'query-string'\nimport { CreditsModalContainer } from '../../../credits/modal/ModalContainer'\nimport { emailValidate } from '../../../credits/context/utils'\nimport { useMemberPopupContext } from '../../context/provider'\nimport type { SubscribeModalCopy } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n isOpen: boolean\n onClose: () => void\n onSuccess?: () => void\n copy: SubscribeModalCopy\n email?: string\n}\n\nfunction getAdCookie() {\n if (typeof window === 'undefined') return { register_source: '' }\n const { search, href } = window.location\n const query = parse(search)\n return {\n fbuy_ref_code: Cookies.get('fbuy_ref_code'),\n ref: Cookies.get('ref_ads'),\n inviter_code: query.ic ?? query.inviter_code ?? Cookies.get('inviter_code'),\n register_source: query.redirect ?? Cookies.get('reg_source') ?? href,\n }\n}\n\nasync function getRecaptchaToken(sitekey: string): Promise<string> {\n if (typeof window === 'undefined' || !window?.grecaptcha?.execute) return ''\n if (!sitekey) return ''\n try {\n return await window.grecaptcha.execute(sitekey, { action: 'activity' })\n } catch {\n return ''\n }\n}\n\nexport function EarnCreditsSubscribeModal({ isOpen, onClose, onSuccess, copy, email: initialEmail }: Props) {\n const { alpcConfig } = useMemberPopupContext()\n const { locale } = alpcConfig\n const { brand: headlessBrand, storeDomain, recaptchaSitekey } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(headlessBrand)\n const [policy, setPolicy] = useState(false)\n const [email, setEmail] = useState(initialEmail ?? '')\n const [errorMessage, setErrorMessage] = useState('')\n const [successMessage, setSuccessMessage] = useState('')\n const [loading, setLoading] = useState(false)\n\n useEffect(() => {\n if (initialEmail) setEmail(initialEmail)\n }, [initialEmail])\n\n console.log('copy', copy)\n\n const handleSubmit = useCallback(async () => {\n setErrorMessage('')\n if (!email) return setErrorMessage('Please fill in your email')\n if (!emailValidate(email)) return setErrorMessage('Invalid email address')\n if (!policy) return setErrorMessage('Please agree to the policy')\n\n setLoading(true)\n const { register_source } = getAdCookie()\n const recaptchaToken = await getRecaptchaToken(recaptchaSitekey || '')\n try {\n const response = await fetch('/api/multipass/rainbowbridge/activities', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'current-language': locale,\n 'X-Recaptcha-Token': recaptchaToken,\n },\n body: JSON.stringify({\n email,\n register_source,\n shopify_domain: storeDomain,\n single_brand_subscribe: copy.single_brand_subscribe ?? true,\n genre: copy.genre ?? copy.dealsType ?? '',\n sub_brand_type: copy.sub_brand_type ?? '',\n }),\n })\n const result = await response.json()\n if (!result.errors) {\n setSuccessMessage(copy.successTips ?? 'Subscribed successfully!')\n onSuccess?.()\n setTimeout(() => {\n setSuccessMessage('')\n onClose()\n }, 3000)\n } else {\n setErrorMessage(result.errors ?? 'Error occurred')\n }\n } catch {\n setErrorMessage('Network error')\n } finally {\n setLoading(false)\n }\n }, [email, policy, locale, storeDomain, copy, onSuccess, onClose])\n\n return (\n <CreditsModalContainer\n isOpen={isOpen}\n onClose={onClose}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] md:mb-[24px]\"\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n >\n <div className=\"flex flex-col gap-[16px] text-center\">\n <Text className=\"text-[22px] font-bold\" html={copy.title} />\n {copy.desc && <Text className=\"text-left text-[16px] font-semibold text-[#1f2021]\" html={copy.desc} />}\n <div\n className={cn(\n 'flex h-[52px] w-full overflow-hidden md:flex-col md:h-auto md:gap-[16px]',\n rounded ? 'rounded-[2px]' : 'rounded-none'\n )}\n >\n <input\n className={cn(\n 'h-full flex-1 border border-[#d8d8d8] px-[14px] text-[16px] outline-none placeholder:text-[#999] md:h-[52px]',\n rounded ? 'rounded-l-[2px] md:rounded-[2px]' : 'rounded-none'\n )}\n placeholder={copy.placeholder}\n value={email}\n onChange={e => {\n setErrorMessage('')\n setEmail(e.target.value.trim())\n }}\n />\n <Button\n variant=\"primary\"\n loading={loading}\n className={cn(\n '!h-full !min-w-0 !px-[24px] md:!h-[46px]',\n rounded ? '!rounded-l-none !rounded-r-[2px] md:!rounded-[2px]' : '!rounded-none'\n )}\n onClick={handleSubmit}\n >\n {copy.buttonLabel ?? 'Subscribe'}\n </Button>\n </div>\n <div className=\"flex w-full items-start gap-[8px]\">\n <Checkbox checked={policy} onCheckedChange={() => setPolicy(v => !v)} className=\"border-[#1d1d1f]\" />\n <label\n className=\"text-left text-[14px] font-semibold text-[#777] [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: copy.policy ?? '' }}\n />\n </div>\n {copy.promo && (\n <div className=\"border-t border-[#e5e5e5] pt-[16px]\">\n <div className=\"flex items-center gap-[12px]\">\n <div className=\"flex flex-1 flex-col gap-[8px] text-left\">\n {copy.promo.title && <p className=\"text-[14px] font-[700] text-[#080a0f]\">{copy.promo.title}</p>}\n {copy.promo.description && (\n <p className=\"text-[12px] font-[400] leading-[18px] text-[#666]\">{copy.promo.description}</p>\n )}\n {copy.promo.learnMoreLabel && (\n <a\n href={copy.promo.learnMoreUrl ?? '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-[4px] text-[12px] font-[600] text-[#080a0f] underline-offset-2 hover:underline\"\n >\n {copy.promo.learnMoreLabel}\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M4.5 2.5L7.5 6L4.5 9.5\"\n stroke=\"#080a0f\"\n strokeWidth=\"1.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </a>\n )}\n </div>\n {copy.promo.image?.url && (\n <img\n src={copy.promo.image.url}\n alt={copy.promo.image.alt ?? ''}\n className=\"h-[80px] w-[100px] flex-shrink-0 rounded-[8px] object-cover\"\n />\n )}\n </div>\n </div>\n )}\n <div\n className={cn(\n 'text-left text-[16px] font-semibold',\n errorMessage && 'text-[#f84d4f]',\n successMessage && 'text-[#52c41a]'\n )}\n >\n <Text html={successMessage || errorMessage || ''} />\n </div>\n </div>\n </CreditsModalContainer>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAgHQ,cAAAA,EAEA,QAAAC,MAFA,oBAhHR,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QACjD,OAAS,UAAAC,EAAQ,YAAAC,EAAU,QAAAC,MAAY,wBACvC,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,OAAOC,MAAa,YACpB,OAAS,SAAAC,MAAa,eACtB,OAAS,yBAAAC,MAA6B,wCACtC,OAAS,iBAAAC,MAAqB,iCAC9B,OAAS,yBAAAC,MAA6B,yBAEtC,OAAS,kBAAAC,MAAsB,wBAU/B,SAASC,GAAc,CACrB,GAAI,OAAO,OAAW,IAAa,MAAO,CAAE,gBAAiB,EAAG,EAChE,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAK,EAAI,OAAO,SAC1BC,EAAQR,EAAMM,CAAM,EAC1B,MAAO,CACL,cAAeP,EAAQ,IAAI,eAAe,EAC1C,IAAKA,EAAQ,IAAI,SAAS,EAC1B,aAAcS,EAAM,IAAMA,EAAM,cAAgBT,EAAQ,IAAI,cAAc,EAC1E,gBAAiBS,EAAM,UAAYT,EAAQ,IAAI,YAAY,GAAKQ,CAClE,CACF,CAEA,eAAeE,EAAkBC,EAAkC,CAEjE,GADI,OAAO,OAAW,KAAe,CAAC,QAAQ,YAAY,SACtD,CAACA,EAAS,MAAO,GACrB,GAAI,CACF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AAUc,GAAK,CAACA,CAAC,EAAG,UAAU,mBAAmB,EACnGjD,EAAC,SACC,UAAU,kEACV,wBAAyB,CAAE,OAAQ0B,EAAK,QAAU,EAAG,EACvD,GACF,EACCA,EAAK,OACJ1B,EAAC,OAAI,UAAU,sCACb,SAAAC,EAAC,OAAI,UAAU,+BACb,UAAAA,EAAC,OAAI,UAAU,2CACZ,UAAAyB,EAAK,MAAM,OAAS1B,EAAC,KAAE,UAAU,wCAAyC,SAAA0B,EAAK,MAAM,MAAM,EAC3FA,EAAK,MAAM,aACV1B,EAAC,KAAE,UAAU,oDAAqD,SAAA0B,EAAK,MAAM,YAAY,EAE1FA,EAAK,MAAM,gBACVzB,EAAC,KACC,KAAMyB,EAAK,MAAM,cAAgB,IACjC,OAAO,SACP,IAAI,sBACJ,UAAU,uGAET,UAAAA,EAAK,MAAM,eACZ1B,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAChE,SAAAA,EAAC,QACC,EAAE,yBACF,OAAO,UACP,YAAY,MACZ,cAAc,QACd,eAAe,QACjB,EACF,GACF,GAEJ,EACC0B,EAAK,MAAM,OAAO,KACjB1B,EAAC,OACC,IAAK0B,EAAK,MAAM,MAAM,IACtB,IAAKA,EAAK,MAAM,MAAM,KAAO,GAC7B,UAAU,8DACZ,GAEJ,EACF,EAEF1B,EAAC,OACC,UAAWQ,EACT,sCACA8B,GAAgB,iBAChBE,GAAkB,gBACpB,EAEA,SAAAxC,EAACO,EAAA,CAAK,KAAMiC,GAAkBF,GAAgB,GAAI,EACpD,GACF,EACF,CAEJ",
|
|
6
6
|
"names": ["jsx", "jsxs", "useCallback", "useEffect", "useState", "Button", "Checkbox", "Text", "cn", "useHeadlessContext", "Cookies", "parse", "CreditsModalContainer", "emailValidate", "useMemberPopupContext", "ROUNDED_BRANDS", "getAdCookie", "search", "href", "query", "getRecaptchaToken", "sitekey", "EarnCreditsSubscribeModal", "isOpen", "onClose", "onSuccess", "copy", "initialEmail", "alpcConfig", "locale", "headlessBrand", "storeDomain", "recaptchaSitekey", "rounded", "policy", "setPolicy", "email", "setEmail", "errorMessage", "setErrorMessage", "successMessage", "setSuccessMessage", "loading", "setLoading", "handleSubmit", "register_source", "recaptchaToken", "result", "e", "v"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useMemo as
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useMemo as m}from"react";import{classNames as c,useHeadlessContext as A}from"@anker-in/lib";import{useMemberPopupContext as B}from"../../context/provider";import{useViewStack as U}from"../../context/viewStack";import{useSubscribed as D}from"./hooks/useSubscribed";import{EarnCreditsTaskType as i,MemberPopupPanelType as b}from"../../type";import{IconBag as M,IconLock as R,IconSubscription as y,IconOrders as F}from"../../icons";import{numberFormat as L}from"../../../credits/context/utils";import{ROUNDED_BRANDS as O}from"../../../../constants";function V({id:t,className:a}){switch(t){case i.Activate:return e(R,{className:a});case i.Subscribe:return e(y,{className:a});case i.Shop:return e(M,{className:a});case i.CompleteProfile:return e(F,{className:a})}}function z({copy:t,onClose:a,isSubscribeSuccess:v=!1,isActivateSuccess:g=!1,isProfileCompleteSuccess:f=!1,onSubscribeSuccess:w,onActivateSuccess:P,onProfileCompleteSuccess:E}){const{profile:o,openSignUpPopup:d,alpcConfig:N,creditInfo:x}=B(),{pushView:p}=U(),{locale:T}=N,{brand:h}=A(),u=O.includes(h);console.log("creditInfo",x);const l=!!o,C=D({userId:o?.user_id,brand:h,email:o?.email,locale:T,apiBaseUrl:N.apiBaseUrl}),k=m(()=>f||!!(o?.first_name||o?.last_name)&&!!o?.phone_number&&!!o?.dob,[o,f]),S=m(()=>({[i.Activate]:{finished:!!o?.activated||g,onClick:l?()=>p({type:b.Activate,props:{onSuccess:P}}):d},[i.CompleteProfile]:{finished:k,onClick:l?()=>p({type:b.CompleteProfile,props:{onSuccess:E}}):d},[i.Subscribe]:{finished:C||v,onClick:l?()=>p({type:b.SubscribeEmail,props:{onSuccess:w}}):d},[i.Shop]:{finished:!1,link:t.goShopLink,onClick:l?void 0:d}}),[o,l,g,f,k,C,v,d,p,t.goShopLink]),I=m(()=>t.list.map(s=>{const r=S[s.id];if(!r)return null;const _=r.finished?t.completed:l?H(s.id,t):t.joinNow;return{...s,...r,buttonLabel:_}}).filter(Boolean),[t,S,l]);return n("div",{className:"flex flex-col gap-[16px]",children:[n("div",{className:"flex flex-col gap-[16px]",children:[e("div",{className:"flex flex-col gap-[8px]",children:t.title&&e("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:t.title})}),l&&n("div",{className:c("flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]",u?"rounded-[8px]":"rounded-none"),children:[n("div",{className:"flex flex-1 flex-col gap-[4px]",children:[e("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:t.balanceLabel??"AnkerCredits Balance"}),n("div",{className:"flex items-end gap-[4px]",children:[e("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:L(x?.available_credit??0)}),e("span",{className:"text-[14px] font-[700] leading-[1.4] text-[#1e2024]",children:t.creditUnit??"ankercredits"})]})]}),e("div",{className:"h-full w-px bg-[#dadce0]"}),n("div",{className:"flex flex-1 flex-col gap-[4px]",children:[e("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:t.comingSoonLabel??"Coming Soon"}),n("div",{className:"flex items-end gap-[4px]",children:[e("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:L(x?.pending_credit??0)}),e("span",{className:"text-[14px] font-[700] leading-[1.4] text-[#1e2024]",children:t.creditUnit??"ankercredits"})]})]})]})]}),n("div",{className:"flex flex-col gap-[16px]",children:[t.subtitle&&e("p",{className:"text-[16px] font-[700] text-[#1e2024]",children:t.subtitle}),e("div",{className:"flex flex-col",children:I.map((s,r)=>n("div",{className:"relative py-[16px]",children:[r>0&&e("div",{className:"absolute left-0 right-0 top-0 h-px bg-[#dadce0]"}),n("div",{className:c("flex items-center gap-[12px]",s.finished&&"opacity-60"),children:[e(V,{id:s.id,className:"size-[24px] shrink-0"}),n("div",{className:"flex-1",children:[e("div",{className:"text-[16px] font-[700] text-[#1e2024]",children:s.title}),s.description&&e("div",{className:"mt-[4px] text-[14px] font-[700] text-[#4a4c56]",children:s.description})]}),!s.finished&&s.link?e("a",{href:s.link,target:"_blank",rel:"noopener noreferrer",className:c("cursor-pointer bg-[#080a0f] min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white",u?"rounded-[4px]":"rounded-none"),children:s.buttonLabel}):e("button",{className:c("cursor-pointer min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white",s.finished?"bg-[#767880]":"bg-[#080a0f]",u?"rounded-[4px]":"rounded-none"),disabled:s.finished,onClick:s.finished?void 0:s.onClick,children:s.buttonLabel})]})]},r))})]})]})}function H(t,a){switch(t){case i.Activate:return a.activate;case i.CompleteProfile:return a.completeProfileLabel;case i.Subscribe:return a.subscribeLabel;case i.Shop:return a.shopNow}}var Z=z;export{Z 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/EarnCredits/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react'\nimport { 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 onClose: () => void\n isSubscribeSuccess?: boolean\n isActivateSuccess?: boolean\n isProfileCompleteSuccess?: boolean\n onSubscribeSuccess?: () => void\n onActivateSuccess?: () => void\n onProfileCompleteSuccess?: () => void\n}\n\nfunction EarnCredits({\n copy,\n onClose,\n isSubscribeSuccess = false,\n isActivateSuccess = false,\n isProfileCompleteSuccess = false,\n onSubscribeSuccess,\n onActivateSuccess,\n onProfileCompleteSuccess,\n}: Props) {\n const { profile, openSignUpPopup, alpcConfig, creditInfo } = useMemberPopupContext()\n const { pushView } = useViewStack()\n const { locale } = alpcConfig\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const isLogin = !!profile\n\n const isSubscribed = useSubscribed({\n userId: profile?.user_id,\n brand:
|
|
5
|
-
"mappings": "AAaa,cAAAA,
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react'\nimport { 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 onClose: () => void\n isSubscribeSuccess?: boolean\n isActivateSuccess?: boolean\n isProfileCompleteSuccess?: boolean\n onSubscribeSuccess?: () => void\n onActivateSuccess?: () => void\n onProfileCompleteSuccess?: () => void\n}\n\nfunction EarnCredits({\n copy,\n onClose,\n isSubscribeSuccess = false,\n isActivateSuccess = false,\n isProfileCompleteSuccess = false,\n onSubscribeSuccess,\n onActivateSuccess,\n onProfileCompleteSuccess,\n}: Props) {\n const { profile, openSignUpPopup, alpcConfig, creditInfo } = useMemberPopupContext()\n const { pushView } = useViewStack()\n const { locale } = alpcConfig\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n console.log('creditInfo', creditInfo)\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 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 pushView({\n type: MemberPopupPanelType.Activate,\n props: { onSuccess: onActivateSuccess },\n })\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.CompleteProfile]: {\n finished: profileCompleted,\n onClick: isLogin\n ? () =>\n pushView({\n type: MemberPopupPanelType.CompleteProfile,\n props: { onSuccess: onProfileCompleteSuccess },\n })\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Subscribe]: {\n finished: isSubscribed || isSubscribeSuccess,\n onClick: isLogin\n ? () =>\n pushView({\n type: MemberPopupPanelType.SubscribeEmail,\n props: { onSuccess: onSubscribeSuccess },\n })\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Shop]: {\n finished: false,\n link: copy.goShopLink,\n onClick: isLogin ? undefined : 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]', item.finished && 'opacity-60')}>\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.description && (\n <div className=\"mt-[4px] text-[14px] font-[700] text-[#4a4c56]\">{item.description}</div>\n )}\n </div>\n {!item.finished && item.link ? (\n <a\n href={item.link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'cursor-pointer bg-[#080a0f] min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n >\n {item.buttonLabel}\n </a>\n ) : (\n <button\n className={cn(\n 'cursor-pointer min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',\n item.finished ? 'bg-[#767880]' : 'bg-[#080a0f]',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\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 default EarnCredits\n"],
|
|
5
|
+
"mappings": "AAaa,cAAAA,EAgJC,QAAAC,MAhJD,oBAbb,OAAS,WAAAC,MAAe,QACxB,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,OAAS,yBAAAC,MAA6B,yBACtC,OAAS,gBAAAC,MAAoB,0BAC7B,OAAS,iBAAAC,MAAqB,wBAC9B,OAAS,uBAAAC,EAAqB,wBAAAC,MAAkD,aAChF,OAAS,WAAAC,EAAS,YAAAC,EAAU,oBAAAC,EAAkB,cAAAC,MAAkB,cAChE,OAAS,gBAAAC,MAAoB,iCAC7B,OAAS,kBAAAC,MAAsB,wBAE/B,SAASC,EAAS,CAAE,GAAAC,EAAI,UAAAC,CAAU,EAAoD,CACpF,OAAQD,EAAI,CACV,KAAKT,EAAoB,SACvB,OAAOR,EAACW,EAAA,CAAS,UAAWO,EAAW,EACzC,KAAKV,EAAoB,UACvB,OAAOR,EAACY,EAAA,CAAiB,UAAWM,EAAW,EACjD,KAAKV,EAAoB,KACvB,OAAOR,EAACU,EAAA,CAAQ,UAAWQ,EAAW,EACxC,KAAKV,EAAoB,gBACvB,OAAOR,EAACa,EAAA,CAAW,UAAWK,EAAW,CAC7C,CACF,CAaA,SAASC,EAAY,CACnB,KAAAC,EACA,QAAAC,EACA,mBAAAC,EAAqB,GACrB,kBAAAC,EAAoB,GACpB,yBAAAC,EAA2B,GAC3B,mBAAAC,EACA,kBAAAC,EACA,yBAAAC,CACF,EAAU,CACR,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,WAAAC,EAAY,WAAAC,CAAW,EAAI1B,EAAsB,EAC7E,CAAE,SAAA2B,CA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SAAS,EAEtFpB,EAAC,OAAI,UAAU,gBACZ,SAAAwC,EAAK,IAAI,CAACC,EAAMI,IACf5C,EAAC,OAAc,UAAU,qBACtB,UAAA4C,EAAM,GAAK7C,EAAC,OAAI,UAAU,kDAAkD,EAC7EC,EAAC,OAAI,UAAWE,EAAG,+BAAgCsC,EAAK,UAAY,YAAY,EAC9E,UAAAzC,EAACgB,EAAA,CAAS,GAAIyB,EAAK,GAAI,UAAU,uBAAuB,EACxDxC,EAAC,OAAI,UAAU,SACb,UAAAD,EAAC,OAAI,UAAU,wCAAyC,SAAAyC,EAAK,MAAM,EAClEA,EAAK,aACJzC,EAAC,OAAI,UAAU,iDAAkD,SAAAyC,EAAK,YAAY,GAEtF,EACC,CAACA,EAAK,UAAYA,EAAK,KACtBzC,EAAC,KACC,KAAMyC,EAAK,KACX,OAAO,SACP,IAAI,sBACJ,UAAWtC,EACT,0HACAgC,EAAU,gBAAkB,cAC9B,EAEC,SAAAM,EAAK,YACR,EAEAzC,EAAC,UACC,UAAWG,EACT,6GACAsC,EAAK,SAAW,eAAiB,eACjCN,EAAU,gBAAkB,cAC9B,EACA,SAAUM,EAAK,SACf,QAAUA,EAAK,SAA0B,OAAfA,EAAK,QAE9B,SAAAA,EAAK,YACR,GAEJ,IAnCQI,CAoCV,CACD,EACH,GACF,GACF,CAEJ,CAEA,SAASD,EAAoB3B,EAAyBG,EAA+B,CACnF,OAAQH,EAAI,CACV,KAAKT,EAAoB,SACvB,OAAOY,EAAK,SACd,KAAKZ,EAAoB,gBACvB,OAAOY,EAAK,qBACd,KAAKZ,EAAoB,UACvB,OAAOY,EAAK,eACd,KAAKZ,EAAoB,KACvB,OAAOY,EAAK,OAChB,CACF,CAEA,IAAO0B,EAAQ3B",
|
|
6
6
|
"names": ["jsx", "jsxs", "useMemo", "cn", "useHeadlessContext", "useMemberPopupContext", "useViewStack", "useSubscribed", "EarnCreditsTaskType", "MemberPopupPanelType", "IconBag", "IconLock", "IconSubscription", "IconOrders", "numberFormat", "ROUNDED_BRANDS", "TaskIcon", "id", "className", "EarnCredits", "copy", "onClose", "isSubscribeSuccess", "isActivateSuccess", "isProfileCompleteSuccess", "onSubscribeSuccess", "onActivateSuccess", "onProfileCompleteSuccess", "profile", "openSignUpPopup", "alpcConfig", "creditInfo", "pushView", "locale", "brand", "rounded", "isLogin", "isSubscribed", "profileCompleted", "taskStates", "list", "item", "state", "buttonLabel", "getNotFinishedLabel", "idx", "EarnCredits_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as a,jsxs as t}from"react/jsx-runtime";import{Picture as m}from"@anker-in/headless-ui";import{classNames as n,useHeadlessContext as g}from"@anker-in/lib";import{useMemberPopupContext as u}from"../../context/provider";import{useReferralOverview as h}from"./hooks/useReferralOverview";import{formatPrice as x}from"../../../credits/context/utils";import{ROUNDED_BRANDS as v}from"../../../../constants";function N({copy:e,onClose:b}){const{profile:f,alpcConfig:r}=u(),c=!!f,{brand:p,currencyCode:s="USD"}=g(),o=v.includes(p),{data:l}=h(),i=l?.data?.data?.available??0,d=l?.data?.data?.pending??0;return console.log("cashAvailable",i),console.log("cashPending",d),console.log("data",l),console.log("data.data",l?.data),t("div",{className:"flex flex-col gap-[12px]",children:[e.title&&a("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:e.title}),c&&t("div",{className:n("flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]",o?"rounded-[8px]":"rounded-none"),children:[t("div",{className:"flex flex-1 flex-col gap-[4px]",children:[a("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashAvailableLabel}),a("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:x({amount:i,currencyCode:s,locale:r.locale})})]}),a("div",{className:"h-full w-px self-stretch bg-[#dadce0]"}),t("div",{className:"flex flex-1 flex-col gap-[4px]",children:[a("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashPendingLabel}),a("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:x({amount:d,currencyCode:s,locale:r.locale})})]})]}),(e.howToTitle||e.howToDescription)&&t("div",{className:"flex flex-col gap-[8px]",children:[e.howToTitle&&a("h3",{className:"text-[20px] font-[700] leading-[1.2] text-[#080a0f]",children:e.howToTitle}),e.howToDescription&&a("p",{className:"text-[14px] leading-[1.5] text-[#1e2024]",children:e.howToDescription}),e.learnMoreLabel&&e.learnMoreUrl&&t("a",{href:e.learnMoreUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline",children:[e.learnMoreLabel,a("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:a("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&&a(m,{source:e.image.url,alt:e.image.alt??"",className:n("h-[100px] w-full object-cover",o?"rounded-[8px]":"rounded-none")}),e.ctaButton&&a("a",{href:e.ctaUrl??"#",target:"_blank",rel:"noopener noreferrer",className:n("block w-full cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white",o?"rounded-[4px]":"rounded-none"),children:e.ctaButton})]})}var M=N;export{M as default};
|
|
1
|
+
import{jsx as a,jsxs as t}from"react/jsx-runtime";import{Picture as m}from"@anker-in/headless-ui";import{classNames as n,useHeadlessContext as g}from"@anker-in/lib";import{useMemberPopupContext as u}from"../../context/provider";import{useReferralOverview as h}from"./hooks/useReferralOverview";import{formatPrice as x}from"../../../credits/context/utils";import{ROUNDED_BRANDS as v}from"../../../../constants";function N({copy:e,onClose:b}){const{profile:f,alpcConfig:r}=u(),c=!!f,{brand:p,currencyCode:s="USD"}=g(),o=v.includes(p),{data:l}=h(),i=l?.data?.data?.available??0,d=l?.data?.data?.pending??0;return console.log("cashAvailable",i),console.log("cashPending",d),console.log("data",l),console.log("data.data",l?.data),t("div",{className:"flex flex-col gap-[12px]",children:[e.title&&a("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:e.title}),c&&t("div",{className:n("flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]",o?"rounded-[8px]":"rounded-none"),children:[t("div",{className:"flex flex-1 flex-col gap-[4px]",children:[a("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashAvailableLabel}),a("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:x({amount:i,currencyCode:s,locale:r.locale})})]}),a("div",{className:"h-full w-px self-stretch bg-[#dadce0]"}),t("div",{className:"flex flex-1 flex-col gap-[4px]",children:[a("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashPendingLabel}),a("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:x({amount:d,currencyCode:s,locale:r.locale})})]})]}),(e.howToTitle||e.howToDescription)&&t("div",{className:"flex flex-col gap-[8px]",children:[e.howToTitle&&a("h3",{className:"text-[20px] font-[700] leading-[1.2] text-[#080a0f]",children:e.howToTitle}),e.howToDescription&&a("p",{className:"text-[14px] leading-[1.5] text-[#1e2024]",children:e.howToDescription}),e.learnMoreLabel&&e.learnMoreUrl&&t("a",{href:e.learnMoreUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline",children:[e.learnMoreLabel,a("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:a("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&&a(m,{source:e.image.url,alt:e.image.alt??"",className:n("mt-[8px] h-[100px] w-full object-cover",o?"rounded-[8px]":"rounded-none")}),e.ctaButton&&a("a",{href:e.ctaUrl??"#",target:"_blank",rel:"noopener noreferrer",className:n("block w-full cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white",o?"rounded-[4px]":"rounded-none"),children:e.ctaButton})]})}var M=N;export{M 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 { 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 } = 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 console.log('cashAvailable', cashAvailable)\n console.log('cashPending', cashPending)\n console.log('data', data)\n console.log('data.data', data?.data)\n\n return (\n <div className=\"flex flex-col gap-[12px]\">\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 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 flex-col gap-[8px]\">\n {copy.howToTitle && (\n <h3 className=\"text-[20px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.howToTitle}</h3>\n )}\n {copy.howToDescription && <p className=\"text-[14px] leading-[1.5] text-[#1e2024]\">{copy.howToDescription}</p>}\n {copy.learnMoreLabel && copy.learnMoreUrl && (\n <a\n href={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('h-[100px] w-full object-cover', rounded ? 'rounded-[8px]' : 'rounded-none')}\n />\n )}\n\n {copy.ctaButton && (\n <a\n href={copy.ctaUrl ?? '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'block w-full cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n >\n {copy.ctaButton}\n </a>\n )}\n </div>\n )\n}\n\nexport default Referral\n"],
|
|
5
|
-
"mappings": "AAgCqB,cAAAA,EASX,QAAAC,MATW,oBAhCrB,OAAS,WAAAC,MAAe,wBACxB,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,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,CAAW,EAAIR,EAAsB,EAChDS,EAAU,CAAC,CAACF,EACZ,CAAE,MAAAG,EAAO,aAAAC,EAAe,KAAgB,EAAIZ,EAAmB,EAC/Da,EAAUT,EAAe,SAASO,CAAK,EAEvC,CAAE,KAAAG,CAAK,EAAIZ,EAAoB,EAE/Ba,EAAgBD,GAAM,MAAM,MAAM,WAAa,EAC/CE,EAAcF,GAAM,MAAM,MAAM,SAAW,EAEjD,eAAQ,IAAI,gBAAiBC,CAAa,EAC1C,QAAQ,IAAI,cAAeC,CAAW,EACtC,QAAQ,IAAI,OAAQF,CAAI,EACxB,QAAQ,IAAI,YAAaA,GAAM,IAAI,EAGjCjB,EAAC,OAAI,UAAU,2BACZ,UAAAS,EAAK,OAASV,EAAC,MAAG,UAAU,sDAAuD,SAAAU,EAAK,MAAM,EAE9FI,GACCb,EAAC,OACC,UAAWE,EACT,qDACAc,EAAU,gBAAkB,cAC9B,EAEA,UAAAhB,EAAC,OAAI,UAAU,iCACb,UAAAD,EAAC,OAAI,UAAU,wCAAyC,SAAAU,EAAK,mBAAmB,EAChFV,EAAC,QAAK,UAAU,sDACb,SAAAO,EAAY,CAAE,OAAQY,EAAe,aAAAH,EAAc,OAAQH,EAAW,MAAO,CAAC,EACjF,GACF,EACAb,EAAC,OAAI,UAAU,wCAAwC,EACvDC,EAAC,OAAI,UAAU,iCACb,UAAAD,EAAC,OAAI,UAAU,wCAAyC,SAAAU,EAAK,iBAAiB,EAC9EV,EAAC,QAAK,UAAU,sDACb,SAAAO,EAAY,CAAE,OAAQa,EAAa,aAAAJ,EAAc,OAAQH,EAAW,MAAO,CAAC,EAC/E,GACF,GACF,GAGAH,EAAK,YAAcA,EAAK,mBACxBT,EAAC,OAAI,UAAU,0BACZ,UAAAS,EAAK,YACJV,EAAC,MAAG,UAAU,sDAAuD,SAAAU,EAAK,WAAW,EAEtFA,EAAK,kBAAoBV,EAAC,KAAE,UAAU,2CAA4C,SAAAU,EAAK,iBAAiB,EACxGA,EAAK,gBAAkBA,EAAK,cAC3BT,EAAC,KACC,KAAMS,EAAK,aACX,OAAO,SACP,IAAI,sBACJ,UAAU,8EAET,UAAAA,EAAK,eACNV,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACnD,SAAAA,EAAC,QACC,EAAE,kUACF,KAAK,UACP,EACF,GACF,GAEJ,EAGDU,EAAK,OAAO,KACXV,EAACE,EAAA,CACC,OAAQQ,EAAK,MAAM,IACnB,IAAKA,EAAK,MAAM,KAAO,GACvB,UAAWP,EAAG,
|
|
4
|
+
"sourcesContent": ["import { Picture } from '@anker-in/headless-ui'\nimport { 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 } = 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 console.log('cashAvailable', cashAvailable)\n console.log('cashPending', cashPending)\n console.log('data', data)\n console.log('data.data', data?.data)\n\n return (\n <div className=\"flex flex-col gap-[12px]\">\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 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 flex-col gap-[8px]\">\n {copy.howToTitle && (\n <h3 className=\"text-[20px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.howToTitle}</h3>\n )}\n {copy.howToDescription && <p className=\"text-[14px] leading-[1.5] text-[#1e2024]\">{copy.howToDescription}</p>}\n {copy.learnMoreLabel && copy.learnMoreUrl && (\n <a\n href={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] h-[100px] w-full object-cover', rounded ? 'rounded-[8px]' : 'rounded-none')}\n />\n )}\n\n {copy.ctaButton && (\n <a\n href={copy.ctaUrl ?? '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'block w-full cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n >\n {copy.ctaButton}\n </a>\n )}\n </div>\n )\n}\n\nexport default Referral\n"],
|
|
5
|
+
"mappings": "AAgCqB,cAAAA,EASX,QAAAC,MATW,oBAhCrB,OAAS,WAAAC,MAAe,wBACxB,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,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,CAC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AAAU,EAAK,iBAAiB,EACxGA,EAAK,gBAAkBA,EAAK,cAC3BT,EAAC,KACC,KAAMS,EAAK,aACX,OAAO,SACP,IAAI,sBACJ,UAAU,8EAET,UAAAA,EAAK,eACNV,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACnD,SAAAA,EAAC,QACC,EAAE,kUACF,KAAK,UACP,EACF,GACF,GAEJ,EAGDU,EAAK,OAAO,KACXV,EAACE,EAAA,CACC,OAAQQ,EAAK,MAAM,IACnB,IAAKA,EAAK,MAAM,KAAO,GACvB,UAAWP,EAAG,yCAA0Cc,EAAU,gBAAkB,cAAc,EACpG,EAGDP,EAAK,WACJV,EAAC,KACC,KAAMU,EAAK,QAAU,IACrB,OAAO,SACP,IAAI,sBACJ,UAAWP,EACT,mGACAc,EAAU,gBAAkB,cAC9B,EAEC,SAAAP,EAAK,UACR,GAEJ,CAEJ,CAEA,IAAOW,EAAQZ",
|
|
6
6
|
"names": ["jsx", "jsxs", "Picture", "cn", "useHeadlessContext", "useMemberPopupContext", "useReferralOverview", "formatPrice", "ROUNDED_BRANDS", "Referral", "copy", "onClose", "profile", "alpcConfig", "isLogin", "brand", "currencyCode", "rounded", "data", "cashAvailable", "cashPending", "Referral_default"]
|
|
7
7
|
}
|
|
@@ -27,7 +27,9 @@ export declare enum EarnCreditsTaskType {
|
|
|
27
27
|
}
|
|
28
28
|
export declare enum ConsumeCreditsItemType {
|
|
29
29
|
Coupon = "COUPON",
|
|
30
|
-
RedeemAndBuy = "REDEEM_AND_BUY"
|
|
30
|
+
RedeemAndBuy = "REDEEM_AND_BUY",
|
|
31
|
+
GiftCard = "GIFT_CARD",
|
|
32
|
+
Product = "PRODUCT"
|
|
31
33
|
}
|
|
32
34
|
export type MemberPopupLink = {
|
|
33
35
|
type: MemberPopupActionType;
|
|
@@ -67,7 +69,7 @@ export type MemberPopupCopy = {
|
|
|
67
69
|
shopLabel: string;
|
|
68
70
|
shopUrl?: string;
|
|
69
71
|
};
|
|
70
|
-
|
|
72
|
+
activitiesSubscribe?: SubscribeModalCopy;
|
|
71
73
|
earnCredits?: EarnCreditsCopy;
|
|
72
74
|
consumeCredits?: ConsumeCreditsopy;
|
|
73
75
|
referral?: ReferralCopy;
|
|
@@ -122,6 +124,16 @@ export type SubscribeModalCopy = {
|
|
|
122
124
|
single_brand_subscribe?: boolean;
|
|
123
125
|
genre?: string;
|
|
124
126
|
sub_brand_type?: string;
|
|
127
|
+
promo?: {
|
|
128
|
+
title?: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
learnMoreLabel?: string;
|
|
131
|
+
learnMoreUrl?: string;
|
|
132
|
+
image?: {
|
|
133
|
+
url: string;
|
|
134
|
+
alt?: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
125
137
|
};
|
|
126
138
|
export type ConsumeCreditsopy = {
|
|
127
139
|
title?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=(
|
|
1
|
+
var n=(i=>(i.EarnCredits="EARN_CREDITS",i.ConsumeCredits="CONSUME_CREDITS",i.Referral="REFERRAL",i.CompleteProfile="COMPLETE_PROFILE",i.Subscribe="SUBSCRIBE",i.SubscribeEmail="SUBSCRIBE_EMAIL",i.RedeemCoupon="REDEEM_COUPON",i.Activate="ACTIVATE",i))(n||{}),s=(r=>(r.ExternalLink="EXTERNAL_LINK",r.OpenEarnCredits="OPEN_EARN_CREDITS",r.OpenConsumeCredits="OPEN_CONSUME_CREDITS",r.OpenReferral="OPEN_REFERRAL",r.OpenSubscribe="OPEN_SUBSCRIBE",r))(s||{}),o=(t=>(t.Activate="activate",t.CompleteProfile="completeProfile",t.Subscribe="subscribe",t.Shop="shop",t))(o||{}),g=(t=>(t.Coupon="COUPON",t.RedeemAndBuy="REDEEM_AND_BUY",t.GiftCard="GIFT_CARD",t.Product="PRODUCT",t))(g||{}),l=(e=>(e.Global="GLOBAL",e.Include="INCLUDE",e.Exclude="EXCLUDE",e))(l||{});export{g as ConsumeCreditsItemType,o as EarnCreditsTaskType,s as MemberPopupActionType,l as MemberPopupPageScope,n as MemberPopupPanelType};
|
|
2
2
|
//# sourceMappingURL=type.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/memberPopup/type.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AuthCodeActivateCopy } from '../registration/authCodeActivate/type'\nimport type { CreditInfoResponse } from '../credits/context/response'\nimport type { DTC_TASK_TYPE } from '../credits/context/const'\n\nexport type { AuthCodeActivateCopy }\n\n// \u2500\u2500\u2500 \u9762\u677F\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPanelType {\n EarnCredits = 'EARN_CREDITS',\n ConsumeCredits = 'CONSUME_CREDITS',\n Referral = 'REFERRAL',\n CompleteProfile = 'COMPLETE_PROFILE',\n Subscribe = 'SUBSCRIBE',\n SubscribeEmail = 'SUBSCRIBE_EMAIL',\n RedeemCoupon = 'REDEEM_COUPON',\n Activate = 'ACTIVATE',\n}\n\n// \u2500\u2500\u2500 item action \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupActionType {\n ExternalLink = 'EXTERNAL_LINK',\n OpenEarnCredits = 'OPEN_EARN_CREDITS',\n OpenConsumeCredits = 'OPEN_CONSUME_CREDITS',\n OpenReferral = 'OPEN_REFERRAL',\n OpenSubscribe = 'OPEN_SUBSCRIBE',\n}\n\n// \u2500\u2500\u2500 EarnCredits \u4EFB\u52A1\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum EarnCreditsTaskType {\n Activate = 'activate',\n CompleteProfile = 'completeProfile',\n Subscribe = 'subscribe',\n Shop = 'shop',\n}\n\n// \u2500\u2500\u2500 ConsumeCredits item \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum ConsumeCreditsItemType {\n Coupon = 'COUPON',\n RedeemAndBuy = 'REDEEM_AND_BUY',\n}\n\n// \u2500\u2500\u2500 \u901A\u7528 link\uFF08\u7EDF\u4E00\u4E00\u79CD\u7C7B\u578B\uFF09 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupLink = {\n type: MemberPopupActionType\n label: string\n url?: string // \u4EC5 ExternalLink \u65F6\u4F7F\u7528\n}\n\n// \u2500\u2500\u2500 list item \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupItem = {\n title: string\n description?: string\n links: MemberPopupLink[]\n}\n\n// \u2500\u2500 \u4E3B\u7EC4\u4EF6 Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPageScope {\n /** \u5168\u5C40\u5C55\u793A */\n Global = 'GLOBAL',\n /** \u4EC5\u5728\u7279\u5B9A\u9875\u9762\u5C55\u793A */\n Include = 'INCLUDE',\n /** \u5728\u7279\u5B9A\u9875\u9762\u4E0D\u5C55\u793A */\n Exclude = 'EXCLUDE',\n}\n\nexport type MemberPopupPageConfig = {\n scope: MemberPopupPageScope\n /** \u9875\u9762\u8DEF\u5F84\u5217\u8868\uFF0C\u652F\u6301\u7CBE\u786E\u5339\u914D\u548C\u524D\u7F00\u5339\u914D\uFF08\u5982 \"/products\" \u4F1A\u5339\u914D \"/products/xxx\"\uFF09 */\n pages: string[]\n}\n\nexport type MemberPopupCopy = {\n triggerImg: { url: string; alt?: string }\n title?: string\n subtitle?: string\n list: MemberPopupItem[]\n footer?: {\n loginHint: string\n loginLabel: string\n joinLabel: string\n shopLabel: string\n shopUrl?: string\n }\n
|
|
5
|
-
"mappings": "AAOO,IAAKA,OACVA,EAAA,YAAc,eACdA,EAAA,eAAiB,kBACjBA,EAAA,SAAW,WACXA,EAAA,gBAAkB,mBAClBA,EAAA,UAAY,YACZA,EAAA,eAAiB,kBACjBA,EAAA,aAAe,gBACfA,EAAA,SAAW,WARDA,OAAA,IAYAC,OACVA,EAAA,aAAe,gBACfA,EAAA,gBAAkB,oBAClBA,EAAA,mBAAqB,uBACrBA,EAAA,aAAe,gBACfA,EAAA,cAAgB,iBALNA,OAAA,IASAC,OACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,kBAClBA,EAAA,UAAY,YACZA,EAAA,KAAO,OAJGA,OAAA,IAQAC,OACVA,EAAA,OAAS,SACTA,EAAA,aAAe,
|
|
4
|
+
"sourcesContent": ["import type { AuthCodeActivateCopy } from '../registration/authCodeActivate/type'\nimport type { CreditInfoResponse } from '../credits/context/response'\nimport type { DTC_TASK_TYPE } from '../credits/context/const'\n\nexport type { AuthCodeActivateCopy }\n\n// \u2500\u2500\u2500 \u9762\u677F\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPanelType {\n EarnCredits = 'EARN_CREDITS',\n ConsumeCredits = 'CONSUME_CREDITS',\n Referral = 'REFERRAL',\n CompleteProfile = 'COMPLETE_PROFILE',\n Subscribe = 'SUBSCRIBE',\n SubscribeEmail = 'SUBSCRIBE_EMAIL',\n RedeemCoupon = 'REDEEM_COUPON',\n Activate = 'ACTIVATE',\n}\n\n// \u2500\u2500\u2500 item action \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupActionType {\n ExternalLink = 'EXTERNAL_LINK',\n OpenEarnCredits = 'OPEN_EARN_CREDITS',\n OpenConsumeCredits = 'OPEN_CONSUME_CREDITS',\n OpenReferral = 'OPEN_REFERRAL',\n OpenSubscribe = 'OPEN_SUBSCRIBE',\n}\n\n// \u2500\u2500\u2500 EarnCredits \u4EFB\u52A1\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum EarnCreditsTaskType {\n Activate = 'activate',\n CompleteProfile = 'completeProfile',\n Subscribe = 'subscribe',\n Shop = 'shop',\n}\n\n// \u2500\u2500\u2500 ConsumeCredits item \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum ConsumeCreditsItemType {\n Coupon = 'COUPON',\n RedeemAndBuy = 'REDEEM_AND_BUY',\n GiftCard = 'GIFT_CARD',\n Product = 'PRODUCT',\n}\n\n// \u2500\u2500\u2500 \u901A\u7528 link\uFF08\u7EDF\u4E00\u4E00\u79CD\u7C7B\u578B\uFF09 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupLink = {\n type: MemberPopupActionType\n label: string\n url?: string // \u4EC5 ExternalLink \u65F6\u4F7F\u7528\n}\n\n// \u2500\u2500\u2500 list item \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupItem = {\n title: string\n description?: string\n links: MemberPopupLink[]\n}\n\n// \u2500\u2500 \u4E3B\u7EC4\u4EF6 Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPageScope {\n /** \u5168\u5C40\u5C55\u793A */\n Global = 'GLOBAL',\n /** \u4EC5\u5728\u7279\u5B9A\u9875\u9762\u5C55\u793A */\n Include = 'INCLUDE',\n /** \u5728\u7279\u5B9A\u9875\u9762\u4E0D\u5C55\u793A */\n Exclude = 'EXCLUDE',\n}\n\nexport type MemberPopupPageConfig = {\n scope: MemberPopupPageScope\n /** \u9875\u9762\u8DEF\u5F84\u5217\u8868\uFF0C\u652F\u6301\u7CBE\u786E\u5339\u914D\u548C\u524D\u7F00\u5339\u914D\uFF08\u5982 \"/products\" \u4F1A\u5339\u914D \"/products/xxx\"\uFF09 */\n pages: string[]\n}\n\nexport type MemberPopupCopy = {\n triggerImg: { url: string; alt?: string }\n title?: string\n subtitle?: string\n list: MemberPopupItem[]\n footer?: {\n loginHint: string\n loginLabel: string\n joinLabel: string\n shopLabel: string\n shopUrl?: string\n }\n activitiesSubscribe?: SubscribeModalCopy\n earnCredits?: EarnCreditsCopy\n consumeCredits?: ConsumeCreditsopy\n referral?: ReferralCopy\n /** \u9875\u9762\u8986\u76D6\u8303\u56F4\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u5168\u5C40\u5C55\u793A */\n pageConfig?: MemberPopupPageConfig\n}\n\n// \u2500\u2500\u2500 EarnCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type EarnCreditsCopy = {\n title?: string\n subtitle?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n joinNow: string\n completed: string\n activate: string\n completeProfileLabel: string\n subscribeLabel: string\n shopNow: string\n goShopLink?: string\n list: {\n id: EarnCreditsTaskType\n title: string\n description: string\n credits?: string\n }[]\n // \u5B50\u5F39\u7A97\u6587\u6848\n authCodeActivate: AuthCodeActivateCopy\n completeProfile: CompleteProfileCopy\n subscribe: SubscribeModalCopy\n}\n\nexport type CompleteProfileCopy = {\n title: string\n subtitle?: string\n firstName: string\n lastName: string\n email: string\n phone: string\n birthday: string\n country: string\n save: string\n cancel: string\n edit: string\n required: string\n}\n\nexport type SubscribeModalCopy = {\n title: string\n desc?: string\n placeholder: string\n policy?: string\n successTips?: string\n dealsType?: string\n buttonLabel?: string\n single_brand_subscribe?: boolean\n genre?: string\n sub_brand_type?: string\n promo?: {\n title?: string\n description?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n }\n}\n\n// \u2500\u2500\u2500 ConsumeCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ConsumeCreditsopy = {\n title?: string\n subtitle?: string\n soldOut: string\n unlockRewards: string\n btnRedeem: string\n insufficientCredits?: string\n pointUnit?: string\n off?: string\n imageMapping?: {\n [key in ConsumeCreditsItemType]?: { url: string }\n }\n list: ConsumeCreditsItem[]\n redeemModal: RedeemCouponModalCopy\n creditsPage?: { label: string; url: string }\n}\n\nexport type ConsumeCreditsItem = {\n redeemId: string | number\n title: string\n description?: string\n image: { url: string; alt?: string }\n type: ConsumeCreditsItemType\n product?: { handle: string; sku: string }\n price?: number\n value?: string\n rules?: string[]\n}\n\nexport type RedeemCouponModalCopy = {\n confirmTitle: string\n confirmButton: string\n commonError: string\n redeemLimitError: string\n inventoryNotEnough: string\n creditsNotEnough: string\n crossSiteError: string\n successTitle: string\n successDesc: string\n successButton: string\n successButtonUrl?: string\n}\n\n// \u2500\u2500\u2500 Referral Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ReferralCopy = {\n title?: string\n description?: string\n cashAvailableLabel: string\n cashPendingLabel: string\n creditUnit?: string\n referralLinksLabel?: string\n referralLinkBaseUrl?: string\n copyLabel?: string\n copiedLabel?: string\n howToTitle?: string\n howToDescription?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n ctaButton: string\n ctaUrl?: string\n loginTitle?: string\n loginDescription?: string\n loginCtaLabel?: string\n}\n\n// \u2500\u2500\u2500 Provider Context \u7C7B\u578B \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type AlpcConfig = {\n brand: string\n locale: string\n appName: string\n apiBaseUrl?: string\n}\n\nexport type MemberPopupContextValue = {\n profile: any\n isLoadingProfile: boolean\n creditInfo?: CreditInfoResponse\n fetchCreditInfo: (userId: string) => void\n openSignUpPopup: () => void\n openSignInPopup: () => void\n taskIdToTypeMapping?: Record<string, DTC_TASK_TYPE>\n alpcConfig: AlpcConfig\n}\n"],
|
|
5
|
+
"mappings": "AAOO,IAAKA,OACVA,EAAA,YAAc,eACdA,EAAA,eAAiB,kBACjBA,EAAA,SAAW,WACXA,EAAA,gBAAkB,mBAClBA,EAAA,UAAY,YACZA,EAAA,eAAiB,kBACjBA,EAAA,aAAe,gBACfA,EAAA,SAAW,WARDA,OAAA,IAYAC,OACVA,EAAA,aAAe,gBACfA,EAAA,gBAAkB,oBAClBA,EAAA,mBAAqB,uBACrBA,EAAA,aAAe,gBACfA,EAAA,cAAgB,iBALNA,OAAA,IASAC,OACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,kBAClBA,EAAA,UAAY,YACZA,EAAA,KAAO,OAJGA,OAAA,IAQAC,OACVA,EAAA,OAAS,SACTA,EAAA,aAAe,iBACfA,EAAA,SAAW,YACXA,EAAA,QAAU,UAJAA,OAAA,IAsBAC,OAEVA,EAAA,OAAS,SAETA,EAAA,QAAU,UAEVA,EAAA,QAAU,UANAA,OAAA",
|
|
6
6
|
"names": ["MemberPopupPanelType", "MemberPopupActionType", "EarnCreditsTaskType", "ConsumeCreditsItemType", "MemberPopupPageScope"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -20,8 +20,7 @@ function useCountries({ shopifyStoreDomain }: { shopifyStoreDomain: string }) {
|
|
|
20
20
|
})
|
|
21
21
|
const res: any = await response.json()
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
let shipsToCountries: ShippingCountry[] = res?.data || res || []
|
|
23
|
+
let shipsToCountries: ShippingCountry[] = res?.data?.data || []
|
|
25
24
|
|
|
26
25
|
// 字母顺序排序
|
|
27
26
|
shipsToCountries = shipsToCountries.sort((a, b) => {
|
|
@@ -21,7 +21,7 @@ const EarnCredits = lazy(() => import('./panels/EarnCredits'))
|
|
|
21
21
|
const ConsumeCredits = lazy(() => import('./panels/ConsumeCredits'))
|
|
22
22
|
const Referral = lazy(() => import('./panels/Referral'))
|
|
23
23
|
const CompleteProfile = lazy(() => import('./panels/EarnCredits/CompleteProfilePanel'))
|
|
24
|
-
const
|
|
24
|
+
const ActivitiesSubscribe = lazy(() => import('./panels/ActivitiesSubscribePanel'))
|
|
25
25
|
const SubscribeEmail = lazy(() => import('./panels/EarnCredits/SubscribeEmailPanel'))
|
|
26
26
|
const Activate = lazy(() => import('./panels/EarnCredits/ActivatePanel'))
|
|
27
27
|
const RedeemCoupon = lazy(() => import('./panels/ConsumeCredits/RedeemCouponPanel'))
|
|
@@ -55,6 +55,7 @@ function MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {
|
|
|
55
55
|
const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)
|
|
56
56
|
const [isActivateSuccess, setIsActivateSuccess] = useState(false)
|
|
57
57
|
const [isProfileCompleteSuccess, setIsProfileCompleteSuccess] = useState(false)
|
|
58
|
+
const [isSubscribeFormHidden, setIsSubscribeFormHidden] = useState(false)
|
|
58
59
|
|
|
59
60
|
const currentView = viewStack[viewStack.length - 1] ?? null
|
|
60
61
|
|
|
@@ -106,21 +107,26 @@ function MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {
|
|
|
106
107
|
function handleClose() {
|
|
107
108
|
setIsOpen(false)
|
|
108
109
|
setViewStack([])
|
|
110
|
+
setIsSubscribeFormHidden(false)
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
return (
|
|
112
114
|
<ViewStackContext.Provider value={{ pushView, popView }}>
|
|
113
115
|
{isOpen && <div className="fixed inset-0 z-[998]" onClick={handleClose} />}
|
|
114
|
-
<div
|
|
116
|
+
<div
|
|
117
|
+
className="fixed right-0 z-[999] flex flex-row items-end pr-[16px] md:flex-col md:items-end md:right-0 md:w-screen md:pr-0 md:pl-0"
|
|
118
|
+
style={{ bottom: bottomOffset }}
|
|
119
|
+
>
|
|
115
120
|
{isOpen && (
|
|
116
121
|
<div
|
|
117
122
|
className={cn(
|
|
118
|
-
'relative
|
|
123
|
+
'relative mr-[8px] flex w-[420px] max-w-[calc(100vw-32px)] min-h-[500px] flex-col overflow-hidden bg-white shadow-[0_8px_32px_rgba(0,0,0,0.16)] md:mr-0 md:mb-[8px] md:mx-[16px] md:w-[calc(100vw-32px)] md:max-w-[400px]',
|
|
119
124
|
rounded ? 'rounded-[12px]' : 'rounded-none'
|
|
120
125
|
)}
|
|
126
|
+
style={{ maxHeight: 'min(80vh, 606px)' }}
|
|
121
127
|
onClick={e => e.stopPropagation()}
|
|
122
128
|
>
|
|
123
|
-
<div className="absolute right-[-8px] top-[24px] size-0 border-y-8 border-l-8 border-y-transparent border-l-white" />
|
|
129
|
+
<div className="absolute right-[-8px] top-[24px] size-0 border-y-8 border-l-8 border-y-transparent border-l-white md:bottom-[-8px] md:left-auto md:right-[29px] md:top-auto md:border-x-8 md:border-b-transparent md:border-t-white" />
|
|
124
130
|
<div className="flex items-center justify-end pl-[10px] pr-[16px] pb-[8px] pt-[16px]">
|
|
125
131
|
{currentView !== null && (
|
|
126
132
|
<button
|
|
@@ -140,10 +146,7 @@ function MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {
|
|
|
140
146
|
</button>
|
|
141
147
|
</div>
|
|
142
148
|
|
|
143
|
-
<div
|
|
144
|
-
className="flex flex-1 flex-col gap-[12px] overflow-y-auto p-[16px]"
|
|
145
|
-
style={{ maxHeight: 'min(calc(80vh - 118px), 606px)' }}
|
|
146
|
-
>
|
|
149
|
+
<div className="flex flex-1 flex-col gap-[12px] overflow-y-auto p-[16px]">
|
|
147
150
|
{currentView === null && (
|
|
148
151
|
<>
|
|
149
152
|
{(copy.title || copy.subtitle) && (
|
|
@@ -196,12 +199,13 @@ function MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {
|
|
|
196
199
|
onSuccess={currentView.props?.onSuccess}
|
|
197
200
|
/>
|
|
198
201
|
)}
|
|
199
|
-
{currentView.type === MemberPopupPanelType.Subscribe && copy.
|
|
200
|
-
<
|
|
201
|
-
copy={copy.
|
|
202
|
+
{currentView.type === MemberPopupPanelType.Subscribe && copy.activitiesSubscribe && (
|
|
203
|
+
<ActivitiesSubscribe
|
|
204
|
+
copy={copy.activitiesSubscribe}
|
|
202
205
|
email={profile?.email}
|
|
203
|
-
onClose={popView}
|
|
204
206
|
onSuccess={currentView.props?.onSuccess}
|
|
207
|
+
hideForm={isSubscribeFormHidden}
|
|
208
|
+
onHideForm={() => setIsSubscribeFormHidden(true)}
|
|
205
209
|
/>
|
|
206
210
|
)}
|
|
207
211
|
{currentView.type === MemberPopupPanelType.SubscribeEmail && copy.earnCredits && (
|
|
@@ -228,6 +232,7 @@ function MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {
|
|
|
228
232
|
itemImage={currentView.props.itemImage}
|
|
229
233
|
itemValue={currentView.props.itemValue}
|
|
230
234
|
itemOff={currentView.props.itemOff}
|
|
235
|
+
itemRules={currentView.props.itemRules}
|
|
231
236
|
redeemId={currentView.props.redeemId}
|
|
232
237
|
userId={currentView.props.userId}
|
|
233
238
|
alpcConfig={currentView.props.alpcConfig}
|
|
@@ -270,7 +275,7 @@ function MemberPopupContent({ copy, bottomOffset }: MemberPopupContentProps) {
|
|
|
270
275
|
)}
|
|
271
276
|
|
|
272
277
|
<button
|
|
273
|
-
className="flex cursor-pointer items-center justify-center rounded-full bg-white shadow-lg"
|
|
278
|
+
className="flex cursor-pointer items-center justify-center rounded-full bg-white shadow-lg md:ml-auto md:mr-[16px]"
|
|
274
279
|
onClick={() => setIsOpen(prev => !prev)}
|
|
275
280
|
aria-label={copy.triggerImg.alt ?? 'Open member popup'}
|
|
276
281
|
>
|