@anker-in/campaign-ui 0.2.0-beta.1 → 0.2.0-beta.11
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/provider.d.ts +2 -2
- 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/creditsBenefits/benefitItem.js +1 -1
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +3 -3
- package/dist/cjs/components/credits/creditsBenefits/index.js +3 -3
- package/dist/cjs/components/credits/creditsBenefits/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +3 -3
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +3 -3
- package/dist/cjs/components/credits/creditsCash/type.d.ts +0 -2
- 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/index.js +1 -1
- package/dist/cjs/components/credits/creditsFaq/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +0 -2
- package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
- 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/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.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/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.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/components/credits/modal/activitiesModal.js +1 -1
- package/dist/cjs/components/credits/modal/activitiesModal.js.map +2 -2
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +1 -1
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/modalContainer.js +1 -1
- package/dist/cjs/components/credits/modal/modalContainer.js.map +3 -3
- package/dist/cjs/components/credits/modal/subscribeModal.js +1 -1
- package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/tip.js +1 -1
- package/dist/cjs/components/credits/modal/tip.js.map +3 -3
- package/dist/cjs/components/credits/type.d.ts +4 -2
- package/dist/cjs/components/credits/type.js +1 -1
- package/dist/cjs/components/credits/type.js.map +1 -1
- package/dist/cjs/components/registration/authCodeActivate/Message.js +1 -1
- package/dist/cjs/components/registration/authCodeActivate/Message.js.map +2 -2
- package/dist/cjs/components/registration/authCodeActivate/index.js +1 -1
- package/dist/cjs/components/registration/authCodeActivate/index.js.map +3 -3
- package/dist/cjs/components/registration/authCodeActivate/type.d.ts +0 -1
- package/dist/cjs/components/registration/authCodeActivate/type.js.map +1 -1
- package/dist/cjs/components/registration/context/provider.d.ts +2 -0
- package/dist/cjs/components/registration/context/provider.js +1 -1
- package/dist/cjs/components/registration/context/provider.js.map +3 -3
- package/dist/cjs/components/registration/modalContainer.d.ts +1 -2
- package/dist/cjs/components/registration/modalContainer.js +1 -1
- package/dist/cjs/components/registration/modalContainer.js.map +3 -3
- package/dist/cjs/templates/credits.d.ts +9 -8
- package/dist/cjs/templates/credits.js +1 -1
- package/dist/cjs/templates/credits.js.map +3 -3
- package/dist/esm/components/credits/context/provider.d.ts +2 -2
- 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/creditsBenefits/benefitItem.js +1 -1
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +3 -3
- package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
- package/dist/esm/components/credits/creditsBenefits/index.js.map +3 -3
- package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +3 -3
- 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 +0 -2
- package/dist/esm/components/credits/creditsFaq/index.js +1 -1
- package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
- package/dist/esm/components/credits/creditsInfoCard/index.d.ts +0 -2
- package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
- 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/RedeemProductModal/Address.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
- package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
- package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
- package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
- package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +1 -1
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
- package/dist/esm/components/credits/modal/modalContainer.js +1 -1
- package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
- package/dist/esm/components/credits/modal/subscribeModal.js +1 -1
- package/dist/esm/components/credits/modal/subscribeModal.js.map +3 -3
- package/dist/esm/components/credits/modal/tip.js +1 -1
- package/dist/esm/components/credits/modal/tip.js.map +3 -3
- package/dist/esm/components/credits/type.d.ts +4 -2
- package/dist/esm/components/registration/authCodeActivate/Message.js +1 -1
- package/dist/esm/components/registration/authCodeActivate/Message.js.map +2 -2
- package/dist/esm/components/registration/authCodeActivate/index.js +1 -1
- package/dist/esm/components/registration/authCodeActivate/index.js.map +3 -3
- package/dist/esm/components/registration/authCodeActivate/type.d.ts +0 -1
- package/dist/esm/components/registration/context/provider.d.ts +2 -0
- package/dist/esm/components/registration/context/provider.js +1 -1
- package/dist/esm/components/registration/context/provider.js.map +3 -3
- package/dist/esm/components/registration/modalContainer.d.ts +1 -2
- package/dist/esm/components/registration/modalContainer.js +1 -1
- package/dist/esm/components/registration/modalContainer.js.map +3 -3
- package/dist/esm/templates/credits.d.ts +9 -8
- package/dist/esm/templates/credits.js +1 -1
- package/dist/esm/templates/credits.js.map +3 -3
- package/package.json +3 -3
- package/src/components/credits/context/provider.tsx +1 -4
- package/src/components/credits/creditsBenefits/benefitItem.tsx +2 -5
- package/src/components/credits/creditsBenefits/index.tsx +1 -4
- package/src/components/credits/creditsCash/CreditsCash.tsx +4 -7
- package/src/components/credits/creditsCash/RedeemableItem.tsx +5 -4
- package/src/components/credits/creditsCash/type.ts +0 -2
- package/src/components/credits/creditsFaq/index.tsx +2 -3
- package/src/components/credits/creditsInfoCard/index.tsx +10 -12
- package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +3 -4
- package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +2 -3
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +2 -3
- package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +2 -4
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +2 -3
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +6 -4
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +2 -3
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +2 -3
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +5 -3
- package/src/components/credits/creditsWaysToGetCredits/useActions.ts +4 -1
- package/src/components/credits/modal/MyRewardsModal.tsx +2 -3
- package/src/components/credits/modal/activitiesModal.tsx +2 -3
- package/src/components/credits/modal/creditsUploadReceiptModal.tsx +2 -3
- package/src/components/credits/modal/modalContainer.tsx +2 -3
- package/src/components/credits/modal/subscribeModal.tsx +9 -32
- package/src/components/credits/modal/tip.tsx +2 -3
- package/src/components/credits/type.ts +4 -2
- package/src/components/registration/authCodeActivate/Message.tsx +1 -1
- package/src/components/registration/authCodeActivate/index.tsx +141 -109
- package/src/components/registration/authCodeActivate/type.ts +0 -1
- package/src/components/registration/context/provider.tsx +9 -0
- package/src/components/registration/modalContainer.tsx +9 -7
- package/src/templates/credits.tsx +41 -31
- package/src/components/credits/const.ts +0 -1
|
@@ -8,20 +8,21 @@ import { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysTo
|
|
|
8
8
|
import { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList';
|
|
9
9
|
import { CreditsCashCopy } from '../components/credits/creditsCash';
|
|
10
10
|
import { CreditsFaqCopy } from '../components/credits/creditsFaq';
|
|
11
|
+
import { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type';
|
|
11
12
|
export declare enum ComponentKey {
|
|
12
|
-
Banner = "
|
|
13
|
-
InfoCard = "
|
|
14
|
-
Benefits = "
|
|
15
|
-
WaysToGetCredits = "
|
|
16
|
-
RedeemList = "
|
|
17
|
-
SpendCreditsLikeCash = "
|
|
18
|
-
Faqs = "
|
|
13
|
+
Banner = "creditsBanner",
|
|
14
|
+
InfoCard = "creditsInfoCard",
|
|
15
|
+
Benefits = "creditsBenefits",
|
|
16
|
+
WaysToGetCredits = "creditsWaysToGetCredits",
|
|
17
|
+
RedeemList = "creditsRedeemList",
|
|
18
|
+
SpendCreditsLikeCash = "creditsCash",
|
|
19
|
+
Faqs = "creditsFaq"
|
|
19
20
|
}
|
|
20
21
|
export type CreditsTemplateProps = {
|
|
21
22
|
headlessConfig: HeadlessConfig;
|
|
22
23
|
siteConfig: {
|
|
23
24
|
registrationsSettings: {
|
|
24
|
-
authCodeActivate:
|
|
25
|
+
authCodeActivate: AuthCodeActivateCopy;
|
|
25
26
|
};
|
|
26
27
|
taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>;
|
|
27
28
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var L=(r,i)=>{for(var t in i)a(r,t,{get:i[t],enumerable:!0})},S=(r,i,t,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of u(i))!B.call(r,d)&&d!==t&&a(r,d,{get:()=>i[d],enumerable:!(n=v(i,d))||n.enumerable});return r};var F=r=>S(a({},"__esModule",{value:!0}),r);var R={};L(R,{ComponentKey:()=>h,CreditsTemplate:()=>K});module.exports=F(R);var e=require("react/jsx-runtime"),p=require("@anker-in/lib"),C=require("../components/registration/context/provider"),m=require("../components/credits/context/provider"),f=require("../components/credits/creditsBanner"),y=require("../components/credits/creditsInfoCard"),c=require("../components/credits/creditsBenefits"),l=require("../components/credits/creditsWaysToGetCredits"),g=require("../components/credits/creditsRedeemList"),T=require("../components/credits/creditsCash"),P=require("../components/credits/creditsFaq"),h=(o=>(o.Banner="creditsBanner",o.InfoCard="creditsInfoCard",o.Benefits="creditsBenefits",o.WaysToGetCredits="creditsWaysToGetCredits",o.RedeemList="creditsRedeemList",o.SpendCreditsLikeCash="creditsCash",o.Faqs="creditsFaq",o))(h||{});const K=({headlessConfig:r,siteConfig:i,userContext:t,pageConfig:n,registrationContext:d,gtm:I})=>(0,e.jsx)(p.HeadlessProvider,{headlessConfig:r,children:(0,e.jsx)(C.RegistrationProvider,{copy:i.registrationsSettings,email:t?.profile?.email,children:(0,e.jsx)(m.CreditsProvider,{profile:t?.profile,removeProfile:t?.removeProfile,isLoadingProfile:t?.isLoadingProfile,openSignInPopup:d.openSignInPopup,openSignUpPopup:d.openSignUpPopup,creditInfo:t?.creditInfo,taskIdToTypeMapping:i.taskIdToTypeMapping,customer:t?.customer,fetchCreditInfo:t?.fetchCreditInfo,customerLoading:t?.customerLoading,gtm:I,pageCommon:n.common,children:(0,e.jsx)("div",{className:(0,p.classNames)("bg-[#f5f5f7] leading-[1.2]"),children:n.order.map(s=>{const o=n.components?.[s];return o?(0,e.jsxs)(e.Fragment,{children:[s==="creditsBanner"&&(0,e.jsx)(f.CreditsBanner,{copy:o}),s==="creditsInfoCard"&&t?.profile&&(0,e.jsx)(y.CreditsInfoCard,{copy:o}),s==="creditsBenefits"&&(0,e.jsx)(c.CreditsBenefits,{copy:o}),s==="creditsWaysToGetCredits"&&(0,e.jsx)(l.CreditsWaysToGetCredits,{copy:o,classNames:r.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]"}}),s==="creditsRedeemList"&&(0,e.jsx)(g.CreditsRedeemList,{copy:o}),s==="creditsCash"&&(0,e.jsx)(T.CreditsCash,{copy:o}),s==="creditsFaq"&&(0,e.jsx)(P.CreditsFaq,{copy:o}),s!=="creditsBanner"&&(0,e.jsx)("div",{className:"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16"})]}):null})})})})});
|
|
2
2
|
//# sourceMappingURL=credits.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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'\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 { CreditsRedeemList, CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport { CreditsCash, CreditsCashCopy } from '../components/credits/creditsCash'\nimport { CreditsFaq, CreditsFaqCopy } from '../components/credits/creditsFaq'\n\nexport enum ComponentKey {\n Banner = '
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,oBAAAC,IAAA,eAAAC,EAAAJ,
|
|
6
|
-
"names": ["credits_exports", "__export", "ComponentKey", "CreditsTemplate", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_provider", "import_creditsBanner", "import_creditsInfoCard", "import_creditsBenefits", "import_creditsWaysToGetCredits", "import_creditsRedeemList", "import_creditsCash", "import_creditsFaq", "headlessConfig", "siteConfig", "userContext", "pageConfig", "registrationContext", "gtm", "
|
|
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'\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 { CreditsRedeemList, CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport { CreditsCash, CreditsCashCopy } from '../components/credits/creditsCash'\nimport { CreditsFaq, CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\n\nexport enum ComponentKey {\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n RedeemList = 'creditsRedeemList',\n SpendCreditsLikeCash = 'creditsCash',\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 }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\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 userContext,\n pageConfig,\n registrationContext,\n gtm,\n}: CreditsTemplateProps) => {\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 >\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} />\n )}\n {key === ComponentKey.Benefits && <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} />}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\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.RedeemList && (\n <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} />\n )}\n {key === ComponentKey.SpendCreditsLikeCash && <CreditsCash copy={componentCopy as CreditsCashCopy} />}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} />}\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,GA8FgB,IAAAK,EAAA,6BA9FhBC,EAA6D,yBAC7DC,EAAqC,uDAGrCA,EAAgC,kDAGhCC,EAAiD,+CACjDC,EAAqD,iDACrDC,EAAqD,iDACrDC,EAAqE,yDACrEC,EAAyD,mDACzDC,EAA6C,6CAC7CC,EAA2C,4CAG/BZ,OACVA,EAAA,OAAS,gBACTA,EAAA,SAAW,kBACXA,EAAA,SAAW,kBACXA,EAAA,iBAAmB,0BACnBA,EAAA,WAAa,oBACbA,EAAA,qBAAuB,cACvBA,EAAA,KAAO,aAPGA,OAAA,IAgDL,MAAMC,EAAkB,CAAC,CAC9B,eAAAY,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,IAAAC,CACF,OAEI,OAAC,oBAAiB,eAAgBL,EAChC,mBAAC,wBAAqB,KAAMC,EAAW,sBAAuB,MAAOC,GAAa,SAAS,MACzF,mBAAC,mBACC,QAASA,GAAa,QACtB,cAAeA,GAAa,cAC5B,iBAAkBA,GAAa,iBAC/B,gBAAiBE,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYF,GAAa,WACzB,oBAAqBD,EAAW,oBAChC,SAAUC,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKG,EACL,WAAYF,EAAW,OAEvB,mBAAC,OAAI,aAAW,cAAW,4BAA4B,EACpD,SAAAA,EAAW,MAAM,IAAIG,GAAO,CAC3B,MAAMC,EAAgBJ,EAAW,aAAaG,CAAG,EACjD,OAAKC,KAEH,oBACG,UAAAD,IAAQ,oBAAuB,OAAC,iBAAc,KAAMC,EAAoC,EACxFD,IAAQ,mBAAyBJ,GAAa,YAC7C,OAAC,mBAAgB,KAAMK,EAAsC,EAE9DD,IAAQ,sBAAyB,OAAC,mBAAgB,KAAMC,EAAsC,EAC9FD,IAAQ,8BACP,OAAC,2BACC,KAAMC,EACN,WACEP,EAAe,QAAU,QACrB,CACE,SAAU,aACV,iBACE,4EACJ,EACA,CACE,SAAU,iBACV,iBAAkB,gBACpB,EAER,EAEDM,IAAQ,wBACP,OAAC,qBAAkB,KAAMC,EAAwC,EAElED,IAAQ,kBAAqC,OAAC,eAAY,KAAMC,EAAkC,EAClGD,IAAQ,iBAAqB,OAAC,cAAW,KAAMC,EAAiC,EAChFD,IAAQ,oBACP,OAAC,OAAI,UAAU,qEAAqE,GAExF,EAjCyB,IAmC7B,CAAC,EACH,EACF,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_creditsRedeemList", "import_creditsCash", "import_creditsFaq", "headlessConfig", "siteConfig", "userContext", "pageConfig", "registrationContext", "gtm", "key", "componentCopy"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
2
|
import type { DTC_TASK_TYPE } from './const';
|
|
3
3
|
import type { CreditInfoResponse } from './response';
|
|
4
4
|
import { CreditsPageCommon } from '../type';
|
|
@@ -18,7 +18,7 @@ type Context = {
|
|
|
18
18
|
};
|
|
19
19
|
pageCommon: CreditsPageCommon;
|
|
20
20
|
};
|
|
21
|
-
export declare const CreditsContext:
|
|
21
|
+
export declare const CreditsContext: import("react").Context<Context>;
|
|
22
22
|
export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, }: PropsWithChildren<Context>): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export declare function useCreditsContext(): Context;
|
|
24
24
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{createContext as u,useContext as P}from"react";const o=u({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:""},pageCommon:{}});function T({children:e,profile:t,removeProfile:r,isLoadingProfile:n,openSignInPopup:i,openSignUpPopup:p,taskIdToTypeMapping:s,creditInfo:d,customer:C,customerLoading:f,fetchCreditInfo:m,gtm:a,pageCommon:g}){return l(o.Provider,{value:{profile:t,isLoadingProfile:n,removeProfile:r,openSignInPopup:i,openSignUpPopup:p,taskIdToTypeMapping:s,creditInfo:d,fetchCreditInfo:m,customer:C,customerLoading:f,gtm:a,pageCommon:g},children:e})}function h(){const e=P(o);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}export{o as CreditsContext,T as CreditsProvider,h as useCreditsContext};
|
|
2
2
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/provider.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "
|
|
4
|
+
"sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n }\n pageCommon: CreditsPageCommon\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n },\n pageCommon: {},\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n}: PropsWithChildren<Context>) {\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
|
|
5
|
+
"mappings": "AAsDI,cAAAA,MAAA,oBAtDJ,OAAS,iBAAAC,EAAkC,cAAAC,MAAkB,QAsBtD,MAAMC,EAAiBF,EAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBG,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,EACb,EACA,WAAY,CAAC,CACf,CAAC,EAEM,SAASC,EAAgB,CAC9B,SAAAC,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,CACF,EAA+B,CAC7B,OACElB,EAACG,EAAe,SAAf,CACC,MAAO,CACL,QAAAI,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,CACF,EAEC,SAAAZ,EACH,CAEJ,CAEO,SAASa,GAAoB,CAClC,MAAMC,EAAUlB,EAAWC,CAAc,EACzC,GAAI,CAACiB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
|
|
6
|
+
"names": ["jsx", "createContext", "useContext", "CreditsContext", "user_id", "CreditsProvider", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "useCreditsContext", "context"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as n}from"react/jsx-runtime";import{Heading as p,Picture as m,Text as d}from"@anker-in/headless-ui";import{classNames as o,useHeadlessContext as c,ROUNDED_BRANDS as f}from"@anker-in/lib";import u from"./iconInfo";const b=({item:e,handleClick:i,isNoteActive:s,index:r})=>{const{brand:x}=c(),a=f.includes(x);return t("div",{className:o("relative flex-1 flex flex-col rounded-[16px] border border-white px-[24px] pb-[26px] pt-[24px] md:min-h-[180px] md:p-[16px]",!a&&"rounded-none"),style:{background:"linear-gradient(119.61deg, #FAFAFA 38.58%, #FFFFFF 63.73%, #F9FCFF 89.37%)"},children:n("div",{className:"flex flex-col",children:[t(m,{className:"mb-[16px] size-[31px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0",alt:e.icon?.alt,source:e.icon?.url}),n("div",{className:"flex items-center",children:[t(p,{html:e.text,size:"2",className:"break-all"}),e.note&&n("div",{role:"button",tabIndex:0,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&l.preventDefault()},className:"relative mb-1 ml-[4px]",onClick:()=>i({item:e,index:r}),children:[t(u,{}),t("div",{className:o("absolute -bottom-[12px] left-[32px] z-10 w-[356px] -translate-x-full translate-y-full md:w-[276px]",s?"block":"hidden"),children:n("div",{className:o("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow",!a&&"rounded-none"),children:[t(d,{as:"p",size:"2",html:e.note,className:"desktop:text-[18px]"}),t("div",{className:o("absolute -top-[10px] right-[9px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]",!a&&"rounded-none")})]})})]})]}),e.tag&&t(d,{as:"div",html:e.tag,className:"mt-[2px] text-[16px] font-bold text-[#6D6D6F]"})]})})};var N=b;export{N as default};
|
|
2
2
|
//# sourceMappingURL=benefitItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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'\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Heading", "Picture", "Text", "cn", "useHeadlessContext", "
|
|
4
|
+
"sourcesContent": ["import { Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport IconInfo from './iconInfo'\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}: {\n item: BenefitItemCopy\n handleClick: ({ item, index }: { item: BenefitItemCopy; index: number }) => void\n isNoteActive: boolean\n index: number\n}) => {\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\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={{\n background: 'linear-gradient(119.61deg, #FAFAFA 38.58%, #FFFFFF 63.73%, #F9FCFF 89.37%)',\n }}\n >\n <div className=\"flex flex-col\">\n <Picture\n className=\"mb-[16px] size-[31px] md:absolute md:bottom-[16px] md:right-[16px] md:mb-0\"\n alt={item.icon?.alt}\n source={item.icon?.url}\n />\n <div className=\"flex items-center\">\n <Heading html={item.text} size=\"2\" className=\"break-all\" />\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\nex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,CAAK,GAAG,MAAM,KAAMM,EAAK,IAAK,UAAU,gDAAgD,GACxG,EACF,CAEJ,EAEA,IAAOO,EAAQR",
|
|
6
|
+
"names": ["jsx", "jsxs", "Heading", "Picture", "Text", "cn", "useHeadlessContext", "ROUNDED_BRANDS", "IconInfo", "BenefitItem", "item", "handleClick", "isNoteActive", "index", "brand", "rounded", "e", "benefitItem_default"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i,jsxs as a}from"react/jsx-runtime";import"swiper/css";import"swiper/css/grid";import"swiper/css/pagination";import{Container as
|
|
2
|
-
</div>`}},children:
|
|
3
|
-
[&_.swiper-pagination-bullet]:cursor-pointer [&_.swiper-pagination-bullet]:rounded-full`})]}),n&&i("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-10",onClick:()=>
|
|
1
|
+
import{jsx as i,jsxs as a}from"react/jsx-runtime";import"swiper/css";import"swiper/css/grid";import"swiper/css/pagination";import{Container as d,Heading as c}from"@anker-in/headless-ui";import{useState as u}from"react";import{Grid as f,Pagination as g}from"swiper/modules";import{Swiper as v,SwiperSlide as b}from"swiper/react";import l from"./benefitItem";import{useCreditsContext as C}from"../context/provider";import{gaTrack as w,classNames as x}from"@anker-in/lib";const D=({copy:s})=>{const[n,r]=u(null),{profile:p,gtm:m}=C(),o=({item:t,index:e})=>{w({event:"ga4Event",event_name:"lp_button",member_active_status:p?.activated?"active":"not active",event_parameters:{page_group:m.pageGroup,position:s.title,button_name:t.text,info:""}}),n===e?r(null):(r(e),setTimeout(()=>{r(null)},5e3))};return a(d,{id:"benefits",className:"!z-[30] bg-[#F5F5F7]",children:[i(c,{as:"h2",size:"4",html:s?.title}),i("div",{className:"mt-[24px] grid grid-cols-4 xl:grid-cols-3 gap-[16px] l:hidden items-stretch",children:s.benefits.map((t,e)=>i(l,{item:t,handleClick:o,isNoteActive:n===e,index:e},e))}),a("div",{className:"mt-[24px] hidden l:block",children:[i(v,{spaceBetween:16,slidesPerView:2,slidesPerGroup:2,grid:{rows:2,fill:"row"},breakpoints:{768:{slidesPerView:3,slidesPerGroup:3}},wrapperClass:"!items-stretch",modules:[f,g],pagination:{clickable:!0,el:"#benefits-pagination",renderBullet(t,e){return`<div class='${e} !flex justify-center size-[8px] rounded-full bg-[#D9D9D9] cursor-pointer items-center'>
|
|
2
|
+
</div>`}},children:s.benefits.map((t,e)=>i(b,{className:x("!h-auto !flex",n===e&&"!z-[100]"),children:i(l,{item:t,handleClick:o,isNoteActive:n===e,index:e})},e))}),i("div",{id:"benefits-pagination",className:`mx-auto mt-[12px] grid !w-fit grid-flow-col [&_.swiper-pagination-bullet-active>div]:!bg-[#151515]
|
|
3
|
+
[&_.swiper-pagination-bullet]:cursor-pointer [&_.swiper-pagination-bullet]:rounded-full`})]}),n&&i("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-10",onClick:()=>r(null),onKeyDown:t=>t.key==="Escape"&&r(null)})]})};export{D as CreditsBenefits};
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsBenefits/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import 'swiper/css'\nimport 'swiper/css/grid'\nimport 'swiper/css/pagination'\n\nimport { Container, Heading } from '@anker-in/headless-ui'\nimport { useState } from 'react'\nimport { Grid, Pagination } from 'swiper/modules'\nimport { Swiper, SwiperSlide } from 'swiper/react'\n\nimport BenefitItem, { type BenefitItemCopy } from './benefitItem'\nimport { useCreditsContext } from '../context/provider'\nimport { gaTrack, classNames as cn
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Container", "Heading", "useState", "Grid", "Pagination", "Swiper", "SwiperSlide", "BenefitItem", "useCreditsContext", "gaTrack", "cn", "
|
|
4
|
+
"sourcesContent": ["import 'swiper/css'\nimport 'swiper/css/grid'\nimport 'swiper/css/pagination'\n\nimport { Container, Heading } from '@anker-in/headless-ui'\nimport { useState } from 'react'\nimport { Grid, Pagination } from 'swiper/modules'\nimport { Swiper, SwiperSlide } from 'swiper/react'\n\nimport BenefitItem, { type BenefitItemCopy } from './benefitItem'\nimport { useCreditsContext } from '../context/provider'\nimport { gaTrack, classNames as cn } from '@anker-in/lib'\n\nexport type CreditsBenefitsCopy = {\n title: string\n benefits: BenefitItemCopy[]\n}\n\nexport const CreditsBenefits = ({ copy }: { copy: CreditsBenefitsCopy }) => {\n const [activeNoteIndex, setActiveNoteIndex] = useState<number | null>(null)\n const { profile, gtm } = useCreditsContext()\n const handleClick = ({ item, index }: { item: BenefitItemCopy; index: number }) => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: gtm.pageGroup,\n position: copy.title,\n button_name: item.text,\n info: '',\n },\n })\n if (activeNoteIndex === index) {\n setActiveNoteIndex(null)\n } else {\n setActiveNoteIndex(index)\n setTimeout(() => {\n setActiveNoteIndex(null)\n }, 5000)\n }\n }\n\n return (\n <Container id=\"benefits\" className=\"!z-[30] bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy?.title} />\n <div className=\"mt-[24px] grid grid-cols-4 xl:grid-cols-3 gap-[16px] l:hidden items-stretch\">\n {copy.benefits.map((item, index) => (\n <BenefitItem\n key={index}\n item={item}\n handleClick={handleClick}\n isNoteActive={activeNoteIndex === index}\n index={index}\n />\n ))}\n </div>\n <div className=\"mt-[24px] hidden l:block\">\n <Swiper\n spaceBetween={16}\n slidesPerView={2}\n slidesPerGroup={2}\n grid={{\n rows: 2,\n fill: 'row',\n }}\n breakpoints={{\n 768: {\n slidesPerView: 3,\n slidesPerGroup: 3,\n },\n }}\n wrapperClass=\"!items-stretch\"\n modules={[Grid, Pagination]}\n pagination={{\n clickable: true,\n el: '#benefits-pagination',\n renderBullet(index, className) {\n return `<div class='${className} !flex justify-center size-[8px] rounded-full bg-[#D9D9D9] cursor-pointer items-center'>\n </div>`\n },\n }}\n >\n {copy.benefits.map((item, index) => (\n <SwiperSlide key={index} className={cn('!h-auto !flex', activeNoteIndex === index && '!z-[100]')}>\n <BenefitItem\n item={item}\n handleClick={handleClick}\n isNoteActive={activeNoteIndex === index}\n index={index}\n />\n </SwiperSlide>\n ))}\n </Swiper>\n <div\n id=\"benefits-pagination\"\n className=\"mx-auto mt-[12px] grid !w-fit grid-flow-col [&_.swiper-pagination-bullet-active>div]:!bg-[#151515] \n [&_.swiper-pagination-bullet]:cursor-pointer [&_.swiper-pagination-bullet]:rounded-full\"\n ></div>\n </div>\n\n {activeNoteIndex && (\n <div\n role=\"button\"\n tabIndex={0}\n className=\"fixed inset-0 z-10\"\n onClick={() => setActiveNoteIndex(null)}\n onKeyDown={e => e.key === 'Escape' && setActiveNoteIndex(null)}\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "AA6CM,cAAAA,EAYA,QAAAC,MAZA,oBA7CN,MAAO,aACP,MAAO,kBACP,MAAO,wBAEP,OAAS,aAAAC,EAAW,WAAAC,MAAe,wBACnC,OAAS,YAAAC,MAAgB,QACzB,OAAS,QAAAC,EAAM,cAAAC,MAAkB,iBACjC,OAAS,UAAAC,EAAQ,eAAAC,MAAmB,eAEpC,OAAOC,MAA2C,gBAClD,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,WAAAC,EAAS,cAAcC,MAAU,gBAOnC,MAAMC,EAAkB,CAAC,CAAE,KAAAC,CAAK,IAAqC,CAC1E,KAAM,CAACC,EAAiBC,CAAkB,EAAIZ,EAAwB,IAAI,EACpE,CAAE,QAAAa,EAAS,IAAAC,CAAI,EAAIR,EAAkB,EACrCS,EAAc,CAAC,CAAE,KAAAC,EAAM,MAAAC,CAAM,IAAgD,CACjFV,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBM,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EAAI,UAChB,SAAUJ,EA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,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Container", "Heading", "useState", "Grid", "Pagination", "Swiper", "SwiperSlide", "BenefitItem", "useCreditsContext", "gaTrack", "cn", "CreditsBenefits", "copy", "activeNoteIndex", "setActiveNoteIndex", "profile", "gtm", "handleClick", "item", "index", "className", "e"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i,jsxs as R}from"react/jsx-runtime";import{Container as f,Heading as C}from"@anker-in/headless-ui";import{useMemo as g,useState as h}from"react";import x from"./RedeemableItem";import y from"../context/hooks/useRedeemableList";import b from"../modal/rulesModal";import{useProductsByHandles as v}from"@anker-in/lib";import{classNames as N}from"@anker-in/lib";import{useCreditsContext as I}from"../context/provider";const O=({copy:s})=>{const[n,m]=h(),{redeemableList:d}=y(),{pageCommon:c}=I(),p=[],{data:o}=v({handles:s?.list?.map(e=>e.products?.[0]?.handle)||[],metafieldIdentifiers:{variant:p}}),u=g(()=>o?.map(e=>{const r=s.list.find(a=>a.products?.[0]?.handle===e.handle),t=d.find(a=>a.id?.toString()===r?.redeemId?.toString()),l=e.variants?.find(a=>a.sku===r?.products?.[0]?.sku)||e.variants?.[0];return!t||!l?null:{product:e,productVariant:l,alpcData:{id:t?.id,consumeCredits:t?.consume_credits,remainingInventory:t?.remaining_inventory,isLimited:t?.is_limited,consumeType:t?.consume_type,title:t?.name,desc:t?.note},config:r}}).filter(Boolean),[o,s.list,d]);return R(f,{className:N("bg-[#F5F5F5]"),children:[i(C,{as:"h2",size:"4",html:s.title}),i("div",{className:"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3",children:u?.map((e,r)=>i(x,{copy:s,itemData:e,setRules:m,currencyCode:o?.[0]?.price.currencyCode||"USD"},r))}),n&&i(b,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:n.length>0,onClose:()=>m([]),titleClassName:"border-b-transparent h-[56px]",rules:n,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:c?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};export{O as CreditsCash};
|
|
2
2
|
//# sourceMappingURL=CreditsCash.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsCash/CreditsCash.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Container, Heading } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport RedeemableItem from './RedeemableItem'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport RulesModal from '../modal/rulesModal'\nimport { useProductsByHandles
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Container", "Heading", "useMemo", "useState", "RedeemableItem", "useRedeemableList", "RulesModal", "useProductsByHandles", "
|
|
4
|
+
"sourcesContent": ["import { Container, Heading } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport RedeemableItem from './RedeemableItem'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport RulesModal from '../modal/rulesModal'\nimport { useProductsByHandles } from '@anker-in/lib'\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { Product, classNames as cn } from '@anker-in/lib'\nimport { useCreditsContext } from '../context/provider'\n\nexport const CreditsCash = ({ copy }: { copy: CreditsCashCopy }) => {\n const [rules, setRules] = useState<string | string[]>()\n const { redeemableList } = useRedeemableList()\n const { pageCommon } = useCreditsContext()\n\n const variantMetafieldIdentifiers: any[] = []\n\n const { data: productByHandles } = useProductsByHandles({\n handles: copy?.list?.map(item => item.products?.[0]?.handle) || [],\n metafieldIdentifiers: {\n variant: variantMetafieldIdentifiers,\n },\n })\n\n const list = useMemo(() => {\n return productByHandles\n ?.map((product: Product) => {\n const config = copy.list.find(item => item.products?.[0]?.handle === product.handle)\n const alpcData = redeemableList.find(item => item.id?.toString() === config?.redeemId?.toString())\n const productVariant =\n product.variants?.find((variant: any) => variant.sku === config?.products?.[0]?.sku) || product.variants?.[0]\n if (!alpcData || !productVariant) return null\n return {\n product,\n productVariant,\n alpcData: {\n id: alpcData?.id,\n consumeCredits: alpcData?.consume_credits,\n remainingInventory: alpcData?.remaining_inventory,\n isLimited: alpcData?.is_limited,\n consumeType: alpcData?.consume_type,\n title: alpcData?.name,\n desc: alpcData?.note,\n },\n config,\n }\n })\n .filter(Boolean) as unknown as RedeemItem[]\n }, [productByHandles, copy.list, redeemableList])\n\n return (\n <Container className={cn('bg-[#F5F5F5]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div className=\"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3\">\n {list?.map((item, index: number) => (\n <RedeemableItem\n key={index}\n copy={copy}\n itemData={item}\n setRules={setRules}\n currencyCode={productByHandles?.[0]?.price.currencyCode || 'USD'}\n />\n ))}\n </div>\n\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className=\"md:h-fit md:rounded-b-[16px]\"\n isOpen={rules.length > 0}\n onClose={() => setRules([])}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] md:mb-[24px] md:pt-0\"\n title={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAoDI,OACE,OAAAA,EADF,QAAAC,MAAA,oBApDJ,OAAS,aAAAC,EAAW,WAAAC,MAAe,wBACnC,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAOC,MAAoB,mBAC3B,OAAOC,MAAuB,qCAC9B,OAAOC,MAAgB,sBACvB,OAAS,wBAAAC,MAA4B,gBAErC,OAAkB,cAAcC,MAAU,gBAC1C,OAAS,qBAAAC,MAAyB,sBAE3B,MAAMC,EAAc,CAAC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,SAAUO,EACV,SAAUL,EACV,aAAcI,IAAmB,CAAC,GAAG,MAAM,cAAgB,OAJtDQ,CAKP,CACD,EACH,EAECb,GACCd,EAACQ,EAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQM,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOG,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Container", "Heading", "useMemo", "useState", "RedeemableItem", "useRedeemableList", "RulesModal", "useProductsByHandles", "cn", "useCreditsContext", "CreditsCash", "copy", "rules", "setRules", "redeemableList", "pageCommon", "variantMetafieldIdentifiers", "productByHandles", "item", "list", "product", "config", "alpcData", "productVariant", "variant", "index"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t,jsxs as n}from"react/jsx-runtime";import{Button as z,Text as u,Picture as b}from"@anker-in/headless-ui";import{useMemo as p,useState as I}from"react";import{useCreditsContext as k}from"../context/provider";import{useRedeemAndBuy as F}from"../context/hooks/useRedeemAndBuy";import{numberFormat as E}from"../context/utils";import{gaTrack as h,classNames as d}from"@anker-in/lib";import{useRegistration as V}from"../../../components/registration";function A({copy:i,itemData:e,setRules:C,className:N}){const{creditInfo:x,profile:l,openSignUpPopup:_,pageCommon:o,gtm:{pageGroup:m}}=k(),{authCodeActivate:f}=V(),[v,g]=I(null),{trigger:w,isMutating:y}=F({},{onError:a=>{g(a.message)}}),r=p(()=>!!l,[l?.activated]),s=p(()=>r&&l?.activated&&e.alpcData?.consumeCredits>Number(x?.available_credit||0),[r,l?.activated,e.alpcData?.consumeCredits,x?.available_credit]),R=p(()=>!!(e.alpcData?.remainingInventory<=0&&e.alpcData?.isLimited||!e.productVariant?.availableForSale||s),[e.alpcData?.remainingInventory,e.alpcData?.isLimited,e.productVariant?.availableForSale,s]),S=()=>{g(null),r?!l?.activated&&!f.isActivateSuccess?f.open():(w({productVariant:e?.productVariant,redeemId:e?.config?.redeemId}),h({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:m,position:i.title,button_name:c,info:e?.alpcData?.id?.toString()}})):_()},c=p(()=>e.productVariant?.availableForSale?r?i.btnRedeem:i.unlockRewards:i?.soldOut||"Sold Out",[r,e.productVariant?.availableForSale,i.btnRedeem,i.unlockRewards,i?.soldOut]);return n("div",{className:d("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",N),children:[t("div",{className:d("relative mx-auto h-[224px] w-fit l:h-[120px] l-xxl:h-[138px]"),children:t(b,{className:"mx-auto h-full w-auto",imgClassName:"h-full object-contain",source:e?.config?.image?.url||e?.productVariant?.metafields?.global?.transparentImg||e?.productVariant?.image?.url})}),n("div",{className:d("mt-[22px] w-full l:mt-[8px]"),children:[t(u,{html:e?.product?.title,title:e.config?.title||e.alpcData?.title||e.product?.title,size:2,className:"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]"}),e?.config?.rules?.split("<br>")?.length>0&&t("button",{type:"button",onClick:()=>{C(e?.config?.rules?.split("<br>")),h({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:m,position:i.title,button_name:o?.ruleLabel,info:e?.alpcData?.id?.toString()}})},className:"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&a.preventDefault()},children:o?.ruleLabel}),n("div",{className:"mt-[24px] flex items-center l:mt-[12px] laptop:text-[16px] lg-desktop:text-[18px]",children:[t(b,{className:"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),t(u,{html:`${E(e?.alpcData?.consumeCredits)} + ${e?.config?.price}`,size:2,as:"p",className:"ml-[4px] mt-[4px] text-[28px] font-bold leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),n("div",{className:"group relative w-full",children:[t(z,{disabled:R,variant:"primary",size:"lg",className:"mt-[8px] md:px-[10px] l:w-full",loading:y,onClick:()=>{S()},title:s?o.insufficientCredits:c,children:c}),t("div",{className:d("absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]",s?"block":"hidden"),children:n("div",{className:"relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]",children:[t(u,{as:"p",size:"2",html:o?.insufficientCredits,className:"text-[14px]"}),t("div",{className:"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]"})]})})]})]}),v&&t("div",{className:"mt-[8px] text-[14px] text-[#FF0000]",children:v})]})}var j=A;export{j as default};
|
|
2
2
|
//# sourceMappingURL=RedeemableItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsCash/RedeemableItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemAndBuy } from '../context/hooks/useRedeemAndBuy'\nimport { numberFormat } from '../context/utils'\nimport { gaTrack, classNames as cn } from '@anker-in/lib'\nimport { useRegistration } from '../../../components/registration'\n\nfunction RedeemableItem({\n copy,\n itemData,\n setRules,\n className,\n}: {\n copy: CreditsCashCopy\n itemData: RedeemItem\n className?: string\n setRules: (rules: string[]) => void\n currencyCode: string\n}) {\n const {\n creditInfo,\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const [error, setError] = useState<string | null>(null)\n const { trigger, isMutating } = useRedeemAndBuy(\n {},\n {\n onError: error => {\n setError(error.message)\n },\n }\n )\n\n const isLogin = useMemo(() => {\n return !!profile\n }, [profile?.activated])\n\n const inSufficientCredit = useMemo(() => {\n return (\n isLogin && profile?.activated && itemData.alpcData?.consumeCredits > Number(creditInfo?.available_credit || 0)\n )\n }, [isLogin, profile?.activated, itemData.alpcData?.consumeCredits, creditInfo?.available_credit])\n\n const isDisabled = useMemo(() => {\n // \u5151\u6362\u9650\u5236\n if (itemData.alpcData?.remainingInventory <= 0 && itemData.alpcData?.isLimited) {\n return true\n }\n\n // \u5546\u54C1\u5E93\u5B58\u9650\u5236\n if (!itemData.productVariant?.availableForSale) {\n return true\n }\n\n // \u79EF\u5206\u4E0D\u8DB3\n if (inSufficientCredit) {\n return true\n }\n return false\n }, [\n itemData.alpcData?.remainingInventory,\n itemData.alpcData?.isLimited,\n itemData.productVariant?.availableForSale,\n inSufficientCredit,\n ])\n\n const handleRedeem = () => {\n setError(null)\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.open()\n } else {\n trigger({\n productVariant: itemData?.productVariant,\n redeemId: itemData?.config?.redeemId,\n })\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }\n }\n\n const redeemButtonText = useMemo(() => {\n // \u7F3A\u8D27\u6587\u6848\n if (!itemData.productVariant?.availableForSale) {\n return copy?.soldOut || 'Sold Out'\n } else if (!isLogin) {\n return copy.unlockRewards\n } else {\n return copy.btnRedeem\n }\n }, [isLogin, itemData.productVariant?.availableForSale, copy.btnRedeem, copy.unlockRewards, copy?.soldOut])\n\n return (\n <div\n className={cn(\n 'flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]',\n className\n )}\n >\n <div className={cn('relative mx-auto h-[224px] w-fit l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"mx-auto h-full w-auto\"\n imgClassName=\"h-full object-contain\"\n source={\n itemData?.config?.image?.url ||\n itemData?.productVariant?.metafields?.global?.transparentImg ||\n itemData?.productVariant?.image?.url\n }\n ></Picture>\n </div>\n <div className={cn('mt-[22px] w-full l:mt-[8px]')}>\n <Text\n html={itemData?.product?.title}\n title={itemData.config?.title || itemData.alpcData?.title || itemData.product?.title}\n size={2}\n className=\"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]\"\n />\n {itemData?.config?.rules?.split('<br>')?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n setRules(itemData?.config?.rules?.split('<br>'))\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name:
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "useState", "useCreditsContext", "useRedeemAndBuy", "numberFormat", "gaTrack", "cn", "useRegistration", "RedeemableItem", "copy", "itemData", "setRules", "className", "creditInfo", "profile", "openSignUpPopup", "pageGroup", "authCodeActivate", "error", "setError", "trigger", "isMutating", "isLogin", "inSufficientCredit", "isDisabled", "handleRedeem", "redeemButtonText", "e", "RedeemableItem_default"]
|
|
4
|
+
"sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemAndBuy } from '../context/hooks/useRedeemAndBuy'\nimport { numberFormat } from '../context/utils'\nimport { gaTrack, classNames as cn } from '@anker-in/lib'\nimport { useRegistration } from '../../../components/registration'\n\nfunction RedeemableItem({\n copy,\n itemData,\n setRules,\n className,\n}: {\n copy: CreditsCashCopy\n itemData: RedeemItem\n className?: string\n setRules: (rules: string[]) => void\n currencyCode: string\n}) {\n const {\n creditInfo,\n profile,\n openSignUpPopup,\n pageCommon,\n gtm: { pageGroup },\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const [error, setError] = useState<string | null>(null)\n const { trigger, isMutating } = useRedeemAndBuy(\n {},\n {\n onError: error => {\n setError(error.message)\n },\n }\n )\n\n const isLogin = useMemo(() => {\n return !!profile\n }, [profile?.activated])\n\n const inSufficientCredit = useMemo(() => {\n return (\n isLogin && profile?.activated && itemData.alpcData?.consumeCredits > Number(creditInfo?.available_credit || 0)\n )\n }, [isLogin, profile?.activated, itemData.alpcData?.consumeCredits, creditInfo?.available_credit])\n\n const isDisabled = useMemo(() => {\n // \u5151\u6362\u9650\u5236\n if (itemData.alpcData?.remainingInventory <= 0 && itemData.alpcData?.isLimited) {\n return true\n }\n\n // \u5546\u54C1\u5E93\u5B58\u9650\u5236\n if (!itemData.productVariant?.availableForSale) {\n return true\n }\n\n // \u79EF\u5206\u4E0D\u8DB3\n if (inSufficientCredit) {\n return true\n }\n return false\n }, [\n itemData.alpcData?.remainingInventory,\n itemData.alpcData?.isLimited,\n itemData.productVariant?.availableForSale,\n inSufficientCredit,\n ])\n\n const handleRedeem = () => {\n setError(null)\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.open()\n } else {\n trigger({\n productVariant: itemData?.productVariant,\n redeemId: itemData?.config?.redeemId,\n })\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }\n }\n\n const redeemButtonText = useMemo(() => {\n // \u7F3A\u8D27\u6587\u6848\n if (!itemData.productVariant?.availableForSale) {\n return copy?.soldOut || 'Sold Out'\n } else if (!isLogin) {\n return copy.unlockRewards\n } else {\n return copy.btnRedeem\n }\n }, [isLogin, itemData.productVariant?.availableForSale, copy.btnRedeem, copy.unlockRewards, copy?.soldOut])\n\n return (\n <div\n className={cn(\n 'flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]',\n className\n )}\n >\n <div className={cn('relative mx-auto h-[224px] w-fit l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"mx-auto h-full w-auto\"\n imgClassName=\"h-full object-contain\"\n source={\n itemData?.config?.image?.url ||\n itemData?.productVariant?.metafields?.global?.transparentImg ||\n itemData?.productVariant?.image?.url\n }\n ></Picture>\n </div>\n <div className={cn('mt-[22px] w-full l:mt-[8px]')}>\n <Text\n html={itemData?.product?.title}\n title={itemData.config?.title || itemData.alpcData?.title || itemData.product?.title}\n size={2}\n className=\"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]\"\n />\n {itemData?.config?.rules?.split('<br>')?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n setRules(itemData?.config?.rules?.split('<br>'))\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: pageCommon?.ruleLabel,\n info: itemData?.alpcData?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] text-[16px] font-bold underline xxl:text-[14px]\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {pageCommon?.ruleLabel}\n </button>\n )}\n <div className=\"mt-[24px] flex items-center l:mt-[12px] laptop:text-[16px] lg-desktop:text-[18px]\">\n <Picture\n className=\"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783\"\n />\n <Text\n html={`${numberFormat(itemData?.alpcData?.consumeCredits)} + ${itemData?.config?.price}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] mt-[4px] text-[28px] font-bold leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] \"\n />\n </div>\n\n <div className=\"group relative w-full\">\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[10px] l:w-full\"\n loading={isMutating}\n onClick={() => {\n handleRedeem()\n }}\n title={inSufficientCredit ? pageCommon.insufficientCredits : redeemButtonText}\n >\n {redeemButtonText}\n </Button>\n <div\n className={cn(\n 'absolute -bottom-[20px] left-0 z-10 w-[300px] translate-y-full opacity-0 transition-opacity group-hover:opacity-100 md:-bottom-[14px] md:w-[160px]',\n inSufficientCredit ? 'block' : 'hidden'\n )}\n >\n <div className=\"relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow md:px-[10px] md:py-[8px]\">\n <Text as=\"p\" size=\"2\" html={pageCommon?.insufficientCredits} className=\"text-[14px]\" />\n <div className=\"absolute -top-[10px] left-[48px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]\" />\n </div>\n </div>\n </div>\n </div>\n {error && <div className=\"mt-[8px] text-[14px] text-[#FF0000]\">{error}</div>}\n </div>\n )\n}\n\nexport default RedeemableItem\n"],
|
|
5
|
+
"mappings": "AAqHQ,cAAAA,EA6CA,QAAAC,MA7CA,oBArHR,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBACtC,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAGlC,OAAS,qBAAAC,MAAyB,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EFpB,EAAC,OAAI,UAAU,oFACb,UAAAD,EAACI,EAAA,CACC,UAAU,gEACV,OAAO,6FACT,EACAJ,EAACG,EAAA,CACC,KAAM,GAAGM,EAAaM,GAAU,UAAU,cAAc,CAAC,MAAMA,GAAU,QAAQ,KAAK,GACtF,KAAM,EACN,GAAG,IACH,UAAU,0GACZ,GACF,EAEAd,EAAC,OAAI,UAAU,wBACb,UAAAD,EAACE,EAAA,CACC,SAAU4B,EACV,QAAQ,UACR,KAAK,KACL,UAAU,iCACV,QAASH,EACT,QAAS,IAAM,CACbI,EAAa,CACf,EACA,MAAOF,EAAqBR,EAAW,oBAAsBW,EAE5D,SAAAA,EACH,EACAhC,EAAC,OACC,UAAWW,EACT,qJACAkB,EAAqB,QAAU,QACjC,EAEA,SAAA5B,EAAC,OAAI,UAAU,mHACb,UAAAD,EAACG,EAAA,CAAK,GAAG,IAAI,KAAK,IAAI,KAAMkB,GAAY,oBAAqB,UAAU,cAAc,EACrFrB,EAAC,OAAI,UAAU,mHAAmH,GACpI,EACF,GACF,GACF,EACCwB,GAASxB,EAAC,OAAI,UAAU,sCAAuC,SAAAwB,EAAM,GACxE,CAEJ,CAEA,IAAOU,EAAQrB",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "useState", "useCreditsContext", "useRedeemAndBuy", "numberFormat", "gaTrack", "cn", "useRegistration", "RedeemableItem", "copy", "itemData", "setRules", "className", "creditInfo", "profile", "openSignUpPopup", "pageCommon", "pageGroup", "authCodeActivate", "error", "setError", "trigger", "isMutating", "isLogin", "inSufficientCredit", "isDisabled", "handleRedeem", "redeemButtonText", "e", "RedeemableItem_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as F}from"react/jsx-runtime";import{Container as c,Heading as b,Tabs as x,TabsList as p,TabsTrigger as T,Text as h}from"@anker-in/headless-ui";import{classNames as q,useHeadlessContext as v,ROUNDED_BRANDS as C}from"@anker-in/lib";import{useMemo as o,useState as N}from"react";import{FaqItem as w}from"./faqItem/FaqItem";const L=({copy:a})=>{const{title:m,items:r,subTitle:i=""}=a||{},{brand:g}=v(),u=C.includes(g),s=o(()=>Array.from(new Set(r?.map?.(e=>e.category_name).filter(e=>!!e))),[r]),[l,f]=N(s[0]?.toString()||""),d=o(()=>r?s.length?r.filter(e=>e?.category_name===l):r:[],[r,s.length,l]);return F(c,{className:"bg-[#F5F5F7]",id:"faq",children:[m&&t(b,{as:"h2",size:"4",html:a?.title}),i&&t("div",{className:"mt-[8px] flex flex-row",children:t(h,{size:"4",as:"p",html:i,className:"flex-1"})}),t(x,{align:"left",shape:u?"rounded":"square",className:"mt-[24px]",value:l.toString(),onValueChange:e=>{f(e)},children:t(p,{children:s.map((e,n)=>t(T,{value:e?.toString()||"",children:e},n))})}),t("div",{className:q("mt-[24px] flex flex-col overflow-auto pt-0"),children:d?.map((e,n)=>t(w,{index:n,defaultExpended:r.length===1,question:e.question,answer:e.answer,showDots:!1},n))}),a.learnMore?.link&&a.learnMore?.label&&t("a",{href:a.learnMore?.link,target:"_blank",className:"mt-[24px] block w-full text-center text-[18px] font-bold text-brand hover:underline l:text-[16px]",children:a.learnMore?.label})]})};export{L as CreditsFaq};
|
|
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 } from '@anker-in/lib'\nimport { useMemo, useState } from 'react'\n\nimport { FaqItem } from './faqItem/FaqItem'\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "Text", "cn", "useHeadlessContext", "
|
|
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": "AAqCI,OACY,OAAAA,EADZ,QAAAC,MAAA,oBArCJ,OAAS,aAAAC,EAAW,WAAAC,EAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,EAAa,QAAAC,MAAY,wBACtE,OAAS,cAAcC,EAAI,sBAAAC,EAAoB,kBAAAC,MAAsB,gBACrE,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAS,WAAAC,MAAe,oBAejB,MAAMC,EAAa,CAAC,CAAE,KAAAC,CAAK,IAAgC,CAChE,KAAM,CAAE,MAAAC,EAAO,MAAOC,EAAS,SAAAC,EAAW,EAAG,EAAIH,GAAQ,CAAC,EACpD,CAAE,MAAAI,CAAM,EAAIV,EAAmB,EAC/BW,EAAUV,EAAe,SAASS,CAAK,EACvCE,EAAeV,EAAQ,IACpB,MAAM,KAAK,IAAI,IAAIM,GAAS,MAAMK,GAAOA,EAAI,aAAa,EAAE,OAAOC,GAAQ,CAAC,CAACA,CAAI,CAAC,CAAC,EACzF,CAACN,CAAO,CAAC,EACN,CAACO,EAAWC,CAAY,EAAIb,EAAiBS,EAAa,CAAC,GAAG,SAAS,GAAK,EAAE,EAE9EK,EAAcf,EAAQ,IACrBM,EACDI,EAAa,OACRJ,EAAQ,OAAOM,GAAQA,GAAM,gBAAkBC,CAAS,EAE1DP,EAJc,CAAC,EAKrB,CAACA,EAASI,EAAa,OAAQG,CAAS,CAAC,EAE5C,OACEvB,EAACC,EAAA,CAAU,UAAU,eAAe,GAAG,MACpC,UAAAc,GAAShB,EAACG,EAAA,CAAQ,GAAG,KAAK,KAAK,IAAI,KAAMY,GAAM,MAAO,EACtDG,GACClB,EAAC,OAAI,UAAU,yBACb,SAAAA,EAACO,EAAA,CAAK,KAAK,IAAI,GAAG,IAAI,KAAMW,EAAU,UAAU,SAAS,EAC3D,EAGFlB,EAACI,EAAA,CACC,MAAM,OACN,MAAOgB,EAAU,UAAY,SAC7B,UAAU,YACV,MAAOI,EAAU,SAAS,EAC1B,cAAeG,GAAS,CACtBF,EAAaE,CAAK,CACpB,EAEA,SAAA3B,EAACK,EAAA,CACE,SAAAgB,EAAa,IAAI,CAACE,EAAMK,IACvB5B,EAACM,EAAA,CAAwB,MAAOiB,GAAM,SAAS,GAAK,GACjD,SAAAA,GADeK,CAElB,CACD,EACH,EACF,EACA5B,EAAC,OAAI,UAAWQ,EAAG,4CAA4C,EAC5D,SAAAkB,GAAa,IAAI,CAACH,EAAMK,IAErB5B,EAACa,EAAA,CAEC,MAAOe,EACP,gBAAiBX,EAAQ,SAAW,EACpC,SAAUM,EAAK,SACf,OAAQA,EAAK,OACb,SAAU,IALLK,CAMN,CAEJ,EACH,EACCb,EAAK,WAAW,MAAQA,EAAK,WAAW,OACvCf,EAAC,KACC,KAAMe,EAAK,WAAW,KACtB,OAAO,SACP,UAAU,oGAET,SAAAA,EAAK,WAAW,MACnB,GAEJ,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "Text", "cn", "useHeadlessContext", "ROUNDED_BRANDS", "useMemo", "useState", "FaqItem", "CreditsFaq", "copy", "title", "faqList", "subTitle", "brand", "rounded", "categoryList", "faq", "item", "activeTab", "setActiveTab", "currentList", "value", "index"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Button as
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Button as C,Container as w,Text as x}from"@anker-in/headless-ui";import{useCallback as y,useState as p}from"react";import{useCreditsContext as k}from"../context/provider";import{numberFormat as v}from"../context/utils";import h from"../modal/activitiesModal";import M from"../modal/MyRewardsModal";import{gaNormalClick as D,classNames as t,useHeadlessContext as z,ROUNDED_BRANDS as B}from"@anker-in/lib";function F({copy:l}){const[b,m]=p(!1),[u,c]=p(!1),[d,o]=p(!1),{creditInfo:n,pageCommon:s}=k(),{brand:g}=z(),r=B.includes(g),N=y(a=>{if(D({position:"info_card",label:a.text}),a.type)switch(a.type){case"activities":m(!0);break;case"rewards":c(!0);break}},[]);return i(w,{asChild:!0,id:"infoCard",className:"-mb-[86px] -translate-y-[86px] x:-mb-[30px] x:-translate-y-[30px]",children:[i("div",{className:t("mx-auto flex justify-between items-center rounded-[12px] border border-white px-[24px] py-[40px]","l:flex-col l:items-start","min-l:px-[48px]","min-xl:px-[100px]",!r&&"rounded-none"),style:{background:"linear-gradient(119.61deg, rgba(250, 250, 250, 0.6) 38.58%, rgba(255, 255, 255, 0.6) 63.73%, rgba(249, 252, 255, 0.6) 89.37%)",backdropFilter:"blur(8px)"},children:[i("div",{className:t("grid grid-cols-2 gap-[24px] font-bold l:w-full md:grid-cols-1 md:flex-col md:gap-[16px] min-md:items-center"),children:[i("div",{className:"mr-[80px] md:mr-[0] md:flex-1 md-xl:mr-[64px]",children:[e("div",{className:t("mb-[24px] text-[14px] font-bold l:mb-[6px] xl:text-[16px] min-md:text-[18px] l-xl:mb-[16px]"),children:l.balanceLabel}),i("div",{className:"flex items-baseline",children:[e("div",{className:t("mr-[8px] text-[36px] font-extrabold","min-md:text-[44px]","min-xl:text-[56px]"),children:n?v(n.available_credit):0}),e("div",{className:"text-[16px]",children:s?.pointUnit})]})]}),i("div",{className:"w-fit md:flex-1",children:[i("div",{className:t("mb-[24px] flex text-[18px] l:mb-[6px] l:text-[14px] l-xl:mb-[16px]"),children:[e(x,{className:"text-[14px] font-bold xl:text-[16px] min-md:text-[18px]",html:l.comingSoonLabel}),l.comingSoonTips&&i("div",{className:"group relative ml-[4px] flex cursor-pointer items-start",children:[e(x,{as:"div",html:s?.infoIcon,className:"size-[18px] cursor-pointer [&_svg]:size-full",onClick:()=>{d?o(!1):(o(!0),setTimeout(()=>{o(!1)},5e3))}}),e("div",{className:t("absolute -bottom-[12px] -left-[32px] z-10 w-[356px] translate-y-full md:w-[276px]",d?"block":"hidden"),children:i("div",{className:t("relative rounded-[10px] bg-[#6D6D6F] p-[16px] text-[14px] font-medium text-white shadow",!r&&"rounded-none"),children:[e(x,{size:"2",html:l.comingSoonTips,className:"desktop:text-[18px]"}),e("div",{className:t("absolute -top-[10px] left-[40px] mb-2 size-[16px] origin-top-left rotate-45 transform rounded-[2px] bg-[#6D6D6F]",!r&&"rounded-none")})]})})]})]}),i("div",{className:"flex items-baseline ",children:[e("div",{className:t("mr-[8px] text-[36px] font-extrabold","min-l:text-[44px]","min-xl:text-[56px]"),children:n?v(n.pending_credit):0}),e("div",{className:"text-[16px]",children:s?.pointUnit})]})]})]}),e("div",{className:t("grid w-fit md:w-full l:mt-[32px] l:gap-[12px] min-l:gap-[16px] min-l:pl-[48px] md-l:grid-cols-2"),children:l.buttons?.map((a,f)=>e(C,{variant:f===0?"secondary":"primary",size:"lg",className:"min-w-[156px] laptop:min-w-[189px]",onClick:()=>{N(a)},children:a.text},f))}),s?.activitiesModal&&e(h,{isOpen:b,data:s?.activitiesModal,onClose:()=>{m(!1)}}),s?.rewardsModal&&e(M,{isOpen:u,data:s?.rewardsModal,onClose:()=>{c(!1)}})]}),d&&e("div",{role:"button",tabIndex:0,className:"fixed inset-0 z-10",onClick:()=>o(!1),onKeyDown:a=>a.key==="Escape"&&o(!1)})]})}export{F as CreditsInfoCard};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|