@anker-in/campaign-ui 0.2.11-beta.3 → 0.2.11-beta.4
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/useFunctionMemberPrice.d.ts +2 -2
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +2 -2
- package/dist/cjs/components/credits/context/memberPriceConst.d.ts +0 -5
- package/dist/cjs/components/credits/context/memberPriceConst.js +1 -1
- package/dist/cjs/components/credits/context/memberPriceConst.js.map +3 -3
- package/dist/cjs/components/credits/context/memberPriceTypes.d.ts +1 -22
- package/dist/cjs/components/credits/context/memberPriceTypes.js +1 -1
- package/dist/cjs/components/credits/context/memberPriceTypes.js.map +1 -1
- package/dist/cjs/components/credits/context/provider.d.ts +15 -1
- package/dist/cjs/components/credits/context/provider.js +1 -1
- package/dist/cjs/components/credits/context/provider.js.map +3 -3
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +2 -2
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +1 -1
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +1 -1
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +2 -2
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +1 -1
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +1 -1
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +2 -2
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +1 -1
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +1 -1
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +3 -3
- package/dist/cjs/components/credits/creditsBanner/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsBanner/index.js +12 -1
- package/dist/cjs/components/credits/creditsBanner/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js +2 -0
- package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/{iconInfo.js → IconInfo.js} +1 -1
- package/dist/cjs/components/credits/creditsBenefits/{iconInfo.js.map → IconInfo.js.map} +1 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +2 -2
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +2 -2
- package/dist/cjs/components/credits/creditsCash/type.d.ts +1 -0
- package/dist/cjs/components/credits/creditsCash/type.js +1 -1
- package/dist/cjs/components/credits/creditsCash/type.js.map +1 -1
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +3 -3
- package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/cjs/components/credits/creditsInfoCard/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +3 -3
- package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js +1 -1
- package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js.map +3 -3
- package/dist/cjs/components/credits/creditsMemberPrice/type.d.ts +3 -5
- package/dist/cjs/components/credits/creditsMemberPrice/type.js +1 -1
- package/dist/cjs/components/credits/creditsMemberPrice/type.js.map +1 -1
- package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js +1 -1
- package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
- package/dist/cjs/templates/{credits.d.ts → Credits.d.ts} +15 -1
- package/dist/cjs/templates/Credits.js +2 -0
- package/dist/cjs/templates/Credits.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +2 -2
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +1 -1
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +2 -2
- package/dist/esm/components/credits/context/memberPriceConst.d.ts +0 -5
- package/dist/esm/components/credits/context/memberPriceConst.js +1 -1
- package/dist/esm/components/credits/context/memberPriceConst.js.map +3 -3
- package/dist/esm/components/credits/context/memberPriceTypes.d.ts +1 -22
- package/dist/esm/components/credits/context/provider.d.ts +15 -1
- package/dist/esm/components/credits/context/provider.js +1 -1
- package/dist/esm/components/credits/context/provider.js.map +3 -3
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +2 -2
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +1 -1
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +1 -1
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +2 -2
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +1 -1
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +1 -1
- package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +2 -2
- package/dist/esm/components/credits/context/utils/variantGetCoupon.js +1 -1
- package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +1 -1
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +3 -3
- package/dist/esm/components/credits/creditsBanner/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsBanner/index.js +12 -1
- package/dist/esm/components/credits/creditsBanner/index.js.map +3 -3
- package/dist/esm/components/credits/creditsBenefits/BenefitItem.js +2 -0
- package/dist/esm/components/credits/creditsBenefits/BenefitItem.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/{iconInfo.js → IconInfo.js} +1 -1
- package/dist/esm/components/credits/creditsBenefits/{iconInfo.js.map → IconInfo.js.map} +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +2 -2
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +3 -3
- package/dist/esm/components/credits/creditsCash/type.d.ts +1 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +3 -3
- package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/esm/components/credits/creditsInfoCard/index.js.map +2 -2
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +3 -3
- package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js +1 -1
- package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js.map +3 -3
- package/dist/esm/components/credits/creditsMemberPrice/type.d.ts +3 -5
- package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js +1 -1
- package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
- package/dist/esm/templates/{credits.d.ts → Credits.d.ts} +15 -1
- package/dist/esm/templates/Credits.js +2 -0
- package/dist/esm/templates/Credits.js.map +7 -0
- package/package.json +1 -1
- package/src/components/credits/context/memberPriceConst.ts +0 -7
- package/src/components/credits/context/memberPriceTypes.ts +1 -26
- package/src/components/credits/context/provider.tsx +14 -0
- package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +25 -25
- package/src/components/credits/creditsBanner/index.tsx +31 -2
- package/src/components/credits/creditsBenefits/BenefitItem.tsx +11 -4
- package/src/components/credits/creditsBenefits/IconInfo.tsx +1 -1
- package/src/components/credits/creditsCash/CreditsCash.tsx +1 -1
- package/src/components/credits/creditsCash/RedeemableItem.tsx +17 -4
- package/src/components/credits/creditsCash/type.ts +1 -0
- package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +25 -23
- package/src/components/credits/creditsInfoCard/index.tsx +1 -1
- package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +57 -5
- package/src/components/credits/creditsMemberPrice/MemberPriceItem.tsx +102 -25
- package/src/components/credits/creditsMemberPrice/type.ts +3 -5
- package/src/components/credits/creditsNavigation/CreditsNavigation.tsx +3 -3
- package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +26 -13
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +20 -17
- package/src/templates/Credits.tsx +26 -9
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.d.ts +0 -1
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +0 -2
- package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +0 -7
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +0 -9
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.js +0 -2
- package/dist/cjs/components/credits/context/hooks/useSubscriptions.js.map +0 -7
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +0 -2
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +0 -7
- package/dist/cjs/helpers/fetchResponse.d.ts +0 -14
- package/dist/cjs/helpers/fetchResponse.js +0 -2
- package/dist/cjs/helpers/fetchResponse.js.map +0 -7
- package/dist/cjs/helpers/fetcher.d.ts +0 -2
- package/dist/cjs/helpers/fetcher.js +0 -2
- package/dist/cjs/helpers/fetcher.js.map +0 -7
- package/dist/cjs/helpers/index.d.ts +0 -2
- package/dist/cjs/helpers/index.js +0 -2
- package/dist/cjs/helpers/index.js.map +0 -7
- package/dist/cjs/helpers/track.d.ts +0 -19
- package/dist/cjs/helpers/track.js +0 -2
- package/dist/cjs/helpers/track.js.map +0 -7
- package/dist/cjs/helpers/utils.d.ts +0 -3
- package/dist/cjs/helpers/utils.js +0 -2
- package/dist/cjs/helpers/utils.js.map +0 -7
- package/dist/cjs/templates/credits.js +0 -2
- package/dist/cjs/templates/credits.js.map +0 -7
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.d.ts +0 -1
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +0 -2
- package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +0 -7
- package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +0 -9
- package/dist/esm/components/credits/context/hooks/useSubscriptions.js +0 -2
- package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +0 -7
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js +0 -2
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +0 -7
- package/dist/esm/helpers/fetchResponse.d.ts +0 -14
- package/dist/esm/helpers/fetchResponse.js +0 -2
- package/dist/esm/helpers/fetchResponse.js.map +0 -7
- package/dist/esm/helpers/fetcher.d.ts +0 -2
- package/dist/esm/helpers/fetcher.js +0 -2
- package/dist/esm/helpers/fetcher.js.map +0 -7
- package/dist/esm/helpers/index.d.ts +0 -2
- package/dist/esm/helpers/index.js +0 -2
- package/dist/esm/helpers/index.js.map +0 -7
- package/dist/esm/helpers/track.d.ts +0 -19
- package/dist/esm/helpers/track.js +0 -2
- package/dist/esm/helpers/track.js.map +0 -7
- package/dist/esm/helpers/utils.d.ts +0 -3
- package/dist/esm/helpers/utils.js +0 -2
- package/dist/esm/helpers/utils.js.map +0 -7
- package/dist/esm/templates/credits.js +0 -2
- package/dist/esm/templates/credits.js.map +0 -7
- package/src/components/credits/context/hooks/useFunctionMemberPrice.ts +0 -33
- package/src/components/credits/context/utils/atobID.ts +0 -8
- package/src/components/credits/context/utils/functionDiscountCalculate.ts +0 -57
- package/src/components/credits/context/utils/getFunctionMemberPrice.ts +0 -135
- package/src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts +0 -51
- package/src/components/credits/context/utils/variantGetCoupon.ts +0 -34
- /package/dist/cjs/components/credits/creditsBenefits/{benefitItem.d.ts → BenefitItem.d.ts} +0 -0
- /package/dist/cjs/components/credits/creditsBenefits/{iconInfo.d.ts → IconInfo.d.ts} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{benefitItem.d.ts → BenefitItem.d.ts} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{iconInfo.d.ts → IconInfo.d.ts} +0 -0
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,2 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/track.ts"],
|
|
4
|
-
"sourcesContent": ["declare global {\n interface Window {\n dataLayer?: Array<any>\n fbq?: (...args: any[]) => void\n klaviyo?: any\n gtag?: any\n }\n}\n\n// GA \u57CB\u70B9\nexport const gaTrack = (data: any) => {\n if (typeof window === 'undefined') {\n return ''\n }\n window.dataLayer = window?.dataLayer || []\n if (!Array.isArray(window.dataLayer)) {\n return ''\n }\n\n try {\n window?.dataLayer?.push({ event_parameters: null })\n window?.dataLayer?.push(data || {})\n } catch (error) {\n console.log('pageGTMEvent error', error)\n }\n}\n\nexport function gaNormalClick({ position, label }: { position: string; label: string }) {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n page_group: 'soundcoreCredits Rewards Program',\n position: position,\n button_name: label,\n },\n })\n}\n\n// facebook \u57CB\u70B9\nexport const fbq = (...args: any[]) => {\n if (typeof window === 'undefined') {\n return ''\n }\n if (window.fbq) {\n window.fbq(...args)\n }\n}\n\nexport const gtag = (...args: any[]) => {\n if (typeof window === 'undefined') {\n return ''\n }\n if (window.gtag) {\n window.gtag(...args)\n }\n}\n\nexport const getGtmGroup = ({ query, asPath }: { query: any; asPath: string }) => {\n if (asPath.includes('collections')) {\n return `Product List Page_${query?.handle}`\n }\n\n if (asPath.includes('products')) {\n return 'Product Detail Page_' + query?.handle\n }\n\n if (asPath === '/' || asPath === '/app-home') {\n return 'Home Page'\n }\n\n return 'Activity Page_' + query?.handle || query?.paths?.[0]?.replace('storefront-', '')\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,SAAAE,EAAA,kBAAAC,EAAA,YAAAC,EAAA,gBAAAC,EAAA,SAAAC,IAAA,eAAAC,EAAAP,GAUO,MAAMI,EAAWI,GAAc,CAKpC,GAJI,OAAO,OAAW,MAGtB,OAAO,UAAY,QAAQ,WAAa,CAAC,EACrC,CAAC,MAAM,QAAQ,OAAO,SAAS,GACjC,MAAO,GAGT,GAAI,CACF,QAAQ,WAAW,KAAK,CAAE,iBAAkB,IAAK,CAAC,EAClD,QAAQ,WAAW,KAAKA,GAAQ,CAAC,CAAC,CACpC,OAASC,EAAO,CACd,QAAQ,IAAI,qBAAsBA,CAAK,CACzC,CACF,EAEO,SAASN,EAAc,CAAE,SAAAO,EAAU,MAAAC,CAAM,EAAwC,CACtFP,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,iBAAkB,CAChB,WAAY,mCACZ,SAAUM,EACV,YAAaC,CACf,CACF,CAAC,CACH,CAGO,MAAMT,EAAM,IAAIU,IAAgB,CACrC,GAAI,OAAO,OAAW,IACpB,MAAO,GAEL,OAAO,KACT,OAAO,IAAI,GAAGA,CAAI,CAEtB,EAEaN,EAAO,IAAIM,IAAgB,CACtC,GAAI,OAAO,OAAW,IACpB,MAAO,GAEL,OAAO,MACT,OAAO,KAAK,GAAGA,CAAI,CAEvB,EAEaP,EAAc,CAAC,CAAE,MAAAQ,EAAO,OAAAC,CAAO,IACtCA,EAAO,SAAS,aAAa,EACxB,qBAAqBD,GAAO,MAAM,GAGvCC,EAAO,SAAS,UAAU,EACrB,uBAAyBD,GAAO,OAGrCC,IAAW,KAAOA,IAAW,YACxB,YAGF,iBAAmBD,GAAO,QAAUA,GAAO,QAAQ,CAAC,GAAG,QAAQ,cAAe,EAAE",
|
|
6
|
-
"names": ["track_exports", "__export", "fbq", "gaNormalClick", "gaTrack", "getGtmGroup", "gtag", "__toCommonJS", "data", "error", "position", "label", "args", "query", "asPath"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(o,r)=>{for(var e in r)n(o,e,{get:r[e],enumerable:!0})},i=(o,r,e,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of u(r))!c.call(o,t)&&t!==e&&n(o,t,{get:()=>r[t],enumerable:!(p=s(r,t))||p.enumerable});return o};var m=o=>i(n({},"__esModule",{value:!0}),o);var C={};f(C,{cn:()=>x,noop:()=>y});module.exports=m(C);var a=require("clsx"),l=require("tailwind-merge");function x(...o){return(0,l.twMerge)((0,a.clsx)(o))}function y(){}
|
|
2
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,QAAAE,EAAA,SAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAsC,gBACtCC,EAAwB,0BAEjB,SAASJ,KAAMK,EAAsB,CAC1C,SAAO,cAAQ,QAAKA,CAAM,CAAC,CAC7B,CAEO,SAASJ,GAAY,CAAC",
|
|
6
|
-
"names": ["utils_exports", "__export", "cn", "noop", "__toCommonJS", "import_clsx", "import_tailwind_merge", "inputs"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var C=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var M=(s,i)=>{for(var p in i)C(s,p,{get:i[p],enumerable:!0})},N=(s,i,p,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of K(i))!F.call(s,t)&&t!==p&&C(s,t,{get:()=>i[t],enumerable:!(r=L(i,t))||r.enumerable});return s};var S=s=>N(C({},"__esModule",{value:!0}),s);var D={};M(D,{ComponentKey:()=>I,CreditsTemplate:()=>x});module.exports=S(D);var o=require("react/jsx-runtime"),a=require("@anker-in/lib"),c=require("../components/registration/context/provider"),f=require("../components/credits/context/provider"),l=require("../components/credits/creditsBanner"),y=require("../components/credits/creditsInfoCard"),g=require("../components/credits/creditsBenefits"),P=require("../components/credits/creditsWaysToGetCredits"),T=require("../components/credits/creditsAnkersolixTask"),v=require("../components/credits/creditsRedeemList"),u=require("../components/credits/creditsCash"),b=require("../components/credits/creditsMemberPrice"),h=require("../components/credits/creditsFaq"),B=require("../components/credits/creditsNavigation"),I=(d=>(d.Navigation="creditsNavigation",d.Banner="creditsBanner",d.InfoCard="creditsInfoCard",d.Benefits="creditsBenefits",d.WaysToGetCredits="creditsWaysToGetCredits",d.AnkersolixTask="creditsAnkersolixTask",d.RedeemList="creditsRedeemList",d.SpendCreditsLikeCash="creditsCash",d.MemberPrice="creditsMemberPrice",d.Faqs="creditsFaq",d))(I||{});const x=({headlessConfig:s,siteConfig:i,creditsConfig:p,userContext:r,pageConfig:t,registrationContext:m,gtm:A})=>(console.log("siteConfig",i),(0,o.jsx)(a.HeadlessProvider,{headlessConfig:s,children:(0,o.jsx)(c.RegistrationProvider,{copy:i.registrationsSettings,email:r?.profile?.email,children:(0,o.jsxs)(f.CreditsProvider,{profile:r?.profile,removeProfile:r?.removeProfile,isLoadingProfile:r?.isLoadingProfile,openSignInPopup:m.openSignInPopup,openSignUpPopup:m.openSignUpPopup,creditInfo:r?.creditInfo,taskIdToTypeMapping:i.taskIdToTypeMapping,customer:r?.customer,fetchCreditInfo:r?.fetchCreditInfo,customerLoading:r?.customerLoading,gtm:A,pageCommon:t.common,memberPriceDiscount:i.memberPriceDiscount,alpcBrand:p?.alpcBrand,children:[t.components.creditsNavigation&&(0,o.jsx)(B.CreditsNavigation,{copy:t.components.creditsNavigation}),(0,o.jsx)("div",{className:(0,a.classNames)("bg-[#f5f5f7] leading-[1.2]"),children:t.order.map(e=>{if(e==="creditsNavigation")return null;const n=t.components?.[e];return n?(0,o.jsxs)(o.Fragment,{children:[e==="creditsBanner"&&(0,o.jsx)(l.CreditsBanner,{copy:n,id:e}),e==="creditsInfoCard"&&r?.profile&&(0,o.jsx)(y.CreditsInfoCard,{copy:n,id:e}),e==="creditsBenefits"&&(0,o.jsx)(g.CreditsBenefits,{copy:n,id:e}),e==="creditsWaysToGetCredits"&&(0,o.jsx)(P.CreditsWaysToGetCredits,{copy:n,id:e,classNames:s.brand==="anker"?{subtitle:"text-white",equalCreditsText:"bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent"}:{subtitle:"text-[#D1D1D1]",equalCreditsText:"text-[#F6EAD0]"}}),e==="creditsAnkersolixTask"&&(0,o.jsx)(T.CreditsAnkersolixTask,{copy:n,id:e}),e==="creditsRedeemList"&&(0,o.jsx)(v.CreditsRedeemList,{copy:n,id:e}),e==="creditsCash"&&(0,o.jsx)(u.CreditsCash,{copy:n,id:e}),e==="creditsMemberPrice"&&(0,o.jsx)(b.CreditsMemberPrice,{copy:n,id:e}),e==="creditsFaq"&&(0,o.jsx)(h.CreditsFaq,{copy:n,id:e}),e!=="creditsBanner"&&(0,o.jsx)("div",{className:"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16"})]}):null})})]})})}));
|
|
2
|
-
//# sourceMappingURL=Credits.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/templates/Credits.tsx"],
|
|
4
|
-
"sourcesContent": ["import { classNames, HeadlessConfig, HeadlessProvider } from '@anker-in/lib'\nimport { RegistrationProvider } from '../components/registration/context/provider'\n\nimport { DTC_TASK_TYPE } from '../components/credits/context/const'\nimport { CreditsProvider } from '../components/credits/context/provider'\nimport { CreditsPageCommon } from '../components/credits/type'\nimport { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes'\n\nimport { CreditsBanner, CreditsBannerCopy } from '../components/credits/creditsBanner'\nimport { CreditsInfoCard, CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'\nimport { CreditsBenefits, CreditsBenefitsCopy } from '../components/credits/creditsBenefits'\nimport { CreditsWaysToGetCredits, CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'\nimport { CreditsAnkersolixTask, CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask'\nimport { CreditsRedeemList, CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport { CreditsCash, CreditsCashCopy } from '../components/credits/creditsCash'\nimport { CreditsMemberPrice, CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice'\nimport { CreditsFaq, CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport { CreditsNavigation, CreditsNavigationCopy } from '../components/credits/creditsNavigation'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\n\nexport enum ComponentKey {\n Navigation = 'creditsNavigation',\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n AnkersolixTask = 'creditsAnkersolixTask',\n RedeemList = 'creditsRedeemList',\n SpendCreditsLikeCash = 'creditsCash',\n MemberPrice = 'creditsMemberPrice',\n Faqs = 'creditsFaq',\n}\nexport type CreditsTemplateProps = {\n headlessConfig: HeadlessConfig\n siteConfig: {\n registrationsSettings: {\n authCodeActivate: AuthCodeActivateCopy\n }\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n }\n creditsConfig?: {\n alpcBrand?: string\n }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Navigation]?: CreditsNavigationCopy\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\n [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy\n [ComponentKey.Faqs]?: CreditsFaqCopy\n }\n }\n userContext: {\n profile: any\n removeProfile: () => void\n isLoadingProfile: boolean\n creditInfo: any\n customer: any\n customerLoading: boolean\n fetchCreditInfo: () => void\n }\n registrationContext: {\n openSignUpPopup: () => void\n openSignInPopup: () => void\n }\n gtm: {\n pageGroup: string\n }\n}\n\nexport const CreditsTemplate = ({\n headlessConfig,\n siteConfig,\n creditsConfig,\n userContext,\n pageConfig,\n registrationContext,\n gtm,\n}: CreditsTemplateProps) => {\n\n console.log('siteConfig', siteConfig)\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>\n <CreditsProvider\n profile={userContext?.profile}\n removeProfile={userContext?.removeProfile}\n isLoadingProfile={userContext?.isLoadingProfile}\n openSignInPopup={registrationContext.openSignInPopup}\n openSignUpPopup={registrationContext.openSignUpPopup}\n creditInfo={userContext?.creditInfo}\n taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}\n customer={userContext?.customer}\n fetchCreditInfo={userContext?.fetchCreditInfo}\n customerLoading={userContext?.customerLoading}\n gtm={gtm}\n pageCommon={pageConfig.common}\n memberPriceDiscount={siteConfig.memberPriceDiscount}\n alpcBrand={creditsConfig?.alpcBrand}\n >\n {/* \u5BFC\u822A\u7EC4\u4EF6 - \u56FA\u5B9A\u4F4D\u7F6E\uFF0C\u4E0D\u53C2\u4E0E order \u6392\u5E8F */}\n {pageConfig.components[ComponentKey.Navigation] && (\n <CreditsNavigation copy={pageConfig.components[ComponentKey.Navigation]} />\n )}\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n // \u8DF3\u8FC7\u5BFC\u822A\u7EC4\u4EF6\uFF0C\u56E0\u4E3A\u5B83\u5DF2\u7ECF\u56FA\u5B9A\u6E32\u67D3\u5728\u4E0A\u65B9\n if (key === ComponentKey.Navigation) return null\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} id={key} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} id={key} />\n )}\n {key === ComponentKey.Benefits && <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} id={key} />}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\n id={key}\n classNames={\n headlessConfig.brand === 'anker'\n ? {\n subtitle: 'text-white',\n equalCreditsText:\n 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',\n }\n : {\n subtitle: 'text-[#D1D1D1]',\n equalCreditsText: 'text-[#F6EAD0]',\n }\n }\n />\n )}\n {key === ComponentKey.AnkersolixTask && (\n <CreditsAnkersolixTask\n copy={componentCopy as CreditsAnkersolixTaskCopy}\n id={key}\n />\n )}\n {key === ComponentKey.RedeemList && <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} id={key} />}\n {key === ComponentKey.SpendCreditsLikeCash && <CreditsCash copy={componentCopy as CreditsCashCopy} id={key} />}\n {key === ComponentKey.MemberPrice && <CreditsMemberPrice copy={componentCopy as CreditsMemberPriceCopy} id={key} />}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} id={key} />}\n {key !== ComponentKey.Banner && (\n <div className=\"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16\" />\n )}\n </>\n )\n })}\n </div>\n </CreditsProvider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,oBAAAC,IAAA,eAAAC,EAAAJ,GA8GY,IAAAK,EAAA,6BA9GZC,EAA6D,yBAC7DC,EAAqC,uDAGrCA,EAAgC,kDAIhCC,EAAiD,+CACjDC,EAAqD,iDACrDC,EAAqD,iDACrDC,EAAqE,yDACrEC,EAAiE,uDACjEC,EAAyD,mDACzDC,EAA6C,6CAC7CC,EAA2D,oDAC3DC,EAA2C,4CAC3CC,EAAyD,mDAG7Cf,OACVA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,SAAW,kBACXA,EAAA,SAAW,kBACXA,EAAA,iBAAmB,0BACnBA,EAAA,eAAiB,wBACjBA,EAAA,WAAa,oBACbA,EAAA,qBAAuB,cACvBA,EAAA,YAAc,qBACdA,EAAA,KAAO,aAVGA,OAAA,IA0DL,MAAMC,EAAkB,CAAC,CAC9B,eAAAe,EACA,WAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,IAAAC,CACF,KAEE,QAAQ,IAAI,aAAcL,CAAU,KAElC,OAAC,oBAAiB,eAAgBD,EAChC,mBAAC,wBAAqB,KAAMC,EAAW,sBAAuB,MAAOE,GAAa,SAAS,MACzF,oBAAC,mBACC,QAASA,GAAa,QACtB,cAAeA,GAAa,cAC5B,iBAAkBA,GAAa,iBAC/B,gBAAiBE,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYF,GAAa,WACzB,oBAAqBF,EAAW,oBAChC,SAAUE,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKG,EACL,WAAYF,EAAW,OACvB,oBAAqBH,EAAW,oBAChC,UAAWC,GAAe,UAGzB,UAAAE,EAAW,WAAW,sBACrB,OAAC,qBAAkB,KAAMA,EAAW,WAAW,kBAA0B,KAE3E,OAAC,OAAI,aAAW,cAAW,4BAA4B,EACpD,SAAAA,EAAW,MAAM,IAAIG,GAAO,CAE3B,GAAIA,IAAQ,oBAAyB,OAAO,KAC5C,MAAMC,EAAgBJ,EAAW,aAAaG,CAAG,EACjD,OAAKC,KAEH,oBACG,UAAAD,IAAQ,oBAAuB,OAAC,iBAAc,KAAMC,EAAoC,GAAID,EAAK,EACjGA,IAAQ,mBAAyBJ,GAAa,YAC7C,OAAC,mBAAgB,KAAMK,EAAsC,GAAID,EAAK,EAEvEA,IAAQ,sBAAyB,OAAC,mBAAgB,KAAMC,EAAsC,GAAID,EAAK,EACvGA,IAAQ,8BACP,OAAC,2BACC,KAAMC,EACN,GAAID,EACJ,WACEP,EAAe,QAAU,QACrB,CACE,SAAU,aACV,iBACE,4EACJ,EACA,CACE,SAAU,iBACV,iBAAkB,gBACpB,EAER,EAEDO,IAAQ,4BACP,OAAC,yBACC,KAAMC,EACN,GAAID,EACN,EAEDA,IAAQ,wBAA2B,OAAC,qBAAkB,KAAMC,EAAwC,GAAID,EAAK,EAC7GA,IAAQ,kBAAqC,OAAC,eAAY,KAAMC,EAAkC,GAAID,EAAK,EAC3GA,IAAQ,yBAA4B,OAAC,sBAAmB,KAAMC,EAAyC,GAAID,EAAK,EAChHA,IAAQ,iBAAqB,OAAC,cAAW,KAAMC,EAAiC,GAAID,EAAK,EACzFA,IAAQ,oBACP,OAAC,OAAI,UAAU,qEAAqE,GAExF,EAvCyB,IAyC7B,CAAC,EACH,GACF,EACF,EACF",
|
|
6
|
-
"names": ["Credits_exports", "__export", "ComponentKey", "CreditsTemplate", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_provider", "import_creditsBanner", "import_creditsInfoCard", "import_creditsBenefits", "import_creditsWaysToGetCredits", "import_creditsAnkersolixTask", "import_creditsRedeemList", "import_creditsCash", "import_creditsMemberPrice", "import_creditsFaq", "import_creditsNavigation", "headlessConfig", "siteConfig", "creditsConfig", "userContext", "pageConfig", "registrationContext", "gtm", "key", "componentCopy"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useSendEmailValidation(): import("swr/mutation").SWRMutationResponse<any, any, "send-email-validation", never>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import a from"../../../../helpers/fetcher";import i from"swr/mutation";import{useCreditsContext as n}from"../provider";import{useHeadlessContext as r}from"@anker-in/lib";function u(){const{profile:e}=n(),{appName:t,locale:o}=r();return i("send-email-validation",()=>a({locale:o,url:"/api/multipass/account/users/send_validation_email",method:"POST",body:{email:e?.email,app:t},needRecaptcha:!0,action:"verifyAccount"}))}export{u as useSendEmailValidation};
|
|
2
|
-
//# sourceMappingURL=useSendEmailValidation.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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": "AAAA,OAAOA,MAAa,8BACpB,OAAOC,MAAoB,eAC3B,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAE5B,SAASC,GAAyB,CACvC,KAAM,CAAE,QAAAC,CAAQ,EAAIH,EAAkB,EAChC,CAAE,QAAAI,EAAS,OAAAC,CAAO,EAAIJ,EAAmB,EAE/C,OAAOF,EAAe,wBAAyB,IAC7CD,EAAQ,CACN,OAAAO,EACA,IAAK,qDACL,OAAQ,OACR,KAAM,CAAE,MAAOF,GAAS,MAAO,IAAKC,CAAQ,EAC5C,cAAe,GACf,OAAQ,eACV,CAAC,CACH,CACF",
|
|
6
|
-
"names": ["fetcher", "useSWRMutation", "useCreditsContext", "useHeadlessContext", "useSendEmailValidation", "profile", "appName", "locale"]
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import n from"swr";import r from"../../../../helpers/fetcher";import{useHeadlessContext as c}from"@anker-in/lib";function m({email:s}){const{locale:t}=c(),{data:e,...o}=n(s?["/api/multipass/account/subscriptions",s]:null,async([p,i])=>r({method:"GET",url:p,body:{email:i},action:"login",locale:t,headers:{},type:""}));return{data:e?.data,...o}}export{m as useSubscriptions};
|
|
2
|
-
//# sourceMappingURL=useSubscriptions.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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": "AAAA,OAAOA,MAA6B,MAEpC,OAAOC,MAAa,8BACpB,OAAS,sBAAAC,MAA0B,gBAK5B,SAASC,EAAiB,CAAE,MAAAC,CAAM,EAAkD,CACzF,KAAM,CAAE,OAAAC,CAAO,EAAIH,EAAmB,EAEhC,CAAE,KAAAI,EAAM,GAAGC,CAAK,EAAIP,EACxBI,EAAQ,CAAC,uCAAwCA,CAAK,EAAI,KAC1D,MAAO,CAACI,EAAKJ,CAAK,IAChBH,EAAQ,CACN,OAAQ,MACR,IAAAO,EACA,KAAM,CACJ,MAAAJ,CACF,EACA,OAAQ,QACR,OAAAC,EACA,QAAS,CAAC,EACV,KAAM,EACR,CAAC,CACL,EAEA,MAAO,CAAE,KAAMC,GAAM,KAAM,GAAGC,CAAK,CACrC",
|
|
6
|
-
"names": ["useSWR", "fetcher", "useHeadlessContext", "useSubscriptions", "email", "locale", "data", "rest", "url"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as t,jsxs as i}from"react/jsx-runtime";import{Heading as u,Picture as g,Text as r}from"@anker-in/headless-ui";import{classNames as n,useHeadlessContext as v}from"@anker-in/lib";import F from"./IconInfo";import{ROUNDED_BRANDS as N}from"../../../constants";const h=({item:e,handleClick:x,isNoteActive:m,index:p,bigIcon:c,cardBgColor:l,cardBorderColor:d})=>{const{brand:b}=v(),s=N.includes(b),f=c?"mb-[16px] size-[64px] xl-xxl:size-[54px] xl:size-[48px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0":"mb-[16px] size-[31px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0";console.log("cardBgColor in BenefitItem",l);const o={};return l?o.background=l:o.background="linear-gradient(119.61deg, #FAFAFA 38.58%, #FFFFFF 63.73%, #F9FCFF 89.37%)",d&&(o.borderColor=d),t("div",{className:n("relative flex-1 flex flex-col rounded-[16px] border border-white px-[24px] pb-[26px] pt-[24px] md:min-h-[180px] md:p-[16px]",!s&&"rounded-none"),style:o,children:i("div",{className:"flex flex-col",children:[t(g,{className:f,alt:e.icon?.alt,source:e.icon?.url}),i("div",{className:"flex items-center",children:[t(u,{html:e.text,size:"2",className:"break-all md-l:line-clamp-3"}),e.note&&i("div",{role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&a.preventDefault()},className:"relative mb-1 ml-[4px]",onClick:()=>x({item:e,index:p}),children:[t(F,{}),t("div",{className:n("absolute -bottom-[12px] left-[32px] z-10 w-[356px] -translate-x-full translate-y-full md:w-[276px]",m?"block":"hidden"),children:i("div",{className:n("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow",!s&&"rounded-none"),children:[t(r,{as:"p",size:"2",html:e.note,className:"desktop:text-[18px]"}),t("div",{className:n("absolute -top-[10px] right-[9px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]",!s&&"rounded-none")})]})})]})]}),e.tag&&t(r,{as:"div",html:e.tag,className:"mt-[2px] text-[16px] font-bold text-[#6D6D6F]"})]})})};var z=h;export{z as default};
|
|
2
|
-
//# sourceMappingURL=BenefitItem.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/components/credits/creditsBenefits/BenefitItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport IconInfo from './IconInfo'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport interface BenefitItemCopy {\n icon: {\n alt: string\n url: string\n }\n text: string\n note?: string\n tag?: string\n}\nconst BenefitItem = ({\n item,\n handleClick,\n isNoteActive,\n index,\n bigIcon,\n cardBgColor,\n cardBorderColor,\n}: {\n item: BenefitItemCopy\n handleClick: ({ item, index }: { item: BenefitItemCopy; index: number }) => void\n isNoteActive: boolean\n index: number\n bigIcon?: boolean\n cardBgColor?: string\n cardBorderColor?: string\n}) => {\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n // \u6839\u636E bigIcon \u8BBE\u7F6E\u4E0D\u540C\u5C4F\u5E55\u4E0B\u7684\u56FE\u6807\u5927\u5C0F\n // \u5C3A\u5BF8\uFF1A\u22651921px=64px, 1441-1920px=54px, \u22641440px=48px\n const iconSizeClass = bigIcon\n ? 'mb-[16px] size-[64px] xl-xxl:size-[54px] xl:size-[48px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0'\n : 'mb-[16px] size-[31px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0'\n\n console.log('cardBgColor in BenefitItem', cardBgColor)\n // \u80CC\u666F\u8272\u548C\u8FB9\u6846\u8272\u5904\u7406\n const cardStyle: React.CSSProperties = {}\n if (cardBgColor) {\n cardStyle.background = cardBgColor\n } else {\n cardStyle.background = 'linear-gradient(119.61deg, #FAFAFA 38.58%, #FFFFFF 63.73%, #F9FCFF 89.37%)'\n }\n if (cardBorderColor) {\n cardStyle.borderColor = cardBorderColor\n }\n\n return (\n <div\n className={cn(\n 'relative flex-1 flex flex-col rounded-[16px] border border-white px-[24px] pb-[26px] pt-[24px] md:min-h-[180px] md:p-[16px]',\n !rounded && 'rounded-none'\n )}\n style={cardStyle}\n >\n <div className=\"flex flex-col\">\n <Picture className={iconSizeClass} alt={item.icon?.alt} source={item.icon?.url} />\n <div className=\"flex items-center\">\n <Heading html={item.text} size=\"2\" className=\"break-all md-l:line-clamp-3\" />\n {item.note && (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n className=\"relative mb-1 ml-[4px]\"\n onClick={() => handleClick({ item, index })}\n >\n <IconInfo />\n <div\n className={cn(\n 'absolute -bottom-[12px] left-[32px] z-10 w-[356px] -translate-x-full translate-y-full md:w-[276px]',\n isNoteActive ? 'block' : 'hidden'\n )}\n >\n <div\n className={cn(\n 'relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow',\n !rounded && 'rounded-none'\n )}\n >\n <Text as=\"p\" size=\"2\" html={item.note} className=\"desktop:text-[18px]\" />\n <div\n className={cn(\n 'absolute -top-[10px] right-[9px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]',\n !rounded && 'rounded-none'\n )}\n />\n </div>\n </div>\n </div>\n )}\n </div>\n {item.tag && <Text as=\"div\" html={item.tag} className=\"mt-[2px] text-[16px] font-bold text-[#6D6D6F]\" />}\n </div>\n </div>\n )\n}\n\nexport default BenefitItem\n"],
|
|
5
|
-
"mappings": "AA6DQ,cAAAA,EAsBQ,QAAAC,MAtBR,oBA7DR,OAAS,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBACvC,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,OAAOC,MAAc,aACrB,OAAS,kBAAAC,MAAsB,qBAW/B,MAAMC,EAAc,CAAC,CACnB,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,MAAAC,EACA,QAAAC,EACA,YAAAC,EACA,gBAAAC,CACF,IAQM,CACJ,KAAM,CAAE,MAAAC,CAAM,EAAIX,EAAmB,EAC/BY,EAAUV,EAAe,SAASS,CAAK,EAIvCE,EAAgBL,EAClB,+GACA,6EAEJ,QAAQ,IAAI,6BAA8BC,CAAW,EAErD,MAAMK,EAAiC,CAAC,EACxC,OAAIL,EACFK,EAAU,WAAaL,EAEvBK,EAAU,WAAa,6EAErBJ,IACFI,EAAU,YAAcJ,GAIxBhB,EAAC,OACC,UAAWK,EACT,8HACA,CAACa,GAAW,cACd,EACA,MAAOE,EAEP,SAAAnB,EAAC,OAAI,UAAU,gBACb,UAAAD,EAACG,EAAA,CAAQ,UAAWgB,EAAe,IAAKT,EAAK,MAAM,IAAK,OAAQA,EAAK,MAAM,IAAK,EAChFT,EAAC,OAAI,UAAU,oBACb,UAAAD,EAACE,EAAA,CAAQ,KAAMQ,EAAK,KAAM,KAAK,IAAI,UAAU,8BAA8B,EAC1EA,EAAK,MACJT,EAAC,OACC,KAAK,SACL,SAAU,EACV,UAAWoB,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EACA,UAAU,yBACV,QAAS,IAAMV,EAAY,CAAE,KAAAD,EAAM,MAAAG,CAAM,CAAC,EAE1C,UAAAb,EAACO,EAAA,EAAS,EACVP,EAAC,OACC,UAAWK,EACT,qGACAO,EAAe,QAAU,QAC3B,EAEA,SAAAX,EAAC,OACC,UAAWI,EACT,0FACA,CAACa,GAAW,cACd,EAEA,UAAAlB,EAACI,EAAA,CAAK,GAAG,IAAI,KAAK,IAAI,KAAMM,EAAK,KAAM,UAAU,sBAAsB,EACvEV,EAAC,OACC,UAAWK,EACT,mHACA,CAACa,GAAW,cACd,EACF,GACF,EACF,GACF,GAEJ,EACCR,EAAK,KAAOV,EAACI,EAAA,CAAK,GAAG,MAAM,KAAMM,EAAK,IAAK,UAAU,gDAAgD,GACxG,EACF,CAEJ,EAEA,IAAOY,EAAQb",
|
|
6
|
-
"names": ["jsx", "jsxs", "Heading", "Picture", "Text", "cn", "useHeadlessContext", "IconInfo", "ROUNDED_BRANDS", "BenefitItem", "item", "handleClick", "isNoteActive", "index", "bigIcon", "cardBgColor", "cardBorderColor", "brand", "rounded", "iconSizeClass", "cardStyle", "e", "BenefitItem_default"]
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
async function e(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 o=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 e(a)};var n=o;export{n as default,e as getAsyncError};
|
|
2
|
-
//# sourceMappingURL=fetchResponse.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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": "AAAA,eAAsBA,EAAcC,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,MAAMH,EAAcC,CAAG,CAChC,EAEA,IAAOK,EAAQF",
|
|
6
|
-
"names": ["getAsyncError", "res", "result", "error", "handleFetchResponse", "errors", "fetchResponse_default"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import f from"./fetchResponse.js";const d=async({locale:o="en",url:l,method:r="POST",headers:s={},body:e,type:c,timeout:a=9e4})=>{let n="";c==="uploadFile"?n=e:n=e?JSON.stringify(e):"";const t=new AbortController;a&&setTimeout(()=>t.abort(),a);const i=await fetch(l,{method:r,mode:"cors",headers:{"current-language":o,...s},...a&&{signal:t.signal},...r!=="GET"&&{body:n}});return f(i)};var h=d;export{h as default};
|
|
2
|
-
//# sourceMappingURL=fetcher.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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": "AAAA,OAAOA,MAAyB,qBAEhC,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,OAAOT,EAAoBW,CAAI,CACjC,EAEA,IAAOC,EAAQX",
|
|
6
|
-
"names": ["handleFetchResponse", "fetcher", "locale", "url", "method", "headers", "body", "type", "timeout", "bodyData", "controller", "data", "fetcher_default"]
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const r=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 t({position:e,label:n}){r({event:"ga4Event",event_name:"lp_button",event_parameters:{page_group:"soundcoreCredits Rewards Program",position:e,button_name:n}})}const a=(...e)=>{if(typeof window>"u")return"";window.fbq&&window.fbq(...e)},o=(...e)=>{if(typeof window>"u")return"";window.gtag&&window.gtag(...e)},i=({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-","");export{a as fbq,t as gaNormalClick,r as gaTrack,i as getGtmGroup,o as gtag};
|
|
2
|
-
//# sourceMappingURL=track.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/track.ts"],
|
|
4
|
-
"sourcesContent": ["declare global {\n interface Window {\n dataLayer?: Array<any>\n fbq?: (...args: any[]) => void\n klaviyo?: any\n gtag?: any\n }\n}\n\n// GA \u57CB\u70B9\nexport const gaTrack = (data: any) => {\n if (typeof window === 'undefined') {\n return ''\n }\n window.dataLayer = window?.dataLayer || []\n if (!Array.isArray(window.dataLayer)) {\n return ''\n }\n\n try {\n window?.dataLayer?.push({ event_parameters: null })\n window?.dataLayer?.push(data || {})\n } catch (error) {\n console.log('pageGTMEvent error', error)\n }\n}\n\nexport function gaNormalClick({ position, label }: { position: string; label: string }) {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n page_group: 'soundcoreCredits Rewards Program',\n position: position,\n button_name: label,\n },\n })\n}\n\n// facebook \u57CB\u70B9\nexport const fbq = (...args: any[]) => {\n if (typeof window === 'undefined') {\n return ''\n }\n if (window.fbq) {\n window.fbq(...args)\n }\n}\n\nexport const gtag = (...args: any[]) => {\n if (typeof window === 'undefined') {\n return ''\n }\n if (window.gtag) {\n window.gtag(...args)\n }\n}\n\nexport const getGtmGroup = ({ query, asPath }: { query: any; asPath: string }) => {\n if (asPath.includes('collections')) {\n return `Product List Page_${query?.handle}`\n }\n\n if (asPath.includes('products')) {\n return 'Product Detail Page_' + query?.handle\n }\n\n if (asPath === '/' || asPath === '/app-home') {\n return 'Home Page'\n }\n\n return 'Activity Page_' + query?.handle || query?.paths?.[0]?.replace('storefront-', '')\n}\n"],
|
|
5
|
-
"mappings": "AAUO,MAAMA,EAAWC,GAAc,CAKpC,GAJI,OAAO,OAAW,MAGtB,OAAO,UAAY,QAAQ,WAAa,CAAC,EACrC,CAAC,MAAM,QAAQ,OAAO,SAAS,GACjC,MAAO,GAGT,GAAI,CACF,QAAQ,WAAW,KAAK,CAAE,iBAAkB,IAAK,CAAC,EAClD,QAAQ,WAAW,KAAKA,GAAQ,CAAC,CAAC,CACpC,OAASC,EAAO,CACd,QAAQ,IAAI,qBAAsBA,CAAK,CACzC,CACF,EAEO,SAASC,EAAc,CAAE,SAAAC,EAAU,MAAAC,CAAM,EAAwC,CACtFL,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,iBAAkB,CAChB,WAAY,mCACZ,SAAUI,EACV,YAAaC,CACf,CACF,CAAC,CACH,CAGO,MAAMC,EAAM,IAAIC,IAAgB,CACrC,GAAI,OAAO,OAAW,IACpB,MAAO,GAEL,OAAO,KACT,OAAO,IAAI,GAAGA,CAAI,CAEtB,EAEaC,EAAO,IAAID,IAAgB,CACtC,GAAI,OAAO,OAAW,IACpB,MAAO,GAEL,OAAO,MACT,OAAO,KAAK,GAAGA,CAAI,CAEvB,EAEaE,EAAc,CAAC,CAAE,MAAAC,EAAO,OAAAC,CAAO,IACtCA,EAAO,SAAS,aAAa,EACxB,qBAAqBD,GAAO,MAAM,GAGvCC,EAAO,SAAS,UAAU,EACrB,uBAAyBD,GAAO,OAGrCC,IAAW,KAAOA,IAAW,YACxB,YAGF,iBAAmBD,GAAO,QAAUA,GAAO,QAAQ,CAAC,GAAG,QAAQ,cAAe,EAAE",
|
|
6
|
-
"names": ["gaTrack", "data", "error", "gaNormalClick", "position", "label", "fbq", "args", "gtag", "getGtmGroup", "query", "asPath"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,MAA6B,OACtC,OAAS,WAAAC,MAAe,iBAEjB,SAASC,KAAMC,EAAsB,CAC1C,OAAOF,EAAQD,EAAKG,CAAM,CAAC,CAC7B,CAEO,SAASC,GAAY,CAAC",
|
|
6
|
-
"names": ["clsx", "twMerge", "cn", "inputs", "noop"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Fragment as K,jsx as o,jsxs as a}from"react/jsx-runtime";import{classNames as c,HeadlessProvider as f}from"@anker-in/lib";import{RegistrationProvider as l}from"../components/registration/context/provider";import{CreditsProvider as y}from"../components/credits/context/provider";import{CreditsBanner as g}from"../components/credits/creditsBanner";import{CreditsInfoCard as P}from"../components/credits/creditsInfoCard";import{CreditsBenefits as T}from"../components/credits/creditsBenefits";import{CreditsWaysToGetCredits as v}from"../components/credits/creditsWaysToGetCredits";import{CreditsAnkersolixTask as u}from"../components/credits/creditsAnkersolixTask";import{CreditsRedeemList as b}from"../components/credits/creditsRedeemList";import{CreditsCash as h}from"../components/credits/creditsCash";import{CreditsMemberPrice as B}from"../components/credits/creditsMemberPrice";import{CreditsFaq as I}from"../components/credits/creditsFaq";import{CreditsNavigation as A}from"../components/credits/creditsNavigation";var L=(r=>(r.Navigation="creditsNavigation",r.Banner="creditsBanner",r.InfoCard="creditsInfoCard",r.Benefits="creditsBenefits",r.WaysToGetCredits="creditsWaysToGetCredits",r.AnkersolixTask="creditsAnkersolixTask",r.RedeemList="creditsRedeemList",r.SpendCreditsLikeCash="creditsCash",r.MemberPrice="creditsMemberPrice",r.Faqs="creditsFaq",r))(L||{});const ne=({headlessConfig:d,siteConfig:n,creditsConfig:C,userContext:t,pageConfig:s,registrationContext:p,gtm:m})=>(console.log("siteConfig",n),o(f,{headlessConfig:d,children:o(l,{copy:n.registrationsSettings,email:t?.profile?.email,children:a(y,{profile:t?.profile,removeProfile:t?.removeProfile,isLoadingProfile:t?.isLoadingProfile,openSignInPopup:p.openSignInPopup,openSignUpPopup:p.openSignUpPopup,creditInfo:t?.creditInfo,taskIdToTypeMapping:n.taskIdToTypeMapping,customer:t?.customer,fetchCreditInfo:t?.fetchCreditInfo,customerLoading:t?.customerLoading,gtm:m,pageCommon:s.common,memberPriceDiscount:n.memberPriceDiscount,alpcBrand:C?.alpcBrand,children:[s.components.creditsNavigation&&o(A,{copy:s.components.creditsNavigation}),o("div",{className:c("bg-[#f5f5f7] leading-[1.2]"),children:s.order.map(e=>{if(e==="creditsNavigation")return null;const i=s.components?.[e];return i?a(K,{children:[e==="creditsBanner"&&o(g,{copy:i,id:e}),e==="creditsInfoCard"&&t?.profile&&o(P,{copy:i,id:e}),e==="creditsBenefits"&&o(T,{copy:i,id:e}),e==="creditsWaysToGetCredits"&&o(v,{copy:i,id:e,classNames:d.brand==="anker"?{subtitle:"text-white",equalCreditsText:"bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent"}:{subtitle:"text-[#D1D1D1]",equalCreditsText:"text-[#F6EAD0]"}}),e==="creditsAnkersolixTask"&&o(u,{copy:i,id:e}),e==="creditsRedeemList"&&o(b,{copy:i,id:e}),e==="creditsCash"&&o(h,{copy:i,id:e}),e==="creditsMemberPrice"&&o(B,{copy:i,id:e}),e==="creditsFaq"&&o(I,{copy:i,id:e}),e!=="creditsBanner"&&o("div",{className:"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16"})]}):null})})]})})}));export{L as ComponentKey,ne as CreditsTemplate};
|
|
2
|
-
//# sourceMappingURL=Credits.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/templates/Credits.tsx"],
|
|
4
|
-
"sourcesContent": ["import { classNames, HeadlessConfig, HeadlessProvider } from '@anker-in/lib'\nimport { RegistrationProvider } from '../components/registration/context/provider'\n\nimport { DTC_TASK_TYPE } from '../components/credits/context/const'\nimport { CreditsProvider } from '../components/credits/context/provider'\nimport { CreditsPageCommon } from '../components/credits/type'\nimport { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes'\n\nimport { CreditsBanner, CreditsBannerCopy } from '../components/credits/creditsBanner'\nimport { CreditsInfoCard, CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'\nimport { CreditsBenefits, CreditsBenefitsCopy } from '../components/credits/creditsBenefits'\nimport { CreditsWaysToGetCredits, CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'\nimport { CreditsAnkersolixTask, CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask'\nimport { CreditsRedeemList, CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport { CreditsCash, CreditsCashCopy } from '../components/credits/creditsCash'\nimport { CreditsMemberPrice, CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice'\nimport { CreditsFaq, CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport { CreditsNavigation, CreditsNavigationCopy } from '../components/credits/creditsNavigation'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\n\nexport enum ComponentKey {\n Navigation = 'creditsNavigation',\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n AnkersolixTask = 'creditsAnkersolixTask',\n RedeemList = 'creditsRedeemList',\n SpendCreditsLikeCash = 'creditsCash',\n MemberPrice = 'creditsMemberPrice',\n Faqs = 'creditsFaq',\n}\nexport type CreditsTemplateProps = {\n headlessConfig: HeadlessConfig\n siteConfig: {\n registrationsSettings: {\n authCodeActivate: AuthCodeActivateCopy\n }\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n }\n creditsConfig?: {\n alpcBrand?: string\n }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Navigation]?: CreditsNavigationCopy\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\n [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy\n [ComponentKey.Faqs]?: CreditsFaqCopy\n }\n }\n userContext: {\n profile: any\n removeProfile: () => void\n isLoadingProfile: boolean\n creditInfo: any\n customer: any\n customerLoading: boolean\n fetchCreditInfo: () => void\n }\n registrationContext: {\n openSignUpPopup: () => void\n openSignInPopup: () => void\n }\n gtm: {\n pageGroup: string\n }\n}\n\nexport const CreditsTemplate = ({\n headlessConfig,\n siteConfig,\n creditsConfig,\n userContext,\n pageConfig,\n registrationContext,\n gtm,\n}: CreditsTemplateProps) => {\n\n console.log('siteConfig', siteConfig)\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>\n <CreditsProvider\n profile={userContext?.profile}\n removeProfile={userContext?.removeProfile}\n isLoadingProfile={userContext?.isLoadingProfile}\n openSignInPopup={registrationContext.openSignInPopup}\n openSignUpPopup={registrationContext.openSignUpPopup}\n creditInfo={userContext?.creditInfo}\n taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}\n customer={userContext?.customer}\n fetchCreditInfo={userContext?.fetchCreditInfo}\n customerLoading={userContext?.customerLoading}\n gtm={gtm}\n pageCommon={pageConfig.common}\n memberPriceDiscount={siteConfig.memberPriceDiscount}\n alpcBrand={creditsConfig?.alpcBrand}\n >\n {/* \u5BFC\u822A\u7EC4\u4EF6 - \u56FA\u5B9A\u4F4D\u7F6E\uFF0C\u4E0D\u53C2\u4E0E order \u6392\u5E8F */}\n {pageConfig.components[ComponentKey.Navigation] && (\n <CreditsNavigation copy={pageConfig.components[ComponentKey.Navigation]} />\n )}\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n // \u8DF3\u8FC7\u5BFC\u822A\u7EC4\u4EF6\uFF0C\u56E0\u4E3A\u5B83\u5DF2\u7ECF\u56FA\u5B9A\u6E32\u67D3\u5728\u4E0A\u65B9\n if (key === ComponentKey.Navigation) return null\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} id={key} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} id={key} />\n )}\n {key === ComponentKey.Benefits && <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} id={key} />}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\n id={key}\n classNames={\n headlessConfig.brand === 'anker'\n ? {\n subtitle: 'text-white',\n equalCreditsText:\n 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',\n }\n : {\n subtitle: 'text-[#D1D1D1]',\n equalCreditsText: 'text-[#F6EAD0]',\n }\n }\n />\n )}\n {key === ComponentKey.AnkersolixTask && (\n <CreditsAnkersolixTask\n copy={componentCopy as CreditsAnkersolixTaskCopy}\n id={key}\n />\n )}\n {key === ComponentKey.RedeemList && <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} id={key} />}\n {key === ComponentKey.SpendCreditsLikeCash && <CreditsCash copy={componentCopy as CreditsCashCopy} id={key} />}\n {key === ComponentKey.MemberPrice && <CreditsMemberPrice copy={componentCopy as CreditsMemberPriceCopy} id={key} />}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} id={key} />}\n {key !== ComponentKey.Banner && (\n <div className=\"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16\" />\n )}\n </>\n )\n })}\n </div>\n </CreditsProvider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\n"],
|
|
5
|
-
"mappings": "AA8GY,OASI,YAAAA,EATJ,OAAAC,EASI,QAAAC,MATJ,oBA9GZ,OAAS,cAAAC,EAA4B,oBAAAC,MAAwB,gBAC7D,OAAS,wBAAAC,MAA4B,8CAGrC,OAAS,mBAAAC,MAAuB,yCAIhC,OAAS,iBAAAC,MAAwC,sCACjD,OAAS,mBAAAC,MAA4C,wCACrD,OAAS,mBAAAC,MAA4C,wCACrD,OAAS,2BAAAC,MAA4D,gDACrE,OAAS,yBAAAC,MAAwD,8CACjE,OAAS,qBAAAC,MAAgD,0CACzD,OAAS,eAAAC,MAAoC,oCAC7C,OAAS,sBAAAC,MAAkD,2CAC3D,OAAS,cAAAC,MAAkC,mCAC3C,OAAS,qBAAAC,MAAgD,0CAGlD,IAAKC,OACVA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,SAAW,kBACXA,EAAA,SAAW,kBACXA,EAAA,iBAAmB,0BACnBA,EAAA,eAAiB,wBACjBA,EAAA,WAAa,oBACbA,EAAA,qBAAuB,cACvBA,EAAA,YAAc,qBACdA,EAAA,KAAO,aAVGA,OAAA,IA0DL,MAAMC,GAAkB,CAAC,CAC9B,eAAAC,EACA,WAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,IAAAC,CACF,KAEE,QAAQ,IAAI,aAAcL,CAAU,EAElCnB,EAACG,EAAA,CAAiB,eAAgBe,EAChC,SAAAlB,EAACI,EAAA,CAAqB,KAAMe,EAAW,sBAAuB,MAAOE,GAAa,SAAS,MACzF,SAAApB,EAACI,EAAA,CACC,QAASgB,GAAa,QACtB,cAAeA,GAAa,cAC5B,iBAAkBA,GAAa,iBAC/B,gBAAiBE,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYF,GAAa,WACzB,oBAAqBF,EAAW,oBAChC,SAAUE,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKG,EACL,WAAYF,EAAW,OACvB,oBAAqBH,EAAW,oBAChC,UAAWC,GAAe,UAGzB,UAAAE,EAAW,WAAW,mBACrBtB,EAACe,EAAA,CAAkB,KAAMO,EAAW,WAAW,kBAA0B,EAE3EtB,EAAC,OAAI,UAAWE,EAAW,4BAA4B,EACpD,SAAAoB,EAAW,MAAM,IAAIG,GAAO,CAE3B,GAAIA,IAAQ,oBAAyB,OAAO,KAC5C,MAAMC,EAAgBJ,EAAW,aAAaG,CAAG,EACjD,OAAKC,EAEHzB,EAAAF,EAAA,CACG,UAAA0B,IAAQ,iBAAuBzB,EAACM,EAAA,CAAc,KAAMoB,EAAoC,GAAID,EAAK,EACjGA,IAAQ,mBAAyBJ,GAAa,SAC7CrB,EAACO,EAAA,CAAgB,KAAMmB,EAAsC,GAAID,EAAK,EAEvEA,IAAQ,mBAAyBzB,EAACQ,EAAA,CAAgB,KAAMkB,EAAsC,GAAID,EAAK,EACvGA,IAAQ,2BACPzB,EAACS,EAAA,CACC,KAAMiB,EACN,GAAID,EACJ,WACEP,EAAe,QAAU,QACrB,CACE,SAAU,aACV,iBACE,4EACJ,EACA,CACE,SAAU,iBACV,iBAAkB,gBACpB,EAER,EAEDO,IAAQ,yBACPzB,EAACU,EAAA,CACC,KAAMgB,EACN,GAAID,EACN,EAEDA,IAAQ,qBAA2BzB,EAACW,EAAA,CAAkB,KAAMe,EAAwC,GAAID,EAAK,EAC7GA,IAAQ,eAAqCzB,EAACY,EAAA,CAAY,KAAMc,EAAkC,GAAID,EAAK,EAC3GA,IAAQ,sBAA4BzB,EAACa,EAAA,CAAmB,KAAMa,EAAyC,GAAID,EAAK,EAChHA,IAAQ,cAAqBzB,EAACc,EAAA,CAAW,KAAMY,EAAiC,GAAID,EAAK,EACzFA,IAAQ,iBACPzB,EAAC,OAAI,UAAU,qEAAqE,GAExF,EAvCyB,IAyC7B,CAAC,EACH,GACF,EACF,EACF",
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "classNames", "HeadlessProvider", "RegistrationProvider", "CreditsProvider", "CreditsBanner", "CreditsInfoCard", "CreditsBenefits", "CreditsWaysToGetCredits", "CreditsAnkersolixTask", "CreditsRedeemList", "CreditsCash", "CreditsMemberPrice", "CreditsFaq", "CreditsNavigation", "ComponentKey", "CreditsTemplate", "headlessConfig", "siteConfig", "creditsConfig", "userContext", "pageConfig", "registrationContext", "gtm", "key", "componentCopy"]
|
|
7
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ProductVariant } from '@anker-in/lib'
|
|
2
|
-
import { FunctionMemberPriceResult } from '../memberPriceTypes'
|
|
3
|
-
import { getFunctionMemberPrice } from '../utils/getFunctionMemberPrice'
|
|
4
|
-
import { useMemo } from 'react'
|
|
5
|
-
import { useCreditsContext } from '../provider'
|
|
6
|
-
import { useHeadlessContext } from '@anker-in/lib'
|
|
7
|
-
|
|
8
|
-
// 计算单件商品的会员价
|
|
9
|
-
export const useFunctionMemberPrice = ({ variant }: { variant?: ProductVariant }) => {
|
|
10
|
-
const { memberPriceDiscount } = useCreditsContext()
|
|
11
|
-
const { locale = '' } = useHeadlessContext()
|
|
12
|
-
|
|
13
|
-
const memberPrice:
|
|
14
|
-
| FunctionMemberPriceResult
|
|
15
|
-
| (Partial<FunctionMemberPriceResult> & {
|
|
16
|
-
hasMemberPrice: false
|
|
17
|
-
}) = useMemo(() => {
|
|
18
|
-
const result = getFunctionMemberPrice({
|
|
19
|
-
memberPriceDiscount: memberPriceDiscount,
|
|
20
|
-
currencyCode: variant?.price.currencyCode,
|
|
21
|
-
variant,
|
|
22
|
-
locale,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
if (result) {
|
|
26
|
-
return result as FunctionMemberPriceResult
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return { hasMemberPrice: false }
|
|
30
|
-
}, [locale, memberPriceDiscount, variant])
|
|
31
|
-
|
|
32
|
-
return memberPrice
|
|
33
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { FunctionDiscountType, RoundSelected } from '../memberPriceConst'
|
|
2
|
-
import { DiscountConfig } from '../memberPriceTypes'
|
|
3
|
-
import Decimal from 'decimal.js'
|
|
4
|
-
|
|
5
|
-
// Function 计算折后价
|
|
6
|
-
export const functionDiscountCalculate = ({
|
|
7
|
-
config,
|
|
8
|
-
price,
|
|
9
|
-
}: {
|
|
10
|
-
config: DiscountConfig
|
|
11
|
-
price: number
|
|
12
|
-
}) => {
|
|
13
|
-
const { apply_price_ending, one_decimal_place, two_decimal_place, round_selected } =
|
|
14
|
-
config.price_ending_conf || {}
|
|
15
|
-
|
|
16
|
-
let salePrice = new Decimal(price)
|
|
17
|
-
|
|
18
|
-
switch (config.discount_type) {
|
|
19
|
-
// 百分比折扣
|
|
20
|
-
case FunctionDiscountType.Percentage:
|
|
21
|
-
salePrice = salePrice.mul(100 - config.discount_value).div(100)
|
|
22
|
-
break
|
|
23
|
-
// 固定金额折扣
|
|
24
|
-
case FunctionDiscountType.FixedAmount:
|
|
25
|
-
salePrice = salePrice.sub(config.discount_value)
|
|
26
|
-
break
|
|
27
|
-
// 固定价格折扣
|
|
28
|
-
case FunctionDiscountType.FixedPrice:
|
|
29
|
-
salePrice = new Decimal(config.discount_value)
|
|
30
|
-
break
|
|
31
|
-
default:
|
|
32
|
-
break
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (apply_price_ending) {
|
|
36
|
-
// 小数位取舍
|
|
37
|
-
switch (round_selected) {
|
|
38
|
-
case RoundSelected.RoundHighest:
|
|
39
|
-
salePrice = salePrice.ceil()
|
|
40
|
-
break
|
|
41
|
-
case RoundSelected.RoundLowest:
|
|
42
|
-
salePrice = salePrice.floor()
|
|
43
|
-
break
|
|
44
|
-
case RoundSelected.RoundNearest:
|
|
45
|
-
salePrice = salePrice.round()
|
|
46
|
-
break
|
|
47
|
-
default:
|
|
48
|
-
salePrice = new Decimal(salePrice.toFixed(2, Decimal.ROUND_DOWN))
|
|
49
|
-
break
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const priceEnding = salePrice.toString().split('.')
|
|
53
|
-
salePrice = new Decimal(priceEnding[0] + '.' + one_decimal_place + two_decimal_place)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return salePrice.toNumber()
|
|
57
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { formatPrice } from '../utils'
|
|
2
|
-
import { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes'
|
|
3
|
-
import { ProductVariant } from '@anker-in/lib'
|
|
4
|
-
import { functionDiscountCalculate } from './functionDiscountCalculate'
|
|
5
|
-
import Decimal from 'decimal.js'
|
|
6
|
-
import { getFunctionMemberPriceDiscountConfig } from './getFunctionMemberPriceDiscountConfig'
|
|
7
|
-
import variantGetCoupon from './variantGetCoupon'
|
|
8
|
-
|
|
9
|
-
// 计算单件商品的会员价
|
|
10
|
-
export const getFunctionMemberPrice = ({
|
|
11
|
-
memberPriceDiscount,
|
|
12
|
-
currencyCode,
|
|
13
|
-
variant,
|
|
14
|
-
locale,
|
|
15
|
-
}: {
|
|
16
|
-
memberPriceDiscount?: FunctionMemberPriceConfig[]
|
|
17
|
-
currencyCode?: string
|
|
18
|
-
variant?: ProductVariant
|
|
19
|
-
locale: string
|
|
20
|
-
}) => {
|
|
21
|
-
const couponData = variantGetCoupon({ variant })
|
|
22
|
-
|
|
23
|
-
// variant对应的会员价折扣配置
|
|
24
|
-
const { memberPriceDiscountConfig, activeMemberPriceConfig } = getFunctionMemberPriceDiscountConfig({
|
|
25
|
-
config: memberPriceDiscount,
|
|
26
|
-
variant,
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const useCoupon = !!activeMemberPriceConfig?.discount_combinations.other_product_discounts
|
|
30
|
-
|
|
31
|
-
if (!memberPriceDiscountConfig) {
|
|
32
|
-
return false as false
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const originalPrice = {
|
|
36
|
-
amount: variant?.price.amount || 0,
|
|
37
|
-
priceWithCurrency: formatPrice({
|
|
38
|
-
amount: variant?.price.amount || 0,
|
|
39
|
-
currencyCode: currencyCode || 'USD',
|
|
40
|
-
locale,
|
|
41
|
-
}),
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const salePriceWithoutCouponAmount = memberPriceDiscountConfig
|
|
45
|
-
? functionDiscountCalculate({
|
|
46
|
-
config: memberPriceDiscountConfig,
|
|
47
|
-
price: variant?.price.amount || 0,
|
|
48
|
-
})
|
|
49
|
-
: variant?.price.amount || 0
|
|
50
|
-
const salePriceWithoutCoupon = {
|
|
51
|
-
amount: salePriceWithoutCouponAmount,
|
|
52
|
-
priceWithCurrency: formatPrice({
|
|
53
|
-
amount: salePriceWithoutCouponAmount,
|
|
54
|
-
currencyCode: currencyCode || 'USD',
|
|
55
|
-
locale,
|
|
56
|
-
}),
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// function 会员价是在原价的基础上进行计算,暂不支持折后价
|
|
60
|
-
let salePriceAmount = salePriceWithoutCouponAmount
|
|
61
|
-
|
|
62
|
-
// 减去code的优惠
|
|
63
|
-
if (couponData?.variant_price4wscode && variant && useCoupon) {
|
|
64
|
-
if (useCoupon) {
|
|
65
|
-
// code的优惠金额
|
|
66
|
-
const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)
|
|
67
|
-
salePriceAmount = new Decimal(salePriceWithoutCouponAmount).minus(codeSaveAmountDecimal).toNumber()
|
|
68
|
-
} else {
|
|
69
|
-
// 不能与 code 同时使用,需要判断会员价是否小于 code 的优惠金额,如果小于则当做没有会员价
|
|
70
|
-
const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)
|
|
71
|
-
if (salePriceWithoutCouponAmount > codeSaveAmountDecimal.toNumber()) {
|
|
72
|
-
return false as false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const salePrice = {
|
|
78
|
-
amount: salePriceAmount,
|
|
79
|
-
priceWithCurrency: formatPrice({
|
|
80
|
-
amount: salePriceAmount,
|
|
81
|
-
currencyCode: currencyCode || 'USD',
|
|
82
|
-
locale,
|
|
83
|
-
}),
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const savePriceAmount = new Decimal(originalPrice.amount).minus(salePrice.amount).toNumber()
|
|
87
|
-
const savePrice = {
|
|
88
|
-
amount: savePriceAmount,
|
|
89
|
-
priceWithCurrency: formatPrice({
|
|
90
|
-
amount: savePriceAmount,
|
|
91
|
-
currencyCode: currencyCode || 'USD',
|
|
92
|
-
locale,
|
|
93
|
-
maximumFractionDigits: 2,
|
|
94
|
-
}),
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const savePriceWithoutCouponAmount = new Decimal(originalPrice.amount)
|
|
98
|
-
.minus(salePriceWithoutCoupon.amount)
|
|
99
|
-
.toNumber()
|
|
100
|
-
const savePriceWithoutCoupon = {
|
|
101
|
-
amount: savePriceWithoutCouponAmount,
|
|
102
|
-
priceWithCurrency: formatPrice({
|
|
103
|
-
amount: savePriceWithoutCouponAmount,
|
|
104
|
-
currencyCode: currencyCode || 'USD',
|
|
105
|
-
locale,
|
|
106
|
-
maximumFractionDigits: 2,
|
|
107
|
-
}),
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const result: FunctionMemberPriceResult = {
|
|
111
|
-
// 是否存在会员价
|
|
112
|
-
hasMemberPrice: !!memberPriceDiscountConfig,
|
|
113
|
-
useCoupon,
|
|
114
|
-
// 原价
|
|
115
|
-
originalPrice: originalPrice.amount,
|
|
116
|
-
originalPriceWithCurrency: originalPrice.priceWithCurrency as string,
|
|
117
|
-
// 使用券后的折后价
|
|
118
|
-
salePrice: salePrice.amount,
|
|
119
|
-
salePriceWithCurrency: salePrice.priceWithCurrency as string,
|
|
120
|
-
|
|
121
|
-
// 不使用券的折后价
|
|
122
|
-
salePriceWithoutCoupon: salePriceWithoutCoupon.amount,
|
|
123
|
-
salePriceWithoutCouponWithCurrency: salePriceWithoutCoupon.priceWithCurrency as string,
|
|
124
|
-
|
|
125
|
-
// 包含使用券的节省金额
|
|
126
|
-
savePrice: savePrice.amount,
|
|
127
|
-
savePriceWithCurrency: savePrice.priceWithCurrency as string,
|
|
128
|
-
|
|
129
|
-
// 不使用券的节省金额
|
|
130
|
-
savePriceWithoutCoupon: savePriceWithoutCoupon.amount,
|
|
131
|
-
savePriceWithoutCouponWithCurrency: savePriceWithoutCoupon.priceWithCurrency as string,
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return result
|
|
135
|
-
}
|