@anker-in/campaign-ui 0.2.10-beta.28 → 0.2.10-beta.30
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/const.d.ts +2 -1
- package/dist/cjs/components/credits/context/const.js +1 -1
- package/dist/cjs/components/credits/context/const.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/CardValue.d.ts +6 -0
- package/dist/cjs/components/credits/creditsRedeemList/CardValue.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/CardValue.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.d.ts +6 -0
- package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/index.js.map +2 -2
- package/dist/esm/components/credits/context/const.d.ts +2 -1
- package/dist/esm/components/credits/context/const.js +1 -1
- package/dist/esm/components/credits/context/const.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/CardValue.d.ts +6 -0
- package/dist/esm/components/credits/creditsRedeemList/CardValue.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/CardValue.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/NonProductValue.d.ts +6 -0
- package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
- 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/creditsRedeemList/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/index.js.map +2 -2
- package/package.json +1 -1
- package/src/components/credits/context/const.ts +1 -0
- package/src/components/credits/context/hooks/useRedeemableList.ts +0 -14
- package/src/components/credits/creditsRedeemList/NonProductValue.tsx +38 -0
- package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +4 -6
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +2 -10
- package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +23 -0
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +10 -23
- package/src/components/credits/creditsRedeemList/index.tsx +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h=(i=>(i[i.All=0]="All",i[i.Earned=1]="Earned",i[i.Deducted=2]="Deducted",i[i.Expired=3]="Expired",i))(h||{}),u=(f=>(f.Coupon="coupon",f.GiftCard="giftCard",f.GoGift="goGift",f.Product="product",f.ShippingCoupon="shippingCoupon",f))(u||{}),L=(o=>(o[o.Coupon=1]="Coupon",o[o.Product=2]="Product",o))(L||{}),U=(x=>(x[x.Program=1]="Program",x[x.Operation=2]="Operation",x[x.Redeem=3]="Redeem",x))(U||{}),m=(x=>(x.FirstPurchase="firstPurchase",x.UploadReceipt="uploadReceipt",x.Shopping="shopping",x))(m||{}),P=(t=>(t[t.Activation=1]="Activation",t[t.UpdateName=2]="UpdateName",t[t.UpdatePhone=3]="UpdatePhone",t[t.UpdateBirthday=4]="UpdateBirthday",t[t.Subscription=5]="Subscription",t[t.UpadteAppName=7]="UpadteAppName",t[t.Refund=3e3]="Refund",t[t.ProductUnApproved=5e3]="ProductUnApproved",t))(P||{}),c=(o=>(o.FixedMount="fixed_amount",o.Percent="percent",o))(c||{}),F=(g=>(g[g.Received=0]="Received",g[g.Pending=1]="Pending",g[g.ApproveSuccess=2]="ApproveSuccess",g[g.ApproveFail=3]="ApproveFail",g[g.Unfulfilled=4]="Unfulfilled",g[g.Fulfilled=5]="Fulfilled",g[g.Failed=6]="Failed",g))(F||{}),d=(n=>(n[n.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",n[n.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",n[n.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",n[n.CodeLpcUnknownError=180004]="CodeLpcUnknownError",n[n.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",n[n.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",n[n.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",n[n.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",n[n.CodeCrossSiteError=180011]="CodeCrossSiteError",n))(d||{});const M=new Map([["eu-en","eu"],["eu-de","de"]]);var N=(i=>(i[i.Pending=0]="Pending",i[i.Success=1]="Success",i[i.Failed=2]="Failed",i[i.DoubleConfirm=3]="DoubleConfirm",i))(N||{});const G={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};export{M as ALPC_COUNTRY_MAP,L as AlpcConsumeType,d as AlpcErrorCode,N as ApprovalStatus,u as ConsumeType,c as CouponType,h as CreditType,m as DTC_TASK_TYPE,G as PRICE_SYMBOL,F as RewardType,P as TaskSubType,U as TaskType};
|
|
2
2
|
//# sourceMappingURL=const.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/const.ts"],
|
|
4
|
-
"sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
|
|
5
|
-
"mappings": "AAAO,IAAKA,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAC,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,
|
|
4
|
+
"sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
|
|
5
|
+
"mappings": "AAAO,IAAKA,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAC,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAC,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,UAFUA,OAAA,IAKAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAHUA,OAAA,IAMAC,OACVA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAHDA,OAAA,IAMAC,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,WAAa,GAAb,aACAA,IAAA,YAAc,GAAd,cACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,aAAe,GAAf,eACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,OAAS,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAC,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAC,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAPUA,OAAA,IAUAC,OACVA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,0BAA4B,QAA5B,4BAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,wBAA0B,QAA1B,0BAEAA,IAAA,mBAAqB,QAArB,qBAEAA,IAAA,8BAAgC,QAAhC,gCAEAA,IAAA,oCAAsC,QAAtC,sCAEAA,IAAA,mBAAqB,QAArB,qBAjBUA,OAAA,IAoBL,MAAMC,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMC,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN",
|
|
6
6
|
"names": ["CreditType", "ConsumeType", "AlpcConsumeType", "TaskType", "DTC_TASK_TYPE", "TaskSubType", "CouponType", "RewardType", "AlpcErrorCode", "ALPC_COUNTRY_MAP", "ApprovalStatus", "PRICE_SYMBOL"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as C,useEffect as L,useState as R}from"react";import{useAlpcMutation as b}from"./useAlpcFetch";import{ALPC_COUNTRY_MAP as x}from"../const";import{useCreditsContext as y}from"../provider";import{useHeadlessContext as S}from"@anker-in/lib";function A(){let t="";const{profile:n,isLoadingProfile:c}=y(),{locale:u,brand:d}=S();u==="pl"?t="eu":t=u;const[p,_]=R([]),{isMutating:f,trigger:l}=b({url:"/v1/credit/consume_credit_rules",initData:{brand:d,page:1,page_size:20,country:(x.get(t)||t)?.toUpperCase(),task_target:1}}),s=C(()=>{l({user_id:n?.user_id},{onSuccess(g){let a=g.data.consume_credit_rules||[],o=a.filter(e=>e.consume_type==1)||[],r=a.filter(e=>e.consume_type==2)||[];o=o.sort((e,i)=>e.consume_credits-i.consume_credits),r=r.sort((e,i)=>e.consume_credits-i.consume_credits);const m=o.concat(r);_(m),localStorage?.setItem(`consume_credit_rules-${t}`,JSON.stringify({expire:Date.now()+10*60*1e3,consume_credit_rules:m}))}})},[n,l,t]);return L(()=>{c||s()},[s,c]),{listLoading:f,redeemableList:p,getRedeemableList:s}}var O=A;export{O as default};
|
|
2
2
|
//# sourceMappingURL=useRedeemableList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemableList.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList() {\n let locale = '' as string\n const { profile, isLoadingProfile } = useCreditsContext()\n const { locale: contextLocale, brand } = useHeadlessContext()\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 20,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n task_target: 1, // 1: 'app', 2: 'website'\n },\n })\n\n const getRedeemableList = useCallback(() => {\n
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAwB,WACjC,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,GAAoB,CAC3B,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,CAAiB,EAAIL,EAAkB,EAClD,CAAE,OAAQM,EAAe,MAAAC,CAAM,EAAIN,EAAmB,EAExDK,IAAkB,KACpBH,EAAS,KAETA,EAASG,EAGX,KAAM,CAACE,EAAgBC,CAAiB,EAAIZ,EAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYa,EAAa,QAAAC,CAAQ,EAAIb,EAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAS,EACA,KAAM,EACN,UAAW,GACX,SAAUR,EAAiB,IAAII,CAAM,GAAKA,IAAS,YAAY,EAC/D,YAAa,CACf,CACF,CAAC,EAEKS,EAAoBjB,EAAY,IAAM,
|
|
6
|
-
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "locale", "profile", "isLoadingProfile", "contextLocale", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList() {\n let locale = '' as string\n const { profile, isLoadingProfile } = useCreditsContext()\n const { locale: contextLocale, brand } = useHeadlessContext()\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 20,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n task_target: 1, // 1: 'app', 2: 'website'\n },\n })\n\n const getRedeemableList = useCallback(() => {\n trigger(\n {\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n let list = responseData.data.consume_credit_rules || []\n let cList = list.filter(i => i.consume_type == 1) || []\n let pList = list.filter(i => i.consume_type == 2) || []\n cList = cList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n pList = pList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n const resultList = cList.concat(pList)\n setRedeemableList(resultList)\n\n localStorage?.setItem(\n `consume_credit_rules-${locale}`,\n JSON.stringify({\n expire: Date.now() + 10 * 60 * 1000,\n consume_credit_rules: resultList,\n })\n )\n },\n }\n )\n }, [profile, trigger, locale])\n\n useEffect(() => {\n if (!isLoadingProfile) {\n getRedeemableList()\n }\n }, [getRedeemableList, isLoadingProfile])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAwB,WACj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EAAmBP,CAAgB,CAAC,EAEjC,CACL,YAAAK,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOS,EAAQnB",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "locale", "profile", "isLoadingProfile", "contextLocale", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "cList", "i", "pList", "prev", "next", "resultList", "useRedeemableList_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as i}from"react/jsx-runtime";import{Text as l,Picture as a}from"@anker-in/headless-ui";import{classNames as m}from"@anker-in/lib";import{ConsumeType as x}from"../context/const";const u=({item:e,copy:o})=>{switch(e.config?.type){case x.Product:return t("div",{className:m("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(a,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})});default:break}return e.config?.type===x.ShippingCoupon?t(l,{className:"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[18px] md-l:text-[14px]",html:e.config?.value}):i("div",{className:"flex items-end",children:[t(l,{className:"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]",html:e.config?.value}),t(l,{className:"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]",html:e.config?.type===x.GiftCard?o?.giftCardLabel:o?.off})]})};export{u as CardValue};
|
|
2
|
+
//# sourceMappingURL=CardValue.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsRedeemList/CardValue.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Text, Picture } from '@anker-in/headless-ui'\nimport { classNames } from '@anker-in/lib'\nimport { RedeemableItem } from '../type'\nimport { ConsumeType } from '../context/const'\nimport { CreditsRedeemListCopy } from './type'\n\nexport const CardValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n switch (item.config?.type) {\n case ConsumeType.Product:\n return (\n <div className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product.images?.[0]?.url}\n ></Picture>\n </div>\n )\n break\n\n default:\n break\n }\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return (\n <Text\n className=\"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[18px] md-l:text-[14px]\"\n html={item.config?.value}\n />\n )\n } else {\n return (\n <div className=\"flex items-end\">\n <Text\n className=\"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]\"\n html={item.config?.value}\n />\n <Text\n className=\"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]\"\n html={item.config?.type === ConsumeType.GiftCard ? copy?.giftCardLabel : copy?.off}\n />\n </div>\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "AAWU,cAAAA,EAoBJ,QAAAC,MApBI,oBAXV,OAAS,QAAAC,EAAM,WAAAC,MAAe,wBAC9B,OAAS,cAAAC,MAAkB,gBAE3B,OAAS,eAAAC,MAAmB,mBAGrB,MAAMC,EAAY,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAA6D,CAClG,OAAQD,EAAK,QAAQ,KAAM,CACzB,KAAKF,EAAY,QACf,OACEL,EAAC,OAAI,UAAWI,EAAW,2EAA2E,EACpG,SAAAJ,EAACG,EAAA,CACC,UAAU,sDACV,OAAQI,EAAK,QAAQ,OAAO,KAAOA,EAAK,QAAQ,SAAS,CAAC,GAAG,IAC9D,EACH,EAIJ,QACE,KACJ,CACA,OAAIA,EAAK,QAAQ,OAASF,EAAY,eAElCL,EAACE,EAAA,CACC,UAAU,uFACV,KAAMK,EAAK,QAAQ,MACrB,EAIAN,EAAC,OAAI,UAAU,iBACb,UAAAD,EAACE,EAAA,CACC,UAAU,4FACV,KAAMK,EAAK,QAAQ,MACrB,EACAP,EAACE,EAAA,CACC,UAAU,2GACV,KAAMK,EAAK,QAAQ,OAASF,EAAY,SAAWG,GAAM,cAAgBA,GAAM,IACjF,GACF,CAGN",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "Picture", "classNames", "ConsumeType", "CardValue", "item", "copy"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as p}from"react/jsx-runtime";import{Text as l}from"@anker-in/headless-ui";import{ConsumeType as o}from"../context/const";const s=({item:t,copy:x})=>t.config?.type===o.ShippingCoupon?e("div",{className:"absolute left-[16px] l-xxl:left-[12px] bottom-[8px] l:left-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]",children:e(l,{className:"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[20px] w-[70%] md:w-full md-l:text-[14px]",html:t.config?.value,as:"p"})}):e("div",{className:"absolute left-[16px] l-xxl:left-[12px] l:left-[8px] bottom-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]",children:t.config?.value?p("div",{className:"flex items-end",children:[e(l,{className:"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]",html:t.config?.value.toString()}),e(l,{className:"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]",html:t.config?.type===o.GiftCard?x?.giftCardLabel:x?.off})]}):e(l,{className:"text-[24px] w-[70%] font-bold leading-none",html:t.config?.title,as:"p"})});export{s as NoneProductValue};
|
|
2
|
+
//# sourceMappingURL=NonProductValue.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsRedeemList/NonProductValue.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { RedeemableItem } from '../type'\nimport { ConsumeType } from '../context/const'\nimport { CreditsRedeemListCopy } from './type'\n\nexport const NoneProductValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n // shipping coupon \u4EC5\u5C55\u793A\u6587\u6848\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return (\n <div className=\"absolute left-[16px] l-xxl:left-[12px] bottom-[8px] l:left-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]\">\n <Text\n className=\"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[20px] w-[70%] md:w-full md-l:text-[14px]\"\n html={item.config?.value}\n as=\"p\"\n />\n </div>\n )\n } else {\n return (\n <div className=\"absolute left-[16px] l-xxl:left-[12px] l:left-[8px] bottom-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]\">\n {item.config?.value ? (\n <div className=\"flex items-end\">\n <Text\n className=\"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]\"\n html={item.config?.value.toString()}\n />\n <Text\n className=\"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]\"\n html={item.config?.type === ConsumeType.GiftCard ? copy?.giftCardLabel : copy?.off}\n />\n </div>\n ) : (\n <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.title} as=\"p\" />\n )}\n </div>\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "AAUQ,cAAAA,EAWE,QAAAC,MAXF,oBAVR,OAAS,QAAAC,MAAY,wBAErB,OAAS,eAAAC,MAAmB,mBAGrB,MAAMC,EAAmB,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAExCD,EAAK,QAAQ,OAASF,EAAY,eAElCH,EAAC,OAAI,UAAU,2HACb,SAAAA,EAACE,EAAA,CACC,UAAU,yGACV,KAAMG,EAAK,QAAQ,MACnB,GAAG,IACL,EACF,EAIAL,EAAC,OAAI,UAAU,2HACZ,SAAAK,EAAK,QAAQ,MACZJ,EAAC,OAAI,UAAU,iBACb,UAAAD,EAACE,EAAA,CACC,UAAU,4FACV,KAAMG,EAAK,QAAQ,MAAM,SAAS,EACpC,EACAL,EAACE,EAAA,CACC,UAAU,2GACV,KAAMG,EAAK,QAAQ,OAASF,EAAY,SAAWG,GAAM,cAAgBA,GAAM,IACjF,GACF,EAEAN,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMG,EAAK,QAAQ,MAAO,GAAG,IAAI,EAElG",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "ConsumeType", "NoneProductValue", "item", "copy"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as E,jsx as
|
|
1
|
+
import{Fragment as E,jsx as o,jsxs as l}from"react/jsx-runtime";import{Button as M,Picture as y,Text as i}from"@anker-in/headless-ui";import x from"classnames";import{useCallback as k,useEffect as I,useState as u}from"react";import L from"../context/hooks/useCopy";import{useCreditsContext as _}from"../context/provider";import{useRedeemCoupon as B}from"../context/hooks/useRedeemCoupon";import{AlpcErrorCode as p}from"../context/const";import{CreditsModalContainer as S}from"../modal/modalContainer";import{numberFormat as P}from"../context/utils";import{useHeadlessContext as z}from"@anker-in/lib";import{NoneProductValue as O}from"./RedeemProductModal/NonProductValue";function U({item:d,copy:e,onError:f,...m}){const{locale:w}=z(),[a,F]=u(),[g,s]=u(),[C,n]=u(!1),{copy:R,copied:b}=L(),{profile:c,fetchCreditInfo:v}=_(),{isMutating:N,trigger:h}=B({onSuccess(t){if(!t){s(e.redeemModal.commonError);return}if(t?.data?.success)F(t.data.coupon_code),v(c?.user_id);else{let r;t.code===p.CodeLpcShopifyCouponRuleRedeemLimit?(r=e.redeemModal.redeemLimitError,n(!0)):t.code===p.CodeLpcRuleInventoryNotEnough?(r=e.redeemModal.inventoryNotEnough,n(!0)):t.code===p.CodeLpcNotEnoughCredits?(r=e.redeemModal.creditsNotEnough,n(!0),v(c?.user_id)):t.code===p.CodeCrossSiteError&&(r=e.redeemModal.crossSiteError,n(!0)),s(r||e.redeemModal.commonError||""),f&&f(t.code)}},onError(t){s(t.message||e.redeemModal.commonError)}}),T=k(async()=>{s(""),h({user_id:c?.user_id,rule_id:Number(d.alpc?.id)})},[d,c,h]);return I(()=>{m.isOpen||(n(!1),s(""))},[m.isOpen]),l(S,{...m,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-0 md:mb-[24px] px-0",titleClassName:"h-[56px] bg-[#F5F5F7]",children:[l("div",{className:x("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[l("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[e?.imageMapping[d.config?.type]?.url&&o(y,{source:e.imageMapping[d.config.type].url,className:"h-full [&_img]:h-full"}),o("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:d.config.value?o(O,{item:d,copy:e}):o(i,{size:3,html:d.alpc?.title})})]}),a?l("div",{className:"mt-[30px] flex items-center justify-center md:mt-[18px]",children:[o("div",{className:"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]",children:a}),o("div",{className:x("cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]",b?"pointer-events-none":"pointer-events-auto"),onClick:()=>{R(a)},role:"button",tabIndex:0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&t.preventDefault()},children:b?e?.copied:e?.copy})]}):l(i,{as:"p",className:x("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[P(d.alpc?.consumeCredits)," ",e?.pointUnit]}),!a&&d.config?.rules?.length>0&&l("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[l("div",{className:"mb-[4px]",children:[e?.ruleLabel,":"]}),o("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:d.config?.rules?.map((t,r)=>o("li",{className:"list-disc",children:o(i,{html:t})},r))})]})]}),l("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[a&&!N?l(E,{children:[l("div",{className:"flex flex-col",children:[o(i,{className:"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]",html:e.redeemModal.coupon.successTitle}),o(i,{className:"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]",html:e.redeemModal.coupon.successDesc})]}),o(M,{variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:()=>{window.location.href=e.redeemModal.coupon.successButtonUrl||`/${w}`,m.onClose&&m.onClose()},disabled:C,children:e.redeemModal.coupon.successButton})]}):l(E,{children:[o(i,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:e.redeemModal.confirmTitle}),o(M,{loading:N,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:T,disabled:C,children:e.redeemModal.confirmButton})]}),g&&o("div",{className:"mx-auto max-w-full py-[12px] text-center",children:o(i,{className:"text-[14px] font-semibold text-[#1F2021]",html:g})})]})]})}var Y=U;export{Y as default};
|
|
2
2
|
//# sourceMappingURL=RedeemCouponModal.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/modalContainer'\nimport useCopy from '../context/hooks/useCopy'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/modalContainer'\nimport { numberFormat } from '../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsRedeemListCopy } from './type'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: number) => void\n}) {\n const { locale } = useHeadlessContext()\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied: copiedStatus } = useCopy()\n\n const { profile, fetchCreditInfo } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.redeemModal.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.redeemModal.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.redeemModal.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo('')\n }\n }, [props.isOpen])\n\n return (\n <CreditsModalContainer\n {...props}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {copy?.imageMapping?.
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCallback", "useEffect", "useState", "useCopy", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "numberFormat", "useHeadlessContext", "RedeemCouponModal", "item", "copy", "onError", "props", "locale", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copiedStatus", "profile", "fetchCreditInfo", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "e", "text", "index", "RedeemCouponModal_default"]
|
|
4
|
+
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/modalContainer'\nimport useCopy from '../context/hooks/useCopy'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/modalContainer'\nimport { numberFormat } from '../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsRedeemListCopy } from './type'\nimport { NoneProductValue } from './RedeemProductModal/NonProductValue'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: number) => void\n}) {\n const { locale } = useHeadlessContext()\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied: copiedStatus } = useCopy()\n\n const { profile, fetchCreditInfo } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.redeemModal.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.redeemModal.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.redeemModal.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo('')\n }\n }, [props.isOpen])\n\n return (\n <CreditsModalContainer\n {...props}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {copy?.imageMapping[item.config?.type]?.url && (\n <Picture source={copy.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} copy={copy} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n {couponCode ? (\n <div className=\"mt-[30px] flex items-center justify-center md:mt-[18px]\">\n <div className=\"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]\">{couponCode}</div>\n <div\n className={classNames(\n 'cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]',\n copiedStatus ? 'pointer-events-none' : 'pointer-events-auto'\n )}\n onClick={() => {\n copyText(couponCode)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copiedStatus ? copy?.copied : copy?.copy}\n </div>\n </div>\n ) : (\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {copy?.pointUnit}\n </Text>\n )}\n {!couponCode && item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{copy?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n {couponCode && !loading ? (\n <>\n <div className=\"flex flex-col\">\n <Text\n className=\"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]\"\n html={copy.redeemModal.coupon.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.redeemModal.coupon.successDesc}\n ></Text>\n </div>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n window.location.href = copy.redeemModal.coupon.successButtonUrl || `/${locale}`\n if (props.onClose) {\n props.onClose()\n }\n }}\n disabled={disabled}\n >\n {copy.redeemModal.coupon.successButton}\n </Button>\n </>\n ) : (\n <>\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={handleConfirm}\n disabled={disabled}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </>\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full py-[12px] text-center\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </div>\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemCouponModal\n"],
|
|
5
|
+
"mappings": "AAiGQ,OA2DE,YAAAA,EAzDE,OAAAC,EAFJ,QAAAC,MAAA,oBAjGR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAOC,MAAa,2BACpB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,sBAAAC,MAA0B,gB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I,UAAU,kGACb,UAAAA,EAAC,OAAI,UAAU,WAAY,UAAAkB,GAAM,UAAU,KAAC,EAC5CnB,EAAC,MAAG,UAAU,oCACX,SAAAkB,EAAK,QAAQ,OAAO,IAAI,CAACsB,EAAMC,IAC9BzC,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,KAAMoC,EAAM,GADWC,CAE/B,CACD,EACH,GACF,GAEJ,EACAxC,EAAC,OAAI,UAAU,wDACZ,UAAAsB,GAAc,CAACU,EACdhC,EAAAF,EAAA,CACE,UAAAE,EAAC,OAAI,UAAU,gBACb,UAAAD,EAACI,EAAA,CACC,UAAU,8DACV,KAAMe,EAAK,YAAY,OAAO,aAC/B,EACDnB,EAACI,EAAA,CACC,UAAU,oEACV,KAAMe,EAAK,YAAY,OAAO,YAC/B,GACH,EACAnB,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAAS,IAAM,CACb,OAAO,SAAS,KAAOiB,EAAK,YAAY,OAAO,kBAAoB,IAAIG,CAAM,GACzED,EAAM,SACRA,EAAM,QAAQ,CAElB,EACA,SAAUM,EAET,SAAAR,EAAK,YAAY,OAAO,cAC3B,GACF,EAEAlB,EAAAF,EAAA,CACE,UAAAC,EAACI,EAAA,CACC,UAAU,4EACV,KAAMe,EAAK,YAAY,aACxB,EACDnB,EAACE,EAAA,CACC,QAAS+B,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASK,EACT,SAAUX,EAET,SAAAR,EAAK,YAAY,cACpB,GACF,EAEDM,GACCzB,EAAC,OAAI,UAAU,2CACb,SAAAA,EAACI,EAAA,CAAK,UAAU,2CAA2C,KAAMqB,EAAW,EAC9E,GAEJ,GACF,CAEJ,CAEA,IAAOiB,EAAQzB",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCallback", "useEffect", "useState", "useCopy", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "numberFormat", "useHeadlessContext", "NoneProductValue", "RedeemCouponModal", "item", "copy", "onError", "props", "locale", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copiedStatus", "profile", "fetchCreditInfo", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "e", "text", "index", "RedeemCouponModal_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as N,jsx as e,jsxs as d}from"react/jsx-runtime";import{Button as c,Picture as a,Text as i}from"@anker-in/headless-ui";import m from"classnames";import{Fragment as u,useMemo as f}from"react";import{numberFormat as g}from"../../context/utils";import{ConsumeType as v}from"../../context/const";import{NoneProductValue as b}from"./NonProductValue";const I=({copy:l,item:t,loading:r,disabled:x,setStatus:n})=>{const p=f(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...l.redeemModal.product.rules||[]],[t.config.rules,t.config.desc,l.redeemModal.product.rules]);return d("div",{className:"flex flex-col",children:[e("div",{className:m("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:d(N,{children:[d("div",{className:"relative mx-auto h-[164px] w-fit",children:[e(a,{source:t.config?.type===v.Product?t.product.images[0]?.url:l?.imageMapping[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&e(b,{item:t,copy:l})})]}),d("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&e("div",{className:m("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),d(i,{as:"p",className:m(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[g(t.alpc?.consumeCredits)," ",l?.pointUnit]})]}),d("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[e("div",{className:"text-[16px] font-bold leading-[1.4]",children:l.redeemModal.product.stepTitle}),e("div",{className:"mt-[4px] flex items-center justify-center",children:l.redeemModal.product.steps?.map((s,o)=>d(u,{children:[d("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[e(a,{source:s.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),e("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:s.title})]}),o!==l.redeemModal.product.steps.length-1&&e(a,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},o))}),e("div",{className:"overflow-auto",children:p?.length&&e("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:p.map((s,o)=>e("li",{className:"list-disc",children:e(i,{as:"div",html:s,className:"font-bold"})},o))})})]})]})}),d("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[e(i,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:l.redeemModal.confirmTitle}),e(c,{loading:r,disabled:x,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{n("address")},children:l.redeemModal.confirmButton})]})]})};export{I as Init};
|
|
2
2
|
//# sourceMappingURL=Init.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\n\ntype InitProps = {\n copy: CreditsRedeemListCopy\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.redeemModal.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.redeemModal.product.rules])\n\n
|
|
5
|
-
"mappings": "AAiCQ,mBAAAA,EAEI,OAAAC,
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useMemo", "numberFormat", "ConsumeType", "Init", "copy", "item", "loading", "disabled", "setStatus", "rules", "index", "text"]
|
|
4
|
+
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\nimport { NoneProductValue } from './NonProductValue'\n\ntype InitProps = {\n copy: CreditsRedeemListCopy\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.redeemModal.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.redeemModal.product.rules])\n\n return (\n <div className=\"flex flex-col\">\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <>\n <div className=\"relative mx-auto h-[164px] w-fit\">\n <Picture\n source={\n item.config?.type === ConsumeType.Product\n ? item.product.images[0]?.url\n : copy?.imageMapping[item.config.type]?.url || item.config.image?.url\n }\n className=\"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n {/* \u793C\u54C1\u5361\u5C55\u793A */}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value && <NoneProductValue item={item} copy={copy} />}\n </div>\n </div>\n <div className=\"mt-[30px] md:mt-[18px]\">\n {item.config.type === 'product' && (\n <div\n className={classNames(\n 'mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {item.config.title}\n </div>\n )}\n <Text\n as=\"p\"\n className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}\n >\n {numberFormat(item.alpc?.consumeCredits)} {copy?.pointUnit}\n </Text>\n </div>\n <div className=\"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{copy.redeemModal.product.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.redeemModal.product.steps?.map((item, index) => (\n <Fragment key={index}>\n <div className=\"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]\">\n <Picture source={item.imageUrl} className=\"mb-[4px] h-[58px] w-[58px]\"></Picture>\n <div className=\"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]\">\n {item.title}\n </div>\n </div>\n {index !== copy.redeemModal.product.steps.length - 1 && (\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150\"\n className=\"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]\"\n ></Picture>\n )}\n </Fragment>\n ))}\n </div>\n <div className=\"overflow-auto\">\n {rules?.length && (\n <ul className=\"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]\">\n {rules.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text as=\"div\" html={text} className=\"font-bold\" />\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n </>\n </div>\n <div className=\"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]\">\n <Text\n as=\"p\"\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n disabled={disabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full md:mt-[12px]\"\n onClick={() => {\n setStatus('address')\n }}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAiCQ,mBAAAA,EAEI,OAAAC,EADF,QAAAC,MADF,oBAjCR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,YAAAN,EAAU,WAAAO,MAAe,QAClC,OAAS,gBAAAC,MAAoB,sBAG7B,OAAS,eAAAC,MAAmB,sBAC5B,OAAS,oBAAAC,MAAwB,oBAU1B,MAAMC,EAAO,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,EAAU,UAAAC,CAAU,IAAiB,CAC/E,MAAMC,EAAQV,EAAQ,IAChBM,EAAK,OAAO,OAAO,OACdA,EAAK,OAAO,MAGd,CAAC,GADaA,EAAK,OAAO,MAAM,MAAM,MAAM,GAAK,CAAC,EAChC,GAAID,EAAK,YAAY,QAAQ,OAAS,CAAC,CAAE,EACjE,CAACC,EAAK,OAAO,MAAOA,EAAK,OAAO,KAAMD,EAAK,YAAY,QAAQ,KAAK,CAAC,EAExE,OACEV,EAAC,OAAI,UAAU,gBACb,UAAAD,EAAC,O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MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,GAAG,MAAM,KAAMc,EAAM,UAAU,YAAY,GADpBD,CAE/B,CACD,EACH,EAEJ,GACF,GACF,EACF,EACAhB,EAAC,OAAI,UAAU,+DACb,UAAAD,EAACI,EAAA,CACC,GAAG,IACH,UAAU,4EACV,KAAMO,EAAK,YAAY,aACxB,EACDX,EAACE,EAAA,CACC,QAASW,EACT,SAAUC,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbC,EAAU,SAAS,CACrB,EAEC,SAAAJ,EAAK,YAAY,cACpB,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useMemo", "numberFormat", "ConsumeType", "NoneProductValue", "Init", "copy", "item", "loading", "disabled", "setStatus", "rules", "index", "text"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as a}from"react/jsx-runtime";import{Text as o}from"@anker-in/headless-ui";import{ConsumeType as l}from"../../context/const";const r=({item:e,copy:n})=>e.config?.type===l.ShippingCoupon?t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.value,as:"p"}):e.config?.value?a("div",{className:"flex items-end gap-[4px]",children:[t(o,{className:"text-[64px] font-extrabold leading-none",html:e.config.value.toString()}),t(o,{className:"text-[24px] font-bold leading-[2]",html:e.config.type===l.Coupon?n?.off:n?.giftCardLabel})]}):t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.title,as:"p"});export{r as NoneProductValue};
|
|
2
|
+
//# sourceMappingURL=NonProductValue.js.map
|
package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { RedeemableItem } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\n\nexport const NoneProductValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n // shipping coupon \u4EC5\u5C55\u793A\u6587\u6848\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.value} as=\"p\" />\n } else {\n return item.config?.value ? (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-extrabold leading-none\" html={item.config.value.toString()} />\n <Text\n className=\"text-[24px] font-bold leading-[2]\"\n html={item.config.type === ConsumeType.Coupon ? copy?.off : copy?.giftCardLabel}\n />\n </div>\n ) : (\n <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.title} as=\"p\" />\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "AAQW,cAAAA,EAGL,QAAAC,MAHK,oBARX,OAAS,QAAAC,MAAY,wBAGrB,OAAS,eAAAC,MAAmB,sBAErB,MAAMC,EAAmB,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAExCD,EAAK,QAAQ,OAASF,EAAY,eAC7BH,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMG,EAAK,QAAQ,MAAO,GAAG,IAAI,EAE9FA,EAAK,QAAQ,MAClBJ,EAAC,OAAI,UAAU,2BACb,UAAAD,EAACE,EAAA,CAAK,UAAU,0CAA0C,KAAMG,EAAK,OAAO,MAAM,SAAS,EAAG,EAC9FL,EAACE,EAAA,CACC,UAAU,oCACV,KAAMG,EAAK,OAAO,OAASF,EAAY,OAASG,GAAM,IAAMA,GAAM,cACpE,GACF,EAEAN,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMG,EAAK,QAAQ,MAAO,GAAG,IAAI",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "ConsumeType", "NoneProductValue", "item", "copy"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as i}from"react/jsx-runtime";import{Button as y,Text as c,Picture as o}from"@anker-in/headless-ui";import{useMemo as d}from"react";import p from"classnames";import{useCreditsContext as h}from"../context/provider";import{AlpcConsumeType as x,ConsumeType as N}from"../context/const";import{numberFormat as C}from"../context/utils";import{gaTrack as f}from"../../../helpers/track";import{NoneProductValue as R}from"./NonProductValue";function F({copy:t,className:v,item:e,onRulesOpen:g,onRedeem:b}){const{creditInfo:s,profile:l,gtm:{pageGroup:m}}=h(),n=Object.keys(l||{}).length>0,_=d(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===x.Product&&!e.variant?.availableForSale||n&&l?.activated&&e.alpc?.consumeCredits>Number(s?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,n,l?.activated,s?.available_credit,e.variant?.availableForSale]),u=d(()=>n?e.alpc?.consumeType===x.Product?e.variant?.availableForSale?t.btnRedeem:t?.soldOut||"Sold Out":t.btnRedeem:t.unlockRewards,[n,e.alpc?.consumeType,e.variant?.availableForSale,t.btnRedeem,t.unlockRewards,t?.soldOut]);return i("div",{className:p("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",v),children:[e.config?.type===N.Product?a("div",{className:p("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:a(o,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})}):i("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[a(o,{source:t?.imageMapping[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),a(R,{item:e,copy:t})]}),i("div",{className:p("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[a(c,{html:e.config?.title||e.alpc?.title,title:e.config?.title||e.alpc?.title,size:2,className:"text-[24px] font-bold leading-[1.2] l:text-[16px] l-xxl:text-[20px]"}),e.config?.rules?.length>0&&a("button",{type:"button",onClick:()=>{g(e.config?.rules||[]),f({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:m,position:t.title,button_name:t?.ruleLabel,info:e.alpc?.id?.toString()}})},className:"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&r.preventDefault()},children:t?.ruleLabel}),i("div",{children:[i("div",{className:"mt-[24px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[a(o,{className:"size-[20px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),a(c,{html:`${C(e.alpc?.consumeCredits)}`,size:2,as:"p",className:"ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),a(y,{disabled:_,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{b(e),f({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:m,position:t.title,button_name:u,info:e.alpc?.id?.toString()}})},children:u})]})]})]})}export{F as RedeemableItem};
|
|
2
2
|
//# sourceMappingURL=RedeemableItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemableItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\n\nimport { useMemo } from 'react'\n\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { AlpcConsumeType, ConsumeType } from '../context/const'\nimport { numberFormat } from '../context/utils'\nimport type { CreditsRedeemListCopy } from './type'\nimport { gaTrack } from '../../../helpers/track'\n\nexport function RedeemableItem({\n copy,\n className,\n item,\n onRulesOpen,\n onRedeem,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n item: RedeemableItemType\n onRulesOpen: (rules: string[]) => void\n onRedeem: (item: RedeemableItemType) => void\n}) {\n const {\n creditInfo,\n profile,\n gtm: { pageGroup },\n } = useCreditsContext()\n const isLogin = Object.keys(profile || {}).length > 0\n\n const isDisabled = useMemo(() => {\n if (item.alpc?.remainingInventory <= 0 && item.alpc?.isLimited) {\n // \u6709\u5E93\u5B58\u9650\u5236\n return true\n }\n\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n if (!item.variant?.availableForSale) {\n return true\n }\n }\n if (isLogin && profile?.activated && item.alpc?.consumeCredits > Number(creditInfo?.available_credit || 0)) {\n return true\n }\n return false\n }, [\n item.alpc?.remainingInventory,\n item.alpc?.isLimited,\n item.alpc?.consumeType,\n item.alpc?.consumeCredits,\n isLogin,\n profile?.activated,\n creditInfo?.available_credit,\n item.variant?.availableForSale,\n ])\n\n const redeemButtonText = useMemo(() => {\n if (!isLogin) {\n return copy.unlockRewards\n }\n\n // \u7F3A\u8D27\u6587\u6848\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n return item.variant?.availableForSale ? copy.btnRedeem : copy?.soldOut || 'Sold Out'\n }\n return copy.btnRedeem\n }, [\n isLogin,\n item.alpc?.consumeType,\n item.variant?.availableForSale,\n copy.btnRedeem,\n copy.unlockRewards,\n copy?.soldOut,\n ])\n\n return (\n <div\n className={classNames(\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 {item.config?.type
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "gaTrack", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "isLogin", "isDisabled", "redeemButtonText", "e"]
|
|
4
|
+
"sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\n\nimport { useMemo } from 'react'\n\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { AlpcConsumeType, ConsumeType } from '../context/const'\nimport { numberFormat } from '../context/utils'\nimport type { CreditsRedeemListCopy } from './type'\nimport { gaTrack } from '../../../helpers/track'\nimport { NoneProductValue } from './NonProductValue'\n\nexport function RedeemableItem({\n copy,\n className,\n item,\n onRulesOpen,\n onRedeem,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n item: RedeemableItemType\n onRulesOpen: (rules: string[]) => void\n onRedeem: (item: RedeemableItemType) => void\n}) {\n const {\n creditInfo,\n profile,\n gtm: { pageGroup },\n } = useCreditsContext()\n const isLogin = Object.keys(profile || {}).length > 0\n\n const isDisabled = useMemo(() => {\n if (item.alpc?.remainingInventory <= 0 && item.alpc?.isLimited) {\n // \u6709\u5E93\u5B58\u9650\u5236\n return true\n }\n\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n if (!item.variant?.availableForSale) {\n return true\n }\n }\n if (isLogin && profile?.activated && item.alpc?.consumeCredits > Number(creditInfo?.available_credit || 0)) {\n return true\n }\n return false\n }, [\n item.alpc?.remainingInventory,\n item.alpc?.isLimited,\n item.alpc?.consumeType,\n item.alpc?.consumeCredits,\n isLogin,\n profile?.activated,\n creditInfo?.available_credit,\n item.variant?.availableForSale,\n ])\n\n const redeemButtonText = useMemo(() => {\n if (!isLogin) {\n return copy.unlockRewards\n }\n\n // \u7F3A\u8D27\u6587\u6848\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n return item.variant?.availableForSale ? copy.btnRedeem : copy?.soldOut || 'Sold Out'\n }\n return copy.btnRedeem\n }, [\n isLogin,\n item.alpc?.consumeType,\n item.variant?.availableForSale,\n copy.btnRedeem,\n copy.unlockRewards,\n copy?.soldOut,\n ])\n\n return (\n <div\n className={classNames(\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 {item.config?.type === ConsumeType.Product ? (\n <div className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product.images?.[0]?.url}\n ></Picture>\n </div>\n ) : (\n <div className=\"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]\">\n <Picture\n source={copy?.imageMapping[item.config?.type]?.url}\n className=\"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n\n <NoneProductValue item={item} copy={copy} />\n </div>\n )}\n <div className={classNames('mt-[22px] flex w-full flex-1 flex-col justify-between')}>\n <Text\n html={item.config?.title || item.alpc?.title}\n title={item.config?.title || item.alpc?.title}\n size={2}\n className=\"text-[24px] font-bold leading-[1.2] l:text-[16px] l-xxl:text-[20px]\"\n />\n {item.config?.rules?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n onRulesOpen(item.config?.rules || [])\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: copy?.ruleLabel,\n info: item.alpc?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copy?.ruleLabel}\n </button>\n )}\n <div>\n <div className=\"mt-[24px] flex items-center l:mt-[12px] l-xl:mt-[16px]\">\n <Picture\n className=\"size-[20px]\"\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(item.alpc?.consumeCredits)}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] \"\n />\n </div>\n\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[8px] l:w-full\"\n onClick={() => {\n onRedeem(item)\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: item.alpc?.id?.toString(),\n },\n })\n }}\n >\n {redeemButtonText}\n </Button>\n </div>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAuFU,cAAAA,EAMF,QAAAC,MANE,oBAvFV,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBAEtC,OAAS,WAAAC,MAAe,QAExB,OAAOC,MAAgB,aACvB,OAAS,qBAAAC,MAAyB,sBAElC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,mBAC7C,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,WAAAC,MAAe,yBACxB,OAAS,oBAAAC,MAAwB,oBAE1B,SAASC,EAAe,CAC7B,KAAAC,EACA,UAAAC,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,CACF,EAMG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,CACnB,EAAId,EAAkB,EAChBe,EAAU,OAAO,KAAKF,GAAW,CAAC,CAAC,EAAE,OAAS,EAE9CG,EAAalB,EAAQ,IACrB,GAAAW,EAAK,MAAM,oBAAsB,GAAKA,EAA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EAAYD,EAAK,QAAQ,OAAS,CAAC,CAAC,EACpCL,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBS,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaA,GAAM,UACnB,KAAME,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EACA,UAAU,uEACV,SAAU,EACV,UAAWS,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAAX,GAAM,UACT,EAEFb,EAAC,OACC,UAAAA,EAAC,OAAI,UAAU,yDACb,UAAAD,EAACI,EAAA,CACC,UAAU,cACV,OAAO,6FACT,EACAJ,EAACG,EAAA,CACC,KAAM,GAAGO,EAAaM,EAAK,MAAM,cAAc,CAAC,GAChD,KAAM,EACN,GAAG,IACH,UAAU,kGACZ,GACF,EAEAhB,EAACE,EAAA,CACC,SAAUqB,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbL,EAASF,CAAI,EACbL,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBS,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaU,EACb,KAAMR,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EAEC,SAAAQ,EACH,GACF,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "gaTrack", "NoneProductValue", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "isLogin", "isDisabled", "redeemButtonText", "e"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as X}from"react/jsx-runtime";import{Container as F,Heading as z,Tabs as D,TabsList as H,TabsTrigger as j}from"@anker-in/headless-ui";import c from"classnames";import{useCallback as w,useMemo as L,useState as g}from"react";import B from"./RedeemCouponModal";import G from"./RedeemProductModal";import{useCreditsContext as U}from"../context/provider";import V from"../context/hooks/useRedeemableList";import{AlpcConsumeType as f,AlpcErrorCode as q}from"../context/const";import{useProductsByHandles as J}from"@anker-in/lib";import{RedeemableItem as K}from"./RedeemableItem";import Q from"../modal/rulesModal";import{gaTrack as W}from"../../../helpers/track";function pe({copy:t,className:N="",tabClassName:k="",hideTitle:x=!1,cardClassName:_,activate:d}){const{profile:b,openSignUpPopup:I,gtm:{pageGroup:P}}=U(),S=Object.keys(b||{}).length>0,[m,E]=g(t.list[0].label),[n,l]=g(void 0),[p,C]=g(),{listLoading:O,redeemableList:v,getRedeemableList:R}=V(),r=L(()=>v.map(e=>({id:e.id.toString(),title:e.name,consumeCredits:e.consume_credits,remainingInventory:e.remaining_inventory,isLimited:!!e.is_limited,consumeType:e.consume_type,handle:e.sku_handle,sku:e.goods_sku,image:e.goods_url})),[t.list,m,v]),A=r.map(e=>e.handle),{data:T}=J({handles:A}),M=L(()=>t.list.find(s=>s.label===m)?.list.filter(s=>r.some(i=>i.id===s.id)).map(s=>{const i=r.find(a=>a.id===s.id),u=T?.find(a=>a.handle===i?.handle),y=u?.variants.find(a=>a.sku===i?.sku);return i?.consumeType===f.Product&&(!u||!y)?null:{alpc:r.find(a=>a.id===s.id),config:s,product:u,variant:y}}).filter(s=>s!==null),[r,T]),h=w(e=>{e===q.CodeLpcRuleInventoryNotEnough&&R()},[R]);return X(F,{className:c("relative bg-[#F5F5F7]",N),children:[!x&&o(z,{as:"h2",size:"4",html:t.title}),o(D,{shape:"rounded",align:"left",className:c("sticky top-0 z-20 py-[24px] md:justify-center",k),value:m.toString(),onValueChange:e=>{E(e),W({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:e,page_group:P}})},children:o(H,{children:t.list.map(e=>o(j,{value:e.label,children:e.label},e.label))})}),!!r?.length&&!O&&o("div",{className:c("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:M?.map(e=>o(K,{copy:t,item:e,onRedeem:s=>{S?!b?.activated&&!d.isSuccess?(d.openAuthCodePopup(),d.setOnSuccess(()=>{l(s)})):l(s):I()},onRulesOpen:C,className:_},e?.alpc?.id))}),n?.alpc?.consumeType===f.Coupon&&t?.redeemModal?.coupon&&n&&o(B,{isOpen:!!n,item:n,copy:t,onError:h,onClose:()=>{l(void 0)}}),n?.alpc?.consumeType===f.Product&&t?.redeemModal&&n&&o(G,{isOpen:!!n,item:n,copy:t,onError:h,onClose:()=>{l(void 0)}}),p&&o(Q,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:p.length>0,onClose:()=>C([]),titleClassName:"border-b-transparent h-[56px]",rules:p,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:t?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})}export{pe as CreditsRedeemList};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsRedeemList/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport RedeemCouponModal from './RedeemCouponModal'\nimport RedeemProductModal from './RedeemProductModal'\nimport { useCreditsContext } from '../context/provider'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { AlpcConsumeType, AlpcErrorCode } from '../context/const'\nimport { useProductsByHandles } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { RedeemableItem } from './RedeemableItem'\nimport RulesModal from '../modal/rulesModal'\nimport { CreditsRedeemListCopy } from './type'\nimport { gaTrack } from '../../../helpers/track'\n\nexport function CreditsRedeemList({\n copy,\n className = '',\n tabClassName = '',\n hideTitle = false,\n cardClassName,\n activate,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n tabClassName?: string\n hideTitle?: boolean\n cardClassName?: string\n activate: {\n openAuthCodePopup: () => void\n isSuccess: boolean\n setOnSuccess: (callback: Function) => void\n }\n}) {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n } = useCreditsContext()\n const isLogin = Object.keys(profile || {}).length > 0\n\n const [activeTab, setActiveTab] = useState<string>(copy.list[0].label)\n\n const [popRedeemData, setPopRedeemData] = useState<RedeemableItemType | undefined>(undefined)\n\n const [rules, setRules] = useState<string | string[]>()\n\n const { listLoading, redeemableList, getRedeemableList } = useRedeemableList()\n\n const alpcList = useMemo(() => {\n return redeemableList.map(item => {\n return {\n id: item.id.toString(),\n title: item.name,\n consumeCredits: item.consume_credits,\n remainingInventory: item.remaining_inventory,\n isLimited: !!item.is_limited,\n consumeType: item.consume_type,\n handle: item.sku_handle,\n sku: item.goods_sku,\n image: item.goods_url,\n }\n })\n }, [copy.list, activeTab, redeemableList])\n\n const handles = alpcList.map(item => item.handle)\n const { data: products } = useProductsByHandles({ handles })\n\n const list = useMemo(() => {\n const currentList = copy.list.find(item => item.label === activeTab)\n return currentList?.list\n .filter(item => alpcList.some(alpcItem => alpcItem.id === item.id))\n .map(item => {\n const alpcItem = alpcList.find(alpcItem => alpcItem.id === item.id)\n const product = products?.find(product => product.handle === alpcItem?.handle)\n const variant = product?.variants.find(variant => variant.sku === alpcItem?.sku)\n if (alpcItem?.consumeType === AlpcConsumeType.Product && (!product || !variant)) return null\n return {\n alpc: alpcList.find(alpcItem => alpcItem.id === item.id),\n config: item,\n product,\n variant,\n }\n })\n .filter(item => item !== null) as unknown as RedeemableItemType[]\n }, [alpcList, products])\n\n const handleRedeemError = useCallback(\n (errorCode: AlpcErrorCode) => {\n if (errorCode === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n getRedeemableList()\n }\n },\n [getRedeemableList]\n )\n\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport RedeemCouponModal from './RedeemCouponModal'\nimport RedeemProductModal from './RedeemProductModal'\nimport { useCreditsContext } from '../context/provider'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { AlpcConsumeType, AlpcErrorCode } from '../context/const'\nimport { useProductsByHandles } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { RedeemableItem } from './RedeemableItem'\nimport RulesModal from '../modal/rulesModal'\nimport { CreditsRedeemListCopy } from './type'\nimport { gaTrack } from '../../../helpers/track'\n\nexport function CreditsRedeemList({\n copy,\n className = '',\n tabClassName = '',\n hideTitle = false,\n cardClassName,\n activate,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n tabClassName?: string\n hideTitle?: boolean\n cardClassName?: string\n activate: {\n openAuthCodePopup: () => void\n isSuccess: boolean\n setOnSuccess: (callback: Function) => void\n }\n}) {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n } = useCreditsContext()\n const isLogin = Object.keys(profile || {}).length > 0\n\n const [activeTab, setActiveTab] = useState<string>(copy.list[0].label)\n\n const [popRedeemData, setPopRedeemData] = useState<RedeemableItemType | undefined>(undefined)\n\n const [rules, setRules] = useState<string | string[]>()\n\n const { listLoading, redeemableList, getRedeemableList } = useRedeemableList()\n\n const alpcList = useMemo(() => {\n return redeemableList.map(item => {\n return {\n id: item.id.toString(),\n title: item.name,\n consumeCredits: item.consume_credits,\n remainingInventory: item.remaining_inventory,\n isLimited: !!item.is_limited,\n consumeType: item.consume_type,\n handle: item.sku_handle,\n sku: item.goods_sku,\n image: item.goods_url,\n }\n })\n }, [copy.list, activeTab, redeemableList])\n\n const handles = alpcList.map(item => item.handle)\n const { data: products } = useProductsByHandles({ handles })\n\n const list = useMemo(() => {\n const currentList = copy.list.find(item => item.label === activeTab)\n return currentList?.list\n .filter(item => alpcList.some(alpcItem => alpcItem.id === item.id))\n .map(item => {\n const alpcItem = alpcList.find(alpcItem => alpcItem.id === item.id)\n const product = products?.find(product => product.handle === alpcItem?.handle)\n const variant = product?.variants.find(variant => variant.sku === alpcItem?.sku)\n if (alpcItem?.consumeType === AlpcConsumeType.Product && (!product || !variant)) return null\n return {\n alpc: alpcList.find(alpcItem => alpcItem.id === item.id),\n config: item,\n product,\n variant,\n }\n })\n .filter(item => item !== null) as unknown as RedeemableItemType[]\n }, [alpcList, products])\n\n const handleRedeemError = useCallback(\n (errorCode: AlpcErrorCode) => {\n if (errorCode === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n getRedeemableList()\n }\n },\n [getRedeemableList]\n )\n\n return (\n <Container className={classNames('relative bg-[#F5F5F7]', className)}>\n {!hideTitle && <Heading as=\"h2\" size=\"4\" html={copy.title} />}\n\n <Tabs\n shape=\"rounded\"\n align=\"left\"\n className={classNames('sticky top-0 z-20 py-[24px] md:justify-center', tabClassName)}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_navigation',\n event_parameters: {\n navigation: value,\n page_group: pageGroup,\n },\n })\n }}\n >\n <TabsList>\n {copy.list.map(item => (\n <TabsTrigger key={item.label} value={item.label}>\n {item.label}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n {/* PC\u7AEF */}\n {!!alpcList?.length && !listLoading && (\n <div\n className={classNames('relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3')}\n >\n {list?.map(item => (\n <RedeemableItem\n key={item?.alpc?.id}\n copy={copy}\n item={item}\n onRedeem={(item: RedeemableItemType) => {\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !activate.isSuccess) {\n activate.openAuthCodePopup()\n activate.setOnSuccess(() => {\n setPopRedeemData(item)\n })\n } else {\n setPopRedeemData(item)\n }\n }}\n onRulesOpen={setRules}\n className={cardClassName}\n />\n ))}\n </div>\n )}\n\n {popRedeemData?.alpc?.consumeType === AlpcConsumeType.Coupon && copy?.redeemModal?.coupon && popRedeemData && (\n <RedeemCouponModal\n isOpen={!!popRedeemData}\n item={popRedeemData}\n copy={copy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {popRedeemData?.alpc?.consumeType === AlpcConsumeType.Product && copy?.redeemModal && popRedeemData && (\n <RedeemProductModal\n isOpen={!!popRedeemData}\n item={popRedeemData}\n copy={copy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\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={copy?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAkGI,OACiB,OAAAA,EADjB,QAAAC,MAAA,oBAlGJ,OAAS,aAAAC,EAAW,WAAAC,EAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,MAAmB,wBAChE,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAE/C,OAAOC,MAAuB,sBAC9B,OAAOC,MAAwB,uBAC/B,OAAS,qBAAAC,MAAyB,sBAClC,OAAOC,MAAuB,qCAC9B,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,mBAC/C,OAAS,wBAAAC,MAA4B,gBAErC,OAAS,kBAAAC,MAAsB,mBAC/B,OAAOC,MAAgB,sBAEvB,OAAS,WAAAC,MAAe,y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aAAa,IAAM,CAC1BQ,EAAiBO,CAAI,CACvB,CAAC,GAEDP,EAAiBO,CAAI,EAPrBb,EAAgB,CASpB,EACA,YAAaQ,EACb,UAAWX,GAhBNgB,GAAM,MAAM,EAiBnB,CACD,EACH,EAGDR,GAAe,MAAM,cAAgBnB,EAAgB,QAAUO,GAAM,aAAa,QAAUY,GAC3FlC,EAACW,EAAA,CACC,OAAQ,CAAC,CAACuB,EACV,KAAMA,EACN,KAAMZ,EACN,QAAS2B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDD,GAAe,MAAM,cAAgBnB,EAAgB,SAAWO,GAAM,aAAeY,GACpFlC,EAACY,EAAA,CACC,OAAQ,CAAC,CAACsB,EACV,KAAMA,EACN,KAAMZ,EACN,QAAS2B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDC,GACCpC,EAACmB,EAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQiB,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOd,GAAM,UACb,cAAc,2BAChB,GAEJ,CAEJ",
|
|
6
6
|
"names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "classNames", "useCallback", "useMemo", "useState", "RedeemCouponModal", "RedeemProductModal", "useCreditsContext", "useRedeemableList", "AlpcConsumeType", "AlpcErrorCode", "useProductsByHandles", "RedeemableItem", "RulesModal", "gaTrack", "CreditsRedeemList", "copy", "className", "tabClassName", "hideTitle", "cardClassName", "activate", "profile", "openSignUpPopup", "pageGroup", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "handleRedeemError", "errorCode", "value"]
|
|
7
7
|
}
|
package/package.json
CHANGED