@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
@@ -0,0 +1,2 @@
1
+ import{Fragment as b,jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as r,Picture as c,Text as m}from"@anker-in/headless-ui";import p from"classnames";import{numberFormat as u}from"../../context/utils";import{NoneProductValue as f}from"../RedeemProductModal/NonProductValue";import{useCreditsContext as g}from"../../context/provider";const w=({item:t,copy:a,loading:i,disabled:d,onConfirm:n})=>{const{pageCommon:l}=g();return o(b,{children:[o("div",{className:p("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[o("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[l?.imageMapping?.[t.config?.type]?.url&&e(c,{source:l.imageMapping[t.config.type].url,className:"h-full [&_img]:h-full"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value?e(f,{item:t}):e(m,{size:3,html:t.alpc?.title})})]}),o(m,{as:"p",className:p("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[u(t.alpc?.consumeCredits)," ",l?.pointUnit]}),t.config?.rules?.length>0&&o("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[o("div",{className:"mb-[4px]",children:[l?.ruleLabel,":"]}),e("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:t.config?.rules?.map((x,s)=>e("li",{className:"list-disc",children:e(m,{html:x})},s))})]})]}),o("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[e(m,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:a.confirmTitle}),e(r,{loading:i,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:n,disabled:d,children:a.confirmButton})]})]})};export{w as CouponInit};
2
+ //# sourceMappingURL=CouponInit.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx"],
4
+ "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { NoneProductValue } from '../RedeemProductModal/NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype CouponInitProps = {\n item: RedeemableItemType\n copy: RedeemModalCommon\n loading: boolean\n disabled: boolean\n onConfirm: () => void\n}\n\nexport const CouponInit = ({ item, copy, loading, disabled, onConfirm }: CouponInitProps) => {\n const { pageCommon } = useCreditsContext()\n\n return (\n <>\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n {item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{pageCommon?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={onConfirm}\n disabled={disabled}\n >\n {copy.confirmButton}\n </Button>\n </div>\n </>\n )\n}\n"],
5
+ "mappings": "AAmBI,mBAAAA,EAQQ,OAAAC,EAFJ,QAAAC,MANJ,oBAnBJ,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,gBAAAC,MAAoB,sBAE7B,OAAS,oBAAAC,MAAwB,wCACjC,OAAS,qBAAAC,MAAyB,yBAU3B,MAAMC,EAAa,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,EAAU,UAAAC,CAAU,IAAuB,CAC3F,KAAM,CAAE,WAAAC,CAAW,EAAIP,EAAkB,EAEzC,OACEP,EAAAF,EAAA,CACE,UAAAE,EAAC,OACC,UAAWI,EACT,8FACF,EAEA,UAAAJ,EAAC,OAAI,UAAU,uCACZ,UAAAc,GAAY,eAAeL,EAAK,QAAQ,IAAI,GAAG,KAC9CV,EAACG,EAAA,CAAQ,OAAQY,EAAW,aAAaL,EAAK,OAAO,IAAI,EAAE,IAAK,UAAU,wBAAwB,EAEpGV,EAAC,OAAI,UAAU,8DACZ,SAAAU,EAAK,OAAO,MACXV,EAACO,EAAA,CAAiB,KAAMG,EAAM,EAE9BV,EAACI,EAAA,CAAK,KAAM,EAAG,KAAMM,EAAK,MAAM,MAAO,EAE3C,GACF,EACAT,EAACG,EAAA,CACC,GAAG,IACH,UAAWC,EACT,wGACF,EAEC,UAAAC,EAAaI,EAAK,MAAM,cAAc,EAAE,IAAEK,GAAY,WACzD,EACCL,EAAK,QAAQ,OAAO,OAAS,GAC5BT,EAAC,OAAI,UAAU,kGACb,UAAAA,EAAC,OAAI,UAAU,WAAY,UAAAc,GAAY,UAAU,KAAC,EAClDf,EAAC,MAAG,UAAU,oCACX,SAAAU,EAAK,QAAQ,OAAO,IAAI,CAACM,EAAMC,IAC9BjB,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,KAAMY,EAAM,GADWC,CAE/B,CACD,EACH,GACF,GAEJ,EACAhB,EAAC,OAAI,UAAU,wDACb,UAAAD,EAACI,EAAA,CACC,UAAU,4EACV,KAAMO,EAAK,aACZ,EACDX,EAACE,EAAA,CACC,QAASU,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASE,EACT,SAAUD,EAET,SAAAF,EAAK,cACR,GACF,GACF,CAEJ",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "numberFormat", "NoneProductValue", "useCreditsContext", "CouponInit", "item", "copy", "loading", "disabled", "onConfirm", "pageCommon", "text", "index"]
7
+ }
@@ -0,0 +1,10 @@
1
+ import type { RedeemModalCommon, RedeemableItem as RedeemableItemType } from '../../type';
2
+ type CouponSuccessProps = {
3
+ item: RedeemableItemType;
4
+ copy: RedeemModalCommon;
5
+ couponCode: string;
6
+ disabled: boolean;
7
+ onClose: () => void;
8
+ };
9
+ export declare const CouponSuccess: ({ item, copy, couponCode, disabled, onClose }: CouponSuccessProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import{Fragment as N,jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as u,Picture as f,Text as a}from"@anker-in/headless-ui";import n from"classnames";import v from"../../context/hooks/useCopy";import{useCreditsContext as b}from"../../context/provider";import{useHeadlessContext as g}from"@anker-in/lib";import{NoneProductValue as y}from"../RedeemProductModal/NonProductValue";const k=({item:o,copy:s,couponCode:m,disabled:c,onClose:d})=>{const{locale:x}=g(),{pageCommon:p}=b(),{copy:r,copied:i}=v();return t(N,{children:[t("div",{className:n("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[t("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[p?.imageMapping?.[o.config?.type]?.url&&e(f,{source:p.imageMapping[o.config.type].url,className:"h-full [&_img]:h-full"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:o.config.value?e(y,{item:o}):e(a,{size:3,html:o.alpc?.title})})]}),t("div",{className:"mt-[30px] flex items-center justify-center md:mt-[18px]",children:[e("div",{className:"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]",children:m}),e("div",{className:n("cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]",i?"pointer-events-none":"pointer-events-auto"),onClick:()=>r(m),role:"button",tabIndex:0,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&l.preventDefault()},children:i?p?.copied:p?.copy})]})]}),t("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[t("div",{className:"flex flex-col",children:[e(a,{className:"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]",html:s.coupon.successTitle}),e(a,{className:"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]",html:s.coupon.successDesc})]}),e(u,{variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:()=>{window.location.href=s.coupon.successButtonUrl||`/${x}`,d()},disabled:c,children:s.coupon.successButton})]})]})};export{k as CouponSuccess};
2
+ //# sourceMappingURL=CouponSuccess.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.tsx"],
4
+ "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport useCopy from '../../context/hooks/useCopy'\nimport { useCreditsContext } from '../../context/provider'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport type { RedeemModalCommon, RedeemableItem as RedeemableItemType } from '../../type'\nimport { NoneProductValue } from '../RedeemProductModal/NonProductValue'\n\ntype CouponSuccessProps = {\n item: RedeemableItemType\n copy: RedeemModalCommon\n couponCode: string\n disabled: boolean\n onClose: () => void\n}\n\nexport const CouponSuccess = ({ item, copy, couponCode, disabled, onClose }: CouponSuccessProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n const { copy: copyText, copied: copiedStatus } = useCopy()\n return (\n <>\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n <div className=\"mt-[30px] flex items-center justify-center md:mt-[18px]\">\n <div className=\"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]\">{couponCode}</div>\n <div\n className={classNames(\n 'cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]',\n copiedStatus ? 'pointer-events-none' : 'pointer-events-auto'\n )}\n onClick={() => copyText(couponCode)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copiedStatus ? pageCommon?.copied : pageCommon?.copy}\n </div>\n </div>\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n <div className=\"flex flex-col\">\n <Text\n className=\"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]\"\n html={copy.coupon.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.coupon.successDesc}\n ></Text>\n </div>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n window.location.href = copy.coupon.successButtonUrl || `/${locale}`\n onClose()\n }}\n disabled={disabled}\n >\n {copy.coupon.successButton}\n </Button>\n </div>\n </>\n )\n}\n"],
5
+ "mappings": "AAqBI,mBAAAA,EAQQ,OAAAC,EAFJ,QAAAC,MANJ,oBArBJ,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAOC,MAAa,8BACpB,OAAS,qBAAAC,MAAyB,yBAClC,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,oBAAAC,MAAwB,wCAU1B,MAAMC,EAAgB,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,SAAAC,EAAU,QAAAC,CAAQ,IAA0B,CAClG,KAAM,CAAE,OAAAC,CAAO,EAAIR,EAAmB,EAChC,CAAE,WAAAS,CAAW,EAAIV,EAAkB,EACnC,CAAE,KAAMW,EAAU,OAAQC,CAAa,EAAIb,EAAQ,EACzD,OACEL,EAAAF,EAAA,CACE,UAAAE,EAAC,OACC,UAAWI,EACT,8FACF,EAEA,UAAAJ,EAAC,OAAI,UAAU,uCACZ,UAAAgB,GAAY,eAAeN,EAAK,QAAQ,IAAI,GAAG,KAC9CX,EAACG,EAAA,CAAQ,OAAQc,EAAW,aAAaN,EAAK,OAAO,IAAI,EAAE,IAAK,UAAU,wBAAwB,EAEpGX,EAAC,OAAI,UAAU,8DACZ,SAAAW,EAAK,OAAO,MACXX,EAACS,EAAA,CAAiB,KAAME,EAAM,EAE9BX,EAACI,EAAA,CAAK,KAAM,EAAG,KAAMO,EAAK,MAAM,MAAO,EAE3C,GACF,EACAV,EAAC,OAAI,UAAU,0DACb,UAAAD,EAAC,OAAI,UAAU,iEAAkE,SAAAa,EAAW,EAC5Fb,EAAC,OACC,UAAWK,EACT,8EACAc,EAAe,sBAAwB,qBACzC,EACA,QAAS,IAAMD,EAASL,CAAU,EAClC,KAAK,SACL,SAAU,EACV,UAAWO,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAAD,EAAeF,GAAY,OAASA,GAAY,KACnD,GACF,GACF,EACAhB,EAAC,OAAI,UAAU,wDACb,UAAAA,EAAC,OAAI,UAAU,gBACb,UAAAD,EAACI,EAAA,CACC,UAAU,8DACV,KAAMQ,EAAK,OAAO,aACnB,EACDZ,EAACI,EAAA,CACC,UAAU,oEACV,KAAMQ,EAAK,OAAO,YACnB,GACH,EACAZ,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAAS,IAAM,CACb,OAAO,SAAS,KAAOU,EAAK,OAAO,kBAAoB,IAAII,CAAM,GACjED,EAAQ,CACV,EACA,SAAUD,EAET,SAAAF,EAAK,OAAO,cACf,GACF,GACF,CAEJ",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCopy", "useCreditsContext", "useHeadlessContext", "NoneProductValue", "CouponSuccess", "item", "copy", "couponCode", "disabled", "onClose", "locale", "pageCommon", "copyText", "copiedStatus", "e"]
7
+ }
@@ -1,9 +1,8 @@
1
- import type { ModalContainerProps } from '../modal/modalContainer';
2
- import type { RedeemableItem as RedeemableItemType } from '../type';
3
- import { CreditsRedeemListCopy } from './type';
4
- declare function RedeemCouponModal({ item, copy, onError, ...props }: ModalContainerProps & {
1
+ import type { ModalContainerProps } from '../modal/ModalContainer';
2
+ import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../type';
3
+ declare function RedeemCouponModal({ item, copy, onError, ...props }: Omit<ModalContainerProps, 'isOpen'> & {
5
4
  item: RedeemableItemType;
6
- copy: CreditsRedeemListCopy;
5
+ copy: RedeemModalCommon;
7
6
  onError: (code: number) => void;
8
7
  }): import("react/jsx-runtime").JSX.Element;
9
8
  export default RedeemCouponModal;
@@ -1,2 +1,2 @@
1
- import{Fragment as E,jsx as t,jsxs as l}from"react/jsx-runtime";import{Button as y,Picture as k,Text as i}from"@anker-in/headless-ui";import u from"classnames";import{useCallback as I,useEffect as L,useState as f}from"react";import _ from"../context/hooks/useCopy";import{useCreditsContext as B}from"../context/provider";import{useRedeemCoupon as S}from"../context/hooks/useRedeemCoupon";import{AlpcErrorCode as x}from"../context/const";import{CreditsModalContainer as P}from"../modal/modalContainer";import{numberFormat as z}from"../context/utils";import{useHeadlessContext as O}from"@anker-in/lib";import{NoneProductValue as U}from"./RedeemProductModal/NonProductValue";function A({item:d,copy:o,onError:g,...a}){const{locale:w}=O(),[s,F]=f(),[C,n]=f(),[b,p]=f(!1),{copy:R,copied:v}=_(),{profile:c,fetchCreditInfo:N,pageCommon:m}=B(),{isMutating:h,trigger:M}=S({onSuccess(e){if(!e){n(o.redeemModal.commonError);return}if(e?.data?.success)F(e.data.coupon_code),N(c?.user_id);else{let r;e.code===x.CodeLpcShopifyCouponRuleRedeemLimit?(r=o.redeemModal.redeemLimitError,p(!0)):e.code===x.CodeLpcRuleInventoryNotEnough?(r=o.redeemModal.inventoryNotEnough,p(!0)):e.code===x.CodeLpcNotEnoughCredits?(r=o.redeemModal.creditsNotEnough,p(!0),N(c?.user_id)):e.code===x.CodeCrossSiteError&&(r=o.redeemModal.crossSiteError,p(!0)),n(r||o.redeemModal.commonError||""),g&&g(e.code)}},onError(e){n(e.message||o.redeemModal.commonError)}}),T=I(async()=>{n(""),M({user_id:c?.user_id,rule_id:Number(d.alpc?.id)})},[d,c,M]);return L(()=>{a.isOpen||(p(!1),n(""))},[a.isOpen]),l(P,{...a,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-0 md:mb-[24px] px-0",titleClassName:"h-[56px] bg-[#F5F5F7]",children:[l("div",{className:u("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[l("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[m?.imageMapping?.[d.config?.type]?.url&&t(k,{source:m.imageMapping[d.config.type].url,className:"h-full [&_img]:h-full"}),t("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:d.config.value?t(U,{item:d,copy:o}):t(i,{size:3,html:d.alpc?.title})})]}),s?l("div",{className:"mt-[30px] flex items-center justify-center md:mt-[18px]",children:[t("div",{className:"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]",children:s}),t("div",{className:u("cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]",v?"pointer-events-none":"pointer-events-auto"),onClick:()=>{R(s)},role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.preventDefault()},children:v?m?.copied:m?.copy})]}):l(i,{as:"p",className:u("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[z(d.alpc?.consumeCredits)," ",m?.pointUnit]}),!s&&d.config?.rules?.length>0&&l("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[l("div",{className:"mb-[4px]",children:[m?.ruleLabel,":"]}),t("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:d.config?.rules?.map((e,r)=>t("li",{className:"list-disc",children:t(i,{html:e})},r))})]})]}),l("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[s&&!h?l(E,{children:[l("div",{className:"flex flex-col",children:[t(i,{className:"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]",html:o.redeemModal.coupon.successTitle}),t(i,{className:"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]",html:o.redeemModal.coupon.successDesc})]}),t(y,{variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:()=>{window.location.href=o.redeemModal.coupon.successButtonUrl||`/${w}`,a.onClose&&a.onClose()},disabled:b,children:o.redeemModal.coupon.successButton})]}):l(E,{children:[t(i,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:o.redeemModal.confirmTitle}),t(y,{loading:h,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:T,disabled:b,children:o.redeemModal.confirmButton})]}),C&&t("div",{className:"mx-auto max-w-full py-[12px] text-center text-[#FF0000]",children:t(i,{className:"text-[14px] font-semibold text-[#1F2021]",html:C})})]})]})}var Z=A;export{Z as default};
1
+ import{jsx as s,jsxs as y}from"react/jsx-runtime";import{Text as h}from"@anker-in/headless-ui";import{useCallback as M,useEffect as N,useState as l}from"react";import{useCreditsContext as R}from"../context/provider";import{useRedeemCoupon as I}from"../context/hooks/useRedeemCoupon";import{AlpcErrorCode as n}from"../context/const";import{CreditsModalContainer as F}from"../modal/ModalContainer";import{CouponInit as S}from"./RedeemCouponModal/CouponInit";import{CouponSuccess as _}from"./RedeemCouponModal/CouponSuccess";function v({item:r,copy:o,onError:u,...a}){const[c,p]=l(),[C,t]=l(),[f,d]=l(!1),{profile:m,fetchCreditInfo:x}=R(),{isMutating:b,trigger:g}=I({onSuccess(e){if(!e){t(o.commonError);return}if(e?.data?.success)p(e.data.coupon_code),x(m?.user_id);else{let i;e.code===n.CodeLpcShopifyCouponRuleRedeemLimit?(i=o.redeemLimitError,d(!0)):e.code===n.CodeLpcRuleInventoryNotEnough?(i=o.inventoryNotEnough,d(!0)):e.code===n.CodeLpcNotEnoughCredits?(i=o.creditsNotEnough,d(!0),x(m?.user_id)):e.code===n.CodeCrossSiteError&&(i=o.crossSiteError,d(!0)),t(i||o.commonError||""),u&&u(e.code)}},onError(e){t(e.message||o.commonError)}}),E=M(async()=>{t(""),g({user_id:m?.user_id,rule_id:Number(r.alpc?.id)})},[r,m,g]);return N(()=>()=>{d(!1),t(""),p(void 0)},[]),y(F,{...a,isOpen:!!r,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-0 md:mb-[24px] px-0",titleClassName:"h-[56px] bg-[#F5F5F7]",children:[c&&!b?s(_,{item:r,copy:o,couponCode:c,disabled:f,onClose:a.onClose}):s(S,{item:r,copy:o,loading:b,disabled:f,onConfirm:E}),C&&s("div",{className:"mx-auto max-w-full bg-white px-[48px] py-[12px] text-center text-[#FF0000] md:px-[16px]",children:s(h,{className:"text-[14px] font-semibold text-[#1F2021]",html:C})})]})}var z=v;export{z as default};
2
2
  //# sourceMappingURL=RedeemCouponModal.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal.tsx"],
4
- "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/modalContainer'\nimport useCopy from '../context/hooks/useCopy'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/modalContainer'\nimport { numberFormat } from '../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsRedeemListCopy } from './type'\nimport { NoneProductValue } from './RedeemProductModal/NonProductValue'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: number) => void\n}) {\n const { locale } = useHeadlessContext()\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied: copiedStatus } = useCopy()\n\n const { profile, fetchCreditInfo, pageCommon } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.redeemModal.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.redeemModal.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.redeemModal.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo('')\n }\n }, [props.isOpen])\n\n return (\n <CreditsModalContainer\n {...props}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} copy={copy} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n {couponCode ? (\n <div className=\"mt-[30px] flex items-center justify-center md:mt-[18px]\">\n <div className=\"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]\">{couponCode}</div>\n <div\n className={classNames(\n 'cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]',\n copiedStatus ? 'pointer-events-none' : 'pointer-events-auto'\n )}\n onClick={() => {\n copyText(couponCode)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copiedStatus ? pageCommon?.copied : pageCommon?.copy}\n </div>\n </div>\n ) : (\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n )}\n {!couponCode && item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{pageCommon?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n {couponCode && !loading ? (\n <>\n <div className=\"flex flex-col\">\n <Text\n className=\"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]\"\n html={copy.redeemModal.coupon.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.redeemModal.coupon.successDesc}\n ></Text>\n </div>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n window.location.href = copy.redeemModal.coupon.successButtonUrl || `/${locale}`\n if (props.onClose) {\n props.onClose()\n }\n }}\n disabled={disabled}\n >\n {copy.redeemModal.coupon.successButton}\n </Button>\n </>\n ) : (\n <>\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={handleConfirm}\n disabled={disabled}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </>\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full py-[12px] text-center text-[#FF0000]\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </div>\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemCouponModal\n"],
5
- "mappings": "AAiGQ,OA2DE,YAAAA,EAzDE,OAAAC,EAFJ,QAAAC,MAAA,oBAjGR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAOC,MAAa,2BACpB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,oBAAAC,MAAwB,uCAEjC,SAASC,EAAkB,CACzB,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAIG,CACD,KAAM,CAAE,OAAAC,CAAO,EAAIP,EAAmB,EAChC,CAACQ,EAAYC,CAAa,EAAIhB,EAAiB,EAC/C,CAACiB,EAAWC,CAAY,EAAIlB,EAAiB,EAE7C,CAACmB,EAAUC,CAAW,EAAIpB,EAAS,EAAK,EACxC,CAAE,KAAMqB,EAAU,OAAQC,CAAa,EAAIrB,EAAQ,EAEnD,CAAE,QAAAsB,EAAS,gBAAAC,EAAiB,W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,UAAAD,EAACI,EAAA,CACC,UAAU,8DACV,KAAMe,EAAK,YAAY,OAAO,aAC/B,EACDnB,EAACI,EAAA,CACC,UAAU,oEACV,KAAMe,EAAK,YAAY,OAAO,YAC/B,GACH,EACAnB,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAAS,IAAM,CACb,OAAO,SAAS,KAAOiB,EAAK,YAAY,OAAO,kBAAoB,IAAIG,CAAM,GACzED,EAAM,SACRA,EAAM,QAAQ,CAElB,EACA,SAAUM,EAET,SAAAR,EAAK,YAAY,OAAO,cAC3B,GACF,EAEAlB,EAAAF,EAAA,CACE,UAAAC,EAACI,EAAA,CACC,UAAU,4EACV,KAAMe,EAAK,YAAY,aACxB,EACDnB,EAACE,EAAA,CACC,QAASgC,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASK,EACT,SAAUZ,EAET,SAAAR,EAAK,YAAY,cACpB,GACF,EAEDM,GACCzB,EAAC,OAAI,UAAU,0DACb,SAAAA,EAACI,EAAA,CAAK,UAAU,2CAA2C,KAAMqB,EAAW,EAC9E,GAEJ,GACF,CAEJ,CAEA,IAAOiB,EAAQzB",
6
- "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCallback", "useEffect", "useState", "useCopy", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "numberFormat", "useHeadlessContext", "NoneProductValue", "RedeemCouponModal", "item", "copy", "onError", "props", "locale", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copiedStatus", "profile", "fetchCreditInfo", "pageCommon", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "text", "index", "RedeemCouponModal_default"]
4
+ "sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/ModalContainer'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/ModalContainer'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../type'\nimport { CouponInit } from './RedeemCouponModal/CouponInit'\nimport { CouponSuccess } from './RedeemCouponModal/CouponSuccess'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: Omit<ModalContainerProps, 'isOpen'> & {\n item: RedeemableItemType\n copy: RedeemModalCommon\n onError: (code: number) => void\n}) {\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n const [disabled, setDisabled] = useState(false)\n\n const { profile, fetchCreditInfo } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n return () => {\n setDisabled(false)\n setErrorInfo('')\n setCouponCode(undefined)\n }\n }, [])\n\n return (\n <CreditsModalContainer\n {...props}\n isOpen={!!item}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n {couponCode && !loading ? (\n <CouponSuccess item={item} copy={copy} couponCode={couponCode} disabled={disabled} onClose={props.onClose} />\n ) : (\n <CouponInit item={item} copy={copy} loading={loading} disabled={disabled} onConfirm={handleConfirm} />\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full bg-white px-[48px] py-[12px] text-center text-[#FF0000] md:px-[16px]\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemCouponModal\n"],
5
+ "mappings": "AAgFI,OAQI,OAAAA,EARJ,QAAAC,MAAA,oBAhFJ,OAAS,QAAAC,MAAY,wBACrB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,yBAAAC,MAA6B,0BAEtC,OAAS,cAAAC,MAAkB,iCAC3B,OAAS,iBAAAC,MAAqB,oCAE9B,SAASC,EAAkB,CACzB,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAIG,CACD,KAAM,CAACC,EAAYC,CAAa,EAAIb,EAAiB,EAC/C,CAACc,EAAWC,CAAY,EAAIf,EAAiB,EAC7C,CAACgB,EAAUC,CAAW,EAAIjB,EAAS,EAAK,EAExC,CAAE,QAAAkB,EAAS,gBAAAC,CAAgB,EAAIlB,EAAkB,EAEjD,CAAE,WAAYmB,EAAS,QAAAC,CAAQ,EAAInB,EAAgB,CACvD,UAAUoB,EAAc,CACtB,GAAI,CAACA,EAAc,CACjBP,EAAaN,EAAK,WAAW,EAC7B,MACF,CAEA,GAAI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AAU,2CAA2C,KAAMiB,EAAW,EAC9E,GAEJ,CAEJ,CAEA,IAAOY,EAAQnB",
6
+ "names": ["jsx", "jsxs", "Text", "useCallback", "useEffect", "useState", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "CouponInit", "CouponSuccess", "RedeemCouponModal", "item", "copy", "onError", "props", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "profile", "fetchCreditInfo", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "RedeemCouponModal_default"]
7
7
  }
@@ -1,7 +1,6 @@
1
- import type { RedeemableItem as RedeemableItemType } from '../../type';
2
- import { CreditsRedeemListCopy } from '../type';
1
+ import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type';
3
2
  type AddressProps = {
4
- copy: CreditsRedeemListCopy;
3
+ copy: RedeemModalCommon;
5
4
  shippingAddress: string;
6
5
  setAddress: (address: Record<string, any>) => void;
7
6
  validateAddress: (address: Record<string, any>) => boolean;
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as d}from"react/jsx-runtime";import{Button as N,Text as r}from"@anker-in/headless-ui";import m from"classnames";import{AddressForm as R}from"../AddressForm";import{useHeadlessContext as h}from"@anker-in/lib";import{ProductInfo as A}from"./ProductInfo";import C from"../../context/hooks/useCountries";import{ROUNDED_BRANDS as F}from"../../../../constants";const E=({copy:o,shippingAddress:t,setAddress:a,validateAddress:i,validateErrors:n,shippingProduct:s,loading:p,address:l,disabled:x,handlePayment:c,item:u})=>{const{storeDomain:f,brand:v}=h(),y=F.includes(v),{countries:b=[],isLoading:g}=C({shopifyStoreDomain:f});return d("div",{className:"relative",children:[e("div",{className:m("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:d("div",{children:[t&&e(r,{className:"mb-5 text-[16px] font-bold",html:t}),o.redeemModal?.product?.addressForm&&e(R,{onChange:a,validate:i,errors:n,form:o.redeemModal.product.addressForm,countries:b,countriesLoading:g})]})}),d("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[d("div",{className:m("flex w-full items-center bg-[#F5F5F7] p-[16px]",!y&&"rounded-none"),children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(A,{item:u,copy:o})]}),e(N,{loading:p||!l,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:c,disabled:x,children:o.redeemModal.product.paymentButton})]})]})};export{E as Address};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as N,Text as r}from"@anker-in/headless-ui";import m from"classnames";import{AddressForm as R}from"../AddressForm";import{useHeadlessContext as h}from"@anker-in/lib";import{ProductInfo as A}from"./ProductInfo";import F from"../../context/hooks/useCountries";import{ROUNDED_BRANDS as C}from"../../../../constants";const L=({copy:o,shippingAddress:d,setAddress:a,validateAddress:i,validateErrors:n,shippingProduct:s,loading:l,address:p,disabled:x,handlePayment:c,item:u})=>{const{storeDomain:f,brand:v}=h(),b=C.includes(v),{countries:g=[],isLoading:y}=F({shopifyStoreDomain:f});return t("div",{className:"relative",children:[e("div",{className:m("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:t("div",{children:[d&&e(r,{className:"mb-5 text-[16px] font-bold",html:d}),o?.product?.addressForm&&e(R,{onChange:a,validate:i,errors:n,form:o.product.addressForm,countries:g,countriesLoading:y})]})}),t("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[t("div",{className:m("flex w-full items-center bg-[#F5F5F7] p-[16px]",!b&&"rounded-none"),children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(A,{item:u,copy:o})]}),e(N,{loading:l||!p,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:c,disabled:x,children:o.product.paymentButton})]})]})};export{L as Address};
2
2
  //# sourceMappingURL=Address.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx"],
4
- "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype AddressProps = {\n copy: CreditsRedeemListCopy\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n {copy.redeemModal?.product?.addressForm && (\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.redeemModal.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n )}\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AA4CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA5CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,sBAAAC,MAA0B,gBAGnC,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCACzB,OAAS,kBAAAC,MAAsB,wBAgBxB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,EAAa,MAAAC,CAAM,EAAIjB,EAAmB,EAC5CkB,EAAUf,EAAe,SAASc,CAAK,EACvC,CAAE,UAAAE,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIlB,EAAa,CAAE,mBAAoBc,CAAY,CAAC,EAExG,OACErB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAW,GAAmBZ,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMS,EAAiB,EACvFD,EAAK,aAAa,SAAS,aAC1BX,EAACK,EAAA,CACC,SAAUQ,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWc,EACX,iBAAkBC,EACnB,GAEL,EACF,EACAzB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAWG,EAAW,iDAAkD,CAACoB,GAAW,cAAc,EACpG,UAAAR,GAAmBhB,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMa,EAAiB,EACxFhB,EAACO,EAAA,CAAY,KAAMc,EAAM,KAAMV,EAAM,GACvC,EACAX,EAACE,EAAA,CACC,QAASe,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
4
+ "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype AddressProps = {\n copy: RedeemModalCommon\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n {copy?.product?.addressForm && (\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n )}\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AA2CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA3CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCACzB,OAAS,kBAAAC,MAAsB,wBAgBxB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,EAAa,MAAAC,CAAM,EAAIjB,EAAmB,EAC5CkB,EAAUf,EAAe,SAASc,CAAK,EACvC,CAAE,UAAAE,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIlB,EAAa,CAAE,mBAAoBc,CAAY,CAAC,EAExG,OACErB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAW,GAAmBZ,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMS,EAAiB,EACvFD,GAAM,SAAS,aACdX,EAACK,EAAA,CACC,SAAUQ,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,QAAQ,YACnB,UAAWc,EACX,iBAAkBC,EACnB,GAEL,EACF,EACAzB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAWG,EAAW,iDAAkD,CAACoB,GAAW,cAAc,EACpG,UAAAR,GAAmBhB,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMa,EAAiB,EACxFhB,EAACO,EAAA,CAAY,KAAMc,EAAM,KAAMV,EAAM,GACvC,EACAX,EAACE,EAAA,CACC,QAASe,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,QAAQ,cAChB,GACF,GACF,CAEJ",
6
6
  "names": ["jsx", "jsxs", "Button", "Text", "classNames", "AddressForm", "useHeadlessContext", "ProductInfo", "useCountries", "ROUNDED_BRANDS", "Address", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "brand", "rounded", "countries", "countriesLoading"]
7
7
  }
@@ -1,7 +1,6 @@
1
- import type { RedeemableItem as RedeemableItemType } from '../../type';
2
- import { CreditsRedeemListCopy } from '../type';
1
+ import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type';
3
2
  type InitProps = {
4
- copy: CreditsRedeemListCopy;
3
+ copy: RedeemModalCommon;
5
4
  item: RedeemableItemType;
6
5
  loading: boolean;
7
6
  disabled: boolean;
@@ -1,2 +1,2 @@
1
- import{Fragment as w,jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as u,Picture as m,Text as i}from"@anker-in/headless-ui";import a from"classnames";import{Fragment as f,useMemo as g}from"react";import{numberFormat as v}from"../../context/utils";import{ConsumeType as b}from"../../context/const";import{NoneProductValue as N}from"./NonProductValue";import{useCreditsContext as h}from"../../context/provider";const B=({copy:s,item:t,loading:x,disabled:n,setStatus:c})=>{const{pageCommon:p}=h(),r=g(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...s.redeemModal.product.rules||[]],[t.config.rules,t.config.desc,s.redeemModal.product.rules]);return o("div",{className:"flex flex-col",children:[e("div",{className:a("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o(w,{children:[o("div",{className:"relative mx-auto h-[164px] w-fit",children:[e(m,{source:t.config?.type===b.Product?t.product.images[0]?.url:p?.imageMapping?.[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&e(N,{item:t,copy:s})})]}),o("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&e("div",{className:a("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),o(i,{as:"p",className:a(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[v(t.alpc?.consumeCredits)," ",p?.pointUnit]})]}),o("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[e("div",{className:"text-[16px] font-bold leading-[1.4]",children:s.redeemModal.product.stepTitle}),e("div",{className:"mt-[4px] flex items-center justify-center",children:s.redeemModal.product.steps?.map((d,l)=>o(f,{children:[o("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[e(m,{source:d.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),e("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:d.title})]}),l!==s.redeemModal.product.steps.length-1&&e(m,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},l))}),e("div",{className:"overflow-auto",children:r?.length&&e("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:r.map((d,l)=>e("li",{className:"list-disc",children:e(i,{as:"div",html:d,className:"font-bold"})},l))})})]})]})}),o("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[e(i,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:s.redeemModal.confirmTitle}),e(u,{loading:x,disabled:n,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{c("address")},children:s.redeemModal.confirmButton})]})]})};export{B as Init};
1
+ import{Fragment as w,jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as u,Picture as i,Text as a}from"@anker-in/headless-ui";import d from"classnames";import{Fragment as f,useMemo as g}from"react";import{numberFormat as v}from"../../context/utils";import{ConsumeType as b}from"../../context/const";import{NoneProductValue as N}from"./NonProductValue";import{useCreditsContext as h}from"../../context/provider";const k=({copy:s,item:t,loading:x,disabled:n,setStatus:c})=>{const{pageCommon:p}=h(),r=g(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...s.product.rules||[]],[t.config.rules,t.config.desc,s.product.rules]);return o("div",{className:"flex flex-col",children:[e("div",{className:d("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o(w,{children:[o("div",{className:"relative mx-auto h-[164px] w-fit",children:[e(i,{source:t.config?.type===b.Product?t.product?.images[0]?.url:p?.imageMapping?.[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&e(N,{item:t})})]}),o("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&e("div",{className:d("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),o(a,{as:"p",className:d(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[v(t.alpc?.consumeCredits)," ",p?.pointUnit]})]}),o("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[e("div",{className:"text-[16px] font-bold leading-[1.4]",children:s.product.stepTitle}),e("div",{className:"mt-[4px] flex items-center justify-center",children:s.product.steps?.map((l,m)=>o(f,{children:[o("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[e(i,{source:l.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),e("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:l.title})]}),m!==s.product.steps.length-1&&e(i,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},m))}),e("div",{className:"overflow-auto",children:r?.length&&e("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:r.map((l,m)=>e("li",{className:"list-disc",children:e(a,{as:"div",html:l,className:"font-bold"})},m))})})]})]})}),o("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[e(a,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:s.confirmTitle}),e(u,{loading:x,disabled:n,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{c("address")},children:s.confirmButton})]})]})};export{k as Init};
2
2
  //# sourceMappingURL=Init.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx"],
4
- "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\nimport { NoneProductValue } from './NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype InitProps = {\n copy: CreditsRedeemListCopy\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const { pageCommon } = useCreditsContext()\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.redeemModal.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.redeemModal.product.rules])\n\n return (\n <div className=\"flex flex-col\">\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <>\n <div className=\"relative mx-auto h-[164px] w-fit\">\n <Picture\n source={\n item.config?.type === ConsumeType.Product\n ? item.product.images[0]?.url\n : pageCommon?.imageMapping?.[item.config.type]?.url || item.config.image?.url\n }\n className=\"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n {/* \u793C\u54C1\u5361\u5C55\u793A */}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value && <NoneProductValue item={item} copy={copy} />}\n </div>\n </div>\n <div className=\"mt-[30px] md:mt-[18px]\">\n {item.config.type === 'product' && (\n <div\n className={classNames(\n 'mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {item.config.title}\n </div>\n )}\n <Text\n as=\"p\"\n className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n </div>\n <div className=\"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{copy.redeemModal.product.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.redeemModal.product.steps?.map((item, index) => (\n <Fragment key={index}>\n <div className=\"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]\">\n <Picture source={item.imageUrl} className=\"mb-[4px] h-[58px] w-[58px]\"></Picture>\n <div className=\"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]\">\n {item.title}\n </div>\n </div>\n {index !== copy.redeemModal.product.steps.length - 1 && (\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150\"\n className=\"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]\"\n ></Picture>\n )}\n </Fragment>\n ))}\n </div>\n <div className=\"overflow-auto\">\n {rules?.length && (\n <ul className=\"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]\">\n {rules.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text as=\"div\" html={text} className=\"font-bold\" />\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n </>\n </div>\n <div className=\"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]\">\n <Text\n as=\"p\"\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n disabled={disabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full md:mt-[12px]\"\n onClick={() => {\n setStatus('address')\n }}\n >\n {copy.red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text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { ConsumeType } from '../../context/const'\nimport { NoneProductValue } from './NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype InitProps = {\n copy: RedeemModalCommon\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const { pageCommon } = useCreditsContext()\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.product.rules])\n\n return (\n <div className=\"flex flex-col\">\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <>\n <div className=\"relative mx-auto h-[164px] w-fit\">\n <Picture\n source={\n item.config?.type === ConsumeType.Product\n ? item.product?.images[0]?.url\n : pageCommon?.imageMapping?.[item.config.type]?.url || item.config.image?.url\n }\n className=\"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n {/* \u793C\u54C1\u5361\u5C55\u793A */}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value && <NoneProductValue item={item} />}\n </div>\n </div>\n <div className=\"mt-[30px] md:mt-[18px]\">\n {item.config.type === 'product' && (\n <div\n className={classNames(\n 'mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {item.config.title}\n </div>\n )}\n <Text\n as=\"p\"\n className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n </div>\n <div className=\"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{copy.product.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.product.steps?.map((item, index) => (\n <Fragment key={index}>\n <div className=\"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]\">\n <Picture source={item.imageUrl} className=\"mb-[4px] h-[58px] w-[58px]\"></Picture>\n <div className=\"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]\">\n {item.title}\n </div>\n </div>\n {index !== copy.product.steps.length - 1 && (\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150\"\n className=\"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]\"\n ></Picture>\n )}\n </Fragment>\n ))}\n </div>\n <div className=\"overflow-auto\">\n {rules?.length && (\n <ul className=\"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]\">\n {rules.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text as=\"div\" html={text} className=\"font-bold\" />\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n </>\n </div>\n <div className=\"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]\">\n <Text\n as=\"p\"\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n disabled={disabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full md:mt-[12px]\"\n onClick={() => {\n setStatus('address')\n }}\n >\n {copy.confirmButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAkCQ,mBAAAA,EAEI,OAAAC,EADF,QAAAC,MADF,oBAlCR,OAAS,UAAAC,EAA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,EAAK,MAAM,cAAc,EAAE,IAAEI,GAAY,WACzD,GACF,EACAhB,EAAC,OAAI,UAAU,sEACb,UAAAD,EAAC,OAAI,UAAU,sCAAuC,SAAAY,EAAK,QAAQ,UAAU,EAC7EZ,EAAC,OAAI,UAAU,4CACZ,SAAAY,EAAK,QAAQ,OAAO,IAAI,CAACC,EAAMM,IAC9BlB,EAACF,EAAA,CACC,UAAAE,EAAC,OAAI,UAAU,8EACb,UAAAD,EAACG,EAAA,CAAQ,OAAQU,EAAK,SAAU,UAAU,6BAA6B,EACvEb,EAAC,OAAI,UAAU,gFACZ,SAAAa,EAAK,MACR,GACF,EACCM,IAAUP,EAAK,QAAQ,MAAM,OAAS,GACrCZ,EAACG,EAAA,CACC,OAAO,qFACP,UAAU,kEACX,IAXUgB,CAaf,CACD,EACH,EACAnB,EAAC,OAAI,UAAU,gBACZ,SAAAkB,GAAO,QACNlB,EAAC,MAAG,UAAU,mHACX,SAAAkB,EAAM,IAAI,CAACE,EAAMD,IAChBnB,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,GAAG,MAAM,KAAMgB,EAAM,UAAU,YAAY,GADpBD,CAE/B,CACD,EACH,EAEJ,GACF,GACF,EACF,EACAlB,EAAC,OAAI,UAAU,+DACb,UAAAD,EAACI,EAAA,CACC,GAAG,IACH,UAAU,4EACV,KAAMQ,EAAK,aACZ,EACDZ,EAACE,EAAA,CACC,QAASY,EACT,SAAUC,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbC,EAAU,SAAS,CACrB,EAEC,SAAAJ,EAAK,cACR,GACF,GACF,CAEJ",
6
6
  "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useMemo", "numberFormat", "ConsumeType", "NoneProductValue", "useCreditsContext", "Init", "copy", "item", "loading", "disabled", "setStatus", "pageCommon", "rules", "index", "text"]
7
7
  }
@@ -1,6 +1,4 @@
1
1
  import { RedeemableItem } from '../../type';
2
- import { CreditsRedeemListCopy } from '../type';
3
- export declare const NoneProductValue: ({ item, copy }: {
2
+ export declare const NoneProductValue: ({ item }: {
4
3
  item: RedeemableItem;
5
- copy: CreditsRedeemListCopy;
6
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as p}from"react/jsx-runtime";import{Text as o}from"@anker-in/headless-ui";import{ConsumeType as l}from"../../context/const";import{useCreditsContext as a}from"../../context/provider";const x=({item:e,copy:i})=>{const{pageCommon:n}=a();return e.config?.type===l.ShippingCoupon?t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.value,as:"p"}):e.config?.value?p("div",{className:"flex items-end gap-[4px]",children:[t(o,{className:"text-[64px] font-extrabold leading-none",html:e.config.value.toString()}),t(o,{className:"text-[24px] font-bold leading-[2]",html:e.config.type===l.Coupon?n?.off:n?.giftCardLabel})]}):t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.title,as:"p"})};export{x as NoneProductValue};
1
+ import{jsx as l,jsxs as i}from"react/jsx-runtime";import{Text as t}from"@anker-in/headless-ui";import{ConsumeType as n}from"../../context/const";import{useCreditsContext as a}from"../../context/provider";const d=({item:e})=>{const{pageCommon:f}=a();if(e.config?.type===n.ShippingCoupon)return l(t,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.value,as:"p"});if(!e.config?.value)return l(t,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.title,as:"p"});let o="";return e.config.type===n.Coupon?o=f?.off||"":e.config.type===n.GoGift?o=f?.goGiftLabel||"":e.config.type===n.GiftCard&&(o=f?.giftCardLabel||""),i("div",{className:"flex items-end gap-[4px]",children:[l(t,{className:"text-[64px] font-extrabold leading-none",html:e.config.value.toString()}),o&&l(t,{className:"text-[24px] font-bold leading-[2]",html:o})]})};export{d as NoneProductValue};
2
2
  //# sourceMappingURL=NonProductValue.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx"],
4
- "sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { RedeemableItem } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\n\nexport const NoneProductValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n const { pageCommon } = useCreditsContext()\n // shipping coupon \u4EC5\u5C55\u793A\u6587\u6848\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.value} as=\"p\" />\n } else {\n return item.config?.value ? (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-extrabold leading-none\" html={item.config.value.toString()} />\n <Text\n className=\"text-[24px] font-bold leading-[2]\"\n html={item.config.type === ConsumeType.Coupon ? pageCommon?.off : pageCommon?.giftCardLabel}\n />\n </div>\n ) : (\n <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.title} as=\"p\" />\n )\n }\n}\n"],
5
- "mappings": "AAUW,cAAAA,EAGL,QAAAC,MAHK,oBAVX,OAAS,QAAAC,MAAY,wBAGrB,OAAS,eAAAC,MAAmB,sBAC5B,OAAS,qBAAAC,MAAyB,yBAE3B,MAAMC,EAAmB,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAA6D,CACzG,KAAM,CAAE,WAAAC,CAAW,EAAIJ,EAAkB,EAEzC,OAAIE,EAAK,QAAQ,OAASH,EAAY,eAC7BH,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,EAE9FA,EAAK,QAAQ,MAClBL,EAAC,OAAI,UAAU,2BACb,UAAAD,EAACE,EAAA,CAAK,UAAU,0CAA0C,KAAMI,EAAK,OAAO,MAAM,SAAS,EAAG,EAC9FN,EAACE,EAAA,CACC,UAAU,oCACV,KAAMI,EAAK,OAAO,OAASH,EAAY,OAASK,GAAY,IAAMA,GAAY,cAChF,GACF,EAEAR,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,CAGpG",
6
- "names": ["jsx", "jsxs", "Text", "ConsumeType", "useCreditsContext", "NoneProductValue", "item", "copy", "pageCommon"]
4
+ "sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { RedeemableItem } from '../../type'\nimport { ConsumeType } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\n\nexport const NoneProductValue = ({ item }: { item: RedeemableItem }) => {\n const { pageCommon } = useCreditsContext()\n\n // shipping coupon \u4EC5\u5C55\u793A\u6587\u6848\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.value} as=\"p\" />\n }\n\n if (!item.config?.value) {\n return <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.title} as=\"p\" />\n }\n\n // \u6839\u636E\u7C7B\u578B\u786E\u5B9A\u540E\u7F00\u6587\u6848\n let suffixLabel = ''\n if (item.config.type === ConsumeType.Coupon) {\n suffixLabel = pageCommon?.off || ''\n } else if (item.config.type === ConsumeType.GoGift) {\n suffixLabel = pageCommon?.goGiftLabel || ''\n } else if (item.config.type === ConsumeType.GiftCard) {\n suffixLabel = pageCommon?.giftCardLabel || ''\n }\n\n return (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-extrabold leading-none\" html={item.config.value.toString()} />\n {suffixLabel && <Text className=\"text-[24px] font-bold leading-[2]\" html={suffixLabel} />}\n </div>\n )\n}\n"],
5
+ "mappings": "AAUW,cAAAA,EAkBP,QAAAC,MAlBO,oBAVX,OAAS,QAAAC,MAAY,wBAErB,OAAS,eAAAC,MAAmB,sBAC5B,OAAS,qBAAAC,MAAyB,yBAE3B,MAAMC,EAAmB,CAAC,CAAE,KAAAC,CAAK,IAAgC,CACtE,KAAM,CAAE,WAAAC,CAAW,EAAIH,EAAkB,EAGzC,GAAIE,EAAK,QAAQ,OAASH,EAAY,eACpC,OAAOH,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,EAGvG,GAAI,CAACA,EAAK,QAAQ,MAChB,OAAON,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,EAIvG,IAAIE,EAAc,GAClB,OAAIF,EAAK,OAAO,OAASH,EAAY,OACnCK,EAAcD,GAAY,KAAO,GACxBD,EAAK,OAAO,OAASH,EAAY,OAC1CK,EAAcD,GAAY,aAAe,GAChCD,EAAK,OAAO,OAASH,EAAY,WAC1CK,EAAcD,GAAY,eAAiB,IAI3CN,EAAC,OAAI,UAAU,2BACb,UAAAD,EAACE,EAAA,CAAK,UAAU,0CAA0C,KAAMI,EAAK,OAAO,MAAM,SAAS,EAAG,EAC7FE,GAAeR,EAACE,EAAA,CAAK,UAAU,oCAAoC,KAAMM,EAAa,GACzF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Text", "ConsumeType", "useCreditsContext", "NoneProductValue", "item", "pageCommon", "suffixLabel"]
7
7
  }
@@ -1,8 +1,7 @@
1
- import type { RedeemableItem as RedeemableItemType } from '../../type';
2
- import { CreditsRedeemListCopy } from '../type';
1
+ import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type';
3
2
  type ProductInfoProps = {
4
3
  item: RedeemableItemType;
5
- copy: CreditsRedeemListCopy;
4
+ copy: RedeemModalCommon;
6
5
  };
7
- export declare const ProductInfo: ({ item, copy }: ProductInfoProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const ProductInfo: ({ item, copy }: ProductInfoProps) => import("react/jsx-runtime").JSX.Element | null;
8
7
  export {};
@@ -1,2 +1,2 @@
1
- import{jsx as a,jsxs as e}from"react/jsx-runtime";import{Picture as s,Text as i}from"@anker-in/headless-ui";import{formatPrice as r}from"../../context/utils";import{useHeadlessContext as o}from"@anker-in/lib";import{useCreditsContext as p}from"../../context/provider";const b=({item:t,copy:d})=>{const{locale:m}=o(),{pageCommon:l}=p();return e("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(s,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),e("div",{className:"md:flex md:flex-col",children:[e("div",{className:"md:flex md:items-center",children:[a(s,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:t.product.title,children:t.product.title})]}),e("div",{className:"mt-[16px] md:mt-[12px]",children:[a(i,{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",html:t.product.title,title:t.product.title}),e("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[e("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[t.variant.title&&t.variant.title.toLowerCase()!=="default title"&&e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.variantLabel,": "]}),a("span",{className:"ml-1",children:t.variant.title})]}),e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:r({amount:0,currencyCode:t.product.price?.currencyCode,locale:m||"us"})})]})]}),e("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),e("div",{className:"l:flex l:items-center l:justify-between",children:[e("span",{children:[d.redeemModal.product.totalPriceLabel,": "]}),e("span",{className:"ml-1",children:[t.alpc?.consumeCredits," ",l?.pointUnit]})]})]})]})]})]})]})};export{b as ProductInfo};
1
+ import{jsx as a,jsxs as t}from"react/jsx-runtime";import{Picture as s,Text as i}from"@anker-in/headless-ui";import{formatPrice as r}from"../../context/utils";import{useHeadlessContext as o}from"@anker-in/lib";import{useCreditsContext as n}from"../../context/provider";const f=({item:e,copy:l})=>{const{locale:m}=o(),{pageCommon:d}=n();return!e.product||!e.variant?null:t("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(s,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:e.variant.image?.url||e.product.images[0]?.url,alt:e.product.title}),t("div",{className:"md:flex md:flex-col",children:[t("div",{className:"md:flex md:items-center",children:[a(s,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:e.variant.image?.url||e.product.images[0]?.url,alt:e.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:e.product.title,children:e.product.title})]}),t("div",{className:"mt-[16px] md:mt-[12px]",children:[a(i,{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",html:e.product.title,title:e.product.title}),t("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[t("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[e.variant.title&&e.variant.title.toLowerCase()!=="default title"&&t("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[t("span",{children:[l.product.variantLabel,": "]}),a("span",{className:"ml-1",children:e.variant.title})]}),t("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[t("span",{children:[l.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:r({amount:0,currencyCode:e.product.price?.currencyCode,locale:m||"us"})})]})]}),t("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[t("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[t("span",{children:[l.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),t("div",{className:"l:flex l:items-center l:justify-between",children:[t("span",{children:[l.product.totalPriceLabel,": "]}),t("span",{className:"ml-1",children:[e.alpc?.consumeCredits," ",d?.pointUnit]})]})]})]})]})]})]})};export{f as ProductInfo};
2
2
  //# sourceMappingURL=ProductInfo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx"],
