@anker-in/campaign-ui 0.3.4 → 0.4.0-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 (363) hide show
  1. package/dist/cjs/components/LiveChatWidget/LiveChatWidget.js +1 -1
  2. package/dist/cjs/components/LiveChatWidget/LiveChatWidget.js.map +3 -3
  3. package/dist/cjs/components/LiveChatWidget/components/MessageContent/PromotionList.js.map +2 -2
  4. package/dist/cjs/components/LiveChatWidget/components/MessageList.js +3 -3
  5. package/dist/cjs/components/LiveChatWidget/components/MessageList.js.map +3 -3
  6. package/dist/cjs/components/LiveChatWidget/hooks/useChatState.d.ts +2 -1
  7. package/dist/cjs/components/LiveChatWidget/hooks/useChatState.js +1 -1
  8. package/dist/cjs/components/LiveChatWidget/hooks/useChatState.js.map +2 -2
  9. package/dist/cjs/components/LiveChatWidget/types.d.ts +2 -1
  10. package/dist/cjs/components/LiveChatWidget/types.js.map +1 -1
  11. package/dist/cjs/components/credits/context/const.d.ts +10 -2
  12. package/dist/cjs/components/credits/context/const.js +1 -1
  13. package/dist/cjs/components/credits/context/const.js.map +2 -2
  14. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
  15. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
  16. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
  17. package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
  18. package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
  19. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
  20. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +2 -0
  21. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
  22. package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
  23. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
  24. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  25. package/dist/cjs/components/credits/context/provider.d.ts +5 -1
  26. package/dist/cjs/components/credits/context/provider.js +1 -1
  27. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  28. package/dist/cjs/components/credits/context/response.d.ts +1 -0
  29. package/dist/cjs/components/credits/context/response.js.map +1 -1
  30. package/dist/cjs/components/credits/context/utils/atobID.d.ts +1 -0
  31. package/dist/cjs/components/credits/context/utils/atobID.js +2 -0
  32. package/dist/cjs/components/credits/context/utils/atobID.js.map +7 -0
  33. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
  34. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js +2 -0
  35. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
  36. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
  37. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
  38. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
  39. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
  40. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
  41. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
  42. package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
  43. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +2 -0
  44. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +7 -0
  45. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  46. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +2 -2
  47. package/dist/cjs/components/credits/creditsBanner/index.js +2 -2
  48. package/dist/cjs/components/credits/creditsBanner/index.js.map +2 -2
  49. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
  50. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +2 -2
  51. package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
  52. package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
  53. package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
  54. package/dist/cjs/components/credits/creditsGoGift/index.d.ts +2 -0
  55. package/dist/cjs/components/credits/creditsGoGift/index.js +2 -0
  56. package/dist/cjs/components/credits/creditsGoGift/index.js.map +7 -0
  57. package/dist/cjs/components/credits/creditsGoGift/type.d.ts +22 -0
  58. package/dist/cjs/components/credits/creditsGoGift/type.js +2 -0
  59. package/dist/cjs/components/credits/creditsGoGift/type.js.map +7 -0
  60. package/dist/cjs/components/credits/creditsGofit/CreditsGofit.d.ts +5 -0
  61. package/dist/cjs/components/credits/creditsGofit/CreditsGofit.js +2 -0
  62. package/dist/cjs/components/credits/creditsGofit/CreditsGofit.js.map +7 -0
  63. package/dist/cjs/components/credits/creditsGofit/index.d.ts +2 -0
  64. package/dist/cjs/components/credits/creditsGofit/index.js +2 -0
  65. package/dist/cjs/components/credits/creditsGofit/index.js.map +7 -0
  66. package/dist/cjs/components/credits/creditsGofit/type.d.ts +22 -0
  67. package/dist/cjs/components/credits/creditsGofit/type.js +2 -0
  68. package/dist/cjs/components/credits/creditsGofit/type.js.map +7 -0
  69. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  70. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  71. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  72. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +2 -2
  73. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  74. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  75. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
  76. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
  77. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
  78. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
  79. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
  80. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
  81. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
  82. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  83. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
  84. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
  85. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  86. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
  87. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
  88. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  89. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
  90. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
  91. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
  92. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
  93. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
  94. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  95. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
  96. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
  97. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  98. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
  99. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
  100. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  101. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  102. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
  103. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
  104. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
  105. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
  106. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
  107. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
  108. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
  109. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
  110. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
  111. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  112. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  113. package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +11 -0
  114. package/dist/cjs/components/credits/creditsRedeemList/type.js +1 -1
  115. package/dist/cjs/components/credits/creditsRedeemList/type.js.map +1 -1
  116. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  117. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +2 -2
  118. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
  119. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
  120. package/dist/cjs/components/credits/index.d.ts +2 -1
  121. package/dist/cjs/components/credits/index.js +1 -1
  122. package/dist/cjs/components/credits/index.js.map +3 -3
  123. package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +16 -0
  124. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  125. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +3 -3
  126. package/dist/cjs/components/credits/modal/RewardsModal.d.ts +64 -0
  127. package/dist/cjs/components/credits/modal/RewardsModal.js +2 -0
  128. package/dist/cjs/components/credits/modal/RewardsModal.js.map +7 -0
  129. package/dist/cjs/components/credits/modal/activitiesModal.d.ts +1 -1
  130. package/dist/cjs/components/credits/modal/activitiesModal.js +2 -2
  131. package/dist/cjs/components/credits/modal/activitiesModal.js.map +3 -3
  132. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +2 -2
  133. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  134. package/dist/cjs/components/credits/modal/loadingDots.js +1 -1
  135. package/dist/cjs/components/credits/modal/loadingDots.js.map +2 -2
  136. package/dist/cjs/components/credits/modal/modalContainer.js +2 -2
  137. package/dist/cjs/components/credits/modal/modalContainer.js.map +4 -4
  138. package/dist/cjs/components/credits/modal/rulesModal.d.ts +1 -1
  139. package/dist/cjs/components/credits/modal/rulesModal.js +2 -2
  140. package/dist/cjs/components/credits/modal/rulesModal.js.map +3 -3
  141. package/dist/cjs/components/credits/modal/subscribeModal.d.ts +1 -1
  142. package/dist/cjs/components/credits/modal/subscribeModal.js +2 -2
  143. package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
  144. package/dist/cjs/components/credits/modal/tip.js +1 -1
  145. package/dist/cjs/components/credits/modal/tip.js.map +2 -2
  146. package/dist/cjs/components/credits/type.d.ts +67 -5
  147. package/dist/cjs/components/credits/type.js +1 -1
  148. package/dist/cjs/components/credits/type.js.map +1 -1
  149. package/dist/cjs/stories/LiveChatWidget.stories.js +2 -9
  150. package/dist/cjs/stories/LiveChatWidget.stories.js.map +2 -2
  151. package/dist/cjs/templates/Credits.d.ts +1 -87
  152. package/dist/cjs/templates/Credits.js +1 -1
  153. package/dist/cjs/templates/Credits.js.map +3 -3
  154. package/dist/cjs/templates/Credits.types.d.ts +96 -0
  155. package/dist/cjs/templates/Credits.types.js +2 -0
  156. package/dist/cjs/templates/Credits.types.js.map +7 -0
  157. package/dist/esm/components/LiveChatWidget/LiveChatWidget.js +1 -1
  158. package/dist/esm/components/LiveChatWidget/LiveChatWidget.js.map +3 -3
  159. package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.js.map +2 -2
  160. package/dist/esm/components/LiveChatWidget/components/MessageList.js +3 -3
  161. package/dist/esm/components/LiveChatWidget/components/MessageList.js.map +3 -3
  162. package/dist/esm/components/LiveChatWidget/hooks/useChatState.d.ts +2 -1
  163. package/dist/esm/components/LiveChatWidget/hooks/useChatState.js +1 -1
  164. package/dist/esm/components/LiveChatWidget/hooks/useChatState.js.map +2 -2
  165. package/dist/esm/components/LiveChatWidget/types.d.ts +2 -1
  166. package/dist/esm/components/credits/context/const.d.ts +10 -2
  167. package/dist/esm/components/credits/context/const.js +1 -1
  168. package/dist/esm/components/credits/context/const.js.map +2 -2
  169. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
  170. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
  171. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
  172. package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
  173. package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
  174. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
  175. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +2 -0
  176. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
  177. package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
  178. package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
  179. package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  180. package/dist/esm/components/credits/context/provider.d.ts +5 -1
  181. package/dist/esm/components/credits/context/provider.js +1 -1
  182. package/dist/esm/components/credits/context/provider.js.map +3 -3
  183. package/dist/esm/components/credits/context/response.d.ts +1 -0
  184. package/dist/esm/components/credits/context/utils/atobID.d.ts +1 -0
  185. package/dist/esm/components/credits/context/utils/atobID.js +2 -0
  186. package/dist/esm/components/credits/context/utils/atobID.js.map +7 -0
  187. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
  188. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js +2 -0
  189. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
  190. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
  191. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
  192. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
  193. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
  194. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
  195. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
  196. package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
  197. package/dist/esm/components/credits/context/utils/variantGetCoupon.js +2 -0
  198. package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +7 -0
  199. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  200. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +1 -1
  201. package/dist/esm/components/credits/creditsBanner/index.js +2 -2
  202. package/dist/esm/components/credits/creditsBanner/index.js.map +2 -2
  203. package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
  204. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +1 -1
  205. package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
  206. package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
  207. package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
  208. package/dist/esm/components/credits/creditsGoGift/index.d.ts +2 -0
  209. package/dist/esm/components/credits/creditsGoGift/index.js +2 -0
  210. package/dist/esm/components/credits/creditsGoGift/index.js.map +7 -0
  211. package/dist/esm/components/credits/creditsGoGift/type.d.ts +22 -0
  212. package/dist/esm/components/credits/creditsGoGift/type.js +1 -0
  213. package/dist/esm/components/credits/creditsGoGift/type.js.map +7 -0
  214. package/dist/esm/components/credits/creditsGofit/CreditsGofit.d.ts +5 -0
  215. package/dist/esm/components/credits/creditsGofit/CreditsGofit.js +2 -0
  216. package/dist/esm/components/credits/creditsGofit/CreditsGofit.js.map +7 -0
  217. package/dist/esm/components/credits/creditsGofit/index.d.ts +2 -0
  218. package/dist/esm/components/credits/creditsGofit/index.js +2 -0
  219. package/dist/esm/components/credits/creditsGofit/index.js.map +7 -0
  220. package/dist/esm/components/credits/creditsGofit/type.d.ts +22 -0
  221. package/dist/esm/components/credits/creditsGofit/type.js +1 -0
  222. package/dist/esm/components/credits/creditsGofit/type.js.map +7 -0
  223. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  224. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  225. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  226. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +1 -1
  227. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  228. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  229. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
  230. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
  231. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
  232. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
  233. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
  234. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
  235. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
  236. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  237. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
  238. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
  239. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  240. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
  241. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
  242. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  243. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
  244. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
  245. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
  246. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
  247. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
  248. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  249. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
  250. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
  251. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  252. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
  253. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
  254. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  255. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  256. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
  257. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
  258. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
  259. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
  260. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
  261. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
  262. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
  263. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
  264. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
  265. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  266. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  267. package/dist/esm/components/credits/creditsRedeemList/type.d.ts +11 -0
  268. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  269. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +1 -1
  270. package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
  271. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
  272. package/dist/esm/components/credits/index.d.ts +2 -1
  273. package/dist/esm/components/credits/index.js +1 -1
  274. package/dist/esm/components/credits/index.js.map +3 -3
  275. package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +16 -0
  276. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  277. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
  278. package/dist/esm/components/credits/modal/RewardsModal.d.ts +64 -0
  279. package/dist/esm/components/credits/modal/RewardsModal.js +2 -0
  280. package/dist/esm/components/credits/modal/RewardsModal.js.map +7 -0
  281. package/dist/esm/components/credits/modal/activitiesModal.d.ts +1 -1
  282. package/dist/esm/components/credits/modal/activitiesModal.js +2 -2
  283. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  284. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +2 -2
  285. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +2 -2
  286. package/dist/esm/components/credits/modal/loadingDots.js +1 -1
  287. package/dist/esm/components/credits/modal/loadingDots.js.map +2 -2
  288. package/dist/esm/components/credits/modal/modalContainer.js +2 -2
  289. package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
  290. package/dist/esm/components/credits/modal/rulesModal.d.ts +1 -1
  291. package/dist/esm/components/credits/modal/rulesModal.js +2 -2
  292. package/dist/esm/components/credits/modal/rulesModal.js.map +3 -3
  293. package/dist/esm/components/credits/modal/subscribeModal.d.ts +1 -1
  294. package/dist/esm/components/credits/modal/subscribeModal.js +2 -2
  295. package/dist/esm/components/credits/modal/subscribeModal.js.map +2 -2
  296. package/dist/esm/components/credits/modal/tip.js +1 -1
  297. package/dist/esm/components/credits/modal/tip.js.map +2 -2
  298. package/dist/esm/components/credits/type.d.ts +67 -5
  299. package/dist/esm/stories/LiveChatWidget.stories.js +1 -8
  300. package/dist/esm/stories/LiveChatWidget.stories.js.map +2 -2
  301. package/dist/esm/templates/Credits.d.ts +1 -87
  302. package/dist/esm/templates/Credits.js +1 -1
  303. package/dist/esm/templates/Credits.js.map +3 -3
  304. package/dist/esm/templates/Credits.types.d.ts +96 -0
  305. package/dist/esm/templates/Credits.types.js +2 -0
  306. package/dist/esm/templates/Credits.types.js.map +7 -0
  307. package/package.json +2 -2
  308. package/src/components/LiveChatWidget/LiveChatWidget.tsx +20 -0
  309. package/src/components/LiveChatWidget/components/MessageContent/PromotionList.tsx +1 -1
  310. package/src/components/LiveChatWidget/components/MessageList.tsx +39 -44
  311. package/src/components/LiveChatWidget/hooks/useChatState.ts +4 -3
  312. package/src/components/LiveChatWidget/types.ts +2 -1
  313. package/src/components/credits/context/const.ts +8 -0
  314. package/src/components/credits/context/hooks/useMyRewards.ts +7 -31
  315. package/src/components/credits/context/hooks/useRedeemGoGift.ts +36 -0
  316. package/src/components/credits/context/hooks/useRedeemableList.ts +13 -19
  317. package/src/components/credits/context/provider.tsx +17 -2
  318. package/src/components/credits/context/response.ts +1 -0
  319. package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +2 -2
  320. package/src/components/credits/creditsBanner/index.tsx +5 -5
  321. package/src/components/credits/creditsCash/CreditsCash.tsx +1 -1
  322. package/src/components/credits/creditsGoGift/CreditsGoGift.tsx +210 -0
  323. package/src/components/credits/creditsGoGift/index.ts +2 -0
  324. package/src/components/credits/creditsGoGift/type.ts +23 -0
  325. package/src/components/credits/creditsInfoCard/index.tsx +5 -28
  326. package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +1 -1
  327. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +39 -17
  328. package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx +77 -0
  329. package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.tsx +86 -0
  330. package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +29 -138
  331. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +5 -6
  332. package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +11 -12
  333. package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +23 -14
  334. package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +11 -9
  335. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +4 -5
  336. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +29 -28
  337. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.tsx +101 -0
  338. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.tsx +65 -0
  339. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal.tsx +156 -0
  340. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
  341. package/src/components/credits/creditsRedeemList/type.ts +11 -0
  342. package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +2 -2
  343. package/src/components/credits/creditsWaysToGetCredits/type.ts +2 -2
  344. package/src/components/credits/index.ts +2 -1
  345. package/src/components/credits/modal/{activitiesModal.tsx → ActivitiesModal.tsx} +2 -2
  346. package/src/components/credits/modal/{creditsUploadReceiptModal.tsx → CreditsUploadReceiptModal.tsx} +1 -1
  347. package/src/components/credits/modal/{modalContainer.tsx → ModalContainer.tsx} +1 -1
  348. package/src/components/credits/modal/{MyRewardsModal.tsx → RewardsModal.tsx} +145 -103
  349. package/src/components/credits/modal/{rulesModal.tsx → RulesModal.tsx} +1 -1
  350. package/src/components/credits/modal/{subscribeModal.tsx → SubscribeModal.tsx} +1 -1
  351. package/src/components/credits/type.ts +68 -5
  352. package/src/stories/LiveChatWidget.stories.tsx +7 -12
  353. package/src/styles/livechat.css +29 -0
  354. package/src/templates/Credits.tsx +110 -142
  355. package/src/templates/Credits.types.ts +110 -0
  356. package/dist/index.d.mts +0 -1305
  357. package/dist/index.d.ts +0 -1305
  358. package/dist/index.js +0 -26656
  359. package/dist/index.js.map +0 -1
  360. package/dist/index.mjs +0 -26641
  361. package/dist/index.mjs.map +0 -1
  362. /package/src/components/credits/modal/{loadingDots.tsx → LoadingDots.tsx} +0 -0
  363. /package/src/components/credits/modal/{tip.tsx → Tip.tsx} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/hooks/useMyRewards.ts"],
