@anker-in/campaign-ui 0.2.1 → 0.2.2
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/useSendEmailValidation.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +9 -0
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.js.map +7 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +2 -2
- package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
- package/dist/cjs/components/credits/creditsFaq/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +2 -2
- package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
- package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +2 -2
- package/dist/cjs/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/helpers/fetchResponse.js +2 -0
- package/dist/cjs/helpers/fetchResponse.js.map +7 -0
- package/dist/cjs/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/helpers/fetcher.js +2 -0
- package/dist/cjs/helpers/fetcher.js.map +7 -0
- package/dist/cjs/helpers/index.d.ts +2 -0
- package/dist/cjs/helpers/index.js +2 -0
- package/dist/cjs/helpers/index.js.map +7 -0
- package/dist/cjs/helpers/track.d.ts +19 -0
- package/dist/cjs/helpers/track.js +2 -0
- package/dist/cjs/helpers/track.js.map +7 -0
- package/dist/cjs/helpers/utils.d.ts +3 -0
- package/dist/cjs/helpers/utils.js +2 -0
- package/dist/cjs/helpers/utils.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +2 -0
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +9 -0
- package/dist/esm/components/credits/context/hooks/useSubscriptions.js +2 -0
- package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +7 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +2 -2
- package/dist/esm/components/credits/creditsFaq/index.js +1 -1
- package/dist/esm/components/credits/creditsFaq/index.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +2 -2
- package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
- package/dist/esm/components/credits/modal/MyRewardsModal.js.map +2 -2
- package/dist/esm/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/helpers/fetchResponse.js +2 -0
- package/dist/esm/helpers/fetchResponse.js.map +7 -0
- package/dist/esm/helpers/fetcher.d.ts +2 -0
- package/dist/esm/helpers/fetcher.js +2 -0
- package/dist/esm/helpers/fetcher.js.map +7 -0
- package/dist/esm/helpers/index.d.ts +2 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/index.js.map +7 -0
- package/dist/esm/helpers/track.d.ts +19 -0
- package/dist/esm/helpers/track.js +2 -0
- package/dist/esm/helpers/track.js.map +7 -0
- package/dist/esm/helpers/utils.d.ts +3 -0
- package/dist/esm/helpers/utils.js +2 -0
- package/dist/esm/helpers/utils.js.map +7 -0
- package/package.json +3 -3
- package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +1 -1
- package/src/components/credits/creditsFaq/index.tsx +1 -1
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +1 -1
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +1 -1
- package/src/components/credits/modal/MyRewardsModal.tsx +1 -1
- package/dist/cjs/components/credits/const.d.ts +0 -1
- package/dist/cjs/components/credits/const.js +0 -2
- package/dist/cjs/components/credits/const.js.map +0 -7
- package/dist/esm/components/credits/const.d.ts +0 -1
- package/dist/esm/components/credits/const.js +0 -2
- package/dist/esm/components/credits/const.js.map +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useSendEmailValidation(): import("swr/mutation").SWRMutationResponse<any, any, "send-email-validation", never>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=Object.create;var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},r=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of f(t))!v.call(e,a)&&a!==o&&i(e,a,{get:()=>t[a],enumerable:!(n=d(t,a))||n.enumerable});return e};var m=(e,t,o)=>(o=e!=null?c(h(e)):{},r(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),C=e=>r(i({},"__esModule",{value:!0}),e);var y={};x(y,{useSendEmailValidation:()=>S});module.exports=C(y);var s=m(require("../../../../helpers/fetcher")),l=m(require("swr/mutation")),p=require("../provider"),u=require("@anker-in/lib");function S(){const{profile:e}=(0,p.useCreditsContext)(),{appName:t,locale:o}=(0,u.useHeadlessContext)();return(0,l.default)("send-email-validation",()=>(0,s.default)({locale:o,url:"/api/multipass/account/users/send_validation_email",method:"POST",body:{email:e?.email,app:t},needRecaptcha:!0,action:"verifyAccount"}))}
|
|
2
|
+
//# sourceMappingURL=useSendEmailValidation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/hooks/useSendEmailValidation.ts"],
|
|
4
|
+
"sourcesContent": ["import fetcher from '../../../../helpers/fetcher'\nimport useSWRMutation from 'swr/mutation'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nexport function useSendEmailValidation() {\n const { profile } = useCreditsContext()\n const { appName, locale } = useHeadlessContext()\n\n return useSWRMutation('send-email-validation', () =>\n fetcher({\n locale,\n url: '/api/multipass/account/users/send_validation_email',\n method: 'POST',\n body: { email: profile?.email, app: appName },\n needRecaptcha: true,\n action: 'verifyAccount',\n })\n )\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoB,0CACpBC,EAA2B,2BAC3BC,EAAkC,uBAClCC,EAAmC,yBAE5B,SAASL,GAAyB,CACvC,KAAM,CAAE,QAAAM,CAAQ,KAAI,qBAAkB,EAChC,CAAE,QAAAC,EAAS,OAAAC,CAAO,KAAI,sBAAmB,EAE/C,SAAO,EAAAC,SAAe,wBAAyB,OAC7C,EAAAC,SAAQ,CACN,OAAAF,EACA,IAAK,qDACL,OAAQ,OACR,KAAM,CAAE,MAAOF,GAAS,MAAO,IAAKC,CAAQ,EAC5C,cAAe,GACf,OAAQ,eACV,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["useSendEmailValidation_exports", "__export", "useSendEmailValidation", "__toCommonJS", "import_fetcher", "import_mutation", "import_provider", "import_lib", "profile", "appName", "locale", "useSWRMutation", "fetcher"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SWRResponse } from 'swr';
|
|
2
|
+
import type { Subscription } from '../../type';
|
|
3
|
+
export type SubscriptionApiResponse = {
|
|
4
|
+
data: Subscription;
|
|
5
|
+
};
|
|
6
|
+
export type FetchSubscriptionResponse = SWRResponse<Subscription>;
|
|
7
|
+
export declare function useSubscriptions({ email }: {
|
|
8
|
+
email?: string;
|
|
9
|
+
}): FetchSubscriptionResponse;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var b=Object.create;var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var y=(s,t)=>{for(var e in t)i(s,e,{get:t[e],enumerable:!0})},n=(s,t,e,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R(t))!l.call(s,o)&&o!==e&&i(s,o,{get:()=>t[o],enumerable:!(p=m(t,o))||p.enumerable});return s};var r=(s,t,e)=>(e=s!=null?b(d(s)):{},n(t||!s||!s.__esModule?i(e,"default",{value:s,enumerable:!0}):e,s)),f=s=>n(i({},"__esModule",{value:!0}),s);var x={};y(x,{useSubscriptions:()=>h});module.exports=f(x);var c=r(require("swr")),u=r(require("../../../../helpers/fetcher")),a=require("@anker-in/lib");function h({email:s}){const{locale:t}=(0,a.useHeadlessContext)(),{data:e,...p}=(0,c.default)(s?["/api/multipass/account/subscriptions",s]:null,async([o,S])=>(0,u.default)({method:"GET",url:o,body:{email:S},action:"login",locale:t,headers:{},type:""}));return{data:e?.data,...p}}
|
|
2
|
+
//# sourceMappingURL=useSubscriptions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/hooks/useSubscriptions.ts"],
|
|
4
|
+
"sourcesContent": ["import useSWR, { SWRResponse } from 'swr'\nimport type { Subscription } from '../../type'\nimport fetcher from '../../../../helpers/fetcher'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nexport type SubscriptionApiResponse = { data: Subscription }\nexport type FetchSubscriptionResponse = SWRResponse<Subscription>\n\nexport function useSubscriptions({ email }: { email?: string }): FetchSubscriptionResponse {\n const { locale } = useHeadlessContext()\n\n const { data, ...rest } = useSWR<SubscriptionApiResponse>(\n email ? ['/api/multipass/account/subscriptions', email] : null,\n async ([url, email]) =>\n fetcher({\n method: 'GET',\n url,\n body: {\n email,\n },\n action: 'login',\n locale,\n headers: {},\n type: '',\n })\n )\n\n return { data: data?.data, ...rest } as unknown as FetchSubscriptionResponse\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,kBAEpCC,EAAoB,0CACpBC,EAAmC,yBAK5B,SAASJ,EAAiB,CAAE,MAAAK,CAAM,EAAkD,CACzF,KAAM,CAAE,OAAAC,CAAO,KAAI,sBAAmB,EAEhC,CAAE,KAAAC,EAAM,GAAGC,CAAK,KAAI,EAAAC,SACxBJ,EAAQ,CAAC,uCAAwCA,CAAK,EAAI,KAC1D,MAAO,CAACK,EAAKL,CAAK,OAChB,EAAAM,SAAQ,CACN,OAAQ,MACR,IAAAD,EACA,KAAM,CACJ,MAAAL,CACF,EACA,OAAQ,QACR,OAAAC,EACA,QAAS,CAAC,EACV,KAAM,EACR,CAAC,CACL,EAEA,MAAO,CAAE,KAAMC,GAAM,KAAM,GAAGC,CAAK,CACrC",
|
|
6
|
+
"names": ["useSubscriptions_exports", "__export", "useSubscriptions", "__toCommonJS", "import_swr", "import_fetcher", "import_lib", "email", "locale", "data", "rest", "useSWR", "url", "fetcher"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!h.call(t,a)&&a!==o&&m(t,a,{get:()=>e[a],enumerable:!(i=u(e,a))||i.enumerable});return t};var N=t=>y(m({},"__esModule",{value:!0}),t);var k={};g(k,{FaqItem:()=>D});module.exports=N(k);var r=require("react/jsx-runtime"),d=require("@anker-in/headless-ui"),f=require("@heroicons/react/24/outline"),n=require("@anker-in/lib"),b=require("framer-motion"),l=require("react");const D=({index:t,question:e,answer:o,showDots:i,itemRightIconRender:a,defaultExpended:c=!1})=>{const[p,s]=(0,l.useState)(c);return(0,l.useEffect)(()=>{t==0&&s(!0),e||s(!0)},[t,e]),(0,r.jsxs)("div",{className:(0,n.classNames)("relative mx-0 border-b-[1px] border-[#e4e5e6] py-[24px] l:py-[16px]"),children:[(0,r.jsxs)("div",{className:"relative flex items-center",onClick:()=>{s(!p)},role:"button",tabIndex:0,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&x.preventDefault()},children:[(0,r.jsx)(d.Heading,{html:e,as:"h3",className:(0,n.classNames)(i?'before:absolute before:left-[-15px] before:top-[8px] before:h-[6px] before:w-[6px] before:rounded-[50%] before:bg-[#000] before:content-[""]':"","relative block flex-1 cursor-pointer pr-[10px] text-[18px] font-bold text-[#1D1D1F] l:text-[16px]")}),a?a({expanded:p}):(0,r.jsx)(f.ChevronDownIcon,{className:(0,n.classNames)("size-[16px] shrink-0 cursor-pointer stroke-[2.5px] transition-all",p?"rotate-180":"")})]}),(0,r.jsx)(b.motion.div,{initial:!1,animate:{height:p?"auto":0},className:"overflow-hidden [&_td]:border [&_td]:border-[#333] [&_td]:px-[8px] [&_td]:py-[4px]",children:o?.toString()?.includes("https://www.youtube.com")?(0,r.jsx)(d.Text,{as:"div",className:(0,n.classNames)("mt-[8px]"),"data-ratio":"16:9","data-content":o,html:o?.toString()}):(0,r.jsx)(d.Text,{as:"div",html:o?.toString(),className:(0,n.classNames)("mt-[8px] text-[16px] font-bold leading-[1.5] text-[#3D3D3F] l:text-[14px] [&_a]:text-brand [&_a]:underline")})})]},t)};
|
|
1
|
+
"use strict";var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!h.call(t,a)&&a!==o&&m(t,a,{get:()=>e[a],enumerable:!(i=u(e,a))||i.enumerable});return t};var N=t=>y(m({},"__esModule",{value:!0}),t);var k={};g(k,{FaqItem:()=>D});module.exports=N(k);var r=require("react/jsx-runtime"),d=require("@anker-in/headless-ui"),f=require("@heroicons/react/24/outline"),n=require("@anker-in/lib"),b=require("framer-motion"),l=require("react");const D=({index:t,question:e,answer:o,showDots:i,itemRightIconRender:a,defaultExpended:c=!1})=>{const[p,s]=(0,l.useState)(c);return(0,l.useEffect)(()=>{t==0&&s(!0),e||s(!0)},[t,e]),(0,r.jsxs)("div",{className:(0,n.classNames)("relative mx-0 border-b-[1px] border-[#e4e5e6] py-[24px] l:py-[16px]"),children:[(0,r.jsxs)("div",{className:"relative flex items-center",onClick:()=>{s(!p)},role:"button",tabIndex:0,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&x.preventDefault()},children:[(0,r.jsx)(d.Heading,{html:e,as:"h3",className:(0,n.classNames)(i?'before:absolute before:left-[-15px] before:top-[8px] before:h-[6px] before:w-[6px] before:rounded-[50%] before:bg-[#000] before:content-[""]':"","relative block flex-1 cursor-pointer pr-[10px] text-[18px] font-bold text-[#1D1D1F] l:text-[16px]")}),a?a({expanded:p}):(0,r.jsx)(f.ChevronDownIcon,{className:(0,n.classNames)("size-[16px] shrink-0 cursor-pointer stroke-[2.5px] transition-all",p?"rotate-180":"")})]}),(0,r.jsx)(b.motion.div,{initial:!1,animate:{height:p?"auto":0},className:"overflow-hidden [&_td]:border [&_td]:border-[#333] [&_td]:px-[8px] [&_td]:py-[4px]",children:o?.toString()?.includes("https://www.youtube.com")?(0,r.jsx)(d.Text,{as:"div",className:(0,n.classNames)("mt-[8px]"),"data-ratio":"16:9","data-content":o,html:o?.toString()}):(0,r.jsx)(d.Text,{as:"div",html:o?.toString(),className:(0,n.classNames)("mt-[8px] text-[16px] font-bold leading-[1.5] text-[#3D3D3F] l:text-[14px] [&_a]:text-brand-0 [&_a]:underline")})})]},t)};
|
|
2
2
|
//# sourceMappingURL=FaqItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/creditsFaq/faqItem/FaqItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Heading, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon } from '@heroicons/react/24/outline'\nimport { classNames as cn } from '@anker-in/lib'\nimport { motion } from 'framer-motion'\nimport { type ReactNode, useEffect, useState } from 'react'\n\ntype FaqItemProps = {\n index: number\n question?: string\n answer?: string | number\n showDots: boolean\n itemRightIconRender?: ({ expanded }: { expanded: boolean }) => ReactNode\n defaultExpended?: boolean\n}\n\nexport const FaqItem = ({\n index,\n question,\n answer,\n showDots,\n itemRightIconRender,\n defaultExpended = false,\n}: FaqItemProps) => {\n const [expanded, setExpanded] = useState(defaultExpended)\n useEffect(() => {\n if (index == 0) {\n setExpanded(true)\n }\n if (!question) {\n setExpanded(true)\n }\n }, [index, question])\n\n return (\n <div key={index} className={cn('relative mx-0 border-b-[1px] border-[#e4e5e6] py-[24px] l:py-[16px]')}>\n <div\n className=\"relative flex items-center\"\n onClick={() => {\n setExpanded(!expanded)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n <Heading\n html={question}\n as=\"h3\"\n className={cn(\n showDots\n ? 'before:absolute before:left-[-15px] before:top-[8px] before:h-[6px] before:w-[6px] before:rounded-[50%] before:bg-[#000] before:content-[\"\"]'\n : '',\n 'relative block flex-1 cursor-pointer pr-[10px] text-[18px] font-bold text-[#1D1D1F] l:text-[16px]'\n )}\n ></Heading>\n {itemRightIconRender ? (\n itemRightIconRender({ expanded })\n ) : (\n <ChevronDownIcon\n className={cn(\n 'size-[16px] shrink-0 cursor-pointer stroke-[2.5px] transition-all',\n expanded ? 'rotate-180' : ''\n )}\n />\n )}\n </div>\n <motion.div\n initial={false}\n animate={{ height: !expanded ? 0 : 'auto' }}\n className=\"overflow-hidden [&_td]:border [&_td]:border-[#333] [&_td]:px-[8px] [&_td]:py-[4px]\"\n >\n {answer?.toString()?.includes('https://www.youtube.com') ? (\n <Text\n as=\"div\"\n className={cn('mt-[8px]')}\n data-ratio=\"16:9\"\n data-content={answer}\n html={answer?.toString()}\n ></Text>\n ) : (\n <Text\n as=\"div\"\n html={answer?.toString()}\n className={cn(\n 'mt-[8px] text-[16px] font-bold leading-[1.5] text-[#3D3D3F] l:text-[14px] [&_a]:text-brand [&_a]:underline'\n )}\n ></Text>\n )}\n </motion.div>\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmCM,IAAAI,EAAA,6BAnCNC,EAA8B,iCAC9BC,EAAgC,uCAChCC,EAAiC,yBACjCC,EAAuB,yBACvBC,EAAoD,iBAW7C,MAAMP,EAAU,CAAC,CACtB,MAAAQ,EACA,SAAAC,EACA,OAAAC,EACA,SAAAC,EACA,oBAAAC,EACA,gBAAAC,EAAkB,EACpB,IAAoB,CAClB,KAAM,CAACC,EAAUC,CAAW,KAAI,YAASF,CAAe,EACxD,sBAAU,IAAM,CACVL,GAAS,GACXO,EAAY,EAAI,EAEbN,GACHM,EAAY,EAAI,CAEpB,EAAG,CAACP,EAAOC,CAAQ,CAAC,KAGlB,QAAC,OAAgB,aAAW,EAAAO,YAAG,sEAAsE,EACnG,qBAAC,OACC,UAAU,6BACV,QAAS,IAAM,CACbD,EAAY,CAACD,CAAQ,CACvB,EACA,KAAK,SACL,SAAU,EACV,UAAWG,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEA,oBAAC,WACC,KAAMR,EACN,GAAG,KACH,aAAW,EAAAO,YACTL,EACI,+IACA,GACJ,mGACF,EACD,EACAC,EACCA,EAAoB,CAAE,SAAAE,CAAS,CAAC,KAEhC,OAAC,mBACC,aAAW,EAAAE,YACT,oEACAF,EAAW,aAAe,EAC5B,EACF,GAEJ,KACA,OAAC,SAAO,IAAP,CACC,QAAS,GACT,QAAS,CAAE,OAASA,EAAe,OAAJ,CAAW,EAC1C,UAAU,qFAET,SAAAJ,GAAQ,SAAS,GAAG,SAAS,yBAAyB,KACrD,OAAC,QACC,GAAG,MACH,aAAW,EAAAM,YAAG,UAAU,EACxB,aAAW,OACX,eAAcN,EACd,KAAMA,GAAQ,SAAS,EACxB,KAED,OAAC,QACC,GAAG,MACH,KAAMA,GAAQ,SAAS,EACvB,aAAW,EAAAM,YACT,
|
|
4
|
+
"sourcesContent": ["import { Heading, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon } from '@heroicons/react/24/outline'\nimport { classNames as cn } from '@anker-in/lib'\nimport { motion } from 'framer-motion'\nimport { type ReactNode, useEffect, useState } from 'react'\n\ntype FaqItemProps = {\n index: number\n question?: string\n answer?: string | number\n showDots: boolean\n itemRightIconRender?: ({ expanded }: { expanded: boolean }) => ReactNode\n defaultExpended?: boolean\n}\n\nexport const FaqItem = ({\n index,\n question,\n answer,\n showDots,\n itemRightIconRender,\n defaultExpended = false,\n}: FaqItemProps) => {\n const [expanded, setExpanded] = useState(defaultExpended)\n useEffect(() => {\n if (index == 0) {\n setExpanded(true)\n }\n if (!question) {\n setExpanded(true)\n }\n }, [index, question])\n\n return (\n <div key={index} className={cn('relative mx-0 border-b-[1px] border-[#e4e5e6] py-[24px] l:py-[16px]')}>\n <div\n className=\"relative flex items-center\"\n onClick={() => {\n setExpanded(!expanded)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n <Heading\n html={question}\n as=\"h3\"\n className={cn(\n showDots\n ? 'before:absolute before:left-[-15px] before:top-[8px] before:h-[6px] before:w-[6px] before:rounded-[50%] before:bg-[#000] before:content-[\"\"]'\n : '',\n 'relative block flex-1 cursor-pointer pr-[10px] text-[18px] font-bold text-[#1D1D1F] l:text-[16px]'\n )}\n ></Heading>\n {itemRightIconRender ? (\n itemRightIconRender({ expanded })\n ) : (\n <ChevronDownIcon\n className={cn(\n 'size-[16px] shrink-0 cursor-pointer stroke-[2.5px] transition-all',\n expanded ? 'rotate-180' : ''\n )}\n />\n )}\n </div>\n <motion.div\n initial={false}\n animate={{ height: !expanded ? 0 : 'auto' }}\n className=\"overflow-hidden [&_td]:border [&_td]:border-[#333] [&_td]:px-[8px] [&_td]:py-[4px]\"\n >\n {answer?.toString()?.includes('https://www.youtube.com') ? (\n <Text\n as=\"div\"\n className={cn('mt-[8px]')}\n data-ratio=\"16:9\"\n data-content={answer}\n html={answer?.toString()}\n ></Text>\n ) : (\n <Text\n as=\"div\"\n html={answer?.toString()}\n className={cn(\n 'mt-[8px] text-[16px] font-bold leading-[1.5] text-[#3D3D3F] l:text-[14px] [&_a]:text-brand-0 [&_a]:underline'\n )}\n ></Text>\n )}\n </motion.div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmCM,IAAAI,EAAA,6BAnCNC,EAA8B,iCAC9BC,EAAgC,uCAChCC,EAAiC,yBACjCC,EAAuB,yBACvBC,EAAoD,iBAW7C,MAAMP,EAAU,CAAC,CACtB,MAAAQ,EACA,SAAAC,EACA,OAAAC,EACA,SAAAC,EACA,oBAAAC,EACA,gBAAAC,EAAkB,EACpB,IAAoB,CAClB,KAAM,CAACC,EAAUC,CAAW,KAAI,YAASF,CAAe,EACxD,sBAAU,IAAM,CACVL,GAAS,GACXO,EAAY,EAAI,EAEbN,GACHM,EAAY,EAAI,CAEpB,EAAG,CAACP,EAAOC,CAAQ,CAAC,KAGlB,QAAC,OAAgB,aAAW,EAAAO,YAAG,sEAAsE,EACnG,qBAAC,OACC,UAAU,6BACV,QAAS,IAAM,CACbD,EAAY,CAACD,CAAQ,CACvB,EACA,KAAK,SACL,SAAU,EACV,UAAWG,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEA,oBAAC,WACC,KAAMR,EACN,GAAG,KACH,aAAW,EAAAO,YACTL,EACI,+IACA,GACJ,mGACF,EACD,EACAC,EACCA,EAAoB,CAAE,SAAAE,CAAS,CAAC,KAEhC,OAAC,mBACC,aAAW,EAAAE,YACT,oEACAF,EAAW,aAAe,EAC5B,EACF,GAEJ,KACA,OAAC,SAAO,IAAP,CACC,QAAS,GACT,QAAS,CAAE,OAASA,EAAe,OAAJ,CAAW,EAC1C,UAAU,qFAET,SAAAJ,GAAQ,SAAS,GAAG,SAAS,yBAAyB,KACrD,OAAC,QACC,GAAG,MACH,aAAW,EAAAM,YAAG,UAAU,EACxB,aAAW,OACX,eAAcN,EACd,KAAMA,GAAQ,SAAS,EACxB,KAED,OAAC,QACC,GAAG,MACH,KAAMA,GAAQ,SAAS,EACvB,aAAW,EAAAM,YACT,8GACF,EACD,EAEL,IAzDQR,CA0DV,CAEJ",
|
|
6
6
|
"names": ["FaqItem_exports", "__export", "FaqItem", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_lib", "import_framer_motion", "import_react", "index", "question", "answer", "showDots", "itemRightIconRender", "defaultExpended", "expanded", "setExpanded", "cn", "e"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var v=(e,n)=>{for(var r in n)d(e,r,{get:n[r],enumerable:!0})},C=(e,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of h(n))!q.call(e,l)&&l!==r&&d(e,l,{get:()=>n[l],enumerable:!(o=T(n,l))||o.enumerable});return e};var N=e=>C(d({},"__esModule",{value:!0}),e);var F={};v(F,{CreditsFaq:()=>w});module.exports=N(F);var a=require("react/jsx-runtime"),s=require("@anker-in/headless-ui"),i=require("@anker-in/lib"),m=require("react"),c=require("./faqItem/FaqItem");const w=({copy:e})=>{const{title:n,items:r,subTitle:o=""}=e||{},{brand:l}=(0,i.useHeadlessContext)(),b=i.ROUNDED_BRANDS.includes(l),g=(0,m.useMemo)(()=>Array.from(new Set(r?.map?.(t=>t.category_name).filter(t=>!!t))),[r]),[f,x]=(0,m.useState)(g[0]?.toString()||""),p=(0,m.useMemo)(()=>r?g.length?r.filter(t=>t?.category_name===f):r:[],[r,g.length,f]);return(0,a.jsxs)(s.Container,{className:"bg-[#F5F5F7]",id:"faq",children:[n&&(0,a.jsx)(s.Heading,{as:"h2",size:"4",html:e?.title}),o&&(0,a.jsx)("div",{className:"mt-[8px] flex flex-row",children:(0,a.jsx)(s.Text,{size:"4",as:"p",html:o,className:"flex-1"})}),(0,a.jsx)(s.Tabs,{align:"left",shape:b?"rounded":"square",className:"mt-[24px]",value:f.toString(),onValueChange:t=>{x(t)},children:(0,a.jsx)(s.TabsList,{children:g.map((t,u)=>(0,a.jsx)(s.TabsTrigger,{value:t?.toString()||"",children:t},u))})}),(0,a.jsx)("div",{className:(0,i.classNames)("mt-[24px] flex flex-col overflow-auto pt-0"),children:p?.map((t,u)=>(0,a.jsx)(c.FaqItem,{index:u,defaultExpended:r.length===1,question:t.question,answer:t.answer,showDots:!1},u))}),e.learnMore?.link&&e.learnMore?.label&&(0,a.jsx)("a",{href:e.learnMore?.link,target:"_blank",className:"mt-[24px] block w-full text-center text-[18px] font-bold text-brand hover:underline l:text-[16px]",children:e.learnMore?.label})]})};
|
|
1
|
+
"use strict";var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var v=(e,n)=>{for(var r in n)d(e,r,{get:n[r],enumerable:!0})},C=(e,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of h(n))!q.call(e,l)&&l!==r&&d(e,l,{get:()=>n[l],enumerable:!(o=T(n,l))||o.enumerable});return e};var N=e=>C(d({},"__esModule",{value:!0}),e);var F={};v(F,{CreditsFaq:()=>w});module.exports=N(F);var a=require("react/jsx-runtime"),s=require("@anker-in/headless-ui"),i=require("@anker-in/lib"),m=require("react"),c=require("./faqItem/FaqItem");const w=({copy:e})=>{const{title:n,items:r,subTitle:o=""}=e||{},{brand:l}=(0,i.useHeadlessContext)(),b=i.ROUNDED_BRANDS.includes(l),g=(0,m.useMemo)(()=>Array.from(new Set(r?.map?.(t=>t.category_name).filter(t=>!!t))),[r]),[f,x]=(0,m.useState)(g[0]?.toString()||""),p=(0,m.useMemo)(()=>r?g.length?r.filter(t=>t?.category_name===f):r:[],[r,g.length,f]);return(0,a.jsxs)(s.Container,{className:"bg-[#F5F5F7]",id:"faq",children:[n&&(0,a.jsx)(s.Heading,{as:"h2",size:"4",html:e?.title}),o&&(0,a.jsx)("div",{className:"mt-[8px] flex flex-row",children:(0,a.jsx)(s.Text,{size:"4",as:"p",html:o,className:"flex-1"})}),(0,a.jsx)(s.Tabs,{align:"left",shape:b?"rounded":"square",className:"mt-[24px]",value:f.toString(),onValueChange:t=>{x(t)},children:(0,a.jsx)(s.TabsList,{children:g.map((t,u)=>(0,a.jsx)(s.TabsTrigger,{value:t?.toString()||"",children:t},u))})}),(0,a.jsx)("div",{className:(0,i.classNames)("mt-[24px] flex flex-col overflow-auto pt-0"),children:p?.map((t,u)=>(0,a.jsx)(c.FaqItem,{index:u,defaultExpended:r.length===1,question:t.question,answer:t.answer,showDots:!1},u))}),e.learnMore?.link&&e.learnMore?.label&&(0,a.jsx)("a",{href:e.learnMore?.link,target:"_blank",className:"mt-[24px] block w-full text-center text-[18px] font-bold text-brand-0 hover:underline l:text-[16px]",children:e.learnMore?.label})]})};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsFaq/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger, Text } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { useMemo, useState } from 'react'\n\nimport { FaqItem } from './faqItem/FaqItem'\n\nexport type CreditsFaqCopy = {\n title: string\n subTitle: string\n learnMore: {\n link: string\n label: string\n }\n items: {\n category_name: string\n question: string\n answer: string\n }[]\n}\nexport const CreditsFaq = ({ copy }: { copy: CreditsFaqCopy }) => {\n const { title, items: faqList, subTitle = '' } = copy || {}\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const categoryList = useMemo(() => {\n return Array.from(new Set(faqList?.map?.(faq => faq.category_name).filter(item => !!item)))\n }, [faqList])\n const [activeTab, setActiveTab] = useState<string>(categoryList[0]?.toString() || '')\n\n const currentList = useMemo(() => {\n if (!faqList) return []\n if (categoryList.length) {\n return faqList.filter(item => item?.category_name === activeTab)\n }\n return faqList\n }, [faqList, categoryList.length, activeTab])\n\n return (\n <Container className=\"bg-[#F5F5F7]\" id=\"faq\">\n {title && <Heading as=\"h2\" size=\"4\" html={copy?.title} />}\n {subTitle && (\n <div className=\"mt-[8px] flex flex-row\">\n <Text size=\"4\" as=\"p\" html={subTitle} className=\"flex-1\" />\n </div>\n )}\n {/* faq-nav */}\n <Tabs\n align=\"left\"\n shape={rounded ? 'rounded' : 'square'}\n className=\"mt-[24px]\"\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n }}\n >\n <TabsList>\n {categoryList.map((item, index) => (\n <TabsTrigger key={index} value={item?.toString() || ''}>\n {item}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n <div className={cn('mt-[24px] flex flex-col overflow-auto pt-0')}>\n {currentList?.map((item, index) => {\n return (\n <FaqItem\n key={index}\n index={index}\n defaultExpended={faqList.length === 1}\n question={item.question}\n answer={item.answer}\n showDots={false}\n ></FaqItem>\n )\n })}\n </div>\n {copy.learnMore?.link && copy.learnMore?.label && (\n <a\n href={copy.learnMore?.link}\n target=\"_blank\"\n className=\"mt-[24px] block w-full text-center text-[18px] font-bold text-brand hover:underline l:text-[16px]\"\n >\n {copy.learnMore?.label}\n </a>\n )}\n </Container>\n )\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAqCI,IAAAI,EAAA,6BArCJC,EAAsE,iCACtEC,EAAqE,yBACrEC,EAAkC,iBAElCC,EAAwB,6BAejB,MAAMN,EAAa,CAAC,CAAE,KAAAO,CAAK,IAAgC,CAChE,KAAM,CAAE,MAAAC,EAAO,MAAOC,EAAS,SAAAC,EAAW,EAAG,EAAIH,GAAQ,CAAC,EACpD,CAAE,MAAAI,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EACvCE,KAAe,WAAQ,IACpB,MAAM,KAAK,IAAI,IAAIJ,GAAS,MAAMK,GAAOA,EAAI,aAAa,EAAE,OAAOC,GAAQ,CAAC,CAACA,CAAI,CAAC,CAAC,EACzF,CAACN,CAAO,CAAC,EACN,CAACO,EAAWC,CAAY,KAAI,YAAiBJ,EAAa,CAAC,GAAG,SAAS,GAAK,EAAE,EAE9EK,KAAc,WAAQ,IACrBT,EACDI,EAAa,OACRJ,EAAQ,OAAOM,GAAQA,GAAM,gBAAkBC,CAAS,EAE1DP,EAJc,CAAC,EAKrB,CAACA,EAASI,EAAa,OAAQG,CAAS,CAAC,EAE5C,SACE,QAAC,aAAU,UAAU,eAAe,GAAG,MACpC,UAAAR,MAAS,OAAC,WAAQ,GAAG,KAAK,KAAK,IAAI,KAAMD,GAAM,MAAO,EACtDG,MACC,OAAC,OAAI,UAAU,yBACb,mBAAC,QAAK,KAAK,IAAI,GAAG,IAAI,KAAMA,EAAU,UAAU,SAAS,EAC3D,KAGF,OAAC,QACC,MAAM,OACN,MAAOE,EAAU,UAAY,SAC7B,UAAU,YACV,MAAOI,EAAU,SAAS,EAC1B,cAAeG,GAAS,CACtBF,EAAaE,CAAK,CACpB,EAEA,mBAAC,YACE,SAAAN,EAAa,IAAI,CAACE,EAAMK,OACvB,OAAC,eAAwB,MAAOL,GAAM,SAAS,GAAK,GACjD,SAAAA,GADeK,CAElB,CACD,EACH,EACF,KACA,OAAC,OAAI,aAAW,EAAAC,YAAG,4CAA4C,EAC5D,SAAAH,GAAa,IAAI,CAACH,EAAMK,OAErB,OAAC,WAEC,MAAOA,EACP,gBAAiBX,EAAQ,SAAW,EACpC,SAAUM,EAAK,SACf,OAAQA,EAAK,OACb,SAAU,IALLK,CAMN,CAEJ,EACH,EACCb,EAAK,WAAW,MAAQA,EAAK,WAAW,UACvC,OAAC,KACC,KAAMA,EAAK,WAAW,KACtB,OAAO,SACP,UAAU,
|
|
4
|
+
"sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger, Text } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { useMemo, useState } from 'react'\n\nimport { FaqItem } from './faqItem/FaqItem'\n\nexport type CreditsFaqCopy = {\n title: string\n subTitle: string\n learnMore: {\n link: string\n label: string\n }\n items: {\n category_name: string\n question: string\n answer: string\n }[]\n}\nexport const CreditsFaq = ({ copy }: { copy: CreditsFaqCopy }) => {\n const { title, items: faqList, subTitle = '' } = copy || {}\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const categoryList = useMemo(() => {\n return Array.from(new Set(faqList?.map?.(faq => faq.category_name).filter(item => !!item)))\n }, [faqList])\n const [activeTab, setActiveTab] = useState<string>(categoryList[0]?.toString() || '')\n\n const currentList = useMemo(() => {\n if (!faqList) return []\n if (categoryList.length) {\n return faqList.filter(item => item?.category_name === activeTab)\n }\n return faqList\n }, [faqList, categoryList.length, activeTab])\n\n return (\n <Container className=\"bg-[#F5F5F7]\" id=\"faq\">\n {title && <Heading as=\"h2\" size=\"4\" html={copy?.title} />}\n {subTitle && (\n <div className=\"mt-[8px] flex flex-row\">\n <Text size=\"4\" as=\"p\" html={subTitle} className=\"flex-1\" />\n </div>\n )}\n {/* faq-nav */}\n <Tabs\n align=\"left\"\n shape={rounded ? 'rounded' : 'square'}\n className=\"mt-[24px]\"\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n }}\n >\n <TabsList>\n {categoryList.map((item, index) => (\n <TabsTrigger key={index} value={item?.toString() || ''}>\n {item}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n <div className={cn('mt-[24px] flex flex-col overflow-auto pt-0')}>\n {currentList?.map((item, index) => {\n return (\n <FaqItem\n key={index}\n index={index}\n defaultExpended={faqList.length === 1}\n question={item.question}\n answer={item.answer}\n showDots={false}\n ></FaqItem>\n )\n })}\n </div>\n {copy.learnMore?.link && copy.learnMore?.label && (\n <a\n href={copy.learnMore?.link}\n target=\"_blank\"\n className=\"mt-[24px] block w-full text-center text-[18px] font-bold text-brand-0 hover:underline l:text-[16px]\"\n >\n {copy.learnMore?.label}\n </a>\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAqCI,IAAAI,EAAA,6BArCJC,EAAsE,iCACtEC,EAAqE,yBACrEC,EAAkC,iBAElCC,EAAwB,6BAejB,MAAMN,EAAa,CAAC,CAAE,KAAAO,CAAK,IAAgC,C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MN,CAEJ,EACH,EACCb,EAAK,WAAW,MAAQA,EAAK,WAAW,UACvC,OAAC,KACC,KAAMA,EAAK,WAAW,KACtB,OAAO,SACP,UAAU,sGAET,SAAAA,EAAK,WAAW,MACnB,GAEJ,CAEJ",
|
|
6
6
|
"names": ["creditsFaq_exports", "__export", "CreditsFaq", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_lib", "import_react", "import_FaqItem", "copy", "title", "faqList", "subTitle", "brand", "rounded", "categoryList", "faq", "item", "activeTab", "setActiveTab", "currentList", "value", "index", "cn"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var E=Object.create;var y=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var O=(r,s)=>{for(var d in s)y(r,d,{get:s[d],enumerable:!0})},_=(r,s,d,m)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of z(s))!M.call(r,c)&&c!==d&&y(r,c,{get:()=>s[c],enumerable:!(m=K(s,c))||m.enumerable});return r};var G=(r,s,d)=>(d=r!=null?E(L(r)):{},_(s||!r||!r.__esModule?y(d,"default",{value:r,enumerable:!0}):d,r)),H=r=>_(y({},"__esModule",{value:!0}),r);var V={};O(V,{AddressForm:()=>T});module.exports=H(V);var n=require("react/jsx-runtime"),h=G(require("classnames")),l=require("react"),S=require("./CountrySelect"),w=require("./FormItem"),I=require("./Input"),D=require("./StateSelect"),q=require("../../context/const"),P=require("../../context/provider"),b=require("@anker-in/lib");const T=({countries:r,countriesLoading:s,form:d,validate:m,errors:c,onChange:p})=>{const{profile:v,customer:t}=(0,P.useCreditsContext)(),{locale:A,brand:R}=(0,b.useHeadlessContext)(),U=b.ROUNDED_BRANDS.includes(R),[e,f]=(0,l.useState)(),N=(0,l.useMemo)(()=>r.find(u=>u.code===e?.country)?.provinces||[],[e,r]),k=(0,l.useMemo)(()=>d?.flat().find(u=>u.type==="state")?.key,[d]),F=(0,l.useCallback)(()=>{if(t?.defaultAddress)return{name:(t?.defaultAddress.firstName||"")+" "+(t?.defaultAddress.lastName||""),first_name:t?.defaultAddress.firstName,last_name:t?.defaultAddress.lastName,address1:t?.defaultAddress.address1,address2:t?.defaultAddress.address2,city:t?.defaultAddress.city,phone:t?.defaultAddress.phone,country:t?.defaultAddress.countryCodeV2,province:t?.defaultAddress.province,province_code:t?.defaultAddress.provinceCode,email:t?.email||v?.email,zip:t?.defaultAddress.zip};{let o=q.ALPC_COUNTRY_MAP.get(A)||A;return o==="UK"&&(o="GB"),o==="EU"&&(o="NL"),{email:v?.email,country:o}}},[t,v?.email,A]);return(0,l.useEffect)(()=>{if(t){const o=F();f(o),p(o)}},[t,F]),e?(0,n.jsx)("div",{className:"grid gap-[20px]",children:d&&d.map((o,u)=>(0,n.jsx)("div",{className:"item-center -mx-[6px] flex",children:o.map((a,B)=>{const x=c.find(i=>i.key===a.key)?.message,g=(0,h.default)("h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",x?"!border-[#F84D4F]":"border-[#d8d8d8]",!U&&"rounded-none");return a.type==="state"&&!N.length?null:(0,n.jsx)("div",{className:(0,h.default)("mx-[6px] flex-1"),children:(0,n.jsxs)(w.FormItem,{error:x,required:a.required,label:a.label,children:[a.type==="country"&&(0,n.jsx)(S.CountrySelect,{className:g,countries:r,loading:s,value:e.country,onChange:i=>{e.country!==i&&(e.province="",e.province_code=""),e.country=i,f({...e}),p(e)}}),a.type==="state"&&(0,n.jsx)(D.StateSelect,{className:g,states:N,stateCode:e.province_code,stateName:e.province,onChange:(i,C)=>{e.province_code=i,e.province=C,f({...e}),p(e)}}),a.type!=="state"&&a.type!=="country"&&(0,n.jsx)(I.Input,{placeholder:a.label,className:g,error:x,value:e[a.key],required:a.required,disabled:a.type==="email",onChange:i=>{const C=i.target.value;e[a.key]=C,f({...e}),p(e)},onBlur:()=>{m({ignoreKeys:N.length&&k?[k]:[]})}})]})},B)})},u))}):null};
|
|
1
|
+
"use strict";var E=Object.create;var y=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var O=(r,s)=>{for(var d in s)y(r,d,{get:s[d],enumerable:!0})},_=(r,s,d,m)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of z(s))!M.call(r,c)&&c!==d&&y(r,c,{get:()=>s[c],enumerable:!(m=K(s,c))||m.enumerable});return r};var G=(r,s,d)=>(d=r!=null?E(L(r)):{},_(s||!r||!r.__esModule?y(d,"default",{value:r,enumerable:!0}):d,r)),H=r=>_(y({},"__esModule",{value:!0}),r);var V={};O(V,{AddressForm:()=>T});module.exports=H(V);var n=require("react/jsx-runtime"),h=G(require("classnames")),l=require("react"),S=require("./CountrySelect"),w=require("./FormItem"),I=require("./Input"),D=require("./StateSelect"),q=require("../../context/const"),P=require("../../context/provider"),b=require("@anker-in/lib");const T=({countries:r,countriesLoading:s,form:d,validate:m,errors:c,onChange:p})=>{const{profile:v,customer:t}=(0,P.useCreditsContext)(),{locale:A,brand:R}=(0,b.useHeadlessContext)(),U=b.ROUNDED_BRANDS.includes(R),[e,f]=(0,l.useState)(),N=(0,l.useMemo)(()=>r.find(u=>u.code===e?.country)?.provinces||[],[e,r]),k=(0,l.useMemo)(()=>d?.flat().find(u=>u.type==="state")?.key,[d]),F=(0,l.useCallback)(()=>{if(t?.defaultAddress)return{name:(t?.defaultAddress.firstName||"")+" "+(t?.defaultAddress.lastName||""),first_name:t?.defaultAddress.firstName,last_name:t?.defaultAddress.lastName,address1:t?.defaultAddress.address1,address2:t?.defaultAddress.address2,city:t?.defaultAddress.city,phone:t?.defaultAddress.phone,country:t?.defaultAddress.countryCodeV2,province:t?.defaultAddress.province,province_code:t?.defaultAddress.provinceCode,email:t?.email||v?.email,zip:t?.defaultAddress.zip};{let o=q.ALPC_COUNTRY_MAP.get(A)||A;return o==="UK"&&(o="GB"),o==="EU"&&(o="NL"),{email:v?.email,country:o}}},[t,v?.email,A]);return(0,l.useEffect)(()=>{if(t){const o=F();f(o),p(o)}},[t,F]),e?(0,n.jsx)("div",{className:"grid gap-[20px]",children:d&&d.map((o,u)=>(0,n.jsx)("div",{className:"item-center -mx-[6px] flex",children:o.map((a,B)=>{const x=c.find(i=>i.key===a.key)?.message,g=(0,h.default)("h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand-0 disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",x?"!border-[#F84D4F]":"border-[#d8d8d8]",!U&&"rounded-none");return a.type==="state"&&!N.length?null:(0,n.jsx)("div",{className:(0,h.default)("mx-[6px] flex-1"),children:(0,n.jsxs)(w.FormItem,{error:x,required:a.required,label:a.label,children:[a.type==="country"&&(0,n.jsx)(S.CountrySelect,{className:g,countries:r,loading:s,value:e.country,onChange:i=>{e.country!==i&&(e.province="",e.province_code=""),e.country=i,f({...e}),p(e)}}),a.type==="state"&&(0,n.jsx)(D.StateSelect,{className:g,states:N,stateCode:e.province_code,stateName:e.province,onChange:(i,C)=>{e.province_code=i,e.province=C,f({...e}),p(e)}}),a.type!=="state"&&a.type!=="country"&&(0,n.jsx)(I.Input,{placeholder:a.label,className:g,error:x,value:e[a.key],required:a.required,disabled:a.type==="email",onChange:i=>{const C=i.target.value;e[a.key]=C,f({...e}),p(e)},onBlur:()=>{m({ignoreKeys:N.length&&k?[k]:[]})}})]})},B)})},u))}):null};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/creditsRedeemList/AddressForm/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { CountrySelect } from './CountrySelect'\nimport { FormItem } from './FormItem'\nimport { Input } from './Input'\nimport { StateSelect } from './StateSelect'\nimport { ALPC_COUNTRY_MAP } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\nimport { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { AddressFormProps } from './type'\n\nexport const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {\n const { profile, customer } = useCreditsContext()\n const { locale, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const [address, setAddress] = useState<Record<string, any>>()\n\n const states = useMemo(() => {\n const currentCountry = countries.find(item => item.code === address?.country)\n\n return currentCountry?.provinces || []\n }, [address, countries])\n\n const stateInputKey = useMemo(() => {\n const stateInput = form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [form])\n\n const getDefaultAddress = useCallback(() => {\n if (customer?.defaultAddress) {\n return {\n name: (customer?.defaultAddress.firstName || '') + ' ' + (customer?.defaultAddress.lastName || ''),\n first_name: customer?.defaultAddress.firstName,\n last_name: customer?.defaultAddress.lastName,\n address1: customer?.defaultAddress.address1,\n address2: customer?.defaultAddress.address2,\n city: customer?.defaultAddress.city,\n phone: customer?.defaultAddress.phone,\n country: customer?.defaultAddress.countryCodeV2,\n province: customer?.defaultAddress.province,\n province_code: customer?.defaultAddress.provinceCode,\n email: customer?.email || profile?.email,\n zip: customer?.defaultAddress.zip,\n }\n } else {\n let defaultCountry = ALPC_COUNTRY_MAP.get(locale) || locale\n if (defaultCountry === 'UK') {\n defaultCountry = 'GB'\n }\n if (defaultCountry === 'EU') {\n defaultCountry = 'NL'\n }\n return {\n email: profile?.email,\n country: defaultCountry,\n }\n }\n }, [customer, profile?.email, locale])\n\n useEffect(() => {\n if (customer) {\n const defaultAddress = getDefaultAddress()\n setAddress(defaultAddress)\n onChange(defaultAddress)\n }\n }, [customer, getDefaultAddress])\n\n if (!address) {\n return null\n }\n\n return (\n <div className=\"grid gap-[20px]\">\n {form &&\n form.map((row, rowIndex: number) => (\n <div key={rowIndex} className=\"item-center -mx-[6px] flex\">\n {row.map((input, inputIndex: number) => {\n const error = errors.find(item => item.key === input.key)?.message\n const inputClassName = classNames(\n 'h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n error ? '!border-[#F84D4F]' : 'border-[#d8d8d8]',\n !rounded && 'rounded-none'\n )\n\n if (input.type === 'state') {\n if (!states.length) {\n return null\n }\n }\n\n return (\n <div key={inputIndex} className={classNames('mx-[6px] flex-1')}>\n <FormItem error={error} required={input.required} label={input.label}>\n {input.type === 'country' && (\n <CountrySelect\n className={inputClassName}\n countries={countries}\n loading={countriesLoading}\n value={address.country}\n onChange={selectedCountryCode => {\n if (address.country !== selectedCountryCode) {\n address.province = ''\n address.province_code = ''\n }\n address.country = selectedCountryCode\n setAddress({ ...address })\n onChange(address)\n }}\n ></CountrySelect>\n )}\n {input.type === 'state' && (\n <StateSelect\n className={inputClassName}\n states={states}\n stateCode={address.province_code}\n stateName={address.province}\n onChange={(provinceCode, provinceName) => {\n address.province_code = provinceCode\n address.province = provinceName\n setAddress({ ...address })\n onChange(address)\n }}\n ></StateSelect>\n )}\n\n {input.type !== 'state' && input.type !== 'country' && (\n <Input\n placeholder={input.label}\n className={inputClassName}\n error={error}\n value={address[input.key]}\n required={input.required}\n disabled={input.type === 'email'}\n onChange={event => {\n const value = event.target.value\n address[input.key] = value\n setAddress({ ...address })\n onChange(address)\n }}\n onBlur={() => {\n validate({\n ignoreKe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AAeA,GAAU,eAAe,aACxC,MAAOA,GAAU,OAASD,GAAS,MACnC,IAAKC,GAAU,eAAe,GAChC,EACK,CACL,IAAIU,EAAiB,mBAAiB,IAAIT,CAAM,GAAKA,EACrD,OAAIS,IAAmB,OACrBA,EAAiB,MAEfA,IAAmB,OACrBA,EAAiB,MAEZ,CACL,MAAOX,GAAS,MAChB,QAASW,CACX,CACF,CACF,EAAG,CAACV,EAAUD,GAAS,MAAOE,CAAM,CAAC,EAUrC,SARA,aAAU,IAAM,CACd,GAAID,EAAU,CACZ,MAAMW,EAAiBF,EAAkB,EACzCJ,EAAWM,CAAc,EACzBb,EAASa,CAAc,CACzB,CACF,EAAG,CAACX,EAAUS,CAAiB,CAAC,EAE3BL,KAKH,OAAC,OAAI,UAAU,kBACZ,SAAAT,GACCA,EAAK,IAAI,CAACiB,EAAKC,OACb,OAAC,OAAmB,UAAU,6BAC3B,SAAAD,EAAI,IAAI,CAACE,EAAOC,IAAuB,CACtC,MAAMC,EAAQnB,EAAO,KAAKU,GAAQA,EAAK,MAAQO,EAAM,GAAG,GAAG,QACrDG,KAAiB,EAAAC,SACrB,
|
|
4
|
+
"sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { CountrySelect } from './CountrySelect'\nimport { FormItem } from './FormItem'\nimport { Input } from './Input'\nimport { StateSelect } from './StateSelect'\nimport { ALPC_COUNTRY_MAP } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\nimport { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { AddressFormProps } from './type'\n\nexport const AddressForm = ({ countries, countriesLoading, form, validate, errors, onChange }: AddressFormProps) => {\n const { profile, customer } = useCreditsContext()\n const { locale, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const [address, setAddress] = useState<Record<string, any>>()\n\n const states = useMemo(() => {\n const currentCountry = countries.find(item => item.code === address?.country)\n\n return currentCountry?.provinces || []\n }, [address, countries])\n\n const stateInputKey = useMemo(() => {\n const stateInput = form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [form])\n\n const getDefaultAddress = useCallback(() => {\n if (customer?.defaultAddress) {\n return {\n name: (customer?.defaultAddress.firstName || '') + ' ' + (customer?.defaultAddress.lastName || ''),\n first_name: customer?.defaultAddress.firstName,\n last_name: customer?.defaultAddress.lastName,\n address1: customer?.defaultAddress.address1,\n address2: customer?.defaultAddress.address2,\n city: customer?.defaultAddress.city,\n phone: customer?.defaultAddress.phone,\n country: customer?.defaultAddress.countryCodeV2,\n province: customer?.defaultAddress.province,\n province_code: customer?.defaultAddress.provinceCode,\n email: customer?.email || profile?.email,\n zip: customer?.defaultAddress.zip,\n }\n } else {\n let defaultCountry = ALPC_COUNTRY_MAP.get(locale) || locale\n if (defaultCountry === 'UK') {\n defaultCountry = 'GB'\n }\n if (defaultCountry === 'EU') {\n defaultCountry = 'NL'\n }\n return {\n email: profile?.email,\n country: defaultCountry,\n }\n }\n }, [customer, profile?.email, locale])\n\n useEffect(() => {\n if (customer) {\n const defaultAddress = getDefaultAddress()\n setAddress(defaultAddress)\n onChange(defaultAddress)\n }\n }, [customer, getDefaultAddress])\n\n if (!address) {\n return null\n }\n\n return (\n <div className=\"grid gap-[20px]\">\n {form &&\n form.map((row, rowIndex: number) => (\n <div key={rowIndex} className=\"item-center -mx-[6px] flex\">\n {row.map((input, inputIndex: number) => {\n const error = errors.find(item => item.key === input.key)?.message\n const inputClassName = classNames(\n 'h-full w-full appearance-none rounded-[2px] border bg-white px-[14px] py-[17px] leading-[1] outline-none placeholder:text-[#999] autofill:shadow-white focus:border-brand-0 disabled:pointer-events-none disabled:text-[#999] disabled:bg-[#F7F8F9] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n error ? '!border-[#F84D4F]' : 'border-[#d8d8d8]',\n !rounded && 'rounded-none'\n )\n\n if (input.type === 'state') {\n if (!states.length) {\n return null\n }\n }\n\n return (\n <div key={inputIndex} className={classNames('mx-[6px] flex-1')}>\n <FormItem error={error} required={input.required} label={input.label}>\n {input.type === 'country' && (\n <CountrySelect\n className={inputClassName}\n countries={countries}\n loading={countriesLoading}\n value={address.country}\n onChange={selectedCountryCode => {\n if (address.country !== selectedCountryCode) {\n address.province = ''\n address.province_code = ''\n }\n address.country = selectedCountryCode\n setAddress({ ...address })\n onChange(address)\n }}\n ></CountrySelect>\n )}\n {input.type === 'state' && (\n <StateSelect\n className={inputClassName}\n states={states}\n stateCode={address.province_code}\n stateName={address.province}\n onChange={(provinceCode, provinceName) => {\n address.province_code = provinceCode\n address.province = provinceName\n setAddress({ ...address })\n onChange(address)\n }}\n ></StateSelect>\n )}\n\n {input.type !== 'state' && input.type !== 'country' && (\n <Input\n placeholder={input.label}\n className={inputClassName}\n error={error}\n value={address[input.key]}\n required={input.required}\n disabled={input.type === 'email'}\n onChange={event => {\n const value = event.target.value\n address[input.key] = value\n setAddress({ ...address })\n onChange(address)\n }}\n onBlur={() => {\n validate({\n ignoreKeys: states.length && stateInputKey ? [stateInputKey] : [],\n })\n }}\n />\n )}\n </FormItem>\n </div>\n )\n })}\n </div>\n ))}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GA6FkB,IAAAI,EAAA,6BA7FlBC,EAAuB,yBACvBC,EAA0D,iBAE1DC,EAA8B,2BAC9BC,EAAyB,sBACzBC,EAAsB,mBACtBC,EAA4B,yBAC5BC,EAAiC,+BACjCC,EAAkC,kCAClCC,EAAmD,yBAG5C,MAAMX,EAAc,CAAC,CAAE,UAAAY,EAAW,iBAAAC,EAAkB,KAAAC,EAAM,SAAAC,EAAU,OAAAC,EAAQ,SAAAC,CAAS,IAAwB,CAClH,KAAM,CAAE,QAAAC,EAAS,SAAAC,CAAS,KAAI,qBAAkB,EAC1C,CAAE,OAAAC,EAAQ,MAAAC,CAAM,KAAI,sBAAmB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AAI,CAAC,CAClE,CAAC,CACH,EACF,GAEJ,GAvDQO,CAwDV,CAEJ,CAAC,GA1EOF,CA2EV,CACD,EACL,EApFO,IAsFX",
|
|
6
6
|
"names": ["AddressForm_exports", "__export", "AddressForm", "__toCommonJS", "import_jsx_runtime", "import_classnames", "import_react", "import_CountrySelect", "import_FormItem", "import_Input", "import_StateSelect", "import_const", "import_provider", "import_lib", "countries", "countriesLoading", "form", "validate", "errors", "onChange", "profile", "customer", "locale", "brand", "rounded", "address", "setAddress", "states", "item", "stateInputKey", "getDefaultAddress", "defaultCountry", "defaultAddress", "row", "rowIndex", "input", "inputIndex", "error", "inputClassName", "classNames", "selectedCountryCode", "provinceCode", "provinceName", "event", "value"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var E=(t,n)=>{for(var l in n)k(t,l,{get:n[l],enumerable:!0})},H=(t,n,l,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of j(n))!q.call(t,d)&&d!==l&&k(t,d,{get:()=>n[d],enumerable:!(p=_(n,d))||p.enumerable});return t};var V=t=>H(k({},"__esModule",{value:!0}),t);var K={};E(K,{CreditsWaysToGetCredits:()=>J});module.exports=V(K);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),f=require("@heroicons/react/24/outline"),I=require("framer-motion"),a=require("react"),x=require("./type"),y=require("./useActions"),D=require("../context/provider"),o=require("@anker-in/lib"),R=require("../../registration"),T=require("../modal/creditsUploadReceiptModal"),U=require("../modal/subscribeModal");const J=({copy:t,classNames:n})=>{const[l,p]=(0,a.useState)(!1),{profile:d}=(0,D.useCreditsContext)(),{authCodeActivate:L}=(0,R.useRegistration)(),{brand:M}=(0,o.useHeadlessContext)(),C=o.ROUNDED_BRANDS.includes(M),b=!!d,[O,N]=(0,a.useState)(!1),[A,h]=(0,a.useState)(!1),[w,B]=(0,a.useState)(!1),[F,P]=(0,a.useState)(!1),{actions:v}=(0,y.useActions)({copy:t,subscribe:{openSubscribePopup:()=>h(!0),isSuccess:w},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:F}}),G=(0,a.useMemo)(()=>{const s=t.list.map(r=>{if(!v[r.id])return;const{finished:c,notLogin:S,notFinished:g,completed:W}=v[r.id];let m="",u,z;return b?c?(m=W.buttonLabel,u=void 0):(m=g.buttonLabel,u=g.handleClick,z=g.link):(m=S.buttonLabel,u=S.handleClick),{...r,buttonLabel:m,handleClick:u,finished:c,link:z}}).filter(Boolean);return b?s.sort((r,c)=>r?.finished&&!c?.finished?1:!r?.finished&&c?.finished?-1:0):s},[v,t.list,b]);return(0,e.jsxs)(i.Container,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[(0,e.jsxs)("div",{className:(0,o.classNames)("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!C&&"rounded-none"),children:[(0,e.jsx)(i.Heading,{as:"h2",size:4,html:t?.title,className:"text-center l:pl-[16px] l:text-left"}),(0,e.jsxs)("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[(0,e.jsxs)("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[(0,e.jsx)(i.Heading,{size:3,as:"h3",html:t.subtitle,className:n?.subtitle}),(0,e.jsxs)("div",{className:"mt-[8px] flex items-center",children:[t.creditsIcon?.url&&(0,e.jsx)(i.Picture,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:t.creditsIcon.url,alt:t.creditsIcon.alt||"credits"}),(0,e.jsx)(i.Heading,{html:t.equalCredits,size:4,as:"h3",className:(0,o.classNames)("mt-2 text-white md:text-[24px]",n?.equalCreditsText)})]})]}),(0,e.jsx)(i.Picture,{className:"w-full laptop:w-[50%]",source:t.mainImage?.url})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)(I.motion.div,{className:(0,o.classNames)("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:l?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!l&&window.screen.width<768){const s=document.getElementById("ways-to-get-credits");s&&s.scrollIntoView({behavior:"smooth",block:"end"})}},children:[G.map(s=>(0,e.jsxs)("div",{className:(0,o.classNames)("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!C&&"rounded-none"),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Heading,{as:"h4",html:s.title,size:2,className:"text-pretty"}),(0,e.jsxs)("div",{className:"mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),s.handleClick&&!(s.id===x.TaskType.UploadReceipt&&F)&&!(s.id===x.TaskType.Activate&&L.isActivateSuccess)&&!(s.id===x.TaskType.Subscribe&&w)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!l&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),l?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{p(!1)},children:(0,e.jsx)(f.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>p(!l),children:(0,e.jsx)(f.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),t.receipt&&(0,e.jsx)(T.CreditsUploadReceiptModal,{isOpen:O,onClose:()=>{N(!1)},copy:t.receipt,onSuccess:()=>{P(!0)}}),t.subscribe&&(0,e.jsx)(U.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{B(!0),setTimeout(()=>{h(!1)},3e3)},isOpen:A,onClose:()=>{h(!1)}})]})};
|
|
1
|
+
"use strict";var k=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var E=(t,n)=>{for(var l in n)k(t,l,{get:n[l],enumerable:!0})},H=(t,n,l,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of j(n))!q.call(t,d)&&d!==l&&k(t,d,{get:()=>n[d],enumerable:!(p=_(n,d))||p.enumerable});return t};var V=t=>H(k({},"__esModule",{value:!0}),t);var K={};E(K,{CreditsWaysToGetCredits:()=>J});module.exports=V(K);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),f=require("@heroicons/react/24/outline"),I=require("framer-motion"),a=require("react"),x=require("./type"),y=require("./useActions"),D=require("../context/provider"),o=require("@anker-in/lib"),R=require("../../registration"),T=require("../modal/creditsUploadReceiptModal"),U=require("../modal/subscribeModal");const J=({copy:t,classNames:n})=>{const[l,p]=(0,a.useState)(!1),{profile:d}=(0,D.useCreditsContext)(),{authCodeActivate:L}=(0,R.useRegistration)(),{brand:M}=(0,o.useHeadlessContext)(),C=o.ROUNDED_BRANDS.includes(M),b=!!d,[O,N]=(0,a.useState)(!1),[A,h]=(0,a.useState)(!1),[w,B]=(0,a.useState)(!1),[F,P]=(0,a.useState)(!1),{actions:v}=(0,y.useActions)({copy:t,subscribe:{openSubscribePopup:()=>h(!0),isSuccess:w},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:F}}),G=(0,a.useMemo)(()=>{const s=t.list.map(r=>{if(!v[r.id])return;const{finished:c,notLogin:S,notFinished:g,completed:W}=v[r.id];let m="",u,z;return b?c?(m=W.buttonLabel,u=void 0):(m=g.buttonLabel,u=g.handleClick,z=g.link):(m=S.buttonLabel,u=S.handleClick),{...r,buttonLabel:m,handleClick:u,finished:c,link:z}}).filter(Boolean);return b?s.sort((r,c)=>r?.finished&&!c?.finished?1:!r?.finished&&c?.finished?-1:0):s},[v,t.list,b]);return(0,e.jsxs)(i.Container,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[(0,e.jsxs)("div",{className:(0,o.classNames)("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!C&&"rounded-none"),children:[(0,e.jsx)(i.Heading,{as:"h2",size:4,html:t?.title,className:"text-center l:pl-[16px] l:text-left"}),(0,e.jsxs)("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[(0,e.jsxs)("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[(0,e.jsx)(i.Heading,{size:3,as:"h3",html:t.subtitle,className:n?.subtitle}),(0,e.jsxs)("div",{className:"mt-[8px] flex items-center",children:[t.creditsIcon?.url&&(0,e.jsx)(i.Picture,{className:"size-[48px] mr-[8px] stroke-brand-0 xl:size-[30px] [&_path]:stroke-brand-0",source:t.creditsIcon.url,alt:t.creditsIcon.alt||"credits"}),(0,e.jsx)(i.Heading,{html:t.equalCredits,size:4,as:"h3",className:(0,o.classNames)("mt-2 text-white md:text-[24px]",n?.equalCreditsText)})]})]}),(0,e.jsx)(i.Picture,{className:"w-full laptop:w-[50%]",source:t.mainImage?.url})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)(I.motion.div,{className:(0,o.classNames)("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:l?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!l&&window.screen.width<768){const s=document.getElementById("ways-to-get-credits");s&&s.scrollIntoView({behavior:"smooth",block:"end"})}},children:[G.map(s=>(0,e.jsxs)("div",{className:(0,o.classNames)("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!C&&"rounded-none"),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Heading,{as:"h4",html:s.title,size:2,className:"text-pretty"}),(0,e.jsxs)("div",{className:"mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),s.handleClick&&!(s.id===x.TaskType.UploadReceipt&&F)&&!(s.id===x.TaskType.Activate&&L.isActivateSuccess)&&!(s.id===x.TaskType.Subscribe&&w)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!l&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),l?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{p(!1)},children:(0,e.jsx)(f.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>p(!l),children:(0,e.jsx)(f.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),t.receipt&&(0,e.jsx)(T.CreditsUploadReceiptModal,{isOpen:O,onClose:()=>{N(!1)},copy:t.receipt,onSuccess:()=>{P(!0)}}),t.subscribe&&(0,e.jsx)(U.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{B(!0),setTimeout(()=>{h(!1)},3e3)},isOpen:A,onClose:()=>{h(!1)}})]})};
|
|
2
2
|
//# sourceMappingURL=CreditsWaysToGetCredits.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\n\nexport const CreditsWaysToGetCredits = ({ copy, classNames }: CreditsWaysToGetCreditsProps) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id=\"ways-to-get-credits\" className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div\n className={cn(\n 'rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]',\n !rounded && 'rounded-none'\n )}\n >\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <motion.div\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2'\n )}\n initial={{ height: 512 }}\n animate={{ height: showMore ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && window.screen.width < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]',\n !rounded && 'rounded-none'\n )}\n >\n <div>\n <Heading as=\"h4\" html={item.title} size={2} className=\"text-pretty\" />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text as=\"p\" html={item.credits} size={2} className=\"ml-[4px] mt-[6px] lg-desktop:text-[18px]\" />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)' }}\n ></div>\n )}\n </motion.div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAoGQ,IAAAI,EAAA,6BApGRC,EAA0D,iCAC1DC,EAA+C,uCAC/CC,EAAuB,yBACvBC,EAAkC,iBAElCC,EAA4D,kBAC5DC,EAA2B,wBAC3BC,EAAkC,+BAClCC,EAAqE,yBACrEC,EAAgC,8BAChCC,EAA0C,8CAC1CC,EAAsC,mCAE/B,MAAMb,EAA0B,CAAC,CAAE,KAAAc,EAAM,WAAAC,CAAW,IAAoC,CAC7F,KAAM,CAACC,EAA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,CAEX,EAAG,CAACD,EAASjB,EAAK,KAAMQ,CAAO,CAAC,EAEhC,SACE,QAAC,aAAU,GAAG,sBAAsB,UAAU,gCAC5C,qBAAC,OACC,aAAW,EAAAqB,YACT,wHACA,CAACtB,GAAW,cACd,EAEA,oBAAC,WAAQ,GAAG,KAAK,KAAM,EAAG,KAAMP,GAAM,MAAO,UAAU,sCAAsC,KAC7F,QAAC,OAAI,UAAU,uHACb,qBAAC,OAAI,UAAU,+DACb,oBAAC,WAAQ,KAAM,EAAG,GAAG,KAAK,KAAMA,EAAK,SAAU,UAAWC,GAAY,SAAU,KAChF,QAAC,OAAI,UAAU,6BACZ,UAAAD,EAAK,aAAa,QACjB,OAAC,WACC,UAAU,
|
|
4
|
+
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\n\nexport const CreditsWaysToGetCredits = ({ copy, classNames }: CreditsWaysToGetCreditsProps) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id=\"ways-to-get-credits\" className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div\n className={cn(\n 'rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]',\n !rounded && 'rounded-none'\n )}\n >\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand-0 xl:size-[30px] [&_path]:stroke-brand-0\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <motion.div\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2'\n )}\n initial={{ height: 512 }}\n animate={{ height: showMore ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && window.screen.width < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]',\n !rounded && 'rounded-none'\n )}\n >\n <div>\n <Heading as=\"h4\" html={item.title} size={2} className=\"text-pretty\" />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text as=\"p\" html={item.credits} size={2} className=\"ml-[4px] mt-[6px] lg-desktop:text-[18px]\" />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)' }}\n ></div>\n )}\n </motion.div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAoGQ,IAAAI,EAAA,6BApGRC,EAA0D,iCAC1DC,EAA+C,uCAC/CC,EAAuB,yBACvBC,EAAkC,iBAElCC,EAA4D,kBAC5DC,EAA2B,wBAC3BC,EAAkC,+BAClCC,EAAqE,yBACrEC,EAAgC,8BAChCC,EAA0C,8CAC1CC,EAAsC,mCAE/B,MAAMb,EAA0B,CAAC,CAAE,KAAAc,EAAM,WAAAC,CAAW,IAAoC,CAC7F,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxC,CAAE,QAAAC,CAAQ,KAAI,qBAAkB,EAChC,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EACvCE,EAAU,CAAC,CAACJ,EAEZ,CAACK,EAA0BC,CAA2B,KAAI,YAAS,EAAK,EACxE,CAACC,EAAsBC,CAAuB,KAAI,YAAS,EAAK,EAChE,CAACC,EAAoBC,CAAqB,KAAI,YAAS,EAAK,EAC5D,CAACC,EAAwBC,CAAyB,KAAI,YAAS,EAAK,EAEpE,CAAE,QAAAC,CAAQ,KAAI,cAAW,CAC7B,KAAAjB,EACA,UAAW,CACT,mBAAoB,IAAMY,EAAwB,EAAI,EACtD,UAAWC,CACb,EACA,cAAe,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,UAAU,KAAK,KAAK,UAAU,kBAAkB,SAAQ,GACrE,SAAAA,EAAK,YACR,IAlCGA,EAAK,EAoCZ,CACD,EACA,CAACjB,MACA,OAAC,OACC,UAAU,qDACV,MAAO,CAAE,WAAY,mEAAoE,EAC1F,GAEL,EACCA,KACC,OAAC,UACC,UAAU,8CACV,QAAS,IAAM,CACbC,EAAY,EAAK,CACnB,EAEA,mBAAC,iBAAc,UAAU,kDAAkD,EAC7E,KAEA,mBACE,mBAAC,OAAI,UAAU,6EACb,mBAAC,UAAO,UAAU,QAAQ,QAAS,IAAMA,EAAY,CAACD,CAAQ,EAC5D,mBAAC,mBAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,GAEJ,GACF,EACCF,EAAK,YACJ,OAAC,6BACC,OAAQS,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMV,EAAK,QACX,UAAW,IAAM,CACfgB,EAA0B,EAAI,CAChC,EACF,EAEDhB,EAAK,cACJ,OAAC,yBACC,KAAMA,EAAK,UACX,UAAW,IAAM,CACfc,EAAsB,EAAI,EAC1B,WAAW,IAAM,CACfF,EAAwB,EAAK,CAC/B,EAAG,GAAI,CACT,EACA,OAAQD,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
|
|
6
6
|
"names": ["CreditsWaysToGetCredits_exports", "__export", "CreditsWaysToGetCredits", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_framer_motion", "import_react", "import_type", "import_useActions", "import_provider", "import_lib", "import_registration", "import_creditsUploadReceiptModal", "import_subscribeModal", "copy", "classNames", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "cn", "section"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var V=Object.create;var m=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var X=(o,n)=>{for(var i in n)m(o,i,{get:n[i],enumerable:!0})},F=(o,n,i,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of J(n))!W.call(o,a)&&a!==i&&m(o,a,{get:()=>n[a],enumerable:!(u=G(n,a))||u.enumerable});return o};var d=(o,n,i)=>(i=o!=null?V(Q(o)):{},F(n||!o||!o.__esModule?m(i,"default",{value:o,enumerable:!0}):i,o)),Z=o=>F(m({},"__esModule",{value:!0}),o);var te={};X(te,{default:()=>oe});module.exports=Z(te);var s=require("react/jsx-runtime"),p=require("@anker-in/headless-ui"),g=d(require("classnames")),_=d(require("copy-to-clipboard")),h=d(require("dayjs")),r=require("react"),e=require("../context/const"),D=require("./modalContainer"),A=d(require("./tip")),O=d(require("./loadingDots")),x=d(require("../context/hooks/useMyRewards")),b=require("@anker-in/lib");function ee({data:o,...n}){const[i,u]=(0,r.useState)(e.AlpcConsumeType.Coupon),{brand:a}=(0,b.useHeadlessContext)(),y=b.ROUNDED_BRANDS.includes(a),[c,I]=(0,r.useState)(1),[f,U]=(0,r.useState)(1),[k,C]=(0,r.useState)(-1),E=(0,r.useMemo)(()=>{const t=[];return o.couponTab&&t.push({title:o.couponTab,type:e.AlpcConsumeType.Coupon}),o.productTab&&t.push({title:o.productTab,type:e.AlpcConsumeType.Product}),t},[o.couponTab,o.productTab]),Y=(0,r.useMemo)(()=>({page:n.isOpen?f:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Product}),[n.isOpen,f]),j=(0,r.useMemo)(()=>({page:n.isOpen?c:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Coupon}),[n.isOpen,c]),{myRewards:N=[],canNext:T,isLoading:H}=(0,x.default)(j),{myRewards:L=[],canNext:P,isLoading:$}=(0,x.default)(Y),M=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?N.map(t=>({title:t.goods_title,value:t.consume_credits,type:e.RewardType.Received,date:new Date(t.create_time*1e3),couponCode:t.coupon_code,orderNumber:""})):i===e.AlpcConsumeType.Product?L.map(t=>{let l=e.RewardType.Pending;return t.fulfillment_status&&t.fulfillment_status!=="null"?t.fulfillment_status==="fulfilled"?l=e.RewardType.Fulfilled:l=e.RewardType.Unfulfilled:t.approval_status===e.ApprovalStatus.Success||t.approval_status===e.ApprovalStatus.DoubleConfirm?l=e.RewardType.ApproveSuccess:t.approval_status===e.ApprovalStatus.Failed&&(l=e.RewardType.Failed),{title:t.goods_title,value:t.consume_credits,type:l,date:new Date(t.create_time*1e3),orderNumber:t.order_number,couponCode:""}}):[],[i,L,N]),w=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?T:i===e.AlpcConsumeType.Product?P:!1,[i,T,P]),z=(0,r.useMemo)(()=>({[e.RewardType.Received]:o.receivedLabel,[e.RewardType.Pending]:o.pendingLabel,[e.RewardType.ApproveFail]:o.failedLabel,[e.RewardType.ApproveSuccess]:o.approveSuccessLabel,[e.RewardType.Unfulfilled]:o.unfulfilledLabel,[e.RewardType.Fulfilled]:o.fulfilledLabel,[e.RewardType.Failed]:o.failedLabel}),[o]),R=(0,r.useMemo)(()=>({[e.RewardType.Received]:"",[e.RewardType.Pending]:o.pendingTip,[e.RewardType.ApproveFail]:"",[e.RewardType.ApproveSuccess]:o.confirmedTip,[e.RewardType.Unfulfilled]:o.processingTip,[e.RewardType.Fulfilled]:o.ShippedTip,[e.RewardType.Failed]:""}),[o]),q=(0,r.useMemo)(()=>({[e.RewardType.Received]:"#52C41A",[e.RewardType.Pending]:"#999",[e.RewardType.ApproveFail]:"#F84D4F",[e.RewardType.ApproveSuccess]:"#999",[e.RewardType.Unfulfilled]:"#999",[e.RewardType.Fulfilled]:"#999",[e.RewardType.Failed]:"#F84D4F"}),[]),B=(0,r.useCallback)(()=>{w&&(i===e.AlpcConsumeType.Coupon?I(c+1):i===e.AlpcConsumeType.Product&&U(f+1))},[i,f,c,w]),K=(0,r.useCallback)((t,l)=>{C(l),(0,_.default)(t),setTimeout(()=>{C(-1)},2e3)},[]),S=i===e.AlpcConsumeType.Coupon?H:$;return(0,s.jsxs)(D.CreditsModalContainer,{title:o.title,className:(0,g.default)("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...n,onScrollEnd:B,children:[(0,s.jsx)("div",{className:"",children:(0,s.jsx)(p.Tabs,{align:"left",shape:y?"rounded":"square",value:i.toString(),onValueChange:t=>{u(Number(t))},children:(0,s.jsx)(p.TabsList,{children:E.map(t=>(0,s.jsx)(p.TabsTrigger,{value:t.type.toString(),children:t.title},t.type))})})}),S&&(0,s.jsx)("div",{className:"flex h-full flex-col items-center justify-center",children:(0,s.jsx)(O.default,{})}),!S&&(0,s.jsx)("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:M.length>0?(0,s.jsx)("div",{className:"grid gap-[18px] md:gap-[12px]",children:M.map((t,l)=>(0,s.jsxs)("div",{className:"grid gap-[8px]",children:[t?.orderNumber&&(0,s.jsxs)("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",t.orderNumber]}),(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!y&&"rounded-none"),children:[(0,s.jsxs)("div",{className:"grid gap-[4px]",children:[(0,s.jsx)("div",{className:"text-[16px] font-bold leading-[1.4]",children:t.title}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",t.value," ",o?.pointUnit]}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[t?.couponCode?`${o?.code||"Code"}: ${t.couponCode} `:"",t?.couponCode&&(0,s.jsx)("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{K(t.couponCode,l)},role:"button",tabIndex:0,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&v.preventDefault()},children:k===l?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),(0,s.jsxs)("div",{className:"grid gap-[4px] text-right",children:[(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${q[t.type]}]`),children:[(0,s.jsx)("span",{children:z[t.type]}),R[t.type]&&(0,s.jsx)(A.default,{info:R[t.type],index:l})]}),(0,s.jsx)("div",{className:"text-[14px] font-semibold text-[#999]",children:(0,h.default)(t.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},l))}):(0,s.jsxs)("div",{className:"flex h-full flex-col items-center justify-center",children:[(0,s.jsx)(p.Picture,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),(0,s.jsx)("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var oe=ee;
|
|
1
|
+
"use strict";var V=Object.create;var m=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var X=(o,n)=>{for(var i in n)m(o,i,{get:n[i],enumerable:!0})},F=(o,n,i,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of J(n))!W.call(o,a)&&a!==i&&m(o,a,{get:()=>n[a],enumerable:!(u=G(n,a))||u.enumerable});return o};var d=(o,n,i)=>(i=o!=null?V(Q(o)):{},F(n||!o||!o.__esModule?m(i,"default",{value:o,enumerable:!0}):i,o)),Z=o=>F(m({},"__esModule",{value:!0}),o);var te={};X(te,{default:()=>oe});module.exports=Z(te);var s=require("react/jsx-runtime"),p=require("@anker-in/headless-ui"),g=d(require("classnames")),_=d(require("copy-to-clipboard")),h=d(require("dayjs")),r=require("react"),e=require("../context/const"),D=require("./modalContainer"),A=d(require("./tip")),O=d(require("./loadingDots")),x=d(require("../context/hooks/useMyRewards")),b=require("@anker-in/lib");function ee({data:o,...n}){const[i,u]=(0,r.useState)(e.AlpcConsumeType.Coupon),{brand:a}=(0,b.useHeadlessContext)(),y=b.ROUNDED_BRANDS.includes(a),[c,I]=(0,r.useState)(1),[f,U]=(0,r.useState)(1),[k,C]=(0,r.useState)(-1),E=(0,r.useMemo)(()=>{const t=[];return o.couponTab&&t.push({title:o.couponTab,type:e.AlpcConsumeType.Coupon}),o.productTab&&t.push({title:o.productTab,type:e.AlpcConsumeType.Product}),t},[o.couponTab,o.productTab]),Y=(0,r.useMemo)(()=>({page:n.isOpen?f:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Product}),[n.isOpen,f]),j=(0,r.useMemo)(()=>({page:n.isOpen?c:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Coupon}),[n.isOpen,c]),{myRewards:N=[],canNext:T,isLoading:H}=(0,x.default)(j),{myRewards:L=[],canNext:P,isLoading:$}=(0,x.default)(Y),M=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?N.map(t=>({title:t.goods_title,value:t.consume_credits,type:e.RewardType.Received,date:new Date(t.create_time*1e3),couponCode:t.coupon_code,orderNumber:""})):i===e.AlpcConsumeType.Product?L.map(t=>{let l=e.RewardType.Pending;return t.fulfillment_status&&t.fulfillment_status!=="null"?t.fulfillment_status==="fulfilled"?l=e.RewardType.Fulfilled:l=e.RewardType.Unfulfilled:t.approval_status===e.ApprovalStatus.Success||t.approval_status===e.ApprovalStatus.DoubleConfirm?l=e.RewardType.ApproveSuccess:t.approval_status===e.ApprovalStatus.Failed&&(l=e.RewardType.Failed),{title:t.goods_title,value:t.consume_credits,type:l,date:new Date(t.create_time*1e3),orderNumber:t.order_number,couponCode:""}}):[],[i,L,N]),w=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?T:i===e.AlpcConsumeType.Product?P:!1,[i,T,P]),z=(0,r.useMemo)(()=>({[e.RewardType.Received]:o.receivedLabel,[e.RewardType.Pending]:o.pendingLabel,[e.RewardType.ApproveFail]:o.failedLabel,[e.RewardType.ApproveSuccess]:o.approveSuccessLabel,[e.RewardType.Unfulfilled]:o.unfulfilledLabel,[e.RewardType.Fulfilled]:o.fulfilledLabel,[e.RewardType.Failed]:o.failedLabel}),[o]),R=(0,r.useMemo)(()=>({[e.RewardType.Received]:"",[e.RewardType.Pending]:o.pendingTip,[e.RewardType.ApproveFail]:"",[e.RewardType.ApproveSuccess]:o.confirmedTip,[e.RewardType.Unfulfilled]:o.processingTip,[e.RewardType.Fulfilled]:o.ShippedTip,[e.RewardType.Failed]:""}),[o]),q=(0,r.useMemo)(()=>({[e.RewardType.Received]:"#52C41A",[e.RewardType.Pending]:"#999",[e.RewardType.ApproveFail]:"#F84D4F",[e.RewardType.ApproveSuccess]:"#999",[e.RewardType.Unfulfilled]:"#999",[e.RewardType.Fulfilled]:"#999",[e.RewardType.Failed]:"#F84D4F"}),[]),B=(0,r.useCallback)(()=>{w&&(i===e.AlpcConsumeType.Coupon?I(c+1):i===e.AlpcConsumeType.Product&&U(f+1))},[i,f,c,w]),K=(0,r.useCallback)((t,l)=>{C(l),(0,_.default)(t),setTimeout(()=>{C(-1)},2e3)},[]),S=i===e.AlpcConsumeType.Coupon?H:$;return(0,s.jsxs)(D.CreditsModalContainer,{title:o.title,className:(0,g.default)("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...n,onScrollEnd:B,children:[(0,s.jsx)("div",{className:"",children:(0,s.jsx)(p.Tabs,{align:"left",shape:y?"rounded":"square",value:i.toString(),onValueChange:t=>{u(Number(t))},children:(0,s.jsx)(p.TabsList,{children:E.map(t=>(0,s.jsx)(p.TabsTrigger,{value:t.type.toString(),children:t.title},t.type))})})}),S&&(0,s.jsx)("div",{className:"flex h-full flex-col items-center justify-center",children:(0,s.jsx)(O.default,{})}),!S&&(0,s.jsx)("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:M.length>0?(0,s.jsx)("div",{className:"grid gap-[18px] md:gap-[12px]",children:M.map((t,l)=>(0,s.jsxs)("div",{className:"grid gap-[8px]",children:[t?.orderNumber&&(0,s.jsxs)("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",t.orderNumber]}),(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!y&&"rounded-none"),children:[(0,s.jsxs)("div",{className:"grid gap-[4px]",children:[(0,s.jsx)("div",{className:"text-[16px] font-bold leading-[1.4]",children:t.title}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",t.value," ",o?.pointUnit]}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[t?.couponCode?`${o?.code||"Code"}: ${t.couponCode} `:"",t?.couponCode&&(0,s.jsx)("span",{className:"cursor-pointer text-[14px] font-semibold text-brand-0 underline",onClick:()=>{K(t.couponCode,l)},role:"button",tabIndex:0,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&v.preventDefault()},children:k===l?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),(0,s.jsxs)("div",{className:"grid gap-[4px] text-right",children:[(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${q[t.type]}]`),children:[(0,s.jsx)("span",{children:z[t.type]}),R[t.type]&&(0,s.jsx)(A.default,{info:R[t.type],index:l})]}),(0,s.jsx)("div",{className:"text-[14px] font-semibold text-[#999]",children:(0,h.default)(t.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},l))}):(0,s.jsxs)("div",{className:"flex h-full flex-col items-center justify-center",children:[(0,s.jsx)(p.Picture,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),(0,s.jsx)("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var oe=ee;
|
|
2
2
|
//# sourceMappingURL=MyRewardsModal.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/modal/MyRewardsModal.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Tabs, TabsList, TabsTrigger, Picture } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport clipboard from 'copy-to-clipboard'\nimport dayjs from 'dayjs'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport { ApprovalStatus, AlpcConsumeType, RewardType } from '../context/const'\nimport { CreditsModalContainer, type ModalContainerProps } from './modalContainer'\nimport Tip from './tip'\nimport LoadingDots from './loadingDots'\nimport useMyRewards from '../context/hooks/useMyRewards'\nimport { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\n\nexport interface MyRewardsMetafields {\n title: string\n orderNumberLabel: string\n valueLabel: string\n receivedLabel: string\n failedLabel: string\n approveSuccessLabel: string\n couponTab: string\n productTab: string\n pendingLabel: string\n unfulfilledLabel: string\n fulfilledLabel: string\n confirmedTip: string\n pendingTip: string\n processingTip: string\n ShippedTip: string\n emptyListLabel: string\n pointUnit: string\n code: string\n copied: string\n copy: string\n emptyListImage: {\n url: string\n alt?: string\n }\n}\ninterface MyRewardsModalProps extends ModalContainerProps {\n data: MyRewardsMetafields\n}\n\nfunction MyRewardsModal({ data, ...props }: MyRewardsModalProps) {\n const [activeTab, setActiveTab] = useState(AlpcConsumeType.Coupon)\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const [couponPage, setCouponPage] = useState(1)\n const [productPage, setProductPage] = useState(1)\n const [copied, setCopied] = useState(-1)\n\n const tabs = useMemo(() => {\n const availableTabs: { title: string; type: number }[] = []\n\n if (data.couponTab) {\n availableTabs.push({\n title: data.couponTab,\n type: AlpcConsumeType.Coupon,\n })\n }\n\n if (data.productTab) {\n availableTabs.push({\n title: data.productTab,\n type: AlpcConsumeType.Product,\n })\n }\n\n return availableTabs\n }, [data.couponTab, data.productTab])\n\n const myProductRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? productPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Product,\n }\n }, [props.isOpen, productPage])\n const myCouponRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? couponPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Coupon,\n }\n }, [props.isOpen, couponPage])\n\n const {\n myRewards: myCouponRewards = [],\n canNext: couponCanNext,\n isLoading: couponIsLoading,\n } = useMyRewards(myCouponRewardsOptions)\n const {\n myRewards: myProductRewards = [],\n canNext: productCanNext,\n isLoading: productIsLoading,\n } = useMyRewards(myProductRewardsOptions)\n\n const list = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return myCouponRewards.map(item => ({\n title: item.goods_title,\n value: item.consume_credits,\n type: RewardType.Received,\n date: new Date(item.create_time * 1000),\n couponCode: item.coupon_code,\n orderNumber: '',\n }))\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return myProductRewards.map(item => {\n let type = RewardType.Pending\n\n if (item.fulfillment_status && item.fulfillment_status !== 'null') {\n // \u7269\u6D41\u72B6\u6001\n if (item.fulfillment_status === 'fulfilled') {\n type = RewardType.Fulfilled\n } else {\n type = RewardType.Unfulfilled\n }\n } else {\n if (\n item.approval_status === ApprovalStatus.Success ||\n item.approval_status === ApprovalStatus.DoubleConfirm\n ) {\n type = RewardType.ApproveSuccess\n } else if (item.approval_status === ApprovalStatus.Failed) {\n type = RewardType.Failed\n }\n }\n\n return {\n title: item.goods_title,\n value: item.consume_credits,\n type,\n date: new Date(item.create_time * 1000),\n orderNumber: item.order_number,\n couponCode: '',\n }\n })\n }\n\n return []\n }, [activeTab, myProductRewards, myCouponRewards])\n\n const canNext = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return couponCanNext\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return productCanNext\n }\n\n return false\n }, [activeTab, couponCanNext, productCanNext])\n\n const TypeMap = useMemo(() => {\n return {\n [RewardType.Received]: data.receivedLabel,\n [RewardType.Pending]: data.pendingLabel,\n [RewardType.ApproveFail]: data.failedLabel,\n [RewardType.ApproveSuccess]: data.approveSuccessLabel,\n [RewardType.Unfulfilled]: data.unfulfilledLabel,\n [RewardType.Fulfilled]: data.fulfilledLabel,\n [RewardType.Failed]: data.failedLabel,\n }\n }, [data])\n\n const TipMap = useMemo(() => {\n return {\n [RewardType.Received]: '',\n [RewardType.Pending]: data.pendingTip,\n [RewardType.ApproveFail]: '',\n [RewardType.ApproveSuccess]: data.confirmedTip,\n [RewardType.Unfulfilled]: data.processingTip,\n [RewardType.Fulfilled]: data.ShippedTip,\n [RewardType.Failed]: '',\n }\n }, [data])\n\n const ColorMap = useMemo(() => {\n return {\n [RewardType.Received]: '#52C41A',\n [RewardType.Pending]: '#999',\n [RewardType.ApproveFail]: '#F84D4F',\n [RewardType.ApproveSuccess]: '#999',\n [RewardType.Unfulfilled]: '#999',\n [RewardType.Fulfilled]: '#999',\n [RewardType.Failed]: '#F84D4F',\n }\n }, [])\n\n const handleScrollEnd = useCallback(() => {\n if (!canNext) {\n return\n }\n\n if (activeTab === AlpcConsumeType.Coupon) {\n setCouponPage(couponPage + 1)\n } else if (activeTab === AlpcConsumeType.Product) {\n setProductPage(productPage + 1)\n }\n }, [activeTab, productPage, couponPage, canNext])\n\n const handleCopy = useCallback((code: string, idx: number) => {\n setCopied(idx)\n clipboard(code)\n setTimeout(() => {\n setCopied(-1)\n }, 2000)\n }, [])\n\n const isLoading = activeTab === AlpcConsumeType.Coupon ? couponIsLoading : productIsLoading\n\n return (\n <CreditsModalContainer\n title={data.title}\n className={classNames('h-[800px] w-[640px]')}\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n scrollClassName=\"md:mb-0\"\n {...props}\n onScrollEnd={handleScrollEnd}\n >\n <div className=\"\">\n <Tabs\n align=\"left\"\n shape={rounded ? 'rounded' : 'square'}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(Number(value))\n }}\n >\n <TabsList>\n {tabs.map(tab => (\n <TabsTrigger key={tab.type} value={tab.type.toString()}>\n {tab.title}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n </div>\n\n {isLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <LoadingDots />\n </div>\n )}\n\n {!isLoading && (\n <div className=\"mt-[24px] overflow-auto overscroll-contain\">\n {list.length > 0 ? (\n <div className=\"grid gap-[18px] md:gap-[12px]\">\n {list.map((item, index) => (\n <div key={index} className=\"grid gap-[8px]\">\n {item?.orderNumber && (\n <div className=\"text-[15px] font-semibold leading-[1.4] text-[#777]\">\n {data.orderNumberLabel}: {item.orderNumber}\n </div>\n )}\n <div\n className={classNames(\n 'flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]',\n !rounded && 'rounded-none'\n )}\n >\n <div className=\"grid gap-[4px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{item.title}</div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {data.valueLabel}: {item.value} {data?.pointUnit}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {item?.couponCode ? `${data?.code || 'Code'}: ${item.couponCode} ` : ''}\n {item?.couponCode && (\n <span\n className=\"cursor-pointer text-[14px] font-semibold text-brand underline\"\n onClick={() => {\n handleCopy(item.couponCode, index)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copied === index ? data?.copied || 'COPIED' : data?.copy || 'COPY'}\n </span>\n )}\n </div>\n </div>\n <div className=\"grid gap-[4px] text-right\">\n <div\n className={classNames(\n 'flex items-center justify-end text-[16px] font-bold leading-[1.4]',\n `text-[${ColorMap[item.type]}]`\n )}\n >\n <span>{TypeMap[item.type]}</span>\n {TipMap[item.type] && <Tip info={TipMap[item.type]} index={index} />}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}\n </div>\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <Picture\n className=\"mb-[12px] w-[160px]\"\n source={data?.emptyListImage?.url}\n alt={data?.emptyListImage?.alt || 'empty list image'}\n ></Picture>\n <div className=\"text-[16px] font-semibold leading-[1.4]\">{data?.emptyListLabel}</div>\n </div>\n )}\n </div>\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default MyRewardsModal\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,aAAAE,KAAA,eAAAC,EAAAH,IA6Oc,IAAAI,EAAA,6BA7OdC,EAAqD,iCACrDC,EAAuB,yBACvBC,EAAsB,gCACtBC,EAAkB,oBAClBC,EAA+C,iBAE/CC,EAA4D,4BAC5DC,EAAgE,4BAChEC,EAAgB,oBAChBC,EAAwB,4BACxBC,EAAyB,4CACzBC,EAAmD,yBAgCnD,SAASC,GAAe,CAAE,KAAAC,EAAM,GAAGC,CAAM,EAAwB,CAC/D,KAAM,CAACC,EAAWC,CAAY,KAAI,YAAS,kBAAgB,MAAM,EAC3D,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EAEvC,CAACE,EAAYC,CAAa,KAAI,YAAS,CAAC,EACxC,CAACC,EAAaC,CAAc,KAAI,YAAS,CAAC,EAC1C,CAACC,EAAQC,CAAS,KAAI,YAAS,EAAE,EAEjCC,KAAO,WAAQ,IAAM,CACzB,MAAMC,EAAmD,CAAC,EAE1D,OAAIb,EAAK,WACPa,EAAc,KAAK,CACjB,MAAOb,EAAK,UACZ,KAAM,kBAAgB,MACxB,CAAC,EAGCA,EAAK,YACPa,EAAc,KAAK,CACjB,MAAOb,EAAK,WACZ,KAAM,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B,GAAM,WAAa,GAAGxB,GAAM,MAAQ,MAAM,KAAKwB,EAAK,UAAU,IAAM,GACpEA,GAAM,eACL,OAAC,QACC,UAAU,
|
|
4
|
+
"sourcesContent": ["import { Tabs, TabsList, TabsTrigger, Picture } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport clipboard from 'copy-to-clipboard'\nimport dayjs from 'dayjs'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport { ApprovalStatus, AlpcConsumeType, RewardType } from '../context/const'\nimport { CreditsModalContainer, type ModalContainerProps } from './modalContainer'\nimport Tip from './tip'\nimport LoadingDots from './loadingDots'\nimport useMyRewards from '../context/hooks/useMyRewards'\nimport { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\n\nexport interface MyRewardsMetafields {\n title: string\n orderNumberLabel: string\n valueLabel: string\n receivedLabel: string\n failedLabel: string\n approveSuccessLabel: string\n couponTab: string\n productTab: string\n pendingLabel: string\n unfulfilledLabel: string\n fulfilledLabel: string\n confirmedTip: string\n pendingTip: string\n processingTip: string\n ShippedTip: string\n emptyListLabel: string\n pointUnit: string\n code: string\n copied: string\n copy: string\n emptyListImage: {\n url: string\n alt?: string\n }\n}\ninterface MyRewardsModalProps extends ModalContainerProps {\n data: MyRewardsMetafields\n}\n\nfunction MyRewardsModal({ data, ...props }: MyRewardsModalProps) {\n const [activeTab, setActiveTab] = useState(AlpcConsumeType.Coupon)\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const [couponPage, setCouponPage] = useState(1)\n const [productPage, setProductPage] = useState(1)\n const [copied, setCopied] = useState(-1)\n\n const tabs = useMemo(() => {\n const availableTabs: { title: string; type: number }[] = []\n\n if (data.couponTab) {\n availableTabs.push({\n title: data.couponTab,\n type: AlpcConsumeType.Coupon,\n })\n }\n\n if (data.productTab) {\n availableTabs.push({\n title: data.productTab,\n type: AlpcConsumeType.Product,\n })\n }\n\n return availableTabs\n }, [data.couponTab, data.productTab])\n\n const myProductRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? productPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Product,\n }\n }, [props.isOpen, productPage])\n const myCouponRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? couponPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Coupon,\n }\n }, [props.isOpen, couponPage])\n\n const {\n myRewards: myCouponRewards = [],\n canNext: couponCanNext,\n isLoading: couponIsLoading,\n } = useMyRewards(myCouponRewardsOptions)\n const {\n myRewards: myProductRewards = [],\n canNext: productCanNext,\n isLoading: productIsLoading,\n } = useMyRewards(myProductRewardsOptions)\n\n const list = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return myCouponRewards.map(item => ({\n title: item.goods_title,\n value: item.consume_credits,\n type: RewardType.Received,\n date: new Date(item.create_time * 1000),\n couponCode: item.coupon_code,\n orderNumber: '',\n }))\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return myProductRewards.map(item => {\n let type = RewardType.Pending\n\n if (item.fulfillment_status && item.fulfillment_status !== 'null') {\n // \u7269\u6D41\u72B6\u6001\n if (item.fulfillment_status === 'fulfilled') {\n type = RewardType.Fulfilled\n } else {\n type = RewardType.Unfulfilled\n }\n } else {\n if (\n item.approval_status === ApprovalStatus.Success ||\n item.approval_status === ApprovalStatus.DoubleConfirm\n ) {\n type = RewardType.ApproveSuccess\n } else if (item.approval_status === ApprovalStatus.Failed) {\n type = RewardType.Failed\n }\n }\n\n return {\n title: item.goods_title,\n value: item.consume_credits,\n type,\n date: new Date(item.create_time * 1000),\n orderNumber: item.order_number,\n couponCode: '',\n }\n })\n }\n\n return []\n }, [activeTab, myProductRewards, myCouponRewards])\n\n const canNext = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return couponCanNext\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return productCanNext\n }\n\n return false\n }, [activeTab, couponCanNext, productCanNext])\n\n const TypeMap = useMemo(() => {\n return {\n [RewardType.Received]: data.receivedLabel,\n [RewardType.Pending]: data.pendingLabel,\n [RewardType.ApproveFail]: data.failedLabel,\n [RewardType.ApproveSuccess]: data.approveSuccessLabel,\n [RewardType.Unfulfilled]: data.unfulfilledLabel,\n [RewardType.Fulfilled]: data.fulfilledLabel,\n [RewardType.Failed]: data.failedLabel,\n }\n }, [data])\n\n const TipMap = useMemo(() => {\n return {\n [RewardType.Received]: '',\n [RewardType.Pending]: data.pendingTip,\n [RewardType.ApproveFail]: '',\n [RewardType.ApproveSuccess]: data.confirmedTip,\n [RewardType.Unfulfilled]: data.processingTip,\n [RewardType.Fulfilled]: data.ShippedTip,\n [RewardType.Failed]: '',\n }\n }, [data])\n\n const ColorMap = useMemo(() => {\n return {\n [RewardType.Received]: '#52C41A',\n [RewardType.Pending]: '#999',\n [RewardType.ApproveFail]: '#F84D4F',\n [RewardType.ApproveSuccess]: '#999',\n [RewardType.Unfulfilled]: '#999',\n [RewardType.Fulfilled]: '#999',\n [RewardType.Failed]: '#F84D4F',\n }\n }, [])\n\n const handleScrollEnd = useCallback(() => {\n if (!canNext) {\n return\n }\n\n if (activeTab === AlpcConsumeType.Coupon) {\n setCouponPage(couponPage + 1)\n } else if (activeTab === AlpcConsumeType.Product) {\n setProductPage(productPage + 1)\n }\n }, [activeTab, productPage, couponPage, canNext])\n\n const handleCopy = useCallback((code: string, idx: number) => {\n setCopied(idx)\n clipboard(code)\n setTimeout(() => {\n setCopied(-1)\n }, 2000)\n }, [])\n\n const isLoading = activeTab === AlpcConsumeType.Coupon ? couponIsLoading : productIsLoading\n\n return (\n <CreditsModalContainer\n title={data.title}\n className={classNames('h-[800px] w-[640px]')}\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n scrollClassName=\"md:mb-0\"\n {...props}\n onScrollEnd={handleScrollEnd}\n >\n <div className=\"\">\n <Tabs\n align=\"left\"\n shape={rounded ? 'rounded' : 'square'}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(Number(value))\n }}\n >\n <TabsList>\n {tabs.map(tab => (\n <TabsTrigger key={tab.type} value={tab.type.toString()}>\n {tab.title}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n </div>\n\n {isLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <LoadingDots />\n </div>\n )}\n\n {!isLoading && (\n <div className=\"mt-[24px] overflow-auto overscroll-contain\">\n {list.length > 0 ? (\n <div className=\"grid gap-[18px] md:gap-[12px]\">\n {list.map((item, index) => (\n <div key={index} className=\"grid gap-[8px]\">\n {item?.orderNumber && (\n <div className=\"text-[15px] font-semibold leading-[1.4] text-[#777]\">\n {data.orderNumberLabel}: {item.orderNumber}\n </div>\n )}\n <div\n className={classNames(\n 'flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]',\n !rounded && 'rounded-none'\n )}\n >\n <div className=\"grid gap-[4px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{item.title}</div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {data.valueLabel}: {item.value} {data?.pointUnit}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {item?.couponCode ? `${data?.code || 'Code'}: ${item.couponCode} ` : ''}\n {item?.couponCode && (\n <span\n className=\"cursor-pointer text-[14px] font-semibold text-brand-0 underline\"\n onClick={() => {\n handleCopy(item.couponCode, index)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copied === index ? data?.copied || 'COPIED' : data?.copy || 'COPY'}\n </span>\n )}\n </div>\n </div>\n <div className=\"grid gap-[4px] text-right\">\n <div\n className={classNames(\n 'flex items-center justify-end text-[16px] font-bold leading-[1.4]',\n `text-[${ColorMap[item.type]}]`\n )}\n >\n <span>{TypeMap[item.type]}</span>\n {TipMap[item.type] && <Tip info={TipMap[item.type]} index={index} />}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}\n </div>\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <Picture\n className=\"mb-[12px] w-[160px]\"\n source={data?.emptyListImage?.url}\n alt={data?.emptyListImage?.alt || 'empty list image'}\n ></Picture>\n <div className=\"text-[16px] font-semibold leading-[1.4]\">{data?.emptyListLabel}</div>\n </div>\n )}\n </div>\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default MyRewardsModal\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,aAAAE,KAAA,eAAAC,EAAAH,IA6Oc,IAAAI,EAAA,6BA7OdC,EAAqD,iCACrDC,EAAuB,yBACvBC,EAAsB,gCACtBC,EAAkB,oBAClBC,EAA+C,iBAE/CC,EAA4D,4BAC5DC,EAAgE,4BAChEC,EAAgB,oBAChBC,EAAwB,4BACxBC,EAAyB,4CACzBC,EAAmD,yBAgCnD,SAASC,GAAe,CAAE,KAAAC,EAAM,GAAGC,CAAM,EAAwB,CAC/D,KAAM,CAACC,EAAWC,CAAY,KAAI,YAAS,kBAAgB,MAAM,EAC3D,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EAEvC,CAACE,EAAYC,CAAa,KAAI,YAAS,CAAC,EACxC,CAACC,EAAaC,CAAc,KAAI,YAAS,CAAC,EAC1C,CAACC,EAAQC,CAAS,KAAI,YAAS,EAAE,EAEjCC,KAAO,WAAQ,IAAM,CACzB,MAAMC,EAAmD,CAAC,EAE1D,OAAIb,EAAK,WACPa,EAAc,KAAK,CACjB,MAAOb,EAAK,UACZ,KAAM,kBAAgB,MACxB,CAAC,EAGCA,EAAK,YACPa,EAAc,KAAK,CACjB,MAAOb,EAAK,WACZ,KAAM,kBAAgB,OACxB,CAAC,EAGIa,CACT,EAAG,CAACb,EAAK,UAAWA,EAAK,UAAU,CAAC,EAE9Bc,KAA0B,WAAQ,K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U,kEACV,QAAS,IAAM,CACbO,EAAWP,EAAK,WAAYgB,CAAK,CACnC,EACA,KAAK,SACL,SAAU,EACV,UAAWC,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAA/B,IAAW8B,EAAQxC,GAAM,QAAU,SAAWA,GAAM,MAAQ,OAC/D,GAEJ,GACF,KACA,QAAC,OAAI,UAAU,4BACb,qBAAC,OACC,aAAW,EAAAoC,SACT,oEACA,SAASP,EAASL,EAAK,IAAI,CAAC,GAC9B,EAEA,oBAAC,QAAM,SAAAG,EAAQH,EAAK,IAAI,EAAE,EACzBI,EAAOJ,EAAK,IAAI,MAAK,OAAC,EAAAkB,QAAA,CAAI,KAAMd,EAAOJ,EAAK,IAAI,EAAG,MAAOgB,EAAO,GACpE,KACA,OAAC,OAAI,UAAU,wCACZ,cAAAG,SAAMnB,EAAK,IAAI,EAAE,OAAO,kBAAkB,EAAE,SAAS,EACxD,GACF,GACF,IApDQgB,CAqDV,CACD,EACH,KAEA,QAAC,OAAI,UAAU,mDACb,oBAAC,WACC,UAAU,sBACV,OAAQxC,GAAM,gBAAgB,IAC9B,IAAKA,GAAM,gBAAgB,KAAO,mBACnC,KACD,OAAC,OAAI,UAAU,0CAA2C,SAAAA,GAAM,eAAe,GACjF,EAEJ,GAEJ,CAEJ,CAEA,IAAOf,GAAQc",
|
|
6
6
|
"names": ["MyRewardsModal_exports", "__export", "MyRewardsModal_default", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_copy_to_clipboard", "import_dayjs", "import_react", "import_const", "import_modalContainer", "import_tip", "import_loadingDots", "import_useMyRewards", "import_lib", "MyRewardsModal", "data", "props", "activeTab", "setActiveTab", "brand", "rounded", "couponPage", "setCouponPage", "productPage", "setProductPage", "copied", "setCopied", "tabs", "availableTabs", "myProductRewardsOptions", "myCouponRewardsOptions", "myCouponRewards", "couponCanNext", "couponIsLoading", "useMyRewards", "myProductRewards", "productCanNext", "productIsLoading", "list", "item", "type", "canNext", "TypeMap", "TipMap", "ColorMap", "handleScrollEnd", "handleCopy", "code", "idx", "clipboard", "isLoading", "classNames", "value", "tab", "LoadingDots", "index", "e", "Tip", "dayjs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function getAsyncError(res: {
|
|
2
|
+
json: () => any;
|
|
3
|
+
status: any;
|
|
4
|
+
statusText: any;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
status: any;
|
|
7
|
+
statusText: any;
|
|
8
|
+
errors: any;
|
|
9
|
+
type: any;
|
|
10
|
+
data: any;
|
|
11
|
+
message: any;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
declare const handleFetchResponse: (res: Response) => Promise<any>;
|
|
14
|
+
export default handleFetchResponse;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(a,t)=>{for(var s in t)o(a,s,{get:t[s],enumerable:!0})},l=(a,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of c(t))!y.call(a,e)&&e!==s&&o(a,e,{get:()=>t[e],enumerable:!(n=u(t,e))||n.enumerable});return a};var g=a=>l(o({},"__esModule",{value:!0}),a);var x={};d(x,{default:()=>p,getAsyncError:()=>r});module.exports=g(x);async function r(a){try{const t=await a.json();return{status:a.status,statusText:a.statusText,errors:t?.data?.error||t?.data?.code||a.statusText||a.status,type:t?.data?.type,data:t?.data,message:t?.data?.message}}catch(t){console.log(t)}}const i=async a=>{if(a.ok)try{const t=await a.json(),{errors:s}=t;return s&&s.length?{errors:s,status:a.status}:t}catch(t){console.log(t)}return await r(a)};var p=i;
|
|
2
|
+
//# sourceMappingURL=fetchResponse.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/fetchResponse.ts"],
|
|
4
|
+
"sourcesContent": ["export async function getAsyncError(res: { json: () => any; status: any; statusText: any }) {\n try {\n const result = await res.json()\n return {\n status: res.status,\n statusText: res.statusText,\n errors: result?.data?.error || result?.data?.code || res.statusText || res.status,\n type: result?.data?.type,\n data: result?.data,\n message: result?.data?.message,\n }\n } catch (error) {\n console.log(error)\n }\n}\n\nconst handleFetchResponse = async (res: Response) => {\n if (res.ok) {\n try {\n const result = await res.json()\n const { errors } = result\n if (errors && errors.length) {\n return { errors, status: res.status }\n }\n\n return result\n } catch (error) {\n console.log(error)\n }\n }\n\n return await getAsyncError(res)\n}\n\nexport default handleFetchResponse\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,kBAAAC,IAAA,eAAAC,EAAAJ,GAAA,eAAsBG,EAAcE,EAAwD,CAC1F,GAAI,CACF,MAAMC,EAAS,MAAMD,EAAI,KAAK,EAC9B,MAAO,CACL,OAAQA,EAAI,OACZ,WAAYA,EAAI,WAChB,OAAQC,GAAQ,MAAM,OAASA,GAAQ,MAAM,MAAQD,EAAI,YAAcA,EAAI,OAC3E,KAAMC,GAAQ,MAAM,KACpB,KAAMA,GAAQ,KACd,QAASA,GAAQ,MAAM,OACzB,CACF,OAASC,EAAO,CACd,QAAQ,IAAIA,CAAK,CACnB,CACF,CAEA,MAAMC,EAAsB,MAAOH,GAAkB,CACnD,GAAIA,EAAI,GACN,GAAI,CACF,MAAMC,EAAS,MAAMD,EAAI,KAAK,EACxB,CAAE,OAAAI,CAAO,EAAIH,EACnB,OAAIG,GAAUA,EAAO,OACZ,CAAE,OAAAA,EAAQ,OAAQJ,EAAI,MAAO,EAG/BC,CACT,OAASC,EAAO,CACd,QAAQ,IAAIA,CAAK,CACnB,CAGF,OAAO,MAAMJ,EAAcE,CAAG,CAChC,EAEA,IAAOH,EAAQM",
|
|
6
|
+
"names": ["fetchResponse_exports", "__export", "fetchResponse_default", "getAsyncError", "__toCommonJS", "res", "result", "error", "handleFetchResponse", "errors"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var h=Object.create;var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var b=(e,a)=>{for(var n in a)o(e,n,{get:a[n],enumerable:!0})},i=(e,a,n,t)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of u(a))!T.call(e,r)&&r!==n&&o(e,r,{get:()=>a[r],enumerable:!(t=p(a,r))||t.enumerable});return e};var w=(e,a,n)=>(n=e!=null?h(y(e)):{},i(a||!e||!e.__esModule?o(n,"default",{value:e,enumerable:!0}):n,e)),F=e=>i(o({},"__esModule",{value:!0}),e);var m={};b(m,{default:()=>S});module.exports=F(m);var f=w(require("./fetchResponse.js"));const O=async({locale:e="en",url:a,method:n="POST",headers:t={},body:r,type:d,timeout:l=9e4})=>{let s="";d==="uploadFile"?s=r:s=r?JSON.stringify(r):"";const c=new AbortController;l&&setTimeout(()=>c.abort(),l);const g=await fetch(a,{method:n,mode:"cors",headers:{"current-language":e,...t},...l&&{signal:c.signal},...n!=="GET"&&{body:s}});return(0,f.default)(g)};var S=O;
|
|
2
|
+
//# sourceMappingURL=fetcher.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/fetcher.ts"],
|
|
4
|
+
"sourcesContent": ["import handleFetchResponse from './fetchResponse.js'\n\nconst fetcher = async ({ locale = 'en', url, method = 'POST', headers = {}, body, type, timeout = 90000 }: any) => {\n // \u6DFB\u52A0\u8C37\u6B4C\u9A8C\u8BC1\n let bodyData = ''\n if (type === 'uploadFile') {\n bodyData = body\n } else {\n bodyData = body ? JSON.stringify(body) : ''\n }\n\n const controller = new AbortController()\n if (timeout) {\n // \u8D85\u65F6\u62A5\u9519\n setTimeout(() => controller.abort(), timeout)\n }\n\n const data = await fetch(url, {\n method,\n mode: 'cors',\n headers: {\n 'current-language': locale,\n ...headers,\n },\n ...(timeout && { signal: controller.signal }),\n ...(method !== 'GET' && { body: bodyData }),\n })\n return handleFetchResponse(data)\n}\n\nexport default fetcher\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,iCAEhC,MAAMC,EAAU,MAAO,CAAE,OAAAC,EAAS,KAAM,IAAAC,EAAK,OAAAC,EAAS,OAAQ,QAAAC,EAAU,CAAC,EAAG,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAU,GAAM,IAAW,CAEjH,IAAIC,EAAW,GACXF,IAAS,aACXE,EAAWH,EAEXG,EAAWH,EAAO,KAAK,UAAUA,CAAI,EAAI,GAG3C,MAAMI,EAAa,IAAI,gBACnBF,GAEF,WAAW,IAAME,EAAW,MAAM,EAAGF,CAAO,EAG9C,MAAMG,EAAO,MAAM,MAAMR,EAAK,CAC5B,OAAAC,EACA,KAAM,OACN,QAAS,CACP,mBAAoBF,EACpB,GAAGG,CACL,EACA,GAAIG,GAAW,CAAE,OAAQE,EAAW,MAAO,EAC3C,GAAIN,IAAW,OAAS,CAAE,KAAMK,CAAS,CAC3C,CAAC,EACD,SAAO,EAAAG,SAAoBD,CAAI,CACjC,EAEA,IAAOb,EAAQG",
|
|
6
|
+
"names": ["fetcher_exports", "__export", "fetcher_default", "__toCommonJS", "import_fetchResponse", "fetcher", "locale", "url", "method", "headers", "body", "type", "timeout", "bodyData", "controller", "data", "handleFetchResponse"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o)=>{for(var e in o)f(r,e,{get:o[e],enumerable:!0})},d=(r,o,e,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of c(o))!a.call(r,p)&&p!==e&&f(r,p,{get:()=>o[p],enumerable:!(m=x(o,p))||m.enumerable});return r};var g=r=>d(f({},"__esModule",{value:!0}),r);var h={};b(h,{cn:()=>n.cn,noop:()=>t.noop});module.exports=g(h);var n=require("./utils.js"),t=require("./utils.js");
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { cn } from './utils.js'\nexport { noop } from './utils.js'\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8CAAAE,EAAAF,GAAA,IAAAG,EAAmB,sBACnBA,EAAqB",
|
|
6
|
+
"names": ["helpers_exports", "__export", "__toCommonJS", "import_utils"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
dataLayer?: Array<any>;
|
|
4
|
+
fbq?: (...args: any[]) => void;
|
|
5
|
+
klaviyo?: any;
|
|
6
|
+
gtag?: any;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const gaTrack: (data: any) => "" | undefined;
|
|
10
|
+
export declare function gaNormalClick({ position, label }: {
|
|
11
|
+
position: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}): void;
|
|
14
|
+
export declare const fbq: (...args: any[]) => "" | undefined;
|
|
15
|
+
export declare const gtag: (...args: any[]) => "" | undefined;
|
|
16
|
+
export declare const getGtmGroup: ({ query, asPath }: {
|
|
17
|
+
query: any;
|
|
18
|
+
asPath: string;
|
|
19
|
+
}) => any;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var p=(e,n)=>{for(var t in n)a(e,t,{get:n[t],enumerable:!0})},s=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of g(n))!w.call(e,r)&&r!==t&&a(e,r,{get:()=>n[r],enumerable:!(o=d(n,r))||o.enumerable});return e};var u=e=>s(a({},"__esModule",{value:!0}),e);var m={};p(m,{fbq:()=>f,gaNormalClick:()=>c,gaTrack:()=>i,getGtmGroup:()=>y,gtag:()=>l});module.exports=u(m);const i=e=>{if(typeof window>"u"||(window.dataLayer=window?.dataLayer||[],!Array.isArray(window.dataLayer)))return"";try{window?.dataLayer?.push({event_parameters:null}),window?.dataLayer?.push(e||{})}catch(n){console.log("pageGTMEvent error",n)}};function c({position:e,label:n}){i({event:"ga4Event",event_name:"lp_button",event_parameters:{page_group:"soundcoreCredits Rewards Program",position:e,button_name:n}})}const f=(...e)=>{if(typeof window>"u")return"";window.fbq&&window.fbq(...e)},l=(...e)=>{if(typeof window>"u")return"";window.gtag&&window.gtag(...e)},y=({query:e,asPath:n})=>n.includes("collections")?`Product List Page_${e?.handle}`:n.includes("products")?"Product Detail Page_"+e?.handle:n==="/"||n==="/app-home"?"Home Page":"Activity Page_"+e?.handle||e?.paths?.[0]?.replace("storefront-","");
|
|
2
|
+
//# sourceMappingURL=track.js.map
|