@anker-in/campaign-ui 0.3.5 → 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 (328) hide show
  1. package/dist/cjs/components/credits/context/const.d.ts +10 -2
  2. package/dist/cjs/components/credits/context/const.js +1 -1
  3. package/dist/cjs/components/credits/context/const.js.map +2 -2
  4. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
  5. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
  6. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
  7. package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
  8. package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
  9. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
  10. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +2 -0
  11. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
  12. package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
  13. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
  14. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  15. package/dist/cjs/components/credits/context/provider.d.ts +5 -1
  16. package/dist/cjs/components/credits/context/provider.js +1 -1
  17. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  18. package/dist/cjs/components/credits/context/response.d.ts +1 -0
  19. package/dist/cjs/components/credits/context/response.js.map +1 -1
  20. package/dist/cjs/components/credits/context/utils/atobID.d.ts +1 -0
  21. package/dist/cjs/components/credits/context/utils/atobID.js +2 -0
  22. package/dist/cjs/components/credits/context/utils/atobID.js.map +7 -0
  23. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
  24. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js +2 -0
  25. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
  26. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
  27. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
  28. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
  29. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
  30. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
  31. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
  32. package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
  33. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +2 -0
  34. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +7 -0
  35. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  36. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +2 -2
  37. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
  38. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +2 -2
  39. package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
  40. package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
  41. package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
  42. package/dist/cjs/components/credits/creditsGoGift/index.d.ts +2 -0
  43. package/dist/cjs/components/credits/creditsGoGift/index.js +2 -0
  44. package/dist/cjs/components/credits/creditsGoGift/index.js.map +7 -0
  45. package/dist/cjs/components/credits/creditsGoGift/type.d.ts +22 -0
  46. package/dist/cjs/components/credits/creditsGoGift/type.js +2 -0
  47. package/dist/cjs/components/credits/creditsGoGift/type.js.map +7 -0
  48. package/dist/cjs/components/credits/creditsGofit/CreditsGofit.d.ts +5 -0
  49. package/dist/cjs/components/credits/creditsGofit/CreditsGofit.js +2 -0
  50. package/dist/cjs/components/credits/creditsGofit/CreditsGofit.js.map +7 -0
  51. package/dist/cjs/components/credits/creditsGofit/index.d.ts +2 -0
  52. package/dist/cjs/components/credits/creditsGofit/index.js +2 -0
  53. package/dist/cjs/components/credits/creditsGofit/index.js.map +7 -0
  54. package/dist/cjs/components/credits/creditsGofit/type.d.ts +22 -0
  55. package/dist/cjs/components/credits/creditsGofit/type.js +2 -0
  56. package/dist/cjs/components/credits/creditsGofit/type.js.map +7 -0
  57. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  58. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  59. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  60. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +2 -2
  61. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  62. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  63. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
  64. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
  65. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
  66. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
  67. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
  68. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
  69. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
  70. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  71. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
  72. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
  73. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  74. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
  75. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
  76. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  77. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
  78. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
  79. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
  80. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
  81. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
  82. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  83. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
  84. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
  85. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  86. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
  87. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
  88. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  89. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  90. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
  91. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
  92. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
  93. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
  94. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
  95. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
  96. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
  97. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
  98. package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
  99. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  100. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  101. package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +11 -0
  102. package/dist/cjs/components/credits/creditsRedeemList/type.js +1 -1
  103. package/dist/cjs/components/credits/creditsRedeemList/type.js.map +1 -1
  104. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  105. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +2 -2
  106. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
  107. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
  108. package/dist/cjs/components/credits/index.d.ts +2 -1
  109. package/dist/cjs/components/credits/index.js +1 -1
  110. package/dist/cjs/components/credits/index.js.map +3 -3
  111. package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +16 -0
  112. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  113. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +3 -3
  114. package/dist/cjs/components/credits/modal/RewardsModal.d.ts +64 -0
  115. package/dist/cjs/components/credits/modal/RewardsModal.js +2 -0
  116. package/dist/cjs/components/credits/modal/RewardsModal.js.map +7 -0
  117. package/dist/cjs/components/credits/modal/activitiesModal.d.ts +1 -1
  118. package/dist/cjs/components/credits/modal/activitiesModal.js +2 -2
  119. package/dist/cjs/components/credits/modal/activitiesModal.js.map +3 -3
  120. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +2 -2
  121. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  122. package/dist/cjs/components/credits/modal/loadingDots.js +1 -1
  123. package/dist/cjs/components/credits/modal/loadingDots.js.map +2 -2
  124. package/dist/cjs/components/credits/modal/modalContainer.js +2 -2
  125. package/dist/cjs/components/credits/modal/modalContainer.js.map +4 -4
  126. package/dist/cjs/components/credits/modal/rulesModal.d.ts +1 -1
  127. package/dist/cjs/components/credits/modal/rulesModal.js +2 -2
  128. package/dist/cjs/components/credits/modal/rulesModal.js.map +3 -3
  129. package/dist/cjs/components/credits/modal/subscribeModal.d.ts +1 -1
  130. package/dist/cjs/components/credits/modal/subscribeModal.js +2 -2
  131. package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
  132. package/dist/cjs/components/credits/modal/tip.js +1 -1
  133. package/dist/cjs/components/credits/modal/tip.js.map +2 -2
  134. package/dist/cjs/components/credits/type.d.ts +67 -5
  135. package/dist/cjs/components/credits/type.js +1 -1
  136. package/dist/cjs/components/credits/type.js.map +1 -1
  137. package/dist/cjs/templates/Credits.d.ts +1 -87
  138. package/dist/cjs/templates/Credits.js +1 -1
  139. package/dist/cjs/templates/Credits.js.map +3 -3
  140. package/dist/cjs/templates/Credits.types.d.ts +96 -0
  141. package/dist/cjs/templates/Credits.types.js +2 -0
  142. package/dist/cjs/templates/Credits.types.js.map +7 -0
  143. package/dist/esm/components/credits/context/const.d.ts +10 -2
  144. package/dist/esm/components/credits/context/const.js +1 -1
  145. package/dist/esm/components/credits/context/const.js.map +2 -2
  146. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
  147. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
  148. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
  149. package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
  150. package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
  151. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
  152. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +2 -0
  153. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
  154. package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
  155. package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
  156. package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  157. package/dist/esm/components/credits/context/provider.d.ts +5 -1
  158. package/dist/esm/components/credits/context/provider.js +1 -1
  159. package/dist/esm/components/credits/context/provider.js.map +3 -3
  160. package/dist/esm/components/credits/context/response.d.ts +1 -0
  161. package/dist/esm/components/credits/context/utils/atobID.d.ts +1 -0
  162. package/dist/esm/components/credits/context/utils/atobID.js +2 -0
  163. package/dist/esm/components/credits/context/utils/atobID.js.map +7 -0
  164. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
  165. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js +2 -0
  166. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
  167. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
  168. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
  169. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
  170. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
  171. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
  172. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
  173. package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
  174. package/dist/esm/components/credits/context/utils/variantGetCoupon.js +2 -0
  175. package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +7 -0
  176. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
  177. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +1 -1
  178. package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
  179. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +1 -1
  180. package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
  181. package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
  182. package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
  183. package/dist/esm/components/credits/creditsGoGift/index.d.ts +2 -0
  184. package/dist/esm/components/credits/creditsGoGift/index.js +2 -0
  185. package/dist/esm/components/credits/creditsGoGift/index.js.map +7 -0
  186. package/dist/esm/components/credits/creditsGoGift/type.d.ts +22 -0
  187. package/dist/esm/components/credits/creditsGoGift/type.js +1 -0
  188. package/dist/esm/components/credits/creditsGoGift/type.js.map +7 -0
  189. package/dist/esm/components/credits/creditsGofit/CreditsGofit.d.ts +5 -0
  190. package/dist/esm/components/credits/creditsGofit/CreditsGofit.js +2 -0
  191. package/dist/esm/components/credits/creditsGofit/CreditsGofit.js.map +7 -0
  192. package/dist/esm/components/credits/creditsGofit/index.d.ts +2 -0
  193. package/dist/esm/components/credits/creditsGofit/index.js +2 -0
  194. package/dist/esm/components/credits/creditsGofit/index.js.map +7 -0
  195. package/dist/esm/components/credits/creditsGofit/type.d.ts +22 -0
  196. package/dist/esm/components/credits/creditsGofit/type.js +1 -0
  197. package/dist/esm/components/credits/creditsGofit/type.js.map +7 -0
  198. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  199. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  200. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
  201. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +1 -1
  202. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
  203. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
  204. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
  205. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
  206. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
  207. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
  208. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
  209. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
  210. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
  211. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  212. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
  213. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
  214. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  215. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
  216. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
  217. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  218. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
  219. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
  220. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
  221. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
  222. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
  223. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  224. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
  225. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
  226. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  227. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
  228. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
  229. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  230. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  231. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
  232. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
  233. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
  234. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
  235. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
  236. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
  237. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
  238. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
  239. package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
  240. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  241. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
  242. package/dist/esm/components/credits/creditsRedeemList/type.d.ts +11 -0
  243. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
  244. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +1 -1
  245. package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
  246. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
  247. package/dist/esm/components/credits/index.d.ts +2 -1
  248. package/dist/esm/components/credits/index.js +1 -1
  249. package/dist/esm/components/credits/index.js.map +3 -3
  250. package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +16 -0
  251. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  252. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
  253. package/dist/esm/components/credits/modal/RewardsModal.d.ts +64 -0
  254. package/dist/esm/components/credits/modal/RewardsModal.js +2 -0
  255. package/dist/esm/components/credits/modal/RewardsModal.js.map +7 -0
  256. package/dist/esm/components/credits/modal/activitiesModal.d.ts +1 -1
  257. package/dist/esm/components/credits/modal/activitiesModal.js +2 -2
  258. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  259. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +2 -2
  260. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +2 -2
  261. package/dist/esm/components/credits/modal/loadingDots.js +1 -1
  262. package/dist/esm/components/credits/modal/loadingDots.js.map +2 -2
  263. package/dist/esm/components/credits/modal/modalContainer.js +2 -2
  264. package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
  265. package/dist/esm/components/credits/modal/rulesModal.d.ts +1 -1
  266. package/dist/esm/components/credits/modal/rulesModal.js +2 -2
  267. package/dist/esm/components/credits/modal/rulesModal.js.map +3 -3
  268. package/dist/esm/components/credits/modal/subscribeModal.d.ts +1 -1
  269. package/dist/esm/components/credits/modal/subscribeModal.js +2 -2
  270. package/dist/esm/components/credits/modal/subscribeModal.js.map +2 -2
  271. package/dist/esm/components/credits/modal/tip.js +1 -1
  272. package/dist/esm/components/credits/modal/tip.js.map +2 -2
  273. package/dist/esm/components/credits/type.d.ts +67 -5
  274. package/dist/esm/templates/Credits.d.ts +1 -87
  275. package/dist/esm/templates/Credits.js +1 -1
  276. package/dist/esm/templates/Credits.js.map +3 -3
  277. package/dist/esm/templates/Credits.types.d.ts +96 -0
  278. package/dist/esm/templates/Credits.types.js +2 -0
  279. package/dist/esm/templates/Credits.types.js.map +7 -0
  280. package/package.json +1 -1
  281. package/src/components/credits/context/const.ts +8 -0
  282. package/src/components/credits/context/hooks/useMyRewards.ts +7 -31
  283. package/src/components/credits/context/hooks/useRedeemGoGift.ts +36 -0
  284. package/src/components/credits/context/hooks/useRedeemableList.ts +13 -19
  285. package/src/components/credits/context/provider.tsx +17 -2
  286. package/src/components/credits/context/response.ts +1 -0
  287. package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +2 -2
  288. package/src/components/credits/creditsCash/CreditsCash.tsx +1 -1
  289. package/src/components/credits/creditsGoGift/CreditsGoGift.tsx +210 -0
  290. package/src/components/credits/creditsGoGift/index.ts +2 -0
  291. package/src/components/credits/creditsGoGift/type.ts +23 -0
  292. package/src/components/credits/creditsInfoCard/index.tsx +5 -28
  293. package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +1 -1
  294. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +39 -17
  295. package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx +77 -0
  296. package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.tsx +86 -0
  297. package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +29 -138
  298. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +5 -6
  299. package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +11 -12
  300. package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +23 -14
  301. package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +11 -9
  302. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +4 -5
  303. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +29 -28
  304. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.tsx +101 -0
  305. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.tsx +65 -0
  306. package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal.tsx +156 -0
  307. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
  308. package/src/components/credits/creditsRedeemList/type.ts +11 -0
  309. package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +2 -2
  310. package/src/components/credits/creditsWaysToGetCredits/type.ts +2 -2
  311. package/src/components/credits/index.ts +2 -1
  312. package/src/components/credits/modal/{activitiesModal.tsx → ActivitiesModal.tsx} +2 -2
  313. package/src/components/credits/modal/{creditsUploadReceiptModal.tsx → CreditsUploadReceiptModal.tsx} +1 -1
  314. package/src/components/credits/modal/{modalContainer.tsx → ModalContainer.tsx} +1 -1
  315. package/src/components/credits/modal/{MyRewardsModal.tsx → RewardsModal.tsx} +145 -103
  316. package/src/components/credits/modal/{rulesModal.tsx → RulesModal.tsx} +1 -1
  317. package/src/components/credits/modal/{subscribeModal.tsx → SubscribeModal.tsx} +1 -1
  318. package/src/components/credits/type.ts +68 -5
  319. package/src/templates/Credits.tsx +110 -142
  320. package/src/templates/Credits.types.ts +110 -0
  321. package/dist/index.d.mts +0 -1305
  322. package/dist/index.d.ts +0 -1305
  323. package/dist/index.js +0 -26656
  324. package/dist/index.js.map +0 -1
  325. package/dist/index.mjs +0 -26641
  326. package/dist/index.mjs.map +0 -1
  327. /package/src/components/credits/modal/{loadingDots.tsx → LoadingDots.tsx} +0 -0
  328. /package/src/components/credits/modal/{tip.tsx → Tip.tsx} +0 -0