4
- "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { isLoadingProfile, profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n const isLogin = !!profile\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const [currentPage, setCurrentPage] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n useEffect(() => {\n if (isLoadingProfile || !profile || isLoading) {\n return\n }\n\n if (page !== currentPage && page) {\n trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setCurrentPage(page)\n setTotal(responseData?.data?.total)\n setMyRewards(myRewards.concat(responseData?.data?.redeem_logs || []))\n },\n }\n )\n }\n }, [trigger, myRewards, consumeType, page, pageSize, currentPage, profile, isLoadingProfile, isLoading])\n\n const getMyRewards = useCallback(async () => {\n if (isLoadingProfile || !isLogin || !profile || isLoading) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n // \u4EC5\u652F\u63011\u9875\u7684\n onSuccess(responseData) {\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, isLoading, isLoadingProfile, page, pageSize, profile, trigger])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
5
- "mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,iBAAAC,EAAkB,QAAAC,EAAS,UAAAC,CAAU,EAAIR,EAAkB,EAC7D,CAAE,MAAOS,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,EAAIV,EAAmB,EAC/DW,EAAQJ,GAAaC,EACrBI,EAAU,CAAC,CAACN,EAEZ,CAACO,EAAWC,CAAY,EAAInB,EAA8B,CAAC,CAAC,EAC5D,CAACoB,EAAOC,CAAQ,EAAIrB,EAAS,CAAC,EAE9B,CAACsB,EAAaC,CAAc,EAAIvB,EAAS,CAAC,EAE1C,CAAE,WAAYwB,EAAW,QAAAC,CAAQ,EAAItB,EAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAOa,EACP,QAASf,EAAiB,IAAIa,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,CAAC,EAEDhB,EAAU,IAAM,CACVW,GAAoB,CAACC,GAAWa,GAIhCjB,IAASe,GAAef,GAC1BkB,EACE,CACE,aAAchB,GAAeP,EAAgB,OAC7C,KAAAK,EACA,UAAWC,EACX,QAASG,GAAS,OACpB,EACA,CACE,UAAUe,EAAc,CACtBH,EAAehB,CAAI,EACnBc,EAASK,GAAc,MAAM,KAAK,EAClCP,EAAaD,EAAU,OAAOQ,GAAc,MAAM,aAAe,CAAC,CAAC,CAAC,CACtE,CACF,CACF,CAEJ,EAAG,CAACD,EAASP,EAAWT,EAAaF,EAAMC,EAAUc,EAAaX,EAASD,EAAkBc,CAAS,CAAC,EAEvG,MAAMG,EAAe7B,EAAY,SAAY,CACvCY,GAAoB,CAACO,GAAW,CAACN,GAAWa,GAGhD,MAAMC,EACJ,CACE,aAAchB,GAAeP,EAAgB,OAC7C,KAAAK,EACA,UAAWC,EACX,QAASG,GAAS,OACpB,EACA,CAEE,UAAUe,EAAc,CACtBP,EAAaO,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACjB,EAAae,EAAWd,EAAkBH,EAAMC,EAAUG,EAASc,CAAO,CAAC,EAE/E,MAAO,CACL,UAAAP,EACA,UAAAM,EACA,MAAAJ,EACA,aAAAO,EACA,QAASP,EAAQF,EAAU,QAAU,CAACM,CACxC,CACF,CAEA,IAAOI,EAAQtB",
6
- "names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "useMyRewards", "page", "pageSize", "consumeType", "isLoadingProfile", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "isLogin", "myRewards", "setMyRewards", "total", "setTotal", "currentPage", "setCurrentPage", "isLoading", "trigger", "responseData", "getMyRewards", "useMyRewards_default"]
4
+ "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n const getMyRewards = useCallback(async () => {\n if (!profile?.user_id) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, page, pageSize, profile?.user_id])\n\n useEffect(() => {\n getMyRewards()\n }, [getMyRewards])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
5
+ "mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAG,QAAAC,EAAS,UAAAC,CAAU,EAAIP,EAAkB,EAC5C,CAAE,MAAOQ,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,EAAIT,EAAmB,EAC/DU,EAAQJ,GAAaC,EAErB,CAACI,EAAWC,CAAY,EAAIjB,EAA8B,CAAC,CAAC,EAC5D,CAACkB,EAAOC,CAAQ,EAAInB,EAAS,CAAC,EAE9B,CAAE,WAAYoB,EAAW,QAAAC,CAAQ,EAAIlB,EAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAOY,EACP,QAASd,EAAiB,IAAIY,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,CAAC,EAEKQ,EAAexB,EAAY,SAAY,CACtCY,GAAS,SAGd,MAAMW,EACJ,CACE,aAAcZ,GAAeP,EAAgB,OAC7C,KAAAK,EACA,UAAWC,EACX,QAASE,GAAS,OACpB,EACA,CACE,UAAUa,EAAc,CACtBN,EAAaM,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACd,EAAaF,EAAMC,EAAUE,GAAS,OAAO,CAAC,EAElD,OAAAX,EAAU,IAAM,CACduB,EAAa,CACf,EAAG,CAACA,CAAY,CAAC,EAEV,CACL,UAAAN,EACA,UAAAI,EACA,MAAAF,EACA,aAAAI,EACA,QAASJ,EAAQF,EAAU,QAAU,CAACI,CACxC,CACF,CAEA,IAAOI,EAAQlB",
6
+ "names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData", "useMyRewards_default"]
7
7
  }
@@ -0,0 +1,17 @@
1
+ import { type UseMutationConfig } from './useAlpcFetch';
2
+ type RedeemGoGiftResponse = {
3
+ data: {
4
+ id: string;
5
+ };
6
+ msg: string;
7
+ code: number;
8
+ };
9
+ export declare const useRedeemGoGift: (mutationOptions?: UseMutationConfig<RedeemGoGiftResponse>) => {
10
+ isMutating: boolean;
11
+ trigger: (fetchData: {
12
+ user_id?: string;
13
+ rule_id: number;
14
+ }, opts?: UseMutationConfig<RedeemGoGiftResponse>) => Promise<RedeemGoGiftResponse | undefined>;
15
+ data: RedeemGoGiftResponse | undefined;
16
+ };
17
+ export {};
@@ -0,0 +1,2 @@
1
+ import{ALPC_COUNTRY_MAP as s}from"../const";import{useAlpcMutation as i}from"./useAlpcFetch";import{useHeadlessContext as a}from"@anker-in/lib";import{useCreditsContext as d}from"../provider";const g=(t={})=>{const{alpcBrand:o}=d(),{locale:e,appName:n,brand:r}=a();return i({url:"/v1/credit/redeem/gogift",initData:{brand:o||r,country:s.get(e)||e,app_name:n}},t)};export{g as useRedeemGoGift};
2
+ //# sourceMappingURL=useRedeemGoGift.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/hooks/useRedeemGoGift.ts"],
4
+ "sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemGoGiftResponse = {\n data: {\n id: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemGoGift = (mutationOptions: UseMutationConfig<RedeemGoGiftResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemGoGiftResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/gogift`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
5
+ "mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAU3B,MAAMC,EAAkB,CAACC,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,CAAU,EAAIH,EAAkB,EAClC,CAAE,OAAAI,EAAQ,QAAAC,EAAS,MAAOC,CAAc,EAAIP,EAAmB,EAGrE,OAAOD,EAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQK,GAAaG,EAarB,QAAST,EAAiB,IAAIO,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,EACAH,CACF,CACF",
6
+ "names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemGoGift", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
7
+ }
@@ -1,7 +1,12 @@
1
+ import { AlpcConsumeType } from '../const';
1
2
  import type { ConsumeCreditRuleResponse } from '../response';
2
- declare function useRedeemableList(): {
3
+ declare function useRedeemableList(props?: {
4
+ consumeType: AlpcConsumeType;
5
+ }): {
3
6
  listLoading: boolean;
4
7
  redeemableList: ConsumeCreditRuleResponse[];
5
- getRedeemableList: () => void;
8
+ getRedeemableList: (props?: {
9
+ consumeType?: AlpcConsumeType;
10
+ }) => void;
6
11
  };
7
12
  export default useRedeemableList;
@@ -1,2 +1,2 @@
1
- import{useCallback as R,useEffect as b,useState as x}from"react";import{useAlpcMutation as y}from"./useAlpcFetch";import{ALPC_COUNTRY_MAP as S}from"../const";import{useCreditsContext as A}from"../provider";import{useHeadlessContext as M}from"@anker-in/lib";function P(){let t="";const{profile:n,isLoadingProfile:c,alpcBrand:m}=A(),{locale:u,brand:p}=M(),_=m||p;u==="pl"?t="eu":t=u;const[f,g]=x([]),{isMutating:C,trigger:l}=y({url:"/v1/credit/consume_credit_rules",initData:{brand:_,page:1,page_size:999,country:(S.get(t)||t)?.toUpperCase()}}),s=R(()=>{l({user_id:n?.user_id},{onSuccess(L){let a=L.data.consume_credit_rules||[],r=a.filter(e=>e.consume_type==1)||[],o=a.filter(e=>e.consume_type==2)||[];r=r.sort((e,i)=>e.consume_credits-i.consume_credits),o=o.sort((e,i)=>e.consume_credits-i.consume_credits);const d=r.concat(o);g(d),localStorage?.setItem(`consume_credit_rules-${t}`,JSON.stringify({expire:Date.now()+10*60*1e3,consume_credit_rules:d}))}})},[n,l,t]);return b(()=>{c||s()},[s,c]),{listLoading:C,redeemableList:f,getRedeemableList:s}}var h=P;export{h as default};
1
+ import{useCallback as y,useEffect as _,useState as g}from"react";import{useAlpcMutation as T}from"./useAlpcFetch";import{ALPC_COUNTRY_MAP as R}from"../const";import{useCreditsContext as L}from"../provider";import{useHeadlessContext as b}from"@anker-in/lib";function A(c){let e="";const{profile:t,isLoadingProfile:o,alpcBrand:l}=L(),{locale:n,brand:m}=b(),p=l||m;n==="pl"?e="eu":e=n;const[a,d]=g([]),{isMutating:C,trigger:r}=T({url:"/v1/credit/consume_credit_rules",initData:{brand:p,page:1,page_size:999,country:(R.get(e)||e)?.toUpperCase()}}),s=y(u=>{r({user_id:t?.user_id,...u?.consumeType&&{consume_type:u.consumeType}},{onSuccess(i){console.log("responseData",i);let f=i.data.consume_credit_rules||[];d(f)}})},[t,r,e]);return _(()=>{o||s({consumeType:c?.consumeType})},[s,o]),{listLoading:C,redeemableList:a,getRedeemableList:s}}var h=A;export{h as default};
2
2
  //# sourceMappingURL=useRedeemableList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/hooks/useRedeemableList.ts"],
4
- "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList() {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback(() => {\n trigger(\n {\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n let list = responseData.data.consume_credit_rules || []\n let cList = list.filter(i => i.consume_type == 1) || []\n let pList = list.filter(i => i.consume_type == 2) || []\n cList = cList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n pList = pList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n const resultList = cList.concat(pList)\n setRedeemableList(resultList)\n\n localStorage?.setItem(\n `consume_credit_rules-${locale}`,\n JSON.stringify({\n expire: Date.now() + 10 * 60 * 1000,\n consume_credit_rules: resultList,\n })\n )\n },\n }\n )\n }, [profile, trigger, locale])\n\n useEffect(() => {\n if (!isLoadingProfile) {\n getRedeemableList()\n }\n }, [getRedeemableList, isLoadingProfile])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
5
- "mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAwB,WACjC,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,GAAoB,CAC3B,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,CAAU,EAAIN,EAAkB,EAC7D,CAAE,OAAQO,EAAe,MAAOC,CAAc,EAAIP,EAAmB,EACrEQ,EAAQH,GAAaE,EAEvBD,IAAkB,KACpBJ,EAAS,KAETA,EAASI,EAGX,KAAM,CAACG,EAAgBC,CAAiB,EAAId,EAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYe,EAAa,QAAAC,CAAQ,EAAIf,EAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAW,EACA,KAAM,EACN,UAAW,IACX,SAAUV,EAAiB,IAAII,CAAM,GAAKA,IAAS,YAAY,CACjE,CACF,CAAC,EAEKW,EAAoBnB,EAAY,IAAM,CAC1CkB,EACE,CACE,QAAST,GAAS,OACpB,EACA,CACE,UAAUW,EAAc,CACtB,IAAIC,EAAOD,EAAa,KAAK,sBAAwB,CAAC,EAClDE,EAAQD,EAAK,OAAOE,GAAKA,EAAE,cAAgB,CAAC,GAAK,CAAC,EAClDC,EAAQH,EAAK,OAAOE,GAAKA,EAAE,cAAgB,CAAC,GAAK,CAAC,EACtDD,EAAQA,EAAM,KAAK,CAACG,EAAMC,IAASD,EAAK,gBAAkBC,EAAK,eAAe,EAC9EF,EAAQA,EAAM,KAAK,CAACC,EAAMC,IAASD,EAAK,gBAAkBC,EAAK,eAAe,EAC9E,MAAMC,EAAaL,EAAM,OAAOE,CAAK,EACrCR,EAAkBW,CAAU,EAE5B,cAAc,QACZ,wBAAwBnB,CAAM,GAC9B,KAAK,UAAU,CACb,OAAQ,KAAK,IAAI,EAAI,GAAK,GAAK,IAC/B,qBAAsBmB,CACxB,CAAC,CACH,CACF,CACF,CACF,CACF,EAAG,CAAClB,EAASS,EAASV,CAAM,CAAC,EAE7B,OAAAP,EAAU,IAAM,CACTS,GACHS,EAAkB,CAEtB,EAAG,CAACA,EAAmBT,CAAgB,CAAC,EAEjC,CACL,YAAAO,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOS,EAAQrB",
6
- "names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "cList", "i", "pList", "prev", "next", "resultList", "useRedeemableList_default"]
4
+ "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList(props?: { consumeType: AlpcConsumeType }) {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { consume_type?: AlpcConsumeType, user_id?: string}\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback((props?: { consumeType?: AlpcConsumeType}) => {\n trigger(\n {\n user_id: profile?.user_id,\n ...(props?.consumeType && {consume_type: props.consumeType})\n },\n {\n onSuccess(responseData) {\n console.log('responseData', responseData)\n let list = responseData.data.consume_credit_rules || []\n // let cList = list.filter(i => i.consume_type == 1) || []\n // let pList = list.filter(i => i.consume_type == 2) || []\n // cList = cList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n // pList = pList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n // const resultList = cList.concat(pList)\n setRedeemableList(list)\n },\n }\n )\n }, [profile, trigger, locale])\n\n useEffect(() => {\n if (!isLoadingProfile) {\n getRedeemableList({ consumeType: props?.consumeType })\n }\n }, [getRedeemableList, isLoadingProfile])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
5
+ "mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAyC,WAClD,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,CAAU,EAAIP,EAAkB,EAC7D,CAAE,OAAQQ,EAAe,MAAOC,CAAc,EAAIR,EAAmB,EACrES,EAAQH,GAAaE,EAEvBD,IAAkB,KACpBJ,EAAS,KAETA,EAASI,EAGX,KAAM,CAACG,EAAgBC,CAAiB,EAAIf,EAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYgB,EAAa,QAAAC,CAAQ,EAAIhB,EAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAY,EACA,KAAM,EACN,UAAW,IACX,SAAUX,EAAiB,IAAIK,CAAM,GAAKA,IAAS,YAAY,CACjE,CACF,CAAC,EAEKW,EAAoBpB,EAAaQ,GAA6C,CAClFW,EACE,CACE,QAAST,GAAS,QAClB,GAAIF,GAAO,aAAe,CAAC,aAAcA,EAAM,WAAW,CAC5D,EACA,CACE,UAAUa,EAAc,CACtB,QAAQ,IAAI,eAAgBA,CAAY,EACxC,IAAIC,EAAOD,EAAa,KAAK,sBAAwB,CAAC,EAMtDJ,EAAkBK,CAAI,CACxB,CACF,CACF,CACF,EAAG,CAACZ,EAASS,EAASV,CAAM,CAAC,EAE7B,OAAAR,EAAU,IAAM,CACTU,GACHS,EAAkB,CAAE,YAAaZ,GAAO,WAAY,CAAC,CAEzD,EAAG,CAACY,EAAmBT,CAAgB,CAAC,EAEjC,CACL,YAAAO,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOG,EAAQhB",
6
+ "names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "useRedeemableList_default"]
7
7
  }