4
- "sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\nimport { formatPrice } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../../context/provider'\n\ntype ProductInfoProps = {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n}\n\nexport const ProductInfo = ({ item, copy }: ProductInfoProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n\n return (\n <div className=\"flex w-full items-center justify-center md:items-start md:justify-start\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"md:flex md:flex-col\">\n <div className=\"md:flex md:items-center\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n </div>\n\n <div className=\"mt-[16px] md:mt-[12px]\">\n <Text\n className=\"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden\"\n html={item.product.title}\n title={item.product.title}\n ></Text>\n <div className=\"flex font-semibold leading-[1.4] md:flex-col\">\n <div className=\"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]\">\n {item.variant.title && item.variant.title.toLowerCase() !== 'default title' && (\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.variantLabel}: </span>\n <span className=\"ml-1\">{item.variant.title}</span>\n </div>\n )}\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.shippingFeeLabel}: </span>\n <span className=\"ml-1\">\n {formatPrice({\n amount: 0,\n currencyCode: item.product.price?.currencyCode!,\n locale: locale || 'us',\n })}\n </span>\n </div>\n </div>\n <div className=\"text-[15px] font-bold text-[#777] md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.quantityLabel}: </span>\n <span className=\"ml-1\">1</span>\n </div>\n <div className=\"l:flex l:items-center l:justify-between\">\n <span>{copy.redeemModal.product.totalPriceLabel}: </span>\n <span className=\"ml-1\">\n {item.alpc?.consumeCredits} {pageCommon?.pointUnit}\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAkBM,cAAAA,EAME,QAAAC,MANF,oBAlBN,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC9B,OAAS,eAAAC,MAAmB,sBAG5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,yBAO3B,MAAMC,EAAc,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAAwB,CAC/D,KAAM,CAAE,OAAAC,CAAO,EAAIL,EAAmB,EAChC,CAAE,WAAAM,CAAW,EAAIL,EAAkB,EAEzC,OACEL,EAAC,OAAI,UAAU,0EACb,UAAAD,EAACE,E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AA,EAAC,QAAM,UAAAQ,EAAK,YAAY,QAAQ,gBAAgB,MAAE,EAClDR,EAAC,QAAK,UAAU,OACb,UAAAO,EAAK,MAAM,eAAe,IAAEG,GAAY,WAC3C,GACF,GACF,GACF,GACF,GACF,GACF,CAEJ",
4
+ "sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\nimport { formatPrice } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../../context/provider'\n\ntype ProductInfoProps = {\n item: RedeemableItemType\n copy: RedeemModalCommon\n}\n\nexport const ProductInfo = ({ item, copy }: ProductInfoProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n\n // ProductInfo \u53EA\u5728 RedeemProductModal \u4E2D\u4F7F\u7528\uFF0C\u6B64\u65F6 product \u548C variant \u5FC5\u5B9A\u5B58\u5728\n if (!item.product || !item.variant) return null\n\n return (\n <div className=\"flex w-full items-center justify-center md:items-start md:justify-start\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"md:flex md:flex-col\">\n <div className=\"md:flex md:items-center\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n </div>\n\n <div className=\"mt-[16px] md:mt-[12px]\">\n <Text\n className=\"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden\"\n html={item.product.title}\n title={item.product.title}\n ></Text>\n <div className=\"flex font-semibold leading-[1.4] md:flex-col\">\n <div className=\"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]\">\n {item.variant.title && item.variant.title.toLowerCase() !== 'default title' && (\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.product.variantLabel}: </span>\n <span className=\"ml-1\">{item.variant.title}</span>\n </div>\n )}\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.product.shippingFeeLabel}: </span>\n <span className=\"ml-1\">\n {formatPrice({\n amount: 0,\n currencyCode: item.product.price?.currencyCode!,\n locale: locale || 'us',\n })}\n </span>\n </div>\n </div>\n <div className=\"text-[15px] font-bold text-[#777] md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.product.quantityLabel}: </span>\n <span className=\"ml-1\">1</span>\n </div>\n <div className=\"l:flex l:items-center l:justify-between\">\n <span>{copy.product.totalPriceLabel}: </span>\n <span className=\"ml-1\">\n {item.alpc?.consumeCredits} {pageCommon?.pointUnit}\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAoBM,cAAAA,EAME,QAAAC,MANF,oBApBN,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC9B,OAAS,eAAAC,MAAmB,sBAE5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,yBAO3B,MAAMC,EAAc,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAAwB,CAC/D,KAAM,CAAE,OAAAC,CAAO,EAAIL,EAAmB,EAChC,CAAE,WAAAM,CAAW,EAAIL,EAAkB,EAGzC,MAAI,CAACE,EAAK,SAAW,CAACA,EAAK,QAAgB,KAGzCP,EAAC,OAAI,UAAU,0EACb,UAAAD,EAACE,EAAA,CACC,UAAU,6HACV,OAAQM,EAAK,QAAQ,OAAO,KAAOA,EAAK,QAAQ,OAAO,CAAC,GAAG,IAC3D,IAAKA,EAAK,QAAQ,M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GACF,GACF,GACF,GACF,GACF,CAEJ",
6
6
  "names": ["jsx", "jsxs", "Picture", "Text", "formatPrice", "useHeadlessContext", "useCreditsContext", "ProductInfo", "item", "copy", "locale", "pageCommon"]
