@anker-in/campaign-ui 0.2.0-beta.1 → 0.2.0-beta.10

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.
Files changed (156) hide show
  1. package/dist/cjs/components/credits/context/provider.d.ts +2 -2
  2. package/dist/cjs/components/credits/context/provider.js +1 -1
  3. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  4. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +1 -1
  5. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +3 -3
  6. package/dist/cjs/components/credits/creditsBenefits/index.js +3 -3
  7. package/dist/cjs/components/credits/creditsBenefits/index.js.map +3 -3
  8. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
  9. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +3 -3
  10. package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
  11. package/dist/cjs/components/credits/creditsFaq/index.js.map +3 -3
  12. package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +0 -2
  13. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  14. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  15. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  16. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  17. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  18. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  19. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  20. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
  21. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  22. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +2 -2
  23. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  24. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  25. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  26. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
  27. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  28. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  29. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  30. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  31. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  32. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  33. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
  34. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
  35. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  36. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +2 -2
  37. package/dist/cjs/components/credits/modal/activitiesModal.js +1 -1
  38. package/dist/cjs/components/credits/modal/activitiesModal.js.map +2 -2
  39. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  40. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  41. package/dist/cjs/components/credits/modal/modalContainer.js +1 -1
  42. package/dist/cjs/components/credits/modal/modalContainer.js.map +3 -3
  43. package/dist/cjs/components/credits/modal/subscribeModal.js +1 -1
  44. package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
  45. package/dist/cjs/components/credits/modal/tip.js +1 -1
  46. package/dist/cjs/components/credits/modal/tip.js.map +3 -3
  47. package/dist/cjs/components/credits/type.d.ts +3 -2
  48. package/dist/cjs/components/credits/type.js +1 -1
  49. package/dist/cjs/components/credits/type.js.map +1 -1
  50. package/dist/cjs/components/registration/authCodeActivate/Message.js +1 -1
  51. package/dist/cjs/components/registration/authCodeActivate/Message.js.map +2 -2
  52. package/dist/cjs/components/registration/authCodeActivate/index.js +1 -1
  53. package/dist/cjs/components/registration/authCodeActivate/index.js.map +3 -3
  54. package/dist/cjs/components/registration/authCodeActivate/type.d.ts +0 -1
  55. package/dist/cjs/components/registration/authCodeActivate/type.js.map +1 -1
  56. package/dist/cjs/components/registration/context/provider.d.ts +2 -0
  57. package/dist/cjs/components/registration/context/provider.js +1 -1
  58. package/dist/cjs/components/registration/context/provider.js.map +3 -3
  59. package/dist/cjs/components/registration/modalContainer.d.ts +1 -2
  60. package/dist/cjs/components/registration/modalContainer.js +1 -1
  61. package/dist/cjs/components/registration/modalContainer.js.map +3 -3
  62. package/dist/cjs/templates/credits.d.ts +9 -8
  63. package/dist/cjs/templates/credits.js +1 -1
  64. package/dist/cjs/templates/credits.js.map +3 -3
  65. package/dist/esm/components/credits/context/provider.d.ts +2 -2
  66. package/dist/esm/components/credits/context/provider.js +1 -1
  67. package/dist/esm/components/credits/context/provider.js.map +3 -3
  68. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +1 -1
  69. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +3 -3
  70. package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
  71. package/dist/esm/components/credits/creditsBenefits/index.js.map +3 -3
  72. package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
  73. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +3 -3
  74. package/dist/esm/components/credits/creditsFaq/index.js +1 -1
  75. package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
  76. package/dist/esm/components/credits/creditsInfoCard/index.d.ts +0 -2
  77. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  78. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  79. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  80. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  81. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  82. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  83. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  84. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  85. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  86. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  87. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  88. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  89. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  90. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +3 -3
  91. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  92. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  93. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  94. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
  95. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  96. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  97. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
  98. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
  99. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  100. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
  101. package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
  102. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  103. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  104. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  105. package/dist/esm/components/credits/modal/modalContainer.js +1 -1
  106. package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
  107. package/dist/esm/components/credits/modal/subscribeModal.js +1 -1
  108. package/dist/esm/components/credits/modal/subscribeModal.js.map +3 -3
  109. package/dist/esm/components/credits/modal/tip.js +1 -1
  110. package/dist/esm/components/credits/modal/tip.js.map +3 -3
  111. package/dist/esm/components/credits/type.d.ts +3 -2
  112. package/dist/esm/components/registration/authCodeActivate/Message.js +1 -1
  113. package/dist/esm/components/registration/authCodeActivate/Message.js.map +2 -2
  114. package/dist/esm/components/registration/authCodeActivate/index.js +1 -1
  115. package/dist/esm/components/registration/authCodeActivate/index.js.map +3 -3
  116. package/dist/esm/components/registration/authCodeActivate/type.d.ts +0 -1
  117. package/dist/esm/components/registration/context/provider.d.ts +2 -0
  118. package/dist/esm/components/registration/context/provider.js +1 -1
  119. package/dist/esm/components/registration/context/provider.js.map +3 -3
  120. package/dist/esm/components/registration/modalContainer.d.ts +1 -2
  121. package/dist/esm/components/registration/modalContainer.js +1 -1
  122. package/dist/esm/components/registration/modalContainer.js.map +3 -3
  123. package/dist/esm/templates/credits.d.ts +9 -8
  124. package/dist/esm/templates/credits.js +1 -1
  125. package/dist/esm/templates/credits.js.map +3 -3
  126. package/package.json +3 -3
  127. package/src/components/credits/context/provider.tsx +1 -4
  128. package/src/components/credits/creditsBenefits/benefitItem.tsx +2 -5
  129. package/src/components/credits/creditsBenefits/index.tsx +1 -4
  130. package/src/components/credits/creditsCash/CreditsCash.tsx +3 -6
  131. package/src/components/credits/creditsFaq/index.tsx +2 -3
  132. package/src/components/credits/creditsInfoCard/index.tsx +10 -12
  133. package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +3 -4
  134. package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +2 -3
  135. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +2 -3
  136. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +2 -4
  137. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +2 -3
  138. package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +6 -4
  139. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +2 -3
  140. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +2 -3
  141. package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +5 -3
  142. package/src/components/credits/creditsWaysToGetCredits/useActions.ts +4 -1
  143. package/src/components/credits/modal/MyRewardsModal.tsx +2 -3
  144. package/src/components/credits/modal/activitiesModal.tsx +2 -3
  145. package/src/components/credits/modal/creditsUploadReceiptModal.tsx +2 -3
  146. package/src/components/credits/modal/modalContainer.tsx +2 -3
  147. package/src/components/credits/modal/subscribeModal.tsx +9 -32
  148. package/src/components/credits/modal/tip.tsx +2 -3
  149. package/src/components/credits/type.ts +3 -2
  150. package/src/components/registration/authCodeActivate/Message.tsx +1 -1
  151. package/src/components/registration/authCodeActivate/index.tsx +141 -109
  152. package/src/components/registration/authCodeActivate/type.ts +0 -1
  153. package/src/components/registration/context/provider.tsx +9 -0
  154. package/src/components/registration/modalContainer.tsx +9 -7
  155. package/src/templates/credits.tsx +41 -31
  156. package/src/components/credits/const.ts +0 -1
