@anker-in/campaign-ui 0.2.10-beta.9 → 0.2.11-beta.3

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 (918) hide show
  1. package/dist/cjs/components/chat/{chat-context.js → chatContext.js} +1 -1
  2. package/dist/cjs/components/chat/{chat-context.js.map → chatContext.js.map} +2 -2
  3. package/dist/cjs/components/chat/index.js +1 -1
  4. package/dist/cjs/components/chat/index.js.map +3 -3
  5. package/dist/cjs/components/credits/context/const.d.ts +2 -1
  6. package/dist/cjs/components/credits/context/const.js +1 -1
  7. package/dist/cjs/components/credits/context/const.js.map +2 -2
  8. package/dist/cjs/components/credits/context/hooks/useActivities.js +1 -1
  9. package/dist/cjs/components/credits/context/hooks/useActivities.js.map +3 -3
  10. package/dist/cjs/components/credits/context/hooks/useAddressValidate.js +1 -1
  11. package/dist/cjs/components/credits/context/hooks/useAddressValidate.js.map +3 -3
  12. package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js +1 -1
  13. package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js.map +3 -3
  14. package/dist/cjs/components/credits/context/hooks/useCountries.js +1 -1
  15. package/dist/cjs/components/credits/context/hooks/useCountries.js.map +3 -3
  16. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
  17. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
  18. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
  19. package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
  20. package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
  21. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.d.ts +5 -10
  22. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
  23. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js.map +3 -3
  24. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.d.ts +2 -1
  25. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  26. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
  27. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +1 -1
  28. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
  29. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
  30. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  31. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +1 -1
  32. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +3 -3
  33. package/dist/cjs/components/credits/context/hooks/useSubscribed.js +1 -1
  34. package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +3 -3
  35. package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +7 -3
  36. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js +1 -1
  37. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js.map +3 -3
  38. package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js +1 -1
  39. package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js.map +2 -2
  40. package/dist/cjs/components/credits/context/memberPriceConst.d.ts +10 -0
  41. package/dist/cjs/components/credits/context/memberPriceConst.js +2 -0
  42. package/dist/cjs/components/credits/context/memberPriceConst.js.map +7 -0
  43. package/dist/cjs/components/credits/context/memberPriceTypes.d.ts +46 -0
  44. package/dist/cjs/components/credits/context/memberPriceTypes.js +2 -0
  45. package/dist/cjs/components/credits/context/memberPriceTypes.js.map +7 -0
  46. package/dist/cjs/components/credits/context/provider.d.ts +11 -33
  47. package/dist/cjs/components/credits/context/provider.js +1 -1
  48. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  49. package/dist/cjs/components/credits/context/utils/atobID.d.ts +1 -0
  50. package/dist/cjs/components/credits/context/utils/atobID.js +2 -0
  51. package/dist/cjs/components/credits/context/utils/atobID.js.map +7 -0
  52. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
  53. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js +2 -0
  54. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
  55. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
  56. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
  57. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
  58. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
  59. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
  60. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
  61. package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
  62. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +2 -0
  63. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +7 -0
  64. package/dist/cjs/components/credits/context/utils.d.ts +4 -0
  65. package/dist/cjs/components/credits/context/utils.js +1 -1
  66. package/dist/cjs/components/credits/context/utils.js.map +3 -3
  67. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.d.ts +4 -0
  68. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +2 -0
  69. package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +7 -0
  70. package/dist/cjs/components/credits/creditsAnkersolixTask/index.d.ts +2 -0
  71. package/dist/cjs/components/credits/creditsAnkersolixTask/index.js +2 -0
  72. package/dist/cjs/components/credits/creditsAnkersolixTask/index.js.map +7 -0
  73. package/dist/cjs/components/credits/creditsAnkersolixTask/type.d.ts +1 -0
  74. package/dist/cjs/components/credits/creditsAnkersolixTask/type.js +2 -0
  75. package/dist/cjs/components/credits/creditsAnkersolixTask/type.js.map +7 -0
  76. package/dist/cjs/components/credits/creditsBanner/index.d.ts +17 -16
  77. package/dist/cjs/components/credits/creditsBanner/index.js +2 -0
  78. package/dist/cjs/components/credits/creditsBanner/index.js.map +7 -0
  79. package/dist/cjs/components/credits/creditsBenefits/benefitItem.d.ts +4 -1
  80. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +2 -0
  81. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +7 -0
  82. package/dist/cjs/components/credits/{credits-benefits → creditsBenefits}/iconInfo.js +1 -1
  83. package/dist/cjs/components/credits/{credits-benefits → creditsBenefits}/iconInfo.js.map +2 -2
  84. package/dist/cjs/components/credits/creditsBenefits/index.d.ts +12 -9
  85. package/dist/cjs/components/credits/creditsBenefits/index.js +4 -0
  86. package/dist/cjs/components/credits/creditsBenefits/index.js.map +7 -0
  87. package/dist/cjs/components/credits/creditsCash/CreditsCash.d.ts +5 -0
  88. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +2 -0
  89. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +7 -0
  90. package/dist/cjs/components/credits/creditsCash/RedeemableItem.d.ts +1 -7
  91. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +2 -0
  92. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +7 -0
  93. package/dist/cjs/components/credits/creditsCash/index.d.ts +2 -13
  94. package/dist/cjs/components/credits/creditsCash/index.js +2 -0
  95. package/dist/cjs/components/credits/creditsCash/index.js.map +7 -0
  96. package/dist/cjs/components/credits/creditsCash/type.d.ts +2 -4
  97. package/dist/cjs/components/credits/creditsCash/type.js +2 -0
  98. package/dist/cjs/components/credits/creditsCash/type.js.map +7 -0
  99. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
  100. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
  101. package/dist/cjs/components/credits/creditsFaq/index.d.ts +4 -3
  102. package/dist/cjs/components/credits/creditsFaq/index.js +2 -0
  103. package/dist/cjs/components/credits/creditsFaq/index.js.map +7 -0
  104. package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +10 -15
  105. package/dist/cjs/components/credits/creditsInfoCard/index.js +2 -0
  106. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +7 -0
  107. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.d.ts +5 -0
  108. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +2 -0
  109. package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +7 -0
  110. package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.d.ts +7 -0
  111. package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js +2 -0
  112. package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js.map +7 -0
  113. package/dist/cjs/components/credits/creditsMemberPrice/Pagination.d.ts +7 -0
  114. package/dist/cjs/components/credits/creditsMemberPrice/Pagination.js +2 -0
  115. package/dist/cjs/components/credits/creditsMemberPrice/Pagination.js.map +7 -0
  116. package/dist/cjs/components/credits/creditsMemberPrice/index.d.ts +2 -0
  117. package/dist/cjs/components/credits/creditsMemberPrice/index.js +2 -0
  118. package/dist/cjs/components/credits/creditsMemberPrice/index.js.map +7 -0
  119. package/dist/cjs/components/credits/creditsMemberPrice/type.d.ts +64 -0
  120. package/dist/cjs/components/credits/creditsMemberPrice/type.js +2 -0
  121. package/dist/cjs/components/credits/creditsMemberPrice/type.js.map +7 -0
  122. package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.d.ts +4 -0
  123. package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js +2 -0
  124. package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js.map +7 -0
  125. package/dist/cjs/components/credits/creditsNavigation/index.d.ts +2 -0
  126. package/dist/cjs/components/credits/creditsNavigation/index.js +2 -0
  127. package/dist/cjs/components/credits/creditsNavigation/index.js.map +7 -0
  128. package/dist/cjs/components/credits/creditsNavigation/type.d.ts +7 -0
  129. package/dist/cjs/components/credits/creditsNavigation/type.js +2 -0
  130. package/dist/cjs/components/credits/creditsNavigation/type.js.map +7 -0
  131. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
  132. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
  133. package/dist/cjs/components/credits/{credits-redeem-list/address-form/form-item.js → creditsRedeemList/AddressForm/FormItem.js} +1 -1
  134. package/dist/cjs/components/credits/{credits-redeem-list/address-form/form-item.js.map → creditsRedeemList/AddressForm/FormItem.js.map} +2 -2
  135. package/dist/cjs/components/credits/{credits-redeem-list/address-form → creditsRedeemList/AddressForm}/Input.js.map +1 -1
  136. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
  137. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
  138. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
  139. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
  140. package/dist/cjs/components/credits/{credits-redeem-list/address-form → creditsRedeemList/AddressForm}/type.js.map +1 -1
  141. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +5 -0
  142. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
  143. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
  144. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.d.ts +4 -0
  145. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js +2 -0
  146. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
  147. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
  148. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
  149. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
  150. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
  151. package/dist/cjs/components/credits/{credits-redeem-list/redeem-product-modal → creditsRedeemList/RedeemProductModal}/Error.js +1 -1
  152. package/dist/cjs/components/credits/{credits-redeem-list/redeem-product-modal → creditsRedeemList/RedeemProductModal}/Error.js.map +3 -3
  153. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
  154. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
  155. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
  156. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
  157. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
  158. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
  159. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
  160. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
  161. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
  162. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
  163. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
  164. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
  165. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
  166. package/dist/cjs/components/credits/creditsRedeemList/index.d.ts +2 -13
  167. package/dist/cjs/components/credits/creditsRedeemList/index.js +2 -0
  168. package/dist/cjs/components/credits/creditsRedeemList/index.js.map +7 -0
  169. package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +2 -15
  170. package/dist/cjs/components/credits/creditsRedeemList/type.js.map +7 -0
  171. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +4 -0
  172. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
  173. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
  174. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.d.ts +2 -2
  175. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js +2 -0
  176. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
  177. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +5 -16
  178. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js +2 -0
  179. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
  180. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.d.ts +11 -2
  181. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
  182. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
  183. package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +4 -1
  184. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  185. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +3 -3
  186. package/dist/cjs/components/credits/modal/activitiesModal.d.ts +4 -1
  187. package/dist/cjs/components/credits/modal/activitiesModal.js +1 -1
  188. package/dist/cjs/components/credits/modal/activitiesModal.js.map +3 -3
  189. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  190. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  191. package/dist/cjs/components/credits/modal/loadingDots.d.ts +2 -1
  192. package/dist/cjs/components/credits/modal/loadingDots.js +1 -1
  193. package/dist/cjs/components/credits/modal/loadingDots.js.map +3 -3
  194. package/dist/cjs/components/credits/modal/modalContainer.js +1 -1
  195. package/dist/cjs/components/credits/modal/modalContainer.js.map +3 -3
  196. package/dist/cjs/components/credits/modal/rulesModal.js +1 -1
  197. package/dist/cjs/components/credits/modal/rulesModal.js.map +3 -3
  198. package/dist/cjs/components/credits/modal/subscribeModal.d.ts +15 -0
  199. package/dist/cjs/components/credits/modal/subscribeModal.js +2 -0
  200. package/dist/cjs/components/credits/modal/subscribeModal.js.map +7 -0
  201. package/dist/cjs/components/credits/modal/tip.js +1 -1
  202. package/dist/cjs/components/credits/modal/tip.js.map +3 -3
  203. package/dist/cjs/components/credits/type.d.ts +24 -5
  204. package/dist/cjs/components/credits/type.js +1 -1
  205. package/dist/cjs/components/credits/type.js.map +1 -1
  206. package/dist/cjs/components/index.d.ts +2 -1
  207. package/dist/cjs/components/index.js +1 -1
  208. package/dist/cjs/components/index.js.map +2 -2
  209. package/dist/cjs/components/registration/authCodeActivate/Message.d.ts +4 -0
  210. package/dist/cjs/components/registration/authCodeActivate/Message.js +2 -0
  211. package/dist/cjs/components/registration/authCodeActivate/Message.js.map +7 -0
  212. package/dist/cjs/components/registration/authCodeActivate/index.d.ts +3 -0
  213. package/dist/cjs/components/registration/authCodeActivate/index.js +2 -0
  214. package/dist/cjs/components/registration/authCodeActivate/index.js.map +7 -0
  215. package/dist/cjs/components/registration/authCodeActivate/type.d.ts +22 -0
  216. package/dist/cjs/components/registration/authCodeActivate/type.js +2 -0
  217. package/dist/cjs/components/registration/authCodeActivate/type.js.map +7 -0
  218. package/dist/cjs/components/registration/context/index.d.ts +1 -0
  219. package/dist/cjs/components/registration/context/index.js +2 -0
  220. package/dist/cjs/components/registration/context/index.js.map +7 -0
  221. package/dist/cjs/components/registration/context/provider.d.ts +27 -0
  222. package/dist/cjs/components/registration/context/provider.js +2 -0
  223. package/dist/cjs/components/registration/context/provider.js.map +7 -0
  224. package/dist/cjs/components/registration/index.d.ts +2 -0
  225. package/dist/cjs/components/registration/index.js +2 -0
  226. package/dist/cjs/components/registration/index.js.map +7 -0
  227. package/dist/cjs/components/registration/modalContainer.d.ts +14 -0
  228. package/dist/cjs/components/registration/modalContainer.js +2 -0
  229. package/dist/cjs/components/registration/modalContainer.js.map +7 -0
  230. package/dist/cjs/constants.d.ts +1 -0
  231. package/dist/cjs/constants.js +2 -0
  232. package/dist/cjs/constants.js.map +7 -0
  233. package/dist/cjs/debug-env.js +2 -0
  234. package/dist/cjs/debug-env.js.map +7 -0
  235. package/dist/cjs/helpers/fetcher.d.ts +1 -1
  236. package/dist/cjs/helpers/fetcher.js +1 -1
  237. package/dist/cjs/helpers/fetcher.js.map +3 -3
  238. package/dist/cjs/helpers/index.d.ts +2 -2
  239. package/dist/cjs/helpers/index.js +1 -1
  240. package/dist/cjs/helpers/index.js.map +2 -2
  241. package/dist/cjs/helpers/track.d.ts +6 -2
  242. package/dist/cjs/helpers/track.js +1 -1
  243. package/dist/cjs/helpers/track.js.map +3 -3
  244. package/dist/cjs/index.d.ts +3 -2
  245. package/dist/cjs/index.js +1 -726
  246. package/dist/cjs/index.js.map +4 -4
  247. package/dist/cjs/stories/chat.stories.js +2 -0
  248. package/dist/cjs/stories/chat.stories.js.map +7 -0
  249. package/dist/cjs/templates/credits.d.ts +73 -0
  250. package/dist/cjs/templates/credits.js +2 -0
  251. package/dist/cjs/templates/credits.js.map +7 -0
  252. package/dist/cjs/templates/index.d.ts +1 -0
  253. package/dist/cjs/templates/index.js +2 -0
  254. package/dist/cjs/templates/index.js.map +7 -0
  255. package/dist/esm/components/chat/index.js +1 -1
  256. package/dist/esm/components/chat/index.js.map +2 -2
  257. package/dist/esm/components/credits/context/const.d.ts +2 -1
  258. package/dist/esm/components/credits/context/const.js +1 -1
  259. package/dist/esm/components/credits/context/const.js.map +2 -2
  260. package/dist/esm/components/credits/context/hooks/useActivities.js +1 -1
  261. package/dist/esm/components/credits/context/hooks/useActivities.js.map +3 -3
  262. package/dist/esm/components/credits/context/hooks/useAddressValidate.js +1 -1
  263. package/dist/esm/components/credits/context/hooks/useAddressValidate.js.map +3 -3
  264. package/dist/esm/components/credits/context/hooks/useAlpcFetch.js +1 -1
  265. package/dist/esm/components/credits/context/hooks/useAlpcFetch.js.map +3 -3
  266. package/dist/esm/components/credits/context/hooks/useCountries.js +1 -1
  267. package/dist/esm/components/credits/context/hooks/useCountries.js.map +3 -3
  268. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
  269. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
  270. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
  271. package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
  272. package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
  273. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.d.ts +5 -10
  274. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
  275. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +3 -3
  276. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.d.ts +2 -1
  277. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  278. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
  279. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
  280. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
  281. package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
  282. package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  283. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +1 -1
  284. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +3 -3
  285. package/dist/esm/components/credits/context/hooks/useSubscribed.js +1 -1
  286. package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +3 -3
  287. package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +7 -3
  288. package/dist/esm/components/credits/context/hooks/useSubscriptions.js +1 -1
  289. package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +3 -3
  290. package/dist/esm/components/credits/context/hooks/useUploadReceipt.js +1 -1
  291. package/dist/esm/components/credits/context/hooks/useUploadReceipt.js.map +2 -2
  292. package/dist/esm/components/credits/context/memberPriceConst.d.ts +10 -0
  293. package/dist/esm/components/credits/context/memberPriceConst.js +2 -0
  294. package/dist/esm/components/credits/context/memberPriceConst.js.map +7 -0
  295. package/dist/esm/components/credits/context/memberPriceTypes.d.ts +46 -0
  296. package/dist/esm/components/credits/context/memberPriceTypes.js +1 -0
  297. package/dist/esm/components/credits/context/provider.d.ts +11 -33
  298. package/dist/esm/components/credits/context/provider.js +1 -1
  299. package/dist/esm/components/credits/context/provider.js.map +3 -3
  300. package/dist/esm/components/credits/context/utils/atobID.d.ts +1 -0
  301. package/dist/esm/components/credits/context/utils/atobID.js +2 -0
  302. package/dist/esm/components/credits/context/utils/atobID.js.map +7 -0
  303. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
  304. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js +2 -0
  305. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
  306. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
  307. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
  308. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
  309. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
  310. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
  311. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
  312. package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
  313. package/dist/esm/components/credits/context/utils/variantGetCoupon.js +2 -0
  314. package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +7 -0
  315. package/dist/esm/components/credits/context/utils.d.ts +4 -0
  316. package/dist/esm/components/credits/context/utils.js +1 -1
  317. package/dist/esm/components/credits/context/utils.js.map +3 -3
  318. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.d.ts +4 -0
  319. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +2 -0
  320. package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +7 -0
  321. package/dist/esm/components/credits/creditsAnkersolixTask/index.d.ts +2 -0
  322. package/dist/esm/components/credits/creditsAnkersolixTask/index.js +2 -0
  323. package/dist/esm/components/credits/creditsAnkersolixTask/index.js.map +7 -0
  324. package/dist/esm/components/credits/creditsAnkersolixTask/type.d.ts +1 -0
  325. package/dist/esm/components/credits/creditsAnkersolixTask/type.js +2 -0
  326. package/dist/esm/components/credits/creditsAnkersolixTask/type.js.map +7 -0
  327. package/dist/esm/components/credits/creditsBanner/index.d.ts +17 -16
  328. package/dist/esm/components/credits/creditsBanner/index.js +1 -1
  329. package/dist/esm/components/credits/creditsBanner/index.js.map +3 -3
  330. package/dist/esm/components/credits/creditsBenefits/benefitItem.d.ts +4 -1
  331. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +2 -2
  332. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +4 -4
  333. package/dist/esm/components/credits/creditsBenefits/iconInfo.js +1 -1
  334. package/dist/esm/components/credits/creditsBenefits/iconInfo.js.map +2 -2
  335. package/dist/esm/components/credits/creditsBenefits/index.d.ts +12 -9
  336. package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
  337. package/dist/esm/components/credits/creditsBenefits/index.js.map +3 -3
  338. package/dist/esm/components/credits/creditsCash/CreditsCash.d.ts +5 -0
  339. package/dist/esm/components/credits/creditsCash/CreditsCash.js +2 -0
  340. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +7 -0
  341. package/dist/esm/components/credits/creditsCash/RedeemableItem.d.ts +1 -7
  342. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
  343. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  344. package/dist/esm/components/credits/creditsCash/index.d.ts +2 -13
  345. package/dist/esm/components/credits/creditsCash/index.js +1 -1
  346. package/dist/esm/components/credits/creditsCash/index.js.map +4 -4
  347. package/dist/esm/components/credits/creditsCash/type.d.ts +2 -4
  348. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
  349. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +2 -2
  350. package/dist/esm/components/credits/creditsFaq/index.d.ts +4 -3
  351. package/dist/esm/components/credits/creditsFaq/index.js +1 -1
  352. package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
  353. package/dist/esm/components/credits/creditsInfoCard/index.d.ts +10 -15
  354. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  355. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  356. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.d.ts +5 -0
  357. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +2 -0
  358. package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +7 -0
  359. package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.d.ts +7 -0
  360. package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js +2 -0
  361. package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js.map +7 -0
  362. package/dist/esm/components/credits/creditsMemberPrice/Pagination.d.ts +7 -0
  363. package/dist/esm/components/credits/creditsMemberPrice/Pagination.js +2 -0
  364. package/dist/esm/components/credits/creditsMemberPrice/Pagination.js.map +7 -0
  365. package/dist/esm/components/credits/creditsMemberPrice/index.d.ts +2 -0
  366. package/dist/esm/components/credits/creditsMemberPrice/index.js +2 -0
  367. package/dist/esm/components/credits/creditsMemberPrice/index.js.map +7 -0
  368. package/dist/esm/components/credits/creditsMemberPrice/type.d.ts +64 -0
  369. package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.d.ts +4 -0
  370. package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js +2 -0
  371. package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js.map +7 -0
  372. package/dist/esm/components/credits/creditsNavigation/index.d.ts +2 -0
  373. package/dist/esm/components/credits/creditsNavigation/index.js +2 -0
  374. package/dist/esm/components/credits/creditsNavigation/index.js.map +7 -0
  375. package/dist/esm/components/credits/creditsNavigation/type.d.ts +7 -0
  376. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  377. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  378. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  379. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  380. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  381. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  382. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +5 -0
  383. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
  384. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
  385. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.d.ts +4 -0
  386. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js +2 -0
  387. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
  388. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  389. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
  390. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  391. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  392. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js +1 -1
  393. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +2 -2
  394. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  395. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
  396. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
  397. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
  398. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
  399. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  400. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +3 -3
  401. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  402. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  403. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  404. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  405. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  406. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
  407. package/dist/esm/components/credits/creditsRedeemList/index.d.ts +2 -13
  408. package/dist/esm/components/credits/creditsRedeemList/index.js +1 -1
  409. package/dist/esm/components/credits/creditsRedeemList/index.js.map +4 -4
  410. package/dist/esm/components/credits/creditsRedeemList/type.d.ts +2 -15
  411. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +4 -0
  412. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
  413. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
  414. package/dist/esm/components/credits/creditsWaysToGetCredits/index.d.ts +2 -2
  415. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js +1 -1
  416. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js.map +4 -4
  417. package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +5 -16
  418. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js +1 -1
  419. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +2 -2
  420. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.d.ts +11 -2
  421. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
  422. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +3 -3
  423. package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +4 -1
  424. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  425. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
  426. package/dist/esm/components/credits/modal/activitiesModal.d.ts +4 -1
  427. package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
  428. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  429. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  430. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  431. package/dist/esm/components/credits/modal/loadingDots.d.ts +2 -1
  432. package/dist/esm/components/credits/modal/loadingDots.js +1 -1
  433. package/dist/esm/components/credits/modal/loadingDots.js.map +3 -3
  434. package/dist/esm/components/credits/modal/modalContainer.js +1 -1
  435. package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
  436. package/dist/esm/components/credits/modal/rulesModal.js +1 -1
  437. package/dist/esm/components/credits/modal/rulesModal.js.map +2 -2
  438. package/dist/esm/components/credits/modal/subscribeModal.d.ts +15 -0
  439. package/dist/esm/components/credits/modal/subscribeModal.js +2 -0
  440. package/dist/esm/components/credits/modal/subscribeModal.js.map +7 -0
  441. package/dist/esm/components/credits/modal/tip.js +1 -1
  442. package/dist/esm/components/credits/modal/tip.js.map +3 -3
  443. package/dist/esm/components/credits/type.d.ts +24 -5
  444. package/dist/esm/components/index.d.ts +2 -1
  445. package/dist/esm/components/index.js +1 -1
  446. package/dist/esm/components/index.js.map +2 -2
  447. package/dist/esm/components/registration/authCodeActivate/Message.d.ts +4 -0
  448. package/dist/esm/components/registration/authCodeActivate/Message.js +2 -0
  449. package/dist/esm/components/registration/authCodeActivate/Message.js.map +7 -0
  450. package/dist/esm/components/registration/authCodeActivate/index.d.ts +3 -0
  451. package/dist/esm/components/registration/authCodeActivate/index.js +2 -0
  452. package/dist/esm/components/registration/authCodeActivate/index.js.map +7 -0
  453. package/dist/esm/components/registration/authCodeActivate/type.d.ts +22 -0
  454. package/dist/esm/components/registration/authCodeActivate/type.js.map +7 -0
  455. package/dist/esm/components/registration/context/index.d.ts +1 -0
  456. package/dist/esm/components/registration/context/index.js +2 -0
  457. package/dist/esm/components/registration/context/index.js.map +7 -0
  458. package/dist/esm/components/registration/context/provider.d.ts +27 -0
  459. package/dist/esm/components/registration/context/provider.js +2 -0
  460. package/dist/esm/components/registration/context/provider.js.map +7 -0
  461. package/dist/esm/components/registration/index.d.ts +2 -0
  462. package/dist/esm/components/registration/index.js +2 -0
  463. package/dist/esm/components/registration/index.js.map +7 -0
  464. package/dist/esm/components/registration/modalContainer.d.ts +14 -0
  465. package/dist/esm/components/registration/modalContainer.js +2 -0
  466. package/dist/esm/components/registration/modalContainer.js.map +7 -0
  467. package/dist/esm/constants.d.ts +1 -0
  468. package/dist/esm/constants.js +2 -0
  469. package/dist/esm/constants.js.map +7 -0
  470. package/dist/esm/helpers/fetcher.d.ts +1 -1
  471. package/dist/esm/helpers/fetcher.js +1 -1
  472. package/dist/esm/helpers/fetcher.js.map +3 -3
  473. package/dist/esm/helpers/index.d.ts +2 -2
  474. package/dist/esm/helpers/index.js +1 -1
  475. package/dist/esm/helpers/index.js.map +2 -2
  476. package/dist/esm/helpers/track.d.ts +6 -2
  477. package/dist/esm/helpers/track.js +1 -1
  478. package/dist/esm/helpers/track.js.map +3 -3
  479. package/dist/esm/index.d.ts +3 -2
  480. package/dist/esm/index.js +1 -1
  481. package/dist/esm/index.js.map +2 -2
  482. package/dist/esm/templates/credits.d.ts +73 -0
  483. package/dist/esm/templates/credits.js +2 -0
  484. package/dist/esm/templates/credits.js.map +7 -0
  485. package/dist/esm/templates/index.d.ts +1 -0
  486. package/dist/esm/templates/index.js +2 -0
  487. package/dist/esm/templates/index.js.map +7 -0
  488. package/package.json +25 -22
  489. package/src/components/chat/index.tsx +1 -1
  490. package/src/components/credits/context/const.ts +1 -0
  491. package/src/components/credits/context/hooks/useActivities.ts +4 -3
  492. package/src/components/credits/context/hooks/useAddressValidate.ts +2 -2
  493. package/src/components/credits/context/hooks/useAlpcFetch.ts +14 -10
  494. package/src/components/credits/context/hooks/useCountries.ts +2 -2
  495. package/src/components/credits/context/hooks/useFunctionMemberPrice.ts +33 -0
  496. package/src/components/credits/context/hooks/useMyRewards.ts +4 -3
  497. package/src/components/credits/context/hooks/useRedeemAndBuy.ts +21 -24
  498. package/src/components/credits/context/hooks/useRedeemCoupon.ts +7 -3
  499. package/src/components/credits/context/hooks/useRedeemProduct.ts +5 -2
  500. package/src/components/credits/context/hooks/useRedeemableList.ts +4 -18
  501. package/src/components/credits/context/hooks/useSubscribed.ts +6 -7
  502. package/src/components/credits/context/hooks/useUploadReceipt.tsx +0 -1
  503. package/src/components/credits/context/memberPriceConst.ts +13 -0
  504. package/src/components/credits/context/memberPriceTypes.ts +54 -0
  505. package/src/components/credits/context/provider.tsx +25 -20
  506. package/src/components/credits/context/utils/atobID.ts +8 -0
  507. package/src/components/credits/context/utils/functionDiscountCalculate.ts +57 -0
  508. package/src/components/credits/context/utils/getFunctionMemberPrice.ts +135 -0
  509. package/src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts +51 -0
  510. package/src/components/credits/context/utils/variantGetCoupon.ts +34 -0
  511. package/src/components/credits/context/utils.ts +9 -0
  512. package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +273 -0
  513. package/src/components/credits/creditsAnkersolixTask/index.ts +2 -0
  514. package/src/components/credits/creditsAnkersolixTask/type.ts +7 -0
  515. package/src/components/credits/creditsBanner/index.tsx +16 -18
  516. package/src/components/credits/creditsBenefits/BenefitItem.tsx +108 -0
  517. package/src/components/credits/creditsBenefits/index.tsx +20 -15
  518. package/src/components/credits/creditsCash/CreditsCash.tsx +84 -0
  519. package/src/components/credits/creditsCash/RedeemableItem.tsx +66 -44
  520. package/src/components/credits/creditsCash/index.ts +2 -0
  521. package/src/components/credits/creditsCash/type.ts +2 -4
  522. package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +12 -12
  523. package/src/components/credits/creditsFaq/index.tsx +9 -6
  524. package/src/components/credits/creditsInfoCard/index.tsx +43 -36
  525. package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +314 -0
  526. package/src/components/credits/creditsMemberPrice/MemberPriceItem.tsx +181 -0
  527. package/src/components/credits/creditsMemberPrice/Pagination.tsx +113 -0
  528. package/src/components/credits/creditsMemberPrice/index.ts +2 -0
  529. package/src/components/credits/creditsMemberPrice/type.ts +75 -0
  530. package/src/components/credits/creditsNavigation/CreditsNavigation.tsx +123 -0
  531. package/src/components/credits/creditsNavigation/index.ts +2 -0
  532. package/src/components/credits/creditsNavigation/type.ts +10 -0
  533. package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +8 -3
  534. package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +6 -1
  535. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +6 -5
  536. package/src/components/credits/creditsRedeemList/{index.tsx → CreditsRedeemList.tsx} +31 -35
  537. package/src/components/credits/creditsRedeemList/NonProductValue.tsx +39 -0
  538. package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +11 -13
  539. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +15 -11
  540. package/src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx +1 -1
  541. package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +6 -12
  542. package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +25 -0
  543. package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +11 -7
  544. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +5 -1
  545. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +4 -5
  546. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +24 -32
  547. package/src/components/credits/creditsRedeemList/index.ts +2 -0
  548. package/src/components/credits/creditsRedeemList/type.ts +2 -16
  549. package/src/components/credits/creditsWaysToGetCredits/{index.tsx → CreditsWaysToGetCredits.tsx} +79 -20
  550. package/src/components/credits/creditsWaysToGetCredits/index.ts +2 -0
  551. package/src/components/credits/creditsWaysToGetCredits/type.ts +5 -16
  552. package/src/components/credits/creditsWaysToGetCredits/useActions.ts +24 -10
  553. package/src/components/credits/modal/MyRewardsModal.tsx +84 -63
  554. package/src/components/credits/modal/activitiesModal.tsx +62 -46
  555. package/src/components/credits/modal/creditsUploadReceiptModal.tsx +10 -1
  556. package/src/components/credits/modal/loadingDots.tsx +9 -7
  557. package/src/components/credits/modal/modalContainer.tsx +6 -1
  558. package/src/components/credits/modal/rulesModal.tsx +1 -1
  559. package/src/components/credits/modal/subscribeModal.tsx +202 -0
  560. package/src/components/credits/modal/tip.tsx +11 -1
  561. package/src/components/credits/type.ts +24 -5
  562. package/src/components/index.ts +3 -3
  563. package/src/components/registration/authCodeActivate/Message.tsx +43 -0
  564. package/src/components/registration/authCodeActivate/index.tsx +338 -0
  565. package/src/components/registration/authCodeActivate/type.ts +23 -0
  566. package/src/components/registration/context/index.tsx +1 -0
  567. package/src/components/registration/context/provider.tsx +86 -0
  568. package/src/components/registration/index.ts +2 -0
  569. package/src/components/registration/modalContainer.tsx +115 -0
  570. package/src/constants.ts +1 -0
  571. package/src/index.ts +3 -4
  572. package/src/styles/global.css +15 -0
  573. package/src/templates/Credits.tsx +165 -0
  574. package/src/templates/index.ts +1 -0
  575. package/style.css +1 -0
  576. package/tailwind.config.ts +10 -0
  577. package/dist/cjs/components/chat/chat-context.d.ts +0 -101
  578. package/dist/cjs/components/credits/credits-banner/index.d.ts +0 -23
  579. package/dist/cjs/components/credits/credits-banner/index.js +0 -2
  580. package/dist/cjs/components/credits/credits-banner/index.js.map +0 -7
  581. package/dist/cjs/components/credits/credits-benefits/benefitItem.d.ts +0 -19
  582. package/dist/cjs/components/credits/credits-benefits/benefitItem.js +0 -2
  583. package/dist/cjs/components/credits/credits-benefits/benefitItem.js.map +0 -7
  584. package/dist/cjs/components/credits/credits-benefits/iconInfo.d.ts +0 -2
  585. package/dist/cjs/components/credits/credits-benefits/index.d.ts +0 -12
  586. package/dist/cjs/components/credits/credits-benefits/index.js +0 -4
  587. package/dist/cjs/components/credits/credits-benefits/index.js.map +0 -7
  588. package/dist/cjs/components/credits/credits-cash/RedeemableItem.d.ts +0 -15
  589. package/dist/cjs/components/credits/credits-cash/RedeemableItem.js +0 -2
  590. package/dist/cjs/components/credits/credits-cash/RedeemableItem.js.map +0 -7
  591. package/dist/cjs/components/credits/credits-cash/index.d.ts +0 -13
  592. package/dist/cjs/components/credits/credits-cash/index.js +0 -2
  593. package/dist/cjs/components/credits/credits-cash/index.js.map +0 -7
  594. package/dist/cjs/components/credits/credits-cash/type.d.ts +0 -47
  595. package/dist/cjs/components/credits/credits-cash/type.js +0 -2
  596. package/dist/cjs/components/credits/credits-cash/type.js.map +0 -7
  597. package/dist/cjs/components/credits/credits-faq/faq-item/FaqItem.d.ts +0 -13
  598. package/dist/cjs/components/credits/credits-faq/faq-item/faq-item.d.ts +0 -13
  599. package/dist/cjs/components/credits/credits-faq/faq-item/faq-item.js +0 -2
  600. package/dist/cjs/components/credits/credits-faq/faq-item/faq-item.js.map +0 -7
  601. package/dist/cjs/components/credits/credits-faq/faqItem/FaqItem.d.ts +0 -13
  602. package/dist/cjs/components/credits/credits-faq/index.d.ts +0 -16
  603. package/dist/cjs/components/credits/credits-faq/index.js +0 -2
  604. package/dist/cjs/components/credits/credits-faq/index.js.map +0 -7
  605. package/dist/cjs/components/credits/credits-info-card/index.d.ts +0 -20
  606. package/dist/cjs/components/credits/credits-info-card/index.js +0 -2
  607. package/dist/cjs/components/credits/credits-info-card/index.js.map +0 -7
  608. package/dist/cjs/components/credits/credits-redeem-list/AddressForm/Input.d.ts +0 -13
  609. package/dist/cjs/components/credits/credits-redeem-list/AddressForm/country-select.d.ts +0 -14
  610. package/dist/cjs/components/credits/credits-redeem-list/AddressForm/form-item.d.ts +0 -6
  611. package/dist/cjs/components/credits/credits-redeem-list/AddressForm/index.d.ts +0 -2
  612. package/dist/cjs/components/credits/credits-redeem-list/AddressForm/state-select.d.ts +0 -15
  613. package/dist/cjs/components/credits/credits-redeem-list/AddressForm/type.d.ts +0 -26
  614. package/dist/cjs/components/credits/credits-redeem-list/RedeemCouponModal.d.ts +0 -9
  615. package/dist/cjs/components/credits/credits-redeem-list/RedeemProductModal/Address.d.ts +0 -20
  616. package/dist/cjs/components/credits/credits-redeem-list/RedeemProductModal/Error.d.ts +0 -8
  617. package/dist/cjs/components/credits/credits-redeem-list/RedeemProductModal/Init.d.ts +0 -11
  618. package/dist/cjs/components/credits/credits-redeem-list/RedeemProductModal/ProductInfo.d.ts +0 -8
  619. package/dist/cjs/components/credits/credits-redeem-list/RedeemProductModal/Success.d.ts +0 -13
  620. package/dist/cjs/components/credits/credits-redeem-list/RedeemProductModal/index.d.ts +0 -11
  621. package/dist/cjs/components/credits/credits-redeem-list/RedeemableItem.d.ts +0 -9
  622. package/dist/cjs/components/credits/credits-redeem-list/RedeemableItem.js +0 -2
  623. package/dist/cjs/components/credits/credits-redeem-list/RedeemableItem.js.map +0 -7
  624. package/dist/cjs/components/credits/credits-redeem-list/address-form/Input.d.ts +0 -13
  625. package/dist/cjs/components/credits/credits-redeem-list/address-form/country-select.d.ts +0 -14
  626. package/dist/cjs/components/credits/credits-redeem-list/address-form/country-select.js +0 -2
  627. package/dist/cjs/components/credits/credits-redeem-list/address-form/country-select.js.map +0 -7
  628. package/dist/cjs/components/credits/credits-redeem-list/address-form/form-item.d.ts +0 -6
  629. package/dist/cjs/components/credits/credits-redeem-list/address-form/index.d.ts +0 -2
  630. package/dist/cjs/components/credits/credits-redeem-list/address-form/index.js +0 -2
  631. package/dist/cjs/components/credits/credits-redeem-list/address-form/index.js.map +0 -7
  632. package/dist/cjs/components/credits/credits-redeem-list/address-form/state-select.d.ts +0 -15
  633. package/dist/cjs/components/credits/credits-redeem-list/address-form/state-select.js +0 -2
  634. package/dist/cjs/components/credits/credits-redeem-list/address-form/state-select.js.map +0 -7
  635. package/dist/cjs/components/credits/credits-redeem-list/address-form/type.d.ts +0 -26
  636. package/dist/cjs/components/credits/credits-redeem-list/index.d.ts +0 -13
  637. package/dist/cjs/components/credits/credits-redeem-list/index.js +0 -2
  638. package/dist/cjs/components/credits/credits-redeem-list/index.js.map +0 -7
  639. package/dist/cjs/components/credits/credits-redeem-list/redeem-coupon-modal.d.ts +0 -9
  640. package/dist/cjs/components/credits/credits-redeem-list/redeem-coupon-modal.js +0 -2
  641. package/dist/cjs/components/credits/credits-redeem-list/redeem-coupon-modal.js.map +0 -7
  642. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Address.d.ts +0 -20
  643. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Address.js +0 -2
  644. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Address.js.map +0 -7
  645. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Error.d.ts +0 -8
  646. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Init.d.ts +0 -11
  647. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Init.js +0 -2
  648. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Init.js.map +0 -7
  649. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/ProductInfo.d.ts +0 -8
  650. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/ProductInfo.js +0 -2
  651. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/ProductInfo.js.map +0 -7
  652. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Success.d.ts +0 -13
  653. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Success.js +0 -2
  654. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/Success.js.map +0 -7
  655. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/index.d.ts +0 -11
  656. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/index.js +0 -2
  657. package/dist/cjs/components/credits/credits-redeem-list/redeem-product-modal/index.js.map +0 -7
  658. package/dist/cjs/components/credits/credits-redeem-list/type.d.ts +0 -77
  659. package/dist/cjs/components/credits/credits-redeem-list/type.js.map +0 -7
  660. package/dist/cjs/components/credits/credits-ways-to-get-credits/index.d.ts +0 -2
  661. package/dist/cjs/components/credits/credits-ways-to-get-credits/index.js +0 -2
  662. package/dist/cjs/components/credits/credits-ways-to-get-credits/index.js.map +0 -7
  663. package/dist/cjs/components/credits/credits-ways-to-get-credits/type.d.ts +0 -60
  664. package/dist/cjs/components/credits/credits-ways-to-get-credits/type.js +0 -2
  665. package/dist/cjs/components/credits/credits-ways-to-get-credits/type.js.map +0 -7
  666. package/dist/cjs/components/credits/credits-ways-to-get-credits/useActions.d.ts +0 -96
  667. package/dist/cjs/components/credits/credits-ways-to-get-credits/useActions.js +0 -2
  668. package/dist/cjs/components/credits/credits-ways-to-get-credits/useActions.js.map +0 -7
  669. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/country-select.d.ts +0 -14
  670. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/form-item.d.ts +0 -6
  671. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/state-select.d.ts +0 -15
  672. package/dist/cjs/index.css +0 -2
  673. package/dist/cjs/index.css.map +0 -7
  674. package/dist/cjs/shopify/context/ShopifyProvider.d.ts +0 -10
  675. package/dist/cjs/shopify/context/index.d.ts +0 -1
  676. package/dist/cjs/shopify/context/shopify-provider.d.ts +0 -10
  677. package/dist/cjs/shopify/fetchers/create-cart.d.ts +0 -12
  678. package/dist/cjs/shopify/fetchers/get-products-by-handles.d.ts +0 -7
  679. package/dist/cjs/shopify/fetchers/index.d.ts +0 -2
  680. package/dist/cjs/shopify/fragments/article.d.ts +0 -2
  681. package/dist/cjs/shopify/fragments/blog.d.ts +0 -1
  682. package/dist/cjs/shopify/fragments/cart.d.ts +0 -1
  683. package/dist/cjs/shopify/fragments/collection.d.ts +0 -1
  684. package/dist/cjs/shopify/fragments/image.d.ts +0 -1
  685. package/dist/cjs/shopify/fragments/index.d.ts +0 -11
  686. package/dist/cjs/shopify/fragments/metafields.d.ts +0 -2
  687. package/dist/cjs/shopify/fragments/page-info.d.ts +0 -1
  688. package/dist/cjs/shopify/fragments/page.d.ts +0 -1
  689. package/dist/cjs/shopify/fragments/product.d.ts +0 -1
  690. package/dist/cjs/shopify/fragments/seo.d.ts +0 -1
  691. package/dist/cjs/shopify/fragments/variant.d.ts +0 -1
  692. package/dist/cjs/shopify/gql/fragment-masking.d.ts +0 -15
  693. package/dist/cjs/shopify/gql/gql.d.ts +0 -87
  694. package/dist/cjs/shopify/gql/graphql.d.ts +0 -7669
  695. package/dist/cjs/shopify/gql/index.d.ts +0 -3
  696. package/dist/cjs/shopify/hooks/index.d.ts +0 -2
  697. package/dist/cjs/shopify/hooks/use-create-cart.d.ts +0 -2
  698. package/dist/cjs/shopify/hooks/use-products-by-handles.d.ts +0 -4
  699. package/dist/cjs/shopify/hooks/useCreateCart.d.ts +0 -2
  700. package/dist/cjs/shopify/hooks/useProductsByHandles.d.ts +0 -4
  701. package/dist/cjs/shopify/mutations/create-cart.d.ts +0 -1
  702. package/dist/cjs/shopify/queries/get-product-by-handles.d.ts +0 -1
  703. package/dist/cjs/shopify/queries/index.d.ts +0 -1
  704. package/dist/cjs/shopify/src/index.d.ts +0 -5
  705. package/dist/cjs/shopify/tsup.config.d.ts +0 -2
  706. package/dist/cjs/shopify/types/article.d.ts +0 -48
  707. package/dist/cjs/shopify/types/cart.d.ts +0 -173
  708. package/dist/cjs/shopify/types/checkout.d.ts +0 -42
  709. package/dist/cjs/shopify/types/collection.d.ts +0 -122
  710. package/dist/cjs/shopify/types/common.d.ts +0 -42
  711. package/dist/cjs/shopify/types/config.d.ts +0 -12
  712. package/dist/cjs/shopify/types/customer.d.ts +0 -30
  713. package/dist/cjs/shopify/types/fetcher.d.ts +0 -38
  714. package/dist/cjs/shopify/types/index.d.ts +0 -12
  715. package/dist/cjs/shopify/types/page.d.ts +0 -33
  716. package/dist/cjs/shopify/types/product.d.ts +0 -174
  717. package/dist/cjs/shopify/types/search.d.ts +0 -54
  718. package/dist/cjs/shopify/types/site.d.ts +0 -33
  719. package/dist/cjs/shopify/types/type-helper.d.ts +0 -5
  720. package/dist/cjs/shopify/utils/colors.d.ts +0 -3
  721. package/dist/cjs/shopify/utils/const.d.ts +0 -76
  722. package/dist/cjs/shopify/utils/cookie.d.ts +0 -15
  723. package/dist/cjs/shopify/utils/errors.d.ts +0 -38
  724. package/dist/cjs/shopify/utils/fetch-graphql-api.d.ts +0 -19
  725. package/dist/cjs/shopify/utils/handle-fetch-response.d.ts +0 -5
  726. package/dist/cjs/shopify/utils/helper.d.ts +0 -28
  727. package/dist/cjs/shopify/utils/normalize/cart.d.ts +0 -7
  728. package/dist/cjs/shopify/utils/normalize/customer.d.ts +0 -3
  729. package/dist/cjs/shopify/utils/normalize/index.d.ts +0 -2
  730. package/dist/cjs/shopify/utils/normalize/metafield.d.ts +0 -5
  731. package/dist/cjs/shopify/utils/normalize/product.d.ts +0 -16
  732. package/dist/cjs/shopify/utils/store.d.ts +0 -2
  733. package/dist/cjs/shopify/utils/type-helper.d.ts +0 -5
  734. package/dist/cjs/tsconfig.tsbuildinfo +0 -1
  735. package/dist/esm/components/chat/chat-context.d.ts +0 -101
  736. package/dist/esm/components/chat/chat-context.js +0 -2
  737. package/dist/esm/components/chat/chat-context.js.map +0 -7
  738. package/dist/esm/components/credits/credits-banner/index.d.ts +0 -23
  739. package/dist/esm/components/credits/credits-banner/index.js +0 -2
  740. package/dist/esm/components/credits/credits-banner/index.js.map +0 -7
  741. package/dist/esm/components/credits/credits-benefits/benefitItem.d.ts +0 -19
  742. package/dist/esm/components/credits/credits-benefits/benefitItem.js +0 -2
  743. package/dist/esm/components/credits/credits-benefits/benefitItem.js.map +0 -7
  744. package/dist/esm/components/credits/credits-benefits/iconInfo.d.ts +0 -2
  745. package/dist/esm/components/credits/credits-benefits/iconInfo.js +0 -2
  746. package/dist/esm/components/credits/credits-benefits/iconInfo.js.map +0 -7
  747. package/dist/esm/components/credits/credits-benefits/index.d.ts +0 -12
  748. package/dist/esm/components/credits/credits-benefits/index.js +0 -4
  749. package/dist/esm/components/credits/credits-benefits/index.js.map +0 -7
  750. package/dist/esm/components/credits/credits-cash/RedeemableItem.d.ts +0 -15
  751. package/dist/esm/components/credits/credits-cash/RedeemableItem.js +0 -2
  752. package/dist/esm/components/credits/credits-cash/RedeemableItem.js.map +0 -7
  753. package/dist/esm/components/credits/credits-cash/index.d.ts +0 -13
  754. package/dist/esm/components/credits/credits-cash/index.js +0 -2
  755. package/dist/esm/components/credits/credits-cash/index.js.map +0 -7
  756. package/dist/esm/components/credits/credits-cash/type.d.ts +0 -47
  757. package/dist/esm/components/credits/credits-faq/faq-item/FaqItem.d.ts +0 -13
  758. package/dist/esm/components/credits/credits-faq/faq-item/faq-item.d.ts +0 -13
  759. package/dist/esm/components/credits/credits-faq/faq-item/faq-item.js +0 -2
  760. package/dist/esm/components/credits/credits-faq/faq-item/faq-item.js.map +0 -7
  761. package/dist/esm/components/credits/credits-faq/faqItem/FaqItem.d.ts +0 -13
  762. package/dist/esm/components/credits/credits-faq/index.d.ts +0 -16
  763. package/dist/esm/components/credits/credits-faq/index.js +0 -2
  764. package/dist/esm/components/credits/credits-faq/index.js.map +0 -7
  765. package/dist/esm/components/credits/credits-info-card/index.d.ts +0 -20
  766. package/dist/esm/components/credits/credits-info-card/index.js +0 -2
  767. package/dist/esm/components/credits/credits-info-card/index.js.map +0 -7
  768. package/dist/esm/components/credits/credits-redeem-list/AddressForm/Input.d.ts +0 -13
  769. package/dist/esm/components/credits/credits-redeem-list/AddressForm/country-select.d.ts +0 -14
  770. package/dist/esm/components/credits/credits-redeem-list/AddressForm/form-item.d.ts +0 -6
  771. package/dist/esm/components/credits/credits-redeem-list/AddressForm/index.d.ts +0 -2
  772. package/dist/esm/components/credits/credits-redeem-list/AddressForm/state-select.d.ts +0 -15
  773. package/dist/esm/components/credits/credits-redeem-list/AddressForm/type.d.ts +0 -26
  774. package/dist/esm/components/credits/credits-redeem-list/RedeemCouponModal.d.ts +0 -9
  775. package/dist/esm/components/credits/credits-redeem-list/RedeemProductModal/Address.d.ts +0 -20
  776. package/dist/esm/components/credits/credits-redeem-list/RedeemProductModal/Error.d.ts +0 -8
  777. package/dist/esm/components/credits/credits-redeem-list/RedeemProductModal/Init.d.ts +0 -11
  778. package/dist/esm/components/credits/credits-redeem-list/RedeemProductModal/ProductInfo.d.ts +0 -8
  779. package/dist/esm/components/credits/credits-redeem-list/RedeemProductModal/Success.d.ts +0 -13
  780. package/dist/esm/components/credits/credits-redeem-list/RedeemProductModal/index.d.ts +0 -11
  781. package/dist/esm/components/credits/credits-redeem-list/RedeemableItem.d.ts +0 -9
  782. package/dist/esm/components/credits/credits-redeem-list/RedeemableItem.js +0 -2
  783. package/dist/esm/components/credits/credits-redeem-list/RedeemableItem.js.map +0 -7
  784. package/dist/esm/components/credits/credits-redeem-list/address-form/Input.d.ts +0 -13
  785. package/dist/esm/components/credits/credits-redeem-list/address-form/Input.js +0 -2
  786. package/dist/esm/components/credits/credits-redeem-list/address-form/Input.js.map +0 -7
  787. package/dist/esm/components/credits/credits-redeem-list/address-form/country-select.d.ts +0 -14
  788. package/dist/esm/components/credits/credits-redeem-list/address-form/country-select.js +0 -2
  789. package/dist/esm/components/credits/credits-redeem-list/address-form/country-select.js.map +0 -7
  790. package/dist/esm/components/credits/credits-redeem-list/address-form/form-item.d.ts +0 -6
  791. package/dist/esm/components/credits/credits-redeem-list/address-form/form-item.js +0 -2
  792. package/dist/esm/components/credits/credits-redeem-list/address-form/form-item.js.map +0 -7
  793. package/dist/esm/components/credits/credits-redeem-list/address-form/index.d.ts +0 -2
  794. package/dist/esm/components/credits/credits-redeem-list/address-form/index.js +0 -2
  795. package/dist/esm/components/credits/credits-redeem-list/address-form/index.js.map +0 -7
  796. package/dist/esm/components/credits/credits-redeem-list/address-form/state-select.d.ts +0 -15
  797. package/dist/esm/components/credits/credits-redeem-list/address-form/state-select.js +0 -2
  798. package/dist/esm/components/credits/credits-redeem-list/address-form/state-select.js.map +0 -7
  799. package/dist/esm/components/credits/credits-redeem-list/address-form/type.d.ts +0 -26
  800. package/dist/esm/components/credits/credits-redeem-list/index.d.ts +0 -13
  801. package/dist/esm/components/credits/credits-redeem-list/index.js +0 -2
  802. package/dist/esm/components/credits/credits-redeem-list/index.js.map +0 -7
  803. package/dist/esm/components/credits/credits-redeem-list/redeem-coupon-modal.d.ts +0 -9
  804. package/dist/esm/components/credits/credits-redeem-list/redeem-coupon-modal.js +0 -2
  805. package/dist/esm/components/credits/credits-redeem-list/redeem-coupon-modal.js.map +0 -7
  806. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Address.d.ts +0 -20
  807. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Address.js +0 -2
  808. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Address.js.map +0 -7
  809. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Error.d.ts +0 -8
  810. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Error.js +0 -2
  811. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Error.js.map +0 -7
  812. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Init.d.ts +0 -11
  813. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Init.js +0 -2
  814. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Init.js.map +0 -7
  815. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/ProductInfo.d.ts +0 -8
  816. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/ProductInfo.js +0 -2
  817. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/ProductInfo.js.map +0 -7
  818. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Success.d.ts +0 -13
  819. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Success.js +0 -2
  820. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/Success.js.map +0 -7
  821. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/index.d.ts +0 -11
  822. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/index.js +0 -2
  823. package/dist/esm/components/credits/credits-redeem-list/redeem-product-modal/index.js.map +0 -7
  824. package/dist/esm/components/credits/credits-redeem-list/type.d.ts +0 -77
  825. package/dist/esm/components/credits/credits-ways-to-get-credits/index.d.ts +0 -2
  826. package/dist/esm/components/credits/credits-ways-to-get-credits/index.js +0 -2
  827. package/dist/esm/components/credits/credits-ways-to-get-credits/index.js.map +0 -7
  828. package/dist/esm/components/credits/credits-ways-to-get-credits/type.d.ts +0 -60
  829. package/dist/esm/components/credits/credits-ways-to-get-credits/type.js +0 -2
  830. package/dist/esm/components/credits/credits-ways-to-get-credits/type.js.map +0 -7
  831. package/dist/esm/components/credits/credits-ways-to-get-credits/useActions.d.ts +0 -96
  832. package/dist/esm/components/credits/credits-ways-to-get-credits/useActions.js +0 -2
  833. package/dist/esm/components/credits/credits-ways-to-get-credits/useActions.js.map +0 -7
  834. package/dist/esm/components/credits/creditsRedeemList/AddressForm/country-select.d.ts +0 -14
  835. package/dist/esm/components/credits/creditsRedeemList/AddressForm/form-item.d.ts +0 -6
  836. package/dist/esm/components/credits/creditsRedeemList/AddressForm/state-select.d.ts +0 -15
  837. package/dist/esm/index.css +0 -2
  838. package/dist/esm/index.css.map +0 -7
  839. package/dist/esm/shopify/context/ShopifyProvider.d.ts +0 -10
  840. package/dist/esm/shopify/context/index.d.ts +0 -1
  841. package/dist/esm/shopify/context/shopify-provider.d.ts +0 -10
  842. package/dist/esm/shopify/fetchers/create-cart.d.ts +0 -12
  843. package/dist/esm/shopify/fetchers/get-products-by-handles.d.ts +0 -7
  844. package/dist/esm/shopify/fetchers/index.d.ts +0 -2
  845. package/dist/esm/shopify/fragments/article.d.ts +0 -2
  846. package/dist/esm/shopify/fragments/blog.d.ts +0 -1
  847. package/dist/esm/shopify/fragments/cart.d.ts +0 -1
  848. package/dist/esm/shopify/fragments/collection.d.ts +0 -1
  849. package/dist/esm/shopify/fragments/image.d.ts +0 -1
  850. package/dist/esm/shopify/fragments/index.d.ts +0 -11
  851. package/dist/esm/shopify/fragments/metafields.d.ts +0 -2
  852. package/dist/esm/shopify/fragments/page-info.d.ts +0 -1
  853. package/dist/esm/shopify/fragments/page.d.ts +0 -1
  854. package/dist/esm/shopify/fragments/product.d.ts +0 -1
  855. package/dist/esm/shopify/fragments/seo.d.ts +0 -1
  856. package/dist/esm/shopify/fragments/variant.d.ts +0 -1
  857. package/dist/esm/shopify/gql/fragment-masking.d.ts +0 -15
  858. package/dist/esm/shopify/gql/gql.d.ts +0 -87
  859. package/dist/esm/shopify/gql/graphql.d.ts +0 -7669
  860. package/dist/esm/shopify/gql/index.d.ts +0 -3
  861. package/dist/esm/shopify/hooks/index.d.ts +0 -2
  862. package/dist/esm/shopify/hooks/use-create-cart.d.ts +0 -2
  863. package/dist/esm/shopify/hooks/use-products-by-handles.d.ts +0 -4
  864. package/dist/esm/shopify/hooks/useCreateCart.d.ts +0 -2
  865. package/dist/esm/shopify/hooks/useProductsByHandles.d.ts +0 -4
  866. package/dist/esm/shopify/mutations/create-cart.d.ts +0 -1
  867. package/dist/esm/shopify/queries/get-product-by-handles.d.ts +0 -1
  868. package/dist/esm/shopify/queries/index.d.ts +0 -1
  869. package/dist/esm/shopify/src/index.d.ts +0 -5
  870. package/dist/esm/shopify/tsup.config.d.ts +0 -2
  871. package/dist/esm/shopify/types/article.d.ts +0 -48
  872. package/dist/esm/shopify/types/cart.d.ts +0 -173
  873. package/dist/esm/shopify/types/checkout.d.ts +0 -42
  874. package/dist/esm/shopify/types/collection.d.ts +0 -122
  875. package/dist/esm/shopify/types/common.d.ts +0 -42
  876. package/dist/esm/shopify/types/config.d.ts +0 -12
  877. package/dist/esm/shopify/types/customer.d.ts +0 -30
  878. package/dist/esm/shopify/types/fetcher.d.ts +0 -38
  879. package/dist/esm/shopify/types/index.d.ts +0 -12
  880. package/dist/esm/shopify/types/page.d.ts +0 -33
  881. package/dist/esm/shopify/types/product.d.ts +0 -174
  882. package/dist/esm/shopify/types/search.d.ts +0 -54
  883. package/dist/esm/shopify/types/site.d.ts +0 -33
  884. package/dist/esm/shopify/types/type-helper.d.ts +0 -5
  885. package/dist/esm/shopify/utils/colors.d.ts +0 -3
  886. package/dist/esm/shopify/utils/const.d.ts +0 -76
  887. package/dist/esm/shopify/utils/cookie.d.ts +0 -15
  888. package/dist/esm/shopify/utils/errors.d.ts +0 -38
  889. package/dist/esm/shopify/utils/fetch-graphql-api.d.ts +0 -19
  890. package/dist/esm/shopify/utils/handle-fetch-response.d.ts +0 -5
  891. package/dist/esm/shopify/utils/helper.d.ts +0 -28
  892. package/dist/esm/shopify/utils/normalize/cart.d.ts +0 -7
  893. package/dist/esm/shopify/utils/normalize/customer.d.ts +0 -3
  894. package/dist/esm/shopify/utils/normalize/index.d.ts +0 -2
  895. package/dist/esm/shopify/utils/normalize/metafield.d.ts +0 -5
  896. package/dist/esm/shopify/utils/normalize/product.d.ts +0 -16
  897. package/dist/esm/shopify/utils/store.d.ts +0 -2
  898. package/dist/esm/shopify/utils/type-helper.d.ts +0 -5
  899. package/dist/esm/tsconfig.tsbuildinfo +0 -1
  900. package/src/components/credits/context/hooks/useSendEmailValidation.ts +0 -20
  901. package/src/components/credits/context/hooks/useSubscriptions.ts +0 -54
  902. package/src/components/credits/creditsBenefits/benefitItem.tsx +0 -73
  903. package/src/components/credits/creditsCash/index.tsx +0 -102
  904. package/src/helpers/fetchResponse.ts +0 -35
  905. package/src/helpers/fetcher.ts +0 -44
  906. package/src/helpers/index.ts +0 -2
  907. package/src/helpers/track.ts +0 -55
  908. package/src/helpers/utils.ts +0 -8
  909. /package/dist/cjs/components/credits/{credits-redeem-list/address-form → creditsRedeemList/AddressForm}/Input.js +0 -0
  910. /package/dist/cjs/components/credits/{credits-redeem-list/address-form → creditsRedeemList/AddressForm}/type.js +0 -0
  911. /package/dist/cjs/components/credits/{credits-redeem-list → creditsRedeemList}/type.js +0 -0
  912. /package/dist/esm/components/credits/{credits-cash/type.js.map → context/memberPriceTypes.js.map} +0 -0
  913. /package/dist/esm/components/credits/{credits-cash → creditsMemberPrice}/type.js +0 -0
  914. /package/dist/esm/components/credits/{credits-redeem-list/address-form → creditsMemberPrice}/type.js.map +0 -0
  915. /package/dist/esm/components/credits/{credits-redeem-list/address-form → creditsNavigation}/type.js +0 -0
  916. /package/dist/esm/components/credits/{credits-redeem-list → creditsNavigation}/type.js.map +0 -0
  917. /package/dist/esm/components/{credits/credits-redeem-list → registration/authCodeActivate}/type.js +0 -0
  918. /package/src/components/credits/creditsBenefits/{iconInfo.tsx → IconInfo.tsx} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal.tsx"],