7
7
  }
@@ -1,7 +1,6 @@
1
- import type { RedeemableItem as RedeemableItemType } from '../../type';
2
- import { CreditsRedeemListCopy } from '../type';
1
+ import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type';
3
2
  type SuccessProps = {
4
- copy: CreditsRedeemListCopy;
3
+ copy: RedeemModalCommon;
5
4
  shippingProduct: string;
6
5
  loading: boolean;
7
6
  address: Record<string, any> | undefined;
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as v}from"react/jsx-runtime";import{Button as u,Text as m}from"@anker-in/headless-ui";import d from"classnames";import{ProductInfo as f}from"./ProductInfo";import{useHeadlessContext as b}from"@anker-in/lib";import{ROUNDED_BRANDS as y}from"../../../../constants";const B=({copy:t,shippingProduct:o,loading:s,address:a,disabled:p,onClose:r,item:i})=>{const{brand:l}=b(),n=y.includes(l);return e("div",{className:d("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:v("div",{className:"flex flex-col items-center",children:[e("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:t.redeemModal.product.successDesc.map((x,c)=>e(m,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:x},c))}),o&&e(m,{className:"mb-5 text-[16px] font-bold",html:o}),e("div",{className:d("flex w-full items-center bg-[#F5F5F7] p-[16px]",!n&&"rounded-none"),children:e(f,{item:i,copy:t})}),e(u,{loading:s||!a,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:r,disabled:p,children:t.redeemModal.product.paymentButton})]})})};export{B as Success};
1
+ import{jsx as e,jsxs as y}from"react/jsx-runtime";import{Button as u,Text as t}from"@anker-in/headless-ui";import d from"classnames";import{ProductInfo as f}from"./ProductInfo";import{useHeadlessContext as b}from"@anker-in/lib";import{ROUNDED_BRANDS as v}from"../../../../constants";const T=({copy:o,shippingProduct:m,loading:s,address:a,disabled:p,onClose:l,item:n})=>{const{brand:r}=b(),i=v.includes(r);return e("div",{className:d("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:y("div",{className:"flex flex-col items-center",children:[e("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:o.product.successDesc.map((x,c)=>e(t,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:x},c))}),m&&e(t,{className:"mb-5 text-[16px] font-bold",html:m}),e("div",{className:d("flex w-full items-center bg-[#F5F5F7] p-[16px]",!i&&"rounded-none"),children:e(f,{item:n,copy:o})}),e(u,{loading:s||!a,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:l,disabled:p,children:o.product.paymentButton})]})})};export{T as Success};
2
2
  //# sourceMappingURL=Success.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx"],