@@ -1,2 +1,2 @@
1
- import{jsx as o,jsxs as Z}from"react/jsx-runtime";import{Container as S,Heading as F,Tabs as H,TabsList as z,TabsTrigger as B}from"@anker-in/headless-ui";import u from"classnames";import{useCallback as D,useMemo as L,useState as c}from"react";import j from"./RedeemCouponModal";import q from"./RedeemProductModal";import{useCreditsContext as w}from"../context/provider";import G from"../context/hooks/useRedeemableList";import{AlpcConsumeType as g,AlpcErrorCode as U}from"../context/const";import{useHeadlessContext as V,useProductsByHandles as J}from"@anker-in/lib";import{RedeemableItem as K}from"./RedeemableItem";import Q from"../modal/rulesModal";import{gaTrack as W}from"@anker-in/lib";import{useRegistration as X}from"../../../components/registration";import{roundedBrands as Y}from"../const";const fe=({copy:s})=>{const{profile:f,openSignUpPopup:x,gtm:{pageGroup:k},pageCommon:_}=w(),{authCodeActivate:b}=X(),{brand:N}=V(),I=Y.includes(N),E=Object.keys(f||{}).length>0,[d,A]=c(s.list[0].label),[n,l]=c(void 0),[m,C]=c(),{listLoading:M,redeemableList:v,getRedeemableList:R}=G(),a=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})),[s.list,d,v]),P=a.map(e=>e.handle),{data:y}=J({handles:P}),O=L(()=>s.list.find(t=>t.label===d)?.list.filter(t=>a.some(i=>i.id===t.id)).map(t=>{const i=a.find(r=>r.id===t.id),p=y?.find(r=>r.handle===i?.handle),h=p?.variants.find(r=>r.sku===i?.sku);return i?.consumeType===g.Product&&(!p||!h)?null:{alpc:a.find(r=>r.id===t.id),config:t,product:p,variant:h}}).filter(t=>t!==null),[a,y]),T=D(e=>{e===U.CodeLpcRuleInventoryNotEnough&&R()},[R]);return Z(S,{className:u("relative bg-[#F5F5F7]"),children:[o(F,{as:"h2",size:"4",html:s.title}),o(H,{shape:I?"rounded":"square",align:"left",className:u("sticky top-0 z-20 py-[24px] md:justify-center"),value:d.toString(),onValueChange:e=>{A(e),W({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:e,page_group:k}})},children:o(z,{children:s.list.map(e=>o(B,{value:e.label,children:e.label},e.label))})}),!!a?.length&&!M&&o("div",{className:u("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:O?.map(e=>o(K,{copy:s,item:e,onRedeem:t=>{E?!f?.activated&&!b.isActivateSuccess?b.open():l(t):x()},onRulesOpen:C},e?.alpc?.id))}),n?.alpc?.consumeType===g.Coupon&&s?.redeemModal?.coupon&&n&&o(j,{isOpen:!!n,item:n,copy:s,onError:T,onClose:()=>{l(void 0)}}),n?.alpc?.consumeType===g.Product&&s?.redeemModal&&n&&o(q,{isOpen:!!n,item:n,copy:s,onError:T,onClose:()=>{l(void 0)}}),m&&o(Q,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:m.length>0,onClose:()=>C([]),titleClassName:"border-b-transparent h-[56px]",rules:m,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:_?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};export{fe as CreditsRedeemList};
1
+ import{jsx as o,jsxs as Z}from"react/jsx-runtime";import{Container as S,Heading as D,Tabs as F,TabsList as H,TabsTrigger as z}from"@anker-in/headless-ui";import u from"classnames";import{useCallback as B,useMemo as L,useState as c}from"react";import U from"./RedeemCouponModal";import j from"./RedeemProductModal";import{useCreditsContext as q}from"../context/provider";import w from"../context/hooks/useRedeemableList";import{AlpcConsumeType as g,AlpcErrorCode as G}from"../context/const";import{useHeadlessContext as V,useProductsByHandles as J,gaTrack as K,ROUNDED_BRANDS as Q}from"@anker-in/lib";import{RedeemableItem as W}from"./RedeemableItem";import X from"../modal/rulesModal";import{useRegistration as Y}from"../../../components/registration";const ce=({copy:s})=>{const{profile:f,openSignUpPopup:x,gtm:{pageGroup:k},pageCommon:N}=q(),{authCodeActivate:b}=Y(),{brand:_}=V(),I=Q.includes(_),E=Object.keys(f||{}).length>0,[d,A]=c(s.list[0].label),[n,l]=c(void 0),[m,C]=c(),{listLoading:M,redeemableList:R,getRedeemableList:v}=w(),r=L(()=>R.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})),[s.list,d,R]),O=r.map(e=>e.handle),{data:y}=J({handles:O}),P=L(()=>s.list.find(t=>t.label===d)?.list.filter(t=>r.some(i=>i.id===t.id)).map(t=>{const i=r.find(a=>a.id===t.id),p=y?.find(a=>a.handle===i?.handle),h=p?.variants.find(a=>a.sku===i?.sku);return i?.consumeType===g.Product&&(!p||!h)?null:{alpc:r.find(a=>a.id===t.id),config:t,product:p,variant:h}}).filter(t=>t!==null),[r,y]),T=B(e=>{e===G.CodeLpcRuleInventoryNotEnough&&v()},[v]);return Z(S,{className:u("relative bg-[#F5F5F7]"),children:[o(D,{as:"h2",size:"4",html:s.title}),o(F,{shape:I?"rounded":"square",align:"left",className:u("sticky top-0 z-20 py-[24px] md:justify-center"),value:d.toString(),onValueChange:e=>{A(e),K({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:e,page_group:k}})},children:o(H,{children:s.list.map(e=>o(z,{value:e.label,children:e.label},e.label))})}),!!r?.length&&!M&&o("div",{className:u("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:P?.map(e=>o(W,{copy:s,item:e,onRedeem:t=>{E?!f?.activated&&!b.isActivateSuccess?b.open():l(t):x()},onRulesOpen:C},e?.alpc?.id))}),n?.alpc?.consumeType===g.Coupon&&s?.redeemModal?.coupon&&n&&o(U,{isOpen:!!n,item:n,copy:s,onError:T,onClose:()=>{l(void 0)}}),n?.alpc?.consumeType===g.Product&&s?.redeemModal&&n&&o(j,{isOpen:!!n,item:n,copy:s,onError:T,onClose:()=>{l(void 0)}}),m&&o(X,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:m.length>0,onClose:()=>C([]),titleClassName:"border-b-transparent h-[56px]",rules:m,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:N?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};export{ce as CreditsRedeemList};
2
2
  //# sourceMappingURL=CreditsRedeemList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsRedeemList/CreditsRedeemList.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 { useHeadlessContext, 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 '@anker-in/lib'\nimport { useRegistration } from '../../../components/registration'\nimport { roundedBrands } from '../const'\n\nexport const CreditsRedeemList = ({ copy }: { copy: CreditsRedeemListCopy }) => {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n pageCommon,\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n\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]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n <Tabs\n shape={rounded ? 'rounded' : 'square'}\n align=\"left\"\n className={classNames('sticky top-0 z-20 py-[24px] md:justify-center')}\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 && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.open()\n } else {\n setPopRedeemData(item)\n }\n }}\n onRulesOpen={setRules}\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={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
5
- "mappings": "AAuFI,OACE,OAAAA,EADF,QAAAC,MAAA,oBAvFJ,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,sBAAAC,EAAoB,wBAAAC,MAA4B,gBAEzD,OAAS,kBAAAC,MAAsB,mBAC/B,OAAOC,MAAgB,sBAEvB,OAAS,WAAAC,MAAe,gBACxB,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,WAEvB,MAAMC,GAAoB,CAAC,CAAE,KAAAC,CAAK,IAAuC,CAC9E,KAAM,CACJ,QAAAC,EACA,gBAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,CACF,EA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GAAe,MAAM,cAAgBrB,EAAgB,QAAUU,GAAM,aAAa,QAAUW,GAC3FpC,EAACW,EAAA,CACC,OAAQ,CAAC,CAACyB,EACV,KAAMA,EACN,KAAMX,EACN,QAAS0B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDD,GAAe,MAAM,cAAgBrB,EAAgB,SAAWU,GAAM,aAAeW,GACpFpC,EAACY,EAAA,CACC,OAAQ,CAAC,CAACwB,EACV,KAAMA,EACN,KAAMX,EACN,QAAS0B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDC,GACCtC,EAACoB,EAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQkB,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOT,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
6
- "names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "classNames", "useCallback", "useMemo", "useState", "RedeemCouponModal", "RedeemProductModal", "useCreditsContext", "useRedeemableList", "AlpcConsumeType", "AlpcErrorCode", "useHeadlessContext", "useProductsByHandles", "RedeemableItem", "RulesModal", "gaTrack", "useRegistration", "roundedBrands", "CreditsRedeemList", "copy", "profile", "openSignUpPopup", "pageGroup", "pageCommon", "authCodeActivate", "brand", "rounded", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "handleRedeemError", "errorCode", "value"]
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 { useHeadlessContext, useProductsByHandles, gaTrack, ROUNDED_BRANDS } 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 { useRegistration } from '../../../components/registration'\n\nexport const CreditsRedeemList = ({ copy }: { copy: CreditsRedeemListCopy }) => {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n pageCommon,\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\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]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n <Tabs\n shape={rounded ? 'rounded' : 'square'}\n align=\"left\"\n className={classNames('sticky top-0 z-20 py-[24px] md:justify-center')}\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 && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.open()\n } else {\n setPopRedeemData(item)\n }\n }}\n onRulesOpen={setRules}\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={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "AAqFI,OACE,OAAAA,EADF,QAAAC,MAAA,oBArFJ,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,sBAAAC,EAAoB,wBAAAC,EAAsB,WAAAC,EAAS,kBAAAC,MAAsB,gBAElF,OAAS,kBAAAC,MAAsB,mBAC/B,OAAOC,MAAgB,sBAEvB,OAAS,mBAAAC,MAAuB,mCAEzB,MAAMC,GAAoB,CAAC,CAAE,KAAAC,CAAK,IAAuC,CAC9E,KAAM,CACJ,QAAAC,EACA,gBAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,CACF,EAAIhB,EAAkB,EAChB,CAAE,iBAAAiB,CAAiB,EAAIP,EAAgB,EACvC,CAAE,MAAAQ,CAAM,EAAId,EAAmB,EAC/Be,EAAUZ,EAAe,SAASW,CAAK,EAEvCE,EAAU,OAAO,KAAKP,GAAW,CAAC,CAAC,EAAE,OAAS,EAE9C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,GAAe,MAAM,cAAgBrB,EAAgB,SAAWU,GAAM,aAAeW,GACpFpC,EAACY,EAAA,CACC,OAAQ,CAAC,CAACwB,EACV,KAAMA,EACN,KAAMX,EACN,QAAS0B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDC,GACCtC,EAACsB,EAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQgB,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOT,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
6
+ "names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "classNames", "useCallback", "useMemo", "useState", "RedeemCouponModal", "RedeemProductModal", "useCreditsContext", "useRedeemableList", "AlpcConsumeType", "AlpcErrorCode", "useHeadlessContext", "useProductsByHandles", "gaTrack", "ROUNDED_BRANDS", "RedeemableItem", "RulesModal", "useRegistration", "CreditsRedeemList", "copy", "profile", "openSignUpPopup", "pageGroup", "pageCommon", "authCodeActivate", "brand", "rounded", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "handleRedeemError", "errorCode", "value"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as h,Text as r}from"@anker-in/headless-ui";import i from"classnames";import{AddressForm as C}from"../AddressForm";import{useHeadlessContext as N}from"@anker-in/lib";import{ProductInfo as R}from"./ProductInfo";import A from"../../context/hooks/useCountries";import{roundedBrands as F}from"../../const";const E=({copy:t,shippingAddress:d,setAddress:m,validateAddress:a,validateErrors:n,shippingProduct:s,loading:p,address:l,disabled:x,handlePayment:c,item:u})=>{const{storeDomain:f,brand:y}=N(),v=F.includes(y),{countries:b=[],isLoading:g}=A({shopifyStoreDomain:f});return o("div",{className:"relative",children:[e("div",{className:i("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o("div",{children:[d&&e(r,{className:"mb-5 text-[16px] font-bold",html:d}),e(C,{onChange:m,validate:a,errors:n,form:t.redeemModal.product.addressForm,countries:b,countriesLoading:g})]})}),o("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[o("div",{className:i("flex w-full items-center bg-[#F5F5F7] p-[16px]",!v&&"rounded-none"),children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(R,{item:u,copy:t})]}),e(h,{loading:p||!l,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:c,disabled:x,children:t.redeemModal.product.paymentButton})]})]})};export{E as Address};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as N,Text as r}from"@anker-in/headless-ui";import i from"classnames";import{AddressForm as R}from"../AddressForm";import{useHeadlessContext as h,ROUNDED_BRANDS as A}from"@anker-in/lib";import{ProductInfo as C}from"./ProductInfo";import F from"../../context/hooks/useCountries";const E=({copy:t,shippingAddress:s,setAddress:a,validateAddress:m,validateErrors:n,shippingProduct:d,loading:p,address:l,disabled:x,handlePayment:c,item:u})=>{const{storeDomain:f,brand:y}=h(),v=A.includes(y),{countries:b=[],isLoading:g}=F({shopifyStoreDomain:f});return o("div",{className:"relative",children:[e("div",{className:i("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o("div",{children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(R,{onChange:a,validate:m,errors:n,form:t.redeemModal.product.addressForm,countries:b,countriesLoading:g})]})}),o("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[o("div",{className:i("flex w-full items-center bg-[#F5F5F7] p-[16px]",!v&&"rounded-none"),children:[d&&e(r,{className:"mb-5 text-[16px] font-bold",html:d}),e(C,{item:u,copy:t})]}),e(N,{loading:p||!l,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:c,disabled:x,children:t.redeemModal.product.paymentButton})]})]})};export{E as Address};
2
2
  //# sourceMappingURL=Address.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx"],
4
- "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\nimport { roundedBrands } from '../../const'\n\ntype AddressProps = {\n copy: CreditsRedeemListCopy\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain, brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.redeemModal.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AA4CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA5CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,sBAAAC,MAA0B,gBAGnC,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCACzB,OAAS,iBAAAC,MAAqB,cAgBvB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,EAAa,MAAAC,CAAM,EAAIjB,EAAmB,EAC5CkB,EAAUf,EAAc,SAASc,CAAK,EACtC,CAAE,UAAAE,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIlB,EAAa,CAAE,mBAAoBc,CAAY,CAAC,EAExG,OACErB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAW,GAAmBZ,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMS,EAAiB,EACxFZ,EAACK,EAAA,CACC,SAAUQ,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWc,EACX,iBAAkBC,EACnB,GACH,EACF,EACAzB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAWG,EAAW,iDAAkD,CAACoB,GAAW,cAAc,EACpG,UAAAR,GAAmBhB,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMa,EAAiB,EACxFhB,EAACO,EAAA,CAAY,KAAMc,EAAM,KAAMV,EAAM,GACvC,EACAX,EAACE,EAAA,CACC,QAASe,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
6
- "names": ["jsx", "jsxs", "Button", "Text", "classNames", "AddressForm", "useHeadlessContext", "ProductInfo", "useCountries", "roundedBrands", "Address", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "brand", "rounded", "countries", "countriesLoading"]
4
+ "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\n\ntype AddressProps = {\n copy: CreditsRedeemListCopy\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.redeemModal.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AA2CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA3CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,sBAAAC,EAAoB,kBAAAC,MAAsB,gBAGnD,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCAgBlB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,EAAa,MAAAC,CAAM,EAAIjB,EAAmB,EAC5CkB,EAAUjB,EAAe,SAASgB,CAAK,EACvC,CAAE,UAAAE,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIjB,EAAa,CAAE,mBAAoBa,CAAY,CAAC,EAExG,OACErB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAW,GAAmBZ,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMS,EAAiB,EACxFZ,EAACK,EAAA,CACC,SAAUQ,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWc,EACX,iBAAkBC,EACnB,GACH,EACF,EACAzB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAWG,EAAW,iDAAkD,CAACoB,GAAW,cAAc,EACpG,UAAAR,GAAmBhB,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMa,EAAiB,EACxFhB,EAACQ,EAAA,CAAY,KAAMa,EAAM,KAAMV,EAAM,GACvC,EACAX,EAACE,EAAA,CACC,QAASe,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "classNames", "AddressForm", "useHeadlessContext", "ROUNDED_BRANDS", "ProductInfo", "useCountries", "Address", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "brand", "rounded", "countries", "countriesLoading"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as a,jsxs as e}from"react/jsx-runtime";import{Picture as m}from"@anker-in/headless-ui";import{formatPrice as i}from"../../context/utils";import{useHeadlessContext as r}from"@anker-in/lib";import{useCreditsContext as o}from"../../context/provider";const v=({item:t,copy:d})=>{const{locale:s}=r(),{pageCommon:l}=o();return e("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),e("div",{className:"md:flex md:flex-col",children:[e("div",{className:"md:flex md:items-center",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:t.product.title,children:t.product.title})]}),e("div",{className:"mt-[16px] md:mt-[12px]",children:[a("div",{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",title:t.product.title,children:t.product.title}),e("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[e("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.variantLabel,": "]}),a("span",{className:"ml-1",children:t.variant.title||""})]}),e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:i({amount:0,currencyCode:t.product.price?.currencyCode,locale:s||"us"})})]})]}),e("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),e("div",{className:"l:flex l:items-center l:justify-between",children:[e("span",{children:[d.redeemModal.product.totalPriceLabel,": "]}),e("span",{className:"ml-1",children:[t.alpc?.consumeCredits," ",l?.pointUnit]})]})]})]})]})]})]})};export{v as ProductInfo};
1
+ import{jsx as a,jsxs as e}from"react/jsx-runtime";import{Picture as d,Text as i}from"@anker-in/headless-ui";import{formatPrice as r}from"../../context/utils";import{useHeadlessContext as o}from"@anker-in/lib";import{useCreditsContext as p}from"../../context/provider";const b=({item:t,copy:m})=>{const{locale:s}=o(),{pageCommon:l}=p();return e("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(d,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),e("div",{className:"md:flex md:flex-col",children:[e("div",{className:"md:flex md:items-center",children:[a(d,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:t.product.title,children:t.product.title})]}),e("div",{className:"mt-[16px] md:mt-[12px]",children:[a(i,{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",html:t.product.title,title:t.product.title}),e("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[e("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[m.redeemModal.product.variantLabel,": "]}),a("span",{className:"ml-1",children:t.variant.title||""})]}),e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[m.redeemModal.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:r({amount:0,currencyCode:t.product.price?.currencyCode,locale:s||"us"})})]})]}),e("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[m.redeemModal.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),e("div",{className:"l:flex l:items-center l:justify-between",children:[e("span",{children:[m.redeemModal.product.totalPriceLabel,": "]}),e("span",{className:"ml-1",children:[t.alpc?.consumeCredits," ",l?.pointUnit]})]})]})]})]})]})]})};export{b as ProductInfo};
2
2
  //# sourceMappingURL=ProductInfo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx"],
4
- "sourcesContent": ["import { Picture } from '@anker-in/headless-ui'\nimport { formatPrice } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../../context/provider'\n\ntype ProductInfoProps = {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n}\n\nexport const ProductInfo = ({ item, copy }: ProductInfoProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n\n return (\n <div className=\"flex w-full items-center justify-center md:items-start md:justify-start\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"md:flex md:flex-col\">\n <div className=\"md:flex md:items-center\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n </div>\n\n <div className=\"mt-[16px] md:mt-[12px]\">\n <div className=\"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n <div className=\"flex font-semibold leading-[1.4] md:flex-col\">\n <div className=\"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.variantLabel}: </span>\n <span className=\"ml-1\">{item.variant.title || ''}</span>\n </div>\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.shippingFeeLabel}: </span>\n <span className=\"ml-1\">\n {formatPrice({\n amount: 0,\n currencyCode: item.product.price?.currencyCode!,\n locale: locale || 'us',\n })}\n </span>\n </div>\n </div>\n <div className=\"text-[15px] font-bold text-[#777] md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.quantityLabel}: </span>\n <span className=\"ml-1\">1</span>\n </div>\n <div className=\"l:flex l:items-center l:justify-between\">\n <span>{copy.redeemModal.product.totalPriceLabel}: </span>\n <span className=\"ml-1\">\n {item.alpc?.consumeCredits} {pageCommon?.pointUnit}\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAkBM,cAAAA,EAME,QAAAC,MANF,oBAlBN,OAAS,WAAAC,MAAe,wBACxB,OAAS,eAAAC,MAAmB,sBAG5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,yBAO3B,MAAMC,EAAc,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAAwB,CAC/D,KAAM,CAAE,OAAAC,CAAO,EAAIL,EAAmB,EAChC,CAAE,WAAAM,CAAW,EAAIL,EAAkB,EAEzC,OACEJ,EAAC,OAAI,UAAU,0EACb,UAAAD,EAACE,EAAA,CACC,UAAU,6HACV,OAAQK,EAAK,QAAQ,OAAO,KAAOA,EAAK,SAAS,OAAO,CAAC,GAAG,IAC5D,IAAKA,EAAK,QAAQ,MACnB,EACDN,EAAC,OAAI,UAAU,sBACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACE,EAAA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+ "sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\nimport { formatPrice } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../../context/provider'\n\ntype ProductInfoProps = {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n}\n\nexport const ProductInfo = ({ item, copy }: ProductInfoProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n\n return (\n <div className=\"flex w-full items-center justify-center md:items-start md:justify-start\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"md:flex md:flex-col\">\n <div className=\"md:flex md:items-center\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n </div>\n\n <div className=\"mt-[16px] md:mt-[12px]\">\n <Text\n className=\"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden\"\n html={item.product.title}\n title={item.product.title}\n ></Text>\n <div className=\"flex font-semibold leading-[1.4] md:flex-col\">\n <div className=\"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.variantLabel}: </span>\n <span className=\"ml-1\">{item.variant.title || ''}</span>\n </div>\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.shippingFeeLabel}: </span>\n <span className=\"ml-1\">\n {formatPrice({\n amount: 0,\n currencyCode: item.product.price?.currencyCode!,\n locale: locale || 'us',\n })}\n </span>\n </div>\n </div>\n <div className=\"text-[15px] font-bold text-[#777] md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.quantityLabel}: </span>\n <span className=\"ml-1\">1</span>\n </div>\n <div className=\"l:flex l:items-center l:justify-between\">\n <span>{copy.redeemModal.product.totalPriceLabel}: </span>\n <span className=\"ml-1\">\n {item.alpc?.consumeCredits} {pageCommon?.pointUnit}\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAkBM,cAAAA,EAME,QAAAC,MANF,oBAlBN,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC9B,OAAS,eAAAC,MAAmB,sBAG5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,yBAO3B,MAAMC,EAAc,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAAwB,CAC/D,KAAM,CAAE,OAAAC,CAAO,EAAIL,EAAmB,EAChC,CAAE,WAAAM,CAAW,EAAIL,EAAkB,EAEzC,OACEL,EAAC,OAAI,UAAU,0EACb,UAAAD,EAACE,EAAA,CACC,UAAU,6HACV,OAAQM,EAAK,QAAQ,OAAO,KAAOA,EAAK,SAAS,OAAO,CAAC,GAAG,IAC5D,IAAKA,EAAK,QAAQ,MACnB,EACDP,EAAC,OAAI,UAAU,sBACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACE,EAAA,CACC,UAAU,iIACV,OAAQM,EAAK,QAAQ,OAAO,KAAOA,EAAK,SAAS,OAAO,CAAC,GAAG,IAC5D,IAAKA,EAAK,QAAQ,MACnB,EACDR,EAAC,OAAI,UAAU,2DAA2D,MAAOQ,EAAK,QAAQ,MAC3F,SAAAA,EAAK,QAAQ,MAChB,GACF,EAEAP,EAAC,OAAI,UAAU,yBACb,UAAAD,EAACG,EAAA,CACC,UAAU,yDACV,KAAMK,EAAK,QAAQ,MACnB,MAAOA,EAAK,QAAQ,MACrB,EACDP,EAAC,OAAI,UAAU,+CACb,UAAAA,EAAC,OAAI,UAAU,qEACb,UAAAA,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAQ,EAAK,YAAY,QAAQ,aAAa,MAAE,EAC/CT,EAAC,QAAK,UAAU,OAAQ,SAAAQ,EAAK,QAAQ,OAAS,GAAG,GACnD,EACAP,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAQ,EAAK,YAAY,QAAQ,iBAAiB,MAAE,EACnDT,EAAC,QAAK,UAAU,OACb,SAAAI,EAAY,CACX,OAAQ,EACR,aAAcI,EAAK,QAAQ,OAAO,aAClC,OAAQE,GAAU,IACpB,CAAC,EACH,GACF,GACF,EACAT,EAAC,OAAI,UAAU,mDACb,UAAAA,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAQ,EAAK,YAAY,QAAQ,cAAc,MAAE,EAChDT,EAAC,QAAK,UAAU,OAAO,aAAC,GAC1B,EACAC,EAAC,OAAI,UAAU,0CACb,UAAAA,EAAC,QAAM,UAAAQ,EAAK,YAAY,QAAQ,gBAAgB,MAAE,EAClDR,EAAC,QAAK,UAAU,OACb,UAAAO,EAAK,MAAM,eAAe,IAAEG,GAAY,WAC3C,GACF,GACF,GACF,GACF,GACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Picture", "Text", "formatPrice", "useHeadlessContext", "useCreditsContext", "ProductInfo", "item", "copy", "locale", "pageCommon"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as v}from"react/jsx-runtime";import{Button as u,Text as d}from"@anker-in/headless-ui";import m from"classnames";import{ProductInfo as f}from"./ProductInfo";import{useHeadlessContext as b}from"@anker-in/lib";import{roundedBrands as y}from"../../const";const B=({copy:t,shippingProduct:o,loading:s,address:r,disabled:a,onClose:p,item:i})=>{const{brand:l}=b(),n=y.includes(l);return e("div",{className:m("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:v("div",{className:"flex flex-col items-center",children:[e("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:t.redeemModal.product.successDesc.map((x,c)=>e(d,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:x},c))}),o&&e(d,{className:"mb-5 text-[16px] font-bold",html:o}),e("div",{className:m("flex w-full items-center bg-[#F5F5F7] p-[16px]",!n&&"rounded-none"),children:e(f,{item:i,copy:t})}),e(u,{loading:s||!r,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:p,disabled:a,children:t.redeemModal.product.paymentButton})]})})};export{B as Success};
1
+ import{jsx as e,jsxs as v}from"react/jsx-runtime";import{Button as u,Text as m}from"@anker-in/headless-ui";import d from"classnames";import{ProductInfo as f}from"./ProductInfo";import{useHeadlessContext as b,ROUNDED_BRANDS as y}from"@anker-in/lib";const h=({copy:t,shippingProduct:o,loading:s,address:a,disabled:p,onClose:r,item:l})=>{const{brand:i}=b(),n=y.includes(i);return e("div",{className:d("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:v("div",{className:"flex flex-col items-center",children:[e("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:t.redeemModal.product.successDesc.map((x,c)=>e(m,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:x},c))}),o&&e(m,{className:"mb-5 text-[16px] font-bold",html:o}),e("div",{className:d("flex w-full items-center bg-[#F5F5F7] p-[16px]",!n&&"rounded-none"),children:e(f,{item:l,copy:t})}),e(u,{loading:s||!a,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:r,disabled:p,children:t.redeemModal.product.paymentButton})]})})};export{h as Success};
2
2
  //# sourceMappingURL=Success.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx"],