@@ -13,7 +13,8 @@ export declare enum ConsumeType {
13
13
  }
14
14
  export declare enum AlpcConsumeType {
15
15
  Coupon = 1,
16
- Product = 2
16
+ Product = 2,
17
+ ExternalProduct = 5
17
18
  }
18
19
  export declare enum TaskType {
19
20
  Program = 1,
@@ -46,7 +47,14 @@ export declare enum RewardType {
46
47
  ApproveFail = 3,
47
48
  Unfulfilled = 4,
48
49
  Fulfilled = 5,
49
- Failed = 6
50
+ Failed = 6,
51
+ GogiftPending = 7,
52
+ GogiftApproved = 8,
53
+ GogiftSecondConfirm = 9,
54
+ GogiftRejected = 10,
55
+ GogiftCallbackPending = 11,
56
+ GogiftCallbackSuccess = 12,
57
+ GogiftCallbackTimeout = 13
50
58
  }
51
59
  export declare enum AlpcErrorCode {
52
60
  CodeLpcRedeemFailed = 180001,
@@ -1,2 +1,2 @@
1
- "use strict";var L=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var z=(h,f)=>{for(var o in f)L(h,o,{get:f[o],enumerable:!0})},j=(h,f,o,x)=>{if(f&&typeof f=="object"||typeof f=="function")for(let n of B(f))!I.call(h,n)&&n!==o&&L(h,n,{get:()=>f[n],enumerable:!(x=O(f,n))||x.enumerable});return h};var q=h=>j(L({},"__esModule",{value:!0}),h);var J={};z(J,{ALPC_COUNTRY_MAP:()=>D,AlpcConsumeType:()=>P,AlpcErrorCode:()=>G,ApprovalStatus:()=>$,ConsumeType:()=>m,CouponType:()=>N,CreditType:()=>U,DTC_TASK_TYPE:()=>F,PRICE_SYMBOL:()=>H,RewardType:()=>M,TaskSubType:()=>d,TaskType:()=>c});module.exports=q(J);var U=(n=>(n[n.All=0]="All",n[n.Earned=1]="Earned",n[n.Deducted=2]="Deducted",n[n.Expired=3]="Expired",n))(U||{}),m=(u=>(u.Coupon="coupon",u.GiftCard="giftCard",u.GoGift="goGift",u.Product="product",u.ShippingCoupon="shippingCoupon",u))(m||{}),P=(o=>(o[o.Coupon=1]="Coupon",o[o.Product=2]="Product",o))(P||{}),c=(x=>(x[x.Program=1]="Program",x[x.Operation=2]="Operation",x[x.Redeem=3]="Redeem",x))(c||{}),F=(x=>(x.FirstPurchase="firstPurchase",x.UploadReceipt="uploadReceipt",x.Shopping="shopping",x))(F||{}),d=(t=>(t[t.Activation=1]="Activation",t[t.UpdateName=2]="UpdateName",t[t.UpdatePhone=3]="UpdatePhone",t[t.UpdateBirthday=4]="UpdateBirthday",t[t.Subscription=5]="Subscription",t[t.UpadteAppName=7]="UpadteAppName",t[t.Refund=3e3]="Refund",t[t.ProductUnApproved=5e3]="ProductUnApproved",t))(d||{}),N=(o=>(o.FixedMount="fixed_amount",o.Percent="percent",o))(N||{}),M=(g=>(g[g.Received=0]="Received",g[g.Pending=1]="Pending",g[g.ApproveSuccess=2]="ApproveSuccess",g[g.ApproveFail=3]="ApproveFail",g[g.Unfulfilled=4]="Unfulfilled",g[g.Fulfilled=5]="Fulfilled",g[g.Failed=6]="Failed",g))(M||{}),G=(i=>(i[i.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",i[i.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",i[i.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",i[i.CodeLpcUnknownError=180004]="CodeLpcUnknownError",i[i.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",i[i.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",i[i.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",i[i.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",i[i.CodeCrossSiteError=180011]="CodeCrossSiteError",i))(G||{});const D=new Map([["eu-en","eu"],["eu-de","de"]]);var $=(n=>(n[n.Pending=0]="Pending",n[n.Success=1]="Success",n[n.Failed=2]="Failed",n[n.DoubleConfirm=3]="DoubleConfirm",n))($||{});const H={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};
1
+ "use strict";var u=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var z=(x,f)=>{for(var c in f)u(x,c,{get:f[c],enumerable:!0})},d=(x,f,c,t)=>{if(f&&typeof f=="object"||typeof f=="function")for(let i of I(f))!j.call(x,i)&&i!==c&&u(x,i,{get:()=>f[i],enumerable:!(t=B(f,i))||t.enumerable});return x};var q=x=>d(u({},"__esModule",{value:!0}),x);var H={};z(H,{ALPC_COUNTRY_MAP:()=>v,AlpcConsumeType:()=>L,AlpcErrorCode:()=>$,ApprovalStatus:()=>O,ConsumeType:()=>G,CouponType:()=>N,CreditType:()=>h,DTC_TASK_TYPE:()=>m,PRICE_SYMBOL:()=>D,RewardType:()=>M,TaskSubType:()=>F,TaskType:()=>U});module.exports=q(H);var h=(i=>(i[i.All=0]="All",i[i.Earned=1]="Earned",i[i.Deducted=2]="Deducted",i[i.Expired=3]="Expired",i))(h||{}),G=(P=>(P.Coupon="coupon",P.GiftCard="giftCard",P.GoGift="goGift",P.Product="product",P.ShippingCoupon="shippingCoupon",P))(G||{}),L=(t=>(t[t.Coupon=1]="Coupon",t[t.Product=2]="Product",t[t.ExternalProduct=5]="ExternalProduct",t))(L||{}),U=(t=>(t[t.Program=1]="Program",t[t.Operation=2]="Operation",t[t.Redeem=3]="Redeem",t))(U||{}),m=(t=>(t.FirstPurchase="firstPurchase",t.UploadReceipt="uploadReceipt",t.Shopping="shopping",t))(m||{}),F=(o=>(o[o.Activation=1]="Activation",o[o.UpdateName=2]="UpdateName",o[o.UpdatePhone=3]="UpdatePhone",o[o.UpdateBirthday=4]="UpdateBirthday",o[o.Subscription=5]="Subscription",o[o.UpadteAppName=7]="UpadteAppName",o[o.Refund=3e3]="Refund",o[o.ProductUnApproved=5e3]="ProductUnApproved",o))(F||{}),N=(c=>(c.FixedMount="fixed_amount",c.Percent="percent",c))(N||{}),M=(n=>(n[n.Received=0]="Received",n[n.Pending=1]="Pending",n[n.ApproveSuccess=2]="ApproveSuccess",n[n.ApproveFail=3]="ApproveFail",n[n.Unfulfilled=4]="Unfulfilled",n[n.Fulfilled=5]="Fulfilled",n[n.Failed=6]="Failed",n[n.GogiftPending=7]="GogiftPending",n[n.GogiftApproved=8]="GogiftApproved",n[n.GogiftSecondConfirm=9]="GogiftSecondConfirm",n[n.GogiftRejected=10]="GogiftRejected",n[n.GogiftCallbackPending=11]="GogiftCallbackPending",n[n.GogiftCallbackSuccess=12]="GogiftCallbackSuccess",n[n.GogiftCallbackTimeout=13]="GogiftCallbackTimeout",n))(M||{}),$=(g=>(g[g.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",g[g.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",g[g.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",g[g.CodeLpcUnknownError=180004]="CodeLpcUnknownError",g[g.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",g[g.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",g[g.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",g[g.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",g[g.CodeCrossSiteError=180011]="CodeCrossSiteError",g))($||{});const v=new Map([["eu-en","eu"],["eu-de","de"]]);var O=(i=>(i[i.Pending=0]="Pending",i[i.Success=1]="Success",i[i.Failed=2]="Failed",i[i.DoubleConfirm=3]="DoubleConfirm",i))(O||{});const D={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};
2
2
  //# sourceMappingURL=const.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/const.ts"],
4
- "sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,mBAAAC,EAAA,gBAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,eAAAC,EAAA,gBAAAC,EAAA,aAAAC,IAAA,eAAAC,EAAAd,GAAO,IAAKQ,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAF,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAH,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,UAFUA,OAAA,IAKAU,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAHUA,OAAA,IAMAJ,OACVA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAHDA,OAAA,IAMAG,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,WAAa,GAAb,aACAA,IAAA,YAAc,GAAd,cACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,aAAe,GAAf,eACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,OAAS,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAL,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAI,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAPUA,OAAA,IAUAP,OACVA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,0BAA4B,QAA5B,4BAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,wBAA0B,QAA1B,0BAEAA,IAAA,mBAAqB,QAArB,qBAEAA,IAAA,8BAAgC,QAAhC,gCAEAA,IAAA,oCAAsC,QAAtC,sCAEAA,IAAA,mBAAqB,QAArB,qBAjBUA,OAAA,IAoBL,MAAMF,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKG,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMK,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN",
4
+ "sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n ExternalProduct = 5,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n GogiftPending = 7,\n GogiftApproved = 8,\n GogiftSecondConfirm = 9,\n GogiftRejected = 10,\n GogiftCallbackPending = 11,\n GogiftCallbackSuccess = 12,\n GogiftCallbackTimeout = 13,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,mBAAAC,EAAA,gBAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,eAAAC,EAAA,gBAAAC,EAAA,aAAAC,IAAA,eAAAC,EAAAd,GAAO,IAAKQ,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAF,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAH,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,UACAA,IAAA,gBAAkB,GAAlB,kBAHUA,OAAA,IAMAU,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAHUA,OAAA,IAMAJ,OACVA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAHDA,OAAA,IAMAG,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,WAAa,GAAb,aACAA,IAAA,YAAc,GAAd,cACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,aAAe,GAAf,eACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,OAAS,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAL,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAI,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,oBAAsB,GAAtB,sBACAA,IAAA,eAAiB,IAAjB,iBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBAdUA,OAAA,IAiBAP,OACVA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,0BAA4B,QAA5B,4BAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,wBAA0B,QAA1B,0BAEAA,IAAA,mBAAqB,QAArB,qBAEAA,IAAA,8BAAgC,QAAhC,gCAEAA,IAAA,oCAAsC,QAAtC,sCAEAA,IAAA,mBAAqB,QAArB,qBAjBUA,OAAA,IAoBL,MAAMF,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKG,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMK,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN",
6
6
  "names": ["const_exports", "__export", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "AlpcErrorCode", "ApprovalStatus", "ConsumeType", "CouponType", "CreditType", "DTC_TASK_TYPE", "PRICE_SYMBOL", "RewardType", "TaskSubType", "TaskType", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,7 @@
1
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
2
+ import { FunctionMemberPriceResult } from '../memberPriceTypes';
3
+ export declare const useFunctionMemberPrice: ({ variant }: {
4
+ variant?: NormalizedProductVariant;
5
+ }) => FunctionMemberPriceResult | (Partial<FunctionMemberPriceResult> & {
6
+ hasMemberPrice: false;
7
+ });
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var b=(r,e)=>{for(var o in e)i(r,o,{get:e[o],enumerable:!0})},f=(r,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!l.call(r,t)&&t!==o&&i(r,t,{get:()=>e[t],enumerable:!(c=P(e,t))||c.enumerable});return r};var M=r=>f(i({},"__esModule",{value:!0}),r);var p={};b(p,{useFunctionMemberPrice:()=>d});module.exports=M(p);var m=require("../utils/getFunctionMemberPrice"),n=require("react"),s=require("../provider"),u=require("@anker-in/lib");const d=({variant:r})=>{const{memberPriceDiscount:e}=(0,s.useCreditsContext)(),{locale:o=""}=(0,u.useHeadlessContext)();return(0,n.useMemo)(()=>{const t=(0,m.getFunctionMemberPrice)({memberPriceDiscount:e,currencyCode:r?.price.currencyCode,variant:r,locale:o});return t||{hasMemberPrice:!1}},[o,e,r])};
2
+ //# sourceMappingURL=useFunctionMemberPrice.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/hooks/useFunctionMemberPrice.ts"],
4
+ "sourcesContent": ["import { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { getFunctionMemberPrice } from '../utils/getFunctionMemberPrice'\nimport { useMemo } from 'react'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const useFunctionMemberPrice = ({ variant }: { variant?: NormalizedProductVariant }) => {\n const { memberPriceDiscount } = useCreditsContext()\n const { locale = '' } = useHeadlessContext()\n\n const memberPrice:\n | FunctionMemberPriceResult\n | (Partial<FunctionMemberPriceResult> & {\n hasMemberPrice: false\n }) = useMemo(() => {\n const result = getFunctionMemberPrice({\n memberPriceDiscount: memberPriceDiscount,\n currencyCode: variant?.price.currencyCode,\n variant,\n locale,\n })\n\n if (result) {\n return result as FunctionMemberPriceResult\n }\n\n return { hasMemberPrice: false }\n }, [locale, memberPriceDiscount, variant])\n\n return memberPrice\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAuC,2CACvCC,EAAwB,iBACxBC,EAAkC,uBAClCC,EAAmC,yBAG5B,MAAML,EAAyB,CAAC,CAAE,QAAAM,CAAQ,IAA8C,CAC7F,KAAM,CAAE,oBAAAC,CAAoB,KAAI,qBAAkB,EAC5C,CAAE,OAAAC,EAAS,EAAG,KAAI,sBAAmB,EAqB3C,SAfS,WAAQ,IAAM,CACrB,MAAMC,KAAS,0BAAuB,CACpC,oBAAqBF,EACrB,aAAcD,GAAS,MAAM,aAC7B,QAAAA,EACA,OAAAE,CACF,CAAC,EAED,OAAIC,GAIG,CAAE,eAAgB,EAAM,CACjC,EAAG,CAACD,EAAQD,EAAqBD,CAAO,CAAC,CAG3C",
6
+ "names": ["useFunctionMemberPrice_exports", "__export", "useFunctionMemberPrice", "__toCommonJS", "import_getFunctionMemberPrice", "import_react", "import_provider", "import_lib", "variant", "memberPriceDiscount", "locale", "result"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var m=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var s in t)m(e,s,{get:t[s],enumerable:!0})},k=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of T(t))!h.call(e,o)&&o!==s&&m(e,o,{get:()=>t[o],enumerable:!(n=N(t,o))||n.enumerable});return e};var v=e=>k(m({},"__esModule",{value:!0}),e);var H={};B(H,{default:()=>E});module.exports=v(H);var r=require("react"),u=require("../const"),f=require("./useAlpcFetch"),C=require("../provider"),y=require("@anker-in/lib");function z({page:e,pageSize:t,consumeType:s}){const{isLoadingProfile:n,profile:o,alpcBrand:R}=(0,C.useCreditsContext)(),{brand:b,locale:p,appName:L}=(0,y.useHeadlessContext)(),A=R||b,M=!!o,[i,l]=(0,r.useState)([]),[_,w]=(0,r.useState)(0),[g,P]=(0,r.useState)(0),{isMutating:a,trigger:c}=(0,f.useAlpcMutation)({url:"/v1/credit/log/coupon",initData:{brand:A,country:u.ALPC_COUNTRY_MAP.get(p)||p,app_name:L}});(0,r.useEffect)(()=>{n||!o||a||e!==g&&e&&c({consume_type:s||u.AlpcConsumeType.Coupon,page:e,page_size:t,user_id:o?.user_id},{onSuccess(d){P(e),w(d?.data?.total),l(i.concat(d?.data?.redeem_logs||[]))}})},[c,i,s,e,t,g,o,n,a]);const x=(0,r.useCallback)(async()=>{n||!M||!o||a||await c({consume_type:s||u.AlpcConsumeType.Coupon,page:e,page_size:t,user_id:o?.user_id},{onSuccess(d){l(d?.data?.redeem_logs||[])}})},[s,a,n,e,t,o,c]);return{myRewards:i,isLoading:a,total:_,getMyRewards:x,canNext:_>i.length&&!a}}var E=z;
1
+ "use strict";var p=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var T=(s,e)=>{for(var t in e)p(s,t,{get:e[t],enumerable:!0})},x=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of w(e))!L.call(s,o)&&o!==t&&p(s,o,{get:()=>e[o],enumerable:!(n=M(e,o))||n.enumerable});return s};var N=s=>x(p({},"__esModule",{value:!0}),s);var B={};T(B,{default:()=>z});module.exports=N(B);var r=require("react"),a=require("../const"),l=require("./useAlpcFetch"),g=require("../provider"),_=require("@anker-in/lib");function h({page:s,pageSize:e,consumeType:t}){const{profile:n,alpcBrand:o}=(0,g.useCreditsContext)(),{brand:f,locale:m,appName:y}=(0,_.useHeadlessContext)(),R=o||f,[i,C]=(0,r.useState)([]),[d,P]=(0,r.useState)(0),{isMutating:c,trigger:b}=(0,l.useAlpcMutation)({url:"/v1/credit/log/coupon",initData:{brand:R,country:a.ALPC_COUNTRY_MAP.get(m)||m,app_name:y}}),u=(0,r.useCallback)(async()=>{n?.user_id&&await b({consume_type:t||a.AlpcConsumeType.Coupon,page:s,page_size:e,user_id:n?.user_id},{onSuccess(A){C(A?.data?.redeem_logs||[])}})},[t,s,e,n?.user_id]);return(0,r.useEffect)(()=>{u()},[u]),{myRewards:i,isLoading:c,total:d,getMyRewards:u,canNext:d>i.length&&!c}}var z=h;
2
2
  //# sourceMappingURL=useMyRewards.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/hooks/useMyRewards.ts"],
4
- "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { isLoadingProfile, profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n const isLogin = !!profile\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const [currentPage, setCurrentPage] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n useEffect(() => {\n if (isLoadingProfile || !profile || isLoading) {\n return\n }\n\n if (page !== currentPage && page) {\n trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setCurrentPage(page)\n setTotal(responseData?.data?.total)\n setMyRewards(myRewards.concat(responseData?.data?.redeem_logs || []))\n },\n }\n )\n }\n }, [trigger, myRewards, consumeType, page, pageSize, currentPage, profile, isLoadingProfile, isLoading])\n\n const getMyRewards = useCallback(async () => {\n if (isLoadingProfile || !isLogin || !profile || isLoading) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n // \u4EC5\u652F\u63011\u9875\u7684\n onSuccess(responseData) {\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, isLoading, isLoadingProfile, page, pageSize, profile, trigger])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAkD,oBAClDC,EAAgC,0BAEhCC,EAAkC,uBAClCC,EAAmC,yBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,iBAAAC,EAAkB,QAAAC,EAAS,UAAAC,CAAU,KAAI,qBAAkB,EAC7D,CAAE,MAAOC,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,KAAI,sBAAmB,EAC/DC,EAAQJ,GAAaC,EACrBI,EAAU,CAAC,CAACN,EAEZ,CAACO,EAAWC,CAAY,KAAI,YAA8B,CAAC,CAAC,EAC5D,CAACC,EAAOC,CAAQ,KAAI,YAAS,CAAC,EAE9B,CAACC,EAAaC,CAAc,KAAI,YAAS,CAAC,EAE1C,CAAE,WAAYC,EAAW,QAAAC,CAAQ,KAAI,mBAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAOT,EACP,QAAS,mBAAiB,IAAIF,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,CAAC,KAED,aAAU,IAAM,CACVL,GAAoB,CAACC,GAAWa,GAIhCjB,IAASe,GAAef,GAC1BkB,EACE,CACE,aAAchB,GAAe,kBAAgB,OAC7C,KAAAF,EACA,UAAWC,EACX,QAASG,GAAS,OACpB,EACA,CACE,UAAUe,EAAc,CACtBH,EAAehB,CAAI,EACnBc,EAASK,GAAc,MAAM,KAAK,EAClCP,EAAaD,EAAU,OAAOQ,GAAc,MAAM,aAAe,CAAC,CAAC,CAAC,CACtE,CACF,CACF,CAEJ,EAAG,CAACD,EAASP,EAAWT,EAAaF,EAAMC,EAAUc,EAAaX,EAASD,EAAkBc,CAAS,CAAC,EAEvG,MAAMG,KAAe,eAAY,SAAY,CACvCjB,GAAoB,CAACO,GAAW,CAACN,GAAWa,GAGhD,MAAMC,EACJ,CACE,aAAchB,GAAe,kBAAgB,OAC7C,KAAAF,EACA,UAAWC,EACX,QAASG,GAAS,OACpB,EACA,CAEE,UAAUe,EAAc,CACtBP,EAAaO,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACjB,EAAae,EAAWd,EAAkBH,EAAMC,EAAUG,EAASc,CAAO,CAAC,EAE/E,MAAO,CACL,UAAAP,EACA,UAAAM,EACA,MAAAJ,EACA,aAAAO,EACA,QAASP,EAAQF,EAAU,QAAU,CAACM,CACxC,CACF,CAEA,IAAOzB,EAAQO",
6
- "names": ["useMyRewards_exports", "__export", "useMyRewards_default", "__toCommonJS", "import_react", "import_const", "import_useAlpcFetch", "import_provider", "import_lib", "useMyRewards", "page", "pageSize", "consumeType", "isLoadingProfile", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "isLogin", "myRewards", "setMyRewards", "total", "setTotal", "currentPage", "setCurrentPage", "isLoading", "trigger", "responseData", "getMyRewards"]
4
+ "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n const getMyRewards = useCallback(async () => {\n if (!profile?.user_id) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, page, pageSize, profile?.user_id])\n\n useEffect(() => {\n getMyRewards()\n }, [getMyRewards])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAkD,oBAClDC,EAAgC,0BAEhCC,EAAkC,uBAClCC,EAAmC,yBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAG,QAAAC,EAAS,UAAAC,CAAU,KAAI,qBAAkB,EAC5C,CAAE,MAAOC,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,KAAI,sBAAmB,EAC/DC,EAAQJ,GAAaC,EAErB,CAACI,EAAWC,CAAY,KAAI,YAA8B,CAAC,CAAC,EAC5D,CAACC,EAAOC,CAAQ,KAAI,YAAS,CAAC,EAE9B,CAAE,WAAYC,EAAW,QAAAC,CAAQ,KAAI,mBAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAON,EACP,QAAS,mBAAiB,IAAIF,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,CAAC,EAEKQ,KAAe,eAAY,SAAY,CACtCZ,GAAS,SAGd,MAAMW,EACJ,CACE,aAAcZ,GAAe,kBAAgB,OAC7C,KAAAF,EACA,UAAWC,EACX,QAASE,GAAS,OACpB,EACA,CACE,UAAUa,EAAc,CACtBN,EAAaM,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACd,EAAaF,EAAMC,EAAUE,GAAS,OAAO,CAAC,EAElD,sBAAU,IAAM,CACdY,EAAa,CACf,EAAG,CAACA,CAAY,CAAC,EAEV,CACL,UAAAN,EACA,UAAAI,EACA,MAAAF,EACA,aAAAI,EACA,QAASJ,EAAQF,EAAU,QAAU,CAACI,CACxC,CACF,CAEA,IAAOrB,EAAQO",
6
+ "names": ["useMyRewards_exports", "__export", "useMyRewards_default", "__toCommonJS", "import_react", "import_const", "import_useAlpcFetch", "import_provider", "import_lib", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData"]
7
7
  }
@@ -0,0 +1,17 @@
1
+ import { type UseMutationConfig } from './useAlpcFetch';
2
+ type RedeemGoGiftResponse = {
3
+ data: {
4
+ id: string;
5
+ };
6
+ msg: string;
7
+ code: number;
8
+ };
9
+ export declare const useRedeemGoGift: (mutationOptions?: UseMutationConfig<RedeemGoGiftResponse>) => {
10
+ isMutating: boolean;
11
+ trigger: (fetchData: {
12
+ user_id?: string;
13
+ rule_id: number;
14
+ }, opts?: UseMutationConfig<RedeemGoGiftResponse>) => Promise<RedeemGoGiftResponse | undefined>;
15
+ data: RedeemGoGiftResponse | undefined;
16
+ };
17
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of u(e))!f.call(t,n)&&n!==o&&s(t,n,{get:()=>e[n],enumerable:!(r=p(e,n))||r.enumerable});return t};var l=t=>g(s({},"__esModule",{value:!0}),t);var R={};c(R,{useRedeemGoGift:()=>G});module.exports=l(R);var i=require("../const"),a=require("./useAlpcFetch"),d=require("@anker-in/lib"),m=require("../provider");const G=(t={})=>{const{alpcBrand:e}=(0,m.useCreditsContext)(),{locale:o,appName:r,brand:n}=(0,d.useHeadlessContext)();return(0,a.useAlpcMutation)({url:"/v1/credit/redeem/gogift",initData:{brand:e||n,country:i.ALPC_COUNTRY_MAP.get(o)||o,app_name:r}},t)};
2
+ //# sourceMappingURL=useRedeemGoGift.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/hooks/useRedeemGoGift.ts"],
4
+ "sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemGoGiftResponse = {\n data: {\n id: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemGoGift = (mutationOptions: UseMutationConfig<RedeemGoGiftResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemGoGiftResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/gogift`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAU3B,MAAML,EAAkB,CAACM,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,CAAU,KAAI,qBAAkB,EAClC,CAAE,OAAAC,EAAQ,QAAAC,EAAS,MAAOC,CAAc,KAAI,sBAAmB,EAGrE,SAAO,mBAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQH,GAAaG,EAarB,QAAS,mBAAiB,IAAIF,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,EACAH,CACF,CACF",
6
+ "names": ["useRedeemGoGift_exports", "__export", "useRedeemGoGift", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
7
+ }
@@ -1,7 +1,12 @@
1
+ import { AlpcConsumeType } from '../const';
1
2
  import type { ConsumeCreditRuleResponse } from '../response';
2
- declare function useRedeemableList(): {
3
+ declare function useRedeemableList(props?: {
4
+ consumeType: AlpcConsumeType;
5
+ }): {
3
6
  listLoading: boolean;
4
7
  redeemableList: ConsumeCreditRuleResponse[];
5
- getRedeemableList: () => void;
8
+ getRedeemableList: (props?: {
9
+ consumeType?: AlpcConsumeType;
10
+ }) => void;
6
11
  };
7
12
  export default useRedeemableList;
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},N=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of P(t))!B.call(e,s)&&s!==r&&d(e,s,{get:()=>t[s],enumerable:!(n=M(t,s))||n.enumerable});return e};var O=e=>N(d({},"__esModule",{value:!0}),e);var k={};D(k,{default:()=>h});module.exports=O(k);var i=require("react"),f=require("./useAlpcFetch"),g=require("../const"),C=require("../provider"),L=require("@anker-in/lib");function U(){let e="";const{profile:t,isLoadingProfile:r,alpcBrand:n}=(0,C.useCreditsContext)(),{locale:s,brand:R}=(0,L.useHeadlessContext)(),b=n||R;s==="pl"?e="eu":e=s;const[x,y]=(0,i.useState)([]),{isMutating:S,trigger:m}=(0,f.useAlpcMutation)({url:"/v1/credit/consume_credit_rules",initData:{brand:b,page:1,page_size:999,country:(g.ALPC_COUNTRY_MAP.get(e)||e)?.toUpperCase()}}),c=(0,i.useCallback)(()=>{m({user_id:t?.user_id},{onSuccess(A){let p=A.data.consume_credit_rules||[],u=p.filter(o=>o.consume_type==1)||[],l=p.filter(o=>o.consume_type==2)||[];u=u.sort((o,a)=>o.consume_credits-a.consume_credits),l=l.sort((o,a)=>o.consume_credits-a.consume_credits);const _=u.concat(l);y(_),localStorage?.setItem(`consume_credit_rules-${e}`,JSON.stringify({expire:Date.now()+10*60*1e3,consume_credit_rules:_}))}})},[t,m,e]);return(0,i.useEffect)(()=>{r||c()},[c,r]),{listLoading:S,redeemableList:x,getRedeemableList:c}}var h=U;
1
+ "use strict";var i=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var M=(s,e)=>{for(var t in e)i(s,t,{get:e[t],enumerable:!0})},P=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of A(e))!x.call(s,o)&&o!==t&&i(s,o,{get:()=>e[o],enumerable:!(r=b(e,o))||r.enumerable});return s};var B=s=>P(i({},"__esModule",{value:!0}),s);var h={};M(h,{default:()=>U});module.exports=B(h);var n=require("react"),a=require("./useAlpcFetch"),d=require("../const"),C=require("../provider"),f=require("@anker-in/lib");function S(s){let e="";const{profile:t,isLoadingProfile:r,alpcBrand:o}=(0,C.useCreditsContext)(),{locale:c,brand:y}=(0,f.useHeadlessContext)(),_=o||y;c==="pl"?e="eu":e=c;const[g,T]=(0,n.useState)([]),{isMutating:R,trigger:l}=(0,a.useAlpcMutation)({url:"/v1/credit/consume_credit_rules",initData:{brand:_,page:1,page_size:999,country:(d.ALPC_COUNTRY_MAP.get(e)||e)?.toUpperCase()}}),u=(0,n.useCallback)(m=>{l({user_id:t?.user_id,...m?.consumeType&&{consume_type:m.consumeType}},{onSuccess(p){console.log("responseData",p);let L=p.data.consume_credit_rules||[];T(L)}})},[t,l,e]);return(0,n.useEffect)(()=>{r||u({consumeType:s?.consumeType})},[u,r]),{listLoading:R,redeemableList:g,getRedeemableList:u}}var U=S;
2
2
  //# sourceMappingURL=useRedeemableList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/context/hooks/useRedeemableList.ts"],
4
- "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList() {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback(() => {\n trigger(\n {\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n let list = responseData.data.consume_credit_rules || []\n let cList = list.filter(i => i.consume_type == 1) || []\n let pList = list.filter(i => i.consume_type == 2) || []\n cList = cList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n pList = pList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n const resultList = cList.concat(pList)\n setRedeemableList(resultList)\n\n localStorage?.setItem(\n `consume_credit_rules-${locale}`,\n JSON.stringify({\n expire: Date.now() + 10 * 60 * 1000,\n consume_credit_rules: resultList,\n })\n )\n },\n }\n )\n }, [profile, trigger, locale])\n\n useEffect(() => {\n if (!isLoadingProfile) {\n getRedeemableList()\n }\n }, [getRedeemableList, isLoadingProfile])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAgC,0BAChCC,EAAiC,oBACjCC,EAAkC,uBAElCC,EAAmC,yBAEnC,SAASC,GAAoB,CAC3B,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,CAAU,KAAI,qBAAkB,EAC7D,CAAE,OAAQC,EAAe,MAAOC,CAAc,KAAI,sBAAmB,EACrEC,EAAQH,GAAaE,EAEvBD,IAAkB,KACpBJ,EAAS,KAETA,EAASI,EAGX,KAAM,CAACG,EAAgBC,CAAiB,KAAI,YAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYC,EAAa,QAAAC,CAAQ,KAAI,mBAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAJ,EACA,KAAM,EACN,UAAW,IACX,SAAU,mBAAiB,IAAIN,CAAM,GAAKA,IAAS,YAAY,CACjE,CACF,CAAC,EAEKW,KAAoB,eAAY,IAAM,CAC1CD,EACE,CACE,QAAST,GAAS,OACpB,EACA,CACE,UAAUW,EAAc,CACtB,IAAIC,EAAOD,EAAa,KAAK,sBAAwB,CAAC,EAClDE,EAAQD,EAAK,OAAOE,GAAKA,EAAE,cAAgB,CAAC,GAAK,CAAC,EAClDC,EAAQH,EAAK,OAAOE,GAAKA,EAAE,cAAgB,CAAC,GAAK,CAAC,EACtDD,EAAQA,EAAM,KAAK,CAACG,EAAMC,IAASD,EAAK,gBAAkBC,EAAK,eAAe,EAC9EF,EAAQA,EAAM,KAAK,CAACC,EAAMC,IAASD,EAAK,gBAAkBC,EAAK,eAAe,EAC9E,MAAMC,EAAaL,EAAM,OAAOE,CAAK,EACrCR,EAAkBW,CAAU,EAE5B,cAAc,QACZ,wBAAwBnB,CAAM,GAC9B,KAAK,UAAU,CACb,OAAQ,KAAK,IAAI,EAAI,GAAK,GAAK,IAC/B,qBAAsBmB,CACxB,CAAC,CACH,CACF,CACF,CACF,CACF,EAAG,CAAClB,EAASS,EAASV,CAAM,CAAC,EAE7B,sBAAU,IAAM,CACTE,GACHS,EAAkB,CAEtB,EAAG,CAACA,EAAmBT,CAAgB,CAAC,EAEjC,CACL,YAAAO,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOnB,EAAQO",
6
- "names": ["useRedeemableList_exports", "__export", "useRedeemableList_default", "__toCommonJS", "import_react", "import_useAlpcFetch", "import_const", "import_provider", "import_lib", "useRedeemableList", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "cList", "i", "pList", "prev", "next", "resultList"]
4
+ "sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList(props?: { consumeType: AlpcConsumeType }) {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { consume_type?: AlpcConsumeType, user_id?: string}\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback((props?: { consumeType?: AlpcConsumeType}) => {\n trigger(\n {\n user_id: profile?.user_id,\n ...(props?.consumeType && {consume_type: props.consumeType})\n },\n {\n onSuccess(responseData) {\n console.log('responseData', responseData)\n let list = responseData.data.consume_credit_rules || []\n // let cList = list.filter(i => i.consume_type == 1) || []\n // let pList = list.filter(i => i.consume_type == 2) || []\n // cList = cList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n // pList = pList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n // const resultList = cList.concat(pList)\n setRedeemableList(list)\n },\n }\n )\n }, [profile, trigger, locale])\n\n useEffect(() => {\n if (!isLoadingProfile) {\n getRedeemableList({ consumeType: props?.consumeType })\n }\n }, [getRedeemableList, isLoadingProfile])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAgC,0BAChCC,EAAkD,oBAClDC,EAAkC,uBAElCC,EAAmC,yBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,CAAU,KAAI,qBAAkB,EAC7D,CAAE,OAAQC,EAAe,MAAOC,CAAc,KAAI,sBAAmB,EACrEC,EAAQH,GAAaE,EAEvBD,IAAkB,KACpBJ,EAAS,KAETA,EAASI,EAGX,KAAM,CAACG,EAAgBC,CAAiB,KAAI,YAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYC,EAAa,QAAAC,CAAQ,KAAI,mBAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAJ,EACA,KAAM,EACN,UAAW,IACX,SAAU,mBAAiB,IAAIN,CAAM,GAAKA,IAAS,YAAY,CACjE,CACF,CAAC,EAEKW,KAAoB,eAAaZ,GAA6C,CAClFW,EACE,CACE,QAAST,GAAS,QAClB,GAAIF,GAAO,aAAe,CAAC,aAAcA,EAAM,WAAW,CAC5D,EACA,CACE,UAAUa,EAAc,CACtB,QAAQ,IAAI,eAAgBA,CAAY,EACxC,IAAIC,EAAOD,EAAa,KAAK,sBAAwB,CAAC,EAMtDJ,EAAkBK,CAAI,CACxB,CACF,CACF,CACF,EAAG,CAACZ,EAASS,EAASV,CAAM,CAAC,EAE7B,sBAAU,IAAM,CACTE,GACHS,EAAkB,CAAE,YAAaZ,GAAO,WAAY,CAAC,CAEzD,EAAG,CAACY,EAAmBT,CAAgB,CAAC,EAEjC,CACL,YAAAO,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOpB,EAAQO",
6
+ "names": ["useRedeemableList_exports", "__export", "useRedeemableList_default", "__toCommonJS", "import_react", "import_useAlpcFetch", "import_const", "import_provider", "import_lib", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list"]
7
7
  }
@@ -35,8 +35,12 @@ type Context = {
35
35
  discountCodes?: string[];
36
36
  }) => void | Promise<any>;
37
37
  };
38
+ openMyRewardsModal: boolean;
39
+ setOpenMyRewardsModal: (open: boolean) => void;
40
+ openActivitiesModal: boolean;
41
+ setOpenActivitiesModal: (open: boolean) => void;
38
42
  };
39
43
  export declare const CreditsContext: import("react").Context<Context>;
40
- export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Context>): import("react/jsx-runtime").JSX.Element;
44
+ export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>): import("react/jsx-runtime").JSX.Element;
41
45
  export declare function useCreditsContext(): Context;