4
- "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype SuccessProps = {\n copy: CreditsRedeemListCopy\n shippingProduct: string\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n onClose: () => void\n item: RedeemableItemType\n}\n\nexport const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n return (\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div className=\"flex flex-col items-center\">\n <div className=\"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]\">\n {copy.redeemModal.product.successDesc.map((description: string, index: number) => (\n <Text key={index} className=\"text-[18px] font-bold leading-[1.4] md:text-[14px]\" html={description}></Text>\n ))}\n </div>\n\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n <ProductInfo item={item} copy={copy} />\n </div>\n\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={onClose}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAuBM,OAGM,OAAAA,EAHN,QAAAC,MAAA,oBAvBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aAGvB,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,kBAAAC,MAAsB,wBAYxB,MAAMC,EAAU,CAAC,CAAE,KAAAC,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,EAAIV,EAAmB,EAC/BW,EAAUV,EAAe,SAASS,CAAK,EAC7C,OACEhB,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,wDACZ,SAAAS,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACS,EAAqBC,IAC9DnB,EAACG,EAAA,CAAiB,UAAU,qDAAqD,KAAMe,GAA5EC,CAAyF,CACrG,EACH,EAECT,GAAmBV,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMO,EAAiB,EAExFV,EAAC,OAAI,UAAWI,EAAW,iDAAkD,CAACa,GAAW,cAAc,EACrG,SAAAjB,EAACK,EAAA,CAAY,KAAMU,EAAM,KAAMN,EAAM,EACvC,EAEAT,EAACE,EAAA,CACC,QAASS,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF,CAEJ",
4
+ "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { ProductInfo } from './ProductInfo'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype SuccessProps = {\n copy: RedeemModalCommon\n shippingProduct: string\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n onClose: () => void\n item: RedeemableItemType\n}\n\nexport const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n return (\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div className=\"flex flex-col items-center\">\n <div className=\"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]\">\n {copy.product.successDesc.map((description: string, index: number) => (\n <Text key={index} className=\"text-[18px] font-bold leading-[1.4] md:text-[14px]\" html={description}></Text>\n ))}\n </div>\n\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n <ProductInfo item={item} copy={copy} />\n </div>\n\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={onClose}\n disabled={disabled}\n >\n {copy.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAsBM,OAGM,OAAAA,EAHN,QAAAC,MAAA,oBAtBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aAEvB,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,kBAAAC,MAAsB,wBAYxB,MAAMC,EAAU,CAAC,CAAE,KAAAC,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,EAAIV,EAAmB,EAC/BW,EAAUV,EAAe,SAASS,CAAK,EAC7C,OACEhB,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,wDACZ,SAAAS,EAAK,QAAQ,YAAY,IAAI,CAACS,EAAqBC,IAClDnB,EAACG,EAAA,CAAiB,UAAU,qDAAqD,KAAMe,GAA5EC,CAAyF,CACrG,EACH,EAECT,GAAmBV,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMO,EAAiB,EAExFV,EAAC,OAAI,UAAWI,EAAW,iDAAkD,CAACa,GAAW,cAAc,EACrG,SAAAjB,EAACK,EAAA,CAAY,KAAMU,EAAM,KAAMN,EAAM,EACvC,EAEAT,EAACE,EAAA,CACC,QAASS,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,QAAQ,cAChB,GACF,EACF,CAEJ",
6
6
  "names": ["jsx", "jsxs", "Button", "Text", "classNames", "ProductInfo", "useHeadlessContext", "ROUNDED_BRANDS", "Success", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "brand", "rounded", "description", "index"]