4
- "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { roundedBrands } from '../../const'\n\ntype SuccessProps = {\n copy: CreditsRedeemListCopy\n shippingProduct: string\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n onClose: () => void\n item: RedeemableItemType\n}\n\nexport const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n return (\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div className=\"flex flex-col items-center\">\n <div className=\"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]\">\n {copy.redeemModal.product.successDesc.map((description: string, index: number) => (\n <Text key={index} className=\"text-[18px] font-bold leading-[1.4] md:text-[14px]\" html={description}></Text>\n ))}\n </div>\n\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n <ProductInfo item={item} copy={copy} />\n </div>\n\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={onClose}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAuBM,OAGM,OAAAA,EAHN,QAAAC,MAAA,oBAvBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aAGvB,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,iBAAAC,MAAqB,cAYvB,MAAMC,EAAU,CAAC,CAAE,KAAAC,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,EAAIV,EAAmB,EAC/BW,EAAUV,EAAc,SAASS,CAAK,EAC5C,OACEhB,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,wDACZ,SAAAS,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACS,EAAqBC,IAC9DnB,EAACG,EAAA,CAAiB,UAAU,qDAAqD,KAAMe,GAA5EC,CAAyF,CACrG,EACH,EAECT,GAAmBV,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMO,EAAiB,EAExFV,EAAC,OAAI,UAAWI,EAAW,iDAAkD,CAACa,GAAW,cAAc,EACrG,SAAAjB,EAACK,EAAA,CAAY,KAAMU,EAAM,KAAMN,EAAM,EACvC,EAEAT,EAACE,EAAA,CACC,QAASS,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF,CAEJ",
6
- "names": ["jsx", "jsxs", "Button", "Text", "classNames", "ProductInfo", "useHeadlessContext", "roundedBrands", "Success", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "brand", "rounded", "description", "index"]
4
+ "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport { useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\n\ntype SuccessProps = {\n copy: CreditsRedeemListCopy\n shippingProduct: string\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n onClose: () => void\n item: RedeemableItemType\n}\n\nexport const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n return (\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div className=\"flex flex-col items-center\">\n <div className=\"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]\">\n {copy.redeemModal.product.successDesc.map((description: string, index: number) => (\n <Text key={index} className=\"text-[18px] font-bold leading-[1.4] md:text-[14px]\" html={description}></Text>\n ))}\n </div>\n\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n <ProductInfo item={item} copy={copy} />\n </div>\n\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={onClose}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAsBM,OAGM,OAAAA,EAHN,QAAAC,MAAA,oBAtBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aAGvB,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,sBAAAC,EAAoB,kBAAAC,MAAsB,gBAY5C,MAAMC,EAAU,CAAC,CAAE,KAAAC,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,EAAIV,EAAmB,EAC/BW,EAAUV,EAAe,SAASS,CAAK,EAC7C,OACEhB,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,wDACZ,SAAAS,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACS,EAAqBC,IAC9DnB,EAACG,EAAA,CAAiB,UAAU,qDAAqD,KAAMe,GAA5EC,CAAyF,CACrG,EACH,EAECT,GAAmBV,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMO,EAAiB,EAExFV,EAAC,OAAI,UAAWI,EAAW,iDAAkD,CAACa,GAAW,cAAc,EACrG,SAAAjB,EAACK,EAAA,CAAY,KAAMU,EAAM,KAAMN,EAAM,EACvC,EAEAT,EAACE,EAAA,CACC,QAASS,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "classNames", "ProductInfo", "useHeadlessContext", "ROUNDED_BRANDS", "Success", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "brand", "rounded", "description", "index"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Button as N,Text as u,Picture as p}from"@anker-in/headless-ui";import{useMemo as x}from"react";import s from"classnames";import{useCreditsContext as R}from"../context/provider";import{AlpcConsumeType as f,ConsumeType as T}from"../context/const";import{numberFormat as w}from"../context/utils";import{gaTrack as v,useHeadlessContext as I}from"@anker-in/lib";import{NoneProductValue as k}from"./NonProductValue";import{roundedBrands as z}from"../const";function D({copy:l,className:g,item:e,onRulesOpen:b,onRedeem:y}){const{creditInfo:m,profile:a,gtm:{pageGroup:d},pageCommon:n}=R(),{brand:_}=I(),i=Object.keys(a||{}).length>0,h=z.includes(_),C=x(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===f.Product&&!e.variant?.availableForSale||i&&a?.activated&&e.alpc?.consumeCredits>Number(m?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,i,a?.activated,m?.available_credit,e.variant?.availableForSale]),c=x(()=>i?e.alpc?.consumeType===f.Product?e.variant?.availableForSale?l.btnRedeem:n?.soldOut||"Sold Out":l.btnRedeem:l.unlockRewards,[i,e.alpc?.consumeType,e.variant?.availableForSale,l.btnRedeem,l.unlockRewards,n?.soldOut]);return o("div",{className:s("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!h&&"rounded-none md:rounded-none",g),children:[e.config?.type===T.Product?t("div",{className:s("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(p,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})}):o("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[t(p,{source:n?.imageMapping?.[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),t(k,{item:e})]}),o("div",{className:s("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[t(u,{html:e.config?.title||e.alpc?.title,title:e.config?.title||e.alpc?.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?.length>0&&t("button",{type:"button",onClick:()=>{b(e.config?.rules||[]),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:n?.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:n?.ruleLabel}),o("div",{children:[o("div",{className:"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[t(p,{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:`${w(e.alpc?.consumeCredits)}`,size:2,as:"p",className:"ml-[4px] text-[28px] font-bold mt-[4px] leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),t(N,{disabled:C,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{y(e),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:c,info:e.alpc?.id?.toString()}})},children:c})]})]})]})}export{D as RedeemableItem};
1
+ import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Button as C,Text as u,Picture as p}from"@anker-in/headless-ui";import{useMemo as x}from"react";import s from"classnames";import{useCreditsContext as R}from"../context/provider";import{AlpcConsumeType as f,ConsumeType as T}from"../context/const";import{numberFormat as w}from"../context/utils";import{gaTrack as v,useHeadlessContext as I,ROUNDED_BRANDS as k}from"@anker-in/lib";import{NoneProductValue as S}from"./NonProductValue";function B({copy:l,className:g,item:e,onRulesOpen:b,onRedeem:y}){const{creditInfo:m,profile:a,gtm:{pageGroup:d},pageCommon:n}=R(),{brand:_}=I(),i=Object.keys(a||{}).length>0,h=k.includes(_),N=x(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===f.Product&&!e.variant?.availableForSale||i&&a?.activated&&e.alpc?.consumeCredits>Number(m?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,i,a?.activated,m?.available_credit,e.variant?.availableForSale]),c=x(()=>i?e.alpc?.consumeType===f.Product?e.variant?.availableForSale?l.btnRedeem:n?.soldOut||"Sold Out":l.btnRedeem:l.unlockRewards,[i,e.alpc?.consumeType,e.variant?.availableForSale,l.btnRedeem,l.unlockRewards,n?.soldOut]);return o("div",{className:s("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!h&&"rounded-none md:rounded-none",g),children:[e.config?.type===T.Product?t("div",{className:s("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(p,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})}):o("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[t(p,{source:n?.imageMapping?.[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),t(S,{item:e})]}),o("div",{className:s("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[t(u,{html:e.config?.title||e.alpc?.title,title:e.config?.title||e.alpc?.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?.length>0&&t("button",{type:"button",onClick:()=>{b(e.config?.rules||[]),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:n?.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:n?.ruleLabel}),o("div",{children:[o("div",{className:"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[t(p,{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:`${w(e.alpc?.consumeCredits)}`,size:2,as:"p",className:"ml-[4px] text-[28px] font-bold mt-[4px] leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),t(C,{disabled:N,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{y(e),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:c,info:e.alpc?.id?.toString()}})},children:c})]})]})]})}export{B 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, useHeadlessContext } from '@anker-in/lib'\nimport { NoneProductValue } from './NonProductValue'\nimport { roundedBrands } from '../const'\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 pageCommon,\n } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const isLogin = Object.keys(profile || {}).length > 0\n const rounded = roundedBrands.includes(brand)\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 : pageCommon?.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 pageCommon?.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 !rounded && 'rounded-none md:rounded-none',\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={pageCommon?.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} />\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=\"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 {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: pageCommon?.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 {pageCommon?.ruleLabel}\n </button>\n )}\n <div>\n <div className=\"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]\">\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(item.alpc?.consumeCredits)}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] text-[28px] font-bold mt-[4px] leading-none 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": "AA4FU,cAAAA,EAMF,QAAAC,MANE,oBA5FV,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBAEtC,OAAS,WAAAC,MAAe,QAExB,OAAOC,MAAgB,aACvB,OAAS,qBAAAC,MAAyB,sBAElC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,mBAC7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MAAO,WACP,WAAY,YACZ,qBAAsBW,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaa,EACb,KAAMX,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EAEC,SAAAW,EACH,GACF,GACF,GACF,CAEJ",
6
- "names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "gaTrack", "useHeadlessContext", "NoneProductValue", "roundedBrands", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "pageCommon", "brand", "isLogin", "rounded", "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, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\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 pageCommon,\n } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const isLogin = Object.keys(profile || {}).length > 0\n const rounded = ROUNDED_BRANDS.includes(brand)\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 : pageCommon?.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 pageCommon?.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 !rounded && 'rounded-none md:rounded-none',\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={pageCommon?.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} />\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=\"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 {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: pageCommon?.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 {pageCommon?.ruleLabel}\n </button>\n )}\n <div>\n <div className=\"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]\">\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(item.alpc?.consumeCredits)}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] text-[28px] font-bold mt-[4px] leading-none 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": "AA2FU,cAAAA,EAMF,QAAAC,MANE,oBA3FV,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBAEtC,OAAS,WAAAC,M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B,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbR,EAASF,CAAI,EACbP,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBW,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaa,EACb,KAAMX,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EAEC,SAAAW,EACH,GACF,GACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "gaTrack", "useHeadlessContext", "ROUNDED_BRANDS", "NoneProductValue", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "pageCommon", "brand", "isLogin", "rounded", "isDisabled", "redeemButtonText", "e"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Fragment as Q,jsx as t,jsxs as i}from"react/jsx-runtime";import{Button as z,Container as O,Heading as p,Picture as f,Text as A}from"@anker-in/headless-ui";import{ChevronDownIcon as P,ChevronUpIcon as G}from"@heroicons/react/24/outline";import{motion as W}from"framer-motion";import{useMemo as j,useState as a}from"react";import{TaskType as b}from"./type";import{useActions as q}from"./useActions";import{useCreditsContext as H}from"../context/provider";import{classNames as c,useHeadlessContext as _}from"@anker-in/lib";import{useRegistration as E}from"../../registration";import{CreditsUploadReceiptModal as V}from"../modal/creditsUploadReceiptModal";import{CreditsSubscribeModal as J}from"../modal/subscribeModal";import{roundedBrands as K}from"../const";const de=({copy:s,classNames:h})=>{const[o,v]=a(!1),{profile:I}=H(),{authCodeActivate:y}=E(),{brand:L}=_(),g=K.includes(L),m=!!I,[M,k]=a(!1),[R,C]=a(!1),[N,T]=a(!1),[w,U]=a(!1),{actions:u}=q({copy:s,subscribe:{openSubscribePopup:()=>C(!0),isSuccess:N},uploadReceipt:{openUploadReceiptPopup:()=>k(!0),isSuccess:w}}),D=j(()=>{const e=s.list.map(n=>{if(!u[n.id])return;const{finished:l,notLogin:F,notFinished:x,completed:B}=u[n.id];let d="",r,S;return m?l?(d=B.buttonLabel,r=void 0):(d=x.buttonLabel,r=x.handleClick,S=x.link):(d=F.buttonLabel,r=F.handleClick),{...n,buttonLabel:d,handleClick:r,finished:l,link:S}}).filter(Boolean);return m?e.sort((n,l)=>n?.finished&&!l?.finished?1:!n?.finished&&l?.finished?-1:0):e},[u,s.list,m]);return i(O,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[i("div",{className:c("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!g&&"rounded-none"),children:[t(p,{as:"h2",size:4,html:s?.title,className:"text-center l:pl-[16px] l:text-left"}),i("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[i("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[t(p,{size:3,as:"h3",html:s.subtitle,className:h?.subtitle}),i("div",{className:"mt-[8px] flex items-center",children:[s.creditsIcon?.url&&t(f,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:s.creditsIcon.url,alt:s.creditsIcon.alt||"credits"}),t(p,{html:s.equalCredits,size:4,as:"h3",className:c("mt-2 text-white md:text-[24px]",h?.equalCreditsText)})]})]}),t(f,{className:"w-full laptop:w-[50%]",source:s.mainImage?.url})]}),i("div",{className:"relative",children:[i(W.div,{className:c("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:o?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!o&&window.screen.width<768){const e=document.getElementById("ways-to-get-credits");e&&e.scrollIntoView({behavior:"smooth",block:"end"})}},children:[D.map(e=>i("div",{className:c("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!g&&"rounded-none"),children:[i("div",{children:[t(p,{as:"h4",html:e.title,size:2,className:"text-pretty"}),i("div",{className:"mt-[4px] flex items-center",children:[t(f,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),t(A,{as:"p",html:e.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),e.handleClick&&!(e.id===b.UploadReceipt&&w)&&!(e.id===b.Activate&&y.isActivateSuccess)&&!(e.id===b.Subscribe&&N)?t(z,{as:e.link?"a":"button",...e.link&&{href:e.link},...e.handleClick&&{onClick:e.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:e.buttonLabel}):t(z,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:e.buttonLabel})]},e.id)),!o&&t("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),o?t("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{v(!1)},children:t(G,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):t(Q,{children:t("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:t("button",{className:"w-fit",onClick:()=>v(!o),children:t(P,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),s.receipt&&t(V,{isOpen:M,onClose:()=>{k(!1)},copy:s.receipt,onSuccess:()=>{U(!0)}}),s.subscribe&&t(J,{copy:s.subscribe,onSuccess:()=>{T(!0)},isOpen:R,onClose:()=>{C(!1)}})]})};export{de as CreditsWaysToGetCredits};
1
+ import{Fragment as Q,jsx as t,jsxs as i}from"react/jsx-runtime";import{Button as z,Container as A,Heading as p,Picture as b,Text as B}from"@anker-in/headless-ui";import{ChevronDownIcon as P,ChevronUpIcon as G}from"@heroicons/react/24/outline";import{motion as W}from"framer-motion";import{useMemo as _,useState as a}from"react";import{TaskType as h}from"./type";import{useActions as j}from"./useActions";import{useCreditsContext as q}from"../context/provider";import{classNames as c,useHeadlessContext as E,ROUNDED_BRANDS as H}from"@anker-in/lib";import{useRegistration as V}from"../../registration";import{CreditsUploadReceiptModal as J}from"../modal/creditsUploadReceiptModal";import{CreditsSubscribeModal as K}from"../modal/subscribeModal";const ae=({copy:s,classNames:v})=>{const[l,g]=a(!1),{profile:I}=q(),{authCodeActivate:y}=V(),{brand:D}=E(),k=H.includes(D),m=!!I,[R,C]=a(!1),[T,u]=a(!1),[N,U]=a(!1),[w,L]=a(!1),{actions:x}=j({copy:s,subscribe:{openSubscribePopup:()=>u(!0),isSuccess:N},uploadReceipt:{openUploadReceiptPopup:()=>C(!0),isSuccess:w}}),M=_(()=>{const e=s.list.map(n=>{if(!x[n.id])return;const{finished:o,notLogin:F,notFinished:f,completed:O}=x[n.id];let d="",r,S;return m?o?(d=O.buttonLabel,r=void 0):(d=f.buttonLabel,r=f.handleClick,S=f.link):(d=F.buttonLabel,r=F.handleClick),{...n,buttonLabel:d,handleClick:r,finished:o,link:S}}).filter(Boolean);return m?e.sort((n,o)=>n?.finished&&!o?.finished?1:!n?.finished&&o?.finished?-1:0):e},[x,s.list,m]);return i(A,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[i("div",{className:c("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!k&&"rounded-none"),children:[t(p,{as:"h2",size:4,html:s?.title,className:"text-center l:pl-[16px] l:text-left"}),i("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[i("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[t(p,{size:3,as:"h3",html:s.subtitle,className:v?.subtitle}),i("div",{className:"mt-[8px] flex items-center",children:[s.creditsIcon?.url&&t(b,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:s.creditsIcon.url,alt:s.creditsIcon.alt||"credits"}),t(p,{html:s.equalCredits,size:4,as:"h3",className:c("mt-2 text-white md:text-[24px]",v?.equalCreditsText)})]})]}),t(b,{className:"w-full laptop:w-[50%]",source:s.mainImage?.url})]}),i("div",{className:"relative",children:[i(W.div,{className:c("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:l?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!l&&window.screen.width<768){const e=document.getElementById("ways-to-get-credits");e&&e.scrollIntoView({behavior:"smooth",block:"end"})}},children:[M.map(e=>i("div",{className:c("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!k&&"rounded-none"),children:[i("div",{children:[t(p,{as:"h4",html:e.title,size:2,className:"text-pretty"}),i("div",{className:"mt-[4px] flex items-center",children:[t(b,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),t(B,{as:"p",html:e.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),e.handleClick&&!(e.id===h.UploadReceipt&&w)&&!(e.id===h.Activate&&y.isActivateSuccess)&&!(e.id===h.Subscribe&&N)?t(z,{as:e.link?"a":"button",...e.link&&{href:e.link},...e.handleClick&&{onClick:e.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:e.buttonLabel}):t(z,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:e.buttonLabel})]},e.id)),!l&&t("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),l?t("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{g(!1)},children:t(G,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):t(Q,{children:t("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:t("button",{className:"w-fit",onClick:()=>g(!l),children:t(P,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),s.receipt&&t(J,{isOpen:R,onClose:()=>{C(!1)},copy:s.receipt,onSuccess:()=>{L(!0)}}),s.subscribe&&t(K,{copy:s.subscribe,onSuccess:()=>{U(!0),setTimeout(()=>{u(!1)},3e3)},isOpen:T,onClose:()=>{u(!1)}})]})};export{ae as CreditsWaysToGetCredits};
2
2
  //# sourceMappingURL=CreditsWaysToGetCredits.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx"],
4
- "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\nimport { roundedBrands } from '../const'\n\nexport const CreditsWaysToGetCredits = ({ copy, classNames }: CreditsWaysToGetCreditsProps) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id=\"ways-to-get-credits\" className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div\n className={cn(\n 'rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]',\n !rounded && 'rounded-none'\n )}\n >\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <motion.div\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2'\n )}\n initial={{ height: 512 }}\n animate={{ height: showMore ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && window.screen.width < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]',\n !rounded && 'rounded-none'\n )}\n >\n <div>\n <Heading as=\"h4\" html={item.title} size={2} className=\"text-pretty\" />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text as=\"p\" html={item.credits} size={2} className=\"ml-[4px] mt-[6px] lg-desktop:text-[18px]\" />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)' }}\n ></div>\n )}\n </motion.div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
5
- "mappings": "AAqGQ,OAiGI,YAAAA,EAjGJ,OAAAC,EAII,QAAAC,MAJJ,oBArGR,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,8BAC/C,OAAS,UAAAC,MAAc,gBACvB,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAS,YAAAC,MAAmD,SAC5D,OAAS,cAAAC,MAAkB,eAC3B,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,OAAS,mBAAAC,MAAuB,qBAChC,OAAS,6BAAAC,MAAiC,qCAC1C,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,iBAAAC,MAAqB,WAEvB,MAAMC,GAA0B,CAAC,CAAE,KAAAC,EAAM,WAAAC,CA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tB,EAACkB,EAAA,CACC,OAAQa,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMV,EAAK,QACX,UAAW,IAAM,CACfgB,EAA0B,EAAI,CAChC,EACF,EAEDhB,EAAK,WACJtB,EAACmB,EAAA,CACC,KAAMG,EAAK,UACX,UAAW,IAAM,CACfc,EAAsB,EAAI,CAC5B,EACA,OAAQH,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
6
- "names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "ChevronDownIcon", "ChevronUpIcon", "motion", "useMemo", "useState", "TaskType", "useActions", "useCreditsContext", "cn", "useHeadlessContext", "useRegistration", "CreditsUploadReceiptModal", "CreditsSubscribeModal", "roundedBrands", "CreditsWaysToGetCredits", "copy", "classNames", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "section"]
4
+ "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\n\nexport const CreditsWaysToGetCredits = ({ copy, classNames }: CreditsWaysToGetCreditsProps) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id=\"ways-to-get-credits\" className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div\n className={cn(\n 'rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]',\n !rounded && 'rounded-none'\n )}\n >\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <motion.div\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2'\n )}\n initial={{ height: 512 }}\n animate={{ height: showMore ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && window.screen.width < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]',\n !rounded && 'rounded-none'\n )}\n >\n <div>\n <Heading as=\"h4\" html={item.title} size={2} className=\"text-pretty\" />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text as=\"p\" html={item.credits} size={2} className=\"ml-[4px] mt-[6px] lg-desktop:text-[18px]\" />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)' }}\n ></div>\n )}\n </motion.div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "AAoGQ,OAiGI,YAAAA,EAjGJ,OAAAC,EAII,QAAAC,MAJJ,oBApGR,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,8BAC/C,OAAS,UAAAC,MAAc,gBACvB,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAS,YAAAC,MAAmD,SAC5D,OAAS,cAAAC,MAAkB,eAC3B,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,cAAcC,EAAI,sBAAAC,EAAoB,kBAAAC,MAAsB,gBACrE,OAAS,mBAAAC,MAAuB,qBAChC,OAAS,6BAAAC,MAAiC,qCAC1C,OAAS,yBAAAC,MAA6B,0BAE/B,MAAMC,GAA0B,CAAC,CAAE,KAAAC,EAAM,WAAAC,CAAW,IAAoC,CAC7F,KAAM,CAAC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,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMV,EAAK,QACX,UAAW,IAAM,CACfgB,EAA0B,EAAI,CAChC,EACF,EAEDhB,EAAK,WACJtB,EAACoB,EAAA,CACC,KAAME,EAAK,UACX,UAAW,IAAM,CACfc,EAAsB,EAAI,EAC1B,WAAW,IAAM,CACfF,EAAwB,EAAK,CAC/B,EAAG,GAAI,CACT,EACA,OAAQD,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "ChevronDownIcon", "ChevronUpIcon", "motion", "useMemo", "useState", "TaskType", "useActions", "useCreditsContext", "cn", "useHeadlessContext", "ROUNDED_BRANDS", "useRegistration", "CreditsUploadReceiptModal", "CreditsSubscribeModal", "CreditsWaysToGetCredits", "copy", "classNames", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "section"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{useHeadlessContext as C,gaTrack as P}from"@anker-in/lib";import{TaskType as t}from"./type";import{useCreditsContext as g}from"../context/provider";import{useMemo as d}from"react";import v from"../context/hooks/useReceiptUploaded";import{useFirstPurchaseFinished as F}from"../context/hooks/useFirstPurchaseFinished";import{useSubscribed as S}from"../context/hooks/useSubscribed";import{useRegistration as w}from"../../registration";const W=({copy:e,subscribe:u,uploadReceipt:c,gaParameters:n})=>{const{openSignUpPopup:a,gtm:m,profile:o}=g(),{authCodeActivate:p}=w(),l=S(),s=F(),b=v(),{appName:h,passportUrl:k}=C(),r=d(()=>(o?.first_name||o?.last_name)&&o?.phone_number&&o?.dob,[o]);return d(()=>{const i=({buttonName:L,id:f,callback:N})=>{P({event:"ga4Event",event_name:"lp_button",member_active_status:o?.activated?"active":"not active",event_parameters:{page_group:m.pageGroup,position:n?.position||e.title,button_name:L,info:f}}),N()};return{actions:{[t.Activate]:{finished:o?.activated,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Activate})},notFinished:{buttonLabel:e?.activate,handleClick:()=>i({buttonName:e?.activate,callback:()=>p.open(),id:t.Activate})},completed:{buttonLabel:e?.completed}},[t.Subscribe]:{finished:l,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Subscribe})},notFinished:{buttonLabel:e?.subscribeLabel,handleClick:()=>i({buttonName:e?.subscribeLabel,callback:()=>u.openSubscribePopup(),id:t.Subscribe})},completed:{buttonLabel:e?.completed}},[t.CompleteProfile]:{finished:r,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.CompleteProfile})},notFinished:{buttonLabel:e?.completeProfile,link:`${k}/account/profile?app=${h}`,handleClick:()=>i({buttonName:e?.completeProfile,callback:()=>{},id:t.CompleteProfile})},completed:{buttonLabel:e?.completed}},[t.FirstPurchase]:{finished:s,notLogin:{buttonLabel:e?.makeFirstPurchase,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:a,id:t.FirstPurchase})},notFinished:{buttonLabel:e?.makeFirstPurchase,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:()=>{},id:t.FirstPurchase})},completed:{buttonLabel:e?.completed}},[t.UploadReceipt]:{finished:b,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.UploadReceipt})},notFinished:{buttonLabel:e?.uploadReceipt,handleClick:()=>i({buttonName:e?.uploadReceipt,callback:()=>c.openUploadReceiptPopup(),id:t.UploadReceipt})},completed:{buttonLabel:e?.completed}},[t.Shop]:{finished:!1,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Shop})},notFinished:{buttonLabel:e?.shopNow,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.shopNow,callback:()=>{},id:t.Shop})},completed:{buttonLabel:e?.completed}}}}},[o?.activated,e?.joinNow,e?.activate,e?.completed,e?.subscribe,e?.completeProfile,e?.makeFirstPurchase,e?.uploadReceipt,e?.shopNow,e.title,e?.goShopLink,l,r,s,b,n?.position,a])};export{W as useActions};
1
+ import{useHeadlessContext as C,gaTrack as P}from"@anker-in/lib";import{TaskType as t}from"./type";import{useCreditsContext as g}from"../context/provider";import{useMemo as d}from"react";import v from"../context/hooks/useReceiptUploaded";import{useFirstPurchaseFinished as F}from"../context/hooks/useFirstPurchaseFinished";import{useSubscribed as S}from"../context/hooks/useSubscribed";import{useRegistration as w}from"../../registration";const W=({copy:e,subscribe:c,uploadReceipt:m,gaParameters:n})=>{const{openSignUpPopup:a,gtm:p,profile:o}=g(),{authCodeActivate:l}=w(),s=S(),b=F(),r=v(),{appName:h,passportUrl:k}=C(),u=d(()=>(o?.first_name||o?.last_name)&&o?.phone_number&&o?.dob,[o]);return d(()=>{const i=({buttonName:L,id:f,callback:N})=>{P({event:"ga4Event",event_name:"lp_button",member_active_status:o?.activated?"active":"not active",event_parameters:{page_group:p.pageGroup,position:n?.position||e.title,button_name:L,info:f}}),N()};return{actions:{[t.Activate]:{finished:o?.activated,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Activate})},notFinished:{buttonLabel:e?.activate,handleClick:()=>i({buttonName:e?.activate,callback:()=>{l.setAutoSendEmail(!0),l.open()},id:t.Activate})},completed:{buttonLabel:e?.completed}},[t.Subscribe]:{finished:s,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Subscribe})},notFinished:{buttonLabel:e?.subscribeLabel,handleClick:()=>i({buttonName:e?.subscribeLabel,callback:()=>c.openSubscribePopup(),id:t.Subscribe})},completed:{buttonLabel:e?.completed}},[t.CompleteProfile]:{finished:u,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.CompleteProfile})},notFinished:{buttonLabel:e?.completeProfile,link:`${k}/account/profile?app=${h}`,handleClick:()=>i({buttonName:e?.completeProfile,callback:()=>{},id:t.CompleteProfile})},completed:{buttonLabel:e?.completed}},[t.FirstPurchase]:{finished:b,notLogin:{buttonLabel:e?.makeFirstPurchase,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:a,id:t.FirstPurchase})},notFinished:{buttonLabel:e?.makeFirstPurchase,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:()=>{},id:t.FirstPurchase})},completed:{buttonLabel:e?.completed}},[t.UploadReceipt]:{finished:r,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.UploadReceipt})},notFinished:{buttonLabel:e?.uploadReceipt,handleClick:()=>i({buttonName:e?.uploadReceipt,callback:()=>m.openUploadReceiptPopup(),id:t.UploadReceipt})},completed:{buttonLabel:e?.completed}},[t.Shop]:{finished:!1,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Shop})},notFinished:{buttonLabel:e?.shopNow,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.shopNow,callback:()=>{},id:t.Shop})},completed:{buttonLabel:e?.completed}}}}},[o?.activated,e?.joinNow,e?.activate,e?.completed,e?.subscribe,e?.completeProfile,e?.makeFirstPurchase,e?.uploadReceipt,e?.shopNow,e.title,e?.goShopLink,s,u,b,r,n?.position,a])};export{W as useActions};
2
2
  //# sourceMappingURL=useActions.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/useActions.ts"],
