@anker-in/campaign-ui 0.5.0-beta.9 → 0.5.1-beta.1

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 (200) hide show
  1. package/dist/cjs/components/LiveChatWidget/components/MessageContent/TextBlock.js +1 -1
  2. package/dist/cjs/components/LiveChatWidget/components/MessageContent/TextBlock.js.map +3 -3
  3. package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
  4. package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
  5. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  6. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
  7. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +1 -1
  8. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
  9. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +1 -1
  10. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
  11. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
  12. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  13. package/dist/cjs/components/credits/context/hooks/useShippingCountries.d.ts +8 -0
  14. package/dist/cjs/components/credits/context/hooks/useShippingCountries.js +2 -0
  15. package/dist/cjs/components/credits/context/hooks/useShippingCountries.js.map +7 -0
  16. package/dist/cjs/components/credits/context/provider.d.ts +2 -1
  17. package/dist/cjs/components/credits/context/provider.js +1 -1
  18. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  19. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  20. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  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/index.js +1 -1
  24. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  25. package/dist/cjs/components/memberPopup/MemberPopup.d.ts +1 -1
  26. package/dist/cjs/components/memberPopup/MemberPopup.js +1 -1
  27. package/dist/cjs/components/memberPopup/MemberPopup.js.map +3 -3
  28. package/dist/cjs/components/memberPopup/context/provider.d.ts +3 -3
  29. package/dist/cjs/components/memberPopup/context/provider.js +1 -1
  30. package/dist/cjs/components/memberPopup/context/provider.js.map +3 -3
  31. package/dist/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.d.ts +1 -4
  32. package/dist/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.js +1 -1
  33. package/dist/cjs/components/memberPopup/panels/ActivitiesSubscribePanel.js.map +3 -3
  34. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +8 -7
  35. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +1 -1
  36. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +3 -3
  37. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.d.ts +1 -2
  38. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js +1 -1
  39. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/index.js.map +3 -3
  40. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.d.ts +1 -2
  41. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js +1 -1
  42. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +3 -3
  43. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.d.ts +1 -3
  44. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +1 -1
  45. package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +3 -3
  46. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.d.ts +1 -2
  47. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +1 -1
  48. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +3 -3
  49. package/dist/cjs/components/memberPopup/panels/EarnCredits/index.d.ts +1 -8
  50. package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js +1 -1
  51. package/dist/cjs/components/memberPopup/panels/EarnCredits/index.js.map +3 -3
  52. package/dist/cjs/components/memberPopup/panels/Referral/index.js +1 -1
  53. package/dist/cjs/components/memberPopup/panels/Referral/index.js.map +3 -3
  54. package/dist/cjs/components/memberPopup/type.d.ts +25 -2
  55. package/dist/cjs/components/memberPopup/type.js +1 -1
  56. package/dist/cjs/components/memberPopup/type.js.map +1 -1
  57. package/dist/cjs/templates/Credits.js +1 -1
  58. package/dist/cjs/templates/Credits.js.map +3 -3
  59. package/dist/cjs/templates/Credits.types.d.ts +1 -0
  60. package/dist/cjs/templates/Credits.types.js.map +1 -1
  61. package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js +1 -1
  62. package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js.map +3 -3
  63. package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
  64. package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
  65. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  66. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
  67. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +1 -1
  68. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
  69. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
  70. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
  71. package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
  72. package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  73. package/dist/esm/components/credits/context/hooks/useShippingCountries.d.ts +8 -0
  74. package/dist/esm/components/credits/context/hooks/useShippingCountries.js +2 -0
  75. package/dist/esm/components/credits/context/hooks/useShippingCountries.js.map +7 -0
  76. package/dist/esm/components/credits/context/provider.d.ts +2 -1
  77. package/dist/esm/components/credits/context/provider.js +1 -1
  78. package/dist/esm/components/credits/context/provider.js.map +3 -3
  79. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  80. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.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/index.js +1 -1
  84. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  85. package/dist/esm/components/memberPopup/MemberPopup.d.ts +1 -1
  86. package/dist/esm/components/memberPopup/MemberPopup.js +1 -1
  87. package/dist/esm/components/memberPopup/MemberPopup.js.map +3 -3
  88. package/dist/esm/components/memberPopup/context/provider.d.ts +3 -3
  89. package/dist/esm/components/memberPopup/context/provider.js +1 -1
  90. package/dist/esm/components/memberPopup/context/provider.js.map +3 -3
  91. package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.d.ts +1 -4
  92. package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.js +1 -1
  93. package/dist/esm/components/memberPopup/panels/ActivitiesSubscribePanel.js.map +3 -3
  94. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.d.ts +8 -7
  95. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js +1 -1
  96. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.js.map +3 -3
  97. package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.d.ts +1 -2
  98. package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js +1 -1
  99. package/dist/esm/components/memberPopup/panels/ConsumeCredits/index.js.map +3 -3
  100. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.d.ts +1 -2
  101. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js +1 -1
  102. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivatePanel.js.map +3 -3
  103. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.d.ts +1 -3
  104. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js +1 -1
  105. package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.js.map +3 -3
  106. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.d.ts +1 -2
  107. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js +1 -1
  108. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.js.map +3 -3
  109. package/dist/esm/components/memberPopup/panels/EarnCredits/index.d.ts +1 -8
  110. package/dist/esm/components/memberPopup/panels/EarnCredits/index.js +1 -1
  111. package/dist/esm/components/memberPopup/panels/EarnCredits/index.js.map +3 -3
  112. package/dist/esm/components/memberPopup/panels/Referral/index.js +1 -1
  113. package/dist/esm/components/memberPopup/panels/Referral/index.js.map +3 -3
  114. package/dist/esm/components/memberPopup/type.d.ts +25 -2
  115. package/dist/esm/components/memberPopup/type.js +1 -1
  116. package/dist/esm/components/memberPopup/type.js.map +1 -1
  117. package/dist/esm/templates/Credits.js +1 -1
  118. package/dist/esm/templates/Credits.js.map +3 -3
  119. package/dist/esm/templates/Credits.types.d.ts +1 -0
  120. package/dist/esm/templates/Credits.types.js.map +1 -1
  121. package/package.json +2 -1
  122. package/src/components/LiveChatWidget/components/MessageContent/TextBlock.tsx +7 -5
  123. package/src/components/credits/context/hooks/useMyRewards.ts +2 -2
  124. package/src/components/credits/context/hooks/useRedeemCoupon.ts +2 -2
  125. package/src/components/credits/context/hooks/useRedeemGoGift.ts +2 -2
  126. package/src/components/credits/context/hooks/useRedeemProduct.ts +2 -2
  127. package/src/components/credits/context/hooks/useRedeemableList.ts +2 -2
  128. package/src/components/credits/context/hooks/useShippingCountries.ts +60 -0
  129. package/src/components/credits/context/provider.tsx +4 -0
  130. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +3 -3
  131. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +2 -2
  132. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +2 -2
  133. package/src/components/memberPopup/MemberPopup.tsx +179 -180
  134. package/src/components/memberPopup/context/provider.tsx +24 -4
  135. package/src/components/memberPopup/panels/ActivitiesSubscribePanel.tsx +66 -73
  136. package/src/components/memberPopup/panels/ConsumeCredits/RedeemCouponPanel.tsx +38 -55
  137. package/src/components/memberPopup/panels/ConsumeCredits/index.tsx +207 -106
  138. package/src/components/memberPopup/panels/EarnCredits/ActivatePanel.tsx +32 -16
  139. package/src/components/memberPopup/panels/EarnCredits/CompleteProfilePanel.tsx +60 -35
  140. package/src/components/memberPopup/panels/EarnCredits/SubscribeEmailPanel.tsx +32 -22
  141. package/src/components/memberPopup/panels/EarnCredits/index.tsx +55 -48
  142. package/src/components/memberPopup/panels/Referral/index.tsx +40 -22
  143. package/src/components/memberPopup/type.ts +26 -3
  144. package/src/templates/Credits.tsx +26 -0
  145. package/src/templates/Credits.types.ts +1 -0
  146. package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.d.ts +0 -10
  147. package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.js +0 -2
  148. package/dist/cjs/components/memberPopup/panels/Activity/SubscribeModal.js.map +0 -7
  149. package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.d.ts +0 -7
  150. package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js +0 -2
  151. package/dist/cjs/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js.map +0 -7
  152. package/dist/cjs/components/memberPopup/panels/Activity/index.d.ts +0 -7
  153. package/dist/cjs/components/memberPopup/panels/Activity/index.js +0 -2
  154. package/dist/cjs/components/memberPopup/panels/Activity/index.js.map +0 -7
  155. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.d.ts +0 -19
  156. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js +0 -2
  157. package/dist/cjs/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js.map +0 -7
  158. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.d.ts +0 -11
  159. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js +0 -2
  160. package/dist/cjs/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js.map +0 -7
  161. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.d.ts +0 -10
  162. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.js +0 -2
  163. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribeModal.js.map +0 -7
  164. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.d.ts +0 -9
  165. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.js +0 -2
  166. package/dist/cjs/components/memberPopup/panels/EarnCredits/SubscribePanel.js.map +0 -7
  167. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.d.ts +0 -13
  168. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js +0 -2
  169. package/dist/cjs/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js.map +0 -7
  170. package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.d.ts +0 -10
  171. package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.js +0 -2
  172. package/dist/esm/components/memberPopup/panels/Activity/SubscribeModal.js.map +0 -7
  173. package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.d.ts +0 -7
  174. package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js +0 -2
  175. package/dist/esm/components/memberPopup/panels/Activity/hooks/useActivitySubscribe.js.map +0 -7
  176. package/dist/esm/components/memberPopup/panels/Activity/index.d.ts +0 -7
  177. package/dist/esm/components/memberPopup/panels/Activity/index.js +0 -2
  178. package/dist/esm/components/memberPopup/panels/Activity/index.js.map +0 -7
  179. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.d.ts +0 -19
  180. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js +0 -2
  181. package/dist/esm/components/memberPopup/panels/ConsumeCredits/RedeemCouponModal.js.map +0 -7
  182. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.d.ts +0 -11
  183. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js +0 -2
  184. package/dist/esm/components/memberPopup/panels/EarnCredits/ActivitiesSubscribePanel.js.map +0 -7
  185. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.d.ts +0 -10
  186. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js +0 -2
  187. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribeModal.js.map +0 -7
  188. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.d.ts +0 -9
  189. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.js +0 -2
  190. package/dist/esm/components/memberPopup/panels/EarnCredits/SubscribePanel.js.map +0 -7
  191. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.d.ts +0 -13
  192. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js +0 -2
  193. package/dist/esm/components/memberPopup/panels/Referral/hooks/useReferralDashboard.js.map +0 -7
  194. package/dist/index.d.mts +0 -1775
  195. package/dist/index.d.ts +0 -1775
  196. package/dist/index.js +0 -18542
  197. package/dist/index.js.map +0 -1
  198. package/dist/index.mjs +0 -18514
  199. package/dist/index.mjs.map +0 -1
  200. package/src/components/memberPopup/panels/EarnCredits/CompleteProfileModal.tsx +0 -191
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var F=(t,s)=>{for(var d in s)g(t,d,{get:s[d],enumerable:!0})},O=(t,s,d,f)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of R(s))!y.call(t,o)&&o!==d&&g(t,o,{get:()=>s[o],enumerable:!(f=M(s,o))||f.enumerable});return t};var V=t=>O(g({},"__esModule",{value:!0}),t);var G={};F(G,{default:()=>q});module.exports=V(G);var e=require("react/jsx-runtime"),m=require("react"),p=require("@anker-in/lib"),w=require("../../context/provider"),P=require("../../context/viewStack"),E=require("./hooks/useSubscribed"),n=require("../../type"),r=require("../../icons"),N=require("../../../credits/context/utils"),T=require("../../../../constants");function z({id:t,className:s}){switch(t){case n.EarnCreditsTaskType.Activate:return(0,e.jsx)(r.IconLock,{className:s});case n.EarnCreditsTaskType.Subscribe:return(0,e.jsx)(r.IconSubscription,{className:s});case n.EarnCreditsTaskType.Shop:return(0,e.jsx)(r.IconBag,{className:s});case n.EarnCreditsTaskType.CompleteProfile:return(0,e.jsx)(r.IconOrders,{className:s})}}function H({copy:t,onClose:s,isSubscribeSuccess:d=!1,isActivateSuccess:f=!1,isProfileCompleteSuccess:o=!1,onSubscribeSuccess:I,onActivateSuccess:_,onProfileCompleteSuccess:A}){const{profile:a,openSignUpPopup:x,alpcConfig:h,creditInfo:b}=(0,w.useMemberPopupContext)(),{pushView:u}=(0,P.useViewStack)(),{locale:B}=h,{brand:C}=(0,p.useHeadlessContext)(),v=T.ROUNDED_BRANDS.includes(C);console.log("creditInfo",b);const l=!!a,k=(0,E.useSubscribed)({userId:a?.user_id,brand:C,email:a?.email,locale:B,apiBaseUrl:h.apiBaseUrl}),S=(0,m.useMemo)(()=>o||!!(a?.first_name||a?.last_name)&&!!a?.phone_number&&!!a?.dob,[a,o]),L=(0,m.useMemo)(()=>({[n.EarnCreditsTaskType.Activate]:{finished:!!a?.activated||f,onClick:l?()=>u({type:n.MemberPopupPanelType.Activate,props:{onSuccess:_}}):x},[n.EarnCreditsTaskType.CompleteProfile]:{finished:S,onClick:l?()=>u({type:n.MemberPopupPanelType.CompleteProfile,props:{onSuccess:A}}):x},[n.EarnCreditsTaskType.Subscribe]:{finished:k||d,onClick:l?()=>u({type:n.MemberPopupPanelType.SubscribeEmail,props:{onSuccess:I}}):x},[n.EarnCreditsTaskType.Shop]:{finished:!1,link:t.goShopLink,onClick:l?void 0:x}}),[a,l,f,o,S,k,d,x,u,t.goShopLink]),U=(0,m.useMemo)(()=>t.list.map(i=>{const c=L[i.id];if(!c)return null;const D=c.finished?t.completed:l?j(i.id,t):t.joinNow;return{...i,...c,buttonLabel:D}}).filter(Boolean),[t,L,l]);return(0,e.jsxs)("div",{className:"flex flex-col gap-[16px]",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-[16px]",children:[(0,e.jsx)("div",{className:"flex flex-col gap-[8px]",children:t.title&&(0,e.jsx)("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:t.title})}),l&&(0,e.jsxs)("div",{className:(0,p.classNames)("flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]",v?"rounded-[8px]":"rounded-none"),children:[(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,e.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:t.balanceLabel??"AnkerCredits Balance"}),(0,e.jsxs)("div",{className:"flex items-end gap-[4px]",children:[(0,e.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,N.numberFormat)(b?.available_credit??0)}),(0,e.jsx)("span",{className:"text-[14px] font-[700] leading-[1.4] text-[#1e2024]",children:t.creditUnit??"ankercredits"})]})]}),(0,e.jsx)("div",{className:"h-full w-px bg-[#dadce0]"}),(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,e.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:t.comingSoonLabel??"Coming Soon"}),(0,e.jsxs)("div",{className:"flex items-end gap-[4px]",children:[(0,e.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,N.numberFormat)(b?.pending_credit??0)}),(0,e.jsx)("span",{className:"text-[14px] font-[700] leading-[1.4] text-[#1e2024]",children:t.creditUnit??"ankercredits"})]})]})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-[16px]",children:[t.subtitle&&(0,e.jsx)("p",{className:"text-[16px] font-[700] text-[#1e2024]",children:t.subtitle}),(0,e.jsx)("div",{className:"flex flex-col",children:U.map((i,c)=>(0,e.jsxs)("div",{className:"relative py-[16px]",children:[c>0&&(0,e.jsx)("div",{className:"absolute left-0 right-0 top-0 h-px bg-[#dadce0]"}),(0,e.jsxs)("div",{className:(0,p.classNames)("flex items-center gap-[12px]",i.finished&&"opacity-60"),children:[(0,e.jsx)(z,{id:i.id,className:"size-[24px] shrink-0"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"text-[16px] font-[700] text-[#1e2024]",children:i.title}),i.description&&(0,e.jsx)("div",{className:"mt-[4px] text-[14px] font-[700] text-[#4a4c56]",children:i.description})]}),!i.finished&&i.link&&l?(0,e.jsx)("a",{href:i.link,target:"_blank",rel:"noopener noreferrer",className:(0,p.classNames)("cursor-pointer bg-[#080a0f] min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white",v?"rounded-[4px]":"rounded-none"),children:i.buttonLabel}):(0,e.jsx)("button",{className:(0,p.classNames)("cursor-pointer min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white",i.finished?"bg-[#767880]":"bg-[#080a0f]",v?"rounded-[4px]":"rounded-none"),disabled:i.finished,onClick:i.finished?void 0:i.onClick,children:i.buttonLabel})]})]},c))})]})]})}function j(t,s){switch(t){case n.EarnCreditsTaskType.Activate:return s.activate;case n.EarnCreditsTaskType.CompleteProfile:return s.completeProfileLabel;case n.EarnCreditsTaskType.Subscribe:return s.subscribeLabel;case n.EarnCreditsTaskType.Shop:return s.shopNow}}var q=H;
1
+ "use strict";var b=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var z=(s,t)=>{for(var n in t)b(s,n,{get:t[n],enumerable:!0})},D=(s,t,n,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of R(t))!y.call(s,r)&&r!==n&&b(s,r,{get:()=>t[r],enumerable:!(f=M(t,r))||f.enumerable});return s};var F=s=>D(b({},"__esModule",{value:!0}),s);var j={};z(j,{default:()=>W});module.exports=F(j);var e=require("react/jsx-runtime"),p=require("react"),d=require("@anker-in/lib"),_=require("../../context/provider"),E=require("../../context/viewStack"),P=require("./hooks/useSubscribed"),i=require("../../type"),c=require("../../icons"),v=require("../../../credits/context/utils"),L=require("../../../../constants"),g=require("@anker-in/headless-ui");function O({id:s,className:t}){switch(s){case i.EarnCreditsTaskType.Activate:return(0,e.jsx)(c.IconLock,{className:t});case i.EarnCreditsTaskType.Subscribe:return(0,e.jsx)(c.IconSubscription,{className:t});case i.EarnCreditsTaskType.Shop:return(0,e.jsx)(c.IconBag,{className:t});case i.EarnCreditsTaskType.CompleteProfile:return(0,e.jsx)(c.IconOrders,{className:t})}}function V({copy:s}){const{profile:t,openSignUpPopup:n,alpcConfig:f,creditInfo:r,fetchCreditInfo:B,isSubscribeSuccess:C,isActivateSuccess:N,isProfileCompleteSuccess:u}=(0,_.useMemberPopupContext)(),{pushView:x}=(0,E.useViewStack)(),{locale:w}=f,{brand:k}=(0,d.useHeadlessContext)(),A=L.ROUNDED_BRANDS.includes(k);(0,p.useEffect)(()=>{t?.user_id&&B(t.user_id)},[]);const o=!!t,h=(0,P.useSubscribed)({userId:t?.user_id,brand:k,email:t?.email,locale:w,apiBaseUrl:f.apiBaseUrl}),S=(0,p.useMemo)(()=>u||!!(t?.first_name||t?.last_name)&&!!t?.phone_number&&!!t?.dob,[t,u]);function m(a){const l={[i.EarnCreditsTaskType.Activate]:"activate",[i.EarnCreditsTaskType.CompleteProfile]:"complete_profile",[i.EarnCreditsTaskType.Subscribe]:"subscribe",[i.EarnCreditsTaskType.Shop]:"shop"};(0,d.gaTrack)({event:"ga4Event",event_name:"lp_button",event_parameters:{position:"earn_credits",button_name:l[a],info:"Member Floating Window"}})}const T=(0,p.useMemo)(()=>({[i.EarnCreditsTaskType.Activate]:{finished:!!t?.activated||N,onClick:o?()=>{m(i.EarnCreditsTaskType.Activate),x({type:i.MemberPopupPanelType.Activate})}:n},[i.EarnCreditsTaskType.CompleteProfile]:{finished:S,onClick:o?()=>{m(i.EarnCreditsTaskType.CompleteProfile),x({type:i.MemberPopupPanelType.CompleteProfile})}:n},[i.EarnCreditsTaskType.Subscribe]:{finished:h||C,onClick:o?()=>{m(i.EarnCreditsTaskType.Subscribe),x({type:i.MemberPopupPanelType.SubscribeEmail})}:n},[i.EarnCreditsTaskType.Shop]:{finished:!1,link:s.goShopLink,onClick:o?()=>m(i.EarnCreditsTaskType.Shop):n}}),[t,o,N,u,S,h,C,n,x,s.goShopLink]),I=(0,p.useMemo)(()=>s.list.map(a=>{const l=T[a.id];if(!l)return null;const U=l.finished?s.completed:o?H(a.id,s):s.joinNow;return{...a,...l,buttonLabel:U}}).filter(Boolean),[s,T,o]);return(0,e.jsxs)("div",{className:"flex flex-col gap-[16px]",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-[16px]",children:[(0,e.jsx)("div",{className:"flex flex-col gap-[8px]",children:s.title&&(0,e.jsx)("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:s.title})}),o&&(0,e.jsxs)("div",{className:(0,d.classNames)("flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]",A?"rounded-[8px]":"rounded-none"),children:[(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,e.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:s.balanceLabel??"AnkerCredits Balance"}),(0,e.jsxs)("div",{className:"flex items-end gap-[4px]",children:[(0,e.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,v.numberFormat)(r?.available_credit??0)}),(0,e.jsx)("span",{className:"text-[14px] font-[700] leading-[1.4] text-[#1e2024]",children:s.creditUnit??"ankercredits"})]})]}),(0,e.jsx)("div",{className:"h-full w-px bg-[#dadce0]"}),(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,e.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:s.comingSoonLabel??"Coming Soon"}),(0,e.jsxs)("div",{className:"flex items-end gap-[4px]",children:[(0,e.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,v.numberFormat)(r?.pending_credit??0)}),(0,e.jsx)("span",{className:"text-[14px] font-[700] leading-[1.4] text-[#1e2024]",children:s.creditUnit??"ankercredits"})]})]})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-[16px]",children:[s.subtitle&&(0,e.jsx)("p",{className:"text-[16px] font-[700] text-[#1e2024]",children:s.subtitle}),(0,e.jsx)("div",{className:"flex flex-col",children:I.map((a,l)=>(0,e.jsxs)("div",{className:"relative py-[16px]",children:[l>0&&(0,e.jsx)("div",{className:"absolute left-0 right-0 top-0 h-px bg-[#dadce0]"}),(0,e.jsxs)("div",{className:(0,d.classNames)("flex items-center gap-[12px]"),children:[(0,e.jsx)(O,{id:a.id,className:"size-[24px] shrink-0"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"text-[16px] font-[700] text-[#1e2024]",children:a.title}),a.credits&&(0,e.jsx)("div",{className:"mt-[4px] text-[14px] font-bold text-[#4A4C56]",children:a.credits})]}),!a.finished&&a.link&&o?(0,e.jsx)(g.Button,{as:"a",size:"base",href:a.link,target:"_blank",rel:"noopener noreferrer",className:"min-w-[116px]",onClick:()=>m(a.id),children:a.buttonLabel}):(0,e.jsx)(g.Button,{size:"base",disabled:a.finished,className:"min-w-[116px]",onClick:a.onClick,children:a.buttonLabel})]})]},l))})]})]})}function H(s,t){switch(s){case i.EarnCreditsTaskType.Activate:return t.activate;case i.EarnCreditsTaskType.CompleteProfile:return t.completeProfileLabel;case i.EarnCreditsTaskType.Subscribe:return t.subscribeLabel;case i.EarnCreditsTaskType.Shop:return t.shopNow}}var W=V;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/memberPopup/panels/EarnCredits/index.tsx"],
4
- "sourcesContent": ["import { useMemo } from 'react'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useViewStack } from '../../context/viewStack'\nimport { useSubscribed } from './hooks/useSubscribed'\nimport { EarnCreditsTaskType, MemberPopupPanelType, type EarnCreditsCopy } from '../../type'\nimport { IconBag, IconLock, IconSubscription, IconOrders } from '../../icons'\nimport { numberFormat } from '../../../credits/context/utils'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\nfunction TaskIcon({ id, className }: { id: EarnCreditsTaskType; className?: string }) {\n switch (id) {\n case EarnCreditsTaskType.Activate:\n return <IconLock className={className} />\n case EarnCreditsTaskType.Subscribe:\n return <IconSubscription className={className} />\n case EarnCreditsTaskType.Shop:\n return <IconBag className={className} />\n case EarnCreditsTaskType.CompleteProfile:\n return <IconOrders className={className} />\n }\n}\n\ntype Props = {\n copy: EarnCreditsCopy\n onClose: () => void\n isSubscribeSuccess?: boolean\n isActivateSuccess?: boolean\n isProfileCompleteSuccess?: boolean\n onSubscribeSuccess?: () => void\n onActivateSuccess?: () => void\n onProfileCompleteSuccess?: () => void\n}\n\nfunction EarnCredits({\n copy,\n onClose,\n isSubscribeSuccess = false,\n isActivateSuccess = false,\n isProfileCompleteSuccess = false,\n onSubscribeSuccess,\n onActivateSuccess,\n onProfileCompleteSuccess,\n}: Props) {\n const { profile, openSignUpPopup, alpcConfig, creditInfo } = useMemberPopupContext()\n const { pushView } = useViewStack()\n const { locale } = alpcConfig\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n console.log('creditInfo', creditInfo)\n\n const isLogin = !!profile\n\n const isSubscribed = useSubscribed({\n userId: profile?.user_id,\n brand: brand,\n email: profile?.email,\n locale,\n apiBaseUrl: alpcConfig.apiBaseUrl,\n })\n\n const profileCompleted = useMemo(() => {\n return (\n isProfileCompleteSuccess ||\n (!!(profile?.first_name || profile?.last_name) && !!profile?.phone_number && !!profile?.dob)\n )\n }, [profile, isProfileCompleteSuccess])\n\n const taskStates: Record<EarnCreditsTaskType, { finished: boolean; onClick?: () => void; link?: string }> = useMemo(\n () => ({\n [EarnCreditsTaskType.Activate]: {\n finished: !!profile?.activated || isActivateSuccess,\n onClick: isLogin\n ? () =>\n pushView({\n type: MemberPopupPanelType.Activate,\n props: { onSuccess: onActivateSuccess },\n })\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.CompleteProfile]: {\n finished: profileCompleted,\n onClick: isLogin\n ? () =>\n pushView({\n type: MemberPopupPanelType.CompleteProfile,\n props: { onSuccess: onProfileCompleteSuccess },\n })\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Subscribe]: {\n finished: isSubscribed || isSubscribeSuccess,\n onClick: isLogin\n ? () =>\n pushView({\n type: MemberPopupPanelType.SubscribeEmail,\n props: { onSuccess: onSubscribeSuccess },\n })\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Shop]: {\n finished: false,\n link: copy.goShopLink,\n onClick: isLogin ? undefined : openSignUpPopup,\n },\n }),\n [\n profile,\n isLogin,\n isActivateSuccess,\n isProfileCompleteSuccess,\n profileCompleted,\n isSubscribed,\n isSubscribeSuccess,\n openSignUpPopup,\n pushView,\n copy.goShopLink,\n ]\n )\n\n const list = useMemo(() => {\n return copy.list\n .map(item => {\n const state = taskStates[item.id]\n if (!state) return null\n const buttonLabel = state.finished\n ? copy.completed\n : isLogin\n ? getNotFinishedLabel(item.id, copy)\n : copy.joinNow\n return { ...item, ...state, buttonLabel }\n })\n .filter(Boolean) as ((typeof copy.list)[number] & {\n finished: boolean\n onClick?: () => void\n link?: string\n buttonLabel: string\n })[]\n }, [copy, taskStates, isLogin])\n\n return (\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[8px]\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n </div>\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.balanceLabel ?? 'AnkerCredits Balance'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.available_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n <div className=\"h-full w-px bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.comingSoonLabel ?? 'Coming Soon'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.pending_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex flex-col gap-[16px]\">\n {copy.subtitle && <p className=\"text-[16px] font-[700] text-[#1e2024]\">{copy.subtitle}</p>}\n\n <div className=\"flex flex-col\">\n {list.map((item, idx) => (\n <div key={idx} className=\"relative py-[16px]\">\n {idx > 0 && <div className=\"absolute left-0 right-0 top-0 h-px bg-[#dadce0]\" />}\n <div className={cn('flex items-center gap-[12px]', item.finished && 'opacity-60')}>\n <TaskIcon id={item.id} className=\"size-[24px] shrink-0\" />\n <div className=\"flex-1\">\n <div className=\"text-[16px] font-[700] text-[#1e2024]\">{item.title}</div>\n {item.description && (\n <div className=\"mt-[4px] text-[14px] font-[700] text-[#4a4c56]\">{item.description}</div>\n )}\n </div>\n {!item.finished && item.link && isLogin ? (\n <a\n href={item.link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'cursor-pointer bg-[#080a0f] min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n >\n {item.buttonLabel}\n </a>\n ) : (\n <button\n className={cn(\n 'cursor-pointer min-w-[118px] px-[20px] pb-[10px] pt-[11px] text-[14px] font-[700] leading-[1.2] text-white',\n item.finished ? 'bg-[#767880]' : 'bg-[#080a0f]',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n disabled={item.finished}\n onClick={!item.finished ? item.onClick : undefined}\n >\n {item.buttonLabel}\n </button>\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\nfunction getNotFinishedLabel(id: EarnCreditsTaskType, copy: EarnCreditsCopy): string {\n switch (id) {\n case EarnCreditsTaskType.Activate:\n return copy.activate\n case EarnCreditsTaskType.CompleteProfile:\n return copy.completeProfileLabel\n case EarnCreditsTaskType.Subscribe:\n return copy.subscribeLabel\n case EarnCreditsTaskType.Shop:\n return copy.shopNow\n }\n}\n\nexport default EarnCredits\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAaa,IAAAI,EAAA,6BAbbC,EAAwB,i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EAAAI,YACT,6GACAJ,EAAK,SAAW,eAAiB,eACjCN,EAAU,gBAAkB,cAC9B,EACA,SAAUM,EAAK,SACf,QAAUA,EAAK,SAA0B,OAAfA,EAAK,QAE9B,SAAAA,EAAK,YACR,GAEJ,IAnCQK,CAoCV,CACD,EACH,GACF,GACF,CAEJ,CAEA,SAASF,EAAoB3B,EAAyBG,EAA+B,CACnF,OAAQH,EAAI,CACV,KAAK,sBAAoB,SACvB,OAAOG,EAAK,SACd,KAAK,sBAAoB,gBACvB,OAAOA,EAAK,qBACd,KAAK,sBAAoB,UACvB,OAAOA,EAAK,eACd,KAAK,sBAAoB,KACvB,OAAOA,EAAK,OAChB,CACF,CAEA,IAAOhB,EAAQe",
6
- "names": ["EarnCredits_exports", "__export", "EarnCredits_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_lib", "import_provider", "import_viewStack", "import_useSubscribed", "import_type", "import_icons", "import_utils", "import_constants", "TaskIcon", "id", "className", "EarnCredits", "copy", "onClose", "isSubscribeSuccess", "isActivateSuccess", "isProfileCompleteSuccess", "onSubscribeSuccess", "onActivateSuccess", "onProfileCompleteSuccess", "profile", "openSignUpPopup", "alpcConfig", "creditInfo", "pushView", "locale", "brand", "rounded", "isLogin", "isSubscribed", "profileCompleted", "taskStates", "list", "item", "state", "buttonLabel", "getNotFinishedLabel", "cn", "idx"]
4
+ "sourcesContent": ["import { useEffect, useMemo } from 'react'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useViewStack } from '../../context/viewStack'\nimport { useSubscribed } from './hooks/useSubscribed'\nimport { EarnCreditsTaskType, MemberPopupPanelType, type EarnCreditsCopy } from '../../type'\nimport { IconBag, IconLock, IconSubscription, IconOrders } from '../../icons'\nimport { numberFormat } from '../../../credits/context/utils'\nimport { ROUNDED_BRANDS } from '../../../../constants'\nimport { Button } from '@anker-in/headless-ui'\n\nfunction TaskIcon({ id, className }: { id: EarnCreditsTaskType; className?: string }) {\n switch (id) {\n case EarnCreditsTaskType.Activate:\n return <IconLock className={className} />\n case EarnCreditsTaskType.Subscribe:\n return <IconSubscription className={className} />\n case EarnCreditsTaskType.Shop:\n return <IconBag className={className} />\n case EarnCreditsTaskType.CompleteProfile:\n return <IconOrders className={className} />\n }\n}\n\ntype Props = {\n copy: EarnCreditsCopy\n}\n\nfunction EarnCredits({ copy }: Props) {\n const {\n profile,\n openSignUpPopup,\n alpcConfig,\n creditInfo,\n fetchCreditInfo,\n isSubscribeSuccess,\n isActivateSuccess,\n isProfileCompleteSuccess,\n } = useMemberPopupContext()\n const { pushView } = useViewStack()\n const { locale } = alpcConfig\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n useEffect(() => {\n if (profile?.user_id) fetchCreditInfo(profile.user_id)\n }, [])\n\n const isLogin = !!profile\n\n const isSubscribed = useSubscribed({\n userId: profile?.user_id,\n brand: brand,\n email: profile?.email,\n locale,\n apiBaseUrl: alpcConfig.apiBaseUrl,\n })\n\n const profileCompleted = useMemo(() => {\n return (\n isProfileCompleteSuccess ||\n (!!(profile?.first_name || profile?.last_name) && !!profile?.phone_number && !!profile?.dob)\n )\n }, [profile, isProfileCompleteSuccess])\n\n function trackTaskButton(taskId: EarnCreditsTaskType) {\n const taskButtonNameMap: Record<EarnCreditsTaskType, string> = {\n [EarnCreditsTaskType.Activate]: 'activate',\n [EarnCreditsTaskType.CompleteProfile]: 'complete_profile',\n [EarnCreditsTaskType.Subscribe]: 'subscribe',\n [EarnCreditsTaskType.Shop]: 'shop',\n }\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position: 'earn_credits',\n button_name: taskButtonNameMap[taskId],\n info: 'Member Floating Window',\n },\n })\n }\n\n const taskStates: Record<EarnCreditsTaskType, { finished: boolean; onClick?: () => void; link?: string }> = useMemo(\n () => ({\n [EarnCreditsTaskType.Activate]: {\n finished: !!profile?.activated || isActivateSuccess,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.Activate)\n pushView({\n type: MemberPopupPanelType.Activate,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.CompleteProfile]: {\n finished: profileCompleted,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.CompleteProfile)\n pushView({\n type: MemberPopupPanelType.CompleteProfile,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Subscribe]: {\n finished: isSubscribed || isSubscribeSuccess,\n onClick: isLogin\n ? () => {\n trackTaskButton(EarnCreditsTaskType.Subscribe)\n pushView({\n type: MemberPopupPanelType.SubscribeEmail,\n })\n }\n : openSignUpPopup,\n },\n [EarnCreditsTaskType.Shop]: {\n finished: false,\n link: copy.goShopLink,\n onClick: isLogin ? () => trackTaskButton(EarnCreditsTaskType.Shop) : openSignUpPopup,\n },\n }),\n [\n profile,\n isLogin,\n isActivateSuccess,\n isProfileCompleteSuccess,\n profileCompleted,\n isSubscribed,\n isSubscribeSuccess,\n openSignUpPopup,\n pushView,\n copy.goShopLink,\n ]\n )\n\n const list = useMemo(() => {\n return copy.list\n .map(item => {\n const state = taskStates[item.id]\n if (!state) return null\n const buttonLabel = state.finished\n ? copy.completed\n : isLogin\n ? getNotFinishedLabel(item.id, copy)\n : copy.joinNow\n return { ...item, ...state, buttonLabel }\n })\n .filter(Boolean) as ((typeof copy.list)[number] & {\n finished: boolean\n onClick?: () => void\n link?: string\n buttonLabel: string\n })[]\n }, [copy, taskStates, isLogin])\n\n return (\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[16px]\">\n <div className=\"flex flex-col gap-[8px]\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n </div>\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.balanceLabel ?? 'AnkerCredits Balance'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.available_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n <div className=\"h-full w-px bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.comingSoonLabel ?? 'Coming Soon'}</div>\n <div className=\"flex items-end gap-[4px]\">\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {numberFormat(creditInfo?.pending_credit ?? 0)}\n </span>\n <span className=\"text-[14px] font-[700] leading-[1.4] text-[#1e2024]\">\n {copy.creditUnit ?? 'ankercredits'}\n </span>\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex flex-col gap-[16px]\">\n {copy.subtitle && <p className=\"text-[16px] font-[700] text-[#1e2024]\">{copy.subtitle}</p>}\n\n <div className=\"flex flex-col\">\n {list.map((item, idx) => (\n <div key={idx} className=\"relative py-[16px]\">\n {idx > 0 && <div className=\"absolute left-0 right-0 top-0 h-px bg-[#dadce0]\" />}\n <div className={cn('flex items-center gap-[12px]')}>\n <TaskIcon id={item.id} className=\"size-[24px] shrink-0\" />\n <div className=\"flex-1\">\n <div className=\"text-[16px] font-[700] text-[#1e2024]\">{item.title}</div>\n {item.credits && <div className=\"mt-[4px] text-[14px] font-bold text-[#4A4C56]\">{item.credits}</div>}\n </div>\n {!item.finished && item.link && isLogin ? (\n <Button\n as=\"a\"\n size=\"base\"\n href={item.link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"min-w-[116px]\"\n onClick={() => trackTaskButton(item.id)}\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button size=\"base\" disabled={item.finished} className=\"min-w-[116px]\" onClick={item.onClick}>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\nfunction getNotFinishedLabel(id: EarnCreditsTaskType, copy: EarnCreditsCopy): string {\n switch (id) {\n case EarnCreditsTaskType.Activate:\n return copy.activate\n case EarnCreditsTaskType.CompleteProfile:\n return copy.completeProfileLabel\n case EarnCreditsTaskType.Subscribe:\n return copy.subscribeLabel\n case EarnCreditsTaskType.Shop:\n return copy.shopNow\n }\n}\n\nexport default EarnCredits\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAca,IAAAI,EAAA,6BAdbC,EAAmC,iBACnCC,EAA8D,yBAC9DC,EAAsC,kCACtCC,EAA6B,mCAC7BC,EAA8B,iCAC9BC,EAAgF,sBAChFC,EAAgE,uBAChEC,EAA6B,0CAC7BC,EAA+B,iCAC/BC,EAAuB,iCAEvB,SAASC,EAAS,CAAE,GAAAC,EAAI,UAAAC,CAAU,EAAoD,CACpF,OAAQD,EAAI,CACV,KAAK,sBAAoB,SACvB,SAAO,OAAC,YAAS,UAAWC,EAAW,EACzC,KAAK,sBAAoB,UACvB,SAAO,OAAC,oBAAiB,UAAWA,EAAW,EACjD,KAAK,sBAAoB,KACvB,SAAO,OAAC,WAAQ,UAAWA,EAAW,EACxC,KAAK,sBAAoB,gBACvB,SAAO,OAAC,cAAW,UAAWA,EAAW,CAC7C,CACF,CAMA,SAASC,EAAY,CAAE,KAAAC,CAAK,EAAU,CACpC,KAAM,CACJ,QAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,yBAAAC,CACF,KAAI,yBAAsB,EACpB,CAAE,SAAAC,CAAS,KAAI,gBAAa,EAC5B,CAAE,OAAAC,CAAO,EAAIP,EACb,CAAE,MAAAQ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["EarnCredits_exports", "__export", "EarnCredits_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_lib", "import_provider", "import_viewStack", "import_useSubscribed", "import_type", "import_icons", "import_utils", "import_constants", "import_headless_ui", "TaskIcon", "id", "className", "EarnCredits", "copy", "profile", "openSignUpPopup", "alpcConfig", "creditInfo", "fetchCreditInfo", "isSubscribeSuccess", "isActivateSuccess", "isProfileCompleteSuccess", "pushView", "locale", "brand", "rounded", "isLogin", "isSubscribed", "profileCompleted", "trackTaskButton", "taskId", "taskButtonNameMap", "taskStates", "list", "item", "state", "buttonLabel", "getNotFinishedLabel", "cn", "idx"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var o in t)d(e,o,{get:t[o],enumerable:!0})},L=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of b(t))!w.call(e,l)&&l!==o&&d(e,l,{get:()=>t[l],enumerable:!(r=N(t,l))||r.enumerable});return e};var T=e=>L(d({},"__esModule",{value:!0}),e);var M={};C(M,{default:()=>D});module.exports=T(M);var a=require("react/jsx-runtime"),m=require("@anker-in/headless-ui"),n=require("@anker-in/lib"),g=require("../../context/provider"),u=require("./hooks/useReferralOverview"),x=require("../../../credits/context/utils"),h=require("../../../../constants");function P({copy:e,onClose:t}){const{profile:o,alpcConfig:r}=(0,g.useMemberPopupContext)(),l=!!o,{brand:v,currencyCode:f="USD"}=(0,n.useHeadlessContext)(),i=h.ROUNDED_BRANDS.includes(v),{data:s}=(0,u.useReferralOverview)(),c=s?.data?.data?.available??0,p=s?.data?.data?.pending??0;return console.log("cashAvailable",c),console.log("cashPending",p),console.log("data",s),console.log("data.data",s?.data),(0,a.jsxs)("div",{className:"flex flex-col gap-[12px]",children:[e.title&&(0,a.jsx)("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:e.title}),l&&(0,a.jsxs)("div",{className:(0,n.classNames)("flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]",i?"rounded-[8px]":"rounded-none"),children:[(0,a.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,a.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashAvailableLabel}),(0,a.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,x.formatPrice)({amount:c,currencyCode:f,locale:r.locale})})]}),(0,a.jsx)("div",{className:"h-full w-px self-stretch bg-[#dadce0]"}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,a.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashPendingLabel}),(0,a.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,x.formatPrice)({amount:p,currencyCode:f,locale:r.locale})})]})]}),(e.howToTitle||e.howToDescription)&&(0,a.jsxs)("div",{className:"flex flex-col gap-[8px]",children:[e.howToTitle&&(0,a.jsx)("h3",{className:"text-[20px] font-[700] leading-[1.2] text-[#080a0f]",children:e.howToTitle}),e.howToDescription&&(0,a.jsx)("p",{className:"text-[14px] leading-[1.5] text-[#1e2024]",children:e.howToDescription}),e.learnMoreLabel&&e.learnMoreUrl&&(0,a.jsxs)("a",{href:e.learnMoreUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline",children:[e.learnMoreLabel,(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,a.jsx)("path",{d:"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z",fill:"#080A0F"})})]})]}),e.image?.url&&(0,a.jsx)(m.Picture,{source:e.image.url,alt:e.image.alt??"",className:(0,n.classNames)("mt-[8px] h-[100px] w-full object-cover",i?"rounded-[8px]":"rounded-none")}),e.ctaButton&&(0,a.jsx)("a",{href:e.ctaUrl??"#",target:"_blank",rel:"noopener noreferrer",className:(0,n.classNames)("block w-full cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white",i?"rounded-[4px]":"rounded-none"),children:e.ctaButton})]})}var D=P;
1
+ "use strict";var f=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var P=(e,a)=>{for(var n in a)f(e,n,{get:a[n],enumerable:!0})},U=(e,a,n,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of R(a))!_.call(e,l)&&l!==n&&f(e,l,{get:()=>a[l],enumerable:!(o=T(a,l))||o.enumerable});return e};var D=e=>U(f({},"__esModule",{value:!0}),e);var k={};P(k,{default:()=>B});module.exports=D(k);var t=require("react/jsx-runtime"),s=require("@anker-in/headless-ui"),r=require("@anker-in/lib"),u=require("../../context/provider"),v=require("./hooks/useReferralOverview"),d=require("../../../credits/context/utils"),h=require("../../../../constants");function M({copy:e,onClose:a}){const{profile:n,alpcConfig:o,pageHandle:l}=(0,u.useMemberPopupContext)(),b=!!n,{brand:N,currencyCode:x="USD"}=(0,r.useHeadlessContext)(),m=h.ROUNDED_BRANDS.includes(N),{data:c}=(0,v.useReferralOverview)(),w=c?.data?.data?.available??0,C=c?.data?.data?.pending??0;function p(i){try{if(!l)return i;const g=new URL(i,window.location.href);return g.searchParams.set("ref",`${l}_referral`),g.toString()}catch{return i}}function L(){(0,r.gaTrack)({event:"ga4Event",event_name:"lp_button",event_parameters:{position:"referral",button_name:"referral_cta",info:"Member Floating Window"}})}return(0,t.jsxs)("div",{className:"flex flex-col",children:[e.title&&(0,t.jsx)("h2",{className:"text-[24px] font-[700] leading-[1.2] text-[#080a0f]",children:e.title}),b&&(0,t.jsxs)("div",{className:(0,r.classNames)("flex items-center mt-[16px] gap-[12px] bg-[#f5f6f7] p-[16px]",m?"rounded-[8px]":"rounded-none"),children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,t.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashAvailableLabel}),(0,t.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,d.formatPrice)({amount:w,currencyCode:x,locale:o.locale})})]}),(0,t.jsx)("div",{className:"h-full w-px self-stretch bg-[#dadce0]"}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-[4px]",children:[(0,t.jsx)("div",{className:"text-[14px] font-[700] text-[#1e2024]",children:e.cashPendingLabel}),(0,t.jsx)("span",{className:"text-[24px] font-[700] leading-[1.2] text-[#1e2024]",children:(0,d.formatPrice)({amount:C,currencyCode:x,locale:o.locale})})]})]}),(e.howToTitle||e.howToDescription)&&(0,t.jsxs)("div",{className:"flex mt-[32px] flex-col gap-[8px]",children:[e.howToTitle&&(0,t.jsx)("h3",{className:"text-[20px] font-bold leading-[1.2] text-[#080a0f]",children:e.howToTitle}),e.howToDescription&&(0,t.jsx)("p",{className:"text-[14px] font-bold leading-[1.4] text-[#080A0F]",children:e.howToDescription}),e.learnMoreLabel&&e.learnMoreUrl&&(0,t.jsxs)("a",{href:p(e.learnMoreUrl),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline",children:[e.learnMoreLabel,(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,t.jsx)("path",{d:"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z",fill:"#080A0F"})})]})]}),e.image?.url&&(0,t.jsx)(s.Picture,{source:e.image.url,alt:e.image.alt??"",className:(0,r.classNames)("mt-[8px] w-full",m?"rounded-[8px]":"rounded-none")}),e.ctaButton&&(0,t.jsx)(s.Button,{size:"base",as:"a",className:"mt-[16px]",href:e.ctaUrl?p(e.ctaUrl):"#",target:"_blank",rel:"noopener noreferrer",onClick:L,children:e.ctaButton})]})}var B=M;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/memberPopup/panels/Referral/index.tsx"],
4
- "sourcesContent": ["import { Picture } from '@anker-in/headless-ui'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useReferralOverview } from './hooks/useReferralOverview'\nimport { formatPrice } from '../../../credits/context/utils'\n\nimport type { ReferralCopy } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n copy: ReferralCopy\n onClose: () => void\n}\n\nfunction Referral({ copy, onClose }: Props) {\n const { profile, alpcConfig } = useMemberPopupContext()\n const isLogin = !!profile\n const { brand, currencyCode = 'USD' as string } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const { data } = useReferralOverview()\n\n const cashAvailable = data?.data?.data?.available ?? 0\n const cashPending = data?.data?.data?.pending ?? 0\n\n console.log('cashAvailable', cashAvailable)\n console.log('cashPending', cashPending)\n console.log('data', data)\n console.log('data.data', data?.data)\n\n return (\n <div className=\"flex flex-col gap-[12px]\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashAvailableLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashAvailable, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n <div className=\"h-full w-px self-stretch bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashPendingLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashPending, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n </div>\n )}\n\n {(copy.howToTitle || copy.howToDescription) && (\n <div className=\"flex flex-col gap-[8px]\">\n {copy.howToTitle && (\n <h3 className=\"text-[20px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.howToTitle}</h3>\n )}\n {copy.howToDescription && <p className=\"text-[14px] leading-[1.5] text-[#1e2024]\">{copy.howToDescription}</p>}\n {copy.learnMoreLabel && copy.learnMoreUrl && (\n <a\n href={copy.learnMoreUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline\"\n >\n {copy.learnMoreLabel}\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z\"\n fill=\"#080A0F\"\n />\n </svg>\n </a>\n )}\n </div>\n )}\n\n {copy.image?.url && (\n <Picture\n source={copy.image.url}\n alt={copy.image.alt ?? ''}\n className={cn('mt-[8px] h-[100px] w-full object-cover', rounded ? 'rounded-[8px]' : 'rounded-none')}\n />\n )}\n\n {copy.ctaButton && (\n <a\n href={copy.ctaUrl ?? '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\n 'block w-full cursor-pointer bg-[#080a0f] py-[14px] text-center text-[14px] font-[700] text-white',\n rounded ? 'rounded-[4px]' : 'rounded-none'\n )}\n >\n {copy.ctaButton}\n </a>\n )}\n </div>\n )\n}\n\nexport default Referral\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgCqB,IAAAI,EAAA,6BAhCrBC,EAAwB,iCACxBC,EAAqD,yBACrDC,EAAsC,kCACtCC,EAAoC,uCACpCC,EAA4B,0CAG5BC,EAA+B,iCAO/B,SAASC,EAAS,CAAE,KAAAC,EAAM,QAAAC,CAAQ,EAAU,CAC1C,KAAM,CAAE,QAAAC,EAAS,WAAAC,CAAW,KAAI,yBAAsB,EAChDC,EAAU,CAAC,CAACF,EACZ,CAAE,MAAAG,EAAO,aAAAC,EAAe,KAAgB,KAAI,sBAAmB,EAC/DC,EAAU,iBAAe,SAASF,CAAK,EAEvC,CAAE,KAAAG,CAAK,KAAI,uBAAoB,EAE/BC,EAAgBD,GAAM,MAAM,MAAM,WAAa,EAC/CE,EAAcF,GAAM,MAAM,MAAM,SAAW,EAEjD,eAAQ,IAAI,gBAAiBC,CAAa,EAC1C,QAAQ,IAAI,cAAeC,CAAW,EACtC,QAAQ,IAAI,OAAQF,CAAI,EACxB,QAAQ,IAAI,YAAaA,GAAM,IAAI,KAGjC,QAAC,OAAI,UAAU,2BACZ,UAAAR,EAAK,UAAS,OAAC,MAAG,UAAU,sDAAuD,SAAAA,EAAK,MAAM,EAE9FI,MACC,QAAC,OACC,aAAW,EAAAO,YACT,qDACAJ,EAAU,gBAAkB,cAC9B,EAEA,qBAAC,OAAI,UAAU,iCACb,oBAAC,OAAI,UAAU,wCAAyC,SAAAP,EAAK,mBAAmB,KAChF,OAAC,QAAK,UAAU,sDACb,2BAAY,CAAE,OAAQS,EAAe,aAAAH,EAAc,OAAQH,EAAW,MAAO,CAAC,EACjF,GACF,KACA,OAAC,OAAI,UAAU,wCAAwC,KACvD,QAAC,OAAI,UAAU,iCACb,oBAAC,OAAI,UAAU,wCAAyC,SAAAH,EAAK,iBAAiB,KAC9E,OAAC,QAAK,UAAU,sDACb,2BAAY,CAAE,OAAQU,EAAa,aAAAJ,EAAc,OAAQH,EAAW,MAAO,CAAC,EAC/E,GACF,GACF,GAGAH,EAAK,YAAcA,EAAK,sBACxB,QAAC,OAAI,UAAU,0BACZ,UAAAA,EAAK,eACJ,OAAC,MAAG,UAAU,sDAAuD,SAAAA,EAAK,WAAW,EAEtFA,EAAK,qBAAoB,OAAC,KAAE,UAAU,2CAA4C,SAAAA,EAAK,iBAAiB,EACxGA,EAAK,gBAAkBA,EAAK,iBAC3B,QAAC,KACC,KAAMA,EAAK,aACX,OAAO,SACP,IAAI,sBACJ,UAAU,8EAET,UAAAA,EAAK,kBACN,OAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACnD,mBAAC,QACC,EAAE,kUACF,KAAK,UACP,EACF,GACF,GAEJ,EAGDA,EAAK,OAAO,QACX,OAAC,WACC,OAAQA,EAAK,MAAM,IACnB,IAAKA,EAAK,MAAM,KAAO,GACvB,aAAW,EAAAW,YAAG,yCAA0CJ,EAAU,gBAAkB,cAAc,EACpG,EAGDP,EAAK,cACJ,OAAC,KACC,KAAMA,EAAK,QAAU,IACrB,OAAO,SACP,IAAI,sBACJ,aAAW,EAAAW,YACT,mGACAJ,EAAU,gBAAkB,cAC9B,EAEC,SAAAP,EAAK,UACR,GAEJ,CAEJ,CAEA,IAAOV,EAAQS",
6
- "names": ["Referral_exports", "__export", "Referral_default", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_lib", "import_provider", "import_useReferralOverview", "import_utils", "import_constants", "Referral", "copy", "onClose", "profile", "alpcConfig", "isLogin", "brand", "currencyCode", "rounded", "data", "cashAvailable", "cashPending", "cn"]
4
+ "sourcesContent": ["import { Button, Picture } from '@anker-in/headless-ui'\nimport { gaTrack, classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useMemberPopupContext } from '../../context/provider'\nimport { useReferralOverview } from './hooks/useReferralOverview'\nimport { formatPrice } from '../../../credits/context/utils'\n\nimport type { ReferralCopy } from '../../type'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype Props = {\n copy: ReferralCopy\n onClose: () => void\n}\n\nfunction Referral({ copy, onClose }: Props) {\n const { profile, alpcConfig, pageHandle } = useMemberPopupContext()\n const isLogin = !!profile\n const { brand, currencyCode = 'USD' as string } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const { data } = useReferralOverview()\n\n const cashAvailable = data?.data?.data?.available ?? 0\n const cashPending = data?.data?.data?.pending ?? 0\n\n function buildRefUrl(url: string) {\n try {\n if (!pageHandle) return url\n const target = new URL(url, window.location.href)\n target.searchParams.set('ref', `${pageHandle}_referral`)\n return target.toString()\n } catch {\n return url\n }\n }\n\n function trackReferralCta() {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n position: 'referral',\n button_name: 'referral_cta',\n info: 'Member Floating Window',\n },\n })\n }\n\n return (\n <div className=\"flex flex-col\">\n {copy.title && <h2 className=\"text-[24px] font-[700] leading-[1.2] text-[#080a0f]\">{copy.title}</h2>}\n\n {isLogin && (\n <div\n className={cn(\n 'flex items-center mt-[16px] gap-[12px] bg-[#f5f6f7] p-[16px]',\n rounded ? 'rounded-[8px]' : 'rounded-none'\n )}\n >\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashAvailableLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashAvailable, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n <div className=\"h-full w-px self-stretch bg-[#dadce0]\" />\n <div className=\"flex flex-1 flex-col gap-[4px]\">\n <div className=\"text-[14px] font-[700] text-[#1e2024]\">{copy.cashPendingLabel}</div>\n <span className=\"text-[24px] font-[700] leading-[1.2] text-[#1e2024]\">\n {formatPrice({ amount: cashPending, currencyCode, locale: alpcConfig.locale })}\n </span>\n </div>\n </div>\n )}\n\n {(copy.howToTitle || copy.howToDescription) && (\n <div className=\"flex mt-[32px] flex-col gap-[8px]\">\n {copy.howToTitle && <h3 className=\"text-[20px] font-bold leading-[1.2] text-[#080a0f]\">{copy.howToTitle}</h3>}\n {copy.howToDescription && (\n <p className=\"text-[14px] font-bold leading-[1.4] text-[#080A0F]\">{copy.howToDescription}</p>\n )}\n {copy.learnMoreLabel && copy.learnMoreUrl && (\n <a\n href={buildRefUrl(copy.learnMoreUrl)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-[4px] text-[14px] font-[700] text-[#080a0f] underline\"\n >\n {copy.learnMoreLabel}\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M5.52827 3.52876C5.78862 3.26841 6.21063 3.26841 6.47098 3.52876L10.471 7.52876C10.7313 7.78911 10.7313 8.21112 10.471 8.47147L6.47098 12.4715C6.21063 12.7318 5.78862 12.7318 5.52827 12.4715C5.26792 12.2111 5.26792 11.7891 5.52827 11.5288L9.05692 8.00011L5.52827 4.47147C5.26792 4.21112 5.26792 3.78911 5.52827 3.52876Z\"\n fill=\"#080A0F\"\n />\n </svg>\n </a>\n )}\n </div>\n )}\n\n {copy.image?.url && (\n <Picture\n source={copy.image.url}\n alt={copy.image.alt ?? ''}\n className={cn('mt-[8px] w-full', rounded ? 'rounded-[8px]' : 'rounded-none')}\n />\n )}\n\n {copy.ctaButton && (\n <Button\n size=\"base\"\n as=\"a\"\n className=\"mt-[16px]\"\n href={copy.ctaUrl ? buildRefUrl(copy.ctaUrl) : '#'}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={trackReferralCta}\n >\n {copy.ctaButton}\n </Button>\n )}\n </div>\n )\n}\n\nexport default Referral\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAkDqB,IAAAI,EAAA,6BAlDrBC,EAAgC,iCAChCC,EAA8D,yBAC9DC,EAAsC,kCACtCC,EAAoC,uCACpCC,EAA4B,0CAG5BC,EAA+B,iCAO/B,SAASC,EAAS,CAAE,KAAAC,EAAM,QAAAC,CAAQ,EAAU,CAC1C,KAAM,CAAE,QAAAC,EAAS,WAAAC,EAAY,WAAAC,CAAW,KAAI,yBAAsB,EAC5DC,EAAU,CAAC,CAACH,EACZ,CAAE,MAAAI,EAAO,aAAAC,EAAe,KAAgB,KAAI,sBAAmB,EAC/DC,EAAU,iBAAe,SAASF,CAAK,EAEvC,CAAE,KAAAG,CAAK,KAAI,uBAAoB,EAE/BC,EAAgBD,GAAM,MAAM,MAAM,WAAa,EAC/CE,EAAcF,GAAM,MAAM,MAAM,SAAW,EAEjD,SAASG,EAAYC,EAAa,CAChC,GAAI,CACF,GAAI,CAACT,EAAY,OAAOS,EACxB,MAAMC,EAAS,IAAI,IAAID,EAAK,OAAO,SAAS,IAAI,EAChD,OAAAC,EAAO,aAAa,IAAI,MAAO,GAAGV,CAAU,WAAW,EAChDU,EAAO,SAAS,CACzB,MAAQ,CACN,OAAOD,CACT,CACF,CAEA,SAASE,GAAmB,IAC1B,WAAQ,CACN,MAAO,WACP,WAAY,YACZ,iBAAkB,CAChB,SAAU,WACV,YAAa,eACb,KAAM,wBACR,CACF,CAAC,CACH,CAEA,SACE,QAAC,OAAI,UAAU,gBACZ,UAAAf,EAAK,UAAS,OAAC,MAAG,UAAU,sDAAuD,SAAAA,EAAK,MAAM,EAE9FK,MACC,QAAC,OACC,aAAW,EAAAW,YACT,+DAC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QS",
6
+ "names": ["Referral_exports", "__export", "Referral_default", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_lib", "import_provider", "import_useReferralOverview", "import_utils", "import_constants", "Referral", "copy", "onClose", "profile", "alpcConfig", "pageHandle", "isLogin", "brand", "currencyCode", "rounded", "data", "cashAvailable", "cashPending", "buildRefUrl", "url", "target", "trackReferralCta", "cn"]
7
7
  }
@@ -75,6 +75,12 @@ export type MemberPopupCopy = {
75
75
  referral?: ReferralCopy;
76
76
  /** 页面覆盖范围配置,默认全局展示 */
77
77
  pageConfig?: MemberPopupPageConfig;
78
+ /** 悬浮窗距离底部的距离,设置后优先于组件 bottomOffset prop(默认 '24px') */
79
+ bottomOffset?: string;
80
+ /** 触发按钮图标尺寸(PC 端,默认 '58px') */
81
+ pcIconSize?: string;
82
+ /** 触发按钮图标尺寸(移动端,默认 '58px') */
83
+ mobileIconSize?: string;
78
84
  };
79
85
  export type EarnCreditsCopy = {
80
86
  title?: string;
@@ -92,7 +98,6 @@ export type EarnCreditsCopy = {
92
98
  list: {
93
99
  id: EarnCreditsTaskType;
94
100
  title: string;
95
- description: string;
96
101
  credits?: string;
97
102
  }[];
98
103
  authCodeActivate: AuthCodeActivateCopy;
@@ -118,7 +123,9 @@ export type SubscribeModalCopy = {
118
123
  desc?: string;
119
124
  placeholder: string;
120
125
  policy?: string;
126
+ policyDefaultChecked?: boolean;
121
127
  successTips?: string;
128
+ subscribedLabel?: string;
122
129
  dealsType?: string;
123
130
  buttonLabel?: string;
124
131
  single_brand_subscribe?: boolean;
@@ -142,8 +149,11 @@ export type ConsumeCreditsopy = {
142
149
  unlockRewards: string;
143
150
  btnRedeem: string;
144
151
  insufficientCredits?: string;
145
- pointUnit?: string;
152
+ balanceLabel?: string;
153
+ comingSoonLabel?: string;
154
+ creditUnit?: string;
146
155
  off?: string;
156
+ giftCard?: string;
147
157
  imageMapping?: {
148
158
  [key in ConsumeCreditsItemType]?: {
149
159
  url: string;
@@ -154,6 +164,7 @@ export type ConsumeCreditsopy = {
154
164
  creditsPage?: {
155
165
  label: string;
156
166
  url: string;
167
+ redeemListSectionId?: string;
157
168
  };
158
169
  };
159
170
  export type ConsumeCreditsItem = {
@@ -176,6 +187,7 @@ export type ConsumeCreditsItem = {
176
187
  export type RedeemCouponModalCopy = {
177
188
  confirmTitle: string;
178
189
  confirmButton: string;
190
+ off?: string;
179
191
  commonError: string;
180
192
  redeemLimitError: string;
181
193
  inventoryNotEnough: string;
@@ -185,6 +197,8 @@ export type RedeemCouponModalCopy = {
185
197
  successDesc: string;
186
198
  successButton: string;
187
199
  successButtonUrl?: string;
200
+ copyLabel?: string;
201
+ copiedLabel?: string;
188
202
  };
189
203
  export type ReferralCopy = {
190
204
  title?: string;
@@ -225,4 +239,13 @@ export type MemberPopupContextValue = {
225
239
  openSignInPopup: () => void;
226
240
  taskIdToTypeMapping?: Record<string, DTC_TASK_TYPE>;
227
241
  alpcConfig: AlpcConfig;
242
+ pageHandle?: string;
243
+ };
244
+ export type MemberPopupInternalContextValue = MemberPopupContextValue & {
245
+ isSubscribeSuccess: boolean;
246
+ setIsSubscribeSuccess: (v: boolean) => void;
247
+ isActivateSuccess: boolean;
248
+ setIsActivateSuccess: (v: boolean) => void;
249
+ isProfileCompleteSuccess: boolean;
250
+ setIsProfileCompleteSuccess: (v: boolean) => void;
228
251
  };
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var m=(e,i)=>{for(var o in i)g(e,o,{get:i[o],enumerable:!0})},E=(e,i,o,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of u(i))!b.call(e,t)&&t!==o&&g(e,t,{get:()=>i[t],enumerable:!(n=C(i,t))||n.enumerable});return e};var f=e=>E(g({},"__esModule",{value:!0}),e);var L={};m(L,{ConsumeCreditsItemType:()=>c,EarnCreditsTaskType:()=>p,MemberPopupActionType:()=>a,MemberPopupPageScope:()=>d,MemberPopupPanelType:()=>l});module.exports=f(L);var l=(r=>(r.EarnCredits="EARN_CREDITS",r.ConsumeCredits="CONSUME_CREDITS",r.Referral="REFERRAL",r.CompleteProfile="COMPLETE_PROFILE",r.Subscribe="SUBSCRIBE",r.SubscribeEmail="SUBSCRIBE_EMAIL",r.RedeemCoupon="REDEEM_COUPON",r.Activate="ACTIVATE",r))(l||{}),a=(s=>(s.ExternalLink="EXTERNAL_LINK",s.OpenEarnCredits="OPEN_EARN_CREDITS",s.OpenConsumeCredits="OPEN_CONSUME_CREDITS",s.OpenReferral="OPEN_REFERRAL",s.OpenSubscribe="OPEN_SUBSCRIBE",s))(a||{}),p=(t=>(t.Activate="activate",t.CompleteProfile="completeProfile",t.Subscribe="subscribe",t.Shop="shop",t))(p||{}),c=(t=>(t.Coupon="COUPON",t.RedeemAndBuy="REDEEM_AND_BUY",t.GiftCard="GIFT_CARD",t.Product="PRODUCT",t))(c||{}),d=(n=>(n.Global="GLOBAL",n.Include="INCLUDE",n.Exclude="EXCLUDE",n))(d||{});
1
+ "use strict";var g=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var m=(r,e)=>{for(var o in e)g(r,o,{get:e[o],enumerable:!0})},f=(r,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of b(e))!C.call(r,t)&&t!==o&&g(r,t,{get:()=>e[t],enumerable:!(s=u(e,t))||s.enumerable});return r};var E=r=>f(g({},"__esModule",{value:!0}),r);var L={};m(L,{ConsumeCreditsItemType:()=>p,EarnCreditsTaskType:()=>c,MemberPopupActionType:()=>a,MemberPopupPageScope:()=>d,MemberPopupPanelType:()=>l});module.exports=E(L);var l=(i=>(i.EarnCredits="EARN_CREDITS",i.ConsumeCredits="CONSUME_CREDITS",i.Referral="REFERRAL",i.CompleteProfile="COMPLETE_PROFILE",i.Subscribe="SUBSCRIBE",i.SubscribeEmail="SUBSCRIBE_EMAIL",i.RedeemCoupon="REDEEM_COUPON",i.Activate="ACTIVATE",i))(l||{}),a=(n=>(n.ExternalLink="EXTERNAL_LINK",n.OpenEarnCredits="OPEN_EARN_CREDITS",n.OpenConsumeCredits="OPEN_CONSUME_CREDITS",n.OpenReferral="OPEN_REFERRAL",n.OpenSubscribe="OPEN_SUBSCRIBE",n))(a||{}),c=(t=>(t.Activate="activate",t.CompleteProfile="completeProfile",t.Subscribe="subscribe",t.Shop="shop",t))(c||{}),p=(t=>(t.Coupon="COUPON",t.RedeemAndBuy="REDEEM_AND_BUY",t.GiftCard="GIFT_CARD",t.Product="PRODUCT",t))(p||{}),d=(s=>(s.Global="GLOBAL",s.Include="INCLUDE",s.Exclude="EXCLUDE",s))(d||{});
2
2
  //# sourceMappingURL=type.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/memberPopup/type.ts"],
4
- "sourcesContent": ["import type { AuthCodeActivateCopy } from '../registration/authCodeActivate/type'\nimport type { CreditInfoResponse } from '../credits/context/response'\nimport type { DTC_TASK_TYPE } from '../credits/context/const'\n\nexport type { AuthCodeActivateCopy }\n\n// \u2500\u2500\u2500 \u9762\u677F\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPanelType {\n EarnCredits = 'EARN_CREDITS',\n ConsumeCredits = 'CONSUME_CREDITS',\n Referral = 'REFERRAL',\n CompleteProfile = 'COMPLETE_PROFILE',\n Subscribe = 'SUBSCRIBE',\n SubscribeEmail = 'SUBSCRIBE_EMAIL',\n RedeemCoupon = 'REDEEM_COUPON',\n Activate = 'ACTIVATE',\n}\n\n// \u2500\u2500\u2500 item action \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupActionType {\n ExternalLink = 'EXTERNAL_LINK',\n OpenEarnCredits = 'OPEN_EARN_CREDITS',\n OpenConsumeCredits = 'OPEN_CONSUME_CREDITS',\n OpenReferral = 'OPEN_REFERRAL',\n OpenSubscribe = 'OPEN_SUBSCRIBE',\n}\n\n// \u2500\u2500\u2500 EarnCredits \u4EFB\u52A1\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum EarnCreditsTaskType {\n Activate = 'activate',\n CompleteProfile = 'completeProfile',\n Subscribe = 'subscribe',\n Shop = 'shop',\n}\n\n// \u2500\u2500\u2500 ConsumeCredits item \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum ConsumeCreditsItemType {\n Coupon = 'COUPON',\n RedeemAndBuy = 'REDEEM_AND_BUY',\n GiftCard = 'GIFT_CARD',\n Product = 'PRODUCT',\n}\n\n// \u2500\u2500\u2500 \u901A\u7528 link\uFF08\u7EDF\u4E00\u4E00\u79CD\u7C7B\u578B\uFF09 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupLink = {\n type: MemberPopupActionType\n label: string\n url?: string // \u4EC5 ExternalLink \u65F6\u4F7F\u7528\n}\n\n// \u2500\u2500\u2500 list item \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupItem = {\n title: string\n description?: string\n links: MemberPopupLink[]\n}\n\n// \u2500\u2500 \u4E3B\u7EC4\u4EF6 Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPageScope {\n /** \u5168\u5C40\u5C55\u793A */\n Global = 'GLOBAL',\n /** \u4EC5\u5728\u7279\u5B9A\u9875\u9762\u5C55\u793A */\n Include = 'INCLUDE',\n /** \u5728\u7279\u5B9A\u9875\u9762\u4E0D\u5C55\u793A */\n Exclude = 'EXCLUDE',\n}\n\nexport type MemberPopupPageConfig = {\n scope: MemberPopupPageScope\n /** \u9875\u9762\u8DEF\u5F84\u5217\u8868\uFF0C\u652F\u6301\u7CBE\u786E\u5339\u914D\u548C\u524D\u7F00\u5339\u914D\uFF08\u5982 \"/products\" \u4F1A\u5339\u914D \"/products/xxx\"\uFF09 */\n pages: string[]\n}\n\nexport type MemberPopupCopy = {\n triggerImg: { url: string; alt?: string }\n title?: string\n subtitle?: string\n list: MemberPopupItem[]\n footer?: {\n loginHint: string\n loginLabel: string\n joinLabel: string\n shopLabel: string\n shopUrl?: string\n }\n activitiesSubscribe?: SubscribeModalCopy\n earnCredits?: EarnCreditsCopy\n consumeCredits?: ConsumeCreditsopy\n referral?: ReferralCopy\n /** \u9875\u9762\u8986\u76D6\u8303\u56F4\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u5168\u5C40\u5C55\u793A */\n pageConfig?: MemberPopupPageConfig\n}\n\n// \u2500\u2500\u2500 EarnCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type EarnCreditsCopy = {\n title?: string\n subtitle?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n joinNow: string\n completed: string\n activate: string\n completeProfileLabel: string\n subscribeLabel: string\n shopNow: string\n goShopLink?: string\n list: {\n id: EarnCreditsTaskType\n title: string\n description: string\n credits?: string\n }[]\n // \u5B50\u5F39\u7A97\u6587\u6848\n authCodeActivate: AuthCodeActivateCopy\n completeProfile: CompleteProfileCopy\n subscribe: SubscribeModalCopy\n}\n\nexport type CompleteProfileCopy = {\n title: string\n subtitle?: string\n firstName: string\n lastName: string\n email: string\n phone: string\n birthday: string\n country: string\n save: string\n cancel: string\n edit: string\n required: string\n}\n\nexport type SubscribeModalCopy = {\n title: string\n desc?: string\n placeholder: string\n policy?: string\n successTips?: string\n dealsType?: string\n buttonLabel?: string\n single_brand_subscribe?: boolean\n genre?: string\n sub_brand_type?: string\n promo?: {\n title?: string\n description?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n }\n}\n\n// \u2500\u2500\u2500 ConsumeCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ConsumeCreditsopy = {\n title?: string\n subtitle?: string\n soldOut: string\n unlockRewards: string\n btnRedeem: string\n insufficientCredits?: string\n pointUnit?: string\n off?: string\n imageMapping?: {\n [key in ConsumeCreditsItemType]?: { url: string }\n }\n list: ConsumeCreditsItem[]\n redeemModal: RedeemCouponModalCopy\n creditsPage?: { label: string; url: string }\n}\n\nexport type ConsumeCreditsItem = {\n redeemId: string | number\n title: string\n description?: string\n image: { url: string; alt?: string }\n type: ConsumeCreditsItemType\n product?: { handle: string; sku: string }\n price?: number\n value?: string\n rules?: string[]\n}\n\nexport type RedeemCouponModalCopy = {\n confirmTitle: string\n confirmButton: string\n commonError: string\n redeemLimitError: string\n inventoryNotEnough: string\n creditsNotEnough: string\n crossSiteError: string\n successTitle: string\n successDesc: string\n successButton: string\n successButtonUrl?: string\n}\n\n// \u2500\u2500\u2500 Referral Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ReferralCopy = {\n title?: string\n description?: string\n cashAvailableLabel: string\n cashPendingLabel: string\n creditUnit?: string\n referralLinksLabel?: string\n referralLinkBaseUrl?: string\n copyLabel?: string\n copiedLabel?: string\n howToTitle?: string\n howToDescription?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n ctaButton: string\n ctaUrl?: string\n loginTitle?: string\n loginDescription?: string\n loginCtaLabel?: string\n}\n\n// \u2500\u2500\u2500 Provider Context \u7C7B\u578B \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type AlpcConfig = {\n brand: string\n locale: string\n appName: string\n apiBaseUrl?: string\n}\n\nexport type MemberPopupContextValue = {\n profile: any\n isLoadingProfile: boolean\n creditInfo?: CreditInfoResponse\n fetchCreditInfo: (userId: string) => void\n openSignUpPopup: () => void\n openSignInPopup: () => void\n taskIdToTypeMapping?: Record<string, DTC_TASK_TYPE>\n alpcConfig: AlpcConfig\n}\n"],
4
+ "sourcesContent": ["import type { AuthCodeActivateCopy } from '../registration/authCodeActivate/type'\nimport type { CreditInfoResponse } from '../credits/context/response'\nimport type { DTC_TASK_TYPE } from '../credits/context/const'\n\nexport type { AuthCodeActivateCopy }\n\n// \u2500\u2500\u2500 \u9762\u677F\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPanelType {\n EarnCredits = 'EARN_CREDITS',\n ConsumeCredits = 'CONSUME_CREDITS',\n Referral = 'REFERRAL',\n CompleteProfile = 'COMPLETE_PROFILE',\n Subscribe = 'SUBSCRIBE',\n SubscribeEmail = 'SUBSCRIBE_EMAIL',\n RedeemCoupon = 'REDEEM_COUPON',\n Activate = 'ACTIVATE',\n}\n\n// \u2500\u2500\u2500 item action \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupActionType {\n ExternalLink = 'EXTERNAL_LINK',\n OpenEarnCredits = 'OPEN_EARN_CREDITS',\n OpenConsumeCredits = 'OPEN_CONSUME_CREDITS',\n OpenReferral = 'OPEN_REFERRAL',\n OpenSubscribe = 'OPEN_SUBSCRIBE',\n}\n\n// \u2500\u2500\u2500 EarnCredits \u4EFB\u52A1\u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum EarnCreditsTaskType {\n Activate = 'activate',\n CompleteProfile = 'completeProfile',\n Subscribe = 'subscribe',\n Shop = 'shop',\n}\n\n// \u2500\u2500\u2500 ConsumeCredits item \u7C7B\u578B\u679A\u4E3E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum ConsumeCreditsItemType {\n Coupon = 'COUPON',\n RedeemAndBuy = 'REDEEM_AND_BUY',\n GiftCard = 'GIFT_CARD',\n Product = 'PRODUCT',\n}\n\n// \u2500\u2500\u2500 \u901A\u7528 link\uFF08\u7EDF\u4E00\u4E00\u79CD\u7C7B\u578B\uFF09 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupLink = {\n type: MemberPopupActionType\n label: string\n url?: string // \u4EC5 ExternalLink \u65F6\u4F7F\u7528\n}\n\n// \u2500\u2500\u2500 list item \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type MemberPopupItem = {\n title: string\n description?: string\n links: MemberPopupLink[]\n}\n\n// \u2500\u2500 \u4E3B\u7EC4\u4EF6 Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport enum MemberPopupPageScope {\n /** \u5168\u5C40\u5C55\u793A */\n Global = 'GLOBAL',\n /** \u4EC5\u5728\u7279\u5B9A\u9875\u9762\u5C55\u793A */\n Include = 'INCLUDE',\n /** \u5728\u7279\u5B9A\u9875\u9762\u4E0D\u5C55\u793A */\n Exclude = 'EXCLUDE',\n}\n\nexport type MemberPopupPageConfig = {\n scope: MemberPopupPageScope\n /** \u9875\u9762\u8DEF\u5F84\u5217\u8868\uFF0C\u652F\u6301\u7CBE\u786E\u5339\u914D\u548C\u524D\u7F00\u5339\u914D\uFF08\u5982 \"/products\" \u4F1A\u5339\u914D \"/products/xxx\"\uFF09 */\n pages: string[]\n}\n\nexport type MemberPopupCopy = {\n triggerImg: { url: string; alt?: string }\n title?: string\n subtitle?: string\n list: MemberPopupItem[]\n footer?: {\n loginHint: string\n loginLabel: string\n joinLabel: string\n shopLabel: string\n shopUrl?: string\n }\n activitiesSubscribe?: SubscribeModalCopy\n earnCredits?: EarnCreditsCopy\n consumeCredits?: ConsumeCreditsopy\n referral?: ReferralCopy\n /** \u9875\u9762\u8986\u76D6\u8303\u56F4\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u5168\u5C40\u5C55\u793A */\n pageConfig?: MemberPopupPageConfig\n /** \u60AC\u6D6E\u7A97\u8DDD\u79BB\u5E95\u90E8\u7684\u8DDD\u79BB\uFF0C\u8BBE\u7F6E\u540E\u4F18\u5148\u4E8E\u7EC4\u4EF6 bottomOffset prop\uFF08\u9ED8\u8BA4 '24px'\uFF09 */\n bottomOffset?: string\n /** \u89E6\u53D1\u6309\u94AE\u56FE\u6807\u5C3A\u5BF8\uFF08PC \u7AEF\uFF0C\u9ED8\u8BA4 '58px'\uFF09 */\n pcIconSize?: string\n /** \u89E6\u53D1\u6309\u94AE\u56FE\u6807\u5C3A\u5BF8\uFF08\u79FB\u52A8\u7AEF\uFF0C\u9ED8\u8BA4 '58px'\uFF09 */\n mobileIconSize?: string\n}\n\n// \u2500\u2500\u2500 EarnCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type EarnCreditsCopy = {\n title?: string\n subtitle?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n joinNow: string\n completed: string\n activate: string\n completeProfileLabel: string\n subscribeLabel: string\n shopNow: string\n goShopLink?: string\n list: {\n id: EarnCreditsTaskType\n title: string\n credits?: string\n }[]\n // \u5B50\u5F39\u7A97\u6587\u6848\n authCodeActivate: AuthCodeActivateCopy\n completeProfile: CompleteProfileCopy\n subscribe: SubscribeModalCopy\n}\n\nexport type CompleteProfileCopy = {\n title: string\n subtitle?: string\n firstName: string\n lastName: string\n email: string\n phone: string\n birthday: string\n country: string\n save: string\n cancel: string\n edit: string\n required: string\n}\n\nexport type SubscribeModalCopy = {\n title: string\n desc?: string\n placeholder: string\n policy?: string\n policyDefaultChecked?: boolean\n successTips?: string\n subscribedLabel?: string\n dealsType?: string\n buttonLabel?: string\n single_brand_subscribe?: boolean\n genre?: string\n sub_brand_type?: string\n promo?: {\n title?: string\n description?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n }\n}\n\n// \u2500\u2500\u2500 ConsumeCredits Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ConsumeCreditsopy = {\n title?: string\n subtitle?: string\n soldOut: string\n unlockRewards: string\n btnRedeem: string\n insufficientCredits?: string\n balanceLabel?: string\n comingSoonLabel?: string\n creditUnit?: string\n off?: string\n giftCard?: string\n imageMapping?: {\n [key in ConsumeCreditsItemType]?: { url: string }\n }\n list: ConsumeCreditsItem[]\n redeemModal: RedeemCouponModalCopy\n creditsPage?: { label: string; url: string; redeemListSectionId?: string }\n}\n\nexport type ConsumeCreditsItem = {\n redeemId: string | number\n title: string\n description?: string\n image: { url: string; alt?: string }\n type: ConsumeCreditsItemType\n product?: { handle: string; sku: string }\n price?: number\n value?: string\n rules?: string[]\n}\n\nexport type RedeemCouponModalCopy = {\n confirmTitle: string\n confirmButton: string\n off?: string\n commonError: string\n redeemLimitError: string\n inventoryNotEnough: string\n creditsNotEnough: string\n crossSiteError: string\n successTitle: string\n successDesc: string\n successButton: string\n successButtonUrl?: string\n copyLabel?: string\n copiedLabel?: string\n}\n\n// \u2500\u2500\u2500 Referral Copy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type ReferralCopy = {\n title?: string\n description?: string\n cashAvailableLabel: string\n cashPendingLabel: string\n creditUnit?: string\n referralLinksLabel?: string\n referralLinkBaseUrl?: string\n copyLabel?: string\n copiedLabel?: string\n howToTitle?: string\n howToDescription?: string\n learnMoreLabel?: string\n learnMoreUrl?: string\n image?: { url: string; alt?: string }\n ctaButton: string\n ctaUrl?: string\n loginTitle?: string\n loginDescription?: string\n loginCtaLabel?: string\n}\n\n// \u2500\u2500\u2500 Provider Context \u7C7B\u578B \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nexport type AlpcConfig = {\n brand: string\n locale: string\n appName: string\n apiBaseUrl?: string\n}\n\nexport type MemberPopupContextValue = {\n profile: any\n isLoadingProfile: boolean\n creditInfo?: CreditInfoResponse\n fetchCreditInfo: (userId: string) => void\n openSignUpPopup: () => void\n openSignInPopup: () => void\n taskIdToTypeMapping?: Record<string, DTC_TASK_TYPE>\n alpcConfig: AlpcConfig\n pageHandle?: string\n}\n\nexport type MemberPopupInternalContextValue = MemberPopupContextValue & {\n isSubscribeSuccess: boolean\n setIsSubscribeSuccess: (v: boolean) => void\n isActivateSuccess: boolean\n setIsActivateSuccess: (v: boolean) => void\n isProfileCompleteSuccess: boolean\n setIsProfileCompleteSuccess: (v: boolean) => void\n}\n"],
5
5
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,EAAA,wBAAAC,EAAA,0BAAAC,EAAA,yBAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAP,GAOO,IAAKM,OACVA,EAAA,YAAc,eACdA,EAAA,eAAiB,kBACjBA,EAAA,SAAW,WACXA,EAAA,gBAAkB,mBAClBA,EAAA,UAAY,YACZA,EAAA,eAAiB,kBACjBA,EAAA,aAAe,gBACfA,EAAA,SAAW,WARDA,OAAA,IAYAF,OACVA,EAAA,aAAe,gBACfA,EAAA,gBAAkB,oBAClBA,EAAA,mBAAqB,uBACrBA,EAAA,aAAe,gBACfA,EAAA,cAAgB,iBALNA,OAAA,IASAD,OACVA,EAAA,SAAW,WACXA,EAAA,gBAAkB,kBAClBA,EAAA,UAAY,YACZA,EAAA,KAAO,OAJGA,OAAA,IAQAD,OACVA,EAAA,OAAS,SACTA,EAAA,aAAe,iBACfA,EAAA,SAAW,YACXA,EAAA,QAAU,UAJAA,OAAA,IAsBAG,OAEVA,EAAA,OAAS,SAETA,EAAA,QAAU,UAEVA,EAAA,QAAU,UANAA,OAAA",
6
6
  "names": ["type_exports", "__export", "ConsumeCreditsItemType", "EarnCreditsTaskType", "MemberPopupActionType", "MemberPopupPageScope", "MemberPopupPanelType", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var N=Object.create;var m=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var x=(r,i)=>{for(var d in i)m(r,d,{get:i[d],enumerable:!0})},P=(r,i,d,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let p of q(i))!S.call(r,p)&&p!==d&&m(r,p,{get:()=>i[p],enumerable:!(t=F(i,p))||t.enumerable});return r};var y=(r,i,d)=>(d=r!=null?N(w(r)):{},P(i||!r||!r.__esModule?m(d,"default",{value:r,enumerable:!0}):d,r)),O=r=>P(m({},"__esModule",{value:!0}),r);var H={};x(H,{CreditsTemplate:()=>W});module.exports=O(H);var e=require("react/jsx-runtime"),l=require("@anker-in/lib"),g=require("../components/registration/context/provider"),c=require("../components/credits/context/provider"),v=require("../components/credits/creditsBanner"),M=require("../components/credits/creditsInfoCard"),T=require("../components/credits/creditsBenefits"),b=require("../components/credits/creditsWaysToGetCredits"),h=require("../components/credits/creditsAnkersolixTask"),u=require("../components/credits/creditsRedeemList"),B=require("../components/credits/creditsGoGift"),G=require("../components/credits/creditsCash"),I=require("../components/credits/creditsMemberPrice"),A=require("../components/credits/creditsFaq"),L=require("../components/credits/creditsNavigation"),R=y(require("../components/credits/modal/ActivitiesModal")),D=y(require("../components/credits/modal/RewardsModal")),s=require("./Credits.types");const U=({headlessConfig:r,pageConfig:i,userContext:d})=>{const{openMyRewardsModal:t,setOpenMyRewardsModal:p,openActivitiesModal:C,setOpenActivitiesModal:f,pageCommon:n}=(0,c.useCreditsContext)();return(0,e.jsxs)(e.Fragment,{children:[i.components[s.ComponentKey.Navigation]&&(0,e.jsx)(L.CreditsNavigation,{copy:i.components[s.ComponentKey.Navigation]}),(0,e.jsx)("div",{className:(0,l.classNames)("bg-[#f5f5f7] leading-[1.2]"),children:i.order.map(o=>{if(o===s.ComponentKey.Navigation)return null;const a=i.components?.[o];return a?(0,e.jsxs)(e.Fragment,{children:[o===s.ComponentKey.Banner&&(0,e.jsx)(v.CreditsBanner,{copy:a,id:o}),o===s.ComponentKey.InfoCard&&d?.profile&&(0,e.jsx)(M.CreditsInfoCard,{copy:a,id:o}),o===s.ComponentKey.Benefits&&(0,e.jsx)(T.CreditsBenefits,{copy:a,id:o}),o===s.ComponentKey.WaysToGetCredits&&(0,e.jsx)(b.CreditsWaysToGetCredits,{copy:a,id:o,classNames:r.brand==="anker"?{subtitle:"text-white",equalCreditsText:"bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent"}:{subtitle:"text-[#D1D1D1]",equalCreditsText:"text-[#F6EAD0]"}}),o===s.ComponentKey.AnkersolixTask&&(0,e.jsx)(h.CreditsAnkersolixTask,{copy:a,id:o}),o===s.ComponentKey.RedeemList&&(0,e.jsx)(u.CreditsRedeemList,{copy:a,id:o}),o===s.ComponentKey.GoGift&&(0,e.jsx)(B.CreditsGoGift,{copy:a,id:o}),o===s.ComponentKey.SpendCreditsLikeCash&&(0,e.jsx)(G.CreditsCash,{copy:a,id:o}),o===s.ComponentKey.MemberPrice&&(0,e.jsx)(I.CreditsMemberPrice,{copy:a,id:o}),o===s.ComponentKey.Faqs&&(0,e.jsx)(A.CreditsFaq,{copy:a,id:o}),o!==s.ComponentKey.Banner&&(0,e.jsx)("div",{className:"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16"})]}):null})}),n?.activitiesModal&&(0,e.jsx)(R.default,{isOpen:C,data:n.activitiesModal,onClose:()=>f(!1)}),n?.rewardsModal&&(0,e.jsx)(D.default,{isOpen:t,data:n.rewardsModal,onClose:()=>p(!1)})]})},W=({headlessConfig:r,siteConfig:i,creditsConfig:d,userContext:t,pageConfig:p,registrationContext:C,gtm:f,cartConfig:n})=>(0,e.jsx)(l.HeadlessProvider,{headlessConfig:r,children:(0,e.jsx)(g.RegistrationProvider,{copy:i.registrationsSettings,email:t?.profile?.email,children:(0,e.jsx)(c.CreditsProvider,{profile:t?.profile,removeProfile:t?.removeProfile,isLoadingProfile:t?.isLoadingProfile,openSignInPopup:C.openSignInPopup,openSignUpPopup:C.openSignUpPopup,creditInfo:t?.creditInfo,taskIdToTypeMapping:i.taskIdToTypeMapping,customer:t?.customer,fetchCreditInfo:t?.fetchCreditInfo,customerLoading:t?.customerLoading,gtm:f,pageCommon:p.common,memberPriceDiscount:i.memberPriceDiscount,alpcBrand:d?.alpcBrand,cartConfig:n,apiBaseUrl:t?.apiBaseUrl,children:(0,e.jsx)(U,{headlessConfig:r,pageConfig:p,userContext:t})})})});
1
+ "use strict";var U=Object.create;var C=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Y=(i,r)=>{for(var d in r)C(i,d,{get:r[d],enumerable:!0})},h=(i,r,d,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of E(r))!K.call(i,p)&&p!==d&&C(i,p,{get:()=>r[p],enumerable:!(t=W(r,p))||t.enumerable});return i};var T=(i,r,d)=>(d=i!=null?U(H(i)):{},h(r||!i||!i.__esModule?C(d,"default",{value:i,enumerable:!0}):d,i)),z=i=>h(C({},"__esModule",{value:!0}),i);var V={};Y(V,{CreditsTemplate:()=>Q});module.exports=z(V);var e=require("react/jsx-runtime"),c=require("@anker-in/lib"),l=require("react"),M=require("../components/registration/context/provider"),f=require("../components/credits/context/provider"),w=require("../components/credits/creditsBanner"),B=require("../components/credits/creditsInfoCard"),b=require("../components/credits/creditsBenefits"),I=require("../components/credits/creditsWaysToGetCredits"),G=require("../components/credits/creditsAnkersolixTask"),R=require("../components/credits/creditsRedeemList"),L=require("../components/credits/creditsGoGift"),A=require("../components/credits/creditsCash"),S=require("../components/credits/creditsMemberPrice"),D=require("../components/credits/creditsFaq"),N=require("../components/credits/creditsNavigation"),F=T(require("../components/credits/modal/ActivitiesModal")),q=T(require("../components/credits/modal/RewardsModal")),s=require("./Credits.types");const J=({headlessConfig:i,pageConfig:r,userContext:d})=>{const{openMyRewardsModal:t,setOpenMyRewardsModal:p,openActivitiesModal:m,setOpenActivitiesModal:y,pageCommon:n}=(0,f.useCreditsContext)(),u=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(u.current||typeof window>"u")return;const a=new URLSearchParams(window.location.search).get("section");if(!a)return;const x=56,g=(P=0)=>{const v=document.getElementById(a);if(v){u.current=!0;const O=v.getBoundingClientRect().top+window.pageYOffset-x;window.scrollTo({top:O,behavior:"smooth"})}else P<10&&setTimeout(()=>g(P+1),300)};g()},[]),(0,e.jsxs)(e.Fragment,{children:[r.components[s.ComponentKey.Navigation]&&(0,e.jsx)(N.CreditsNavigation,{copy:r.components[s.ComponentKey.Navigation]}),(0,e.jsx)("div",{className:(0,c.classNames)("bg-[#f5f5f7] leading-[1.2]"),children:r.order.map(o=>{if(o===s.ComponentKey.Navigation)return null;const a=r.components?.[o];return a?(0,e.jsxs)(e.Fragment,{children:[o===s.ComponentKey.Banner&&(0,e.jsx)(w.CreditsBanner,{copy:a,id:o}),o===s.ComponentKey.InfoCard&&d?.profile&&(0,e.jsx)(B.CreditsInfoCard,{copy:a,id:o}),o===s.ComponentKey.Benefits&&(0,e.jsx)(b.CreditsBenefits,{copy:a,id:o}),o===s.ComponentKey.WaysToGetCredits&&(0,e.jsx)(I.CreditsWaysToGetCredits,{copy:a,id:o,classNames:i.brand==="anker"?{subtitle:"text-white",equalCreditsText:"bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent"}:{subtitle:"text-[#D1D1D1]",equalCreditsText:"text-[#F6EAD0]"}}),o===s.ComponentKey.AnkersolixTask&&(0,e.jsx)(G.CreditsAnkersolixTask,{copy:a,id:o}),o===s.ComponentKey.RedeemList&&(0,e.jsx)(R.CreditsRedeemList,{copy:a,id:o}),o===s.ComponentKey.GoGift&&(0,e.jsx)(L.CreditsGoGift,{copy:a,id:o}),o===s.ComponentKey.SpendCreditsLikeCash&&(0,e.jsx)(A.CreditsCash,{copy:a,id:o}),o===s.ComponentKey.MemberPrice&&(0,e.jsx)(S.CreditsMemberPrice,{copy:a,id:o}),o===s.ComponentKey.Faqs&&(0,e.jsx)(D.CreditsFaq,{copy:a,id:o}),o!==s.ComponentKey.Banner&&(0,e.jsx)("div",{className:"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16"})]}):null})}),n?.activitiesModal&&(0,e.jsx)(F.default,{isOpen:m,data:n.activitiesModal,onClose:()=>y(!1)}),n?.rewardsModal&&(0,e.jsx)(q.default,{isOpen:t,data:n.rewardsModal,onClose:()=>p(!1)})]})},Q=({headlessConfig:i,siteConfig:r,creditsConfig:d,userContext:t,pageConfig:p,registrationContext:m,gtm:y,cartConfig:n})=>(0,e.jsx)(c.HeadlessProvider,{headlessConfig:i,children:(0,e.jsx)(M.RegistrationProvider,{copy:r.registrationsSettings,email:t?.profile?.email,children:(0,e.jsx)(f.CreditsProvider,{profile:t?.profile,removeProfile:t?.removeProfile,isLoadingProfile:t?.isLoadingProfile,openSignInPopup:m.openSignInPopup,openSignUpPopup:m.openSignUpPopup,creditInfo:t?.creditInfo,taskIdToTypeMapping:r.taskIdToTypeMapping,customer:t?.customer,fetchCreditInfo:t?.fetchCreditInfo,customerLoading:t?.customerLoading,gtm:y,pageCommon:p.common,memberPriceDiscount:r.memberPriceDiscount,alpcBrand:d?.alpcBrand,alpcCountry:d?.alpcCountry,cartConfig:n,apiBaseUrl:t?.apiBaseUrl,children:(0,e.jsx)(J,{headlessConfig:i,pageConfig:p,userContext:t})})})});
2
2
  //# sourceMappingURL=Credits.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/templates/Credits.tsx"],
4
- "sourcesContent": ["import { classNames, HeadlessProvider } from '@anker-in/lib'\nimport { RegistrationProvider } from '../components/registration/context/provider'\nimport { CreditsProvider, useCreditsContext } from '../components/credits/context/provider'\nimport { CreditsBanner } from '../components/credits/creditsBanner'\nimport { CreditsInfoCard } from '../components/credits/creditsInfoCard'\nimport { CreditsBenefits } from '../components/credits/creditsBenefits'\nimport { CreditsWaysToGetCredits } from '../components/credits/creditsWaysToGetCredits'\nimport { CreditsAnkersolixTask } from '../components/credits/creditsAnkersolixTask'\nimport { CreditsRedeemList } from '../components/credits/creditsRedeemList'\nimport { CreditsGoGift } from '../components/credits/creditsGoGift'\nimport { CreditsCash } from '../components/credits/creditsCash'\nimport { CreditsMemberPrice } from '../components/credits/creditsMemberPrice'\nimport { CreditsFaq } from '../components/credits/creditsFaq'\nimport { CreditsNavigation } from '../components/credits/creditsNavigation'\nimport ActivitiesModal from '../components/credits/modal/ActivitiesModal'\nimport RewardsModal from '../components/credits/modal/RewardsModal'\nimport { ComponentKey } from './Credits.types'\nimport type {\n CreditsTemplateProps,\n CreditsContentProps,\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n} from './Credits.types'\n\nconst CreditsContent = ({ headlessConfig, pageConfig, userContext }: CreditsContentProps) => {\n const { openMyRewardsModal, setOpenMyRewardsModal, openActivitiesModal, setOpenActivitiesModal, pageCommon } = useCreditsContext()\n\n return (\n <>\n {/* \u5BFC\u822A\u7EC4\u4EF6 - \u56FA\u5B9A\u4F4D\u7F6E\uFF0C\u4E0D\u53C2\u4E0E order \u6392\u5E8F */}\n {pageConfig.components[ComponentKey.Navigation] && (\n <CreditsNavigation copy={pageConfig.components[ComponentKey.Navigation]} />\n )}\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n // \u8DF3\u8FC7\u5BFC\u822A\u7EC4\u4EF6\uFF0C\u56E0\u4E3A\u5B83\u5DF2\u7ECF\u56FA\u5B9A\u6E32\u67D3\u5728\u4E0A\u65B9\n if (key === ComponentKey.Navigation) return null\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} id={key} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} id={key} />\n )}\n {key === ComponentKey.Benefits && (\n <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} id={key} />\n )}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\n id={key}\n classNames={\n headlessConfig.brand === 'anker'\n ? {\n subtitle: 'text-white',\n equalCreditsText:\n 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',\n }\n : {\n subtitle: 'text-[#D1D1D1]',\n equalCreditsText: 'text-[#F6EAD0]',\n }\n }\n />\n )}\n {key === ComponentKey.AnkersolixTask && (\n <CreditsAnkersolixTask copy={componentCopy as CreditsAnkersolixTaskCopy} id={key} />\n )}\n {key === ComponentKey.RedeemList && (\n <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} id={key} />\n )}\n {key === ComponentKey.GoGift && <CreditsGoGift copy={componentCopy as CreditsGoGiftCopy} id={key} />}\n {key === ComponentKey.SpendCreditsLikeCash && (\n <CreditsCash copy={componentCopy as CreditsCashCopy} id={key} />\n )}\n {key === ComponentKey.MemberPrice && (\n <CreditsMemberPrice copy={componentCopy as CreditsMemberPriceCopy} id={key} />\n )}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} id={key} />}\n {key !== ComponentKey.Banner && (\n <div className=\"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16\" />\n )}\n </>\n )\n })}\n </div>\n\n {/* Global Modals */}\n {pageCommon?.activitiesModal && (\n <ActivitiesModal\n isOpen={openActivitiesModal}\n data={pageCommon.activitiesModal}\n onClose={() => setOpenActivitiesModal(false)}\n />\n )}\n {pageCommon?.rewardsModal && (\n <RewardsModal\n isOpen={openMyRewardsModal}\n data={pageCommon.rewardsModal}\n onClose={() => setOpenMyRewardsModal(false)}\n />\n )}\n </>\n )\n}\n\nexport const CreditsTemplate = ({\n headlessConfig,\n siteConfig,\n creditsConfig,\n userContext,\n pageConfig,\n registrationContext,\n gtm,\n cartConfig,\n}: CreditsTemplateProps) => {\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>\n <CreditsProvider\n profile={userContext?.profile}\n removeProfile={userContext?.removeProfile}\n isLoadingProfile={userContext?.isLoadingProfile}\n openSignInPopup={registrationContext.openSignInPopup}\n openSignUpPopup={registrationContext.openSignUpPopup}\n creditInfo={userContext?.creditInfo}\n taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}\n customer={userContext?.customer}\n fetchCreditInfo={userContext?.fetchCreditInfo}\n customerLoading={userContext?.customerLoading}\n gtm={gtm}\n pageCommon={pageConfig.common}\n memberPriceDiscount={siteConfig.memberPriceDiscount}\n alpcBrand={creditsConfig?.alpcBrand}\n cartConfig={cartConfig}\n apiBaseUrl={userContext?.apiBaseUrl}\n >\n <CreditsContent headlessConfig={headlessConfig} pageConfig={pageConfig} userContext={userContext} />\n </CreditsProvider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAuCQ,IAAAI,EAAA,6BAvCRC,EAA6C,yBAC7CC,EAAqC,uDACrCA,EAAmD,kDACnDC,EAA8B,+CAC9BC,EAAgC,iDAChCC,EAAgC,iDAChCC,EAAwC,yDACxCC,EAAsC,uDACtCC,EAAkC,mDAClCC,EAA8B,+CAC9BC,EAA4B,6CAC5BC,EAAmC,oDACnCC,EAA2B,4CAC3BC,EAAkC,mDAClCC,EAA4B,0DAC5BC,EAAyB,uDACzBC,EAA6B,2BAgB7B,MAAMC,EAAiB,CAAC,CAAE,eAAAC,EAAgB,WAAAC,EAAY,YAAAC,CAAY,IAA2B,CAC3F,KAAM,CAAE,mBAAAC,EAAoB,sBAAAC,EAAuB,oBAAAC,EAAqB,uBAAAC,EAAwB,WAAAC,CAAW,KAAI,qBAAkB,EAEjI,SACE,oBAEG,UAAAN,EAAW,WAAW,eAAa,UAAU,MAC5C,OAAC,qBAAkB,KAAMA,EAAW,WAAW,eAAa,UAAU,EAAG,KAE3E,OAAC,OAAI,aAAW,cAAW,4BAA4B,EACpD,SAAAA,EAAW,MAAM,IAAIO,GAAO,CAE3B,GAA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AoB,EACA,WAAAY,EACA,cAAAC,EACA,YAAAX,EACA,WAAAD,EACA,oBAAAa,EACA,IAAAC,EACA,WAAAC,CACF,OAEI,OAAC,oBAAiB,eAAgBhB,EAChC,mBAAC,wBAAqB,KAAMY,EAAW,sBAAuB,MAAOV,GAAa,SAAS,MACzF,mBAAC,mBACC,QAASA,GAAa,QACtB,cAAeA,GAAa,cAC5B,iBAAkBA,GAAa,iBAC/B,gBAAiBY,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYZ,GAAa,WACzB,oBAAqBU,EAAW,oBAChC,SAAUV,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKa,EACL,WAAYd,EAAW,OACvB,oBAAqBW,EAAW,oBAChC,UAAWC,GAAe,UAC1B,WAAYG,EACZ,WAAYd,GAAa,WAEzB,mBAACH,EAAA,CAAe,eAAgBC,EAAgB,WAAYC,EAAY,YAAaC,EAAa,EACpG,EACF,EACF",
6
- "names": ["Credits_exports", "__export", "CreditsTemplate", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_provider", "import_creditsBanner", "import_creditsInfoCard", "import_creditsBenefits", "import_creditsWaysToGetCredits", "import_creditsAnkersolixTask", "import_creditsRedeemList", "import_creditsGoGift", "import_creditsCash", "import_creditsMemberPrice", "import_creditsFaq", "import_creditsNavigation", "import_ActivitiesModal", "import_RewardsModal", "import_Credits", "CreditsContent", "headlessConfig", "pageConfig", "userContext", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "pageCommon", "key", "componentCopy", "ActivitiesModal", "RewardsModal", "siteConfig", "creditsConfig", "registrationContext", "gtm", "cartConfig"]
4
+ "sourcesContent": ["import { classNames, HeadlessProvider } from '@anker-in/lib'\nimport { useEffect, useRef } from 'react'\nimport { RegistrationProvider } from '../components/registration/context/provider'\nimport { CreditsProvider, useCreditsContext } from '../components/credits/context/provider'\nimport { CreditsBanner } from '../components/credits/creditsBanner'\nimport { CreditsInfoCard } from '../components/credits/creditsInfoCard'\nimport { CreditsBenefits } from '../components/credits/creditsBenefits'\nimport { CreditsWaysToGetCredits } from '../components/credits/creditsWaysToGetCredits'\nimport { CreditsAnkersolixTask } from '../components/credits/creditsAnkersolixTask'\nimport { CreditsRedeemList } from '../components/credits/creditsRedeemList'\nimport { CreditsGoGift } from '../components/credits/creditsGoGift'\nimport { CreditsCash } from '../components/credits/creditsCash'\nimport { CreditsMemberPrice } from '../components/credits/creditsMemberPrice'\nimport { CreditsFaq } from '../components/credits/creditsFaq'\nimport { CreditsNavigation } from '../components/credits/creditsNavigation'\nimport ActivitiesModal from '../components/credits/modal/ActivitiesModal'\nimport RewardsModal from '../components/credits/modal/RewardsModal'\nimport { ComponentKey } from './Credits.types'\nimport type {\n CreditsTemplateProps,\n CreditsContentProps,\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n} from './Credits.types'\n\nconst CreditsContent = ({ headlessConfig, pageConfig, userContext }: CreditsContentProps) => {\n const { openMyRewardsModal, setOpenMyRewardsModal, openActivitiesModal, setOpenActivitiesModal, pageCommon } = useCreditsContext()\n const hasScrolled = useRef(false)\n\n useEffect(() => {\n if (hasScrolled.current || typeof window === 'undefined') return\n\n const params = new URLSearchParams(window.location.search)\n const section = params.get('section')\n if (!section) return\n\n const navHeight = 56\n\n const tryScroll = (attempts = 0) => {\n const el = document.getElementById(section)\n if (el) {\n hasScrolled.current = true\n const top = el.getBoundingClientRect().top + window.pageYOffset - navHeight\n window.scrollTo({ top, behavior: 'smooth' })\n } else if (attempts < 10) {\n setTimeout(() => tryScroll(attempts + 1), 300)\n }\n }\n\n tryScroll()\n }, [])\n\n return (\n <>\n {/* \u5BFC\u822A\u7EC4\u4EF6 - \u56FA\u5B9A\u4F4D\u7F6E\uFF0C\u4E0D\u53C2\u4E0E order \u6392\u5E8F */}\n {pageConfig.components[ComponentKey.Navigation] && (\n <CreditsNavigation copy={pageConfig.components[ComponentKey.Navigation]} />\n )}\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n // \u8DF3\u8FC7\u5BFC\u822A\u7EC4\u4EF6\uFF0C\u56E0\u4E3A\u5B83\u5DF2\u7ECF\u56FA\u5B9A\u6E32\u67D3\u5728\u4E0A\u65B9\n if (key === ComponentKey.Navigation) return null\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} id={key} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} id={key} />\n )}\n {key === ComponentKey.Benefits && (\n <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} id={key} />\n )}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\n id={key}\n classNames={\n headlessConfig.brand === 'anker'\n ? {\n subtitle: 'text-white',\n equalCreditsText:\n 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',\n }\n : {\n subtitle: 'text-[#D1D1D1]',\n equalCreditsText: 'text-[#F6EAD0]',\n }\n }\n />\n )}\n {key === ComponentKey.AnkersolixTask && (\n <CreditsAnkersolixTask copy={componentCopy as CreditsAnkersolixTaskCopy} id={key} />\n )}\n {key === ComponentKey.RedeemList && (\n <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} id={key} />\n )}\n {key === ComponentKey.GoGift && <CreditsGoGift copy={componentCopy as CreditsGoGiftCopy} id={key} />}\n {key === ComponentKey.SpendCreditsLikeCash && (\n <CreditsCash copy={componentCopy as CreditsCashCopy} id={key} />\n )}\n {key === ComponentKey.MemberPrice && (\n <CreditsMemberPrice copy={componentCopy as CreditsMemberPriceCopy} id={key} />\n )}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} id={key} />}\n {key !== ComponentKey.Banner && (\n <div className=\"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16\" />\n )}\n </>\n )\n })}\n </div>\n\n {/* Global Modals */}\n {pageCommon?.activitiesModal && (\n <ActivitiesModal\n isOpen={openActivitiesModal}\n data={pageCommon.activitiesModal}\n onClose={() => setOpenActivitiesModal(false)}\n />\n )}\n {pageCommon?.rewardsModal && (\n <RewardsModal\n isOpen={openMyRewardsModal}\n data={pageCommon.rewardsModal}\n onClose={() => setOpenMyRewardsModal(false)}\n />\n )}\n </>\n )\n}\n\nexport const CreditsTemplate = ({\n headlessConfig,\n siteConfig,\n creditsConfig,\n userContext,\n pageConfig,\n registrationContext,\n gtm,\n cartConfig,\n}: CreditsTemplateProps) => {\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>\n <CreditsProvider\n profile={userContext?.profile}\n removeProfile={userContext?.removeProfile}\n isLoadingProfile={userContext?.isLoadingProfile}\n openSignInPopup={registrationContext.openSignInPopup}\n openSignUpPopup={registrationContext.openSignUpPopup}\n creditInfo={userContext?.creditInfo}\n taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}\n customer={userContext?.customer}\n fetchCreditInfo={userContext?.fetchCreditInfo}\n customerLoading={userContext?.customerLoading}\n gtm={gtm}\n pageCommon={pageConfig.common}\n memberPriceDiscount={siteConfig.memberPriceDiscount}\n alpcBrand={creditsConfig?.alpcBrand}\n alpcCountry={creditsConfig?.alpcCountry}\n cartConfig={cartConfig}\n apiBaseUrl={userContext?.apiBaseUrl}\n >\n <CreditsContent headlessConfig={headlessConfig} pageConfig={pageConfig} userContext={userContext} />\n </CreditsProvider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\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,EAAW,aACjB,QAAS,IAAMH,EAAsB,EAAK,EAC5C,GAEJ,CAEJ,EAEazB,EAAkB,CAAC,CAC9B,eAAAqB,EACA,WAAAmB,EACA,cAAAC,EACA,YAAAlB,EACA,WAAAD,EACA,oBAAAoB,EACA,IAAAC,EACA,WAAAC,CACF,OAEI,OAAC,oBAAiB,eAAgBvB,EAChC,mBAAC,wBAAqB,KAAMmB,EAAW,sBAAuB,MAAOjB,GAAa,SAAS,MACzF,mBAAC,mBACC,QAASA,GAAa,QACtB,cAAeA,GAAa,cAC5B,iBAAkBA,GAAa,iBAC/B,gBAAiBmB,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYnB,GAAa,WACzB,oBAAqBiB,EAAW,oBAChC,SAAUjB,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKoB,EACL,WAAYrB,EAAW,OACvB,oBAAqBkB,EAAW,oBAChC,UAAWC,GAAe,UAC1B,YAAaA,GAAe,YAC5B,WAAYG,EACZ,WAAYrB,GAAa,WAEzB,mBAACH,EAAA,CAAe,eAAgBC,EAAgB,WAAYC,EAAY,YAAaC,EAAa,EACpG,EACF,EACF",
6
+ "names": ["Credits_exports", "__export", "CreditsTemplate", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_react", "import_provider", "import_creditsBanner", "import_creditsInfoCard", "import_creditsBenefits", "import_creditsWaysToGetCredits", "import_creditsAnkersolixTask", "import_creditsRedeemList", "import_creditsGoGift", "import_creditsCash", "import_creditsMemberPrice", "import_creditsFaq", "import_creditsNavigation", "import_ActivitiesModal", "import_RewardsModal", "import_Credits", "CreditsContent", "headlessConfig", "pageConfig", "userContext", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "pageCommon", "hasScrolled", "section", "navHeight", "tryScroll", "attempts", "el", "top", "key", "componentCopy", "ActivitiesModal", "RewardsModal", "siteConfig", "creditsConfig", "registrationContext", "gtm", "cartConfig"]
7
7
  }
@@ -39,6 +39,7 @@ export type CreditsTemplateProps = {
39
39
  };
40
40
  creditsConfig?: {
41
41
  alpcBrand?: string;
42
+ alpcCountry?: string;
42
43
  };
43
44
  pageConfig: {
44
45
  order: ComponentKey[];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/templates/Credits.types.ts"],
4
- "sourcesContent": ["import { HeadlessConfig } from '@anker-in/lib'\nimport { DTC_TASK_TYPE } from '../components/credits/context/const'\nimport { CreditsPageCommon } from '../components/credits/type'\nimport { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\nimport type { CreditsBannerCopy } from '../components/credits/creditsBanner'\nimport type { CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'\nimport type { CreditsBenefitsCopy } from '../components/credits/creditsBenefits'\nimport type { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'\nimport type { CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask'\nimport type { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport type { CreditsGoGiftCopy } from '../components/credits/creditsGoGift'\nimport type { CreditsCashCopy } from '../components/credits/creditsCash'\nimport type { CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice'\nimport type { CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport type { CreditsNavigationCopy } from '../components/credits/creditsNavigation'\n\n// Re-export copy types for convenience\nexport type {\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n CreditsNavigationCopy,\n}\n\nexport enum ComponentKey {\n Navigation = 'creditsNavigation',\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n AnkersolixTask = 'creditsAnkersolixTask',\n RedeemList = 'creditsRedeemList',\n GoGift = 'creditsGoGift',\n SpendCreditsLikeCash = 'creditsCash',\n MemberPrice = 'creditsMemberPrice',\n Faqs = 'creditsFaq',\n}\n\nexport type CreditsTemplateProps = {\n headlessConfig: HeadlessConfig\n siteConfig: {\n registrationsSettings: {\n authCodeActivate: AuthCodeActivateCopy\n }\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n }\n creditsConfig?: {\n alpcBrand?: string\n }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Navigation]?: CreditsNavigationCopy\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.GoGift]?: CreditsGoGiftCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\n [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy\n [ComponentKey.Faqs]?: CreditsFaqCopy\n }\n }\n userContext: {\n profile: any\n removeProfile: () => void\n isLoadingProfile: boolean\n creditInfo: any\n customer: any\n customerLoading: boolean\n fetchCreditInfo: () => void\n apiBaseUrl?: string\n }\n registrationContext: {\n openSignUpPopup: () => void\n openSignInPopup: () => void\n }\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n}\n\nexport type CreditsContentProps = {\n headlessConfig: HeadlessConfig\n pageConfig: CreditsTemplateProps['pageConfig']\n userContext: CreditsTemplateProps['userContext']\n}\n"],
4
+ "sourcesContent": ["import { HeadlessConfig } from '@anker-in/lib'\nimport { DTC_TASK_TYPE } from '../components/credits/context/const'\nimport { CreditsPageCommon } from '../components/credits/type'\nimport { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\nimport type { CreditsBannerCopy } from '../components/credits/creditsBanner'\nimport type { CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'\nimport type { CreditsBenefitsCopy } from '../components/credits/creditsBenefits'\nimport type { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'\nimport type { CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask'\nimport type { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport type { CreditsGoGiftCopy } from '../components/credits/creditsGoGift'\nimport type { CreditsCashCopy } from '../components/credits/creditsCash'\nimport type { CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice'\nimport type { CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport type { CreditsNavigationCopy } from '../components/credits/creditsNavigation'\n\n// Re-export copy types for convenience\nexport type {\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n CreditsNavigationCopy,\n}\n\nexport enum ComponentKey {\n Navigation = 'creditsNavigation',\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n AnkersolixTask = 'creditsAnkersolixTask',\n RedeemList = 'creditsRedeemList',\n GoGift = 'creditsGoGift',\n SpendCreditsLikeCash = 'creditsCash',\n MemberPrice = 'creditsMemberPrice',\n Faqs = 'creditsFaq',\n}\n\nexport type CreditsTemplateProps = {\n headlessConfig: HeadlessConfig\n siteConfig: {\n registrationsSettings: {\n authCodeActivate: AuthCodeActivateCopy\n }\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n }\n creditsConfig?: {\n alpcBrand?: string\n alpcCountry?: string\n }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Navigation]?: CreditsNavigationCopy\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.GoGift]?: CreditsGoGiftCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\n [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy\n [ComponentKey.Faqs]?: CreditsFaqCopy\n }\n }\n userContext: {\n profile: any\n removeProfile: () => void\n isLoadingProfile: boolean\n creditInfo: any\n customer: any\n customerLoading: boolean\n fetchCreditInfo: () => void\n apiBaseUrl?: string\n }\n registrationContext: {\n openSignUpPopup: () => void\n openSignInPopup: () => void\n }\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n}\n\nexport type CreditsContentProps = {\n headlessConfig: HeadlessConfig\n pageConfig: CreditsTemplateProps['pageConfig']\n userContext: CreditsTemplateProps['userContext']\n}\n"],
5
5
  "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAgCO,IAAKE,OACVA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,SAAW,kBACXA,EAAA,SAAW,kBACXA,EAAA,iBAAmB,0BACnBA,EAAA,eAAiB,wBACjBA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,qBAAuB,cACvBA,EAAA,YAAc,qBACdA,EAAA,KAAO,aAXGA,OAAA",
6
6
  "names": ["Credits_types_exports", "__export", "ComponentKey", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as t}from"react/jsx-runtime";import d from"react-markdown";import n from"remark-gfm";const i={render:(l,a,s)=>{const r=l;return r.text?t("div",{className:"livechat-markdown text-base md:text-sm",children:t(d,{remarkPlugins:[n],components:{a:({node:o,...e})=>t("a",{...e,className:`underline ${a?"text-blue-200 hover:text-blue-100":"text-blue-600 hover:text-blue-700"}`,target:"_blank",rel:"noopener noreferrer"}),code:({node:o,...e})=>e.inline?t("code",{...e,className:`rounded px-1.5 py-0.5 font-mono text-xs ${a?"livechat-code-user bg-[#004A6E] text-white":"bg-gray-200 text-gray-800"}`}):t("code",{...e,className:`block overflow-x-auto rounded px-3 py-2 font-mono text-xs ${a?"livechat-code-user bg-[#004A6E] text-white":"bg-gray-200 text-gray-800"}`}),p:({node:o,...e})=>t("p",{...e,className:"last:mb-0"}),ul:({node:o,...e})=>t("ul",{...e,className:"ml-4 list-disc"}),ol:({node:o,...e})=>t("ol",{...e,className:"mb-2 ml-4 list-decimal"}),li:({node:o,...e})=>t("li",{...e,className:"mb-1"}),h1:({node:o,...e})=>t("h1",{...e,className:"mb-2 font-bold"}),h2:({node:o,...e})=>t("h2",{...e,className:"mb-2 font-bold"}),h3:({node:o,...e})=>t("h3",{...e,className:"mb-1 font-bold"}),strong:({node:o,...e})=>t("strong",{...e,className:"font-bold"}),em:({node:o,...e})=>t("em",{...e,className:"italic"}),table:({node:o,...e})=>t("div",{className:"my-2 overflow-x-auto",children:t("table",{...e,className:"min-w-full border-collapse border border-gray-300 text-base md:text-sm"})}),thead:({node:o,...e})=>t("thead",{...e,className:"bg-gray-100"}),tbody:({node:o,...e})=>t("tbody",{...e}),tr:({node:o,...e})=>t("tr",{...e,className:"border-b border-gray-300"}),th:({node:o,...e})=>t("th",{...e,className:"border border-gray-300 px-3 py-2 text-left font-semibold"}),td:({node:o,...e})=>t("td",{...e,className:"border border-gray-300 px-3 py-2"})},children:r.text})}):null}};export{i as TextBlock};
1
+ import{jsx as t}from"react/jsx-runtime";import d from"react-markdown";import n from"remark-gfm";const y={render:(s,a,m)=>{const r=s;return r.text?t("div",{className:"livechat-markdown text-base md:text-sm",children:t(d,{remarkPlugins:[n],components:{a:({node:o,...e})=>t("a",{...e,className:`underline ${a?"text-blue-200 hover:text-blue-100":"text-blue-600 hover:text-blue-700"}`,target:"_blank",rel:"noopener noreferrer"}),code:({node:o,className:e,...l})=>/language-/.test(e||"")?t("code",{...l,className:`block overflow-x-auto rounded px-3 py-2 font-mono text-xs ${a?"livechat-code-user bg-[#004A6E] text-white":"bg-gray-200 text-gray-800"}`}):t("code",{...l,className:`rounded px-1.5 py-0.5 font-mono text-xs ${a?"livechat-code-user bg-[#004A6E] text-white":"bg-gray-200 text-gray-800"}`}),p:({node:o,...e})=>t("p",{...e,className:"last:mb-0"}),ul:({node:o,...e})=>t("ul",{...e,className:"ml-4 list-disc"}),ol:({node:o,...e})=>t("ol",{...e,className:"mb-2 ml-4 list-decimal"}),li:({node:o,...e})=>t("li",{...e,className:"mb-1"}),h1:({node:o,...e})=>t("h1",{...e,className:"mb-2 font-bold"}),h2:({node:o,...e})=>t("h2",{...e,className:"mb-2 font-bold"}),h3:({node:o,...e})=>t("h3",{...e,className:"mb-1 font-bold"}),strong:({node:o,...e})=>t("strong",{...e,className:"font-bold"}),em:({node:o,...e})=>t("em",{...e,className:"italic"}),table:({node:o,...e})=>t("div",{className:"my-2 overflow-x-auto",children:t("table",{...e,className:"min-w-full border-collapse border border-gray-300 text-base md:text-sm"})}),thead:({node:o,...e})=>t("thead",{...e,className:"bg-gray-100"}),tbody:({node:o,...e})=>t("tbody",{...e}),tr:({node:o,...e})=>t("tr",{...e,className:"border-b border-gray-300"}),th:({node:o,...e})=>t("th",{...e,className:"border border-gray-300 px-3 py-2 text-left font-semibold"}),td:({node:o,...e})=>t("td",{...e,className:"border border-gray-300 px-3 py-2"})},children:r.text})}):null}};export{y as TextBlock};
2
2
  //# sourceMappingURL=TextBlock.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/LiveChatWidget/components/MessageContent/TextBlock.tsx"],
4
- "sourcesContent": ["/**\n * \u6587\u672C\u6D88\u606F\u5185\u5BB9\u6E32\u67D3\u5668\n * \u652F\u6301 Markdown \u683C\u5F0F\n * \u57FA\u4E8E specs/livechat-widget/plan.md \u7684\u6587\u672C\u6D88\u606F\u8BBE\u8BA1\n */\n\nimport React from 'react'\nimport ReactMarkdown from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport type { MessageRenderer, TextContent } from '../../types'\n\n/**\n * \u6587\u672C\u6D88\u606F\u6E32\u67D3\u5668\n *\n * \u529F\u80FD\uFF1A\n * - \u652F\u6301 Markdown \u8BED\u6CD5\uFF08\u7C97\u4F53\u3001\u659C\u4F53\u3001\u94FE\u63A5\u3001\u5217\u8868\u7B49\uFF09\n * - \u5B89\u5168\u6E32\u67D3\uFF08React Markdown \u81EA\u52A8\u9632\u62A4 XSS\uFF09\n * - \u54CD\u5E94\u5F0F\u6587\u672C\u6837\u5F0F\n *\n * Markdown \u652F\u6301\uFF1A\n * - \u7C97\u4F53\uFF1A**text** \u6216 __text__\n * - \u659C\u4F53\uFF1A*text* \u6216 _text_\n * - \u94FE\u63A5\uFF1A[text](url)\n * - \u5217\u8868\uFF1A- item \u6216 1. item\n * - \u4EE3\u7801\uFF1A`code` \u6216 ```code block```\n *\n * @example\n * ```tsx\n * const content: TextContent = {\n * type: 'text',\n * text: '\u60A8\u597D\uFF01**\u8FD9\u662F\u7C97\u4F53**\uFF0C*\u8FD9\u662F\u659C\u4F53*\u3002'\n * }\n * <TextBlock.render(content, false, false) />\n * ```\n */\nexport const TextBlock: MessageRenderer = {\n render: (content, isUser, isSystem) => {\n const textContent = content as TextContent\n\n if (!textContent.text) {\n return null\n }\n\n return (\n <div className=\"livechat-markdown text-base md:text-sm\">\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n components={{\n // \u81EA\u5B9A\u4E49\u94FE\u63A5\u6837\u5F0F\n a: ({ node, ...props }) => (\n <a\n {...props}\n className={`underline ${isUser ? 'text-blue-200 hover:text-blue-100' : 'text-blue-600 hover:text-blue-700'}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n // \u81EA\u5B9A\u4E49\u4EE3\u7801\u5757\u6837\u5F0F\n code: ({ node, ...props }: any) =>\n props.inline ? (\n <code\n {...props}\n className={`rounded px-1.5 py-0.5 font-mono text-xs ${isUser ? 'livechat-code-user bg-[#004A6E] text-white' : 'bg-gray-200 text-gray-800'}`}\n />\n ) : (\n <code\n {...props}\n className={`block overflow-x-auto rounded px-3 py-2 font-mono text-xs ${isUser ? 'livechat-code-user bg-[#004A6E] text-white' : 'bg-gray-200 text-gray-800'}`}\n />\n ),\n // \u81EA\u5B9A\u4E49\u6BB5\u843D\u6837\u5F0F\n p: ({ node, ...props }) => <p {...props} className=\"last:mb-0\" />,\n // \u81EA\u5B9A\u4E49\u5217\u8868\u6837\u5F0F\n ul: ({ node, ...props }) => <ul {...props} className=\"ml-4 list-disc\" />,\n ol: ({ node, ...props }) => <ol {...props} className=\"mb-2 ml-4 list-decimal\" />,\n li: ({ node, ...props }) => <li {...props} className=\"mb-1\" />,\n // \u81EA\u5B9A\u4E49\u6807\u9898\u6837\u5F0F\n h1: ({ node, ...props }) => <h1 {...props} className=\"mb-2 font-bold\" />,\n h2: ({ node, ...props }) => <h2 {...props} className=\"mb-2 font-bold\" />,\n h3: ({ node, ...props }) => <h3 {...props} className=\"mb-1 font-bold\" />,\n // \u81EA\u5B9A\u4E49\u5F3A\u8C03\u6837\u5F0F\n strong: ({ node, ...props }) => <strong {...props} className=\"font-bold\" />,\n em: ({ node, ...props }) => <em {...props} className=\"italic\" />,\n // \u8868\u683C\u6837\u5F0F\n table: ({ node, ...props }) => (\n <div className=\"my-2 overflow-x-auto\">\n <table {...props} className=\"min-w-full border-collapse border border-gray-300 text-base md:text-sm\" />\n </div>\n ),\n thead: ({ node, ...props }) => (\n <thead {...props} className=\"bg-gray-100\" />\n ),\n tbody: ({ node, ...props }) => <tbody {...props} />,\n tr: ({ node, ...props }) => (\n <tr {...props} className=\"border-b border-gray-300\" />\n ),\n th: ({ node, ...props }) => (\n <th {...props} className=\"border border-gray-300 px-3 py-2 text-left font-semibold\" />\n ),\n td: ({ node, ...props }) => (\n <td {...props} className=\"border border-gray-300 px-3 py-2\" />\n ),\n }}\n >\n {textContent.text}\n </ReactMarkdown>\n </div>\n )\n },\n}\n"],
5
- "mappings": "AAkDc,cAAAA,MAAA,oBA3Cd,OAAOC,MAAmB,iBAC1B,OAAOC,MAAe,aA2Bf,MAAMC,EAA6B,CACxC,OAAQ,CAACC,EAASC,EAAQC,IAAa,CACrC,MAAMC,EAAcH,EAEpB,OAAKG,EAAY,KAKfP,EAAC,OAAI,UAAU,yCACb,SAAAA,EAACC,EAAA,CACC,cAAe,CAACC,CAAS,EACzB,WAAY,CAEV,EAAG,CAAC,CAAE,KAAAM,EAAM,GAAGC,CAAM,IACnBT,EAAC,KACE,GAAGS,EACJ,UAAW,aAAaJ,EAAS,oCAAsC,mCAAmC,GAC1G,OAAO,SACP,IAAI,sBACN,EAGF,KAAM,CAAC,CAAE,KAAAG,EAAM,GAAGC,CAAM,IACtBA,EAAM,OACJT,EAAC,QACE,GAAGS,EACJ,UAAW,2CAA2CJ,EAAS,6CAA+C,2BAA2B,GAC3I,EAEAL,EAAC,QACE,GAAGS,EACJ,UAAW,6DAA6DJ,EAAS,6CAA+C,2BAA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,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,2BAA2B,EAEtD,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,2DAA2D,EAEtF,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,mCAAmC,CAEhE,EAEC,SAAAF,EAAY,KACf,EACF,EAlEO,IAoEX,CACF",
6
- "names": ["jsx", "ReactMarkdown", "remarkGfm", "TextBlock", "content", "isUser", "isSystem", "textContent", "node", "props"]
4
+ "sourcesContent": ["/**\n * \u6587\u672C\u6D88\u606F\u5185\u5BB9\u6E32\u67D3\u5668\n * \u652F\u6301 Markdown \u683C\u5F0F\n * \u57FA\u4E8E specs/livechat-widget/plan.md \u7684\u6587\u672C\u6D88\u606F\u8BBE\u8BA1\n */\n\nimport React from 'react'\nimport ReactMarkdown from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport type { MessageRenderer, TextContent } from '../../types'\n\n/**\n * \u6587\u672C\u6D88\u606F\u6E32\u67D3\u5668\n *\n * \u529F\u80FD\uFF1A\n * - \u652F\u6301 Markdown \u8BED\u6CD5\uFF08\u7C97\u4F53\u3001\u659C\u4F53\u3001\u94FE\u63A5\u3001\u5217\u8868\u7B49\uFF09\n * - \u5B89\u5168\u6E32\u67D3\uFF08React Markdown \u81EA\u52A8\u9632\u62A4 XSS\uFF09\n * - \u54CD\u5E94\u5F0F\u6587\u672C\u6837\u5F0F\n *\n * Markdown \u652F\u6301\uFF1A\n * - \u7C97\u4F53\uFF1A**text** \u6216 __text__\n * - \u659C\u4F53\uFF1A*text* \u6216 _text_\n * - \u94FE\u63A5\uFF1A[text](url)\n * - \u5217\u8868\uFF1A- item \u6216 1. item\n * - \u4EE3\u7801\uFF1A`code` \u6216 ```code block```\n *\n * @example\n * ```tsx\n * const content: TextContent = {\n * type: 'text',\n * text: '\u60A8\u597D\uFF01**\u8FD9\u662F\u7C97\u4F53**\uFF0C*\u8FD9\u662F\u659C\u4F53*\u3002'\n * }\n * <TextBlock.render(content, false, false) />\n * ```\n */\nexport const TextBlock: MessageRenderer = {\n render: (content, isUser, isSystem) => {\n const textContent = content as TextContent\n\n if (!textContent.text) {\n return null\n }\n\n return (\n <div className=\"livechat-markdown text-base md:text-sm\">\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n components={{\n // \u81EA\u5B9A\u4E49\u94FE\u63A5\u6837\u5F0F\n a: ({ node, ...props }) => (\n <a\n {...props}\n className={`underline ${isUser ? 'text-blue-200 hover:text-blue-100' : 'text-blue-600 hover:text-blue-700'}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n // \u81EA\u5B9A\u4E49\u4EE3\u7801\u5757\u6837\u5F0F\n code: ({ node, className, ...props }: any) => {\n const isBlock = /language-/.test(className || '')\n return isBlock ? (\n <code\n {...props}\n className={`block overflow-x-auto rounded px-3 py-2 font-mono text-xs ${isUser ? 'livechat-code-user bg-[#004A6E] text-white' : 'bg-gray-200 text-gray-800'}`}\n />\n ) : (\n <code\n {...props}\n className={`rounded px-1.5 py-0.5 font-mono text-xs ${isUser ? 'livechat-code-user bg-[#004A6E] text-white' : 'bg-gray-200 text-gray-800'}`}\n />\n )\n },\n // \u81EA\u5B9A\u4E49\u6BB5\u843D\u6837\u5F0F\n p: ({ node, ...props }) => <p {...props} className=\"last:mb-0\" />,\n // \u81EA\u5B9A\u4E49\u5217\u8868\u6837\u5F0F\n ul: ({ node, ...props }) => <ul {...props} className=\"ml-4 list-disc\" />,\n ol: ({ node, ...props }) => <ol {...props} className=\"mb-2 ml-4 list-decimal\" />,\n li: ({ node, ...props }) => <li {...props} className=\"mb-1\" />,\n // \u81EA\u5B9A\u4E49\u6807\u9898\u6837\u5F0F\n h1: ({ node, ...props }) => <h1 {...props} className=\"mb-2 font-bold\" />,\n h2: ({ node, ...props }) => <h2 {...props} className=\"mb-2 font-bold\" />,\n h3: ({ node, ...props }) => <h3 {...props} className=\"mb-1 font-bold\" />,\n // \u81EA\u5B9A\u4E49\u5F3A\u8C03\u6837\u5F0F\n strong: ({ node, ...props }) => <strong {...props} className=\"font-bold\" />,\n em: ({ node, ...props }) => <em {...props} className=\"italic\" />,\n // \u8868\u683C\u6837\u5F0F\n table: ({ node, ...props }) => (\n <div className=\"my-2 overflow-x-auto\">\n <table {...props} className=\"min-w-full border-collapse border border-gray-300 text-base md:text-sm\" />\n </div>\n ),\n thead: ({ node, ...props }) => (\n <thead {...props} className=\"bg-gray-100\" />\n ),\n tbody: ({ node, ...props }) => <tbody {...props} />,\n tr: ({ node, ...props }) => (\n <tr {...props} className=\"border-b border-gray-300\" />\n ),\n th: ({ node, ...props }) => (\n <th {...props} className=\"border border-gray-300 px-3 py-2 text-left font-semibold\" />\n ),\n td: ({ node, ...props }) => (\n <td {...props} className=\"border border-gray-300 px-3 py-2\" />\n ),\n }}\n >\n {textContent.text}\n </ReactMarkdown>\n </div>\n )\n },\n}\n"],
5
+ "mappings": "AAkDc,cAAAA,MAAA,oBA3Cd,OAAOC,MAAmB,iBAC1B,OAAOC,MAAe,aA2Bf,MAAMC,EAA6B,CACxC,OAAQ,CAACC,EAASC,EAAQC,IAAa,CACrC,MAAMC,EAAcH,EAEpB,OAAKG,EAAY,KAKfP,EAAC,OAAI,UAAU,yCACb,SAAAA,EAACC,EAAA,CACC,cAAe,CAACC,CAAS,EACzB,WAAY,CAEV,EAAG,CAAC,CAAE,KAAAM,EAAM,GAAGC,CAAM,IACnBT,EAAC,KACE,GAAGS,EACJ,UAAW,aAAaJ,EAAS,oCAAsC,mCAAmC,GAC1G,OAAO,SACP,IAAI,sBACN,EAGF,KAAM,CAAC,CAAE,KAAAG,EAAM,UAAAE,EAAW,GAAGD,CAAM,IACjB,YAAY,KAAKC,GAAa,EAAE,EAE9CV,EAAC,QACE,GAAGS,EACJ,UAAW,6DAA6DJ,EAAS,6CAA+C,2BAA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M,GAAGC,CAAM,IAAMT,EAAC,SAAO,GAAGS,EAAO,EACjD,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,2BAA2B,EAEtD,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,2DAA2D,EAEtF,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,mCAAmC,CAEhE,EAEC,SAAAF,EAAY,KACf,EACF,EApEO,IAsEX,CACF",
6
+ "names": ["jsx", "ReactMarkdown", "remarkGfm", "TextBlock", "content", "isUser", "isSystem", "textContent", "node", "props", "className"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{useCallback as R,useEffect as C,useState as d}from"react";import{ALPC_COUNTRY_MAP as b,AlpcConsumeType as A}from"../const";import{useAlpcMutation as M}from"./useAlpcFetch";import{useCreditsContext as w}from"../provider";import{useHeadlessContext as L}from"@anker-in/lib";function T({page:o,pageSize:r,consumeType:n}){const{profile:e,alpcBrand:c}=w(),{brand:l,locale:a,appName:g}=L(),t=c||l,[u,_]=d([]),[p,f]=d(0),{isMutating:i,trigger:y}=M({url:"/v1/credit/log/coupon",initData:{brand:t,country:b.get(a)||a,app_name:g}}),s=R(async()=>{e?.user_id&&await y({consume_type:n||A.Coupon,page:o,page_size:r,user_id:e?.user_id},{onSuccess(m){f(m?.data?.total),_(m?.data?.redeem_logs||[])}})},[n,o,r,e?.user_id]);return C(()=>{!t||!e?.user_id||s()},[s,t]),{myRewards:u,isLoading:i,total:p,getMyRewards:s,canNext:p>u.length&&!i}}var P=T;export{P as default};
1
+ import{useCallback as R,useEffect as b,useState as d}from"react";import{ALPC_COUNTRY_MAP as A,AlpcConsumeType as M}from"../const";import{useAlpcMutation as w}from"./useAlpcFetch";import{useCreditsContext as L}from"../provider";import{useHeadlessContext as T}from"@anker-in/lib";function x({page:s,pageSize:r,consumeType:n}){const{profile:e,alpcBrand:c,alpcCountry:l}=L(),{brand:g,locale:a,appName:_}=T(),t=c||g,[u,f]=d([]),[p,y]=d(0),{isMutating:i,trigger:C}=w({url:"/v1/credit/log/coupon",initData:{brand:t,country:l||A.get(a)||a,app_name:_}}),o=R(async()=>{e?.user_id&&await C({consume_type:n||M.Coupon,page:s,page_size:r,user_id:e?.user_id},{onSuccess(m){y(m?.data?.total),f(m?.data?.redeem_logs||[])}})},[n,s,r,e?.user_id]);return b(()=>{!t||!e?.user_id||o()},[o,t]),{myRewards:u,isLoading:i,total:p,getMyRewards:o,canNext:p>u.length&&!i}}var S=x;export{S as default};
2
2
  //# sourceMappingURL=useMyRewards.js.map