@@ -35,8 +35,12 @@ type Context = {
35
35
  discountCodes?: string[];
36
36
  }) => void | Promise<any>;
37
37
  };
38
+ openMyRewardsModal: boolean;
39
+ setOpenMyRewardsModal: (open: boolean) => void;
40
+ openActivitiesModal: boolean;
41
+ setOpenActivitiesModal: (open: boolean) => void;
38
42
  };
39
43
  export declare const CreditsContext: import("react").Context<Context>;
40
- export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Context>): import("react/jsx-runtime").JSX.Element;
44
+ export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>): import("react/jsx-runtime").JSX.Element;
41
45
  export declare function useCreditsContext(): Context;
42
46
  export {};
@@ -1,2 +1,2 @@
1
- import{jsx as y}from"react/jsx-runtime";import{createContext as l,useContext as v}from"react";const o=l({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:"",pageHandle:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0,cartConfig:void 0});function _({children:e,profile:r,removeProfile:n,isLoadingProfile:t,openSignInPopup:i,openSignUpPopup:s,taskIdToTypeMapping:d,creditInfo:p,customer:a,customerLoading:g,fetchCreditInfo:u,gtm:C,pageCommon:m,memberPriceDiscount:f,alpcBrand:c,cartConfig:P}){return y(o.Provider,{value:{profile:r,isLoadingProfile:t,removeProfile:n,openSignInPopup:i,openSignUpPopup:s,taskIdToTypeMapping:d,creditInfo:p,fetchCreditInfo:u,customer:a,customerLoading:g,gtm:C,pageCommon:m,memberPriceDiscount:f,alpcBrand:c,cartConfig:P},children:e})}function A(){const e=v(o);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}export{o as CreditsContext,_ as CreditsProvider,A as useCreditsContext};
1
+ import{jsx as R}from"react/jsx-runtime";import{createContext as A,useContext as x,useState as o}from"react";const t=A({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:"",pageHandle:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0,cartConfig:void 0,openMyRewardsModal:!1,setOpenMyRewardsModal:()=>{},openActivitiesModal:!1,setOpenActivitiesModal:()=>{}});function _({children:e,profile:n,removeProfile:i,isLoadingProfile:r,openSignInPopup:s,openSignUpPopup:a,taskIdToTypeMapping:d,creditInfo:p,customer:l,customerLoading:c,fetchCreditInfo:f,gtm:u,pageCommon:g,memberPriceDiscount:m,alpcBrand:C,cartConfig:M}){const[v,P]=o(!1),[y,b]=o(!1);return R(t.Provider,{value:{profile:n,isLoadingProfile:r,removeProfile:i,openSignInPopup:s,openSignUpPopup:a,taskIdToTypeMapping:d,creditInfo:p,fetchCreditInfo:f,customer:l,customerLoading:c,gtm:u,pageCommon:g,memberPriceDiscount:m,alpcBrand:C,cartConfig:M,openMyRewardsModal:v,setOpenMyRewardsModal:P,openActivitiesModal:y,setOpenActivitiesModal:b},children:e})}function L(){const e=x(t);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}export{t as CreditsContext,_ as CreditsProvider,L as useCreditsContext};
2
2
  //# sourceMappingURL=provider.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/provider.tsx"],
4
- "sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\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 const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n}: PropsWithChildren<Context>) {\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
5
- "mappings": "AA4EI,cAAAA,MAAA,oBA5EJ,OAAS,iBAAAC,EAAkC,cAAAC,MAAkB,QAqCtD,MAAMC,EAAiBF,EAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBG,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,GACX,WAAY,EACd,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,OACX,WAAY,MACd,CAAC,EAEM,SAASC,EAAgB,CAC9B,SAAAC,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAA+B,CAC7B,OACErB,EAACG,EAAe,SAAf,CACC,MAAO,CACL,QAAAI,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAEC,SAAAf,EACH,CAEJ,CAEO,SAASgB,GAAoB,CAClC,MAAMC,EAAUrB,EAAWC,CAAc,EACzC,GAAI,CAACoB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
6
- "names": ["jsx", "createContext", "useContext", "CreditsContext", "user_id", "CreditsProvider", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "useCreditsContext", "context"]
4
+ "sourcesContent": ["import { createContext, PropsWithChildren, useContext, useState } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\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 openMyRewardsModal: boolean\n setOpenMyRewardsModal: (open: boolean) => void\n openActivitiesModal: boolean\n setOpenActivitiesModal: (open: boolean) => void\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n openMyRewardsModal: false,\n setOpenMyRewardsModal: () => {},\n openActivitiesModal: false,\n setOpenActivitiesModal: () => {},\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n}: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>) {\n const [openMyRewardsModal, setOpenMyRewardsModal] = useState(false)\n const [openActivitiesModal, setOpenActivitiesModal] = useState(false)\n\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n openMyRewardsModal,\n setOpenMyRewardsModal,\n openActivitiesModal,\n setOpenActivitiesModal,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
5
+ "mappings": "AAuFI,cAAAA,MAAA,oBAvFJ,OAAS,iBAAAC,EAAkC,cAAAC,EAAY,YAAAC,MAAgB,QAyChE,MAAMC,EAAiBH,EAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBI,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,GACX,WAAY,EACd,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,OACX,WAAY,OACZ,mBAAoB,GACpB,sBAAuB,IAAM,CAAC,EAC9B,oBAAqB,GACrB,uBAAwB,IAAM,CAAC,CACjC,CAAC,EAEM,SAASC,EAAgB,CAC9B,SAAAC,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAAwI,CACtI,KAAM,CAACC,EAAoBC,CAAqB,EAAIrB,EAAS,EAAK,EAC5D,CAACsB,EAAqBC,CAAsB,EAAIvB,EAAS,EAAK,EAEpE,OACEH,EAACI,EAAe,SAAf,CACC,MAAO,CACL,QAAAI,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,EACA,mBAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,uBAAAC,CACF,EAEC,SAAAnB,EACH,CAEJ,CAEO,SAASoB,GAAoB,CAClC,MAAMC,EAAU1B,EAAWE,CAAc,EACzC,GAAI,CAACwB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
6
+ "names": ["jsx", "createContext", "useContext", "useState", "CreditsContext", "user_id", "CreditsProvider", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "useCreditsContext", "context"]
7
7
  }
@@ -44,6 +44,7 @@ export interface RedeemLogResponse extends BaseResponse {
44
44
  approval_status: ApprovalStatus;
45
45
  rule_id: number;
46
46
  code_status: number;
47
+ link?: string;
47
48
  }