4
- "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/modalContainer'\nimport useCopy from '../context/hooks/useCopy'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/modalContainer'\nimport { numberFormat } from '../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { useShopifyContext } from '@anker-in/shopify'\nimport { CreditsRedeemListCopy } from './type'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: number) => void\n}) {\n const { locale } = useShopifyContext()\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied: copiedStatus } = useCopy()\n\n const { profile, fetchCreditInfo } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.redeemModal.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.redeemModal.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.redeemModal.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo('')\n }\n }, [props.isOpen])\n\n return (\n <CreditsModalContainer\n {...props}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {copy?.imageMapping?.coupon?.url && (\n <Picture source={copy?.imageMapping?.coupon?.url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-bold leading-none\" html={item.config.value.toString()} />\n <Text className=\"text-[24px] font-bold leading-[2]\" html={copy?.off} />\n </div>\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n {couponCode ? (\n <div className=\"mt-[30px] flex items-center justify-center md:mt-[18px]\">\n <div className=\"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]\">{couponCode}</div>\n <div\n className={classNames(\n 'cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]',\n copiedStatus ? 'pointer-events-none' : 'pointer-events-auto'\n )}\n onClick={() => {\n copyText(couponCode)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copiedStatus ? copy?.copied : copy?.copy}\n </div>\n </div>\n ) : (\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {copy?.pointUnit}\n </Text>\n )}\n {!couponCode && item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{copy?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n {couponCode && !loading ? (\n <>\n <div className=\"flex flex-col\">\n <Text\n className=\"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]\"\n html={copy.redeemModal.coupon.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.redeemModal.coupon.successDesc}\n ></Text>\n </div>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n window.location.href = copy.redeemModal.coupon.successButtonUrl || `/${locale}`\n if (props.onClose) {\n props.onClose()\n }\n }}\n disabled={disabled}\n >\n {copy.redeemModal.coupon.successButton}\n </Button>\n </>\n ) : (\n <>\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={handleConfirm}\n disabled={disabled}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </>\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full py-[12px] text-center\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </div>\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemCouponModal\n"],
5
- "mappings": "AAkGY,OA4DF,YAAAA,EA5DE,OAAAC,EAIE,QAAAC,MAJF,oBAlGZ,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAOC,MAAa,2BACpB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,qBAAAC,MAAyB,oBAGlC,SAASC,EAAkB,CACzB,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAIG,CACD,KAAM,CAAE,OAAAC,CAAO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AM,UAAU,KAAC,EAC5ClB,EAAC,MAAG,UAAU,oCACX,SAAAiB,EAAK,QAAQ,OAAO,IAAI,CAACsB,EAAMC,IAC9BxC,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,KAAMmC,EAAM,GADWC,CAE/B,CACD,EACH,GACF,GAEJ,EACAvC,EAAC,OAAI,UAAU,wDACZ,UAAAqB,GAAc,CAACU,EACd/B,EAAAF,EAAA,CACE,UAAAE,EAAC,OAAI,UAAU,gBACb,UAAAD,EAACI,EAAA,CACC,UAAU,8DACV,KAAMc,EAAK,YAAY,OAAO,aAC/B,EACDlB,EAACI,EAAA,CACC,UAAU,oEACV,KAAMc,EAAK,YAAY,OAAO,YAC/B,GACH,EACAlB,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAAS,IAAM,CACb,OAAO,SAAS,KAAOgB,EAAK,YAAY,OAAO,kBAAoB,IAAIG,CAAM,GACzED,EAAM,SACRA,EAAM,QAAQ,CAElB,EACA,SAAUM,EAET,SAAAR,EAAK,YAAY,OAAO,cAC3B,GACF,EAEAjB,EAAAF,EAAA,CACE,UAAAC,EAACI,EAAA,CACC,UAAU,4EACV,KAAMc,EAAK,YAAY,aACxB,EACDlB,EAACE,EAAA,CACC,QAAS8B,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASK,EACT,SAAUX,EAET,SAAAR,EAAK,YAAY,cACpB,GACF,EAEDM,GACCxB,EAAC,OAAI,UAAU,2CACb,SAAAA,EAACI,EAAA,CAAK,UAAU,2CAA2C,KAAMoB,EAAW,EAC9E,GAEJ,GACF,CAEJ,CAEA,IAAOiB,EAAQzB",
6
- "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCallback", "useEffect", "useState", "useCopy", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "numberFormat", "useShopifyContext", "RedeemCouponModal", "item", "copy", "onError", "props", "locale", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copiedStatus", "profile", "fetchCreditInfo", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "e", "text", "index", "RedeemCouponModal_default"]
4
+ "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/modalContainer'\nimport useCopy from '../context/hooks/useCopy'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/modalContainer'\nimport { numberFormat } from '../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsRedeemListCopy } from './type'\nimport { NoneProductValue } from './RedeemProductModal/NonProductValue'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: number) => void\n}) {\n const { locale } = useHeadlessContext()\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied: copiedStatus } = useCopy()\n\n const { profile, fetchCreditInfo, pageCommon } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.redeemModal.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.redeemModal.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.redeemModal.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo('')\n }\n }, [props.isOpen])\n\n return (\n <CreditsModalContainer\n {...props}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} copy={copy} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n {couponCode ? (\n <div className=\"mt-[30px] flex items-center justify-center md:mt-[18px]\">\n <div className=\"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]\">{couponCode}</div>\n <div\n className={classNames(\n 'cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]',\n copiedStatus ? 'pointer-events-none' : 'pointer-events-auto'\n )}\n onClick={() => {\n copyText(couponCode)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copiedStatus ? pageCommon?.copied : pageCommon?.copy}\n </div>\n </div>\n ) : (\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n )}\n {!couponCode && item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{pageCommon?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n {couponCode && !loading ? (\n <>\n <div className=\"flex flex-col\">\n <Text\n className=\"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]\"\n html={copy.redeemModal.coupon.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.redeemModal.coupon.successDesc}\n ></Text>\n </div>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n window.location.href = copy.redeemModal.coupon.successButtonUrl || `/${locale}`\n if (props.onClose) {\n props.onClose()\n }\n }}\n disabled={disabled}\n >\n {copy.redeemModal.coupon.successButton}\n </Button>\n </>\n ) : (\n <>\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={handleConfirm}\n disabled={disabled}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </>\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full py-[12px] text-center text-[#FF0000]\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </div>\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemCouponModal\n"],
5
+ "mappings": "AAiGQ,OA2DE,YAAAA,EAzDE,OAAAC,EAFJ,QAAAC,MAAA,oBAjGR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAOC,MAAa,2BACpB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,oBAAAC,MAAwB,uCAEjC,SAASC,EAAkB,CACzB,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAIG,CACD,KAAM,CAAE,OAAAC,CAAO,EAAIP,EAAmB,EAChC,CAACQ,EAAYC,CAAa,EAAIhB,EAAiB,EAC/C,CAACiB,EAAWC,CAAY,EAAIlB,EAAiB,EAE7C,CAACmB,EAAUC,CAAW,EAAIpB,EAAS,EAAK,EACxC,CAAE,KAAMqB,EAAU,OAAQC,CAAa,EAAIrB,EAAQ,EAEnD,CAAE,QAAAsB,EAAS,gBAAAC,EAAiB,WAAAC,CAAW,EAAIvB,EAAkB,EAE7D,CAAE,WAAYwB,EAAS,QAAAC,CAAQ,EAAIxB,EAAgB,CACvD,UAAUyB,EAAc,CACtB,GAAI,CAACA,EAAc,CACjBV,EAAaP,EAAK,YAAY,WAAW,EACzC,MACF,CAEA,GAAIiB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ACL,UAAU,mBACV,QAAS,IAAM,CACb,OAAO,SAAS,KAAOiB,EAAK,YAAY,OAAO,kBAAoB,IAAIG,CAAM,GACzED,EAAM,SACRA,EAAM,QAAQ,CAElB,EACA,SAAUM,EAET,SAAAR,EAAK,YAAY,OAAO,cAC3B,GACF,EAEAlB,EAAAF,EAAA,CACE,UAAAC,EAACI,EAAA,CACC,UAAU,4EACV,KAAMe,EAAK,YAAY,aACxB,EACDnB,EAACE,EAAA,CACC,QAASgC,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASK,EACT,SAAUZ,EAET,SAAAR,EAAK,YAAY,cACpB,GACF,EAEDM,GACCzB,EAAC,OAAI,UAAU,0DACb,SAAAA,EAACI,EAAA,CAAK,UAAU,2CAA2C,KAAMqB,EAAW,EAC9E,GAEJ,GACF,CAEJ,CAEA,IAAOiB,EAAQzB",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCallback", "useEffect", "useState", "useCopy", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "numberFormat", "useHeadlessContext", "NoneProductValue", "RedeemCouponModal", "item", "copy", "onError", "props", "locale", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copiedStatus", "profile", "fetchCreditInfo", "pageCommon", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "text", "index", "RedeemCouponModal_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as v,Text as r}from"@anker-in/headless-ui";import b from"classnames";import{AddressForm as g}from"../AddressForm";import{useShopifyContext as h}from"@anker-in/shopify";import{ProductInfo as C}from"./ProductInfo";import N from"../../context/hooks/useCountries";const k=({copy:t,shippingAddress:s,setAddress:i,validateAddress:m,validateErrors:a,shippingProduct:d,loading:n,address:p,disabled:l,handlePayment:x,item:c})=>{const{storeDomain:f}=h(),{countries:u=[],isLoading:y}=N({shopifyStoreDomain:f});return o("div",{className:"relative",children:[e("div",{className:b("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o("div",{children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(g,{onChange:i,validate:m,errors:a,form:t.redeemModal.product.addressForm,countries:u,countriesLoading:y})]})}),o("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[o("div",{className:"flex w-full items-center rounded-[16px] bg-[#F5F5F7] p-[16px]",children:[d&&e(r,{className:"mb-5 text-[16px] font-bold",html:d}),e(C,{item:c,copy:t})]}),e(v,{loading:n||!p,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:x,disabled:l,children:t.redeemModal.product.paymentButton})]})]})};export{k as Address};
1
+ import{jsx as e,jsxs as d}from"react/jsx-runtime";import{Button as N,Text as r}from"@anker-in/headless-ui";import m from"classnames";import{AddressForm as R}from"../AddressForm";import{useHeadlessContext as h}from"@anker-in/lib";import{ProductInfo as A}from"./ProductInfo";import C from"../../context/hooks/useCountries";import{ROUNDED_BRANDS as F}from"../../../../constants";const E=({copy:o,shippingAddress:t,setAddress:a,validateAddress:i,validateErrors:n,shippingProduct:s,loading:p,address:l,disabled:x,handlePayment:c,item:u})=>{const{storeDomain:f,brand:v}=h(),y=F.includes(v),{countries:b=[],isLoading:g}=C({shopifyStoreDomain:f});return d("div",{className:"relative",children:[e("div",{className:m("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:d("div",{children:[t&&e(r,{className:"mb-5 text-[16px] font-bold",html:t}),o.redeemModal?.product?.addressForm&&e(R,{onChange:a,validate:i,errors:n,form:o.redeemModal.product.addressForm,countries:b,countriesLoading:g})]})}),d("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[d("div",{className:m("flex w-full items-center bg-[#F5F5F7] p-[16px]",!y&&"rounded-none"),children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(A,{item:u,copy:o})]}),e(N,{loading:p||!l,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:c,disabled:x,children:o.redeemModal.product.paymentButton})]})]})};export{E as Address};
2
2
  //# sourceMappingURL=Address.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx"],
4
- "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useShopifyContext } from '@anker-in/shopify'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\n\ntype AddressProps = {\n copy: CreditsRedeemListCopy\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain } = useShopifyContext()\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.redeemModal.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className=\"flex w-full items-center rounded-[16px] bg-[#F5F5F7] p-[16px]\">\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AA0CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA1CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,qBAAAC,MAAyB,oBAGlC,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCAgBlB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,CAAY,EAAIf,EAAkB,EACpC,CAAE,UAAAgB,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIf,EAAa,CAAE,mBAAoBa,CAAY,CAAC,EAExG,OACEpB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAU,GAAmBX,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMQ,EAAiB,EACxFX,EAACK,EAAA,CACC,SAAUO,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWY,EACX,iBAAkBC,EACnB,GACH,EACF,EACAtB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAU,gEACZ,UAAAc,GAAmBf,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMY,EAAiB,EACxFf,EAACO,EAAA,CAAY,KAAMa,EAAM,KAAMV,EAAM,GACvC,EACAV,EAACE,EAAA,CACC,QAASc,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
6
- "names": ["jsx", "jsxs", "Button", "Text", "classNames", "AddressForm", "useShopifyContext", "ProductInfo", "useCountries", "Address", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "countries", "countriesLoading"]
4
+ "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype AddressProps = {\n copy: CreditsRedeemListCopy\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain, brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n {copy.redeemModal?.product?.addressForm && (\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.redeemModal.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n )}\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AA4CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA5CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,sBAAAC,MAA0B,gBAGnC,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCACzB,OAAS,kBAAAC,MAAsB,wBAgBxB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,EAAa,MAAAC,CAAM,EAAIjB,EAAmB,EAC5CkB,EAAUf,EAAe,SAASc,CAAK,EACvC,CAAE,UAAAE,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIlB,EAAa,CAAE,mBAAoBc,CAAY,CAAC,EAExG,OACErB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAW,GAAmBZ,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMS,EAAiB,EACvFD,EAAK,aAAa,SAAS,aAC1BX,EAACK,EAAA,CACC,SAAUQ,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWc,EACX,iBAAkBC,EACnB,GAEL,EACF,EACAzB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAWG,EAAW,iDAAkD,CAACoB,GAAW,cAAc,EACpG,UAAAR,GAAmBhB,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMa,EAAiB,EACxFhB,EAACO,EAAA,CAAY,KAAMc,EAAM,KAAMV,EAAM,GACvC,EACAX,EAACE,EAAA,CACC,QAASe,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "classNames", "AddressForm", "useHeadlessContext", "ProductInfo", "useCountries", "ROUNDED_BRANDS", "Address", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "brand", "rounded", "countries", "countriesLoading"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Picture as t,Text as s}from"@anker-in/headless-ui";const x=({errorInfo:r})=>a("div",{className:"mx-auto max-w-[404px] text-[16px] text-black/40",children:[e(t,{className:"mx-auto mb-[12px] h-[140px] w-[220px]",source:r.imageUrl}),e(s,{as:"div",className:"mt-[16px] text-center",html:r.message})]});export{x as Error};
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Picture as t,Text as s}from"@anker-in/headless-ui";const x=({errorInfo:r})=>a("div",{className:"mx-auto max-w-[404px] text-[16px] text-black/40 py-[56px]",children:[e(t,{className:"mx-auto mb-[12px] h-[140px] w-[220px]",source:r.imageUrl}),e(s,{as:"div",className:"mt-[16px] text-center",html:r.message})]});export{x as Error};
2
2
  //# sourceMappingURL=Error.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx"],
4
- "sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\n\ntype ErrorProps = {\n errorInfo: { imageUrl: string; message: string }\n}\n\nexport const Error = ({ errorInfo }: ErrorProps) => {\n return (\n <div className=\"mx-auto max-w-[404px] text-[16px] text-black/40\">\n <Picture className=\"mx-auto mb-[12px] h-[140px] w-[220px]\" source={errorInfo.imageUrl} />\n <Text as=\"div\" className=\"mt-[16px] text-center\" html={errorInfo.message} />\n </div>\n )\n}\n"],
5
- "mappings": "AAQI,OACE,OAAAA,EADF,QAAAC,MAAA,oBARJ,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAMvB,MAAMC,EAAQ,CAAC,CAAE,UAAAC,CAAU,IAE9BJ,EAAC,OAAI,UAAU,kDACb,UAAAD,EAACE,EAAA,CAAQ,UAAU,wCAAwC,OAAQG,EAAU,SAAU,EACvFL,EAACG,EAAA,CAAK,GAAG,MAAM,UAAU,wBAAwB,KAAME,EAAU,QAAS,GAC5E",
4
+ "sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\n\ntype ErrorProps = {\n errorInfo: { imageUrl: string; message: string }\n}\n\nexport const Error = ({ errorInfo }: ErrorProps) => {\n return (\n <div className=\"mx-auto max-w-[404px] text-[16px] text-black/40 py-[56px]\">\n <Picture className=\"mx-auto mb-[12px] h-[140px] w-[220px]\" source={errorInfo.imageUrl} />\n <Text as=\"div\" className=\"mt-[16px] text-center\" html={errorInfo.message} />\n </div>\n )\n}\n"],
5
+ "mappings": "AAQI,OACE,OAAAA,EADF,QAAAC,MAAA,oBARJ,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAMvB,MAAMC,EAAQ,CAAC,CAAE,UAAAC,CAAU,IAE9BJ,EAAC,OAAI,UAAU,4DACb,UAAAD,EAACE,EAAA,CAAQ,UAAU,wCAAwC,OAAQG,EAAU,SAAU,EACvFL,EAACG,EAAA,CAAK,GAAG,MAAM,UAAU,wBAAwB,KAAME,EAAU,QAAS,GAC5E",
6
6
  "names": ["jsx", "jsxs", "Picture", "Text", "Error", "errorInfo"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{Fragment as b,jsx as e,jsxs as s}from"react/jsx-runtime";import{Button as f,Picture as i,Text as a}from"@anker-in/headless-ui";import m from"classnames";import{Fragment as u,useMemo as g}from"react";import{numberFormat as v}from"../../context/utils";import{ConsumeType as r}from"../../context/const";const F=({copy:l,item:t,loading:x,disabled:n,setStatus:c})=>{const p=g(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...l.redeemModal.product.rules||[]],[t.config.rules,t.config.desc,l.redeemModal.product.rules]);return console.log("item",t),s("div",{className:"flex flex-col",children:[e("div",{className:m("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:s(b,{children:[s("div",{className:"relative mx-auto h-[164px] w-fit",children:[e(i,{source:t.config?.type===r.Product?t.product.images[0]?.url:l?.imageMapping[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&s("div",{className:"flex items-end gap-[4px]",children:[e(a,{className:"text-[64px] font-bold leading-none",html:t.config.value.toString()}),e(a,{className:"text-[24px] font-bold leading-[2]",html:t.config.type===r.Coupon?l?.off:l?.giftCardLabel})]})})]}),s("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&e("div",{className:m("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),s(a,{as:"p",className:m(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[v(t.alpc?.consumeCredits)," ",l?.pointUnit]})]}),s("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[e("div",{className:"text-[16px] font-bold leading-[1.4]",children:l.redeemModal.product.stepTitle}),e("div",{className:"mt-[4px] flex items-center justify-center",children:l.redeemModal.product.steps?.map((d,o)=>s(u,{children:[s("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[e(i,{source:d.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),e("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:d.title})]}),o!==l.redeemModal.product.steps.length-1&&e(i,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},o))}),e("div",{className:"overflow-auto",children:p?.length&&e("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:p.map((d,o)=>e("li",{className:"list-disc",children:e(a,{as:"div",html:d,className:"font-bold"})},o))})})]})]})}),s("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[e(a,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:l.redeemModal.confirmTitle}),e(f,{loading:x,disabled:n,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{c("address")},children:l.redeemModal.confirmButton})]})]})};export{F as Init};
1
+ import{Fragment as w,jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as u,Picture as m,Text as i}from"@anker-in/headless-ui";import a from"classnames";import{Fragment as f,useMemo as g}from"react";import{numberFormat as v}from"../../context/utils";import{ConsumeType as b}from"../../context/const";import{NoneProductValue as N}from"./NonProductValue";import{useCreditsContext as h}from"../../context/provider";const B=({copy:s,item:t,loading:x,disabled:n,setStatus:c})=>{const{pageCommon:p}=h(),r=g(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...s.redeemModal.product.rules||[]],[t.config.rules,t.config.desc,s.redeemModal.product.rules]);return o("div",{className:"flex flex-col",children:[e("div",{className:a("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o(w,{children:[o("div",{className:"relative mx-auto h-[164px] w-fit",children:[e(m,{source:t.config?.type===b.Product?t.product.images[0]?.url:p?.imageMapping?.[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&e(N,{item:t,copy:s})})]}),o("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&e("div",{className:a("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),o(i,{as:"p",className:a(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[v(t.alpc?.consumeCredits)," ",p?.pointUnit]})]}),o("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[e("div",{className:"text-[16px] font-bold leading-[1.4]",children:s.redeemModal.product.stepTitle}),e("div",{className:"mt-[4px] flex items-center justify-center",children:s.redeemModal.product.steps?.map((d,l)=>o(f,{children:[o("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[e(m,{source:d.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),e("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:d.title})]}),l!==s.redeemModal.product.steps.length-1&&e(m,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},l))}),e("div",{className:"overflow-auto",children:r?.length&&e("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:r.map((d,l)=>e("li",{className:"list-disc",children:e(i,{as:"div",html:d,className:"font-bold"})},l))})})]})]})}),o("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[e(i,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:s.redeemModal.confirmTitle}),e(u,{loading:x,disabled:n,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{c("address")},children:s.redeemModal.confirmButton})]})]})};export{B as Init};
2
2
  //# sourceMappingURL=Init.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx"],
4
- "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\n\ntype InitProps = {\n copy: CreditsRedeemListCopy\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.redeemModal.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.redeemModal.product.rules])\n\n console.log('item', item)\n return (\n <div className=\"flex flex-col\">\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <>\n <div className=\"relative mx-auto h-[164px] w-fit\">\n <Picture\n source={\n item.config?.type === ConsumeType.Product\n ? item.product.images[0]?.url\n : copy?.imageMapping[item.config.type]?.url || item.config.image?.url\n }\n className=\"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n {/* \u793C\u54C1\u5361\u5C55\u793A */}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value && (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-bold leading-none\" html={item.config.value.toString()} />\n <Text\n className=\"text-[24px] font-bold leading-[2]\"\n html={item.config.type === ConsumeType.Coupon ? copy?.off : copy?.giftCardLabel}\n />\n </div>\n )}\n </div>\n </div>\n <div className=\"mt-[30px] md:mt-[18px]\">\n {item.config.type === 'product' && (\n <div\n className={classNames(\n 'mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {item.config.title}\n </div>\n )}\n <Text\n as=\"p\"\n className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}\n >\n {numberFormat(item.alpc?.consumeCredits)} {copy?.pointUnit}\n </Text>\n </div>\n <div className=\"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{copy.redeemModal.product.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.redeemModal.product.steps?.map((item, index) => (\n <Fragment key={index}>\n <div className=\"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]\">\n <Picture source={item.imageUrl} className=\"mb-[4px] h-[58px] w-[58px]\"></Picture>\n <div className=\"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]\">\n {item.title}\n </div>\n </div>\n {index !== copy.redeemModal.product.steps.length - 1 && (\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150\"\n className=\"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]\"\n ></Picture>\n )}\n </Fragment>\n ))}\n </div>\n <div className=\"overflow-auto\">\n {rules?.length && (\n <ul className=\"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]\">\n {rules.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text as=\"div\" html={text} className=\"font-bold\" />\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n </>\n </div>\n <div className=\"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]\">\n <Text\n as=\"p\"\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n disabled={disabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full md:mt-[12px]\"\n onClick={() => {\n setStatus('address')\n }}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAiCQ,mBAAAA,EAEI,OAAAC,EAWI,QAAAC,MAbR,oBAjCR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,YAAAN,EAAU,WAAAO,MAAe,QAClC,OAAS,gBAAAC,MAAoB,sBAG7B,OAAS,eAAAC,MAAmB,sBAUrB,MAAMC,EAAO,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,EAAU,UAAAC,CAAU,IAAiB,CAC/E,MAAMC,EAAQT,EAAQ,I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,SAAAU,EAAK,YAAY,QAAQ,OAAO,IAAI,CAACC,EAAMK,IAC1Cf,EAACF,EAAA,CACC,UAAAE,EAAC,OAAI,UAAU,8EACb,UAAAD,EAACG,EAAA,CAAQ,OAAQQ,EAAK,SAAU,UAAU,6BAA6B,EACvEX,EAAC,OAAI,UAAU,gFACZ,SAAAW,EAAK,MACR,GACF,EACCK,IAAUN,EAAK,YAAY,QAAQ,MAAM,OAAS,GACjDV,EAACG,EAAA,CACC,OAAO,qFACP,UAAU,kEACX,IAXUa,CAaf,CACD,EACH,EACAhB,EAAC,OAAI,UAAU,gBACZ,SAAAe,GAAO,QACNf,EAAC,MAAG,UAAU,mHACX,SAAAe,EAAM,IAAI,CAACE,EAAMD,IAChBhB,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,GAAG,MAAM,KAAMa,EAAM,UAAU,YAAY,GADpBD,CAE/B,CACD,EACH,EAEJ,GACF,GACF,EACF,EACAf,EAAC,OAAI,UAAU,+DACb,UAAAD,EAACI,EAAA,CACC,GAAG,IACH,UAAU,4EACV,KAAMM,EAAK,YAAY,aACxB,EACDV,EAACE,EAAA,CACC,QAASU,EACT,SAAUC,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbC,EAAU,SAAS,CACrB,EAEC,SAAAJ,EAAK,YAAY,cACpB,GACF,GACF,CAEJ",
6
- "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useMemo", "numberFormat", "ConsumeType", "Init", "copy", "item", "loading", "disabled", "setStatus", "rules", "index", "text"]
4
+ "sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\nimport { NoneProductValue } from './NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype InitProps = {\n copy: CreditsRedeemListCopy\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const { pageCommon } = useCreditsContext()\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.redeemModal.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.redeemModal.product.rules])\n\n return (\n <div className=\"flex flex-col\">\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <>\n <div className=\"relative mx-auto h-[164px] w-fit\">\n <Picture\n source={\n item.config?.type === ConsumeType.Product\n ? item.product.images[0]?.url\n : pageCommon?.imageMapping?.[item.config.type]?.url || item.config.image?.url\n }\n className=\"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n {/* \u793C\u54C1\u5361\u5C55\u793A */}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value && <NoneProductValue item={item} copy={copy} />}\n </div>\n </div>\n <div className=\"mt-[30px] md:mt-[18px]\">\n {item.config.type === 'product' && (\n <div\n className={classNames(\n 'mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {item.config.title}\n </div>\n )}\n <Text\n as=\"p\"\n className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n </div>\n <div className=\"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{copy.redeemModal.product.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.redeemModal.product.steps?.map((item, index) => (\n <Fragment key={index}>\n <div className=\"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]\">\n <Picture source={item.imageUrl} className=\"mb-[4px] h-[58px] w-[58px]\"></Picture>\n <div className=\"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]\">\n {item.title}\n </div>\n </div>\n {index !== copy.redeemModal.product.steps.length - 1 && (\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150\"\n className=\"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]\"\n ></Picture>\n )}\n </Fragment>\n ))}\n </div>\n <div className=\"overflow-auto\">\n {rules?.length && (\n <ul className=\"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]\">\n {rules.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text as=\"div\" html={text} className=\"font-bold\" />\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n </>\n </div>\n <div className=\"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]\">\n <Text\n as=\"p\"\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n disabled={disabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full md:mt-[12px]\"\n onClick={() => {\n setStatus('address')\n }}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAmCQ,mBAAAA,EAEI,OAAAC,EADF,QAAAC,MADF,oBAnCR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,YAAAN,EAAU,WAAAO,MAAe,QAClC,OAAS,gBAAAC,MAAoB,sBAG7B,OAAS,eAAAC,MAA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Y,EAAK,YAAY,QAAQ,UAAU,EACzFZ,EAAC,OAAI,UAAU,4CACZ,SAAAY,EAAK,YAAY,QAAQ,OAAO,IAAI,CAACC,EAAMM,IAC1ClB,EAACF,EAAA,CACC,UAAAE,EAAC,OAAI,UAAU,8EACb,UAAAD,EAACG,EAAA,CAAQ,OAAQU,EAAK,SAAU,UAAU,6BAA6B,EACvEb,EAAC,OAAI,UAAU,gFACZ,SAAAa,EAAK,MACR,GACF,EACCM,IAAUP,EAAK,YAAY,QAAQ,MAAM,OAAS,GACjDZ,EAACG,EAAA,CACC,OAAO,qFACP,UAAU,kEACX,IAXUgB,CAaf,CACD,EACH,EACAnB,EAAC,OAAI,UAAU,gBACZ,SAAAkB,GAAO,QACNlB,EAAC,MAAG,UAAU,mHACX,SAAAkB,EAAM,IAAI,CAACE,EAAMD,IAChBnB,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,GAAG,MAAM,KAAMgB,EAAM,UAAU,YAAY,GADpBD,CAE/B,CACD,EACH,EAEJ,GACF,GACF,EACF,EACAlB,EAAC,OAAI,UAAU,+DACb,UAAAD,EAACI,EAAA,CACC,GAAG,IACH,UAAU,4EACV,KAAMQ,EAAK,YAAY,aACxB,EACDZ,EAACE,EAAA,CACC,QAASY,EACT,SAAUC,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbC,EAAU,SAAS,CACrB,EAEC,SAAAJ,EAAK,YAAY,cACpB,GACF,GACF,CAEJ",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useMemo", "numberFormat", "ConsumeType", "NoneProductValue", "useCreditsContext", "Init", "copy", "item", "loading", "disabled", "setStatus", "pageCommon", "rules", "index", "text"]
7
7
  }
@@ -0,0 +1,6 @@
1
+ import { RedeemableItem } from '../../type';
2
+ import { CreditsRedeemListCopy } from '../type';
3
+ export declare const NoneProductValue: ({ item, copy }: {
4
+ item: RedeemableItem;
5
+ copy: CreditsRedeemListCopy;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import{jsx as t,jsxs as p}from"react/jsx-runtime";import{Text as o}from"@anker-in/headless-ui";import{ConsumeType as l}from"../../context/const";import{useCreditsContext as a}from"../../context/provider";const x=({item:e,copy:i})=>{const{pageCommon:n}=a();return e.config?.type===l.ShippingCoupon?t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.value,as:"p"}):e.config?.value?p("div",{className:"flex items-end gap-[4px]",children:[t(o,{className:"text-[64px] font-extrabold leading-none",html:e.config.value.toString()}),t(o,{className:"text-[24px] font-bold leading-[2]",html:e.config.type===l.Coupon?n?.off:n?.giftCardLabel})]}):t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.title,as:"p"})};export{x as NoneProductValue};
2
+ //# sourceMappingURL=NonProductValue.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx"],
4
+ "sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { RedeemableItem } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\n\nexport const NoneProductValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n const { pageCommon } = useCreditsContext()\n // shipping coupon \u4EC5\u5C55\u793A\u6587\u6848\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.value} as=\"p\" />\n } else {\n return item.config?.value ? (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-extrabold leading-none\" html={item.config.value.toString()} />\n <Text\n className=\"text-[24px] font-bold leading-[2]\"\n html={item.config.type === ConsumeType.Coupon ? pageCommon?.off : pageCommon?.giftCardLabel}\n />\n </div>\n ) : (\n <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.title} as=\"p\" />\n )\n }\n}\n"],
5
+ "mappings": "AAUW,cAAAA,EAGL,QAAAC,MAHK,oBAVX,OAAS,QAAAC,MAAY,wBAGrB,OAAS,eAAAC,MAAmB,sBAC5B,OAAS,qBAAAC,MAAyB,yBAE3B,MAAMC,EAAmB,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAA6D,CACzG,KAAM,CAAE,WAAAC,CAAW,EAAIJ,EAAkB,EAEzC,OAAIE,EAAK,QAAQ,OAASH,EAAY,eAC7BH,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,EAE9FA,EAAK,QAAQ,MAClBL,EAAC,OAAI,UAAU,2BACb,UAAAD,EAACE,EAAA,CAAK,UAAU,0CAA0C,KAAMI,EAAK,OAAO,MAAM,SAAS,EAAG,EAC9FN,EAACE,EAAA,CACC,UAAU,oCACV,KAAMI,EAAK,OAAO,OAASH,EAAY,OAASK,GAAY,IAAMA,GAAY,cAChF,GACF,EAEAR,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,CAGpG",
6
+ "names": ["jsx", "jsxs", "Text", "ConsumeType", "useCreditsContext", "NoneProductValue", "item", "copy", "pageCommon"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{jsx as a,jsxs as e}from"react/jsx-runtime";import{Picture as m}from"@anker-in/headless-ui";import{formatPrice as l}from"../../context/utils";import{useShopifyContext as i}from"@anker-in/shopify";const x=({item:t,copy:d})=>{const{locale:s}=i();return e("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),e("div",{className:"md:flex md:flex-col",children:[e("div",{className:"md:flex md:items-center",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:t.product.title,children:t.product.title})]}),e("div",{className:"mt-[16px] md:mt-[12px]",children:[a("div",{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",title:t.product.title,children:t.product.title}),e("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[e("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.variantLabel,": "]}),a("span",{className:"ml-1",children:t.variant.title||""})]}),e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:l({amount:0,currencyCode:t.product.price?.currencyCode,locale:s||"us"})})]})]}),e("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),e("div",{className:"l:flex l:items-center l:justify-between",children:[e("span",{children:[d.redeemModal.product.totalPriceLabel,": "]}),e("span",{className:"ml-1",children:[t.alpc?.consumeCredits," ",d?.pointUnit]})]})]})]})]})]})]})};export{x as ProductInfo};
1
+ import{jsx as a,jsxs as e}from"react/jsx-runtime";import{Picture as d,Text as i}from"@anker-in/headless-ui";import{formatPrice as r}from"../../context/utils";import{useHeadlessContext as o}from"@anker-in/lib";import{useCreditsContext as p}from"../../context/provider";const b=({item:t,copy:m})=>{const{locale:s}=o(),{pageCommon:l}=p();return e("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(d,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),e("div",{className:"md:flex md:flex-col",children:[e("div",{className:"md:flex md:items-center",children:[a(d,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:t.product.title,children:t.product.title})]}),e("div",{className:"mt-[16px] md:mt-[12px]",children:[a(i,{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",html:t.product.title,title:t.product.title}),e("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[e("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[m.redeemModal.product.variantLabel,": "]}),a("span",{className:"ml-1",children:t.variant.title||""})]}),e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[m.redeemModal.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:r({amount:0,currencyCode:t.product.price?.currencyCode,locale:s||"us"})})]})]}),e("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[m.redeemModal.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),e("div",{className:"l:flex l:items-center l:justify-between",children:[e("span",{children:[m.redeemModal.product.totalPriceLabel,": "]}),e("span",{className:"ml-1",children:[t.alpc?.consumeCredits," ",l?.pointUnit]})]})]})]})]})]})]})};export{b as ProductInfo};
2
2
  //# sourceMappingURL=ProductInfo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx"],
4
- "sourcesContent": ["import { Picture } from '@anker-in/headless-ui'\nimport { formatPrice } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { useShopifyContext } from '@anker-in/shopify'\n\ntype ProductInfoProps = {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n}\n\nexport const ProductInfo = ({ item, copy }: ProductInfoProps) => {\n const { locale } = useShopifyContext()\n\n return (\n <div className=\"flex w-full items-center justify-center md:items-start md:justify-start\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"md:flex md:flex-col\">\n <div className=\"md:flex md:items-center\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n </div>\n\n <div className=\"mt-[16px] md:mt-[12px]\">\n <div className=\"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n <div className=\"flex font-semibold leading-[1.4] md:flex-col\">\n <div className=\"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.variantLabel}: </span>\n <span className=\"ml-1\">{item.variant.title || ''}</span>\n </div>\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.shippingFeeLabel}: </span>\n <span className=\"ml-1\">\n {formatPrice({\n amount: 0,\n currencyCode: item.product.price?.currencyCode!,\n locale: locale || 'us',\n })}\n </span>\n </div>\n </div>\n <div className=\"text-[15px] font-bold text-[#777] md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.quantityLabel}: </span>\n <span className=\"ml-1\">1</span>\n </div>\n <div className=\"l:flex l:items-center l:justify-between\">\n <span>{copy.redeemModal.product.totalPriceLabel}: </span>\n <span className=\"ml-1\">\n {item.alpc?.consumeCredits} {copy?.pointUnit}\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAgBM,cAAAA,EAME,QAAAC,MANF,oBAhBN,OAAS,WAAAC,MAAe,wBACxB,OAAS,eAAAC,MAAmB,sBAG5B,OAAS,qBAAAC,MAAyB,oBAO3B,MAAMC,EAAc,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAAwB,CAC/D,KAAM,CAAE,OAAAC,CAAO,EAAIJ,EAAkB,EAErC,OACEH,EAAC,OAAI,UAAU,0EACb,UAAAD,EAACE,EAAA,CACC,UAAU,6HACV,OAAQI,EAAK,QAAQ,OAAO,KAAOA,EAAK,SAAS,OAAO,CAAC,GAAG,IAC5D,IAAKA,EAAK,QAAQ,MACnB,EACDL,EAAC,OAAI,UAAU,sBACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACE,EAAA,CACC,UAAU,iIACV,OAAQI,EAAK,QAAQ,OAAO,KAAOA,EAAK,SAAS,OAAO,CAAC,GAAG,IAC5D,IAAKA,EAAK,QAAQ,MACnB,EACDN,EAAC,OAAI,UAAU,2DAA2D,MAAOM,EAAK,QAAQ,MAC3F,SAAAA,EAAK,QAAQ,MAChB,GACF,EAEAL,EAAC,OAAI,UAAU,yBACb,UAAAD,EAAC,OAAI,UAAU,yDAAyD,MAAOM,EAAK,QAAQ,MACzF,SAAAA,EAAK,QAAQ,MAChB,EACAL,EAAC,OAAI,UAAU,+CACb,UAAAA,EAAC,OAAI,UAAU,qEACb,UAAAA,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAM,EAAK,YAAY,QAAQ,aAAa,MAAE,EAC/CP,EAAC,QAAK,UAAU,OAAQ,SAAAM,EAAK,QAAQ,OAAS,GAAG,GACnD,EACAL,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAM,EAAK,YAAY,QAAQ,iBAAiB,MAAE,EACnDP,EAAC,QAAK,UAAU,OACb,SAAAG,EAAY,CACX,OAAQ,EACR,aAAcG,EAAK,QAAQ,OAAO,aAClC,OAAQE,GAAU,IACpB,CAAC,EACH,GACF,GACF,EACAP,EAAC,OAAI,UAAU,mDACb,UAAAA,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAM,EAAK,YAAY,QAAQ,cAAc,MAAE,EAChDP,EAAC,QAAK,UAAU,OAAO,aAAC,GAC1B,EACAC,EAAC,OAAI,UAAU,0CACb,UAAAA,EAAC,QAAM,UAAAM,EAAK,YAAY,QAAQ,gBAAgB,MAAE,EAClDN,EAAC,QAAK,UAAU,OACb,UAAAK,EAAK,MAAM,eAAe,IAAEC,GAAM,WACrC,GACF,GACF,GACF,GACF,GACF,GACF,CAEJ",
6
- "names": ["jsx", "jsxs", "Picture", "formatPrice", "useShopifyContext", "ProductInfo", "item", "copy", "locale"]
4
+ "sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\nimport { formatPrice } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../../context/provider'\n\ntype ProductInfoProps = {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n}\n\nexport const ProductInfo = ({ item, copy }: ProductInfoProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n\n return (\n <div className=\"flex w-full items-center justify-center md:items-start md:justify-start\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"md:flex md:flex-col\">\n <div className=\"md:flex md:items-center\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n </div>\n\n <div className=\"mt-[16px] md:mt-[12px]\">\n <Text\n className=\"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden\"\n html={item.product.title}\n title={item.product.title}\n ></Text>\n <div className=\"flex font-semibold leading-[1.4] md:flex-col\">\n <div className=\"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.variantLabel}: </span>\n <span className=\"ml-1\">{item.variant.title || ''}</span>\n </div>\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.shippingFeeLabel}: </span>\n <span className=\"ml-1\">\n {formatPrice({\n amount: 0,\n currencyCode: item.product.price?.currencyCode!,\n locale: locale || 'us',\n })}\n </span>\n </div>\n </div>\n <div className=\"text-[15px] font-bold text-[#777] md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.quantityLabel}: </span>\n <span className=\"ml-1\">1</span>\n </div>\n <div className=\"l:flex l:items-center l:justify-between\">\n <span>{copy.redeemModal.product.totalPriceLabel}: </span>\n <span className=\"ml-1\">\n {item.alpc?.consumeCredits} {pageCommon?.pointUnit}\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
+ "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K,UAAU,OACb,SAAAI,EAAY,CACX,OAAQ,EACR,aAAcI,EAAK,QAAQ,OAAO,aAClC,OAAQE,GAAU,IACpB,CAAC,EACH,GACF,GACF,EACAT,EAAC,OAAI,UAAU,mDACb,UAAAA,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAQ,EAAK,YAAY,QAAQ,cAAc,MAAE,EAChDT,EAAC,QAAK,UAAU,OAAO,aAAC,GAC1B,EACAC,EAAC,OAAI,UAAU,0CACb,UAAAA,EAAC,QAAM,UAAAQ,EAAK,YAAY,QAAQ,gBAAgB,MAAE,EAClDR,EAAC,QAAK,UAAU,OACb,UAAAO,EAAK,MAAM,eAAe,IAAEG,GAAY,WAC3C,GACF,GACF,GACF,GACF,GACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Picture", "Text", "formatPrice", "useHeadlessContext", "useCreditsContext", "ProductInfo", "item", "copy", "locale", "pageCommon"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as u}from"react/jsx-runtime";import{Button as x,Text as o}from"@anker-in/headless-ui";import n from"classnames";import{ProductInfo as c}from"./ProductInfo";const N=({copy:t,shippingProduct:m,loading:d,address:s,disabled:p,onClose:a,item:l})=>e("div",{className:n("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:u("div",{className:"flex flex-col items-center",children:[e("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:t.redeemModal.product.successDesc.map((r,i)=>e(o,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:r},i))}),m&&e(o,{className:"mb-5 text-[16px] font-bold",html:m}),e("div",{className:"flex w-full items-center rounded-[16px] bg-[#F5F5F7] p-[16px]",children:e(c,{item:l,copy:t})}),e(x,{loading:d||!s,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:a,disabled:p,children:t.redeemModal.product.paymentButton})]})});export{N as Success};
1
+ import{jsx as e,jsxs as v}from"react/jsx-runtime";import{Button as u,Text as m}from"@anker-in/headless-ui";import d from"classnames";import{ProductInfo as f}from"./ProductInfo";import{useHeadlessContext as b}from"@anker-in/lib";import{ROUNDED_BRANDS as y}from"../../../../constants";const B=({copy:t,shippingProduct:o,loading:s,address:a,disabled:p,onClose:r,item:i})=>{const{brand:l}=b(),n=y.includes(l);return e("div",{className:d("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:v("div",{className:"flex flex-col items-center",children:[e("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:t.redeemModal.product.successDesc.map((x,c)=>e(m,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:x},c))}),o&&e(m,{className:"mb-5 text-[16px] font-bold",html:o}),e("div",{className:d("flex w-full items-center bg-[#F5F5F7] p-[16px]",!n&&"rounded-none"),children:e(f,{item:i,copy:t})}),e(u,{loading:s||!a,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:r,disabled:p,children:t.redeemModal.product.paymentButton})]})})};export{B as Success};
2
2
  //# sourceMappingURL=Success.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx"],