4
- "sourcesContent": ["import { useHeadlessContext, gaTrack } from '@anker-in/lib'\n\nimport { TaskType } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useMemo } from 'react'\nimport useReceiptUploaded from '../context/hooks/useReceiptUploaded'\nimport { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'\nimport { useSubscribed } from '../context/hooks/useSubscribed'\nimport type { CreditsWaysToGetCreditsCopy } from './type'\n\nimport { useRegistration } from '../../registration'\n\nexport const useActions = ({\n copy,\n subscribe,\n uploadReceipt,\n gaParameters,\n}: {\n copy: CreditsWaysToGetCreditsCopy\n subscribe: {\n openSubscribePopup: () => void\n isSuccess: boolean\n }\n uploadReceipt: {\n openUploadReceiptPopup: () => void\n isSuccess: boolean\n }\n gaParameters?: {\n position: string\n }\n}) => {\n const { openSignUpPopup, gtm, profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const isSubscribed = useSubscribed()\n const firstPurchaseFinished = useFirstPurchaseFinished()\n const uploadedReceipt = useReceiptUploaded()\n const { appName, passportUrl } = useHeadlessContext()\n\n const profileCompleted = useMemo(() => {\n return (profile?.first_name || profile?.last_name) && profile?.phone_number && profile?.dob\n }, [profile])\n\n return useMemo(() => {\n const handleClickWithTrack = ({\n buttonName,\n id,\n callback,\n }: {\n buttonName: string\n id?: string\n callback: () => void\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: gtm.pageGroup,\n position: gaParameters?.position || copy.title,\n button_name: buttonName,\n info: id,\n },\n })\n callback()\n }\n return {\n actions: {\n [TaskType.Activate]: {\n finished: profile?.activated,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Activate }),\n },\n notFinished: {\n buttonLabel: copy?.activate,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.activate,\n callback: () => authCodeActivate.open(),\n id: TaskType.Activate,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Subscribe]: {\n finished: isSubscribed,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Subscribe }),\n },\n notFinished: {\n buttonLabel: copy?.subscribeLabel,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.subscribeLabel,\n callback: () => subscribe.openSubscribePopup(),\n id: TaskType.Subscribe,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.CompleteProfile]: {\n finished: profileCompleted,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.CompleteProfile,\n }),\n },\n notFinished: {\n buttonLabel: copy?.completeProfile,\n link: `${passportUrl}/account/profile?app=${appName}`,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.completeProfile,\n callback: () => {},\n id: TaskType.CompleteProfile,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.FirstPurchase]: {\n finished: firstPurchaseFinished,\n notLogin: {\n buttonLabel: copy?.makeFirstPurchase,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: openSignUpPopup,\n id: TaskType.FirstPurchase,\n }),\n },\n notFinished: {\n buttonLabel: copy?.makeFirstPurchase,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: () => {},\n id: TaskType.FirstPurchase,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.UploadReceipt]: {\n finished: uploadedReceipt,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.UploadReceipt,\n }),\n },\n notFinished: {\n buttonLabel: copy?.uploadReceipt,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.uploadReceipt,\n callback: () => uploadReceipt.openUploadReceiptPopup(),\n id: TaskType.UploadReceipt,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Shop]: {\n finished: false,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.Shop,\n }),\n },\n notFinished: {\n buttonLabel: copy?.shopNow,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.shopNow,\n callback: () => {},\n id: TaskType.Shop,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n },\n }\n }, [\n profile?.activated,\n copy?.joinNow,\n copy?.activate,\n copy?.completed,\n copy?.subscribe,\n copy?.completeProfile,\n copy?.makeFirstPurchase,\n copy?.uploadReceipt,\n copy?.shopNow,\n copy.title,\n copy?.goShopLink,\n isSubscribed,\n profileCompleted,\n firstPurchaseFinished,\n uploadedReceipt,\n gaParameters?.position,\n openSignUpPopup,\n ])\n}\n"],
5
- "mappings": "AAAA,OAAS,sBAAAA,EAAoB,WAAAC,MAAe,gBAE5C,OAAS,YAAAC,MAAgB,SACzB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,WAAAC,MAAe,QACxB,OAAOC,MAAwB,sCAC/B,OAAS,4BAAAC,MAAgC,4CACzC,OAAS,iBAAAC,MAAqB,iCAG9B,OAAS,mBAAAC,MAAuB,qBAEzB,MAAMC,EAAa,CAAC,CACzB,KAAAC,EACA,UAAAC,EACA,cAAAC,EACA,aAAAC,CACF,IAaM,CACJ,KAAM,CAAE,gBAAAC,EAAiB,IAAAC,EAAK,QAAAC,CAAQ,EAAIb,EAAkB,EACtD,CAAE,iBAAAc,CAAiB,EAAIT,EAAgB,EACvCU,EAAeX,EAAc,EAC7BY,EAAwBb,EAAyB,EACjDc,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ACL,EACA,YAAa,CACX,YAAaQ,GAAM,QACnB,KAAMA,GAAM,WACZ,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,QAClB,SAAU,IAAM,CAAC,EACjB,GAAIR,EAAS,IACf,CAAC,CACL,EACA,UAAW,CACT,YAAaQ,GAAM,SACrB,CACF,CACF,CACF,CACF,EAAG,CACDM,GAAS,UACTN,GAAM,QACNA,GAAM,SACNA,GAAM,UACNA,GAAM,UACNA,GAAM,gBACNA,GAAM,kBACNA,GAAM,cACNA,GAAM,QACNA,EAAK,MACLA,GAAM,WACNQ,EACAK,EACAJ,EACAC,EACAP,GAAc,SACdC,CACF,CAAC,CACH",
4
+ "sourcesContent": ["import { useHeadlessContext, gaTrack } from '@anker-in/lib'\n\nimport { TaskType } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useMemo } from 'react'\nimport useReceiptUploaded from '../context/hooks/useReceiptUploaded'\nimport { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'\nimport { useSubscribed } from '../context/hooks/useSubscribed'\nimport type { CreditsWaysToGetCreditsCopy } from './type'\n\nimport { useRegistration } from '../../registration'\n\nexport const useActions = ({\n copy,\n subscribe,\n uploadReceipt,\n gaParameters,\n}: {\n copy: CreditsWaysToGetCreditsCopy\n subscribe: {\n openSubscribePopup: () => void\n isSuccess: boolean\n }\n uploadReceipt: {\n openUploadReceiptPopup: () => void\n isSuccess: boolean\n }\n gaParameters?: {\n position: string\n }\n}) => {\n const { openSignUpPopup, gtm, profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const isSubscribed = useSubscribed()\n const firstPurchaseFinished = useFirstPurchaseFinished()\n const uploadedReceipt = useReceiptUploaded()\n const { appName, passportUrl } = useHeadlessContext()\n\n const profileCompleted = useMemo(() => {\n return (profile?.first_name || profile?.last_name) && profile?.phone_number && profile?.dob\n }, [profile])\n\n return useMemo(() => {\n const handleClickWithTrack = ({\n buttonName,\n id,\n callback,\n }: {\n buttonName: string\n id?: string\n callback: () => void\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: gtm.pageGroup,\n position: gaParameters?.position || copy.title,\n button_name: buttonName,\n info: id,\n },\n })\n callback()\n }\n return {\n actions: {\n [TaskType.Activate]: {\n finished: profile?.activated,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Activate }),\n },\n notFinished: {\n buttonLabel: copy?.activate,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.activate,\n callback: () => {\n authCodeActivate.setAutoSendEmail(true)\n authCodeActivate.open()\n },\n id: TaskType.Activate,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Subscribe]: {\n finished: isSubscribed,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Subscribe }),\n },\n notFinished: {\n buttonLabel: copy?.subscribeLabel,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.subscribeLabel,\n callback: () => subscribe.openSubscribePopup(),\n id: TaskType.Subscribe,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.CompleteProfile]: {\n finished: profileCompleted,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.CompleteProfile,\n }),\n },\n notFinished: {\n buttonLabel: copy?.completeProfile,\n link: `${passportUrl}/account/profile?app=${appName}`,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.completeProfile,\n callback: () => {},\n id: TaskType.CompleteProfile,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.FirstPurchase]: {\n finished: firstPurchaseFinished,\n notLogin: {\n buttonLabel: copy?.makeFirstPurchase,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: openSignUpPopup,\n id: TaskType.FirstPurchase,\n }),\n },\n notFinished: {\n buttonLabel: copy?.makeFirstPurchase,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: () => {},\n id: TaskType.FirstPurchase,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.UploadReceipt]: {\n finished: uploadedReceipt,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.UploadReceipt,\n }),\n },\n notFinished: {\n buttonLabel: copy?.uploadReceipt,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.uploadReceipt,\n callback: () => uploadReceipt.openUploadReceiptPopup(),\n id: TaskType.UploadReceipt,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Shop]: {\n finished: false,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.Shop,\n }),\n },\n notFinished: {\n buttonLabel: copy?.shopNow,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.shopNow,\n callback: () => {},\n id: TaskType.Shop,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n },\n }\n }, [\n profile?.activated,\n copy?.joinNow,\n copy?.activate,\n copy?.completed,\n copy?.subscribe,\n copy?.completeProfile,\n copy?.makeFirstPurchase,\n copy?.uploadReceipt,\n copy?.shopNow,\n copy.title,\n copy?.goShopLink,\n isSubscribed,\n profileCompleted,\n firstPurchaseFinished,\n uploadedReceipt,\n gaParameters?.position,\n openSignUpPopup,\n ])\n}\n"],
5
+ "mappings": "AAAA,OAAS,sBAAAA,EAAoB,WAA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R,EAAS,aAAa,EAAG,CACxB,SAAUkB,EACV,SAAU,CACR,YAAaV,GAAM,QACnB,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,QAClB,SAAUI,EACV,GAAIZ,EAAS,aACf,CAAC,CACL,EACA,YAAa,CACX,YAAaQ,GAAM,cACnB,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,cAClB,SAAU,IAAME,EAAc,uBAAuB,EACrD,GAAIV,EAAS,aACf,CAAC,CACL,EACA,UAAW,CACT,YAAaQ,GAAM,SACrB,CACF,EACA,CAACR,EAAS,IAAI,EAAG,CACf,SAAU,GACV,SAAU,CACR,YAAaQ,GAAM,QACnB,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,QAClB,SAAUI,EACV,GAAIZ,EAAS,IACf,CAAC,CACL,EACA,YAAa,CACX,YAAaQ,GAAM,QACnB,KAAMA,GAAM,WACZ,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,QAClB,SAAU,IAAM,CAAC,EACjB,GAAIR,EAAS,IACf,CAAC,CACL,EACA,UAAW,CACT,YAAaQ,GAAM,SACrB,CACF,CACF,CACF,CACF,EAAG,CACDM,GAAS,UACTN,GAAM,QACNA,GAAM,SACNA,GAAM,UACNA,GAAM,UACNA,GAAM,gBACNA,GAAM,kBACNA,GAAM,cACNA,GAAM,QACNA,EAAK,MACLA,GAAM,WACNQ,EACAK,EACAJ,EACAC,EACAP,GAAc,SACdC,CACF,CAAC,CACH",
6
6
  "names": ["useHeadlessContext", "gaTrack", "TaskType", "useCreditsContext", "useMemo", "useReceiptUploaded", "useFirstPurchaseFinished", "useSubscribed", "useRegistration", "useActions", "copy", "subscribe", "uploadReceipt", "gaParameters", "openSignUpPopup", "gtm", "profile", "authCodeActivate", "isSubscribed", "firstPurchaseFinished", "uploadedReceipt", "appName", "passportUrl", "profileCompleted", "handleClickWithTrack", "buttonName", "id", "callback"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as s,jsxs as l}from"react/jsx-runtime";import{Tabs as $,TabsList as z,TabsTrigger as q,Picture as B}from"@anker-in/headless-ui";import m from"classnames";import K from"copy-to-clipboard";import V from"dayjs";import{useCallback as w,useMemo as p,useState as c}from"react";import{ApprovalStatus as g,AlpcConsumeType as n,RewardType as t}from"../context/const";import{CreditsModalContainer as G}from"./modalContainer";import J from"./tip";import Q from"./loadingDots";import S from"../context/hooks/useMyRewards";import{useHeadlessContext as W}from"@anker-in/lib";import{roundedBrands as X}from"../const";function Z({data:o,...a}){const[r,R]=c(n.Coupon),{brand:F}=W(),b=X.includes(F),[d,h]=c(1),[u,_]=c(1),[A,v]=c(-1),D=p(()=>{const e=[];return o.couponTab&&e.push({title:o.couponTab,type:n.Coupon}),o.productTab&&e.push({title:o.productTab,type:n.Product}),e},[o.couponTab,o.productTab]),O=p(()=>({page:a.isOpen?u:0,pageSize:1e3,consumeType:n.Product}),[a.isOpen,u]),I=p(()=>({page:a.isOpen?d:0,pageSize:1e3,consumeType:n.Coupon}),[a.isOpen,d]),{myRewards:x=[],canNext:y,isLoading:k}=S(I),{myRewards:C=[],canNext:T,isLoading:U}=S(O),N=p(()=>r===n.Coupon?x.map(e=>({title:e.goods_title,value:e.consume_credits,type:t.Received,date:new Date(e.create_time*1e3),couponCode:e.coupon_code,orderNumber:""})):r===n.Product?C.map(e=>{let i=t.Pending;return e.fulfillment_status&&e.fulfillment_status!=="null"?e.fulfillment_status==="fulfilled"?i=t.Fulfilled:i=t.Unfulfilled:e.approval_status===g.Success||e.approval_status===g.DoubleConfirm?i=t.ApproveSuccess:e.approval_status===g.Failed&&(i=t.Failed),{title:e.goods_title,value:e.consume_credits,type:i,date:new Date(e.create_time*1e3),orderNumber:e.order_number,couponCode:""}}):[],[r,C,x]),L=p(()=>r===n.Coupon?y:r===n.Product?T:!1,[r,y,T]),Y=p(()=>({[t.Received]:o.receivedLabel,[t.Pending]:o.pendingLabel,[t.ApproveFail]:o.failedLabel,[t.ApproveSuccess]:o.approveSuccessLabel,[t.Unfulfilled]:o.unfulfilledLabel,[t.Fulfilled]:o.fulfilledLabel,[t.Failed]:o.failedLabel}),[o]),P=p(()=>({[t.Received]:"",[t.Pending]:o.pendingTip,[t.ApproveFail]:"",[t.ApproveSuccess]:o.confirmedTip,[t.Unfulfilled]:o.processingTip,[t.Fulfilled]:o.ShippedTip,[t.Failed]:""}),[o]),j=p(()=>({[t.Received]:"#52C41A",[t.Pending]:"#999",[t.ApproveFail]:"#F84D4F",[t.ApproveSuccess]:"#999",[t.Unfulfilled]:"#999",[t.Fulfilled]:"#999",[t.Failed]:"#F84D4F"}),[]),E=w(()=>{L&&(r===n.Coupon?h(d+1):r===n.Product&&_(u+1))},[r,u,d,L]),H=w((e,i)=>{v(i),K(e),setTimeout(()=>{v(-1)},2e3)},[]),M=r===n.Coupon?k:U;return l(G,{title:o.title,className:m("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...a,onScrollEnd:E,children:[s("div",{className:"",children:s($,{align:"left",shape:b?"rounded":"square",value:r.toString(),onValueChange:e=>{R(Number(e))},children:s(z,{children:D.map(e=>s(q,{value:e.type.toString(),children:e.title},e.type))})})}),M&&s("div",{className:"flex h-full flex-col items-center justify-center",children:s(Q,{})}),!M&&s("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:N.length>0?s("div",{className:"grid gap-[18px] md:gap-[12px]",children:N.map((e,i)=>l("div",{className:"grid gap-[8px]",children:[e?.orderNumber&&l("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",e.orderNumber]}),l("div",{className:m("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!b&&"rounded-none"),children:[l("div",{className:"grid gap-[4px]",children:[s("div",{className:"text-[16px] font-bold leading-[1.4]",children:e.title}),l("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",e.value," ",o?.pointUnit]}),l("div",{className:"text-[14px] font-semibold text-[#999]",children:[e?.couponCode?`${o?.code||"Code"}: ${e.couponCode} `:"",e?.couponCode&&s("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{H(e.couponCode,i)},role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&f.preventDefault()},children:A===i?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),l("div",{className:"grid gap-[4px] text-right",children:[l("div",{className:m("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${j[e.type]}]`),children:[s("span",{children:Y[e.type]}),P[e.type]&&s(J,{info:P[e.type],index:i})]}),s("div",{className:"text-[14px] font-semibold text-[#999]",children:V(e.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},i))}):l("div",{className:"flex h-full flex-col items-center justify-center",children:[s(B,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),s("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var ce=Z;export{ce as default};
1
+ import{jsx as s,jsxs as l}from"react/jsx-runtime";import{Tabs as $,TabsList as z,TabsTrigger as q,Picture as B}from"@anker-in/headless-ui";import m from"classnames";import K from"copy-to-clipboard";import V from"dayjs";import{useCallback as w,useMemo as p,useState as c}from"react";import{ApprovalStatus as g,AlpcConsumeType as n,RewardType as t}from"../context/const";import{CreditsModalContainer as G}from"./modalContainer";import J from"./tip";import Q from"./loadingDots";import R from"../context/hooks/useMyRewards";import{useHeadlessContext as W,ROUNDED_BRANDS as X}from"@anker-in/lib";function Z({data:o,...a}){const[r,S]=c(n.Coupon),{brand:F}=W(),b=X.includes(F),[d,_]=c(1),[u,h]=c(1),[D,v]=c(-1),A=p(()=>{const e=[];return o.couponTab&&e.push({title:o.couponTab,type:n.Coupon}),o.productTab&&e.push({title:o.productTab,type:n.Product}),e},[o.couponTab,o.productTab]),O=p(()=>({page:a.isOpen?u:0,pageSize:1e3,consumeType:n.Product}),[a.isOpen,u]),I=p(()=>({page:a.isOpen?d:0,pageSize:1e3,consumeType:n.Coupon}),[a.isOpen,d]),{myRewards:x=[],canNext:y,isLoading:U}=R(I),{myRewards:C=[],canNext:N,isLoading:k}=R(O),T=p(()=>r===n.Coupon?x.map(e=>({title:e.goods_title,value:e.consume_credits,type:t.Received,date:new Date(e.create_time*1e3),couponCode:e.coupon_code,orderNumber:""})):r===n.Product?C.map(e=>{let i=t.Pending;return e.fulfillment_status&&e.fulfillment_status!=="null"?e.fulfillment_status==="fulfilled"?i=t.Fulfilled:i=t.Unfulfilled:e.approval_status===g.Success||e.approval_status===g.DoubleConfirm?i=t.ApproveSuccess:e.approval_status===g.Failed&&(i=t.Failed),{title:e.goods_title,value:e.consume_credits,type:i,date:new Date(e.create_time*1e3),orderNumber:e.order_number,couponCode:""}}):[],[r,C,x]),L=p(()=>r===n.Coupon?y:r===n.Product?N:!1,[r,y,N]),E=p(()=>({[t.Received]:o.receivedLabel,[t.Pending]:o.pendingLabel,[t.ApproveFail]:o.failedLabel,[t.ApproveSuccess]:o.approveSuccessLabel,[t.Unfulfilled]:o.unfulfilledLabel,[t.Fulfilled]:o.fulfilledLabel,[t.Failed]:o.failedLabel}),[o]),P=p(()=>({[t.Received]:"",[t.Pending]:o.pendingTip,[t.ApproveFail]:"",[t.ApproveSuccess]:o.confirmedTip,[t.Unfulfilled]:o.processingTip,[t.Fulfilled]:o.ShippedTip,[t.Failed]:""}),[o]),Y=p(()=>({[t.Received]:"#52C41A",[t.Pending]:"#999",[t.ApproveFail]:"#F84D4F",[t.ApproveSuccess]:"#999",[t.Unfulfilled]:"#999",[t.Fulfilled]:"#999",[t.Failed]:"#F84D4F"}),[]),j=w(()=>{L&&(r===n.Coupon?_(d+1):r===n.Product&&h(u+1))},[r,u,d,L]),H=w((e,i)=>{v(i),K(e),setTimeout(()=>{v(-1)},2e3)},[]),M=r===n.Coupon?U:k;return l(G,{title:o.title,className:m("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...a,onScrollEnd:j,children:[s("div",{className:"",children:s($,{align:"left",shape:b?"rounded":"square",value:r.toString(),onValueChange:e=>{S(Number(e))},children:s(z,{children:A.map(e=>s(q,{value:e.type.toString(),children:e.title},e.type))})})}),M&&s("div",{className:"flex h-full flex-col items-center justify-center",children:s(Q,{})}),!M&&s("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:T.length>0?s("div",{className:"grid gap-[18px] md:gap-[12px]",children:T.map((e,i)=>l("div",{className:"grid gap-[8px]",children:[e?.orderNumber&&l("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",e.orderNumber]}),l("div",{className:m("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!b&&"rounded-none"),children:[l("div",{className:"grid gap-[4px]",children:[s("div",{className:"text-[16px] font-bold leading-[1.4]",children:e.title}),l("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",e.value," ",o?.pointUnit]}),l("div",{className:"text-[14px] font-semibold text-[#999]",children:[e?.couponCode?`${o?.code||"Code"}: ${e.couponCode} `:"",e?.couponCode&&s("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{H(e.couponCode,i)},role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&f.preventDefault()},children:D===i?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),l("div",{className:"grid gap-[4px] text-right",children:[l("div",{className:m("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${Y[e.type]}]`),children:[s("span",{children:E[e.type]}),P[e.type]&&s(J,{info:P[e.type],index:i})]}),s("div",{className:"text-[14px] font-semibold text-[#999]",children:V(e.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},i))}):l("div",{className:"flex h-full flex-col items-center justify-center",children:[s(B,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),s("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var ue=Z;export{ue as default};
2
2
  //# sourceMappingURL=MyRewardsModal.js.map