48
49
  export interface CreditTaskResponse extends Task {
49
50
  status: number;
@@ -0,0 +1 @@
1
+ export declare function atobID(id: string): string | undefined;
@@ -0,0 +1,2 @@
1
+ function e(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}export{e as atobID};
2
+ //# sourceMappingURL=atobID.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/atobID.ts"],
4
+ "sourcesContent": ["// \u4ECE Shopify GraphQL ID \u4E2D\u63D0\u53D6\u6570\u5B57 ID\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\n"],
5
+ "mappings": "AACO,SAASA,EAAOC,EAAY,CACjC,OAAIA,GAAM,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EAC1CA,EAAG,MAAM,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAEvCA,CAEX",
6
+ "names": ["atobID", "id"]
7
+ }
@@ -0,0 +1,5 @@
1
+ import { DiscountConfig } from '../memberPriceTypes';
2
+ export declare const functionDiscountCalculate: ({ config, price, }: {
3
+ config: DiscountConfig;
4
+ price: number;
5
+ }) => number;
@@ -0,0 +1,2 @@
1
+ import{FunctionDiscountType as c,RoundSelected as i}from"../memberPriceConst";import n from"decimal.js";const b=({config:t,price:o})=>{const{apply_price_ending:r,one_decimal_place:a,two_decimal_place:u,round_selected:s}=t.price_ending_conf||{};let e=new n(o);switch(t.discount_type){case c.Percentage:e=e.mul(100-t.discount_value).div(100);break;case c.FixedAmount:e=e.sub(t.discount_value);break;case c.FixedPrice:e=new n(t.discount_value);break;default:break}if(r){switch(s){case i.RoundHighest:e=e.ceil();break;case i.RoundLowest:e=e.floor();break;case i.RoundNearest:e=e.round();break;default:e=new n(e.toFixed(2,n.ROUND_DOWN));break}const d=e.toString().split(".");e=new n(d[0]+"."+a+u)}return e.toNumber()};export{b as functionDiscountCalculate};
2
+ //# sourceMappingURL=functionDiscountCalculate.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/functionDiscountCalculate.ts"],
4
+ "sourcesContent": ["import { FunctionDiscountType, RoundSelected } from '../memberPriceConst'\nimport { DiscountConfig } from '../memberPriceTypes'\nimport Decimal from 'decimal.js'\n\n// Function \u8BA1\u7B97\u6298\u540E\u4EF7\nexport const functionDiscountCalculate = ({\n config,\n price,\n}: {\n config: DiscountConfig\n price: number\n}) => {\n const { apply_price_ending, one_decimal_place, two_decimal_place, round_selected } =\n config.price_ending_conf || {}\n\n let salePrice = new Decimal(price)\n\n switch (config.discount_type) {\n // \u767E\u5206\u6BD4\u6298\u6263\n case FunctionDiscountType.Percentage:\n salePrice = salePrice.mul(100 - config.discount_value).div(100)\n break\n // \u56FA\u5B9A\u91D1\u989D\u6298\u6263\n case FunctionDiscountType.FixedAmount:\n salePrice = salePrice.sub(config.discount_value)\n break\n // \u56FA\u5B9A\u4EF7\u683C\u6298\u6263\n case FunctionDiscountType.FixedPrice:\n salePrice = new Decimal(config.discount_value)\n break\n default:\n break\n }\n\n if (apply_price_ending) {\n // \u5C0F\u6570\u4F4D\u53D6\u820D\n switch (round_selected) {\n case RoundSelected.RoundHighest:\n salePrice = salePrice.ceil()\n break\n case RoundSelected.RoundLowest:\n salePrice = salePrice.floor()\n break\n case RoundSelected.RoundNearest:\n salePrice = salePrice.round()\n break\n default:\n salePrice = new Decimal(salePrice.toFixed(2, Decimal.ROUND_DOWN))\n break\n }\n\n const priceEnding = salePrice.toString().split('.')\n salePrice = new Decimal(priceEnding[0] + '.' + one_decimal_place + two_decimal_place)\n }\n\n return salePrice.toNumber()\n}\n"],
5
+ "mappings": "AAAA,OAAS,wBAAAA,EAAsB,iBAAAC,MAAqB,sBAEpD,OAAOC,MAAa,aAGb,MAAMC,EAA4B,CAAC,CACxC,OAAAC,EACA,MAAAC,CACF,IAGM,CACJ,KAAM,CAAE,mBAAAC,EAAoB,kBAAAC,EAAmB,kBAAAC,EAAmB,eAAAC,CAAe,EAC/EL,EAAO,mBAAqB,CAAC,EAE/B,IAAIM,EAAY,IAAIR,EAAQG,CAAK,EAEjC,OAAQD,EAAO,cAAe,CAE5B,KAAKJ,EAAqB,WACxBU,EAAYA,EAAU,IAAI,IAAMN,EAAO,cAAc,EAAE,IAAI,GAAG,EAC9D,MAEF,KAAKJ,EAAqB,YACxBU,EAAYA,EAAU,IAAIN,EAAO,cAAc,EAC/C,MAEF,KAAKJ,EAAqB,WACxBU,EAAY,IAAIR,EAAQE,EAAO,cAAc,EAC7C,MACF,QACE,KACJ,CAEA,GAAIE,EAAoB,CAEtB,OAAQG,EAAgB,CACtB,KAAKR,EAAc,aACjBS,EAAYA,EAAU,KAAK,EAC3B,MACF,KAAKT,EAAc,YACjBS,EAAYA,EAAU,MAAM,EAC5B,MACF,KAAKT,EAAc,aACjBS,EAAYA,EAAU,MAAM,EAC5B,MACF,QACEA,EAAY,IAAIR,EAAQQ,EAAU,QAAQ,EAAGR,EAAQ,UAAU,CAAC,EAChE,KACJ,CAEA,MAAMS,EAAcD,EAAU,SAAS,EAAE,MAAM,GAAG,EAClDA,EAAY,IAAIR,EAAQS,EAAY,CAAC,EAAI,IAAMJ,EAAoBC,CAAiB,CACtF,CAEA,OAAOE,EAAU,SAAS,CAC5B",
6
+ "names": ["FunctionDiscountType", "RoundSelected", "Decimal", "functionDiscountCalculate", "config", "price", "apply_price_ending", "one_decimal_place", "two_decimal_place", "round_selected", "salePrice", "priceEnding"]
7
+ }
@@ -0,0 +1,8 @@
1
+ import { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes';
2
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
3
+ export declare const getFunctionMemberPrice: ({ memberPriceDiscount, currencyCode, variant, locale, }: {
4
+ memberPriceDiscount?: FunctionMemberPriceConfig[];
5
+ currencyCode?: string;
6
+ variant?: NormalizedProductVariant;
7
+ locale: string;
8
+ }) => false | FunctionMemberPriceResult;
@@ -0,0 +1,2 @@
1
+ import{formatPrice as t}from"../utils";import{functionDiscountCalculate as b}from"./functionDiscountCalculate";import n from"decimal.js";import{getFunctionMemberPriceDiscountConfig as D}from"./getFunctionMemberPriceDiscountConfig";import d from"./variantGetCoupon";const R=({memberPriceDiscount:g,currencyCode:r,variant:e,locale:i})=>{const m=d({variant:e}),{memberPriceDiscountConfig:c,activeMemberPriceConfig:y}=D({config:g,variant:e}),s=!!y?.discount_combinations.other_product_discounts;if(!c)return!1;const u={amount:e?.price.amount||0,priceWithCurrency:t({amount:e?.price.amount||0,currencyCode:r||"USD",locale:i})},o=c?b({config:c,price:e?.price.amount||0}):e?.price.amount||0,a={amount:o,priceWithCurrency:t({amount:o,currencyCode:r||"USD",locale:i})};let p=o;if(m?.variant_price4wscode&&e&&s)if(s){const P=new n(e.price.amount).minus(m.variant_price4wscode);p=new n(o).minus(P).toNumber()}else{const P=new n(e.price.amount).minus(m.variant_price4wscode);if(o>P.toNumber())return!1}const C={amount:p,priceWithCurrency:t({amount:p,currencyCode:r||"USD",locale:i})},h=new n(u.amount).minus(C.amount).toNumber(),f={amount:h,priceWithCurrency:t({amount:h,currencyCode:r||"USD",locale:i,maximumFractionDigits:2})},W=new n(u.amount).minus(a.amount).toNumber(),l={amount:W,priceWithCurrency:t({amount:W,currencyCode:r||"USD",locale:i,maximumFractionDigits:2})};return{hasMemberPrice:!!c,useCoupon:s,originalPrice:u.amount,originalPriceWithCurrency:u.priceWithCurrency,salePrice:C.amount,salePriceWithCurrency:C.priceWithCurrency,salePriceWithoutCoupon:a.amount,salePriceWithoutCouponWithCurrency:a.priceWithCurrency,savePrice:f.amount,savePriceWithCurrency:f.priceWithCurrency,savePriceWithoutCoupon:l.amount,savePriceWithoutCouponWithCurrency:l.priceWithCurrency}};export{R as getFunctionMemberPrice};
2
+ //# sourceMappingURL=getFunctionMemberPrice.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPrice.ts"],
4
+ "sourcesContent": ["import { formatPrice } from '../utils'\nimport { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { functionDiscountCalculate } from './functionDiscountCalculate'\nimport Decimal from 'decimal.js'\nimport { getFunctionMemberPriceDiscountConfig } from './getFunctionMemberPriceDiscountConfig'\nimport variantGetCoupon from './variantGetCoupon'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const getFunctionMemberPrice = ({\n memberPriceDiscount,\n currencyCode,\n variant,\n locale,\n}: {\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n currencyCode?: string\n variant?: NormalizedProductVariant\n locale: string\n}) => {\n const couponData = variantGetCoupon({ variant })\n\n // variant\u5BF9\u5E94\u7684\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\n const { memberPriceDiscountConfig, activeMemberPriceConfig } = getFunctionMemberPriceDiscountConfig({\n config: memberPriceDiscount,\n variant,\n })\n\n const useCoupon = !!activeMemberPriceConfig?.discount_combinations.other_product_discounts\n\n if (!memberPriceDiscountConfig) {\n return false as false\n }\n\n const originalPrice = {\n amount: variant?.price.amount || 0,\n priceWithCurrency: formatPrice({\n amount: variant?.price.amount || 0,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const salePriceWithoutCouponAmount = memberPriceDiscountConfig\n ? functionDiscountCalculate({\n config: memberPriceDiscountConfig,\n price: variant?.price.amount || 0,\n })\n : variant?.price.amount || 0\n const salePriceWithoutCoupon = {\n amount: salePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n // function \u4F1A\u5458\u4EF7\u662F\u5728\u539F\u4EF7\u7684\u57FA\u7840\u4E0A\u8FDB\u884C\u8BA1\u7B97\uFF0C\u6682\u4E0D\u652F\u6301\u6298\u540E\u4EF7\n let salePriceAmount = salePriceWithoutCouponAmount\n\n // \u51CF\u53BBcode\u7684\u4F18\u60E0\n if (couponData?.variant_price4wscode && variant && useCoupon) {\n if (useCoupon) {\n // code\u7684\u4F18\u60E0\u91D1\u989D\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n salePriceAmount = new Decimal(salePriceWithoutCouponAmount).minus(codeSaveAmountDecimal).toNumber()\n } else {\n // \u4E0D\u80FD\u4E0E code \u540C\u65F6\u4F7F\u7528\uFF0C\u9700\u8981\u5224\u65AD\u4F1A\u5458\u4EF7\u662F\u5426\u5C0F\u4E8E code \u7684\u4F18\u60E0\u91D1\u989D\uFF0C\u5982\u679C\u5C0F\u4E8E\u5219\u5F53\u505A\u6CA1\u6709\u4F1A\u5458\u4EF7\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n if (salePriceWithoutCouponAmount > codeSaveAmountDecimal.toNumber()) {\n return false as false\n }\n }\n }\n\n const salePrice = {\n amount: salePriceAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const savePriceAmount = new Decimal(originalPrice.amount).minus(salePrice.amount).toNumber()\n const savePrice = {\n amount: savePriceAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const savePriceWithoutCouponAmount = new Decimal(originalPrice.amount)\n .minus(salePriceWithoutCoupon.amount)\n .toNumber()\n const savePriceWithoutCoupon = {\n amount: savePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const result: FunctionMemberPriceResult = {\n // \u662F\u5426\u5B58\u5728\u4F1A\u5458\u4EF7\n hasMemberPrice: !!memberPriceDiscountConfig,\n useCoupon,\n // \u539F\u4EF7\n originalPrice: originalPrice.amount,\n originalPriceWithCurrency: originalPrice.priceWithCurrency as string,\n // \u4F7F\u7528\u5238\u540E\u7684\u6298\u540E\u4EF7\n salePrice: salePrice.amount,\n salePriceWithCurrency: salePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u6298\u540E\u4EF7\n salePriceWithoutCoupon: salePriceWithoutCoupon.amount,\n salePriceWithoutCouponWithCurrency: salePriceWithoutCoupon.priceWithCurrency as string,\n\n // \u5305\u542B\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePrice: savePrice.amount,\n savePriceWithCurrency: savePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePriceWithoutCoupon: savePriceWithoutCoupon.amount,\n savePriceWithoutCouponWithCurrency: savePriceWithoutCoupon.priceWithCurrency as string,\n }\n\n return result\n}\n"],
5
+ "mappings": "AAAA,OAAS,eAAAA,MAAmB,WAG5B,OAAS,6BAAAC,MAAiC,8BAC1C,OAAOC,MAAa,aACpB,OAAS,wCAAAC,MAA4C,yCACrD,OAAOC,MAAsB,qBAGtB,MAAMC,EAAyB,CAAC,CACrC,oBAAAC,EACA,aAAAC,EACA,QAAAC,EACA,OAAAC,CACF,IAKM,CACJ,MAAMC,EAAaN,EAAiB,CAAE,QAAAI,CAAQ,CAAC,EAGzC,CAAE,0BAAAG,EAA2B,wBAAAC,CAAwB,EAAIT,EAAqC,CAClG,OAAQG,EACR,QAAAE,CACF,CAAC,EAEKK,EAAY,CAAC,CAACD,GAAyB,sBAAsB,wBAEnE,GAAI,CAACD,EACH,MAAO,GAGT,MAAMG,EAAgB,CACpB,OAAQN,GAAS,MAAM,QAAU,EACjC,kBAAmBR,EAAY,CAC7B,OAAQQ,GAAS,MAAM,QAAU,EACjC,aAAcD,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMM,EAA+BJ,EACjCV,EAA0B,CACxB,OAAQU,EACR,MAAOH,GAAS,MAAM,QAAU,CAClC,CAAC,EACDA,GAAS,MAAM,QAAU,EACvBQ,EAAyB,CAC7B,OAAQD,EACR,kBAAmBf,EAAY,CAC7B,OAAQe,EACR,aAAcR,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAGA,IAAIQ,EAAkBF,EAGtB,GAAIL,GAAY,sBAAwBF,GAAWK,EACjD,GAAIA,EAAW,CAEb,MAAMK,EAAwB,IAAIhB,EAAQM,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrGO,EAAkB,IAAIf,EAAQa,CAA4B,EAAE,MAAMG,CAAqB,EAAE,SAAS,CACpG,KAAO,CAEL,MAAMA,EAAwB,IAAIhB,EAAQM,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrG,GAAIK,EAA+BG,EAAsB,SAAS,EAChE,MAAO,EAEX,CAGF,MAAMC,EAAY,CAChB,OAAQF,EACR,kBAAmBjB,EAAY,CAC7B,OAAQiB,EACR,aAAcV,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMW,EAAkB,IAAIlB,EAAQY,EAAc,MAAM,EAAE,MAAMK,EAAU,MAAM,EAAE,SAAS,EACrFE,EAAY,CAChB,OAAQD,EACR,kBAAmBpB,EAAY,CAC7B,OAAQoB,EACR,aAAcb,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EAEMa,EAA+B,IAAIpB,EAAQY,EAAc,MAAM,EAClE,MAAME,EAAuB,MAAM,EACnC,SAAS,EACNO,EAAyB,CAC7B,OAAQD,EACR,kBAAmBtB,EAAY,CAC7B,OAAQsB,EACR,aAAcf,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EA0BA,MAxB0C,CAExC,eAAgB,CAAC,CAACE,EAClB,UAAAE,EAEA,cAAeC,EAAc,OAC7B,0BAA2BA,EAAc,kBAEzC,UAAWK,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBH,EAAuB,OAC/C,mCAAoCA,EAAuB,kBAG3D,UAAWK,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBE,EAAuB,OAC/C,mCAAoCA,EAAuB,iBAC7D,CAGF",
6
+ "names": ["formatPrice", "functionDiscountCalculate", "Decimal", "getFunctionMemberPriceDiscountConfig", "variantGetCoupon", "getFunctionMemberPrice", "memberPriceDiscount", "currencyCode", "variant", "locale", "couponData", "memberPriceDiscountConfig", "activeMemberPriceConfig", "useCoupon", "originalPrice", "salePriceWithoutCouponAmount", "salePriceWithoutCoupon", "salePriceAmount", "codeSaveAmountDecimal", "salePrice", "savePriceAmount", "savePrice", "savePriceWithoutCouponAmount", "savePriceWithoutCoupon"]
7
+ }
@@ -0,0 +1,9 @@
1
+ import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes';
2
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
3
+ export declare const getFunctionMemberPriceDiscountConfig: ({ config, variant, }: {
4
+ config?: FunctionMemberPriceConfig[];
5
+ variant?: NormalizedProductVariant;
6
+ }) => {
7
+ memberPriceDiscountConfig: DiscountConfig | undefined;
8
+ activeMemberPriceConfig: FunctionMemberPriceConfig | undefined;
9
+ };
@@ -0,0 +1,2 @@
1
+ import{atobID as f}from"./atobID";const b=({config:e,variant:o})=>{let i,r;if(!e||!o)return{memberPriceDiscountConfig:i,activeMemberPriceConfig:r};for(const t of e)if(i=t.result_detail.member_discounts?.find(n=>n.main_products.all_store_variant?n:n.main_products.variants.find(c=>String(c.variant_id)===f(o.id)))?.discount_conf,i){r=t;break}return i?{memberPriceDiscountConfig:i,activeMemberPriceConfig:r}:{memberPriceDiscountConfig:i,activeMemberPriceConfig:r}};export{b as getFunctionMemberPriceDiscountConfig};
2
+ //# sourceMappingURL=getFunctionMemberPriceDiscountConfig.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts"],
4
+ "sourcesContent": ["import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes'\nimport { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { atobID } from './atobID'\n\n// \u83B7\u53D6\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\nexport const getFunctionMemberPriceDiscountConfig = ({\n config,\n variant,\n}: {\n config?: FunctionMemberPriceConfig[]\n variant?: NormalizedProductVariant\n}) => {\n let memberPriceDiscountConfig: DiscountConfig | undefined\n let activeMemberPriceConfig: FunctionMemberPriceConfig | undefined\n\n if (!config || !variant) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n for (const configItem of config) {\n memberPriceDiscountConfig = configItem.result_detail.member_discounts?.find(discountItem => {\n if (discountItem.main_products.all_store_variant) {\n return discountItem\n }\n\n return discountItem.main_products.variants.find(\n variantConfig => String(variantConfig.variant_id) === atobID(variant.id as string)\n )\n })?.discount_conf\n\n if (memberPriceDiscountConfig) {\n activeMemberPriceConfig = configItem\n break\n }\n }\n\n if (!memberPriceDiscountConfig) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n}\n"],
5
+ "mappings": "AAEA,OAAS,UAAAA,MAAc,WAGhB,MAAMC,EAAuC,CAAC,CACnD,OAAAC,EACA,QAAAC,CACF,IAGM,CACJ,IAAIC,EACAC,EAEJ,GAAI,CAACH,GAAU,CAACC,EACd,MAAO,CACL,0BAAAC,EACA,wBAAAC,CACF,EAGF,UAAWC,KAAcJ,EAWvB,GAVAE,EAA4BE,EAAW,cAAc,kBAAkB,KAAKC,GACtEA,EAAa,cAAc,kBACtBA,EAGFA,EAAa,cAAc,SAAS,KACzCC,GAAiB,OAAOA,EAAc,UAAU,IAAMR,EAAOG,EAAQ,EAAY,CACnF,CACD,GAAG,cAEAC,EAA2B,CAC7BC,EAA0BC,EAC1B,KACF,CAGF,OAAKF,EAOE,CACL,0BAAAA,EACA,wBAAAC,CACF,EATS,CACL,0BAAAD,EACA,wBAAAC,CACF,CAOJ",
6
+ "names": ["atobID", "getFunctionMemberPriceDiscountConfig", "config", "variant", "memberPriceDiscountConfig", "activeMemberPriceConfig", "configItem", "discountItem", "variantConfig"]
7
+ }
@@ -0,0 +1,6 @@
1
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
2
+ declare const variantGetCoupon: ({ variant, channel, }: {
3
+ variant?: NormalizedProductVariant;
4
+ channel?: string;
5
+ }) => any;
6
+ export default variantGetCoupon;
@@ -0,0 +1,2 @@
1
+ import{atobID as n}from"./atobID";const r=({variant:e,channel:i=""})=>{if(!e)return;const s="wsch";return(e?.metafields?.discountCodeApp||[])?.filter(t=>{const a=n(e.id);return(!t?.ends_at||new Date(t?.ends_at).getTime()>new Date().getTime())&&new Date(t?.starts_at).getTime()<=new Date().getTime()&&t.variant_shopify_id===+(a||"")&&(i?t?.title?.toLocaleLowerCase().includes(i):!t?.title?.toLocaleLowerCase().includes(s))})?.[0]};var f=r;export{f as default};
2
+ //# sourceMappingURL=variantGetCoupon.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/variantGetCoupon.ts"],
4
+ "sourcesContent": ["import { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { atobID } from './atobID'\n\nconst variantGetCoupon = ({\n variant,\n channel = '',\n}: {\n variant?: NormalizedProductVariant\n channel?: string\n}) => {\n if (!variant) return undefined\n\n const hideChannel = 'wsch'\n const discountCodeApp = variant?.metafields?.discountCodeApp || []\n\n const results = discountCodeApp?.filter((coupon: any) => {\n const variantId = atobID(variant.id as string)\n const isActive =\n (!coupon?.ends_at || new Date(coupon?.ends_at).getTime() > new Date().getTime()) &&\n new Date(coupon?.starts_at).getTime() <= new Date().getTime() &&\n coupon.variant_shopify_id === +(variantId || '')\n\n return (\n isActive &&\n (channel\n ? coupon?.title?.toLocaleLowerCase().includes(channel)\n : !coupon?.title?.toLocaleLowerCase().includes(hideChannel))\n )\n })\n\n return results?.[0]\n}\n\nexport default variantGetCoupon\n"],
5
+ "mappings": "AACA,OAAS,UAAAA,MAAc,WAEvB,MAAMC,EAAmB,CAAC,CACxB,QAAAC,EACA,QAAAC,EAAU,EACZ,IAGM,CACJ,GAAI,CAACD,EAAS,OAEd,MAAME,EAAc,OAkBpB,OAjBwBF,GAAS,YAAY,iBAAmB,CAAC,IAEhC,OAAQG,GAAgB,CACvD,MAAMC,EAAYN,EAAOE,EAAQ,EAAY,EAM7C,OAJG,CAACG,GAAQ,SAAW,IAAI,KAAKA,GAAQ,OAAO,EAAE,QAAQ,EAAI,IAAI,KAAK,EAAE,QAAQ,IAC9E,IAAI,KAAKA,GAAQ,SAAS,EAAE,QAAQ,GAAK,IAAI,KAAK,EAAE,QAAQ,GAC5DA,EAAO,qBAAuB,EAAEC,GAAa,MAI5CH,EACGE,GAAQ,OAAO,kBAAkB,EAAE,SAASF,CAAO,EACnD,CAACE,GAAQ,OAAO,kBAAkB,EAAE,SAASD,CAAW,EAEhE,CAAC,IAEgB,CAAC,CACpB,EAEA,IAAOG,EAAQN",
6
+ "names": ["atobID", "variantGetCoupon", "variant", "channel", "hideChannel", "coupon", "variantId", "variantGetCoupon_default"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{Fragment as R,jsx as e,jsxs as l}from"react/jsx-runtime";import{Button as w,Container as j,Heading as I,Picture as y,Text as z}from"@anker-in/headless-ui";import{ChevronDownIcon as E,ChevronUpIcon as _}from"@heroicons/react/24/outline";import{useMemo as H,useState as r,useEffect as q}from"react";import{TaskType as h}from"./type";import{useActions as V}from"../creditsWaysToGetCredits/useActions";import{useCreditsContext as G}from"../context/provider";import{classNames as g,useHeadlessContext as J}from"@anker-in/lib";import{useRegistration as K}from"../../registration";import{CreditsUploadReceiptModal as Q}from"../modal/creditsUploadReceiptModal";import{CreditsSubscribeModal as W}from"../modal/subscribeModal";import{ROUNDED_BRANDS as X}from"../../../constants";const ce=({copy:s,classNames:Y,id:p})=>{const[n,v]=r(!1),{profile:T}=G(),{authCodeActivate:M}=K(),{brand:A}=J(),u=X.includes(A),x=!!T,[L,k]=r(!1),[U,m]=r(!1),[C,O]=r(!1),[F,B]=r(!1),{actions:f}=V({copy:s,subscribe:{openSubscribePopup:()=>m(!0),isSuccess:C},uploadReceipt:{openUploadReceiptPopup:()=>k(!0),isSuccess:F}}),o=(s?.list||[]).length>3;q(()=>{if(!n&&o&&window.screen.width<768){const t=setTimeout(()=>{const i=document.getElementById(p||"ankersolix-task");i&&i.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(t)}},[n,o,p]);const D=H(()=>{const t=s.list.map(i=>{if(!f[i.id])return;const{finished:a,notLogin:N,notFinished:b,completed:P}=f[i.id];let d="",c,S;return x?a?(d=P.buttonLabel,c=void 0):(d=b.buttonLabel,c=b.handleClick,S=b.link):(d=N.buttonLabel,c=N.handleClick),{...i,buttonLabel:d,handleClick:c,finished:a,link:S}}).filter(Boolean);return x?t.sort((i,a)=>i?.finished&&!a?.finished?1:!i?.finished&&a?.finished?-1:0):t},[f,s.list,x]);return l(j,{id:p,className:"bg-[#F5F5F7]",children:[e(I,{as:"h2",size:"4",html:s.title}),l("div",{className:g("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",u?"rounded-[8px]":"",!u&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[e("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),l("div",{className:"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[l("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[e(I,{as:"h3",size:4,html:s?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),e("div",{className:"flex items-center gap-[8px]",children:e("p",{className:"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:s.equalCredits}})})]}),s.mainImage?.url&&e(y,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:s.mainImage.url})]}),l("div",{className:"relative mt-[24px]",children:[l("div",{className:g("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out"),style:{height:n||!o?"auto":"512px"},children:[D.map(t=>l("div",{className:g("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]",u?"rounded-[16px]":""),children:[l("div",{children:[e(z,{as:"p",html:t.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),l("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[e(y,{className:"size-[24px] xxl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),e(z,{as:"p",html:t.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),t.handleClick&&!(t.id===h.UploadReceipt&&F)&&!(t.id===h.Activate&&M.isActivateSuccess)&&!(t.id===h.Subscribe&&C)?e(w,{as:t.link?"a":"button",...t.link&&{href:t.link},...t.handleClick&&{onClick:t.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:t.buttonLabel}):e(w,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:t.buttonLabel})]},t.id)),!n&&o&&e("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),o&&e(R,{children:n?e("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{v(!1)},children:e(_,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):e(R,{children:e("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:e("button",{className:"w-fit",onClick:()=>v(!n),children:e(E,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),s.receipt&&e(Q,{isOpen:L,onClose:()=>{k(!1)},copy:s.receipt,onSuccess:()=>{B(!0)}}),s.subscribe&&e(W,{copy:s.subscribe,onSuccess:()=>{O(!0),setTimeout(()=>{m(!1)},3e3)},isOpen:U,onClose:()=>{m(!1)}})]})};export{ce as CreditsAnkersolixTask};
1
+ import{Fragment as R,jsx as e,jsxs as l}from"react/jsx-runtime";import{Button as w,Container as j,Heading as I,Picture as y,Text as z}from"@anker-in/headless-ui";import{ChevronDownIcon as E,ChevronUpIcon as _}from"@heroicons/react/24/outline";import{useMemo as H,useState as r,useEffect as q}from"react";import{TaskType as h}from"./type";import{useActions as V}from"../creditsWaysToGetCredits/useActions";import{useCreditsContext as G}from"../context/provider";import{classNames as g,useHeadlessContext as J}from"@anker-in/lib";import{useRegistration as K}from"../../registration";import{CreditsUploadReceiptModal as Q}from"../modal/CreditsUploadReceiptModal";import{CreditsSubscribeModal as W}from"../modal/SubscribeModal";import{ROUNDED_BRANDS as X}from"../../../constants";const ce=({copy:s,classNames:Y,id:p})=>{const[n,v]=r(!1),{profile:T}=G(),{authCodeActivate:M}=K(),{brand:A}=J(),u=X.includes(A),x=!!T,[L,k]=r(!1),[U,m]=r(!1),[C,O]=r(!1),[F,B]=r(!1),{actions:f}=V({copy:s,subscribe:{openSubscribePopup:()=>m(!0),isSuccess:C},uploadReceipt:{openUploadReceiptPopup:()=>k(!0),isSuccess:F}}),o=(s?.list||[]).length>3;q(()=>{if(!n&&o&&window.screen.width<768){const t=setTimeout(()=>{const i=document.getElementById(p||"ankersolix-task");i&&i.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(t)}},[n,o,p]);const D=H(()=>{const t=s.list.map(i=>{if(!f[i.id])return;const{finished:a,notLogin:N,notFinished:b,completed:P}=f[i.id];let d="",c,S;return x?a?(d=P.buttonLabel,c=void 0):(d=b.buttonLabel,c=b.handleClick,S=b.link):(d=N.buttonLabel,c=N.handleClick),{...i,buttonLabel:d,handleClick:c,finished:a,link:S}}).filter(Boolean);return x?t.sort((i,a)=>i?.finished&&!a?.finished?1:!i?.finished&&a?.finished?-1:0):t},[f,s.list,x]);return l(j,{id:p,className:"bg-[#F5F5F7]",children:[e(I,{as:"h2",size:"4",html:s.title}),l("div",{className:g("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",u?"rounded-[8px]":"",!u&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[e("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),l("div",{className:"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[l("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[e(I,{as:"h3",size:4,html:s?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),e("div",{className:"flex items-center gap-[8px]",children:e("p",{className:"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:s.equalCredits}})})]}),s.mainImage?.url&&e(y,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:s.mainImage.url})]}),l("div",{className:"relative mt-[24px]",children:[l("div",{className:g("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out"),style:{height:n||!o?"auto":"512px"},children:[D.map(t=>l("div",{className:g("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]",u?"rounded-[16px]":""),children:[l("div",{children:[e(z,{as:"p",html:t.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),l("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[e(y,{className:"size-[24px] xxl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),e(z,{as:"p",html:t.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),t.handleClick&&!(t.id===h.UploadReceipt&&F)&&!(t.id===h.Activate&&M.isActivateSuccess)&&!(t.id===h.Subscribe&&C)?e(w,{as:t.link?"a":"button",...t.link&&{href:t.link},...t.handleClick&&{onClick:t.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:t.buttonLabel}):e(w,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:t.buttonLabel})]},t.id)),!n&&o&&e("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),o&&e(R,{children:n?e("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{v(!1)},children:e(_,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):e(R,{children:e("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:e("button",{className:"w-fit",onClick:()=>v(!n),children:e(E,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),s.receipt&&e(Q,{isOpen:L,onClose:()=>{k(!1)},copy:s.receipt,onSuccess:()=>{B(!0)}}),s.subscribe&&e(W,{copy:s.subscribe,onSuccess:()=>{O(!0),setTimeout(()=>{m(!1)},3e3)},isOpen:U,onClose:()=>{m(!1)}})]})};export{ce as CreditsAnkersolixTask};
2
2
  //# sourceMappingURL=CreditsAnkersolixTask.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx"],
4
- "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { useMemo, useState, useRef, useEffect } from 'react'\n\nimport { TaskType, type CreditsAnkersolixTaskProps } from './type'\nimport { useActions } from '../creditsWaysToGetCredits/useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsAnkersolixTask = ({ copy, classNames, id }: CreditsAnkersolixTaskProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n\n const shouldShowMask = (copy?.list || []).length > 3\n\n // Handle scroll after collapse animation\n useEffect(() => {\n if (!showMore && shouldShowMask && window.screen.width < 768) {\n const timer = setTimeout(() => {\n const section = document.getElementById(id || 'ankersolix-task')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }, 300) // Match transition duration\n return () => clearTimeout(timer)\n }\n }, [showMore, shouldShowMask, id])\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id={id} className=\"bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div\n className={cn(\n 'mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden',\n rounded ? 'rounded-[8px]' : '',\n !rounded && 'l:rounded-none'\n )}\n style={{\n background: 'linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)',\n }}\n >\n {/* \u5F84\u5411\u6E10\u53D8\u80CC\u666F\u5C42 - \u4F7F\u7528\u4F2A\u5143\u7D20\u6A21\u62DF */}\n <div\n className=\"absolute inset-0 pointer-events-none -z-10\"\n style={{\n background: 'radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)',\n }}\n />\n {/* \u526F\u6807\u9898\u548C\u88C5\u9970\u56FE\u90E8\u5206 */}\n <div className=\"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start\">\n <div className=\"flex flex-col gap-[8px] l:mt-[8px]\">\n <Heading\n as=\"h3\"\n size={4}\n html={copy?.subtitle}\n className=\"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]\"\n />\n <div className=\"flex items-center gap-[8px]\">\n <p\n className=\"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]\"\n dangerouslySetInnerHTML={{ __html: copy.equalCredits }}\n />\n </div>\n </div>\n {copy.mainImage?.url && (\n <Picture\n className=\"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]\"\n imgClassName=\"!h-full !object-contain\"\n source={copy.mainImage.url}\n />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative mt-[24px]\">\n <div\n className={cn(\n 'grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out'\n )}\n style={{\n height: showMore || !shouldShowMask ? 'auto' : '512px',\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]',\n rounded ? 'rounded-[16px]' : ''\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xxl:text-[20px]\"\n />\n <div className=\"mt-[8px] l:mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xxl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && shouldShowMask && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)' }}\n ></div>\n )}\n </div>\n {shouldShowMask && (\n <>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
4
+ "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { useMemo, useState, useRef, useEffect } from 'react'\n\nimport { TaskType, type CreditsAnkersolixTaskProps } from './type'\nimport { useActions } from '../creditsWaysToGetCredits/useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/CreditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/SubscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsAnkersolixTask = ({ copy, classNames, id }: CreditsAnkersolixTaskProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n\n const shouldShowMask = (copy?.list || []).length > 3\n\n // Handle scroll after collapse animation\n useEffect(() => {\n if (!showMore && shouldShowMask && window.screen.width < 768) {\n const timer = setTimeout(() => {\n const section = document.getElementById(id || 'ankersolix-task')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }, 300) // Match transition duration\n return () => clearTimeout(timer)\n }\n }, [showMore, shouldShowMask, id])\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id={id} className=\"bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div\n className={cn(\n 'mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden',\n rounded ? 'rounded-[8px]' : '',\n !rounded && 'l:rounded-none'\n )}\n style={{\n background: 'linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)',\n }}\n >\n {/* \u5F84\u5411\u6E10\u53D8\u80CC\u666F\u5C42 - \u4F7F\u7528\u4F2A\u5143\u7D20\u6A21\u62DF */}\n <div\n className=\"absolute inset-0 pointer-events-none -z-10\"\n style={{\n background: 'radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)',\n }}\n />\n {/* \u526F\u6807\u9898\u548C\u88C5\u9970\u56FE\u90E8\u5206 */}\n <div className=\"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start\">\n <div className=\"flex flex-col gap-[8px] l:mt-[8px]\">\n <Heading\n as=\"h3\"\n size={4}\n html={copy?.subtitle}\n className=\"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]\"\n />\n <div className=\"flex items-center gap-[8px]\">\n <p\n className=\"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]\"\n dangerouslySetInnerHTML={{ __html: copy.equalCredits }}\n />\n </div>\n </div>\n {copy.mainImage?.url && (\n <Picture\n className=\"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]\"\n imgClassName=\"!h-full !object-contain\"\n source={copy.mainImage.url}\n />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative mt-[24px]\">\n <div\n className={cn(\n 'grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out'\n )}\n style={{\n height: showMore || !shouldShowMask ? 'auto' : '512px',\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]',\n rounded ? 'rounded-[16px]' : ''\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xxl:text-[20px]\"\n />\n <div className=\"mt-[8px] l:mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xxl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && shouldShowMask && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)' }}\n ></div>\n )}\n </div>\n {shouldShowMask && (\n <>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
5
5
  "mappings": "AA6GM,OA0HU,YAAAA,EA1HV,OAAAC,EAoBI,QAAAC,MApBJ,oBA7GN,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,8BAC/C,OAAS,WAAAC,EAAS,YAAAC,EAAkB,aAAAC,MAAiB,QAErD,OAAS,YAAAC,MAAiD,SAC1D,OAAS,cAAAC,MAAkB,wCAC3B,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,OAAS,mBAAAC,MAAuB,qBAChC,OAAS,6BAAAC,MAAiC,qCAC1C,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,kBAAAC,MAAsB,qBAExB,MAAMC,GAAwB,CAAC,CAAE,KAAAC,EAAM,WAAAC,EAAY,GAAAC,CAAG,IAAoD,CAC/G,KAAM,CAACC,EAAUC,CAAW,EAAIhB,EAAS,EAAK,EACxC,CAAE,QAAAiB,CAAQ,EAAIb,EAAkB,EAChC,CAAE,iBAAAc,CAAiB,EAAIX,EAAgB,EACvC,CAAE,MAAAY,CAAM,EAAIb,EAAmB,EAC/Bc,EAAUV,EAAe,SAASS,CAAK,EACvCE,EAAU,CAAC,CAACJ,EAEZ,CAACK,EAA0BC,CAA2B,EAAIvB,EAAS,EAAK,EACxE,CAACwB,EAAsBC,CAAuB,EAAIzB,EAAS,EAAK,EAChE,CAAC0B,EAAoBC,CAAqB,EAAI3B,EAAS,EAAK,EAC5D,CAAC4B,EAAwBC,CAAyB,EAAI7B,EAAS,EAAK,EAEpE,CAAE,QAAA8B,CAAQ,EAAI3B,EAAW,CAC7B,KAAAS,EACA,UAAW,CACT,mBAAoB,IAAMa,EAAwB,EAAI,EACtD,UAAWC,CACb,EACA,cAAe,CACb,uBAAwB,IAAMH,EAA4B,EAAI,EAC9D,UAAWK,CACb,CACF,CAAC,EAEKG,GAAkBnB,GAAM,MAAQ,CAAC,GAAG,OAAS,EAGnDX,EAAU,IAAM,CACd,GAAI,CAACc,GAAYgB,GAAkB,OAAO,OAAO,MAAQ,IAAK,CAC5D,MAAMC,EAAQ,WAAW,IAAM,CAC7B,MAAMC,EAAU,SAAS,eAAenB,GAAM,iBAAiB,EAC3DmB,GACFA,EAAQ,eAAe,CAAE,SAAU,SAAU,MAAO,KAAM,CAAC,CAE/D,EAAG,GAAG,EACN,MAAO,IAAM,aAAaD,CAAK,CACjC,CACF,EAAG,CAACjB,EAAUgB,EAAgBjB,CAAE,CAAC,EACjC,MAAMoB,EAAOnC,EAAQ,IAAM,CACzB,MAAMmC,EAAOtB,EAAK,KACf,IAAIuB,GAAQ,CACX,GAAI,CAACL,EAAQK,EAAK,EAA0B,EAC1C,OAEF,KAAM,CAAE,SAAAC,EAAU,SAAAC,EAAU,YAAAC,EAAa,UAAAC,CAAU,EAAIT,EAAQK,EAAK,EAA0B,EAC9F,IAAIK,EAAc,GACdC,EACAC,EACJ,OAAKrB,EAGMe,GACTI,EAAcD,EAAU,YACxBE,EAAc,SAEdD,EAAcF,EAAY,YAC1BG,EAAcH,EAAY,YAC1BI,EAAQJ,EAAiC,OARzCE,EAAcH,EAAS,YACvBI,EAAcJ,EAAS,aASlB,CACL,GAAGF,EACH,YAAAK,EACA,YAAAC,EACA,SAAAL,EACA,KAAAM,CACF,CACF,CAAC,EACA,OAAO,OAAO,EAWjB,OAAIrB,EACKa,EAAK,KAAK,CAACS,EAAGC,IACfD,GAAG,UAAY,CAACC,GAAG,SACd,EAEL,CAACD,GAAG,UAAYC,GAAG,SACd,GAEF,CACR,EAEMV,CAEX,EAAG,CAACJ,EAASlB,EAAK,KAAMS,CAAO,CAAC,EAEhC,OACE9B,EAACE,EAAA,CAAU,GAAIqB,EAAI,UAAU,eAC3B,UAAAxB,EAACI,EAAA,CAAQ,GAAG,KAAK,KAAK,IAAI,KAAMkB,EAAK,MAAO,EAC5CrB,EAAC,OACC,UAAWc,EACT,wEACAe,EAAU,gBAAkB,GAC5B,CAACA,GAAW,gBACd,EACA,MAAO,CACL,WAAY,yEACd,EAGA,UAAA9B,EAAC,OACC,UAAU,6CACV,MAAO,CACL,WAAY,uFACd,EACF,EAEAC,EAAC,OAAI,UAAU,wKACb,UAAAA,EAAC,OAAI,UAAU,qCACb,UAAAD,EAACI,EAAA,CACC,GAAG,KACH,KAAM,EACN,KAAMkB,GAAM,SACZ,UAAU,uFACZ,EACAtB,EAAC,OAAI,UAAU,8BACb,SAAAA,EAAC,KACC,UAAU,wLACV,wBAAyB,CAAE,OAAQsB,EAAK,YAAa,EACvD,EACF,GACF,EACCA,EAAK,WAAW,KACftB,EAACK,EAAA,CACC,UAAU,qEACV,aAAa,0BACb,OAAQiB,EAAK,UAAU,IACzB,GAEJ,EAGArB,EAAC,OAAI,UAAU,qBACb,UAAAA,EAAC,OACC,UAAWc,EACT,oIACF,EACA,MAAO,CACL,OAAQU,GAAY,CAACgB,EAAiB,OAAS,OACjD,EAEC,UAAAG,EAAK,IAAIC,GACR5C,EAAC,OAEC,UAAWc,EACT,oIACAe,EAAU,iBAAmB,EAC/B,EAEA,UAAA7B,EAAC,OACC,UAAAD,EAACM,EAAA,CACC,GAAG,IACH,KAAMuC,EAAK,MACX,KAAM,EACN,UAAU,oDACZ,EACA5C,EAAC,OAAI,UAAU,wCACb,UAAAD,EAACK,EAAA,CACC,UAAU,iDACV,OAAO,0FACT,EACAL,EAACM,EAAA,CACC,GAAG,IACH,KAAMuC,EAAK,QACX,KAAM,EACN,UAAU,gDACZ,GACF,GACF,EAECA,EAAK,aACN,EAAEA,EAAK,KAAOjC,EAAS,eAAiB0B,IACxC,EAAEO,EAAK,KAAOjC,EAAS,UAAYgB,EAAiB,oBACpD,EAAEiB,EAAK,KAAOjC,EAAS,WAAawB,GAClCpC,EAACE,EAAA,CACC,GAAI2C,EAAK,KAAO,IAAM,SACrB,GAAIA,EAAK,MAAQ,CAAE,KAAMA,EAAK,IAAK,EACnC,GAAIA,EAAK,aAAe,CAAE,QAASA,EAAK,WAAY,EACrD,QAAQ,UACR,KAAK,KACL,UAAU,kBAET,SAAAA,EAAK,YACR,EAEA7C,EAACE,EAAA,CAAO,QAAQ,UAAU,KAAK,KAAK,UAAU,kBAAkB,SAAQ,GACrE,SAAA2C,EAAK,YACR,IA5CGA,EAAK,EA8CZ,CACD,EACA,CAACpB,GAAYgB,GACZzC,EAAC,OACC,UAAU,qDACV,MAAO,CAAE,WAAY,sEAAuE,EAC7F,GAEL,EACCyC,GACCzC,EAAAD,EAAA,CACG,SAAA0B,EACCzB,EAAC,UACC,UAAU,8CACV,QAAS,IAAM,CACb0B,EAAY,EAAK,CACnB,EAEA,SAAA1B,EAACQ,EAAA,CAAc,UAAU,kDAAkD,EAC7E,EAEAR,EAAAD,EAAA,CACE,SAAAC,EAAC,OAAI,UAAU,6EACb,SAAAA,EAAC,UAAO,UAAU,QAAQ,QAAS,IAAM0B,EAAY,CAACD,CAAQ,EAC5D,SAAAzB,EAACO,EAAA,CAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,EAEJ,GAEJ,GACF,EACCe,EAAK,SACJtB,EAACkB,EAAA,CACC,OAAQc,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMX,EAAK,QACX,UAAW,IAAM,CACfiB,EAA0B,EAAI,CAChC,EACF,EAEDjB,EAAK,WACJtB,EAACmB,EAAA,CACC,KAAMG,EAAK,UACX,UAAW,IAAM,CACfe,EAAsB,EAAI,EAC1B,WAAW,IAAM,CACfF,EAAwB,EAAK,CAC/B,EAAG,GAAI,CACT,EACA,OAAQD,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
6
6
  "names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "ChevronDownIcon", "ChevronUpIcon", "useMemo", "useState", "useEffect", "TaskType", "useActions", "useCreditsContext", "cn", "useHeadlessContext", "useRegistration", "CreditsUploadReceiptModal", "CreditsSubscribeModal", "ROUNDED_BRANDS", "CreditsAnkersolixTask", "copy", "classNames", "id", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "shouldShowMask", "timer", "section", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b"]
7
7
  }
@@ -1,4 +1,4 @@
1
- import{Fragment as v,jsx as i,jsxs as l}from"react/jsx-runtime";import{Button as s,Container as u,Heading as x,Picture as I,Text as f}from"@anker-in/headless-ui";import b from"classnames";import{useCreditsContext as w}from"../context/provider";function B({copy:t,id:r}){const{profile:e,openSignInPopup:m,openSignUpPopup:g}=w(),a=e?Object.keys(e).length!==0:!1,o=e?.first_name?e?.first_name+" "+e?.last_name:e?.email?.split("@")[0],n=h=>{h==="primary"?g():m()},d=t.pcImg?.width&&t.pcImg?.height?`${t.pcImg.width} / ${t.pcImg.height}`:"1920 / 804",p=t.laptopImg?.width&&t.laptopImg?.height?`${t.laptopImg.width} / ${t.laptopImg.height}`:"768 / 660",c=t.mobileImg?.width&&t.mobileImg?.height?`${t.mobileImg.width} / ${t.mobileImg.height}`:"390 / 660";return i(v,{children:l("div",{id:r,className:" relative w-full",children:[i(I,{className:"credits-banner-image w-full",style:{aspectRatio:d},imgClassName:"object-cover w-full h-full",source:`${t.pcImg?.url}, ${t.laptopImg?.url} 1024, ${t.mobileImg?.url} 768`,alt:t.pcImg?.alt,loading:"eager"}),i("style",{children:`
1
+ import{Fragment as v,jsx as i,jsxs as l}from"react/jsx-runtime";import{Button as s,Container as u,Heading as x,Picture as b,Text as I}from"@anker-in/headless-ui";import f from"classnames";import{useCreditsContext as w}from"../context/provider";function B({copy:t,id:r}){const{profile:e,openSignInPopup:m,openSignUpPopup:g}=w(),a=e?Object.keys(e).length!==0:!1,o=e?.first_name?e?.first_name+" "+e?.last_name:e?.email?.split("@")[0],n=h=>{h==="primary"?g():m()},d=t.pcImg?.width&&t.pcImg?.height?`${t.pcImg.width} / ${t.pcImg.height}`:"1920 / 804",p=t.laptopImg?.width&&t.laptopImg?.height?`${t.laptopImg.width} / ${t.laptopImg.height}`:"768 / 660",c=t.mobileImg?.width&&t.mobileImg?.height?`${t.mobileImg.width} / ${t.mobileImg.height}`:"390 / 660";return i(v,{children:l("div",{id:r,className:" relative w-full",children:[i(b,{className:"credits-banner-image w-full",style:{aspectRatio:d},imgClassName:"object-cover w-full h-full",source:`${t.pcImg?.url}, ${t.laptopImg?.url} 1024, ${t.mobileImg?.url} 768`,alt:t.pcImg?.alt,loading:"eager"}),i("style",{children:`
2
2
  @media (max-width: 1024px) and (min-width: 768px) {
3
3
  .credits-banner-image {
4
4
  aspect-ratio: ${p} !important;
@@ -9,5 +9,5 @@ import{Fragment as v,jsx as i,jsxs as l}from"react/jsx-runtime";import{Button as
9
9
  aspect-ratio: ${c} !important;
10
10
  }
11
11
  }
12
- `}),a&&i("div",{className:"absolute inset-0 ",style:{background:"linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)"}}),i(u,{className:"l:h-auto !absolute inset-0 mx-auto grid h-full",asChild:!0,children:i("div",{className:"grid grid-cols-12",children:l("div",{className:"l:col-span-12 l:justify-start l:truncate l:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]",children:[i(x,{as:"h1",className:"text-[48px] font-bold xl-xxl:text-[40px] l:text-[32px]",html:a?t.login.title?.replace("$name",o||""):t.unLogin.title}),i(f,{size:"3",className:"l:mt-[4px] l-xxl:text-[14px] mt-[16px]",html:a?t.login.description:t.unLogin.description}),!a&&l("div",{className:b("mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]",a&&"hidden"),children:[i(s,{variant:"secondary",size:"lg",onClick:()=>{n("primary")},children:t.joinNow}),i(s,{variant:"primary",size:"lg",onClick:()=>{n("secondary")},children:t.loginIn})]})]})})})]})})}export{B as CreditsBanner};
12
+ `}),a&&i("div",{className:"absolute inset-0 ",style:{background:"linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)"}}),i(u,{className:"l-tablet:h-auto !absolute inset-0 mx-auto grid h-full",asChild:!0,children:i("div",{className:"grid grid-cols-12",children:l("div",{className:"l-tablet:col-span-12 l-tablet:justify-start l-tablet:truncate l-tablet:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]",children:[i(x,{as:"h1",className:"text-[48px] font-bold xl-xxl:text-[40px] l-tablet:text-[32px]",html:a?t.login.title?.replace("$name",o||""):t.unLogin.title}),i(I,{size:"3",className:"l-tablet:mt-[4px] l-xxl:text-[14px] mt-[16px]",html:a?t.login.description:t.unLogin.description}),!a&&l("div",{className:f("mt-[32px] grid w-fit grid-flow-col gap-[12px] l-tablet:mt-[24px]",a&&"hidden"),children:[i(s,{variant:"secondary",size:"lg",onClick:()=>{n("primary")},children:t.joinNow}),i(s,{variant:"primary",size:"lg",onClick:()=>{n("secondary")},children:t.loginIn})]})]})})})]})})}export{B as CreditsBanner};
13
13
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsBanner/index.tsx"],
4
- "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\n\ntype Img = {\n url: string\n alt: string\n width?: number\n height?: number\n}\nexport type CreditsBannerCopy = {\n pcImg: Img\n laptopImg: Img\n mobileImg: Img\n joinNow: string\n loginIn: string\n login: {\n title: string\n description: string\n }\n unLogin: {\n title: string\n description: string\n }\n}\n\nexport function CreditsBanner({ copy, id }: { copy: CreditsBannerCopy; id?: string }) {\n const { profile, openSignInPopup, openSignUpPopup } = useCreditsContext()\n const isLogin = profile ? Object.keys(profile).length !== 0 : false\n\n const displayName = profile?.first_name\n ? profile?.first_name + ' ' + profile?.last_name\n : profile?.email?.split('@')[0]\n\n const handleButtonClick = (buttonType: 'primary' | 'secondary') => {\n buttonType === 'primary' ? openSignUpPopup() : openSignInPopup()\n }\n\n // \u8BA1\u7B97\u56FE\u7247\u6BD4\u4F8B\uFF0C\u5982\u679C\u6CA1\u6709\u914D\u7F6E\u5219\u4F7F\u7528\u9ED8\u8BA4\u503C\n const pcAspectRatio =\n copy.pcImg?.width && copy.pcImg?.height ? `${copy.pcImg.width} / ${copy.pcImg.height}` : '1920 / 804'\n const laptopAspectRatio =\n copy.laptopImg?.width && copy.laptopImg?.height ? `${copy.laptopImg.width} / ${copy.laptopImg.height}` : '768 / 660'\n const mobileAspectRatio =\n copy.mobileImg?.width && copy.mobileImg?.height ? `${copy.mobileImg.width} / ${copy.mobileImg.height}` : '390 / 660'\n\n return (\n <>\n <div id={id} className=\" relative w-full\">\n <Picture\n className=\"credits-banner-image w-full\"\n style={{\n aspectRatio: pcAspectRatio,\n }}\n imgClassName=\"object-cover w-full h-full\"\n source={`${copy.pcImg?.url}, ${copy.laptopImg?.url} 1024, ${copy.mobileImg?.url} 768`}\n alt={copy.pcImg?.alt}\n loading=\"eager\"\n ></Picture>\n <style>\n {`\n @media (max-width: 1024px) and (min-width: 768px) {\n .credits-banner-image {\n aspect-ratio: ${laptopAspectRatio} !important;\n }\n }\n @media (max-width: 767px) {\n .credits-banner-image {\n aspect-ratio: ${mobileAspectRatio} !important;\n }\n }\n `}\n </style>\n {isLogin && (\n <div\n className=\"absolute inset-0 \"\n style={{\n background: 'linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)',\n }}\n ></div>\n )}\n\n <Container className=\"l:h-auto !absolute inset-0 mx-auto grid h-full\" asChild>\n <div className=\"grid grid-cols-12\">\n <div className=\"l:col-span-12 l:justify-start l:truncate l:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]\">\n <Heading\n as=\"h1\"\n className=\"text-[48px] font-bold xl-xxl:text-[40px] l:text-[32px]\"\n html={isLogin ? copy.login.title?.replace('$name', displayName || '') : copy.unLogin.title}\n ></Heading>\n\n <Text\n size=\"3\"\n className=\"l:mt-[4px] l-xxl:text-[14px] mt-[16px]\"\n html={isLogin ? copy.login.description : copy.unLogin.description}\n ></Text>\n\n {!isLogin && (\n <div\n className={classNames(\n 'mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]',\n isLogin && 'hidden'\n )}\n >\n <Button\n variant=\"secondary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('primary')\n }}\n >\n {copy.joinNow}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('secondary')\n }}\n >\n {copy.loginIn}\n </Button>\n </div>\n )}\n </div>\n </div>\n </Container>\n </div>\n </>\n )\n}\n"],
5
- "mappings": "AA+CI,mBAAAA,EAEI,OAAAC,EAiDQ,QAAAC,MAnDZ,oBA/CJ,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAOC,MAAgB,aACvB,OAAS,qBAAAC,MAAyB,sBAwB3B,SAASC,EAAc,CAAE,KAAAC,EAAM,GAAAC,CAAG,EAA6C,CACpF,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,gBAAAC,CAAgB,EAAIN,EAAkB,EAClEO,EAAUH,EAAU,OAAO,KAAKA,CAAO,EAAE,SAAW,EAAI,GAExDI,EAAcJ,GAAS,WACzBA,GAAS,WAAa,IAAMA,GAAS,UACrCA,GAAS,OAAO,MAAM,GAAG,EAAE,CAAC,EAE1BK,EAAqBC,GAAwC,CACjEA,IAAe,UAAYJ,EAAgB,EAAID,EAAgB,CACjE,EAGMM,EACJT,EAAK,OAAO,OAASA,EAAK,OAAO,OAAS,GAAGA,EAAK,MAAM,KAAK,MAAMA,EAAK,MAAM,MAAM,GAAK,aACrFU,EACJV,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YACrGW,EACJX,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YAE3G,OACEV,EAAAD,EAAA,CACE,SAAAE,EAAC,OAAI,GAAIU,EAAI,UAAU,mBACrB,UAAAX,EAACK,EAAA,CACC,UAAU,8BACV,MAAO,CACL,YAAac,CACf,EACA,aAAa,6BACb,OAAQ,GAAGT,EAAK,OAAO,GAAG,KAAKA,EAAK,WAAW,GAAG,UAAUA,EAAK,WAAW,GAAG,OAC/E,IAAKA,EAAK,OAAO,IACjB,QAAQ,QACT,EACDV,EAAC,SACE;AAAA;AAAA;AAAA,gCAGqBoB,CAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,gCAKjBC,CAAiB;AAAA;AAAA;AAAA,YAIzC,EACCN,GACCf,EAAC,OACC,UAAU,oBACV,MAAO,CACL,WAAY,sEACd,EACD,EAGHA,EAACG,EAAA,CAAU,UAAU,iDAAiD,QAAO,GAC3E,SAAAH,EAAC,OAAI,UAAU,oBACb,SAAAC,EAAC,OAAI,UAAU,qHACb,UAAAD,EAACI,EAAA,CACC,GAAG,KACH,UAAU,yDACV,KAAMW,EAAUL,EAAK,MAAM,OAAO,QAAQ,QAASM,GAAe,EAAE,EAAIN,EAAK,QAAQ,MACtF,EAEDV,EAACM,EAAA,CACC,KAAK,IACL,UAAU,yCACV,KAAMS,EAAUL,EAAK,MAAM,YAAcA,EAAK,QAAQ,YACvD,EAEA,CAACK,GACAd,EAAC,OACC,UAAWM,EACT,4DACAQ,GAAW,QACb,EAEA,UAAAf,EAACE,EAAA,CACC,QAAQ,YACR,KAAK,KACL,QAAS,IAAM,CACbe,EAAkB,SAAS,CAC7B,EAEC,SAAAP,EAAK,QACR,EACAV,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,QAAS,IAAM,CACbe,EAAkB,WAAW,CAC/B,EAEC,SAAAP,EAAK,QACR,GACF,GAEJ,EACF,EACF,GACF,EACF,CAEJ",
4
+ "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\n\ntype Img = {\n url: string\n alt: string\n width?: number\n height?: number\n}\nexport type CreditsBannerCopy = {\n pcImg: Img\n laptopImg: Img\n mobileImg: Img\n joinNow: string\n loginIn: string\n login: {\n title: string\n description: string\n }\n unLogin: {\n title: string\n description: string\n }\n}\n\nexport function CreditsBanner({ copy, id }: { copy: CreditsBannerCopy; id?: string }) {\n const { profile, openSignInPopup, openSignUpPopup } = useCreditsContext()\n const isLogin = profile ? Object.keys(profile).length !== 0 : false\n\n const displayName = profile?.first_name\n ? profile?.first_name + ' ' + profile?.last_name\n : profile?.email?.split('@')[0]\n\n const handleButtonClick = (buttonType: 'primary' | 'secondary') => {\n buttonType === 'primary' ? openSignUpPopup() : openSignInPopup()\n }\n\n // \u8BA1\u7B97\u56FE\u7247\u6BD4\u4F8B\uFF0C\u5982\u679C\u6CA1\u6709\u914D\u7F6E\u5219\u4F7F\u7528\u9ED8\u8BA4\u503C\n const pcAspectRatio =\n copy.pcImg?.width && copy.pcImg?.height ? `${copy.pcImg.width} / ${copy.pcImg.height}` : '1920 / 804'\n const laptopAspectRatio =\n copy.laptopImg?.width && copy.laptopImg?.height ? `${copy.laptopImg.width} / ${copy.laptopImg.height}` : '768 / 660'\n const mobileAspectRatio =\n copy.mobileImg?.width && copy.mobileImg?.height ? `${copy.mobileImg.width} / ${copy.mobileImg.height}` : '390 / 660'\n\n return (\n <>\n <div id={id} className=\" relative w-full\">\n <Picture\n className=\"credits-banner-image w-full\"\n style={{\n aspectRatio: pcAspectRatio,\n }}\n imgClassName=\"object-cover w-full h-full\"\n source={`${copy.pcImg?.url}, ${copy.laptopImg?.url} 1024, ${copy.mobileImg?.url} 768`}\n alt={copy.pcImg?.alt}\n loading=\"eager\"\n ></Picture>\n <style>\n {`\n @media (max-width: 1024px) and (min-width: 768px) {\n .credits-banner-image {\n aspect-ratio: ${laptopAspectRatio} !important;\n }\n }\n @media (max-width: 767px) {\n .credits-banner-image {\n aspect-ratio: ${mobileAspectRatio} !important;\n }\n }\n `}\n </style>\n {isLogin && (\n <div\n className=\"absolute inset-0 \"\n style={{\n background: 'linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)',\n }}\n ></div>\n )}\n\n <Container className=\"l-tablet:h-auto !absolute inset-0 mx-auto grid h-full\" asChild>\n <div className=\"grid grid-cols-12\">\n <div className=\"l-tablet:col-span-12 l-tablet:justify-start l-tablet:truncate l-tablet:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]\">\n <Heading\n as=\"h1\"\n className=\"text-[48px] font-bold xl-xxl:text-[40px] l-tablet:text-[32px]\"\n html={isLogin ? copy.login.title?.replace('$name', displayName || '') : copy.unLogin.title}\n ></Heading>\n\n <Text\n size=\"3\"\n className=\"l-tablet:mt-[4px] l-xxl:text-[14px] mt-[16px]\"\n html={isLogin ? copy.login.description : copy.unLogin.description}\n ></Text>\n\n {!isLogin && (\n <div\n className={classNames(\n 'mt-[32px] grid w-fit grid-flow-col gap-[12px] l-tablet:mt-[24px]',\n isLogin && 'hidden'\n )}\n >\n <Button\n variant=\"secondary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('primary')\n }}\n >\n {copy.joinNow}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('secondary')\n }}\n >\n {copy.loginIn}\n </Button>\n </div>\n )}\n </div>\n </div>\n </Container>\n </div>\n </>\n )\n}\n"],
5
+ "mappings": "AA+CI,mBAAAA,EAEI,OAAAC,EAiDQ,QAAAC,MAnDZ,oBA/CJ,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAOC,MAAgB,aACvB,OAAS,qBAAAC,MAAyB,sBAwB3B,SAASC,EAAc,CAAE,KAAAC,EAAM,GAAAC,CAAG,EAA6C,CACpF,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,gBAAAC,CAAgB,EAAIN,EAAkB,EAClEO,EAAUH,EAAU,OAAO,KAAKA,CAAO,EAAE,SAAW,EAAI,GAExDI,EAAcJ,GAAS,WACzBA,GAAS,WAAa,IAAMA,GAAS,UACrCA,GAAS,OAAO,MAAM,GAAG,EAAE,CAAC,EAE1BK,EAAqBC,GAAwC,CACjEA,IAAe,UAAYJ,EAAgB,EAAID,EAAgB,CACjE,EAGMM,EACJT,EAAK,OAAO,OAASA,EAAK,OAAO,OAAS,GAAGA,EAAK,MAAM,KAAK,MAAMA,EAAK,MAAM,MAAM,GAAK,aACrFU,EACJV,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YACrGW,EACJX,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YAE3G,OACEV,EAAAD,EAAA,CACE,SAAAE,EAAC,OAAI,GAAIU,EAAI,UAAU,mBACrB,UAAAX,EAACK,EAAA,CACC,UAAU,8BACV,MAAO,CACL,YAAac,CACf,EACA,aAAa,6BACb,OAAQ,GAAGT,EAAK,OAAO,GAAG,KAAKA,EAAK,WAAW,GAAG,UAAUA,EAAK,WAAW,GAAG,OAC/E,IAAKA,EAAK,OAAO,IACjB,QAAQ,QACT,EACDV,EAAC,SACE;AAAA;AAAA;AAAA,gCAGqBoB,CAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,gCAKjBC,CAAiB;AAAA;AAAA;AAAA,YAIzC,EACCN,GACCf,EAAC,OACC,UAAU,oBACV,MAAO,CACL,WAAY,sEACd,EACD,EAGHA,EAACG,EAAA,CAAU,UAAU,wDAAwD,QAAO,GAClF,SAAAH,EAAC,OAAI,UAAU,oBACb,SAAAC,EAAC,OAAI,UAAU,iJACb,UAAAD,EAACI,EAAA,CACC,GAAG,KACH,UAAU,gEACV,KAAMW,EAAUL,EAAK,MAAM,OAAO,QAAQ,QAASM,GAAe,EAAE,EAAIN,EAAK,QAAQ,MACtF,EAEDV,EAACM,EAAA,CACC,KAAK,IACL,UAAU,gDACV,KAAMS,EAAUL,EAAK,MAAM,YAAcA,EAAK,QAAQ,YACvD,EAEA,CAACK,GACAd,EAAC,OACC,UAAWM,EACT,mEACAQ,GAAW,QACb,EAEA,UAAAf,EAACE,EAAA,CACC,QAAQ,YACR,KAAK,KACL,QAAS,IAAM,CACbe,EAAkB,SAAS,CAC7B,EAEC,SAAAP,EAAK,QACR,EACAV,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,QAAS,IAAM,CACbe,EAAkB,WAAW,CAC/B,EAEC,SAAAP,EAAK,QACR,GACF,GAEJ,EACF,EACF,GACF,EACF,CAEJ",
6
6
  "names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "classNames", "useCreditsContext", "CreditsBanner", "copy", "id", "profile", "openSignInPopup", "openSignUpPopup", "isLogin", "displayName", "handleButtonClick", "buttonType", "pcAspectRatio", "laptopAspectRatio", "mobileAspectRatio"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as i,jsxs as B}from"react/jsx-runtime";import{Container as b,Heading as h}from"@anker-in/headless-ui";import{useMemo as y,useState as v}from"react";import N from"./RedeemableItem";import R from"../context/hooks/useRedeemableList";import D from"../modal/rulesModal";import{useProductsByHandles as I,useHeadlessContext as S}from"@anker-in/lib";import{classNames as c}from"@anker-in/lib";import{useCreditsContext as _}from"../context/provider";import{ROUNDED_BRANDS as k}from"../../../constants";const K=({copy:s,id:p})=>{const[a,d]=v(),{redeemableList:m}=R(),{pageCommon:u}=_(),{brand:f}=S(),C=k.includes(f),g=[],{data:o}=I({handles:s?.list?.map(e=>e.products?.[0]?.handle)||[],metafieldIdentifiers:{variant:g}}),x=y(()=>o?.map(e=>{const r=(s.list||[]).find(n=>n.products?.[0]?.handle===e.handle),t=m.find(n=>n.id?.toString()===r?.redeemId?.toString()),l=e.variants?.find(n=>n.sku===r?.products?.[0]?.sku)||e.variants?.[0];return!t||!l?null:{product:e,productVariant:l,alpcData:{id:t?.id,consumeCredits:t?.consume_credits,remainingInventory:t?.remaining_inventory,isLimited:t?.is_limited,consumeType:t?.consume_type,title:t?.name,desc:t?.note},config:r}}).filter(Boolean),[o,s.list,m]);return B(b,{id:p,className:c("bg-[#F5F5F5]"),children:[i(h,{as:"h2",size:"4",html:s.title}),i("div",{className:"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3",children:x?.map((e,r)=>i(N,{copy:s,itemData:e,setRules:d,currencyCode:o?.[0]?.price.currencyCode||"USD"},r))}),a&&i(D,{overlayClassName:"md:px-[16px] md:items-center",className:c("md:h-fit md:rounded-b-[16px]",!C&&"md:rounded-none"),isOpen:a.length>0,onClose:()=>d([]),titleClassName:"border-b-transparent h-[56px]",rules:a,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:u?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};export{K as CreditsCash};
1
+ import{jsx as i,jsxs as B}from"react/jsx-runtime";import{Container as b,Heading as h}from"@anker-in/headless-ui";import{useMemo as y,useState as v}from"react";import N from"./RedeemableItem";import R from"../context/hooks/useRedeemableList";import D from"../modal/RulesModal";import{useProductsByHandles as I,useHeadlessContext as S}from"@anker-in/lib";import{classNames as c}from"@anker-in/lib";import{useCreditsContext as _}from"../context/provider";import{ROUNDED_BRANDS as k}from"../../../constants";const K=({copy:s,id:p})=>{const[a,d]=v(),{redeemableList:m}=R(),{pageCommon:u}=_(),{brand:f}=S(),C=k.includes(f),g=[],{data:o}=I({handles:s?.list?.map(e=>e.products?.[0]?.handle)||[],metafieldIdentifiers:{variant:g}}),x=y(()=>o?.map(e=>{const r=(s.list||[]).find(n=>n.products?.[0]?.handle===e.handle),t=m.find(n=>n.id?.toString()===r?.redeemId?.toString()),l=e.variants?.find(n=>n.sku===r?.products?.[0]?.sku)||e.variants?.[0];return!t||!l?null:{product:e,productVariant:l,alpcData:{id:t?.id,consumeCredits:t?.consume_credits,remainingInventory:t?.remaining_inventory,isLimited:t?.is_limited,consumeType:t?.consume_type,title:t?.name,desc:t?.note},config:r}}).filter(Boolean),[o,s.list,m]);return B(b,{id:p,className:c("bg-[#F5F5F5]"),children:[i(h,{as:"h2",size:"4",html:s.title}),i("div",{className:"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3",children:x?.map((e,r)=>i(N,{copy:s,itemData:e,setRules:d,currencyCode:o?.[0]?.price.currencyCode||"USD"},r))}),a&&i(D,{overlayClassName:"md:px-[16px] md:items-center",className:c("md:h-fit md:rounded-b-[16px]",!C&&"md:rounded-none"),isOpen:a.length>0,onClose:()=>d([]),titleClassName:"border-b-transparent h-[56px]",rules:a,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:u?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};export{K as CreditsCash};
2
2
  //# sourceMappingURL=CreditsCash.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsCash/CreditsCash.tsx"],
4
- "sourcesContent": ["import { Container, Heading, Text } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport RedeemableItem from './RedeemableItem'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport RulesModal from '../modal/rulesModal'\nimport { useProductsByHandles, useHeadlessContext } from '@anker-in/lib'\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { Product, classNames as cn } from '@anker-in/lib'\nimport { useCreditsContext } from '../context/provider'\nimport { numberFormat } from '../context/utils'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsCash = ({ copy, id }: { copy: CreditsCashCopy; id?: string }) => {\n const [rules, setRules] = useState<string | string[]>()\n const { redeemableList } = useRedeemableList()\n const { pageCommon } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const variantMetafieldIdentifiers: any[] = []\n\n const { data: productByHandles } = useProductsByHandles({\n handles: copy?.list?.map(item => item.products?.[0]?.handle) || [],\n metafieldIdentifiers: {\n variant: variantMetafieldIdentifiers,\n },\n })\n\n const list = useMemo(() => {\n return productByHandles\n ?.map((product: Product) => {\n const config = (copy.list || []).find(item => item.products?.[0]?.handle === product.handle)\n const alpcData = redeemableList.find(item => item.id?.toString() === config?.redeemId?.toString())\n const productVariant =\n product.variants?.find((variant: any) => variant.sku === config?.products?.[0]?.sku) || product.variants?.[0]\n if (!alpcData || !productVariant) return null\n return {\n product,\n productVariant,\n alpcData: {\n id: alpcData?.id,\n consumeCredits: alpcData?.consume_credits,\n remainingInventory: alpcData?.remaining_inventory,\n isLimited: alpcData?.is_limited,\n consumeType: alpcData?.consume_type,\n title: alpcData?.name,\n desc: alpcData?.note,\n },\n config,\n }\n })\n .filter(Boolean) as unknown as RedeemItem[]\n }, [productByHandles, copy.list, redeemableList])\n\n return (\n <Container id={id} className={cn('bg-[#F5F5F5]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n <div className=\"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3\">\n {list?.map((item, index: number) => (\n <RedeemableItem\n key={index}\n copy={copy}\n itemData={item}\n setRules={setRules}\n currencyCode={productByHandles?.[0]?.price.currencyCode || 'USD'}\n />\n ))}\n </div>\n\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className={cn('md:h-fit md:rounded-b-[16px]', !rounded && 'md:rounded-none')}\n isOpen={rules.length > 0}\n onClose={() => setRules([])}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] md:mb-[24px] md:pt-0\"\n title={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
4
+ "sourcesContent": ["import { Container, Heading, Text } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport RedeemableItem from './RedeemableItem'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport RulesModal from '../modal/RulesModal'\nimport { useProductsByHandles, useHeadlessContext } from '@anker-in/lib'\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { Product, classNames as cn } from '@anker-in/lib'\nimport { useCreditsContext } from '../context/provider'\nimport { numberFormat } from '../context/utils'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsCash = ({ copy, id }: { copy: CreditsCashCopy; id?: string }) => {\n const [rules, setRules] = useState<string | string[]>()\n const { redeemableList } = useRedeemableList()\n const { pageCommon } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const variantMetafieldIdentifiers: any[] = []\n\n const { data: productByHandles } = useProductsByHandles({\n handles: copy?.list?.map(item => item.products?.[0]?.handle) || [],\n metafieldIdentifiers: {\n variant: variantMetafieldIdentifiers,\n },\n })\n\n const list = useMemo(() => {\n return productByHandles\n ?.map((product: Product) => {\n const config = (copy.list || []).find(item => item.products?.[0]?.handle === product.handle)\n const alpcData = redeemableList.find(item => item.id?.toString() === config?.redeemId?.toString())\n const productVariant =\n product.variants?.find((variant: any) => variant.sku === config?.products?.[0]?.sku) || product.variants?.[0]\n if (!alpcData || !productVariant) return null\n return {\n product,\n productVariant,\n alpcData: {\n id: alpcData?.id,\n consumeCredits: alpcData?.consume_credits,\n remainingInventory: alpcData?.remaining_inventory,\n isLimited: alpcData?.is_limited,\n consumeType: alpcData?.consume_type,\n title: alpcData?.name,\n desc: alpcData?.note,\n },\n config,\n }\n })\n .filter(Boolean) as unknown as RedeemItem[]\n }, [productByHandles, copy.list, redeemableList])\n\n return (\n <Container id={id} className={cn('bg-[#F5F5F5]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n <div className=\"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3\">\n {list?.map((item, index: number) => (\n <RedeemableItem\n key={index}\n copy={copy}\n itemData={item}\n setRules={setRules}\n currencyCode={productByHandles?.[0]?.price.currencyCode || 'USD'}\n />\n ))}\n </div>\n\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className={cn('md:h-fit md:rounded-b-[16px]', !rounded && 'md:rounded-none')}\n isOpen={rules.length > 0}\n onClose={() => setRules([])}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] md:mb-[24px] md:pt-0\"\n title={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
5
5
  "mappings": "AAwDI,OACE,OAAAA,EADF,QAAAC,MAAA,oBAxDJ,OAAS,aAAAC,EAAW,WAAAC,MAAqB,wBACzC,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAOC,MAAoB,mBAC3B,OAAOC,MAAuB,qCAC9B,OAAOC,MAAgB,sBACvB,OAAS,wBAAAC,EAAsB,sBAAAC,MAA0B,gBAEzD,OAAkB,cAAcC,MAAU,gBAC1C,OAAS,qBAAAC,MAAyB,sBAElC,OAAS,kBAAAC,MAAsB,qBAExB,MAAMC,EAAc,CAAC,CAAE,KAAAC,EAAM,GAAAC,CAAG,IAA8C,CACnF,KAAM,CAACC,EAAOC,CAAQ,EAAIb,EAA4B,EAChD,CAAE,eAAAc,CAAe,EAAIZ,EAAkB,EACvC,CAAE,WAAAa,CAAW,EAAIR,EAAkB,EACnC,CAAE,MAAAS,CAAM,EAAIX,EAAmB,EAC/BY,EAAUT,EAAe,SAASQ,CAAK,EAEvCE,EAAqC,CAAC,EAEtC,CAAE,KAAMC,CAAiB,EAAIf,EAAqB,CACtD,QAASM,GAAM,MAAM,IAAIU,GAAQA,EAAK,WAAW,CAAC,GAAG,MAAM,GAAK,CAAC,EACjE,qBAAsB,CACpB,QAASF,CACX,CACF,CAAC,EAEKG,EAAOtB,EAAQ,IACZoB,GACH,IAAKG,GAAqB,CAC1B,MAAMC,GAAUb,EAAK,MAAQ,CAAC,GAAG,KAAKU,GAAQA,EAAK,WAAW,CAAC,GAAG,SAAWE,EAAQ,MAAM,EACrFE,EAAWV,EAAe,KAAKM,GAAQA,EAAK,IAAI,SAAS,IAAMG,GAAQ,UAAU,SAAS,CAAC,EAC3FE,EACJH,EAAQ,UAAU,KAAMI,GAAiBA,EAAQ,MAAQH,GAAQ,WAAW,CAAC,GAAG,GAAG,GAAKD,EAAQ,WAAW,CAAC,EAC9G,MAAI,CAACE,GAAY,CAACC,EAAuB,KAClC,CACL,QAAAH,EACA,eAAAG,EACA,SAAU,CACR,GAAID,GAAU,GACd,eAAgBA,GAAU,gBAC1B,mBAAoBA,GAAU,oBAC9B,UAAWA,GAAU,WACrB,YAAaA,GAAU,aACvB,MAAOA,GAAU,KACjB,KAAMA,GAAU,IAClB,EACA,OAAAD,CACF,CACF,CAAC,EACA,OAAO,OAAO,EAChB,CAACJ,EAAkBT,EAAK,KAAMI,CAAc,CAAC,EAEhD,OACElB,EAACC,EAAA,CAAU,GAAIc,EAAI,UAAWL,EAAG,cAAc,EAC7C,UAAAX,EAACG,EAAA,CAAQ,GAAG,KAAK,KAAK,IAAI,KAAMY,EAAK,MAAO,EAE5Cf,EAAC,OAAI,UAAU,+FACZ,SAAA0B,GAAM,IAAI,CAACD,EAAMO,IAChBhC,EAACM,EAAA,CAEC,KAAMS,EACN,SAAUU,EACV,SAAUP,EACV,aAAcM,IAAmB,CAAC,GAAG,MAAM,cAAgB,OAJtDQ,CAKP,CACD,EACH,EAECf,GACCjB,EAACQ,EAAA,CACC,iBAAiB,+BACjB,UAAWG,EAAG,+BAAgC,CAACW,GAAW,iBAAiB,EAC3E,OAAQL,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOG,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
6
6
  "names": ["jsx", "jsxs", "Container", "Heading", "useMemo", "useState", "RedeemableItem", "useRedeemableList", "RulesModal", "useProductsByHandles", "useHeadlessContext", "cn", "useCreditsContext", "ROUNDED_BRANDS", "CreditsCash", "copy", "id", "rules", "setRules", "redeemableList", "pageCommon", "brand", "rounded", "variantMetafieldIdentifiers", "productByHandles", "item", "list", "product", "config", "alpcData", "productVariant", "variant", "index"]
7
7
  }
@@ -0,0 +1,5 @@
1
+ import { CreditsGoGiftCopy } from './type';
2
+ export declare const CreditsGoGift: ({ copy, id }: {
3
+ copy: CreditsGoGiftCopy;
4
+ id?: string;
5
+ }) => import("react/jsx-runtime").JSX.Element | null;