@anker-in/campaign-ui 0.2.0-beta.6 → 0.2.0-beta.8

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 (146) 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 +2 -2
  7. package/dist/cjs/components/credits/creditsBenefits/index.js.map +3 -3
  8. package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
  9. package/dist/cjs/components/credits/creditsFaq/index.js.map +3 -3
  10. package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +0 -2
  11. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  12. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  13. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  14. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  15. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  16. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  17. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  18. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +2 -2
  19. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  20. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +2 -2
  21. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  22. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  23. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  24. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  25. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  26. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  27. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  28. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  29. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
  30. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
  31. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  32. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +2 -2
  33. package/dist/cjs/components/credits/modal/activitiesModal.js +1 -1
  34. package/dist/cjs/components/credits/modal/activitiesModal.js.map +2 -2
  35. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  36. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  37. package/dist/cjs/components/credits/modal/modalContainer.js +1 -1
  38. package/dist/cjs/components/credits/modal/modalContainer.js.map +3 -3
  39. package/dist/cjs/components/credits/modal/subscribeModal.js +1 -1
  40. package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
  41. package/dist/cjs/components/credits/modal/tip.js +1 -1
  42. package/dist/cjs/components/credits/modal/tip.js.map +3 -3
  43. package/dist/cjs/components/credits/type.d.ts +1 -0
  44. package/dist/cjs/components/credits/type.js +1 -1
  45. package/dist/cjs/components/credits/type.js.map +1 -1
  46. package/dist/cjs/components/registration/authCodeActivate/Message.js +1 -1
  47. package/dist/cjs/components/registration/authCodeActivate/Message.js.map +2 -2
  48. package/dist/cjs/components/registration/authCodeActivate/index.js +1 -1
  49. package/dist/cjs/components/registration/authCodeActivate/index.js.map +3 -3
  50. package/dist/cjs/components/registration/authCodeActivate/type.d.ts +0 -1
  51. package/dist/cjs/components/registration/authCodeActivate/type.js.map +1 -1
  52. package/dist/cjs/components/registration/context/provider.d.ts +2 -0
  53. package/dist/cjs/components/registration/context/provider.js +1 -1
  54. package/dist/cjs/components/registration/context/provider.js.map +3 -3
  55. package/dist/cjs/components/registration/modalContainer.d.ts +1 -2
  56. package/dist/cjs/components/registration/modalContainer.js +1 -1
  57. package/dist/cjs/components/registration/modalContainer.js.map +3 -3
  58. package/dist/cjs/templates/credits.d.ts +2 -1
  59. package/dist/cjs/templates/credits.js +1 -1
  60. package/dist/cjs/templates/credits.js.map +2 -2
  61. package/dist/esm/components/credits/context/provider.d.ts +2 -2
  62. package/dist/esm/components/credits/context/provider.js +1 -1
  63. package/dist/esm/components/credits/context/provider.js.map +3 -3
  64. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +1 -1
  65. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +3 -3
  66. package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
  67. package/dist/esm/components/credits/creditsBenefits/index.js.map +3 -3
  68. package/dist/esm/components/credits/creditsFaq/index.js +1 -1
  69. package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
  70. package/dist/esm/components/credits/creditsInfoCard/index.d.ts +0 -2
  71. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  72. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  73. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  74. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  75. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  76. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  77. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  78. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  79. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  80. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  81. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  82. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  83. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  84. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  85. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  86. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
  87. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  88. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
  89. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
  90. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +2 -2
  91. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  92. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
  93. package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
  94. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  95. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  96. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  97. package/dist/esm/components/credits/modal/modalContainer.js +1 -1
  98. package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
  99. package/dist/esm/components/credits/modal/subscribeModal.js +1 -1
  100. package/dist/esm/components/credits/modal/subscribeModal.js.map +3 -3
  101. package/dist/esm/components/credits/modal/tip.js +1 -1
  102. package/dist/esm/components/credits/modal/tip.js.map +3 -3
  103. package/dist/esm/components/credits/type.d.ts +1 -0
  104. package/dist/esm/components/registration/authCodeActivate/Message.js +1 -1
  105. package/dist/esm/components/registration/authCodeActivate/Message.js.map +2 -2
  106. package/dist/esm/components/registration/authCodeActivate/index.js +1 -1
  107. package/dist/esm/components/registration/authCodeActivate/index.js.map +3 -3
  108. package/dist/esm/components/registration/authCodeActivate/type.d.ts +0 -1
  109. package/dist/esm/components/registration/context/provider.d.ts +2 -0
  110. package/dist/esm/components/registration/context/provider.js +1 -1
  111. package/dist/esm/components/registration/context/provider.js.map +3 -3
  112. package/dist/esm/components/registration/modalContainer.d.ts +1 -2
  113. package/dist/esm/components/registration/modalContainer.js +1 -1
  114. package/dist/esm/components/registration/modalContainer.js.map +3 -3
  115. package/dist/esm/templates/credits.d.ts +2 -1
  116. package/dist/esm/templates/credits.js +1 -1
  117. package/dist/esm/templates/credits.js.map +2 -2
  118. package/package.json +3 -3
  119. package/src/components/credits/context/provider.tsx +1 -4
  120. package/src/components/credits/creditsBenefits/benefitItem.tsx +2 -5
  121. package/src/components/credits/creditsBenefits/index.tsx +1 -4
  122. package/src/components/credits/creditsFaq/index.tsx +2 -3
  123. package/src/components/credits/creditsInfoCard/index.tsx +6 -8
  124. package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +2 -3
  125. package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +2 -3
  126. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +2 -3
  127. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +2 -4
  128. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +2 -3
  129. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +2 -3
  130. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +2 -3
  131. package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +2 -3
  132. package/src/components/credits/creditsWaysToGetCredits/useActions.ts +4 -1
  133. package/src/components/credits/modal/MyRewardsModal.tsx +2 -3
  134. package/src/components/credits/modal/activitiesModal.tsx +2 -3
  135. package/src/components/credits/modal/creditsUploadReceiptModal.tsx +2 -3
  136. package/src/components/credits/modal/modalContainer.tsx +2 -3
  137. package/src/components/credits/modal/subscribeModal.tsx +2 -3
  138. package/src/components/credits/modal/tip.tsx +2 -3
  139. package/src/components/credits/type.ts +1 -0
  140. package/src/components/registration/authCodeActivate/Message.tsx +1 -1
  141. package/src/components/registration/authCodeActivate/index.tsx +141 -109
  142. package/src/components/registration/authCodeActivate/type.ts +0 -1
  143. package/src/components/registration/context/provider.tsx +9 -0
  144. package/src/components/registration/modalContainer.tsx +9 -7
  145. package/src/templates/credits.tsx +17 -3
  146. package/src/components/credits/const.ts +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";var K=Object.create;var b=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var Z=(e,s)=>{for(var r in s)b(e,r,{get:s[r],enumerable:!0})},A=(e,s,r,f)=>{if(s&&typeof s=="object"||typeof s=="function")for(let l of W(s))!Y.call(e,l)&&l!==r&&b(e,l,{get:()=>s[l],enumerable:!(f=Q(s,l))||f.enumerable});return e};var g=(e,s,r)=>(r=e!=null?K(X(e)):{},A(s||!e||!e.__esModule?b(r,"default",{value:e,enumerable:!0}):r,e)),$=e=>A(b({},"__esModule",{value:!0}),e);var te={};Z(te,{CreditsRedeemList:()=>ee});module.exports=$(te);var o=require("react/jsx-runtime"),a=require("@anker-in/headless-ui"),C=g(require("classnames")),i=require("react"),M=g(require("./RedeemCouponModal")),P=g(require("./RedeemProductModal")),O=require("../context/provider"),S=g(require("../context/hooks/useRedeemableList")),u=require("../context/const"),v=require("@anker-in/lib"),F=require("./RedeemableItem"),H=g(require("../modal/rulesModal")),z=require("@anker-in/lib"),B=require("../../../components/registration"),D=require("../const");const ee=({copy:e})=>{const{profile:s,openSignUpPopup:r,gtm:{pageGroup:f},pageCommon:l}=(0,O.useCreditsContext)(),{authCodeActivate:L}=(0,B.useRegistration)(),{brand:j}=(0,v.useHeadlessContext)(),q=D.roundedBrands.includes(j),w=Object.keys(s||{}).length>0,[R,G]=(0,i.useState)(e.list[0].label),[d,y]=(0,i.useState)(void 0),[T,x]=(0,i.useState)(),{listLoading:U,redeemableList:k,getRedeemableList:_}=(0,S.default)(),p=(0,i.useMemo)(()=>k.map(t=>({id:t.id.toString(),title:t.name,consumeCredits:t.consume_credits,remainingInventory:t.remaining_inventory,isLimited:!!t.is_limited,consumeType:t.consume_type,handle:t.sku_handle,sku:t.goods_sku,image:t.goods_url})),[e.list,R,k]),V=p.map(t=>t.handle),{data:N}=(0,v.useProductsByHandles)({handles:V}),J=(0,i.useMemo)(()=>e.list.find(n=>n.label===R)?.list.filter(n=>p.some(c=>c.id===n.id)).map(n=>{const c=p.find(m=>m.id===n.id),h=N?.find(m=>m.handle===c?.handle),E=h?.variants.find(m=>m.sku===c?.sku);return c?.consumeType===u.AlpcConsumeType.Product&&(!h||!E)?null:{alpc:p.find(m=>m.id===n.id),config:n,product:h,variant:E}}).filter(n=>n!==null),[p,N]),I=(0,i.useCallback)(t=>{t===u.AlpcErrorCode.CodeLpcRuleInventoryNotEnough&&_()},[_]);return(0,o.jsxs)(a.Container,{className:(0,C.default)("relative bg-[#F5F5F7]"),children:[(0,o.jsx)(a.Heading,{as:"h2",size:"4",html:e.title}),(0,o.jsx)(a.Tabs,{shape:q?"rounded":"square",align:"left",className:(0,C.default)("sticky top-0 z-20 py-[24px] md:justify-center"),value:R.toString(),onValueChange:t=>{G(t),(0,z.gaTrack)({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:t,page_group:f}})},children:(0,o.jsx)(a.TabsList,{children:e.list.map(t=>(0,o.jsx)(a.TabsTrigger,{value:t.label,children:t.label},t.label))})}),!!p?.length&&!U&&(0,o.jsx)("div",{className:(0,C.default)("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:J?.map(t=>(0,o.jsx)(F.RedeemableItem,{copy:e,item:t,onRedeem:n=>{w?!s?.activated&&!L.isActivateSuccess?L.open():y(n):r()},onRulesOpen:x},t?.alpc?.id))}),d?.alpc?.consumeType===u.AlpcConsumeType.Coupon&&e?.redeemModal?.coupon&&d&&(0,o.jsx)(M.default,{isOpen:!!d,item:d,copy:e,onError:I,onClose:()=>{y(void 0)}}),d?.alpc?.consumeType===u.AlpcConsumeType.Product&&e?.redeemModal&&d&&(0,o.jsx)(P.default,{isOpen:!!d,item:d,copy:e,onError:I,onClose:()=>{y(void 0)}}),T&&(0,o.jsx)(H.default,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:T.length>0,onClose:()=>x([]),titleClassName:"border-b-transparent h-[56px]",rules:T,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:l?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};
1
+ "use strict";var V=Object.create;var C=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var X=(e,s)=>{for(var a in s)C(e,a,{get:s[a],enumerable:!0})},A=(e,s,a,b)=>{if(s&&typeof s=="object"||typeof s=="function")for(let m of K(s))!W.call(e,m)&&m!==a&&C(e,m,{get:()=>s[m],enumerable:!(b=J(s,m))||b.enumerable});return e};var f=(e,s,a)=>(a=e!=null?V(Q(e)):{},A(s||!e||!e.__esModule?C(a,"default",{value:e,enumerable:!0}):a,e)),Y=e=>A(C({},"__esModule",{value:!0}),e);var $={};X($,{CreditsRedeemList:()=>Z});module.exports=Y($);var o=require("react/jsx-runtime"),r=require("@anker-in/headless-ui"),R=f(require("classnames")),i=require("react"),M=f(require("./RedeemCouponModal")),O=f(require("./RedeemProductModal")),P=require("../context/provider"),S=f(require("../context/hooks/useRedeemableList")),c=require("../context/const"),l=require("@anker-in/lib"),D=require("./RedeemableItem"),F=f(require("../modal/rulesModal")),H=require("../../../components/registration");const Z=({copy:e})=>{const{profile:s,openSignUpPopup:a,gtm:{pageGroup:b},pageCommon:m}=(0,P.useCreditsContext)(),{authCodeActivate:L}=(0,H.useRegistration)(),{brand:z}=(0,l.useHeadlessContext)(),B=l.ROUNDED_BRANDS.includes(z),U=Object.keys(s||{}).length>0,[v,j]=(0,i.useState)(e.list[0].label),[d,y]=(0,i.useState)(void 0),[T,x]=(0,i.useState)(),{listLoading:q,redeemableList:k,getRedeemableList:N}=(0,S.default)(),u=(0,i.useMemo)(()=>k.map(t=>({id:t.id.toString(),title:t.name,consumeCredits:t.consume_credits,remainingInventory:t.remaining_inventory,isLimited:!!t.is_limited,consumeType:t.consume_type,handle:t.sku_handle,sku:t.goods_sku,image:t.goods_url})),[e.list,v,k]),w=u.map(t=>t.handle),{data:_}=(0,l.useProductsByHandles)({handles:w}),G=(0,i.useMemo)(()=>e.list.find(n=>n.label===v)?.list.filter(n=>u.some(g=>g.id===n.id)).map(n=>{const g=u.find(p=>p.id===n.id),h=_?.find(p=>p.handle===g?.handle),E=h?.variants.find(p=>p.sku===g?.sku);return g?.consumeType===c.AlpcConsumeType.Product&&(!h||!E)?null:{alpc:u.find(p=>p.id===n.id),config:n,product:h,variant:E}}).filter(n=>n!==null),[u,_]),I=(0,i.useCallback)(t=>{t===c.AlpcErrorCode.CodeLpcRuleInventoryNotEnough&&N()},[N]);return(0,o.jsxs)(r.Container,{className:(0,R.default)("relative bg-[#F5F5F7]"),children:[(0,o.jsx)(r.Heading,{as:"h2",size:"4",html:e.title}),(0,o.jsx)(r.Tabs,{shape:B?"rounded":"square",align:"left",className:(0,R.default)("sticky top-0 z-20 py-[24px] md:justify-center"),value:v.toString(),onValueChange:t=>{j(t),(0,l.gaTrack)({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:t,page_group:b}})},children:(0,o.jsx)(r.TabsList,{children:e.list.map(t=>(0,o.jsx)(r.TabsTrigger,{value:t.label,children:t.label},t.label))})}),!!u?.length&&!q&&(0,o.jsx)("div",{className:(0,R.default)("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:G?.map(t=>(0,o.jsx)(D.RedeemableItem,{copy:e,item:t,onRedeem:n=>{U?!s?.activated&&!L.isActivateSuccess?L.open():y(n):a()},onRulesOpen:x},t?.alpc?.id))}),d?.alpc?.consumeType===c.AlpcConsumeType.Coupon&&e?.redeemModal?.coupon&&d&&(0,o.jsx)(M.default,{isOpen:!!d,item:d,copy:e,onError:I,onClose:()=>{y(void 0)}}),d?.alpc?.consumeType===c.AlpcConsumeType.Product&&e?.redeemModal&&d&&(0,o.jsx)(O.default,{isOpen:!!d,item:d,copy:e,onError:I,onClose:()=>{y(void 0)}}),T&&(0,o.jsx)(F.default,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:T.length>0,onClose:()=>x([]),titleClassName:"border-b-transparent h-[56px]",rules:T,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:m?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};
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-[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ACE,SAAAH,EAAK,KAAK,IAAIoB,MACb,OAAC,eAA6B,MAAOA,EAAK,MACvC,SAAAA,EAAK,OADUA,EAAK,KAEvB,CACD,EACH,EACF,EAEC,CAAC,CAACD,GAAU,QAAU,CAACJ,MACtB,OAAC,OACC,aAAW,EAAAc,SAAW,qFAAqF,EAE1G,SAAAN,GAAM,IAAIH,MACT,OAAC,kBAEC,KAAMpB,EACN,KAAMoB,EACN,SAAWA,GAA6B,CACjCZ,EAEM,CAACP,GAAS,WAAa,CAACI,EAAiB,kBAClDA,EAAiB,KAAK,EAEtBO,EAAiBQ,CAAI,EAJrBlB,EAAgB,CAMpB,EACA,YAAaY,GAZRM,GAAM,MAAM,EAanB,CACD,EACH,EAGDT,GAAe,MAAM,cAAgB,kBAAgB,QAAUX,GAAM,aAAa,QAAUW,MAC3F,OAAC,EAAAoB,QAAA,CACC,OAAQ,CAAC,CAACpB,EACV,KAAMA,EACN,KAAMX,EACN,QAAS2B,EACT,QAAS,IAAM,CACbf,EAAiB,MAAS,CAC5B,EACF,EAEDD,GAAe,MAAM,cAAgB,kBAAgB,SAAWX,GAAM,aAAeW,MACpF,OAAC,EAAAqB,QAAA,CACC,OAAQ,CAAC,CAACrB,EACV,KAAMA,EACN,KAAMX,EACN,QAAS2B,EACT,QAAS,IAAM,CACbf,EAAiB,MAAS,CAC5B,EACF,EAEDC,MACC,OAAC,EAAAoB,QAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQpB,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOT,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAqFI,IAAAI,EAAA,6BArFJC,EAAgE,iCAChEC,EAAuB,yBACvBC,EAA+C,iBAE/CC,EAA8B,kCAC9BC,EAA+B,mCAC/BC,EAAkC,+BAClCC,EAA8B,iDAC9BC,EAA+C,4BAC/CC,EAAkF,yBAElFC,EAA+B,4BAC/BC,EAAuB,kCAEvBC,EAAgC,4CAEzB,MAAMd,EAAoB,CAAC,CAAE,KAAAe,CAAK,IAAuC,CAC9E,KAAM,CACJ,QAAAC,EACA,gBAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,CACF,KAAI,qBAAkB,EAChB,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EAEvCE,EAAU,OAAO,KAAKP,GAAW,CAAC,CAAC,EAAE,OAAS,EAE9C,CAACQ,EAAWC,CAAY,KAAI,YAAiBV,EAAK,KAAK,CAAC,EAAE,KAAK,EAE/D,CAACW,EAAeC,CAAgB,KAAI,YAAyC,MAAS,EAEtF,CAACC,EAAOC,CAAQ,KAAI,YAA4B,EAEhD,CAAE,YAAAC,EAAa,eAAAC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,OAAQpB,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOT,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
6
6
  "names": ["CreditsRedeemList_exports", "__export", "CreditsRedeemList", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_react", "import_RedeemCouponModal", "import_RedeemProductModal", "import_provider", "import_useRedeemableList", "import_const", "import_lib", "import_RedeemableItem", "import_rulesModal", "import_registration", "copy", "profile", "openSignUpPopup", "pageGroup", "pageCommon", "authCodeActivate", "brand", "rounded", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "useRedeemableList", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "handleRedeemError", "errorCode", "classNames", "value", "RedeemCouponModal", "RedeemProductModal", "RulesModal"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var L=Object.create;var m=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var k=(e,o)=>{for(var d in o)m(e,d,{get:o[d],enumerable:!0})},p=(e,o,d,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of B(o))!P.call(e,s)&&s!==d&&m(e,s,{get:()=>o[s],enumerable:!(i=T(o,s))||i.enumerable});return e};var l=(e,o,d)=>(d=e!=null?L(I(e)):{},p(o||!e||!e.__esModule?m(d,"default",{value:e,enumerable:!0}):d,e)),D=e=>p(m({},"__esModule",{value:!0}),e);var E={};k(E,{Address:()=>M});module.exports=D(E);var t=require("react/jsx-runtime"),r=require("@anker-in/headless-ui"),a=l(require("classnames")),x=require("../AddressForm"),c=require("@anker-in/lib"),u=require("./ProductInfo"),f=l(require("../../context/hooks/useCountries")),y=require("../../const");const M=({copy:e,shippingAddress:o,setAddress:d,validateAddress:i,validateErrors:s,shippingProduct:n,loading:v,address:b,disabled:g,handlePayment:h,item:C})=>{const{storeDomain:N,brand:R}=(0,c.useHeadlessContext)(),A=y.roundedBrands.includes(R),{countries:F=[],isLoading:w}=(0,f.default)({shopifyStoreDomain:N});return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:(0,a.default)("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:(0,t.jsxs)("div",{children:[o&&(0,t.jsx)(r.Text,{className:"mb-5 text-[16px] font-bold",html:o}),(0,t.jsx)(x.AddressForm,{onChange:d,validate:i,errors:s,form:e.redeemModal.product.addressForm,countries:F,countriesLoading:w})]})}),(0,t.jsxs)("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[(0,t.jsxs)("div",{className:(0,a.default)("flex w-full items-center bg-[#F5F5F7] p-[16px]",!A&&"rounded-none"),children:[n&&(0,t.jsx)(r.Text,{className:"mb-5 text-[16px] font-bold",html:n}),(0,t.jsx)(u.ProductInfo,{item:C,copy:e})]}),(0,t.jsx)(r.Button,{loading:v||!b,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:h,disabled:g,children:e.redeemModal.product.paymentButton})]})]})};
1
+ "use strict";var w=Object.create;var a=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var I=(e,o)=>{for(var s in o)a(e,s,{get:o[s],enumerable:!0})},l=(e,o,s,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of L(o))!B.call(e,d)&&d!==s&&a(e,d,{get:()=>o[d],enumerable:!(i=D(o,d))||i.enumerable});return e};var x=(e,o,s)=>(s=e!=null?w(T(e)):{},l(o||!e||!e.__esModule?a(s,"default",{value:e,enumerable:!0}):s,e)),P=e=>l(a({},"__esModule",{value:!0}),e);var E={};I(E,{Address:()=>k});module.exports=P(E);var t=require("react/jsx-runtime"),r=require("@anker-in/headless-ui"),n=x(require("classnames")),c=require("../AddressForm"),m=require("@anker-in/lib"),u=require("./ProductInfo"),f=x(require("../../context/hooks/useCountries"));const k=({copy:e,shippingAddress:o,setAddress:s,validateAddress:i,validateErrors:d,shippingProduct:p,loading:y,address:v,disabled:b,handlePayment:g,item:N})=>{const{storeDomain:R,brand:h}=(0,m.useHeadlessContext)(),A=m.ROUNDED_BRANDS.includes(h),{countries:C=[],isLoading:F}=(0,f.default)({shopifyStoreDomain:R});return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:(0,n.default)("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:(0,t.jsxs)("div",{children:[o&&(0,t.jsx)(r.Text,{className:"mb-5 text-[16px] font-bold",html:o}),(0,t.jsx)(c.AddressForm,{onChange:s,validate:i,errors:d,form:e.redeemModal.product.addressForm,countries:C,countriesLoading:F})]})}),(0,t.jsxs)("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[(0,t.jsxs)("div",{className:(0,n.default)("flex w-full items-center bg-[#F5F5F7] p-[16px]",!A&&"rounded-none"),children:[p&&(0,t.jsx)(r.Text,{className:"mb-5 text-[16px] font-bold",html:p}),(0,t.jsx)(u.ProductInfo,{item:N,copy:e})]}),(0,t.jsx)(r.Button,{loading:y||!v,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:g,disabled:b,children:e.redeemModal.product.paymentButton})]})]})};
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>\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__export", "Address", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_AddressForm", "import_lib", "import_ProductInfo", "import_useCountries", "import_const", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "brand", "rounded", "countries", "countriesLoading", "useCountries", "classNames"]
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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA2CQ,IAAAI,EAAA,6BA3CRC,EAA6B,iCAC7BC,EAAuB,yBACvBC,EAA4B,0BAC5BC,EAAmD,yBAGnDC,EAA4B,yBAC5BC,EAAyB,+CAgBlB,MAAMR,EAAU,CAAC,CACtB,KAAAS,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,KAAI,sBAAmB,EAC5CC,EAAU,iBAAe,SAASD,CAAK,EACvC,CAAE,UAAAE,EAAY,CAAC,EAAG,UAAWC,CAAiB,KAAI,EAAAC,SAAa,CAAE,mBAAoBL,CAAY,CAAC,EAExG,SACE,QAAC,OAAI,UAAU,WACb,oBAAC,OAAI,aAAW,EAAAM,SAAW,iFAAiF,EAC1G,oBAAC,OACE,UAAAhB,MAAmB,OAAC,QAAK,UAAU,6BAA6B,KAAMA,EAAiB,KACxF,OAAC,eACC,SAAUC,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWc,EACX,iBAAkBC,EACnB,GACH,EACF,KACA,QAAC,OAAI,UAAU,qGACb,qBAAC,OAAI,aAAW,EAAAE,SAAW,iDAAkD,CAACJ,GAAW,cAAc,EACpG,UAAAR,MAAmB,OAAC,QAAK,UAAU,6BAA6B,KAAMA,EAAiB,KACxF,OAAC,eAAY,KAAMK,EAAM,KAAMV,EAAM,GACvC,KACA,OAAC,UACC,QAASM,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
6
+ "names": ["Address_exports", "__export", "Address", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_AddressForm", "import_lib", "import_ProductInfo", "import_useCountries", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "brand", "rounded", "countries", "countriesLoading", "useCountries", "classNames"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.create;var a=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},i=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of C(t))!R.call(e,m)&&m!==o&&a(e,m,{get:()=>t[m],enumerable:!(r=N(t,m))||r.enumerable});return e};var h=(e,t,o)=>(o=e!=null?g(w(e)):{},i(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),B=e=>i(a({},"__esModule",{value:!0}),e);var F={};T(F,{Success:()=>I});module.exports=B(F);var d=require("react/jsx-runtime"),s=require("@anker-in/headless-ui"),p=h(require("classnames")),l=require("./ProductInfo"),n=require("@anker-in/lib"),x=require("../../const");const I=({copy:e,shippingProduct:t,loading:o,address:r,disabled:m,onClose:c,item:u})=>{const{brand:f}=(0,n.useHeadlessContext)(),b=x.roundedBrands.includes(f);return(0,d.jsx)("div",{className:(0,p.default)("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:(0,d.jsxs)("div",{className:"flex flex-col items-center",children:[(0,d.jsx)("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:e.redeemModal.product.successDesc.map((y,v)=>(0,d.jsx)(s.Text,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:y},v))}),t&&(0,d.jsx)(s.Text,{className:"mb-5 text-[16px] font-bold",html:t}),(0,d.jsx)("div",{className:(0,p.default)("flex w-full items-center bg-[#F5F5F7] p-[16px]",!b&&"rounded-none"),children:(0,d.jsx)(l.ProductInfo,{item:u,copy:e})}),(0,d.jsx)(s.Button,{loading:o||!r,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:c,disabled:m,children:e.redeemModal.product.paymentButton})]})})};
1
+ "use strict";var v=Object.create;var p=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var w=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},i=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of N(t))!C.call(e,d)&&d!==o&&p(e,d,{get:()=>t[d],enumerable:!(a=g(t,d))||a.enumerable});return e};var T=(e,t,o)=>(o=e!=null?v(R(e)):{},i(t||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),h=e=>i(p({},"__esModule",{value:!0}),e);var D={};w(D,{Success:()=>B});module.exports=h(D);var m=require("react/jsx-runtime"),s=require("@anker-in/headless-ui"),l=T(require("classnames")),n=require("./ProductInfo"),r=require("@anker-in/lib");const B=({copy:e,shippingProduct:t,loading:o,address:a,disabled:d,onClose:x,item:c})=>{const{brand:u}=(0,r.useHeadlessContext)(),f=r.ROUNDED_BRANDS.includes(u);return(0,m.jsx)("div",{className:(0,l.default)("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:(0,m.jsxs)("div",{className:"flex flex-col items-center",children:[(0,m.jsx)("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:e.redeemModal.product.successDesc.map((b,y)=>(0,m.jsx)(s.Text,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:b},y))}),t&&(0,m.jsx)(s.Text,{className:"mb-5 text-[16px] font-bold",html:t}),(0,m.jsx)("div",{className:(0,l.default)("flex w-full items-center bg-[#F5F5F7] p-[16px]",!f&&"rounded-none"),children:(0,m.jsx)(n.ProductInfo,{item:c,copy:e})}),(0,m.jsx)(s.Button,{loading:o||!a,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:x,disabled:d,children:e.redeemModal.product.paymentButton})]})})};
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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAuBM,IAAAI,EAAA,6BAvBNC,EAA6B,iCAC7BC,EAAuB,yBAGvBC,EAA4B,yBAC5BC,EAAmC,yBACnCC,EAA8B,uBAYvB,MAAMP,EAAU,CAAC,CAAE,KAAAQ,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,gBAAc,SAASD,CAAK,EAC5C,SACE,OAAC,OAAI,aAAW,EAAAE,SAAW,iFAAiF,EAC1G,oBAAC,OAAI,UAAU,6BACb,oBAAC,OAAI,UAAU,wDACZ,SAAAT,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACU,EAAqBC,OAC9D,OAAC,QAAiB,UAAU,qDAAqD,KAAMD,GAA5EC,CAAyF,CACrG,EACH,EAECV,MAAmB,OAAC,QAAK,UAAU,6BAA6B,KAAMA,EAAiB,KAExF,OAAC,OAAI,aAAW,EAAAQ,SAAW,iDAAkD,CAACD,GAAW,cAAc,EACrG,mBAAC,eAAY,KAAMF,EAAM,KAAMN,EAAM,EACvC,KAEA,OAAC,UACC,QAASE,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF,CAEJ",
6
- "names": ["Success_exports", "__export", "Success", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_ProductInfo", "import_lib", "import_const", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "brand", "rounded", "classNames", "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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAsBM,IAAAI,EAAA,6BAtBNC,EAA6B,iCAC7BC,EAAuB,yBAGvBC,EAA4B,yBAC5BC,EAAmD,yBAY5C,MAAMN,EAAU,CAAC,CAAE,KAAAO,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EAC7C,SACE,OAAC,OAAI,aAAW,EAAAE,SAAW,iFAAiF,EAC1G,oBAAC,OAAI,UAAU,6BACb,oBAAC,OAAI,UAAU,wDACZ,SAAAT,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACU,EAAqBC,OAC9D,OAAC,QAAiB,UAAU,qDAAqD,KAAMD,GAA5EC,CAAyF,CACrG,EACH,EAECV,MAAmB,OAAC,QAAK,UAAU,6BAA6B,KAAMA,EAAiB,KAExF,OAAC,OAAI,aAAW,EAAAQ,SAAW,iDAAkD,CAACD,GAAW,cAAc,EACrG,mBAAC,eAAY,KAAMF,EAAM,KAAMN,EAAM,EACvC,KAEA,OAAC,UACC,QAASE,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF,CAEJ",
6
+ "names": ["Success_exports", "__export", "Success", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_ProductInfo", "import_lib", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "brand", "rounded", "classNames", "description", "index"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var I=Object.create;var c=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var S=(t,a)=>{for(var e in a)c(t,e,{get:a[e],enumerable:!0})},y=(t,a,e,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of z(a))!P.call(t,o)&&o!==e&&c(t,o,{get:()=>a[o],enumerable:!(m=k(a,o))||m.enumerable});return t};var E=(t,a,e)=>(e=t!=null?I(L(t)):{},y(a||!t||!t.__esModule?c(e,"default",{value:t,enumerable:!0}):e,t)),F=t=>y(c({},"__esModule",{value:!0}),t);var B={};S(B,{RedeemableItem:()=>O});module.exports=F(B);var l=require("react/jsx-runtime"),n=require("@anker-in/headless-ui"),f=require("react"),u=E(require("classnames")),_=require("../context/provider"),p=require("../context/const"),h=require("../context/utils"),s=require("@anker-in/lib"),C=require("./NonProductValue"),N=require("../const");function O({copy:t,className:a,item:e,onRulesOpen:m,onRedeem:o}){const{creditInfo:v,profile:i,gtm:{pageGroup:g},pageCommon:r}=(0,_.useCreditsContext)(),{brand:R}=(0,s.useHeadlessContext)(),d=Object.keys(i||{}).length>0,T=N.roundedBrands.includes(R),w=(0,f.useMemo)(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===p.AlpcConsumeType.Product&&!e.variant?.availableForSale||d&&i?.activated&&e.alpc?.consumeCredits>Number(v?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,d,i?.activated,v?.available_credit,e.variant?.availableForSale]),b=(0,f.useMemo)(()=>d?e.alpc?.consumeType===p.AlpcConsumeType.Product?e.variant?.availableForSale?t.btnRedeem:r?.soldOut||"Sold Out":t.btnRedeem:t.unlockRewards,[d,e.alpc?.consumeType,e.variant?.availableForSale,t.btnRedeem,t.unlockRewards,r?.soldOut]);return(0,l.jsxs)("div",{className:(0,u.default)("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!T&&"rounded-none md:rounded-none",a),children:[e.config?.type===p.ConsumeType.Product?(0,l.jsx)("div",{className:(0,u.default)("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:(0,l.jsx)(n.Picture,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})}):(0,l.jsxs)("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[(0,l.jsx)(n.Picture,{source:r?.imageMapping?.[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),(0,l.jsx)(C.NoneProductValue,{item:e})]}),(0,l.jsxs)("div",{className:(0,u.default)("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[(0,l.jsx)(n.Text,{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&&(0,l.jsx)("button",{type:"button",onClick:()=>{m(e.config?.rules||[]),(0,s.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:i?.activated?"active":"not active",event_parameters:{page_group:g,position:t.title,button_name:r?.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:x=>{(x.key==="Enter"||x.key===" ")&&x.preventDefault()},children:r?.ruleLabel}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[(0,l.jsx)(n.Picture,{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"}),(0,l.jsx)(n.Text,{html:`${(0,h.numberFormat)(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] "})]}),(0,l.jsx)(n.Button,{disabled:w,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{o(e),(0,s.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:i?.activated?"active":"not active",event_parameters:{page_group:g,position:t.title,button_name:b,info:e.alpc?.id?.toString()}})},children:b})]})]})]})}
1
+ "use strict";var w=Object.create;var c=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var E=(t,a)=>{for(var e in a)c(t,e,{get:a[e],enumerable:!0})},y=(t,a,e,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of k(a))!z.call(t,o)&&o!==e&&c(t,o,{get:()=>a[o],enumerable:!(m=I(a,o))||m.enumerable});return t};var L=(t,a,e)=>(e=t!=null?w(S(t)):{},y(a||!t||!t.__esModule?c(e,"default",{value:t,enumerable:!0}):e,t)),P=t=>y(c({},"__esModule",{value:!0}),t);var O={};E(O,{RedeemableItem:()=>D});module.exports=P(O);var l=require("react/jsx-runtime"),n=require("@anker-in/headless-ui"),f=require("react"),u=L(require("classnames")),_=require("../context/provider"),s=require("../context/const"),h=require("../context/utils"),i=require("@anker-in/lib"),N=require("./NonProductValue");function D({copy:t,className:a,item:e,onRulesOpen:m,onRedeem:o}){const{creditInfo:v,profile:r,gtm:{pageGroup:g},pageCommon:p}=(0,_.useCreditsContext)(),{brand:C}=(0,i.useHeadlessContext)(),d=Object.keys(r||{}).length>0,R=i.ROUNDED_BRANDS.includes(C),T=(0,f.useMemo)(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===s.AlpcConsumeType.Product&&!e.variant?.availableForSale||d&&r?.activated&&e.alpc?.consumeCredits>Number(v?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,d,r?.activated,v?.available_credit,e.variant?.availableForSale]),b=(0,f.useMemo)(()=>d?e.alpc?.consumeType===s.AlpcConsumeType.Product?e.variant?.availableForSale?t.btnRedeem:p?.soldOut||"Sold Out":t.btnRedeem:t.unlockRewards,[d,e.alpc?.consumeType,e.variant?.availableForSale,t.btnRedeem,t.unlockRewards,p?.soldOut]);return(0,l.jsxs)("div",{className:(0,u.default)("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!R&&"rounded-none md:rounded-none",a),children:[e.config?.type===s.ConsumeType.Product?(0,l.jsx)("div",{className:(0,u.default)("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:(0,l.jsx)(n.Picture,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})}):(0,l.jsxs)("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[(0,l.jsx)(n.Picture,{source:p?.imageMapping?.[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),(0,l.jsx)(N.NoneProductValue,{item:e})]}),(0,l.jsxs)("div",{className:(0,u.default)("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[(0,l.jsx)(n.Text,{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&&(0,l.jsx)("button",{type:"button",onClick:()=>{m(e.config?.rules||[]),(0,i.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:r?.activated?"active":"not active",event_parameters:{page_group:g,position:t.title,button_name:p?.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:x=>{(x.key==="Enter"||x.key===" ")&&x.preventDefault()},children:p?.ruleLabel}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[(0,l.jsx)(n.Picture,{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"}),(0,l.jsx)(n.Text,{html:`${(0,h.numberFormat)(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] "})]}),(0,l.jsx)(n.Button,{disabled:T,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{o(e),(0,i.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:r?.activated?"active":"not active",event_parameters:{page_group:g,position:t.title,button_name:b,info:e.alpc?.id?.toString()}})},children:b})]})]})]})}
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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GA4FU,IAAAI,EAAA,6BA5FVC,EAAsC,iCAEtCC,EAAwB,iBAExBC,EAAuB,yBACvBC,EAAkC,+BAElCC,EAA6C,4BAC7CC,EAA6B,4BAE7BC,EAA4C,yBAC5CC,EAAiC,6BACjCH,EAA8B,oBAEvB,SAASP,EAAe,CAC7B,KAAAW,EACA,UAAAC,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,CACF,EAMG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,CACF,KAAI,qBAAkB,EAChB,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,OAAO,KAAKJ,GAAW,CAAC,CAAC,EAAE,OAAS,EAC9CK,EAAU,gBAAc,SAASF,CAAK,EAEtCG,KAAa,WAAQ,IACrB,GAAAV,EAAK,MAAM,oBAAsB,GAAKA,EAAK,MAAM,WAKjDA,EAAK,MAAM,cAAgB,kBAAgB,SACzC,CAACA,EAAK,SAAS,kBAIjBQ,GAAWJ,GAAS,WAAaJ,EAAK,MAAM,eAAiB,OAAOG,GAAY,kBAAoB,CAAC,GAIxG,CACDH,EAAK,MAAM,mBACXA,EAAK,MAAM,UACXA,EAAK,MAAM,YACXA,EAAK,MAAM,eACXQ,EACAJ,GAAS,UACTD,GAAY,iBACZH,EAAK,SAAS,gBAChB,CAAC,EAEKW,KAAmB,W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EC,SAAAP,GAAY,UACf,KAEF,QAAC,OACC,qBAAC,OAAI,UAAU,yDACb,oBAAC,WACC,UAAU,gEACV,OAAO,6FACT,KACA,OAAC,QACC,KAAM,MAAG,gBAAaN,EAAK,MAAM,cAAc,CAAC,GAChD,KAAM,EACN,GAAG,IACH,UAAU,0GACZ,GACF,KAEA,OAAC,UACC,SAAUU,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbR,EAASF,CAAI,KACb,WAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBI,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",
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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,o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AS,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
6
  "names": ["RedeemableItem_exports", "__export", "RedeemableItem", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_classnames", "import_provider", "import_const", "import_utils", "import_lib", "import_NonProductValue", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "pageCommon", "brand", "isLogin", "rounded", "isDisabled", "redeemButtonText", "classNames", "e"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var E=(t,n)=>{for(var o in n)g(t,o,{get:n[o],enumerable:!0})},V=(t,n,o,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of H(n))!_.call(t,a)&&a!==o&&g(t,a,{get:()=>n[a],enumerable:!(p=q(n,a))||p.enumerable});return t};var J=t=>V(g({},"__esModule",{value:!0}),t);var Q={};E(Q,{CreditsWaysToGetCredits:()=>K});module.exports=J(Q);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),f=require("@heroicons/react/24/outline"),I=require("framer-motion"),l=require("react"),x=require("./type"),y=require("./useActions"),L=require("../context/provider"),d=require("@anker-in/lib"),M=require("../../registration"),R=require("../modal/creditsUploadReceiptModal"),T=require("../modal/subscribeModal"),U=require("../const");const K=({copy:t,classNames:n})=>{const[o,p]=(0,l.useState)(!1),{profile:a}=(0,L.useCreditsContext)(),{authCodeActivate:D}=(0,M.useRegistration)(),{brand:B}=(0,d.useHeadlessContext)(),k=U.roundedBrands.includes(B),b=!!a,[O,C]=(0,l.useState)(!1),[A,N]=(0,l.useState)(!1),[w,P]=(0,l.useState)(!1),[F,G]=(0,l.useState)(!1),{actions:h}=(0,y.useActions)({copy:t,subscribe:{openSubscribePopup:()=>N(!0),isSuccess:w},uploadReceipt:{openUploadReceiptPopup:()=>C(!0),isSuccess:F}}),W=(0,l.useMemo)(()=>{const s=t.list.map(r=>{if(!h[r.id])return;const{finished:c,notLogin:S,notFinished:v,completed:j}=h[r.id];let m="",u,z;return b?c?(m=j.buttonLabel,u=void 0):(m=v.buttonLabel,u=v.handleClick,z=v.link):(m=S.buttonLabel,u=S.handleClick),{...r,buttonLabel:m,handleClick:u,finished:c,link:z}}).filter(Boolean);return b?s.sort((r,c)=>r?.finished&&!c?.finished?1:!r?.finished&&c?.finished?-1:0):s},[h,t.list,b]);return(0,e.jsxs)(i.Container,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[(0,e.jsxs)("div",{className:(0,d.classNames)("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!k&&"rounded-none"),children:[(0,e.jsx)(i.Heading,{as:"h2",size:4,html:t?.title,className:"text-center l:pl-[16px] l:text-left"}),(0,e.jsxs)("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[(0,e.jsxs)("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[(0,e.jsx)(i.Heading,{size:3,as:"h3",html:t.subtitle,className:n?.subtitle}),(0,e.jsxs)("div",{className:"mt-[8px] flex items-center",children:[t.creditsIcon?.url&&(0,e.jsx)(i.Picture,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:t.creditsIcon.url,alt:t.creditsIcon.alt||"credits"}),(0,e.jsx)(i.Heading,{html:t.equalCredits,size:4,as:"h3",className:(0,d.classNames)("mt-2 text-white md:text-[24px]",n?.equalCreditsText)})]})]}),(0,e.jsx)(i.Picture,{className:"w-full laptop:w-[50%]",source:t.mainImage?.url})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)(I.motion.div,{className:(0,d.classNames)("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:o?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!o&&window.screen.width<768){const s=document.getElementById("ways-to-get-credits");s&&s.scrollIntoView({behavior:"smooth",block:"end"})}},children:[W.map(s=>(0,e.jsxs)("div",{className:(0,d.classNames)("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!k&&"rounded-none"),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Heading,{as:"h4",html:s.title,size:2,className:"text-pretty"}),(0,e.jsxs)("div",{className:"mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),s.handleClick&&!(s.id===x.TaskType.UploadReceipt&&F)&&!(s.id===x.TaskType.Activate&&D.isActivateSuccess)&&!(s.id===x.TaskType.Subscribe&&w)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!o&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),o?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{p(!1)},children:(0,e.jsx)(f.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>p(!o),children:(0,e.jsx)(f.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),t.receipt&&(0,e.jsx)(R.CreditsUploadReceiptModal,{isOpen:O,onClose:()=>{C(!1)},copy:t.receipt,onSuccess:()=>{G(!0)}}),t.subscribe&&(0,e.jsx)(T.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{P(!0)},isOpen:A,onClose:()=>{N(!1)}})]})};
1
+ "use strict";var g=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var E=(t,n)=>{for(var l in n)g(t,l,{get:n[l],enumerable:!0})},H=(t,n,l,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of j(n))!q.call(t,d)&&d!==l&&g(t,d,{get:()=>n[d],enumerable:!(p=_(n,d))||p.enumerable});return t};var V=t=>H(g({},"__esModule",{value:!0}),t);var K={};E(K,{CreditsWaysToGetCredits:()=>J});module.exports=V(K);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),f=require("@heroicons/react/24/outline"),I=require("framer-motion"),a=require("react"),x=require("./type"),y=require("./useActions"),D=require("../context/provider"),o=require("@anker-in/lib"),R=require("../../registration"),U=require("../modal/creditsUploadReceiptModal"),L=require("../modal/subscribeModal");const J=({copy:t,classNames:n})=>{const[l,p]=(0,a.useState)(!1),{profile:d}=(0,D.useCreditsContext)(),{authCodeActivate:M}=(0,R.useRegistration)(),{brand:T}=(0,o.useHeadlessContext)(),k=o.ROUNDED_BRANDS.includes(T),b=!!d,[O,C]=(0,a.useState)(!1),[A,N]=(0,a.useState)(!1),[w,B]=(0,a.useState)(!1),[F,P]=(0,a.useState)(!1),{actions:h}=(0,y.useActions)({copy:t,subscribe:{openSubscribePopup:()=>N(!0),isSuccess:w},uploadReceipt:{openUploadReceiptPopup:()=>C(!0),isSuccess:F}}),G=(0,a.useMemo)(()=>{const s=t.list.map(r=>{if(!h[r.id])return;const{finished:c,notLogin:S,notFinished:v,completed:W}=h[r.id];let m="",u,z;return b?c?(m=W.buttonLabel,u=void 0):(m=v.buttonLabel,u=v.handleClick,z=v.link):(m=S.buttonLabel,u=S.handleClick),{...r,buttonLabel:m,handleClick:u,finished:c,link:z}}).filter(Boolean);return b?s.sort((r,c)=>r?.finished&&!c?.finished?1:!r?.finished&&c?.finished?-1:0):s},[h,t.list,b]);return(0,e.jsxs)(i.Container,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[(0,e.jsxs)("div",{className:(0,o.classNames)("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!k&&"rounded-none"),children:[(0,e.jsx)(i.Heading,{as:"h2",size:4,html:t?.title,className:"text-center l:pl-[16px] l:text-left"}),(0,e.jsxs)("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[(0,e.jsxs)("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[(0,e.jsx)(i.Heading,{size:3,as:"h3",html:t.subtitle,className:n?.subtitle}),(0,e.jsxs)("div",{className:"mt-[8px] flex items-center",children:[t.creditsIcon?.url&&(0,e.jsx)(i.Picture,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:t.creditsIcon.url,alt:t.creditsIcon.alt||"credits"}),(0,e.jsx)(i.Heading,{html:t.equalCredits,size:4,as:"h3",className:(0,o.classNames)("mt-2 text-white md:text-[24px]",n?.equalCreditsText)})]})]}),(0,e.jsx)(i.Picture,{className:"w-full laptop:w-[50%]",source:t.mainImage?.url})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)(I.motion.div,{className:(0,o.classNames)("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:l?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!l&&window.screen.width<768){const s=document.getElementById("ways-to-get-credits");s&&s.scrollIntoView({behavior:"smooth",block:"end"})}},children:[G.map(s=>(0,e.jsxs)("div",{className:(0,o.classNames)("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!k&&"rounded-none"),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Heading,{as:"h4",html:s.title,size:2,className:"text-pretty"}),(0,e.jsxs)("div",{className:"mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),s.handleClick&&!(s.id===x.TaskType.UploadReceipt&&F)&&!(s.id===x.TaskType.Activate&&M.isActivateSuccess)&&!(s.id===x.TaskType.Subscribe&&w)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!l&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),l?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{p(!1)},children:(0,e.jsx)(f.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>p(!l),children:(0,e.jsx)(f.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),t.receipt&&(0,e.jsx)(U.CreditsUploadReceiptModal,{isOpen:O,onClose:()=>{C(!1)},copy:t.receipt,onSuccess:()=>{P(!0)}}),t.subscribe&&(0,e.jsx)(L.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{B(!0)},isOpen:A,onClose:()=>{N(!1)}})]})};
2
2
  //# sourceMappingURL=CreditsWaysToGetCredits.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx"],
4
- "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } 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": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAqGQ,IAAAI,EAAA,6BArGRC,EAA0D,iCAC1DC,EAA+C,uCAC/CC,EAAuB,yBACvBC,EAAkC,iBAElCC,EAA4D,kBAC5DC,EAA2B,wBAC3BC,EAAkC,+BAClCC,EAAqD,yBACrDC,EAAgC,8BAChCC,EAA0C,8CAC1CC,EAAsC,mCACtCC,EAA8B,oBAEvB,MAAMd,EAA0B,CAAC,CAAE,KAAAe,EAAM,WAAAC,CAAW,IAAoC,CAC7F,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxC,CAAE,QAAAC,CAAQ,KAAI,qBAAkB,EAChC,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,gBAAc,SAASD,CAAK,EACtC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K,KAAO,WAAS,eAAiBJ,IACxC,EAAEI,EAAK,KAAO,WAAS,UAAYd,EAAiB,oBACpD,EAAEc,EAAK,KAAO,WAAS,WAAaN,MAClC,OAAC,UACC,GAAIM,EAAK,KAAO,IAAM,SACrB,GAAIA,EAAK,MAAQ,CAAE,KAAMA,EAAK,IAAK,EACnC,GAAIA,EAAK,aAAe,CAAE,QAASA,EAAK,WAAY,EACrD,QAAQ,UACR,KAAK,KACL,UAAU,kBAET,SAAAA,EAAK,YACR,KAEA,OAAC,UAAO,QAAQ,UAAU,KAAK,KAAK,UAAU,kBAAkB,SAAQ,GACrE,SAAAA,EAAK,YACR,IAlCGA,EAAK,EAoCZ,CACD,EACA,CAACjB,MACA,OAAC,OACC,UAAU,qDACV,MAAO,CAAE,WAAY,mEAAoE,EAC1F,GAEL,EACCA,KACC,OAAC,UACC,UAAU,8CACV,QAAS,IAAM,CACbC,EAAY,EAAK,CACnB,EAEA,mBAAC,iBAAc,UAAU,kDAAkD,EAC7E,KAEA,mBACE,mBAAC,OAAI,UAAU,6EACb,mBAAC,UAAO,UAAU,QAAQ,QAAS,IAAMA,EAAY,CAACD,CAAQ,EAC5D,mBAAC,mBAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,GAEJ,GACF,EACCF,EAAK,YACJ,OAAC,6BACC,OAAQS,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMV,EAAK,QACX,UAAW,IAAM,CACfgB,EAA0B,EAAI,CAChC,EACF,EAEDhB,EAAK,cACJ,OAAC,yBACC,KAAMA,EAAK,UACX,UAAW,IAAM,CACfc,EAAsB,EAAI,CAC5B,EACA,OAAQH,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
6
- "names": ["CreditsWaysToGetCredits_exports", "__export", "CreditsWaysToGetCredits", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_framer_motion", "import_react", "import_type", "import_useActions", "import_provider", "import_lib", "import_registration", "import_creditsUploadReceiptModal", "import_subscribeModal", "import_const", "copy", "classNames", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "cn", "section"]
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 }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAoGQ,IAAAI,EAAA,6BApGRC,EAA0D,iCAC1DC,EAA+C,uCAC/CC,EAAuB,yBACvBC,EAAkC,iBAElCC,EAA4D,kBAC5DC,EAA2B,wBAC3BC,EAAkC,+BAClCC,EAAqE,yBACrEC,EAAgC,8BAChCC,EAA0C,8CAC1CC,EAAsC,mCAE/B,MAAMb,EAA0B,CAAC,CAAE,KAAAc,EAAM,WAAAC,CAAW,IAAoC,CAC7F,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxC,CAAE,QAAAC,CAAQ,KAAI,qBAAkB,EAChC,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EACvCE,EAAU,CAAC,CAACJ,EAEZ,CAACK,EAA0BC,CAA2B,KAAI,YAAS,EAAK,EACxE,CAACC,EAAsBC,CAAuB,KAAI,YAAS,EAAK,EAChE,CAACC,EAAoBC,CAAqB,KAAI,YAAS,EAAK,EAC5D,CAACC,EAAwBC,CAAyB,KAAI,YAAS,EAAK,EAEpE,CAAE,QAAAC,CAAQ,KAAI,cAAW,CAC7B,KAAAjB,EACA,UAAW,CACT,mBAAoB,IAAMY,EAAwB,EAAI,EACtD,UAAWC,CACb,EACA,cAAe,CACb,uBAAwB,IAAMH,EAA4B,EAAI,EAC9D,UAAWK,CACb,CACF,CAAC,EACKG,KAAO,WAAQ,IAAM,CACzB,MAAMA,EAAOlB,EAAK,KACf,IAAImB,GAAQ,CACX,GAAI,CAACF,EAAQE,EAAK,EAA0B,EAC1C,OAEF,KAAM,C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UAAU,8CACV,QAAS,IAAM,CACbC,EAAY,EAAK,CACnB,EAEA,mBAAC,iBAAc,UAAU,kDAAkD,EAC7E,KAEA,mBACE,mBAAC,OAAI,UAAU,6EACb,mBAAC,UAAO,UAAU,QAAQ,QAAS,IAAMA,EAAY,CAACD,CAAQ,EAC5D,mBAAC,mBAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,GAEJ,GACF,EACCF,EAAK,YACJ,OAAC,6BACC,OAAQS,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMV,EAAK,QACX,UAAW,IAAM,CACfgB,EAA0B,EAAI,CAChC,EACF,EAEDhB,EAAK,cACJ,OAAC,yBACC,KAAMA,EAAK,UACX,UAAW,IAAM,CACfc,EAAsB,EAAI,CAC5B,EACA,OAAQH,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
6
+ "names": ["CreditsWaysToGetCredits_exports", "__export", "CreditsWaysToGetCredits", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_framer_motion", "import_react", "import_type", "import_useActions", "import_provider", "import_lib", "import_registration", "import_creditsUploadReceiptModal", "import_subscribeModal", "copy", "classNames", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "cn", "section"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var j=Object.create;var b=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var x=(e,i)=>{for(var n in i)b(e,n,{get:i[n],enumerable:!0})},h=(e,i,n,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of U(i))!A.call(e,o)&&o!==n&&b(e,o,{get:()=>i[o],enumerable:!(s=_(i,o))||s.enumerable});return e};var G=(e,i,n)=>(n=e!=null?j(T(e)):{},h(i||!e||!e.__esModule?b(n,"default",{value:e,enumerable:!0}):n,e)),W=e=>h(b({},"__esModule",{value:!0}),e);var E={};x(E,{useActions:()=>$});module.exports=W(E);var r=require("@anker-in/lib"),t=require("./type"),k=require("../context/provider"),d=require("react"),L=G(require("../context/hooks/useReceiptUploaded")),f=require("../context/hooks/useFirstPurchaseFinished"),N=require("../context/hooks/useSubscribed"),C=require("../../registration");const $=({copy:e,subscribe:i,uploadReceipt:n,gaParameters:s})=>{const{openSignUpPopup:o,gtm:P,profile:l}=(0,k.useCreditsContext)(),{authCodeActivate:g}=(0,C.useRegistration)(),u=(0,N.useSubscribed)(),c=(0,f.useFirstPurchaseFinished)(),m=(0,L.default)(),{appName:v,passportUrl:F}=(0,r.useHeadlessContext)(),p=(0,d.useMemo)(()=>(l?.first_name||l?.last_name)&&l?.phone_number&&l?.dob,[l]);return(0,d.useMemo)(()=>{const a=({buttonName:S,id:w,callback:R})=>{(0,r.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:P.pageGroup,position:s?.position||e.title,button_name:S,info:w}}),R()};return{actions:{[t.TaskType.Activate]:{finished:l?.activated,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.Activate})},notFinished:{buttonLabel:e?.activate,handleClick:()=>a({buttonName:e?.activate,callback:()=>g.open(),id:t.TaskType.Activate})},completed:{buttonLabel:e?.completed}},[t.TaskType.Subscribe]:{finished:u,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.Subscribe})},notFinished:{buttonLabel:e?.subscribeLabel,handleClick:()=>a({buttonName:e?.subscribeLabel,callback:()=>i.openSubscribePopup(),id:t.TaskType.Subscribe})},completed:{buttonLabel:e?.completed}},[t.TaskType.CompleteProfile]:{finished:p,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.CompleteProfile})},notFinished:{buttonLabel:e?.completeProfile,link:`${F}/account/profile?app=${v}`,handleClick:()=>a({buttonName:e?.completeProfile,callback:()=>{},id:t.TaskType.CompleteProfile})},completed:{buttonLabel:e?.completed}},[t.TaskType.FirstPurchase]:{finished:c,notLogin:{buttonLabel:e?.makeFirstPurchase,handleClick:()=>a({buttonName:e?.makeFirstPurchase,callback:o,id:t.TaskType.FirstPurchase})},notFinished:{buttonLabel:e?.makeFirstPurchase,link:e?.goShopLink,handleClick:()=>a({buttonName:e?.makeFirstPurchase,callback:()=>{},id:t.TaskType.FirstPurchase})},completed:{buttonLabel:e?.completed}},[t.TaskType.UploadReceipt]:{finished:m,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.UploadReceipt})},notFinished:{buttonLabel:e?.uploadReceipt,handleClick:()=>a({buttonName:e?.uploadReceipt,callback:()=>n.openUploadReceiptPopup(),id:t.TaskType.UploadReceipt})},completed:{buttonLabel:e?.completed}},[t.TaskType.Shop]:{finished:!1,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.Shop})},notFinished:{buttonLabel:e?.shopNow,link:e?.goShopLink,handleClick:()=>a({buttonName:e?.shopNow,callback:()=>{},id:t.TaskType.Shop})},completed:{buttonLabel:e?.completed}}}}},[l?.activated,e?.joinNow,e?.activate,e?.completed,e?.subscribe,e?.completeProfile,e?.makeFirstPurchase,e?.uploadReceipt,e?.shopNow,e.title,e?.goShopLink,u,p,c,m,s?.position,o])};
1
+ "use strict";var j=Object.create;var b=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var x=(e,i)=>{for(var n in i)b(e,n,{get:i[n],enumerable:!0})},k=(e,i,n,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of U(i))!T.call(e,o)&&o!==n&&b(e,o,{get:()=>i[o],enumerable:!(s=_(i,o))||s.enumerable});return e};var G=(e,i,n)=>(n=e!=null?j(A(e)):{},k(i||!e||!e.__esModule?b(n,"default",{value:e,enumerable:!0}):n,e)),W=e=>k(b({},"__esModule",{value:!0}),e);var $={};x($,{useActions:()=>E});module.exports=W($);var r=require("@anker-in/lib"),t=require("./type"),L=require("../context/provider"),u=require("react"),f=G(require("../context/hooks/useReceiptUploaded")),N=require("../context/hooks/useFirstPurchaseFinished"),C=require("../context/hooks/useSubscribed"),P=require("../../registration");const E=({copy:e,subscribe:i,uploadReceipt:n,gaParameters:s})=>{const{openSignUpPopup:o,gtm:g,profile:l}=(0,L.useCreditsContext)(),{authCodeActivate:d}=(0,P.useRegistration)(),c=(0,C.useSubscribed)(),m=(0,N.useFirstPurchaseFinished)(),p=(0,f.default)(),{appName:v,passportUrl:F}=(0,r.useHeadlessContext)(),h=(0,u.useMemo)(()=>(l?.first_name||l?.last_name)&&l?.phone_number&&l?.dob,[l]);return(0,u.useMemo)(()=>{const a=({buttonName:S,id:w,callback:R})=>{(0,r.gaTrack)({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:g.pageGroup,position:s?.position||e.title,button_name:S,info:w}}),R()};return{actions:{[t.TaskType.Activate]:{finished:l?.activated,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.Activate})},notFinished:{buttonLabel:e?.activate,handleClick:()=>a({buttonName:e?.activate,callback:()=>{d.setAutoSendEmail(!0),d.open()},id:t.TaskType.Activate})},completed:{buttonLabel:e?.completed}},[t.TaskType.Subscribe]:{finished:c,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.Subscribe})},notFinished:{buttonLabel:e?.subscribeLabel,handleClick:()=>a({buttonName:e?.subscribeLabel,callback:()=>i.openSubscribePopup(),id:t.TaskType.Subscribe})},completed:{buttonLabel:e?.completed}},[t.TaskType.CompleteProfile]:{finished:h,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.CompleteProfile})},notFinished:{buttonLabel:e?.completeProfile,link:`${F}/account/profile?app=${v}`,handleClick:()=>a({buttonName:e?.completeProfile,callback:()=>{},id:t.TaskType.CompleteProfile})},completed:{buttonLabel:e?.completed}},[t.TaskType.FirstPurchase]:{finished:m,notLogin:{buttonLabel:e?.makeFirstPurchase,handleClick:()=>a({buttonName:e?.makeFirstPurchase,callback:o,id:t.TaskType.FirstPurchase})},notFinished:{buttonLabel:e?.makeFirstPurchase,link:e?.goShopLink,handleClick:()=>a({buttonName:e?.makeFirstPurchase,callback:()=>{},id:t.TaskType.FirstPurchase})},completed:{buttonLabel:e?.completed}},[t.TaskType.UploadReceipt]:{finished:p,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.UploadReceipt})},notFinished:{buttonLabel:e?.uploadReceipt,handleClick:()=>a({buttonName:e?.uploadReceipt,callback:()=>n.openUploadReceiptPopup(),id:t.TaskType.UploadReceipt})},completed:{buttonLabel:e?.completed}},[t.TaskType.Shop]:{finished:!1,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>a({buttonName:e?.joinNow,callback:o,id:t.TaskType.Shop})},notFinished:{buttonLabel:e?.shopNow,link:e?.goShopLink,handleClick:()=>a({buttonName:e?.shopNow,callback:()=>{},id:t.TaskType.Shop})},completed:{buttonLabel:e?.completed}}}}},[l?.activated,e?.joinNow,e?.activate,e?.completed,e?.subscribe,e?.completeProfile,e?.makeFirstPurchase,e?.uploadReceipt,e?.shopNow,e.title,e?.goShopLink,c,h,m,p,s?.position,o])};
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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4C,yBAE5CC,EAAyB,kBACzBC,EAAkC,+BAClCC,EAAwB,iBACxBC,EAA+B,kDAC/BC,EAAyC,qDACzCC,EAA8B,0CAG9BC,EAAgC,8BAEzB,MAAMT,EAAa,CAAC,CACzB,KAAAU,EACA,UAAAC,EACA,cAAAC,EACA,aAAAC,CACF,IAaM,CACJ,KAAM,CAAE,gBAAAC,EAAiB,IAAAC,EAAK,QAAAC,CAAQ,KAAI,qBAAkB,EACtD,CAAE,iBAAAC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AClB,SAAUI,EACV,GAAI,WAAS,IACf,CAAC,CACL,EACA,YAAa,CACX,YAAaJ,GAAM,QACnB,KAAMA,GAAM,WACZ,YAAa,IACXe,EAAqB,CACnB,WAAYf,GAAM,QAClB,SAAU,IAAM,CAAC,EACjB,GAAI,WAAS,IACf,CAAC,CACL,EACA,UAAW,CACT,YAAaA,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,EACAM,EACAL,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
+ "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AAG,CACxB,SAAUU,EACV,SAAU,CACR,YAAaV,GAAM,QACnB,YAAa,IACXe,EAAqB,CACnB,WAAYf,GAAM,QAClB,SAAUI,EACV,GAAI,WAAS,aACf,CAAC,CACL,EACA,YAAa,CACX,YAAaJ,GAAM,cACnB,YAAa,IACXe,EAAqB,CACnB,WAAYf,GAAM,cAClB,SAAU,IAAME,EAAc,uBAAuB,EACrD,GAAI,WAAS,aACf,CAAC,CACL,EACA,UAAW,CACT,YAAaF,GAAM,SACrB,CACF,EACA,CAAC,WAAS,IAAI,EAAG,CACf,SAAU,GACV,SAAU,CACR,YAAaA,GAAM,QACnB,YAAa,IACXe,EAAqB,CACnB,WAAYf,GAAM,QAClB,SAAUI,EACV,GAAI,WAAS,IACf,CAAC,CACL,EACA,YAAa,CACX,YAAaJ,GAAM,QACnB,KAAMA,GAAM,WACZ,YAAa,IACXe,EAAqB,CACnB,WAAYf,GAAM,QAClB,SAAU,IAAM,CAAC,EACjB,GAAI,WAAS,IACf,CAAC,CACL,EACA,UAAW,CACT,YAAaA,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,EACAM,EACAL,EACAC,EACAP,GAAc,SACdC,CACF,CAAC,CACH",
6
6
  "names": ["useActions_exports", "__export", "useActions", "__toCommonJS", "import_lib", "import_type", "import_provider", "import_react", "import_useReceiptUploaded", "import_useFirstPurchaseFinished", "import_useSubscribed", "import_registration", "copy", "subscribe", "uploadReceipt", "gaParameters", "openSignUpPopup", "gtm", "profile", "authCodeActivate", "isSubscribed", "firstPurchaseFinished", "uploadedReceipt", "useReceiptUploaded", "appName", "passportUrl", "profileCompleted", "handleClickWithTrack", "buttonName", "id", "callback"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var G=Object.create;var m=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Z=(o,n)=>{for(var i in n)m(o,i,{get:n[i],enumerable:!0})},R=(o,n,i,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Q(n))!X.call(o,a)&&a!==i&&m(o,a,{get:()=>n[a],enumerable:!(u=J(n,a))||u.enumerable});return o};var d=(o,n,i)=>(i=o!=null?G(W(o)):{},R(n||!o||!o.__esModule?m(i,"default",{value:o,enumerable:!0}):i,o)),ee=o=>R(m({},"__esModule",{value:!0}),o);var se={};Z(se,{default:()=>te});module.exports=ee(se);var s=require("react/jsx-runtime"),p=require("@anker-in/headless-ui"),g=d(require("classnames")),F=d(require("copy-to-clipboard")),h=d(require("dayjs")),r=require("react"),e=require("../context/const"),_=require("./modalContainer"),A=d(require("./tip")),D=d(require("./loadingDots")),v=d(require("../context/hooks/useMyRewards")),O=require("@anker-in/lib"),I=require("../const");function oe({data:o,...n}){const[i,u]=(0,r.useState)(e.AlpcConsumeType.Coupon),{brand:a}=(0,O.useHeadlessContext)(),x=I.roundedBrands.includes(a),[c,k]=(0,r.useState)(1),[f,U]=(0,r.useState)(1),[Y,y]=(0,r.useState)(-1),j=(0,r.useMemo)(()=>{const t=[];return o.couponTab&&t.push({title:o.couponTab,type:e.AlpcConsumeType.Coupon}),o.productTab&&t.push({title:o.productTab,type:e.AlpcConsumeType.Product}),t},[o.couponTab,o.productTab]),E=(0,r.useMemo)(()=>({page:n.isOpen?f:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Product}),[n.isOpen,f]),H=(0,r.useMemo)(()=>({page:n.isOpen?c:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Coupon}),[n.isOpen,c]),{myRewards:C=[],canNext:T,isLoading:$}=(0,v.default)(H),{myRewards:N=[],canNext:L,isLoading:z}=(0,v.default)(E),P=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?C.map(t=>({title:t.goods_title,value:t.consume_credits,type:e.RewardType.Received,date:new Date(t.create_time*1e3),couponCode:t.coupon_code,orderNumber:""})):i===e.AlpcConsumeType.Product?N.map(t=>{let l=e.RewardType.Pending;return t.fulfillment_status&&t.fulfillment_status!=="null"?t.fulfillment_status==="fulfilled"?l=e.RewardType.Fulfilled:l=e.RewardType.Unfulfilled:t.approval_status===e.ApprovalStatus.Success||t.approval_status===e.ApprovalStatus.DoubleConfirm?l=e.RewardType.ApproveSuccess:t.approval_status===e.ApprovalStatus.Failed&&(l=e.RewardType.Failed),{title:t.goods_title,value:t.consume_credits,type:l,date:new Date(t.create_time*1e3),orderNumber:t.order_number,couponCode:""}}):[],[i,N,C]),M=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?T:i===e.AlpcConsumeType.Product?L:!1,[i,T,L]),q=(0,r.useMemo)(()=>({[e.RewardType.Received]:o.receivedLabel,[e.RewardType.Pending]:o.pendingLabel,[e.RewardType.ApproveFail]:o.failedLabel,[e.RewardType.ApproveSuccess]:o.approveSuccessLabel,[e.RewardType.Unfulfilled]:o.unfulfilledLabel,[e.RewardType.Fulfilled]:o.fulfilledLabel,[e.RewardType.Failed]:o.failedLabel}),[o]),w=(0,r.useMemo)(()=>({[e.RewardType.Received]:"",[e.RewardType.Pending]:o.pendingTip,[e.RewardType.ApproveFail]:"",[e.RewardType.ApproveSuccess]:o.confirmedTip,[e.RewardType.Unfulfilled]:o.processingTip,[e.RewardType.Fulfilled]:o.ShippedTip,[e.RewardType.Failed]:""}),[o]),B=(0,r.useMemo)(()=>({[e.RewardType.Received]:"#52C41A",[e.RewardType.Pending]:"#999",[e.RewardType.ApproveFail]:"#F84D4F",[e.RewardType.ApproveSuccess]:"#999",[e.RewardType.Unfulfilled]:"#999",[e.RewardType.Fulfilled]:"#999",[e.RewardType.Failed]:"#F84D4F"}),[]),K=(0,r.useCallback)(()=>{M&&(i===e.AlpcConsumeType.Coupon?k(c+1):i===e.AlpcConsumeType.Product&&U(f+1))},[i,f,c,M]),V=(0,r.useCallback)((t,l)=>{y(l),(0,F.default)(t),setTimeout(()=>{y(-1)},2e3)},[]),S=i===e.AlpcConsumeType.Coupon?$:z;return(0,s.jsxs)(_.CreditsModalContainer,{title:o.title,className:(0,g.default)("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...n,onScrollEnd:K,children:[(0,s.jsx)("div",{className:"",children:(0,s.jsx)(p.Tabs,{align:"left",shape:x?"rounded":"square",value:i.toString(),onValueChange:t=>{u(Number(t))},children:(0,s.jsx)(p.TabsList,{children:j.map(t=>(0,s.jsx)(p.TabsTrigger,{value:t.type.toString(),children:t.title},t.type))})})}),S&&(0,s.jsx)("div",{className:"flex h-full flex-col items-center justify-center",children:(0,s.jsx)(D.default,{})}),!S&&(0,s.jsx)("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:P.length>0?(0,s.jsx)("div",{className:"grid gap-[18px] md:gap-[12px]",children:P.map((t,l)=>(0,s.jsxs)("div",{className:"grid gap-[8px]",children:[t?.orderNumber&&(0,s.jsxs)("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",t.orderNumber]}),(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!x&&"rounded-none"),children:[(0,s.jsxs)("div",{className:"grid gap-[4px]",children:[(0,s.jsx)("div",{className:"text-[16px] font-bold leading-[1.4]",children:t.title}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",t.value," ",o?.pointUnit]}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[t?.couponCode?`${o?.code||"Code"}: ${t.couponCode} `:"",t?.couponCode&&(0,s.jsx)("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{V(t.couponCode,l)},role:"button",tabIndex:0,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&b.preventDefault()},children:Y===l?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),(0,s.jsxs)("div",{className:"grid gap-[4px] text-right",children:[(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${B[t.type]}]`),children:[(0,s.jsx)("span",{children:q[t.type]}),w[t.type]&&(0,s.jsx)(A.default,{info:w[t.type],index:l})]}),(0,s.jsx)("div",{className:"text-[14px] font-semibold text-[#999]",children:(0,h.default)(t.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},l))}):(0,s.jsxs)("div",{className:"flex h-full flex-col items-center justify-center",children:[(0,s.jsx)(p.Picture,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),(0,s.jsx)("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var te=oe;
1
+ "use strict";var V=Object.create;var m=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var X=(o,n)=>{for(var i in n)m(o,i,{get:n[i],enumerable:!0})},F=(o,n,i,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of J(n))!W.call(o,a)&&a!==i&&m(o,a,{get:()=>n[a],enumerable:!(u=G(n,a))||u.enumerable});return o};var d=(o,n,i)=>(i=o!=null?V(Q(o)):{},F(n||!o||!o.__esModule?m(i,"default",{value:o,enumerable:!0}):i,o)),Z=o=>F(m({},"__esModule",{value:!0}),o);var te={};X(te,{default:()=>oe});module.exports=Z(te);var s=require("react/jsx-runtime"),p=require("@anker-in/headless-ui"),g=d(require("classnames")),_=d(require("copy-to-clipboard")),h=d(require("dayjs")),r=require("react"),e=require("../context/const"),D=require("./modalContainer"),A=d(require("./tip")),O=d(require("./loadingDots")),x=d(require("../context/hooks/useMyRewards")),b=require("@anker-in/lib");function ee({data:o,...n}){const[i,u]=(0,r.useState)(e.AlpcConsumeType.Coupon),{brand:a}=(0,b.useHeadlessContext)(),y=b.ROUNDED_BRANDS.includes(a),[c,I]=(0,r.useState)(1),[f,U]=(0,r.useState)(1),[k,C]=(0,r.useState)(-1),E=(0,r.useMemo)(()=>{const t=[];return o.couponTab&&t.push({title:o.couponTab,type:e.AlpcConsumeType.Coupon}),o.productTab&&t.push({title:o.productTab,type:e.AlpcConsumeType.Product}),t},[o.couponTab,o.productTab]),Y=(0,r.useMemo)(()=>({page:n.isOpen?f:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Product}),[n.isOpen,f]),j=(0,r.useMemo)(()=>({page:n.isOpen?c:0,pageSize:1e3,consumeType:e.AlpcConsumeType.Coupon}),[n.isOpen,c]),{myRewards:N=[],canNext:T,isLoading:H}=(0,x.default)(j),{myRewards:L=[],canNext:P,isLoading:$}=(0,x.default)(Y),M=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?N.map(t=>({title:t.goods_title,value:t.consume_credits,type:e.RewardType.Received,date:new Date(t.create_time*1e3),couponCode:t.coupon_code,orderNumber:""})):i===e.AlpcConsumeType.Product?L.map(t=>{let l=e.RewardType.Pending;return t.fulfillment_status&&t.fulfillment_status!=="null"?t.fulfillment_status==="fulfilled"?l=e.RewardType.Fulfilled:l=e.RewardType.Unfulfilled:t.approval_status===e.ApprovalStatus.Success||t.approval_status===e.ApprovalStatus.DoubleConfirm?l=e.RewardType.ApproveSuccess:t.approval_status===e.ApprovalStatus.Failed&&(l=e.RewardType.Failed),{title:t.goods_title,value:t.consume_credits,type:l,date:new Date(t.create_time*1e3),orderNumber:t.order_number,couponCode:""}}):[],[i,L,N]),w=(0,r.useMemo)(()=>i===e.AlpcConsumeType.Coupon?T:i===e.AlpcConsumeType.Product?P:!1,[i,T,P]),z=(0,r.useMemo)(()=>({[e.RewardType.Received]:o.receivedLabel,[e.RewardType.Pending]:o.pendingLabel,[e.RewardType.ApproveFail]:o.failedLabel,[e.RewardType.ApproveSuccess]:o.approveSuccessLabel,[e.RewardType.Unfulfilled]:o.unfulfilledLabel,[e.RewardType.Fulfilled]:o.fulfilledLabel,[e.RewardType.Failed]:o.failedLabel}),[o]),R=(0,r.useMemo)(()=>({[e.RewardType.Received]:"",[e.RewardType.Pending]:o.pendingTip,[e.RewardType.ApproveFail]:"",[e.RewardType.ApproveSuccess]:o.confirmedTip,[e.RewardType.Unfulfilled]:o.processingTip,[e.RewardType.Fulfilled]:o.ShippedTip,[e.RewardType.Failed]:""}),[o]),q=(0,r.useMemo)(()=>({[e.RewardType.Received]:"#52C41A",[e.RewardType.Pending]:"#999",[e.RewardType.ApproveFail]:"#F84D4F",[e.RewardType.ApproveSuccess]:"#999",[e.RewardType.Unfulfilled]:"#999",[e.RewardType.Fulfilled]:"#999",[e.RewardType.Failed]:"#F84D4F"}),[]),B=(0,r.useCallback)(()=>{w&&(i===e.AlpcConsumeType.Coupon?I(c+1):i===e.AlpcConsumeType.Product&&U(f+1))},[i,f,c,w]),K=(0,r.useCallback)((t,l)=>{C(l),(0,_.default)(t),setTimeout(()=>{C(-1)},2e3)},[]),S=i===e.AlpcConsumeType.Coupon?H:$;return(0,s.jsxs)(D.CreditsModalContainer,{title:o.title,className:(0,g.default)("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...n,onScrollEnd:B,children:[(0,s.jsx)("div",{className:"",children:(0,s.jsx)(p.Tabs,{align:"left",shape:y?"rounded":"square",value:i.toString(),onValueChange:t=>{u(Number(t))},children:(0,s.jsx)(p.TabsList,{children:E.map(t=>(0,s.jsx)(p.TabsTrigger,{value:t.type.toString(),children:t.title},t.type))})})}),S&&(0,s.jsx)("div",{className:"flex h-full flex-col items-center justify-center",children:(0,s.jsx)(O.default,{})}),!S&&(0,s.jsx)("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:M.length>0?(0,s.jsx)("div",{className:"grid gap-[18px] md:gap-[12px]",children:M.map((t,l)=>(0,s.jsxs)("div",{className:"grid gap-[8px]",children:[t?.orderNumber&&(0,s.jsxs)("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",t.orderNumber]}),(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!y&&"rounded-none"),children:[(0,s.jsxs)("div",{className:"grid gap-[4px]",children:[(0,s.jsx)("div",{className:"text-[16px] font-bold leading-[1.4]",children:t.title}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",t.value," ",o?.pointUnit]}),(0,s.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[t?.couponCode?`${o?.code||"Code"}: ${t.couponCode} `:"",t?.couponCode&&(0,s.jsx)("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{K(t.couponCode,l)},role:"button",tabIndex:0,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&v.preventDefault()},children:k===l?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),(0,s.jsxs)("div",{className:"grid gap-[4px] text-right",children:[(0,s.jsxs)("div",{className:(0,g.default)("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${q[t.type]}]`),children:[(0,s.jsx)("span",{children:z[t.type]}),R[t.type]&&(0,s.jsx)(A.default,{info:R[t.type],index:l})]}),(0,s.jsx)("div",{className:"text-[14px] font-semibold text-[#999]",children:(0,h.default)(t.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},l))}):(0,s.jsxs)("div",{className:"flex h-full flex-col items-center justify-center",children:[(0,s.jsx)(p.Picture,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),(0,s.jsx)("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var oe=ee;
2
2
  //# sourceMappingURL=MyRewardsModal.js.map