7
7
  }
@@ -1,10 +1,9 @@
1
1
  import { AlpcErrorCode } from '../../context/const';
2
- import type { ModalContainerProps } from '../../modal/modalContainer';
3
- import type { RedeemableItem as RedeemableItemType } from '../../type';
4
- import { CreditsRedeemListCopy } from '../type';
5
- type RedeemProductModalProps = ModalContainerProps & {
2
+ import type { ModalContainerProps } from '../../modal/ModalContainer';
3
+ import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type';
4
+ type RedeemProductModalProps = Omit<ModalContainerProps, 'isOpen'> & {
6
5
  item: RedeemableItemType;
7
- copy: CreditsRedeemListCopy;
6
+ copy: RedeemModalCommon;
8
7
  onError: (code: AlpcErrorCode) => void;
9
8
  };
10
9
  declare function RedeemProductModal({ item, copy, onError, ...props }: RedeemProductModalProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import{jsx as u,jsxs as X}from"react/jsx-runtime";import R from"classnames";import{useCallback as F,useEffect as K,useMemo as _,useState as l}from"react";import{useCreditsContext as A}from"../../context/provider";import k from"../../context/hooks/useCountries";import{AlpcErrorCode as c}from"../../context/const";import{useAddressValidate as T}from"../../context/hooks/useAddressValidate";import{useRedeemProduct as B}from"../../context/hooks/useRedeemProduct";import{CreditsModalContainer as G}from"../../modal/modalContainer";import{useHeadlessContext as H}from"@anker-in/lib";import{Error as J}from"./Error";import{Success as V}from"./Success";import{Address as z}from"./Address";import{Init as Q}from"./Init";function W({item:s,copy:e,onError:h,...m}){const{fetchCreditInfo:E,profile:I}=A(),{storeDomain:N,locale:y}=H(),{pageCommon:L}=A(),{shippingAddress:S,shippingProduct:v}=e.redeemModal.product,[d,i]=l("init"),[t,x]=l(),[U,n]=l({code:0,message:"",imageUrl:""}),[f,a]=l(!1),{countries:b=[],isLoading:Y}=k({shopifyStoreDomain:N}),{isMutating:p,trigger:P}=B({onSuccess(r){if(!r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""});return}if(r?.code===0)E(I?.user_id),i("success");else{let o,M;r.code===c.CodeLpcShopifyCouponRuleRedeemLimit?(o=e.redeemModal.redeemLimitError,a(!0)):r.code===c.CodeLpcRuleInventoryNotEnough?(o=e.redeemModal.inventoryNotEnough,a(!0),M=e.redeemModal.inventoryNotEnough):r.code===c.CodeLpcNotEnoughCredits?(o=e.redeemModal.creditsNotEnough,a(!0),E(I?.user_id)):r.code===c.CodeCrossSiteError&&(o=e.redeemModal.crossSiteError,a(!0)),i("error"),n({code:r.code,imageUrl:M||e.redeemModal.errorImageUrl||"",message:o||e.redeemModal.commonError||""}),h&&h(r.code)}},onError(r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""})}}),g=_(()=>e?.redeemModal.product.form?.flat().find(o=>o.type==="state")?.key,[e?.redeemModal.product.form]),{validate:C,errors:O}=T({address:t,validatorInfo:L?.validatorInfo,formData:e?.redeemModal.product.form?.flat()||[],errorLabel:{require:e.redeemModal.product.required,email:e.redeemModal.product.invalidEmail}}),q=F(async()=>{const r=[];if(g&&((b.find(w=>w.code===t.country)?.provinces||[]).length||r.push(g)),C({force:!0,ignoreKeys:r}))return;let o={...t};o.name&&delete o.name,o.country==="UK"&&(o.country="GB"),P({address:btoa(JSON.stringify(o)),rule_id:Number(s.alpc?.id)})},[s,P,g,C,t,b]);return K(()=>{m.isOpen||(a(!1),n({code:0,message:"",imageUrl:""}))},[m.isOpen,y]),X(G,{...m,className:R("w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]",d!=="init"&&"w-[740px] md:w-full"),scrollClassName:"mb-0 min-l:px-0 md:mb-0 px-0",titleClassName:R("h-[56px]",d==="init"&&"bg-[#F5F5F7]"),title:d==="address"?"Order Confirmation":"",children:[d==="error"&&u(J,{errorInfo:U}),d==="success"&&u(V,{copy:e,shippingProduct:v,loading:p,address:t,disabled:f,onClose:m.onClose,item:s}),d==="address"&&u(z,{copy:e,shippingAddress:S,setAddress:x,validateAddress:C,validateErrors:O,shippingProduct:v,loading:p,address:t,disabled:f,handlePayment:q,item:s}),d==="init"&&u(Q,{item:s,copy:e,loading:p,disabled:f,setStatus:i})]})}var ce=W;export{ce as default};