42
46
  export {};
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var I=(e,o)=>{for(var n in o)s(e,n,{get:o[n],enumerable:!0})},h=(e,o,n,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of T(o))!b.call(e,r)&&r!==n&&s(e,r,{get:()=>o[r],enumerable:!(t=x(o,r))||t.enumerable});return e};var S=e=>h(s({},"__esModule",{value:!0}),e);var L={};I(L,{CreditsContext:()=>d,CreditsProvider:()=>_,useCreditsContext:()=>A});module.exports=S(L);var p=require("react/jsx-runtime"),i=require("react");const d=(0,i.createContext)({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:"",pageHandle:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0,cartConfig:void 0});function _({children:e,profile:o,removeProfile:n,isLoadingProfile:t,openSignInPopup:r,openSignUpPopup:a,taskIdToTypeMapping:g,creditInfo:u,customer:C,customerLoading:m,fetchCreditInfo:f,gtm:c,pageCommon:P,memberPriceDiscount:l,alpcBrand:v,cartConfig:y}){return(0,p.jsx)(d.Provider,{value:{profile:o,isLoadingProfile:t,removeProfile:n,openSignInPopup:r,openSignUpPopup:a,taskIdToTypeMapping:g,creditInfo:u,fetchCreditInfo:f,customer:C,customerLoading:m,gtm:c,pageCommon:P,memberPriceDiscount:l,alpcBrand:v,cartConfig:y},children:e})}function A(){const e=(0,i.useContext)(d);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}
1
+ "use strict";var s=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var I=(e,o)=>{for(var i in o)s(e,i,{get:o[i],enumerable:!0})},O=(e,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of w(o))!T.call(e,t)&&t!==i&&s(e,t,{get:()=>o[t],enumerable:!(r=R(o,t))||r.enumerable});return e};var h=e=>O(s({},"__esModule",{value:!0}),e);var L={};I(L,{CreditsContext:()=>a,CreditsProvider:()=>S,useCreditsContext:()=>_});module.exports=h(L);var d=require("react/jsx-runtime"),n=require("react");const a=(0,n.createContext)({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:"",pageHandle:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0,cartConfig:void 0,openMyRewardsModal:!1,setOpenMyRewardsModal:()=>{},openActivitiesModal:!1,setOpenActivitiesModal:()=>{}});function S({children:e,profile:o,removeProfile:i,isLoadingProfile:r,openSignInPopup:t,openSignUpPopup:p,taskIdToTypeMapping:l,creditInfo:c,customer:f,customerLoading:u,fetchCreditInfo:g,gtm:m,pageCommon:C,memberPriceDiscount:M,alpcBrand:v,cartConfig:P}){const[y,b]=(0,n.useState)(!1),[A,x]=(0,n.useState)(!1);return(0,d.jsx)(a.Provider,{value:{profile:o,isLoadingProfile:r,removeProfile:i,openSignInPopup:t,openSignUpPopup:p,taskIdToTypeMapping:l,creditInfo:c,fetchCreditInfo:g,customer:f,customerLoading:u,gtm:m,pageCommon:C,memberPriceDiscount:M,alpcBrand:v,cartConfig:P,openMyRewardsModal:y,setOpenMyRewardsModal:b,openActivitiesModal:A,setOpenActivitiesModal:x},children:e})}function _(){const e=(0,n.useContext)(a);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}
2
2
  //# sourceMappingURL=provider.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/provider.tsx"],