4
- "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\n\ntype SuccessProps = {\n copy: CreditsRedeemListCopy\n shippingProduct: string\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n onClose: () => void\n item: RedeemableItemType\n}\n\nexport const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {\n return (\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div className=\"flex flex-col items-center\">\n <div className=\"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]\">\n {copy.redeemModal.product.successDesc.map((description: string, index: number) => (\n <Text key={index} className=\"text-[18px] font-bold leading-[1.4] md:text-[14px]\" html={description}></Text>\n ))}\n </div>\n\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n\n <div className=\"flex w-full items-center rounded-[16px] bg-[#F5F5F7] p-[16px]\">\n <ProductInfo item={item} copy={copy} />\n </div>\n\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={onClose}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAmBM,OAGM,OAAAA,EAHN,QAAAC,MAAA,oBAnBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aAGvB,OAAS,eAAAC,MAAmB,gBAYrB,MAAMC,EAAU,CAAC,CAAE,KAAAC,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAEvFb,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,wDACZ,SAAAO,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACO,EAAqBC,IAC9Df,EAACG,EAAA,CAAiB,UAAU,qDAAqD,KAAMW,GAA5EC,CAAyF,CACrG,EACH,EAECP,GAAmBR,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMK,EAAiB,EAExFR,EAAC,OAAI,UAAU,gEACb,SAAAA,EAACK,EAAA,CAAY,KAAMQ,EAAM,KAAMN,EAAM,EACvC,EAEAP,EAACE,EAAA,CACC,QAASO,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF",
6
- "names": ["jsx", "jsxs", "Button", "Text", "classNames", "ProductInfo", "Success", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "description", "index"]
4
+ "sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { ROUNDED_BRANDS } from '../../../../constants'\n\ntype SuccessProps = {\n copy: CreditsRedeemListCopy\n shippingProduct: string\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n onClose: () => void\n item: RedeemableItemType\n}\n\nexport const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n return (\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div className=\"flex flex-col items-center\">\n <div className=\"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]\">\n {copy.redeemModal.product.successDesc.map((description: string, index: number) => (\n <Text key={index} className=\"text-[18px] font-bold leading-[1.4] md:text-[14px]\" html={description}></Text>\n ))}\n </div>\n\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n <ProductInfo item={item} copy={copy} />\n </div>\n\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={onClose}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AAuBM,OAGM,OAAAA,EAHN,QAAAC,MAAA,oBAvBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aAGvB,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,kBAAAC,MAAsB,wBAYxB,MAAMC,EAAU,CAAC,CAAE,KAAAC,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,EAAIV,EAAmB,EAC/BW,EAAUV,EAAe,SAASS,CAAK,EAC7C,OACEhB,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,wDACZ,SAAAS,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACS,EAAqBC,IAC9DnB,EAACG,EAAA,CAAiB,UAAU,qDAAqD,KAAMe,GAA5EC,CAAyF,CACrG,EACH,EAECT,GAAmBV,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMO,EAAiB,EAExFV,EAAC,OAAI,UAAWI,EAAW,iDAAkD,CAACa,GAAW,cAAc,EACrG,SAAAjB,EAACK,EAAA,CAAY,KAAMU,EAAM,KAAMN,EAAM,EACvC,EAEAT,EAACE,EAAA,CACC,QAASS,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "classNames", "ProductInfo", "useHeadlessContext", "ROUNDED_BRANDS", "Success", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "brand", "rounded", "description", "index"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as u,jsxs as X}from"react/jsx-runtime";import R from"classnames";import{useCallback as w,useEffect as F,useMemo as K,useState as l}from"react";import{useCreditsContext as _}from"../../context/provider";import k from"../../context/hooks/useCountries";import{AlpcErrorCode as c}from"../../context/const";import{useAddressValidate as T}from"../../context/hooks/useAddressValidate";import{useRedeemProduct as B}from"../../context/hooks/useRedeemProduct";import{CreditsModalContainer as G}from"../../modal/modalContainer";import{useShopifyContext as J}from"@anker-in/shopify";import{Error as V}from"./Error";import{Success as z}from"./Success";import{Address as H}from"./Address";import{Init as Q}from"./Init";function W({item:s,copy:e,onError:h,...m}){const{fetchCreditInfo:E,profile:I}=_(),{storeDomain:A,locale:N}=J(),{validatorInfo:S}=e,{shippingAddress:y,shippingProduct:v}=e.redeemModal.product,[d,i]=l("init"),[t,L]=l(),[x,n]=l({code:0,message:"",imageUrl:""}),[f,a]=l(!1),{countries:b=[],isLoading:Y}=k({shopifyStoreDomain:A}),{isMutating:p,trigger:P}=B({onSuccess(r){if(!r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""});return}if(r?.code===0)E(I?.user_id),i("success");else{let o,M;r.code===c.CodeLpcShopifyCouponRuleRedeemLimit?(o=e.redeemModal.redeemLimitError,a(!0)):r.code===c.CodeLpcRuleInventoryNotEnough?(o=e.redeemModal.inventoryNotEnough,a(!0),M=e.redeemModal.inventoryNotEnough):r.code===c.CodeLpcNotEnoughCredits?(o=e.redeemModal.creditsNotEnough,a(!0),E(I?.user_id)):r.code===c.CodeCrossSiteError&&(o=e.redeemModal.crossSiteError,a(!0)),i("error"),n({code:r.code,imageUrl:M||e.redeemModal.errorImageUrl||"",message:o||e.redeemModal.commonError||""}),h&&h(r.code)}},onError(r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""})}}),g=K(()=>e?.redeemModal.product.form?.flat().find(o=>o.type==="state")?.key,[e?.redeemModal.product.form]),{validate:C,errors:U}=T({address:t,validatorInfo:S,formData:e?.redeemModal.product.form?.flat()||[],errorLabel:{require:e.redeemModal.product.required,email:e.redeemModal.product.invalidEmail}}),O=w(async()=>{const r=[];if(g&&((b.find(q=>q.code===t.country)?.provinces||[]).length||r.push(g)),C({force:!0,ignoreKeys:r}))return;console.log("address",t);let o={...t};o.name&&delete o.name,o.country==="UK"&&(o.country="GB"),P({address:btoa(JSON.stringify(o)),rule_id:Number(s.alpc?.id)})},[s,P,g,C,t,b]);return F(()=>{m.isOpen||(a(!1),n({code:0,message:"",imageUrl:""}))},[m.isOpen,N]),X(G,{...m,className:R("w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]",d!=="init"&&"w-[740px] md:w-full"),scrollClassName:"mb-0 min-l:px-0 md:mb-0 px-0",titleClassName:R("h-[56px]",d==="init"&&"bg-[#F5F5F7]"),title:d==="address"?"Order Confirmation":"",children:[d==="error"&&u(V,{errorInfo:x}),d==="success"&&u(z,{copy:e,shippingProduct:v,loading:p,address:t,disabled:f,onClose:m.onClose,item:s}),d==="address"&&u(H,{copy:e,shippingAddress:y,setAddress:L,validateAddress:C,validateErrors:U,shippingProduct:v,loading:p,address:t,disabled:f,handlePayment:O,item:s}),d==="init"&&u(Q,{item:s,copy:e,loading:p,disabled:f,setStatus:i})]})}var ce=W;export{ce as default};
1
+ import{jsx as u,jsxs as X}from"react/jsx-runtime";import R from"classnames";import{useCallback as F,useEffect as K,useMemo as _,useState as l}from"react";import{useCreditsContext as A}from"../../context/provider";import k from"../../context/hooks/useCountries";import{AlpcErrorCode as c}from"../../context/const";import{useAddressValidate as T}from"../../context/hooks/useAddressValidate";import{useRedeemProduct as B}from"../../context/hooks/useRedeemProduct";import{CreditsModalContainer as G}from"../../modal/modalContainer";import{useHeadlessContext as H}from"@anker-in/lib";import{Error as J}from"./Error";import{Success as V}from"./Success";import{Address as z}from"./Address";import{Init as Q}from"./Init";function W({item:s,copy:e,onError:h,...m}){const{fetchCreditInfo:E,profile:I}=A(),{storeDomain:N,locale:y}=H(),{pageCommon:L}=A(),{shippingAddress:S,shippingProduct:v}=e.redeemModal.product,[d,i]=l("init"),[t,x]=l(),[U,n]=l({code:0,message:"",imageUrl:""}),[f,a]=l(!1),{countries:b=[],isLoading:Y}=k({shopifyStoreDomain:N}),{isMutating:p,trigger:P}=B({onSuccess(r){if(!r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""});return}if(r?.code===0)E(I?.user_id),i("success");else{let o,M;r.code===c.CodeLpcShopifyCouponRuleRedeemLimit?(o=e.redeemModal.redeemLimitError,a(!0)):r.code===c.CodeLpcRuleInventoryNotEnough?(o=e.redeemModal.inventoryNotEnough,a(!0),M=e.redeemModal.inventoryNotEnough):r.code===c.CodeLpcNotEnoughCredits?(o=e.redeemModal.creditsNotEnough,a(!0),E(I?.user_id)):r.code===c.CodeCrossSiteError&&(o=e.redeemModal.crossSiteError,a(!0)),i("error"),n({code:r.code,imageUrl:M||e.redeemModal.errorImageUrl||"",message:o||e.redeemModal.commonError||""}),h&&h(r.code)}},onError(r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""})}}),g=_(()=>e?.redeemModal.product.form?.flat().find(o=>o.type==="state")?.key,[e?.redeemModal.product.form]),{validate:C,errors:O}=T({address:t,validatorInfo:L?.validatorInfo,formData:e?.redeemModal.product.form?.flat()||[],errorLabel:{require:e.redeemModal.product.required,email:e.redeemModal.product.invalidEmail}}),q=F(async()=>{const r=[];if(g&&((b.find(w=>w.code===t.country)?.provinces||[]).length||r.push(g)),C({force:!0,ignoreKeys:r}))return;let o={...t};o.name&&delete o.name,o.country==="UK"&&(o.country="GB"),P({address:btoa(JSON.stringify(o)),rule_id:Number(s.alpc?.id)})},[s,P,g,C,t,b]);return K(()=>{m.isOpen||(a(!1),n({code:0,message:"",imageUrl:""}))},[m.isOpen,y]),X(G,{...m,className:R("w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]",d!=="init"&&"w-[740px] md:w-full"),scrollClassName:"mb-0 min-l:px-0 md:mb-0 px-0",titleClassName:R("h-[56px]",d==="init"&&"bg-[#F5F5F7]"),title:d==="address"?"Order Confirmation":"",children:[d==="error"&&u(J,{errorInfo:U}),d==="success"&&u(V,{copy:e,shippingProduct:v,loading:p,address:t,disabled:f,onClose:m.onClose,item:s}),d==="address"&&u(z,{copy:e,shippingAddress:S,setAddress:x,validateAddress:C,validateErrors:O,shippingProduct:v,loading:p,address:t,disabled:f,handlePayment:q,item:s}),d==="init"&&u(Q,{item:s,copy:e,loading:p,disabled:f,setStatus:i})]})}var ce=W;export{ce as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx"],
4
- "sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { useCreditsContext } from '../../context/provider'\nimport useCountries from '../../context/hooks/useCountries'\nimport { AlpcErrorCode } from '../../context/const'\nimport { useAddressValidate } from '../../context/hooks/useAddressValidate'\nimport { useRedeemProduct } from '../../context/hooks/useRedeemProduct'\nimport type { ModalContainerProps } from '../../modal/modalContainer'\nimport { CreditsModalContainer } from '../../modal/modalContainer'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { useShopifyContext } from '@anker-in/shopify'\nimport { CreditsRedeemListCopy } from '../type'\nimport { Error } from './Error'\nimport { Success } from './Success'\nimport { Address } from './Address'\nimport { Init } from './Init'\n\ntype RedeemProductModalProps = ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: AlpcErrorCode) => void\n}\n\nfunction RedeemProductModal({ item, copy, onError, ...props }: RedeemProductModalProps) {\n const { fetchCreditInfo, profile } = useCreditsContext()\n const { storeDomain, locale } = useShopifyContext()\n\n const { validatorInfo } = copy\n const { shippingAddress, shippingProduct } = copy.redeemModal.product\n\n const [status, setStatus] = useState<'init' | 'address' | 'success' | 'error'>('init')\n const [address, setAddress] = useState<any>()\n const [errorInfo, setErrorInfo] = useState({\n code: 0,\n message: '',\n imageUrl: '',\n })\n const [disabled, setDisabled] = useState(false)\n\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n const { isMutating: loading, trigger } = useRedeemProduct({\n onSuccess(responseData) {\n if (!responseData) {\n setStatus('error')\n setErrorInfo({\n code: 0,\n imageUrl: copy.redeemModal.errorImageUrl || '',\n message: copy.redeemModal.commonError || '',\n })\n return\n }\n\n if (responseData?.code === 0) {\n fetchCreditInfo(profile?.user_id)\n setStatus('success')\n } else {\n let errorMsg\n let errorImage\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n errorImage = copy.redeemModal.inventoryNotEnough\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setStatus('error')\n setErrorInfo({\n code: responseData.code,\n imageUrl: errorImage || copy.redeemModal.errorImageUrl || '',\n message: errorMsg || copy.redeemModal.commonError || '',\n })\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setStatus('error')\n setErrorInfo({\n code: 0,\n imageUrl: copy.redeemModal.errorImageUrl || '',\n message: copy.redeemModal.commonError || '',\n })\n },\n })\n\n const stateInputKey = useMemo(() => {\n const stateInput = copy?.redeemModal.product.form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [copy?.redeemModal.product.form])\n\n const { validate: validateAddress, errors: validateErrors } = useAddressValidate({\n address: address,\n validatorInfo: validatorInfo,\n formData: copy?.redeemModal.product.form?.flat() || [],\n errorLabel: {\n require: copy.redeemModal.product.required,\n email: copy.redeemModal.product.invalidEmail,\n },\n })\n\n const handlePayment = useCallback(async () => {\n const ignoreKeys: string[] = []\n\n if (stateInputKey) {\n const provinces = countries.find(item => item.code === address.country)?.provinces || []\n\n if (!provinces.length) {\n ignoreKeys.push(stateInputKey as never)\n }\n }\n\n if (\n validateAddress({\n force: true,\n ignoreKeys,\n })\n ) {\n // \u5730\u5740\u6821\u9A8C\u9519\u8BEF\n return\n }\n console.log('address', address)\n let requestAddress = { ...address }\n if (requestAddress.name) {\n delete requestAddress.name\n }\n if (requestAddress.country === 'UK') {\n requestAddress.country = 'GB'\n }\n trigger({\n address: btoa(JSON.stringify(requestAddress)),\n rule_id: Number(item.alpc?.id),\n })\n }, [item, trigger, stateInputKey, validateAddress, address, countries])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo({ code: 0, message: '', imageUrl: '' })\n }\n }, [props.isOpen, locale])\n\n return (\n <CreditsModalContainer\n {...props}\n className={classNames(\n 'w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]',\n status !== 'init' && 'w-[740px] md:w-full'\n )}\n scrollClassName=\"mb-0 min-l:px-0 md:mb-0 px-0\"\n titleClassName={classNames('h-[56px]', status === 'init' && 'bg-[#F5F5F7]')}\n title={status === 'address' ? 'Order Confirmation' : ''}\n >\n {status === 'error' && <Error errorInfo={errorInfo} />}\n {status === 'success' && (\n <Success\n copy={copy}\n shippingProduct={shippingProduct}\n loading={loading}\n address={address}\n disabled={disabled}\n onClose={props.onClose}\n item={item}\n />\n )}\n {status === 'address' && (\n <Address\n copy={copy}\n shippingAddress={shippingAddress}\n setAddress={setAddress}\n validateAddress={validateAddress}\n validateErrors={validateErrors}\n shippingProduct={shippingProduct}\n loading={loading}\n address={address}\n disabled={disabled}\n handlePayment={handlePayment}\n item={item}\n />\n )}\n {status === 'init' && (\n <Init item={item} copy={copy} loading={loading} disabled={disabled} setStatus={setStatus} />\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemPro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AgBC,EAChB,gBAAiBnB,EACjB,QAASW,EACT,QAASR,EACT,SAAUI,EACV,cAAea,EACf,KAAM9B,EACR,EAEDW,IAAW,QACV9B,EAACiB,EAAA,CAAK,KAAME,EAAM,KAAMC,EAAM,QAASoB,EAAS,SAAUJ,EAAU,UAAWL,EAAW,GAE9F,CAEJ,CAEA,IAAOqB,GAAQlC",
6
- "names": ["jsx", "jsxs", "classNames", "useCallback", "useEffect", "useMemo", "useState", "useCreditsContext", "useCountries", "AlpcErrorCode", "useAddressValidate", "useRedeemProduct", "CreditsModalContainer", "useShopifyContext", "Error", "Success", "Address", "Init", "RedeemProductModal", "item", "copy", "onError", "props", "fetchCreditInfo", "profile", "storeDomain", "locale", "validatorInfo", "shippingAddress", "shippingProduct", "status", "setStatus", "address", "setAddress", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "countries", "countriesLoading", "loading", "trigger", "responseData", "errorMsg", "errorImage", "error", "stateInputKey", "validateAddress", "validateErrors", "handlePayment", "ignoreKeys", "requestAddress", "RedeemProductModal_default"]
4
+ "sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { useCreditsContext } from '../../context/provider'\nimport useCountries from '../../context/hooks/useCountries'\nimport { AlpcErrorCode } from '../../context/const'\nimport { useAddressValidate } from '../../context/hooks/useAddressValidate'\nimport { useRedeemProduct } from '../../context/hooks/useRedeemProduct'\nimport type { ModalContainerProps } from '../../modal/modalContainer'\nimport { CreditsModalContainer } from '../../modal/modalContainer'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsRedeemListCopy } from '../type'\nimport { Error } from './Error'\nimport { Success } from './Success'\nimport { Address } from './Address'\nimport { Init } from './Init'\n\ntype RedeemProductModalProps = ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: AlpcErrorCode) => void\n}\n\nfunction RedeemProductModal({ item, copy, onError, ...props }: RedeemProductModalProps) {\n const { fetchCreditInfo, profile } = useCreditsContext()\n const { storeDomain, locale } = useHeadlessContext()\n\n const { pageCommon } = useCreditsContext()\n const { shippingAddress, shippingProduct } = copy.redeemModal.product\n\n const [status, setStatus] = useState<'init' | 'address' | 'success' | 'error'>('init')\n const [address, setAddress] = useState<any>()\n const [errorInfo, setErrorInfo] = useState({\n code: 0,\n message: '',\n imageUrl: '',\n })\n const [disabled, setDisabled] = useState(false)\n\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n const { isMutating: loading, trigger } = useRedeemProduct({\n onSuccess(responseData) {\n if (!responseData) {\n setStatus('error')\n setErrorInfo({\n code: 0,\n imageUrl: copy.redeemModal.errorImageUrl || '',\n message: copy.redeemModal.commonError || '',\n })\n return\n }\n\n if (responseData?.code === 0) {\n fetchCreditInfo(profile?.user_id)\n setStatus('success')\n } else {\n let errorMsg\n let errorImage\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n errorImage = copy.redeemModal.inventoryNotEnough\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setStatus('error')\n setErrorInfo({\n code: responseData.code,\n imageUrl: errorImage || copy.redeemModal.errorImageUrl || '',\n message: errorMsg || copy.redeemModal.commonError || '',\n })\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setStatus('error')\n setErrorInfo({\n code: 0,\n imageUrl: copy.redeemModal.errorImageUrl || '',\n message: copy.redeemModal.commonError || '',\n })\n },\n })\n\n const stateInputKey = useMemo(() => {\n const stateInput = copy?.redeemModal.product.form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [copy?.redeemModal.product.form])\n\n const { validate: validateAddress, errors: validateErrors } = useAddressValidate({\n address: address,\n validatorInfo: pageCommon?.validatorInfo,\n formData: copy?.redeemModal.product.form?.flat() || [],\n errorLabel: {\n require: copy.redeemModal.product.required,\n email: copy.redeemModal.product.invalidEmail,\n },\n })\n\n const handlePayment = useCallback(async () => {\n const ignoreKeys: string[] = []\n\n if (stateInputKey) {\n const provinces = countries.find(item => item.code === address.country)?.provinces || []\n\n if (!provinces.length) {\n ignoreKeys.push(stateInputKey as never)\n }\n }\n\n if (\n validateAddress({\n force: true,\n ignoreKeys,\n })\n ) {\n // \u5730\u5740\u6821\u9A8C\u9519\u8BEF\n return\n }\n let requestAddress = { ...address }\n if (requestAddress.name) {\n delete requestAddress.name\n }\n if (requestAddress.country === 'UK') {\n requestAddress.country = 'GB'\n }\n trigger({\n address: btoa(JSON.stringify(requestAddress)),\n rule_id: Number(item.alpc?.id),\n })\n }, [item, trigger, stateInputKey, validateAddress, address, countries])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo({ code: 0, message: '', imageUrl: '' })\n }\n }, [props.isOpen, locale])\n\n return (\n <CreditsModalContainer\n {...props}\n className={classNames(\n 'w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]',\n status !== 'init' && 'w-[740px] md:w-full'\n )}\n scrollClassName=\"mb-0 min-l:px-0 md:mb-0 px-0\"\n titleClassName={classNames('h-[56px]', status === 'init' && 'bg-[#F5F5F7]')}\n title={status === 'address' ? 'Order Confirmation' : ''}\n >\n {status === 'error' && <Error errorInfo={errorInfo} />}\n {status === 'success' && (\n <Success\n copy={copy}\n shippingProduct={shippingProduct}\n loading={loading}\n address={address}\n disabled={disabled}\n onClose={props.onClose}\n item={item}\n />\n )}\n {status === 'address' && (\n <Address\n copy={copy}\n shippingAddress={shippingAddress}\n setAddress={setAddress}\n validateAddress={validateAddress}\n validateErrors={validateErrors}\n shippingProduct={shippingProduct}\n loading={loading}\n address={address}\n disabled={disabled}\n handlePayment={handlePayment}\n item={item}\n />\n )}\n {status === 'init' && (\n <Init item={item} copy={copy} loading={loading} disabled={disabled} setStatus={setStatus} />\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemProductModal\n"],
5
+ "mappings": "AAsJI,OAUyB,OAAAA,EAVzB,QAAAC,MAAA,oBAtJJ,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QAC1D,OAAS,qBAAAC,MAAyB,yBAClC,OAAOC,MAAkB,mCACzB,OAAS,iBAAAC,MAAqB,sBAC9B,OAAS,sBAAAC,MAA0B,yCACnC,OAAS,oBAAAC,MAAwB,uCAEjC,OAAS,yBAAAC,MAA6B,6BAEtC,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,SAAAC,MAAa,UACtB,OAAS,WAAAC,MAAe,YACxB,OAAS,WAAAC,MAAe,YACxB,OAAS,QAAAC,MAAY,SAQrB,SAASC,EAAmB,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,GAAGC,CAAM,EAA4B,CACtF,KAAM,CAAE,gBAAAC,EAAiB,QAAAC,CAAQ,EAAIjB,EAAkB,EACjD,CAAE,YAAAkB,EAAa,OAAAC,CAAO,EAAIb,EAAmB,EAE7C,CAAE,WAAAc,CAAW,EAAIpB,EAAkB,EACnC,CAAE,gBAAAqB,EAAiB,gBAAAC,CAAgB,EAAIT,EAAK,YAAY,QAExD,CAACU,EAAQC,CAAS,EAAIzB,EAAmD,MAAM,EAC/E,CAAC0B,EAASC,CAAU,EAAI3B,EAAc,EACtC,CAAC4B,EAAWC,CAAY,EAAI7B,EAAS,CACzC,KAAM,EACN,QAAS,GACT,SAAU,EACZ,CAAC,EACK,CAAC8B,EAAUC,CAAW,EAAI/B,EAAS,EAAK,EAExC,CAAE,UA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ACV9B,EAACe,EAAA,CACC,KAAMK,EACN,gBAAiBS,EACjB,QAASW,EACT,QAASR,EACT,SAAUI,EACV,QAASd,EAAM,QACf,KAAMH,EACR,EAEDW,IAAW,WACV9B,EAACgB,EAAA,CACC,KAAMI,EACN,gBAAiBQ,EACjB,WAAYK,EACZ,gBAAiBc,EACjB,eAAgBC,EAChB,gBAAiBnB,EACjB,QAASW,EACT,QAASR,EACT,SAAUI,EACV,cAAea,EACf,KAAM9B,EACR,EAEDW,IAAW,QACV9B,EAACiB,EAAA,CAAK,KAAME,EAAM,KAAMC,EAAM,QAASoB,EAAS,SAAUJ,EAAU,UAAWL,EAAW,GAE9F,CAEJ,CAEA,IAAOqB,GAAQlC",
6
+ "names": ["jsx", "jsxs", "classNames", "useCallback", "useEffect", "useMemo", "useState", "useCreditsContext", "useCountries", "AlpcErrorCode", "useAddressValidate", "useRedeemProduct", "CreditsModalContainer", "useHeadlessContext", "Error", "Success", "Address", "Init", "RedeemProductModal", "item", "copy", "onError", "props", "fetchCreditInfo", "profile", "storeDomain", "locale", "pageCommon", "shippingAddress", "shippingProduct", "status", "setStatus", "address", "setAddress", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "countries", "countriesLoading", "loading", "trigger", "responseData", "errorMsg", "errorImage", "error", "stateInputKey", "validateAddress", "validateErrors", "handlePayment", "ignoreKeys", "requestAddress", "RedeemProductModal_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as l,jsxs as a}from"react/jsx-runtime";import{Button as y,Text as n,Picture as p}from"@anker-in/headless-ui";import{useMemo as c}from"react";import s from"classnames";import{useCreditsContext as N}from"../context/provider";import{AlpcConsumeType as u,ConsumeType as f}from"../context/const";import{numberFormat as C}from"../context/utils";import{gaTrack as v}from"../../../helpers/track";function E({copy:t,className:g,item:e,onRulesOpen:b,onRedeem:h}){const{creditInfo:m,profile:i,gtm:{pageGroup:x}}=N(),o=Object.keys(i||{}).length>0,_=c(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===u.Product&&!e.variant?.availableForSale||o&&i?.activated&&e.alpc?.consumeCredits>Number(m?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,o,i?.activated,m?.available_credit,e.variant?.availableForSale]),d=c(()=>o?e.alpc?.consumeType===u.Product?e.variant?.availableForSale?t.btnRedeem:t?.soldOut||"Sold Out":t.btnRedeem:t.unlockRewards,[o,e.alpc?.consumeType,e.variant?.availableForSale,t.btnRedeem,t.unlockRewards,t?.soldOut]);return a("div",{className:s("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",g),children:[e.config?.type!==f.Product?a("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[l(p,{source:t?.imageMapping[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),l("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white md:bottom-[2px] md:left-[5px]",children:e.config?.value?a("div",{className:"flex items-end",children:[l(n,{className:"text-[64px] font-bold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]",html:e.config?.value}),l(n,{className:"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]",html:e.config?.type===f.GiftCard?t?.giftCardLabel:t?.off})]}):l(n,{size:3,html:e.config?.title||e.alpc?.title})})]}):l("div",{className:s("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:l(p,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})}),a("div",{className:s("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[l(n,{html:e.config?.title||e.alpc?.title,title:e.config?.title||e.alpc?.title,size:2,className:"text-[24px] font-bold leading-[1.2] l:text-[16px] l-xxl:text-[20px]"}),e.config?.rules?.length>0&&l("button",{type:"button",onClick:()=>{b(e.config?.rules||[]),v({event:"ga4Event",event_name:"lp_button",member_active_status:i?.activated?"active":"not active",event_parameters:{page_group:x,position:t.title,button_name:t?.ruleLabel,info:e.alpc?.id?.toString()}})},className:"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&r.preventDefault()},children:t?.ruleLabel}),a("div",{children:[a("div",{className:"mt-[24px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[l(p,{className:"size-[20px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),l(n,{html:`${C(e.alpc?.consumeCredits)}`,size:2,as:"p",className:"ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),l(y,{disabled:_,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{h(e),v({event:"ga4Event",event_name:"lp_button",member_active_status:i?.activated?"active":"not active",event_parameters:{page_group:x,position:t.title,button_name:d,info:e.alpc?.id?.toString()}})},children:d})]})]})]})}export{E as RedeemableItem};
1
+ import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Button as C,Text as u,Picture as p}from"@anker-in/headless-ui";import{useMemo as x}from"react";import s from"classnames";import{useCreditsContext as R}from"../context/provider";import{AlpcConsumeType as f,ConsumeType as T}from"../context/const";import{numberFormat as w}from"../context/utils";import{gaTrack as v,useHeadlessContext as I}from"@anker-in/lib";import{NoneProductValue as k}from"./NonProductValue";import{ROUNDED_BRANDS as S}from"../../../constants";function j({copy:l,className:g,item:e,onRulesOpen:b,onRedeem:y}){const{creditInfo:m,profile:a,gtm:{pageGroup:d},pageCommon:n}=R(),{brand:_}=I(),i=Object.keys(a||{}).length>0,h=S.includes(_),N=x(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===f.Product&&!e.variant?.availableForSale||i&&a?.activated&&e.alpc?.consumeCredits>Number(m?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,i,a?.activated,m?.available_credit,e.variant?.availableForSale]),c=x(()=>i?e.alpc?.consumeType===f.Product?e.variant?.availableForSale?l.btnRedeem:n?.soldOut||"Sold Out":l.btnRedeem:l.unlockRewards,[i,e.alpc?.consumeType,e.variant?.availableForSale,l.btnRedeem,l.unlockRewards,n?.soldOut]);return o("div",{className:s("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!h&&"rounded-none md:rounded-none",g),children:[e.config?.type===T.Product?t("div",{className:s("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(p,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product.images?.[0]?.url})}):o("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[t(p,{source:n?.imageMapping?.[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),t(k,{item:e})]}),o("div",{className:s("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[t(u,{html:e.config?.title||e.alpc?.title,title:e.config?.title||e.alpc?.title,size:2,className:"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]"}),e.config?.rules?.length>0&&t("button",{type:"button",onClick:()=>{b(e.config?.rules||[]),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:n?.ruleLabel,info:e.alpc?.id?.toString()}})},className:"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&r.preventDefault()},children:n?.ruleLabel}),o("div",{children:[o("div",{className:"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[t(p,{className:"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),t(u,{html:`${w(e.alpc?.consumeCredits)}`,size:2,as:"p",className:"ml-[4px] text-[28px] font-bold mt-[4px] leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),t(C,{disabled:N,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{y(e),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:c,info:e.alpc?.id?.toString()}})},children:c})]})]})]})}export{j as RedeemableItem};
2
2
  //# sourceMappingURL=RedeemableItem.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemableItem.tsx"],