1
+ import{jsx as u,jsxs as W}from"react/jsx-runtime";import A from"classnames";import{useCallback as q,useEffect as w,useMemo as F,useState as m}from"react";import{useCreditsContext as K}from"../../context/provider";import _ from"../../context/hooks/useCountries";import{AlpcErrorCode as l}from"../../context/const";import{useAddressValidate as k}from"../../context/hooks/useAddressValidate";import{useRedeemProduct as T}from"../../context/hooks/useRedeemProduct";import{CreditsModalContainer as B}from"../../modal/ModalContainer";import{useHeadlessContext as G}from"@anker-in/lib";import{Error as H}from"./Error";import{Success as J}from"./Success";import{Address as V}from"./Address";import{Init as z}from"./Init";function Q({item:s,copy:e,onError:h,...E}){const{fetchCreditInfo:I,profile:v,pageCommon:N}=K(),{storeDomain:S}=G(),{shippingAddress:x,shippingProduct:b}=e.product,[t,d]=m("init"),[i,M]=m(),[U,a]=m({code:0,message:"",imageUrl:""}),[c,n]=m(!1),{countries:P=[],isLoading:X}=_({shopifyStoreDomain:S}),{isMutating:f,trigger:R}=T({onSuccess(r){if(!r){d("error"),a({code:0,imageUrl:e.errorImageUrl||"",message:e.commonError||""});return}if(r?.code===0)I(v?.user_id),d("success");else{let o,C;r.code===l.CodeLpcShopifyCouponRuleRedeemLimit?(o=e.redeemLimitError,n(!0)):r.code===l.CodeLpcRuleInventoryNotEnough?(o=e.inventoryNotEnough,n(!0),C=e.inventoryNotEnough):r.code===l.CodeLpcNotEnoughCredits?(o=e.creditsNotEnough,n(!0),I(v?.user_id)):r.code===l.CodeCrossSiteError&&(o=e.crossSiteError,n(!0)),d("error"),a({code:r.code,imageUrl:C||e.errorImageUrl||"",message:o||e.commonError||""}),h&&h(r.code)}},onError(r){d("error"),a({code:0,imageUrl:e.errorImageUrl||"",message:e.commonError||""})}}),p=F(()=>e?.product.form?.flat().find(o=>o.type==="state")?.key,[e?.product.form]),{validate:g,errors:y}=k({address:i,validatorInfo:N?.validatorInfo,formData:e?.product.form?.flat()||[],errorLabel:{require:e.product.required,email:e.product.invalidEmail}}),L=q(async()=>{const r=[];if(p&&((P.find(O=>O.code===i.country)?.provinces||[]).length||r.push(p)),g({force:!0,ignoreKeys:r}))return;let o={...i};o.name&&delete o.name,o.country==="UK"&&(o.country="GB"),R({address:btoa(JSON.stringify(o)),rule_id:Number(s.alpc?.id)})},[s,R,p,g,i,P]);return w(()=>()=>{n(!1),a({code:0,message:"",imageUrl:""}),d("init"),M(void 0)},[]),W(B,{...E,isOpen:!!s,className:A("w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]",t!=="init"&&"w-[740px] md:w-full"),scrollClassName:"mb-0 min-l:px-0 md:mb-0 px-0",titleClassName:A("h-[56px]",t==="init"&&"bg-[#F5F5F7]"),title:t==="address"?"Order Confirmation":"",children:[t==="error"&&u(H,{errorInfo:U}),t==="success"&&u(J,{copy:e,shippingProduct:b,loading:f,address:i,disabled:c,onClose:E.onClose,item:s}),t==="address"&&u(V,{copy:e,shippingAddress:x,setAddress:M,validateAddress:g,validateErrors:y,shippingProduct:b,loading:f,address:i,disabled:c,handlePayment:L,item:s}),t==="init"&&u(z,{item:s,copy:e,loading:f,disabled:c,setStatus:d})]})}var ae=Q;export{ae as default};
2
2
  //# sourceMappingURL=index.js.map