4
- "sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n}: PropsWithChildren<Context>) {\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GA4EI,IAAAM,EAAA,6BA5EJC,EAA6D,iBAqCtD,MAAML,KAAiB,iBAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBM,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,GACX,WAAY,EACd,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,OACX,WAAY,MACd,CAAC,EAEM,SAASL,EAAgB,CAC9B,SAAAM,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAA+B,CAC7B,SACE,OAACtB,EAAe,SAAf,CACC,MAAO,CACL,QAAAQ,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAEC,SAAAf,EACH,CAEJ,CAEO,SAASL,GAAoB,CAClC,MAAMqB,KAAU,cAAWvB,CAAc,EACzC,GAAI,CAACuB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
6
- "names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "context"]
4
+ "sourcesContent": ["import { createContext, PropsWithChildren, useContext, useState } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n openMyRewardsModal: boolean\n setOpenMyRewardsModal: (open: boolean) => void\n openActivitiesModal: boolean\n setOpenActivitiesModal: (open: boolean) => void\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n openMyRewardsModal: false,\n setOpenMyRewardsModal: () => {},\n openActivitiesModal: false,\n setOpenActivitiesModal: () => {},\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n}: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>) {\n const [openMyRewardsModal, setOpenMyRewardsModal] = useState(false)\n const [openActivitiesModal, setOpenActivitiesModal] = useState(false)\n\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n openMyRewardsModal,\n setOpenMyRewardsModal,\n openActivitiesModal,\n setOpenActivitiesModal,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GAuFI,IAAAM,EAAA,6BAvFJC,EAAuE,iBAyChE,MAAML,KAAiB,iBAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBM,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,GACX,WAAY,EACd,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,OACX,WAAY,OACZ,mBAAoB,GACpB,sBAAuB,IAAM,CAAC,EAC9B,oBAAqB,GACrB,uBAAwB,IAAM,CAAC,CACjC,CAAC,EAEM,SAASL,EAAgB,CAC9B,SAAAM,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAAwI,CACtI,KAAM,CAACC,EAAoBC,CAAqB,KAAI,YAAS,EAAK,EAC5D,CAACC,EAAqBC,CAAsB,KAAI,YAAS,EAAK,EAEpE,SACE,OAAC1B,EAAe,SAAf,CACC,MAAO,CACL,QAAAQ,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,EACA,mBAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,uBAAAC,CACF,EAEC,SAAAnB,EACH,CAEJ,CAEO,SAASL,GAAoB,CAClC,MAAMyB,KAAU,cAAW3B,CAAc,EACzC,GAAI,CAAC2B,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
6
+ "names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "context"]
7
7
  }