4
- "sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\n\nimport { useMemo } from 'react'\n\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { AlpcConsumeType, ConsumeType } from '../context/const'\nimport { numberFormat } from '../context/utils'\nimport type { CreditsRedeemListCopy } from './type'\nimport { gaTrack } from '../../../helpers/track'\n\nexport function RedeemableItem({\n copy,\n className,\n item,\n onRulesOpen,\n onRedeem,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n item: RedeemableItemType\n onRulesOpen: (rules: string[]) => void\n onRedeem: (item: RedeemableItemType) => void\n}) {\n const {\n creditInfo,\n profile,\n gtm: { pageGroup },\n } = useCreditsContext()\n const isLogin = Object.keys(profile || {}).length > 0\n\n const isDisabled = useMemo(() => {\n if (item.alpc?.remainingInventory <= 0 && item.alpc?.isLimited) {\n // \u6709\u5E93\u5B58\u9650\u5236\n return true\n }\n\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n if (!item.variant?.availableForSale) {\n return true\n }\n }\n if (isLogin && profile?.activated && item.alpc?.consumeCredits > Number(creditInfo?.available_credit || 0)) {\n return true\n }\n return false\n }, [\n item.alpc?.remainingInventory,\n item.alpc?.isLimited,\n item.alpc?.consumeType,\n item.alpc?.consumeCredits,\n isLogin,\n profile?.activated,\n creditInfo?.available_credit,\n item.variant?.availableForSale,\n ])\n\n const redeemButtonText = useMemo(() => {\n if (!isLogin) {\n return copy.unlockRewards\n }\n\n // \u7F3A\u8D27\u6587\u6848\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n return item.variant?.availableForSale ? copy.btnRedeem : copy?.soldOut || 'Sold Out'\n }\n return copy.btnRedeem\n }, [\n isLogin,\n item.alpc?.consumeType,\n item.variant?.availableForSale,\n copy.btnRedeem,\n copy.unlockRewards,\n copy?.soldOut,\n ])\n\n return (\n <div\n className={classNames(\n 'flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]',\n className\n )}\n >\n {item.config?.type !== ConsumeType.Product ? (\n <div className=\"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]\">\n <Picture\n source={copy?.imageMapping[item.config?.type]?.url}\n className=\"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white md:bottom-[2px] md:left-[5px]\">\n {item.config?.value ? (\n <div className=\"flex items-end\">\n <Text\n className=\"text-[64px] font-bold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]\"\n html={item.config?.value}\n />\n <Text\n className=\"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]\"\n html={item.config?.type === ConsumeType.GiftCard ? copy?.giftCardLabel : copy?.off}\n />\n </div>\n ) : (\n <Text size={3} html={item.config?.title || item.alpc?.title} />\n )}\n </div>\n </div>\n ) : (\n <div className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product.images?.[0]?.url}\n ></Picture>\n </div>\n )}\n <div className={classNames('mt-[22px] flex w-full flex-1 flex-col justify-between')}>\n <Text\n html={item.config?.title || item.alpc?.title}\n title={item.config?.title || item.alpc?.title}\n size={2}\n className=\"text-[24px] font-bold leading-[1.2] l:text-[16px] l-xxl:text-[20px]\"\n />\n {item.config?.rules?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n onRulesOpen(item.config?.rules || [])\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: copy?.ruleLabel,\n info: item.alpc?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copy?.ruleLabel}\n </button>\n )}\n <div>\n <div className=\"mt-[24px] flex items-center l:mt-[12px] l-xl:mt-[16px]\">\n <Picture\n className=\"size-[20px]\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783\"\n />\n <Text\n html={`${numberFormat(item.alpc?.consumeCredits)}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] text-[28px] font-bold leading-[1.2] md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] \"\n />\n </div>\n\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[8px] l:w-full\"\n onClick={() => {\n onRedeem(item)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: item.alpc?.id?.toString(),\n },\n })\n }}\n >\n {redeemButtonText}\n </Button>\n </div>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": "AAsFU,cAAAA,EAMI,QAAAC,MANJ,oBAtFV,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBAEtC,OAAS,WAAAC,MAAe,QAExB,OAAOC,MAAgB,aACvB,OAAS,qBAAAC,MAAyB,sBAElC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,mBAC7C,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,WAAAC,MAAe,yBAEjB,SAASC,EAAe,CAC7B,KAAAC,EACA,UAAAC,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,CACF,EAMG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,CACnB,EAAIb,EAAkB,EAChBc,EAAU,OAAO,KAAKF,GAAW,CAAC,CAAC,EAAE,OAAS,EAE9CG,EAAajB,EAAQ,IACrB,GAAAU,EAAK,MAAM,oBAAsB,GAAKA,EAAK,MAAM,WAKjDA,EAAK,MAAM,cAAgBP,EAAgB,SACzC,CAACO,EAAK,SAAS,kBAIjBM,GAAWF,GAAS,WAAaJ,EAAK,MAAM,eAAiB,OAAOG,GAAY,kBAAoB,CAAC,GAIxG,CACDH,EAAK,MAAM,mBACXA,EAAK,MAAM,UACXA,EAAK,MAAM,YACXA,EAAK,MAAM,eACXM,EACAF,GAAS,UACTD,GAAY,iBACZH,EAAK,SAAS,gBAChB,CAAC,EAEKQ,EAAmBlB,EAAQ,IAC1BgB,EAKDN,EAAK,MAAM,cAAgBP,EAAgB,QACtCO,EAAK,SAAS,iBAA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AY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaA,GAAM,UACnB,KAAME,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EACA,UAAU,uEACV,SAAU,EACV,UAAWS,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAAX,GAAM,UACT,EAEFZ,EAAC,OACC,UAAAA,EAAC,OAAI,UAAU,yDACb,UAAAD,EAACI,EAAA,CACC,UAAU,cACV,OAAO,6FACT,EACAJ,EAACG,EAAA,CACC,KAAM,GAAGO,EAAaK,EAAK,MAAM,cAAc,CAAC,GAChD,KAAM,EACN,GAAG,IACH,UAAU,kGACZ,GACF,EAEAf,EAACE,EAAA,CACC,SAAUoB,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbL,EAASF,CAAI,EACbJ,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBQ,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaU,EACb,KAAMR,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EAEC,SAAAQ,EACH,GACF,GACF,GACF,CAEJ",
6
- "names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "gaTrack", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "isLogin", "isDisabled", "redeemButtonText", "e"]
4
+ "sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\n\nimport { useMemo } from 'react'\n\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { AlpcConsumeType, ConsumeType } from '../context/const'\nimport { numberFormat } from '../context/utils'\nimport type { CreditsRedeemListCopy } from './type'\nimport { gaTrack, useHeadlessContext } from '@anker-in/lib'\nimport { NoneProductValue } from './NonProductValue'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport function RedeemableItem({\n copy,\n className,\n item,\n onRulesOpen,\n onRedeem,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n item: RedeemableItemType\n onRulesOpen: (rules: string[]) => void\n onRedeem: (item: RedeemableItemType) => void\n}) {\n const {\n creditInfo,\n profile,\n gtm: { pageGroup },\n pageCommon,\n } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const isLogin = Object.keys(profile || {}).length > 0\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const isDisabled = useMemo(() => {\n if (item.alpc?.remainingInventory <= 0 && item.alpc?.isLimited) {\n // \u6709\u5E93\u5B58\u9650\u5236\n return true\n }\n\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n if (!item.variant?.availableForSale) {\n return true\n }\n }\n if (isLogin && profile?.activated && item.alpc?.consumeCredits > Number(creditInfo?.available_credit || 0)) {\n return true\n }\n return false\n }, [\n item.alpc?.remainingInventory,\n item.alpc?.isLimited,\n item.alpc?.consumeType,\n item.alpc?.consumeCredits,\n isLogin,\n profile?.activated,\n creditInfo?.available_credit,\n item.variant?.availableForSale,\n ])\n\n const redeemButtonText = useMemo(() => {\n if (!isLogin) {\n return copy.unlockRewards\n }\n\n // \u7F3A\u8D27\u6587\u6848\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n return item.variant?.availableForSale ? copy.btnRedeem : pageCommon?.soldOut || 'Sold Out'\n }\n return copy.btnRedeem\n }, [\n isLogin,\n item.alpc?.consumeType,\n item.variant?.availableForSale,\n copy.btnRedeem,\n copy.unlockRewards,\n pageCommon?.soldOut,\n ])\n\n return (\n <div\n className={classNames(\n 'flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]',\n !rounded && 'rounded-none md:rounded-none',\n className\n )}\n >\n {item.config?.type === ConsumeType.Product ? (\n <div className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}>\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product.images?.[0]?.url}\n ></Picture>\n </div>\n ) : (\n <div className=\"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]\">\n <Picture\n source={pageCommon?.imageMapping?.[item.config?.type]?.url}\n className=\"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n\n <NoneProductValue item={item} />\n </div>\n )}\n <div className={classNames('mt-[22px] flex w-full flex-1 flex-col justify-between')}>\n <Text\n html={item.config?.title || item.alpc?.title}\n title={item.config?.title || item.alpc?.title}\n size={2}\n className=\"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]\"\n />\n {item.config?.rules?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n onRulesOpen(item.config?.rules || [])\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: pageCommon?.ruleLabel,\n info: item.alpc?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {pageCommon?.ruleLabel}\n </button>\n )}\n <div>\n <div className=\"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]\">\n <Picture\n className=\"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783\"\n />\n <Text\n html={`${numberFormat(item.alpc?.consumeCredits)}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] text-[28px] font-bold mt-[4px] leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] \"\n />\n </div>\n\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[8px] l:w-full\"\n onClick={() => {\n onRedeem(item)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: item.alpc?.id?.toString(),\n },\n })\n }}\n >\n {redeemButtonText}\n </Button>\n </div>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "AA4FU,cAAAA,EAMF,QAAAC,MANE,oBA5FV,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBAEtC,OAAS,WAAAC,MAAe,QAExB,OAAOC,MAAgB,aACvB,OAAS,qBAAAC,MAAyB,sBAElC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,mBAC7C,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,WAAAC,EAAS,sBAAAC,MAA0B,gBAC5C,OAAS,oBAAAC,MAAwB,oBACjC,OAAS,kBAAAC,MAAsB,qBAExB,SAASC,EAAe,CAC7B,KAAAC,EACA,UAAAC,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,CACF,EAMG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,CACF,EAAIjB,EAAkB,EAChB,CAAE,MAAAkB,CAAM,EAAIb,EAAmB,EAC/Bc,EAAU,OAAO,KAAKJ,GAAW,CAAC,CAAC,EAAE,OAAS,EAC9CK,EAAUb,EAAe,SAASW,CAAK,EAEvCG,EAAavB,EAAQ,IACrB,GAAAa,EAAK,MAAM,oBAAsB,GAAKA,EAAK,MAAM,WAKjDA,EAAK,MAAM,cAAgBV,EAAgB,SAC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AC,EACpCP,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBW,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaQ,GAAY,UACzB,KAAMN,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EACA,UAAU,uEACV,SAAU,EACV,UAAWY,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAAN,GAAY,UACf,EAEFvB,EAAC,OACC,UAAAA,EAAC,OAAI,UAAU,yDACb,UAAAD,EAACI,EAAA,CACC,UAAU,gEACV,OAAO,6FACT,EACAJ,EAACG,EAAA,CACC,KAAM,GAAGO,EAAaQ,EAAK,MAAM,cAAc,CAAC,GAChD,KAAM,EACN,GAAG,IACH,UAAU,0GACZ,GACF,EAEAlB,EAACE,EAAA,CACC,SAAU0B,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbR,EAASF,CAAI,EACbP,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBW,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaa,EACb,KAAMX,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EAEC,SAAAW,EACH,GACF,GACF,GACF,CAEJ",
6
+ "names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "gaTrack", "useHeadlessContext", "NoneProductValue", "ROUNDED_BRANDS", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "pageCommon", "brand", "isLogin", "rounded", "isDisabled", "redeemButtonText", "e"]
7
7
  }
@@ -1,13 +1,2 @@
1
- import { CreditsRedeemListCopy } from './type';
2
- export declare function CreditsRedeemList({ copy, className, tabClassName, hideTitle, cardClassName, activate, }: {
3
- copy: CreditsRedeemListCopy;
4
- className?: string;
5
- tabClassName?: string;
6
- hideTitle?: boolean;
7
- cardClassName?: string;
8
- activate: {
9
- openAuthCodePopup: () => void;
10
- isSuccess: boolean;
11
- setOnSuccess: (callback: Function) => void;
12
- };
13
- }): import("react/jsx-runtime").JSX.Element;
1
+ export * from './type';
2
+ export * from './CreditsRedeemList';
@@ -1,2 +1,2 @@
1
- import{jsx as n,jsxs as X}from"react/jsx-runtime";import{Container as F,Heading as D,Tabs as z,TabsList as H,TabsTrigger as j}from"@anker-in/headless-ui";import c from"classnames";import{useCallback as w,useMemo as L,useState as g}from"react";import B from"./RedeemCouponModal";import G from"./RedeemProductModal";import{useCreditsContext as U}from"../context/provider";import V from"../context/hooks/useRedeemableList";import{AlpcConsumeType as f,AlpcErrorCode as q}from"../context/const";import{useProductsByHandles as J}from"@anker-in/shopify";import{RedeemableItem as K}from"./RedeemableItem";import Q from"../modal/rulesModal";import{gaTrack as W}from"../../../helpers/track";function pe({copy:t,className:N="",tabClassName:k="",hideTitle:x=!1,cardClassName:_,activate:d}){const{profile:b,openSignUpPopup:I,gtm:{pageGroup:P}}=U(),S=Object.keys(b||{}).length>0,[m,E]=g(t.list[0].label),[o,l]=g(void 0),[p,C]=g(),{listLoading:O,redeemableList:R,getRedeemableList:v}=V(),r=L(()=>R.map(e=>({id:e.id.toString(),title:e.name,consumeCredits:e.consume_credits,remainingInventory:e.remaining_inventory,isLimited:!!e.is_limited,consumeType:e.consume_type,handle:e.sku_handle,sku:e.goods_sku,image:e.goods_url})),[t.list,m,R]),A=r.map(e=>e.handle),{data:T}=J({handles:A}),M=L(()=>t.list.find(s=>s.label===m)?.list.filter(s=>r.some(i=>i.id===s.id)).map(s=>{const i=r.find(a=>a.id===s.id),u=T?.find(a=>a.handle===i?.handle),y=u?.variants.find(a=>a.sku===i?.sku);return i?.consumeType===f.Product&&(!u||!y)?null:{alpc:r.find(a=>a.id===s.id),config:s,product:u,variant:y}}).filter(s=>s!==null),[r,T]),h=w(e=>{e===q.CodeLpcRuleInventoryNotEnough&&v()},[v]);return console.log("popRedeemData",o),X(F,{className:c("relative bg-[#F5F5F7]",N),children:[!x&&n(D,{as:"h2",size:"4",html:t.title}),n(z,{shape:"rounded",align:"left",className:c("sticky top-0 z-20 py-[24px] md:justify-center",k),value:m.toString(),onValueChange:e=>{E(e),W({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:e,page_group:P}})},children:n(H,{children:t.list.map(e=>n(j,{value:e.label,children:e.label},e.label))})}),!!r?.length&&!O&&n("div",{className:c("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:M?.map(e=>n(K,{copy:t,item:e,onRedeem:s=>{S?!b?.activated&&!d.isSuccess?(d.openAuthCodePopup(),d.setOnSuccess(()=>{l(s)})):l(s):I()},onRulesOpen:C,className:_},e?.alpc?.id))}),o?.alpc?.consumeType===f.Coupon&&t?.redeemModal?.coupon&&o&&n(B,{isOpen:!!o,item:o,copy:t,onError:h,onClose:()=>{l(void 0)}}),o?.alpc?.consumeType===f.Product&&t?.redeemModal&&o&&n(G,{isOpen:!!o,item:o,copy:t,onError:h,onClose:()=>{l(void 0)}}),p&&n(Q,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:p.length>0,onClose:()=>C([]),titleClassName:"border-b-transparent h-[56px]",rules:p,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:t?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})}export{pe as CreditsRedeemList};
1
+ export*from"./type";export*from"./CreditsRedeemList";
2
2
  //# sourceMappingURL=index.js.map