@@ -44,6 +44,7 @@ export interface RedeemLogResponse extends BaseResponse {
44
44
  approval_status: ApprovalStatus;
45
45
  rule_id: number;
46
46
  code_status: number;
47
+ link?: string;
47
48
  }
48
49
  export interface CreditTaskResponse extends Task {
49
50
  status: number;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/context/response.ts"],
4
- "sourcesContent": ["import { ApprovalStatus, AlpcConsumeType, CreditType, TaskSubType, TaskType } from './const'\n\n// ALPC\u670D\u52A1\u54CD\u5E94\u6570\u636E\u7C7B\u578B\n\ninterface BaseResponse {\n brand: string\n}\n\nexport interface Task extends BaseResponse {\n goods_sku?: string\n task_type: TaskType\n task_sub_type: TaskSubType\n task_rule_id: number\n task_name: string\n task_note: string\n app_name: string\n}\n\n// \u79EF\u5206\u6D41\u6C34\nexport interface CreditLogResponse extends Task {\n credit: number\n task_name: string\n create_time: number\n credit_type: CreditType\n pending_time: number\n status: number\n expired_time?: number\n}\n\nexport interface ConsumeCreditRuleResponse extends BaseResponse {\n id: number\n name: string\n note: string\n consume_credits: number\n consume_type: AlpcConsumeType\n coupon_rule: string\n remaining_inventory: number\n is_limited: number\n sku_handle: string\n goods_sku: string\n goods_url: string\n extra?: string // discount, type\n}\n\nexport interface RedeemLogResponse extends BaseResponse {\n goods_title: string\n coupon_code: string\n order_number: string\n create_time: number\n consume_credits: number\n fulfillment_status: string\n approval_status: ApprovalStatus\n rule_id: number\n code_status: number\n}\n\nexport interface CreditTaskResponse extends Task {\n status: number\n is_enable: number\n id: number\n weight: number\n reward_type: number\n}\n\nexport interface CreditInfoResponse extends BaseResponse {\n total_credit: number\n available_credit: number\n pending_credit: number\n expired_credit: number\n cancel_credit: number\n consumed_credit: number\n}\n"],
4
+ "sourcesContent": ["import { ApprovalStatus, AlpcConsumeType, CreditType, TaskSubType, TaskType } from './const'\n\n// ALPC\u670D\u52A1\u54CD\u5E94\u6570\u636E\u7C7B\u578B\n\ninterface BaseResponse {\n brand: string\n}\n\nexport interface Task extends BaseResponse {\n goods_sku?: string\n task_type: TaskType\n task_sub_type: TaskSubType\n task_rule_id: number\n task_name: string\n task_note: string\n app_name: string\n}\n\n// \u79EF\u5206\u6D41\u6C34\nexport interface CreditLogResponse extends Task {\n credit: number\n task_name: string\n create_time: number\n credit_type: CreditType\n pending_time: number\n status: number\n expired_time?: number\n}\n\nexport interface ConsumeCreditRuleResponse extends BaseResponse {\n id: number\n name: string\n note: string\n consume_credits: number\n consume_type: AlpcConsumeType\n coupon_rule: string\n remaining_inventory: number\n is_limited: number\n sku_handle: string\n goods_sku: string\n goods_url: string\n extra?: string // discount, type\n}\n\nexport interface RedeemLogResponse extends BaseResponse {\n goods_title: string\n coupon_code: string\n order_number: string\n create_time: number\n consume_credits: number\n fulfillment_status: string\n approval_status: ApprovalStatus\n rule_id: number\n code_status: number\n link?: string\n}\n\nexport interface CreditTaskResponse extends Task {\n status: number\n is_enable: number\n id: number\n weight: number\n reward_type: number\n}\n\nexport interface CreditInfoResponse extends BaseResponse {\n total_credit: number\n available_credit: number\n pending_credit: number\n expired_credit: number\n cancel_credit: number\n consumed_credit: number\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["response_exports", "__toCommonJS"]
7
7
  }
@@ -0,0 +1 @@
1
+ export declare function atobID(id: string): string | undefined;
@@ -0,0 +1,2 @@
1
+ "use strict";var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},u=(t,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of f(e))!i.call(t,n)&&n!==r&&s(t,n,{get:()=>e[n],enumerable:!(p=o(e,n))||p.enumerable});return t};var c=t=>u(s({},"__esModule",{value:!0}),t);var a={};l(a,{atobID:()=>g});module.exports=c(a);function g(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}
2
+ //# sourceMappingURL=atobID.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/atobID.ts"],
4
+ "sourcesContent": ["// \u4ECE Shopify GraphQL ID \u4E2D\u63D0\u53D6\u6570\u5B57 ID\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,IAAA,eAAAC,EAAAH,GACO,SAASE,EAAOE,EAAY,CACjC,OAAIA,GAAM,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EAC1CA,EAAG,MAAM,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAEvCA,CAEX",
6
+ "names": ["atobID_exports", "__export", "atobID", "__toCommonJS", "id"]
7
+ }
@@ -0,0 +1,5 @@
1
+ import { DiscountConfig } from '../memberPriceTypes';
2
+ export declare const functionDiscountCalculate: ({ config, price, }: {
3
+ config: DiscountConfig;
4
+ price: number;
5
+ }) => number;
@@ -0,0 +1,2 @@
1
+ "use strict";var p=Object.create;var u=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var k=(e,n)=>{for(var c in n)u(e,c,{get:n[c],enumerable:!0})},s=(e,n,c,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of m(n))!f.call(e,o)&&o!==c&&u(e,o,{get:()=>n[o],enumerable:!(a=_(n,o))||a.enumerable});return e};var w=(e,n,c)=>(c=e!=null?p(b(e)):{},s(n||!e||!e.__esModule?u(c,"default",{value:e,enumerable:!0}):c,e)),D=e=>s(u({},"__esModule",{value:!0}),e);var R={};k(R,{functionDiscountCalculate:()=>g});module.exports=D(R);var i=require("../memberPriceConst"),r=w(require("decimal.js"));const g=({config:e,price:n})=>{const{apply_price_ending:c,one_decimal_place:a,two_decimal_place:o,round_selected:d}=e.price_ending_conf||{};let t=new r.default(n);switch(e.discount_type){case i.FunctionDiscountType.Percentage:t=t.mul(100-e.discount_value).div(100);break;case i.FunctionDiscountType.FixedAmount:t=t.sub(e.discount_value);break;case i.FunctionDiscountType.FixedPrice:t=new r.default(e.discount_value);break;default:break}if(c){switch(d){case i.RoundSelected.RoundHighest:t=t.ceil();break;case i.RoundSelected.RoundLowest:t=t.floor();break;case i.RoundSelected.RoundNearest:t=t.round();break;default:t=new r.default(t.toFixed(2,r.default.ROUND_DOWN));break}const l=t.toString().split(".");t=new r.default(l[0]+"."+a+o)}return t.toNumber()};
2
+ //# sourceMappingURL=functionDiscountCalculate.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/functionDiscountCalculate.ts"],
4
+ "sourcesContent": ["import { FunctionDiscountType, RoundSelected } from '../memberPriceConst'\nimport { DiscountConfig } from '../memberPriceTypes'\nimport Decimal from 'decimal.js'\n\n// Function \u8BA1\u7B97\u6298\u540E\u4EF7\nexport const functionDiscountCalculate = ({\n config,\n price,\n}: {\n config: DiscountConfig\n price: number\n}) => {\n const { apply_price_ending, one_decimal_place, two_decimal_place, round_selected } =\n config.price_ending_conf || {}\n\n let salePrice = new Decimal(price)\n\n switch (config.discount_type) {\n // \u767E\u5206\u6BD4\u6298\u6263\n case FunctionDiscountType.Percentage:\n salePrice = salePrice.mul(100 - config.discount_value).div(100)\n break\n // \u56FA\u5B9A\u91D1\u989D\u6298\u6263\n case FunctionDiscountType.FixedAmount:\n salePrice = salePrice.sub(config.discount_value)\n break\n // \u56FA\u5B9A\u4EF7\u683C\u6298\u6263\n case FunctionDiscountType.FixedPrice:\n salePrice = new Decimal(config.discount_value)\n break\n default:\n break\n }\n\n if (apply_price_ending) {\n // \u5C0F\u6570\u4F4D\u53D6\u820D\n switch (round_selected) {\n case RoundSelected.RoundHighest:\n salePrice = salePrice.ceil()\n break\n case RoundSelected.RoundLowest:\n salePrice = salePrice.floor()\n break\n case RoundSelected.RoundNearest:\n salePrice = salePrice.round()\n break\n default:\n salePrice = new Decimal(salePrice.toFixed(2, Decimal.ROUND_DOWN))\n break\n }\n\n const priceEnding = salePrice.toString().split('.')\n salePrice = new Decimal(priceEnding[0] + '.' + one_decimal_place + two_decimal_place)\n }\n\n return salePrice.toNumber()\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoD,+BAEpDC,EAAoB,yBAGb,MAAMH,EAA4B,CAAC,CACxC,OAAAI,EACA,MAAAC,CACF,IAGM,CACJ,KAAM,CAAE,mBAAAC,EAAoB,kBAAAC,EAAmB,kBAAAC,EAAmB,eAAAC,CAAe,EAC/EL,EAAO,mBAAqB,CAAC,EAE/B,IAAIM,EAAY,IAAI,EAAAC,QAAQN,CAAK,EAEjC,OAAQD,EAAO,cAAe,CAE5B,KAAK,uBAAqB,WACxBM,EAAYA,EAAU,IAAI,IAAMN,EAAO,cAAc,EAAE,IAAI,GAAG,EAC9D,MAEF,KAAK,uBAAqB,YACxBM,EAAYA,EAAU,IAAIN,EAAO,cAAc,EAC/C,MAEF,KAAK,uBAAqB,WACxBM,EAAY,IAAI,EAAAC,QAAQP,EAAO,cAAc,EAC7C,MACF,QACE,KACJ,CAEA,GAAIE,EAAoB,CAEtB,OAAQG,EAAgB,CACtB,KAAK,gBAAc,aACjBC,EAAYA,EAAU,KAAK,EAC3B,MACF,KAAK,gBAAc,YACjBA,EAAYA,EAAU,MAAM,EAC5B,MACF,KAAK,gBAAc,aACjBA,EAAYA,EAAU,MAAM,EAC5B,MACF,QACEA,EAAY,IAAI,EAAAC,QAAQD,EAAU,QAAQ,EAAG,EAAAC,QAAQ,UAAU,CAAC,EAChE,KACJ,CAEA,MAAMC,EAAcF,EAAU,SAAS,EAAE,MAAM,GAAG,EAClDA,EAAY,IAAI,EAAAC,QAAQC,EAAY,CAAC,EAAI,IAAML,EAAoBC,CAAiB,CACtF,CAEA,OAAOE,EAAU,SAAS,CAC5B",
6
+ "names": ["functionDiscountCalculate_exports", "__export", "functionDiscountCalculate", "__toCommonJS", "import_memberPriceConst", "import_decimal", "config", "price", "apply_price_ending", "one_decimal_place", "two_decimal_place", "round_selected", "salePrice", "Decimal", "priceEnding"]
7
+ }
@@ -0,0 +1,8 @@
1
+ import { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes';
2
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
3
+ export declare const getFunctionMemberPrice: ({ memberPriceDiscount, currencyCode, variant, locale, }: {
4
+ memberPriceDiscount?: FunctionMemberPriceConfig[];
5
+ currencyCode?: string;
6
+ variant?: NormalizedProductVariant;
7
+ locale: string;
8
+ }) => false | FunctionMemberPriceResult;
@@ -0,0 +1,2 @@
1
+ "use strict";var M=Object.create;var a=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var U=(i,r)=>{for(var e in r)a(i,e,{get:r[e],enumerable:!0})},b=(i,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of A(r))!_.call(i,o)&&o!==e&&a(i,o,{get:()=>r[o],enumerable:!(t=S(r,o))||t.enumerable});return i};var D=(i,r,e)=>(e=i!=null?M(N(i)):{},b(r||!i||!i.__esModule?a(e,"default",{value:i,enumerable:!0}):e,i)),x=i=>b(a({},"__esModule",{value:!0}),i);var R={};U(R,{getFunctionMemberPrice:()=>z});module.exports=x(R);var n=require("../utils"),d=require("./functionDiscountCalculate"),c=D(require("decimal.js")),v=require("./getFunctionMemberPriceDiscountConfig"),w=D(require("./variantGetCoupon"));const z=({memberPriceDiscount:i,currencyCode:r,variant:e,locale:t})=>{const o=(0,w.default)({variant:e}),{memberPriceDiscountConfig:m,activeMemberPriceConfig:F}=(0,v.getFunctionMemberPriceDiscountConfig)({config:i,variant:e}),p=!!F?.discount_combinations.other_product_discounts;if(!m)return!1;const s={amount:e?.price.amount||0,priceWithCurrency:(0,n.formatPrice)({amount:e?.price.amount||0,currencyCode:r||"USD",locale:t})},u=m?(0,d.functionDiscountCalculate)({config:m,price:e?.price.amount||0}):e?.price.amount||0,C={amount:u,priceWithCurrency:(0,n.formatPrice)({amount:u,currencyCode:r||"USD",locale:t})};let P=u;if(o?.variant_price4wscode&&e&&p)if(p){const f=new c.default(e.price.amount).minus(o.variant_price4wscode);P=new c.default(u).minus(f).toNumber()}else{const f=new c.default(e.price.amount).minus(o.variant_price4wscode);if(u>f.toNumber())return!1}const h={amount:P,priceWithCurrency:(0,n.formatPrice)({amount:P,currencyCode:r||"USD",locale:t})},W=new c.default(s.amount).minus(h.amount).toNumber(),l={amount:W,priceWithCurrency:(0,n.formatPrice)({amount:W,currencyCode:r||"USD",locale:t,maximumFractionDigits:2})},g=new c.default(s.amount).minus(C.amount).toNumber(),y={amount:g,priceWithCurrency:(0,n.formatPrice)({amount:g,currencyCode:r||"USD",locale:t,maximumFractionDigits:2})};return{hasMemberPrice:!!m,useCoupon:p,originalPrice:s.amount,originalPriceWithCurrency:s.priceWithCurrency,salePrice:h.amount,salePriceWithCurrency:h.priceWithCurrency,salePriceWithoutCoupon:C.amount,salePriceWithoutCouponWithCurrency:C.priceWithCurrency,savePrice:l.amount,savePriceWithCurrency:l.priceWithCurrency,savePriceWithoutCoupon:y.amount,savePriceWithoutCouponWithCurrency:y.priceWithCurrency}};
2
+ //# sourceMappingURL=getFunctionMemberPrice.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPrice.ts"],
4
+ "sourcesContent": ["import { formatPrice } from '../utils'\nimport { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { functionDiscountCalculate } from './functionDiscountCalculate'\nimport Decimal from 'decimal.js'\nimport { getFunctionMemberPriceDiscountConfig } from './getFunctionMemberPriceDiscountConfig'\nimport variantGetCoupon from './variantGetCoupon'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const getFunctionMemberPrice = ({\n memberPriceDiscount,\n currencyCode,\n variant,\n locale,\n}: {\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n currencyCode?: string\n variant?: NormalizedProductVariant\n locale: string\n}) => {\n const couponData = variantGetCoupon({ variant })\n\n // variant\u5BF9\u5E94\u7684\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\n const { memberPriceDiscountConfig, activeMemberPriceConfig } = getFunctionMemberPriceDiscountConfig({\n config: memberPriceDiscount,\n variant,\n })\n\n const useCoupon = !!activeMemberPriceConfig?.discount_combinations.other_product_discounts\n\n if (!memberPriceDiscountConfig) {\n return false as false\n }\n\n const originalPrice = {\n amount: variant?.price.amount || 0,\n priceWithCurrency: formatPrice({\n amount: variant?.price.amount || 0,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const salePriceWithoutCouponAmount = memberPriceDiscountConfig\n ? functionDiscountCalculate({\n config: memberPriceDiscountConfig,\n price: variant?.price.amount || 0,\n })\n : variant?.price.amount || 0\n const salePriceWithoutCoupon = {\n amount: salePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n // function \u4F1A\u5458\u4EF7\u662F\u5728\u539F\u4EF7\u7684\u57FA\u7840\u4E0A\u8FDB\u884C\u8BA1\u7B97\uFF0C\u6682\u4E0D\u652F\u6301\u6298\u540E\u4EF7\n let salePriceAmount = salePriceWithoutCouponAmount\n\n // \u51CF\u53BBcode\u7684\u4F18\u60E0\n if (couponData?.variant_price4wscode && variant && useCoupon) {\n if (useCoupon) {\n // code\u7684\u4F18\u60E0\u91D1\u989D\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n salePriceAmount = new Decimal(salePriceWithoutCouponAmount).minus(codeSaveAmountDecimal).toNumber()\n } else {\n // \u4E0D\u80FD\u4E0E code \u540C\u65F6\u4F7F\u7528\uFF0C\u9700\u8981\u5224\u65AD\u4F1A\u5458\u4EF7\u662F\u5426\u5C0F\u4E8E code \u7684\u4F18\u60E0\u91D1\u989D\uFF0C\u5982\u679C\u5C0F\u4E8E\u5219\u5F53\u505A\u6CA1\u6709\u4F1A\u5458\u4EF7\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n if (salePriceWithoutCouponAmount > codeSaveAmountDecimal.toNumber()) {\n return false as false\n }\n }\n }\n\n const salePrice = {\n amount: salePriceAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const savePriceAmount = new Decimal(originalPrice.amount).minus(salePrice.amount).toNumber()\n const savePrice = {\n amount: savePriceAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const savePriceWithoutCouponAmount = new Decimal(originalPrice.amount)\n .minus(salePriceWithoutCoupon.amount)\n .toNumber()\n const savePriceWithoutCoupon = {\n amount: savePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const result: FunctionMemberPriceResult = {\n // \u662F\u5426\u5B58\u5728\u4F1A\u5458\u4EF7\n hasMemberPrice: !!memberPriceDiscountConfig,\n useCoupon,\n // \u539F\u4EF7\n originalPrice: originalPrice.amount,\n originalPriceWithCurrency: originalPrice.priceWithCurrency as string,\n // \u4F7F\u7528\u5238\u540E\u7684\u6298\u540E\u4EF7\n salePrice: salePrice.amount,\n salePriceWithCurrency: salePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u6298\u540E\u4EF7\n salePriceWithoutCoupon: salePriceWithoutCoupon.amount,\n salePriceWithoutCouponWithCurrency: salePriceWithoutCoupon.priceWithCurrency as string,\n\n // \u5305\u542B\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePrice: savePrice.amount,\n savePriceWithCurrency: savePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePriceWithoutCoupon: savePriceWithoutCoupon.amount,\n savePriceWithoutCouponWithCurrency: savePriceWithoutCoupon.priceWithCurrency as string,\n }\n\n return result\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,oBAG5BC,EAA0C,uCAC1CC,EAAoB,yBACpBC,EAAqD,kDACrDC,EAA6B,iCAGtB,MAAMN,EAAyB,CAAC,CACrC,oBAAAO,EACA,aAAAC,EACA,QAAAC,EACA,OAAAC,CACF,IAKM,CACJ,MAAMC,KAAa,EAAAC,SAAiB,CAAE,QAAAH,CAAQ,CAAC,EAGzC,CAAE,0BAAAI,EAA2B,wBAAAC,CAAwB,KAAI,wCAAqC,CAClG,OAAQP,EACR,QAAAE,CACF,CAAC,EAEKM,EAAY,CAAC,CAACD,GAAyB,sBAAsB,wBAEnE,GAAI,CAACD,EACH,MAAO,GAGT,MAAMG,EAAgB,CACpB,OAAQP,GAAS,MAAM,QAAU,EACjC,qBAAmB,eAAY,CAC7B,OAAQA,GAAS,MAAM,QAAU,EACjC,aAAcD,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMO,EAA+BJ,KACjC,6BAA0B,CACxB,OAAQA,EACR,MAAOJ,GAAS,MAAM,QAAU,CAClC,CAAC,EACDA,GAAS,MAAM,QAAU,EACvBS,EAAyB,CAC7B,OAAQD,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcT,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAGA,IAAIS,EAAkBF,EAGtB,GAAIN,GAAY,sBAAwBF,GAAWM,EACjD,GAAIA,EAAW,CAEb,MAAMK,EAAwB,IAAI,EAAAC,QAAQZ,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrGQ,EAAkB,IAAI,EAAAE,QAAQJ,CAA4B,EAAE,MAAMG,CAAqB,EAAE,SAAS,CACpG,KAAO,CAEL,MAAMA,EAAwB,IAAI,EAAAC,QAAQZ,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrG,GAAIM,EAA+BG,EAAsB,SAAS,EAChE,MAAO,EAEX,CAGF,MAAME,EAAY,CAChB,OAAQH,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcX,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMa,EAAkB,IAAI,EAAAF,QAAQL,EAAc,MAAM,EAAE,MAAMM,EAAU,MAAM,EAAE,SAAS,EACrFE,EAAY,CAChB,OAAQD,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcf,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EAEMe,EAA+B,IAAI,EAAAJ,QAAQL,EAAc,MAAM,EAClE,MAAME,EAAuB,MAAM,EACnC,SAAS,EACNQ,EAAyB,CAC7B,OAAQD,EACR,qBAAmB,eAAY,CAC7B,OAAQA,EACR,aAAcjB,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EA0BA,MAxB0C,CAExC,eAAgB,CAAC,CAACG,EAClB,UAAAE,EAEA,cAAeC,EAAc,OAC7B,0BAA2BA,EAAc,kBAEzC,UAAWM,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBJ,EAAuB,OAC/C,mCAAoCA,EAAuB,kBAG3D,UAAWM,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBE,EAAuB,OAC/C,mCAAoCA,EAAuB,iBAC7D,CAGF",
6
+ "names": ["getFunctionMemberPrice_exports", "__export", "getFunctionMemberPrice", "__toCommonJS", "import_utils", "import_functionDiscountCalculate", "import_decimal", "import_getFunctionMemberPriceDiscountConfig", "import_variantGetCoupon", "memberPriceDiscount", "currencyCode", "variant", "locale", "couponData", "variantGetCoupon", "memberPriceDiscountConfig", "activeMemberPriceConfig", "useCoupon", "originalPrice", "salePriceWithoutCouponAmount", "salePriceWithoutCoupon", "salePriceAmount", "codeSaveAmountDecimal", "Decimal", "salePrice", "savePriceAmount", "savePrice", "savePriceWithoutCouponAmount", "savePriceWithoutCoupon"]
7
+ }
@@ -0,0 +1,9 @@
1
+ import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes';
2
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
3
+ export declare const getFunctionMemberPriceDiscountConfig: ({ config, variant, }: {
4
+ config?: FunctionMemberPriceConfig[];
5
+ variant?: NormalizedProductVariant;
6
+ }) => {
7
+ memberPriceDiscountConfig: DiscountConfig | undefined;
8
+ activeMemberPriceConfig: FunctionMemberPriceConfig | undefined;
9
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var s=(n,i)=>{for(var r in i)c(n,r,{get:i[r],enumerable:!0})},g=(n,i,r,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of m(i))!d.call(n,e)&&e!==r&&c(n,e,{get:()=>i[e],enumerable:!(o=u(i,e))||o.enumerable});return n};var b=n=>g(c({},"__esModule",{value:!0}),n);var C={};s(C,{getFunctionMemberPriceDiscountConfig:()=>l});module.exports=b(C);var f=require("./atobID");const l=({config:n,variant:i})=>{let r,o;if(!n||!i)return{memberPriceDiscountConfig:r,activeMemberPriceConfig:o};for(const e of n)if(r=e.result_detail.member_discounts?.find(t=>t.main_products.all_store_variant?t:t.main_products.variants.find(a=>String(a.variant_id)===(0,f.atobID)(i.id)))?.discount_conf,r){o=e;break}return r?{memberPriceDiscountConfig:r,activeMemberPriceConfig:o}:{memberPriceDiscountConfig:r,activeMemberPriceConfig:o}};
2
+ //# sourceMappingURL=getFunctionMemberPriceDiscountConfig.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts"],
4
+ "sourcesContent": ["import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes'\nimport { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { atobID } from './atobID'\n\n// \u83B7\u53D6\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\nexport const getFunctionMemberPriceDiscountConfig = ({\n config,\n variant,\n}: {\n config?: FunctionMemberPriceConfig[]\n variant?: NormalizedProductVariant\n}) => {\n let memberPriceDiscountConfig: DiscountConfig | undefined\n let activeMemberPriceConfig: FunctionMemberPriceConfig | undefined\n\n if (!config || !variant) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n for (const configItem of config) {\n memberPriceDiscountConfig = configItem.result_detail.member_discounts?.find(discountItem => {\n if (discountItem.main_products.all_store_variant) {\n return discountItem\n }\n\n return discountItem.main_products.variants.find(\n variantConfig => String(variantConfig.variant_id) === atobID(variant.id as string)\n )\n })?.discount_conf\n\n if (memberPriceDiscountConfig) {\n activeMemberPriceConfig = configItem\n break\n }\n }\n\n if (!memberPriceDiscountConfig) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0CAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAAuB,oBAGhB,MAAMF,EAAuC,CAAC,CACnD,OAAAG,EACA,QAAAC,CACF,IAGM,CACJ,IAAIC,EACAC,EAEJ,GAAI,CAACH,GAAU,CAACC,EACd,MAAO,CACL,0BAAAC,EACA,wBAAAC,CACF,EAGF,UAAWC,KAAcJ,EAWvB,GAVAE,EAA4BE,EAAW,cAAc,kBAAkB,KAAKC,GACtEA,EAAa,cAAc,kBACtBA,EAGFA,EAAa,cAAc,SAAS,KACzCC,GAAiB,OAAOA,EAAc,UAAU,OAAM,UAAOL,EAAQ,EAAY,CACnF,CACD,GAAG,cAEAC,EAA2B,CAC7BC,EAA0BC,EAC1B,KACF,CAGF,OAAKF,EAOE,CACL,0BAAAA,EACA,wBAAAC,CACF,EATS,CACL,0BAAAD,EACA,wBAAAC,CACF,CAOJ",
6
+ "names": ["getFunctionMemberPriceDiscountConfig_exports", "__export", "getFunctionMemberPriceDiscountConfig", "__toCommonJS", "import_atobID", "config", "variant", "memberPriceDiscountConfig", "activeMemberPriceConfig", "configItem", "discountItem", "variantConfig"]
7
+ }
@@ -0,0 +1,6 @@
1
+ import { NormalizedProductVariant } from '@anker-in/shopify-react';
2
+ declare const variantGetCoupon: ({ variant, channel, }: {
3
+ variant?: NormalizedProductVariant;
4
+ channel?: string;
5
+ }) => any;
6
+ export default variantGetCoupon;
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})},f=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of c(t))!m.call(e,s)&&s!==i&&r(e,s,{get:()=>t[s],enumerable:!(n=l(t,s))||n.enumerable});return e};var w=e=>f(r({},"__esModule",{value:!0}),e);var p={};u(p,{default:()=>g});module.exports=w(p);var d=require("./atobID");const C=({variant:e,channel:t=""})=>{if(!e)return;const i="wsch";return(e?.metafields?.discountCodeApp||[])?.filter(a=>{const o=(0,d.atobID)(e.id);return(!a?.ends_at||new Date(a?.ends_at).getTime()>new Date().getTime())&&new Date(a?.starts_at).getTime()<=new Date().getTime()&&a.variant_shopify_id===+(o||"")&&(t?a?.title?.toLocaleLowerCase().includes(t):!a?.title?.toLocaleLowerCase().includes(i))})?.[0]};var g=C;
2
+ //# sourceMappingURL=variantGetCoupon.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/context/utils/variantGetCoupon.ts"],
4
+ "sourcesContent": ["import { NormalizedProductVariant } from '@anker-in/shopify-react'\nimport { atobID } from './atobID'\n\nconst variantGetCoupon = ({\n variant,\n channel = '',\n}: {\n variant?: NormalizedProductVariant\n channel?: string\n}) => {\n if (!variant) return undefined\n\n const hideChannel = 'wsch'\n const discountCodeApp = variant?.metafields?.discountCodeApp || []\n\n const results = discountCodeApp?.filter((coupon: any) => {\n const variantId = atobID(variant.id as string)\n const isActive =\n (!coupon?.ends_at || new Date(coupon?.ends_at).getTime() > new Date().getTime()) &&\n new Date(coupon?.starts_at).getTime() <= new Date().getTime() &&\n coupon.variant_shopify_id === +(variantId || '')\n\n return (\n isActive &&\n (channel\n ? coupon?.title?.toLocaleLowerCase().includes(channel)\n : !coupon?.title?.toLocaleLowerCase().includes(hideChannel))\n )\n })\n\n return results?.[0]\n}\n\nexport default variantGetCoupon\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAuB,oBAEvB,MAAMC,EAAmB,CAAC,CACxB,QAAAC,EACA,QAAAC,EAAU,EACZ,IAGM,CACJ,GAAI,CAACD,EAAS,OAEd,MAAME,EAAc,OAkBpB,OAjBwBF,GAAS,YAAY,iBAAmB,CAAC,IAEhC,OAAQG,GAAgB,CACvD,MAAMC,KAAY,UAAOJ,EAAQ,EAAY,EAM7C,OAJG,CAACG,GAAQ,SAAW,IAAI,KAAKA,GAAQ,OAAO,EAAE,QAAQ,EAAI,IAAI,KAAK,EAAE,QAAQ,IAC9E,IAAI,KAAKA,GAAQ,SAAS,EAAE,QAAQ,GAAK,IAAI,KAAK,EAAE,QAAQ,GAC5DA,EAAO,qBAAuB,EAAEC,GAAa,MAI5CH,EACGE,GAAQ,OAAO,kBAAkB,EAAE,SAASF,CAAO,EACnD,CAACE,GAAQ,OAAO,kBAAkB,EAAE,SAASD,CAAW,EAEhE,CAAC,IAEgB,CAAC,CACpB,EAEA,IAAON,EAAQG",
6
+ "names": ["variantGetCoupon_exports", "__export", "variantGetCoupon_default", "__toCommonJS", "import_atobID", "variantGetCoupon", "variant", "channel", "hideChannel", "coupon", "variantId"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var F=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var J=(t,l)=>{for(var r in l)F(t,r,{get:l[r],enumerable:!0})},K=(t,l,r,o)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of V(l))!G.call(t,d)&&d!==r&&F(t,d,{get:()=>l[d],enumerable:!(o=q(l,d))||o.enumerable});return t};var Q=t=>K(F({},"__esModule",{value:!0}),t);var X={};J(X,{CreditsAnkersolixTask:()=>W});module.exports=Q(X);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),b=require("@heroicons/react/24/outline"),n=require("react"),f=require("./type"),z=require("../creditsWaysToGetCredits/useActions"),R=require("../context/provider"),c=require("@anker-in/lib"),T=require("../../registration"),M=require("../modal/creditsUploadReceiptModal"),A=require("../modal/subscribeModal"),L=require("../../../constants");const W=({copy:t,classNames:l,id:r})=>{const[o,d]=(0,n.useState)(!1),{profile:U}=(0,R.useCreditsContext)(),{authCodeActivate:O}=(0,T.useRegistration)(),{brand:B}=(0,c.useHeadlessContext)(),h=L.ROUNDED_BRANDS.includes(B),g=!!U,[D,N]=(0,n.useState)(!1),[P,v]=(0,n.useState)(!1),[S,j]=(0,n.useState)(!1),[w,E]=(0,n.useState)(!1),{actions:k}=(0,z.useActions)({copy:t,subscribe:{openSubscribePopup:()=>v(!0),isSuccess:S},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:w}}),p=(t?.list||[]).length>3;(0,n.useEffect)(()=>{if(!o&&p&&window.screen.width<768){const s=setTimeout(()=>{const a=document.getElementById(r||"ankersolix-task");a&&a.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(s)}},[o,p,r]);const _=(0,n.useMemo)(()=>{const s=t.list.map(a=>{if(!k[a.id])return;const{finished:u,notLogin:I,notFinished:C,completed:H}=k[a.id];let x="",m,y;return g?u?(x=H.buttonLabel,m=void 0):(x=C.buttonLabel,m=C.handleClick,y=C.link):(x=I.buttonLabel,m=I.handleClick),{...a,buttonLabel:x,handleClick:m,finished:u,link:y}}).filter(Boolean);return g?s.sort((a,u)=>a?.finished&&!u?.finished?1:!a?.finished&&u?.finished?-1:0):s},[k,t.list,g]);return(0,e.jsxs)(i.Container,{id:r,className:"bg-[#F5F5F7]",children:[(0,e.jsx)(i.Heading,{as:"h2",size:"4",html:t.title}),(0,e.jsxs)("div",{className:(0,c.classNames)("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",h?"rounded-[8px]":"",!h&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),(0,e.jsxs)("div",{className:"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[(0,e.jsx)(i.Heading,{as:"h3",size:4,html:t?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),(0,e.jsx)("div",{className:"flex items-center gap-[8px]",children:(0,e.jsx)("p",{className:"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:t.equalCredits}})})]}),t.mainImage?.url&&(0,e.jsx)(i.Picture,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:t.mainImage.url})]}),(0,e.jsxs)("div",{className:"relative mt-[24px]",children:[(0,e.jsxs)("div",{className:(0,c.classNames)("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out"),style:{height:o||!p?"auto":"512px"},children:[_.map(s=>(0,e.jsxs)("div",{className:(0,c.classNames)("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]",h?"rounded-[16px]":""),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Text,{as:"p",html:s.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),(0,e.jsxs)("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xxl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),s.handleClick&&!(s.id===f.TaskType.UploadReceipt&&w)&&!(s.id===f.TaskType.Activate&&O.isActivateSuccess)&&!(s.id===f.TaskType.Subscribe&&S)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!o&&p&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),p&&(0,e.jsx)(e.Fragment,{children:o?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{d(!1)},children:(0,e.jsx)(b.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>d(!o),children:(0,e.jsx)(b.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),t.receipt&&(0,e.jsx)(M.CreditsUploadReceiptModal,{isOpen:D,onClose:()=>{N(!1)},copy:t.receipt,onSuccess:()=>{E(!0)}}),t.subscribe&&(0,e.jsx)(A.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{j(!0),setTimeout(()=>{v(!1)},3e3)},isOpen:P,onClose:()=>{v(!1)}})]})};
1
+ "use strict";var F=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var J=(t,l)=>{for(var r in l)F(t,r,{get:l[r],enumerable:!0})},K=(t,l,r,o)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of V(l))!G.call(t,d)&&d!==r&&F(t,d,{get:()=>l[d],enumerable:!(o=q(l,d))||o.enumerable});return t};var Q=t=>K(F({},"__esModule",{value:!0}),t);var X={};J(X,{CreditsAnkersolixTask:()=>W});module.exports=Q(X);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),b=require("@heroicons/react/24/outline"),n=require("react"),f=require("./type"),z=require("../creditsWaysToGetCredits/useActions"),R=require("../context/provider"),c=require("@anker-in/lib"),T=require("../../registration"),M=require("../modal/CreditsUploadReceiptModal"),A=require("../modal/SubscribeModal"),L=require("../../../constants");const W=({copy:t,classNames:l,id:r})=>{const[o,d]=(0,n.useState)(!1),{profile:U}=(0,R.useCreditsContext)(),{authCodeActivate:O}=(0,T.useRegistration)(),{brand:B}=(0,c.useHeadlessContext)(),h=L.ROUNDED_BRANDS.includes(B),g=!!U,[D,N]=(0,n.useState)(!1),[P,v]=(0,n.useState)(!1),[S,j]=(0,n.useState)(!1),[w,E]=(0,n.useState)(!1),{actions:k}=(0,z.useActions)({copy:t,subscribe:{openSubscribePopup:()=>v(!0),isSuccess:S},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:w}}),p=(t?.list||[]).length>3;(0,n.useEffect)(()=>{if(!o&&p&&window.screen.width<768){const s=setTimeout(()=>{const a=document.getElementById(r||"ankersolix-task");a&&a.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(s)}},[o,p,r]);const _=(0,n.useMemo)(()=>{const s=t.list.map(a=>{if(!k[a.id])return;const{finished:u,notLogin:I,notFinished:C,completed:H}=k[a.id];let x="",m,y;return g?u?(x=H.buttonLabel,m=void 0):(x=C.buttonLabel,m=C.handleClick,y=C.link):(x=I.buttonLabel,m=I.handleClick),{...a,buttonLabel:x,handleClick:m,finished:u,link:y}}).filter(Boolean);return g?s.sort((a,u)=>a?.finished&&!u?.finished?1:!a?.finished&&u?.finished?-1:0):s},[k,t.list,g]);return(0,e.jsxs)(i.Container,{id:r,className:"bg-[#F5F5F7]",children:[(0,e.jsx)(i.Heading,{as:"h2",size:"4",html:t.title}),(0,e.jsxs)("div",{className:(0,c.classNames)("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",h?"rounded-[8px]":"",!h&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),(0,e.jsxs)("div",{className:"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[(0,e.jsx)(i.Heading,{as:"h3",size:4,html:t?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),(0,e.jsx)("div",{className:"flex items-center gap-[8px]",children:(0,e.jsx)("p",{className:"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:t.equalCredits}})})]}),t.mainImage?.url&&(0,e.jsx)(i.Picture,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:t.mainImage.url})]}),(0,e.jsxs)("div",{className:"relative mt-[24px]",children:[(0,e.jsxs)("div",{className:(0,c.classNames)("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out"),style:{height:o||!p?"auto":"512px"},children:[_.map(s=>(0,e.jsxs)("div",{className:(0,c.classNames)("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]",h?"rounded-[16px]":""),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Text,{as:"p",html:s.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),(0,e.jsxs)("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xxl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),s.handleClick&&!(s.id===f.TaskType.UploadReceipt&&w)&&!(s.id===f.TaskType.Activate&&O.isActivateSuccess)&&!(s.id===f.TaskType.Subscribe&&S)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!o&&p&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),p&&(0,e.jsx)(e.Fragment,{children:o?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{d(!1)},children:(0,e.jsx)(b.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>d(!o),children:(0,e.jsx)(b.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),t.receipt&&(0,e.jsx)(M.CreditsUploadReceiptModal,{isOpen:D,onClose:()=>{N(!1)},copy:t.receipt,onSuccess:()=>{E(!0)}}),t.subscribe&&(0,e.jsx)(A.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{j(!0),setTimeout(()=>{v(!1)},3e3)},isOpen:P,onClose:()=>{v(!1)}})]})};
2
2
  //# sourceMappingURL=CreditsAnkersolixTask.js.map