@anker-in/campaign-ui 0.1.10 → 0.2.0-beta.2

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 (677) hide show
  1. package/dist/cjs/components/chat/action.js +1 -1
  2. package/dist/cjs/components/chat/action.js.map +1 -1
  3. package/dist/cjs/components/chat/button.d.ts +1 -1
  4. package/dist/cjs/components/chat/button.js +1 -1
  5. package/dist/cjs/components/chat/button.js.map +1 -1
  6. package/dist/cjs/components/chat/index.js +1 -1
  7. package/dist/cjs/components/chat/index.js.map +3 -3
  8. package/dist/cjs/components/chat/{Messages.d.ts → messages.d.ts} +1 -1
  9. package/dist/cjs/components/chat/messages.js +1 -1
  10. package/dist/cjs/components/chat/messages.js.map +2 -2
  11. package/dist/cjs/components/chat/props.js +1 -1
  12. package/dist/cjs/components/chat/props.js.map +2 -2
  13. package/dist/cjs/components/chat/response.js +1 -1
  14. package/dist/cjs/components/chat/response.js.map +2 -2
  15. package/dist/cjs/components/chat/suggestions.d.ts +1 -1
  16. package/dist/cjs/components/chat/suggestions.js.map +1 -1
  17. package/dist/cjs/components/credits/const.d.ts +1 -0
  18. package/dist/cjs/components/credits/const.js +2 -0
  19. package/dist/cjs/components/credits/const.js.map +7 -0
  20. package/dist/cjs/components/credits/context/const.d.ts +82 -0
  21. package/dist/cjs/components/credits/context/const.js +2 -0
  22. package/dist/cjs/components/credits/context/const.js.map +7 -0
  23. package/dist/cjs/components/credits/context/hooks/useActivities.d.ts +12 -0
  24. package/dist/cjs/components/credits/context/hooks/useActivities.js +2 -0
  25. package/dist/cjs/components/credits/context/hooks/useActivities.js.map +7 -0
  26. package/dist/cjs/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
  27. package/dist/cjs/components/credits/context/hooks/useAddressValidate.js +2 -0
  28. package/dist/cjs/components/credits/context/hooks/useAddressValidate.js.map +7 -0
  29. package/dist/cjs/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
  30. package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js +2 -0
  31. package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js.map +7 -0
  32. package/dist/cjs/components/credits/context/hooks/useClickOutside.d.ts +3 -0
  33. package/dist/cjs/components/credits/context/hooks/useClickOutside.js +2 -0
  34. package/dist/cjs/components/credits/context/hooks/useClickOutside.js.map +7 -0
  35. package/dist/cjs/components/credits/context/hooks/useCopy.d.ts +5 -0
  36. package/dist/cjs/components/credits/context/hooks/useCopy.js +2 -0
  37. package/dist/cjs/components/credits/context/hooks/useCopy.js.map +7 -0
  38. package/dist/cjs/components/credits/context/hooks/useCountries.d.ts +8 -0
  39. package/dist/cjs/components/credits/context/hooks/useCountries.js +2 -0
  40. package/dist/cjs/components/credits/context/hooks/useCountries.js.map +7 -0
  41. package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
  42. package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.js +2 -0
  43. package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.js.map +7 -0
  44. package/dist/cjs/components/credits/context/hooks/useMyRewards.d.ts +14 -0
  45. package/dist/cjs/components/credits/context/hooks/useMyRewards.js +2 -0
  46. package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +7 -0
  47. package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
  48. package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.js +2 -0
  49. package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.js.map +7 -0
  50. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.d.ts +9 -0
  51. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js +2 -0
  52. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js.map +7 -0
  53. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.d.ts +18 -0
  54. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +2 -0
  55. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +7 -0
  56. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
  57. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +2 -0
  58. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +7 -0
  59. package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
  60. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +2 -0
  61. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +7 -0
  62. package/dist/cjs/components/credits/context/hooks/useSubscribed.d.ts +1 -0
  63. package/dist/cjs/components/credits/context/hooks/useSubscribed.js +2 -0
  64. package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +7 -0
  65. package/dist/cjs/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
  66. package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js +2 -0
  67. package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js.map +7 -0
  68. package/dist/cjs/components/credits/context/provider.d.ts +24 -0
  69. package/dist/cjs/components/credits/context/provider.js +2 -0
  70. package/dist/cjs/components/credits/context/provider.js.map +7 -0
  71. package/dist/cjs/components/credits/context/response.d.ts +63 -0
  72. package/dist/cjs/components/credits/context/response.js +2 -0
  73. package/dist/cjs/components/credits/context/response.js.map +7 -0
  74. package/dist/cjs/components/credits/context/utils.d.ts +25 -0
  75. package/dist/cjs/components/credits/context/utils.js +2 -0
  76. package/dist/cjs/components/credits/context/utils.js.map +7 -0
  77. package/dist/cjs/components/credits/creditsBanner/index.d.ts +23 -0
  78. package/dist/cjs/components/credits/creditsBanner/index.js +2 -0
  79. package/dist/cjs/components/credits/creditsBanner/index.js.map +7 -0
  80. package/dist/cjs/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
  81. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +2 -0
  82. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +7 -0
  83. package/dist/cjs/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
  84. package/dist/cjs/components/credits/creditsBenefits/iconInfo.js +2 -0
  85. package/dist/cjs/components/credits/creditsBenefits/iconInfo.js.map +7 -0
  86. package/dist/cjs/components/credits/creditsBenefits/index.d.ts +11 -0
  87. package/dist/cjs/components/credits/creditsBenefits/index.js +4 -0
  88. package/dist/cjs/components/credits/creditsBenefits/index.js.map +7 -0
  89. package/dist/cjs/components/credits/creditsCash/CreditsCash.d.ts +4 -0
  90. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +2 -0
  91. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +7 -0
  92. package/dist/cjs/components/credits/creditsCash/RedeemableItem.d.ts +9 -0
  93. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +2 -0
  94. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +7 -0
  95. package/dist/cjs/components/credits/creditsCash/index.d.ts +2 -0
  96. package/dist/cjs/components/credits/creditsCash/index.js +2 -0
  97. package/dist/cjs/components/credits/creditsCash/index.js.map +7 -0
  98. package/dist/cjs/components/credits/creditsCash/type.d.ts +47 -0
  99. package/dist/cjs/components/credits/creditsCash/type.js +2 -0
  100. package/dist/cjs/components/credits/creditsCash/type.js.map +7 -0
  101. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
  102. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
  103. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
  104. package/dist/cjs/components/credits/creditsFaq/index.d.ts +16 -0
  105. package/dist/cjs/components/credits/creditsFaq/index.js +2 -0
  106. package/dist/cjs/components/credits/creditsFaq/index.js.map +7 -0
  107. package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +16 -0
  108. package/dist/cjs/components/credits/creditsInfoCard/index.js +2 -0
  109. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +7 -0
  110. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
  111. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
  112. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
  113. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
  114. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.js +2 -0
  115. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.js.map +7 -0
  116. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
  117. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.js +2 -0
  118. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.js.map +7 -0
  119. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
  120. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
  121. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
  122. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
  123. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
  124. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
  125. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
  126. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.js +2 -0
  127. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.js.map +7 -0
  128. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +4 -0
  129. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
  130. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
  131. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.d.ts +4 -0
  132. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js +2 -0
  133. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
  134. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
  135. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
  136. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
  137. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
  138. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
  139. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
  140. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
  141. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.js +2 -0
  142. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +7 -0
  143. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
  144. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
  145. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
  146. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
  147. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
  148. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
  149. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
  150. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
  151. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
  152. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
  153. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
  154. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
  155. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
  156. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
  157. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
  158. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
  159. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
  160. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
  161. package/dist/cjs/components/credits/creditsRedeemList/index.d.ts +2 -0
  162. package/dist/cjs/components/credits/creditsRedeemList/index.js +2 -0
  163. package/dist/cjs/components/credits/creditsRedeemList/index.js.map +7 -0
  164. package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +63 -0
  165. package/dist/cjs/components/credits/creditsRedeemList/type.js +2 -0
  166. package/dist/cjs/components/credits/creditsRedeemList/type.js.map +7 -0
  167. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +2 -0
  168. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
  169. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
  170. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
  171. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js +2 -0
  172. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
  173. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +49 -0
  174. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js +2 -0
  175. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
  176. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.d.ts +105 -0
  177. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
  178. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
  179. package/dist/cjs/components/credits/index.d.ts +10 -0
  180. package/dist/cjs/components/credits/index.js +2 -0
  181. package/dist/cjs/components/credits/index.js.map +7 -0
  182. package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +32 -0
  183. package/dist/cjs/components/credits/modal/MyRewardsModal.js +2 -0
  184. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +7 -0
  185. package/dist/cjs/components/credits/modal/activitiesModal.d.ts +32 -0
  186. package/dist/cjs/components/credits/modal/activitiesModal.js +2 -0
  187. package/dist/cjs/components/credits/modal/activitiesModal.js.map +7 -0
  188. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
  189. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +2 -0
  190. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +7 -0
  191. package/dist/cjs/components/credits/modal/loadingDots.d.ts +6 -0
  192. package/dist/cjs/components/credits/modal/loadingDots.js +2 -0
  193. package/dist/cjs/components/credits/modal/loadingDots.js.map +7 -0
  194. package/dist/cjs/components/credits/modal/modalContainer.d.ts +15 -0
  195. package/dist/cjs/components/credits/modal/modalContainer.js +2 -0
  196. package/dist/cjs/components/credits/modal/modalContainer.js.map +7 -0
  197. package/dist/cjs/components/credits/modal/rulesModal.d.ts +7 -0
  198. package/dist/cjs/components/credits/modal/rulesModal.js +2 -0
  199. package/dist/cjs/components/credits/modal/rulesModal.js.map +7 -0
  200. package/dist/cjs/components/credits/modal/subscribeModal.d.ts +15 -0
  201. package/dist/cjs/components/credits/modal/subscribeModal.js +2 -0
  202. package/dist/cjs/components/credits/modal/subscribeModal.js.map +7 -0
  203. package/dist/cjs/components/credits/modal/tip.d.ts +5 -0
  204. package/dist/cjs/components/credits/modal/tip.js +2 -0
  205. package/dist/cjs/components/credits/modal/tip.js.map +7 -0
  206. package/dist/cjs/components/credits/type.d.ts +72 -0
  207. package/dist/cjs/components/credits/type.js +2 -0
  208. package/dist/cjs/components/credits/type.js.map +7 -0
  209. package/dist/cjs/components/index.d.ts +4 -2
  210. package/dist/cjs/components/index.js +1 -1
  211. package/dist/cjs/components/index.js.map +3 -3
  212. package/dist/cjs/components/registration/authCodeActivate/Message.d.ts +4 -0
  213. package/dist/cjs/components/registration/authCodeActivate/Message.js +2 -0
  214. package/dist/cjs/components/registration/authCodeActivate/Message.js.map +7 -0
  215. package/dist/cjs/components/registration/authCodeActivate/index.d.ts +3 -0
  216. package/dist/cjs/components/registration/authCodeActivate/index.js +2 -0
  217. package/dist/cjs/components/registration/authCodeActivate/index.js.map +7 -0
  218. package/dist/cjs/components/registration/authCodeActivate/type.d.ts +23 -0
  219. package/dist/cjs/components/registration/authCodeActivate/type.js +2 -0
  220. package/dist/cjs/components/registration/authCodeActivate/type.js.map +7 -0
  221. package/dist/cjs/components/registration/context/index.d.ts +1 -0
  222. package/dist/cjs/components/registration/context/index.js +2 -0
  223. package/dist/cjs/components/registration/context/index.js.map +7 -0
  224. package/dist/cjs/components/registration/context/provider.d.ts +25 -0
  225. package/dist/cjs/components/registration/context/provider.js +2 -0
  226. package/dist/cjs/components/registration/context/provider.js.map +7 -0
  227. package/dist/cjs/components/registration/index.d.ts +2 -0
  228. package/dist/cjs/components/registration/index.js +2 -0
  229. package/dist/cjs/components/registration/index.js.map +7 -0
  230. package/dist/cjs/components/registration/modalContainer.d.ts +15 -0
  231. package/dist/cjs/components/registration/modalContainer.js +2 -0
  232. package/dist/cjs/components/registration/modalContainer.js.map +7 -0
  233. package/dist/cjs/debug-env.d.ts +7 -0
  234. package/dist/cjs/debug-env.js +2 -0
  235. package/dist/cjs/debug-env.js.map +7 -0
  236. package/dist/cjs/index.d.ts +2 -1
  237. package/dist/cjs/index.js +1 -1
  238. package/dist/cjs/index.js.map +2 -2
  239. package/dist/cjs/stories/chat.stories.d.ts +1 -1
  240. package/dist/cjs/stories/chat.stories.js +1 -1
  241. package/dist/cjs/stories/chat.stories.js.map +3 -3
  242. package/dist/cjs/templates/credits.d.ts +58 -0
  243. package/dist/cjs/templates/credits.js +2 -0
  244. package/dist/cjs/templates/credits.js.map +7 -0
  245. package/dist/cjs/templates/index.d.ts +1 -0
  246. package/dist/cjs/templates/index.js +2 -0
  247. package/dist/cjs/templates/index.js.map +7 -0
  248. package/dist/esm/components/chat/action.js +1 -1
  249. package/dist/esm/components/chat/action.js.map +1 -1
  250. package/dist/esm/components/chat/button.d.ts +1 -1
  251. package/dist/esm/components/chat/button.js +1 -1
  252. package/dist/esm/components/chat/button.js.map +1 -1
  253. package/dist/esm/components/chat/index.js +1 -1
  254. package/dist/esm/components/chat/index.js.map +2 -2
  255. package/dist/esm/components/chat/{Messages.d.ts → messages.d.ts} +1 -1
  256. package/dist/esm/components/chat/messages.js +1 -1
  257. package/dist/esm/components/chat/messages.js.map +2 -2
  258. package/dist/esm/components/chat/props.js +0 -1
  259. package/dist/esm/components/chat/props.js.map +3 -3
  260. package/dist/esm/components/chat/response.js +1 -1
  261. package/dist/esm/components/chat/response.js.map +2 -2
  262. package/dist/esm/components/chat/suggestions.d.ts +1 -1
  263. package/dist/esm/components/chat/suggestions.js.map +1 -1
  264. package/dist/esm/components/credits/const.d.ts +1 -0
  265. package/dist/esm/components/credits/const.js +2 -0
  266. package/dist/esm/components/credits/const.js.map +7 -0
  267. package/dist/esm/components/credits/context/const.d.ts +82 -0
  268. package/dist/esm/components/credits/context/const.js +2 -0
  269. package/dist/esm/components/credits/context/const.js.map +7 -0
  270. package/dist/esm/components/credits/context/hooks/useActivities.d.ts +12 -0
  271. package/dist/esm/components/credits/context/hooks/useActivities.js +2 -0
  272. package/dist/esm/components/credits/context/hooks/useActivities.js.map +7 -0
  273. package/dist/esm/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
  274. package/dist/esm/components/credits/context/hooks/useAddressValidate.js +2 -0
  275. package/dist/esm/components/credits/context/hooks/useAddressValidate.js.map +7 -0
  276. package/dist/esm/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
  277. package/dist/esm/components/credits/context/hooks/useAlpcFetch.js +2 -0
  278. package/dist/esm/components/credits/context/hooks/useAlpcFetch.js.map +7 -0
  279. package/dist/esm/components/credits/context/hooks/useClickOutside.d.ts +3 -0
  280. package/dist/esm/components/credits/context/hooks/useClickOutside.js +2 -0
  281. package/dist/esm/components/credits/context/hooks/useClickOutside.js.map +7 -0
  282. package/dist/esm/components/credits/context/hooks/useCopy.d.ts +5 -0
  283. package/dist/esm/components/credits/context/hooks/useCopy.js +2 -0
  284. package/dist/esm/components/credits/context/hooks/useCopy.js.map +7 -0
  285. package/dist/esm/components/credits/context/hooks/useCountries.d.ts +8 -0
  286. package/dist/esm/components/credits/context/hooks/useCountries.js +2 -0
  287. package/dist/esm/components/credits/context/hooks/useCountries.js.map +7 -0
  288. package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
  289. package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.js +2 -0
  290. package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.js.map +7 -0
  291. package/dist/esm/components/credits/context/hooks/useMyRewards.d.ts +14 -0
  292. package/dist/esm/components/credits/context/hooks/useMyRewards.js +2 -0
  293. package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +7 -0
  294. package/dist/esm/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
  295. package/dist/esm/components/credits/context/hooks/useReceiptUploaded.js +2 -0
  296. package/dist/esm/components/credits/context/hooks/useReceiptUploaded.js.map +7 -0
  297. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.d.ts +9 -0
  298. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +2 -0
  299. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +7 -0
  300. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.d.ts +18 -0
  301. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +2 -0
  302. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +7 -0
  303. package/dist/esm/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
  304. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +2 -0
  305. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +7 -0
  306. package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
  307. package/dist/esm/components/credits/context/hooks/useRedeemableList.js +2 -0
  308. package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +7 -0
  309. package/dist/esm/components/credits/context/hooks/useSubscribed.d.ts +1 -0
  310. package/dist/esm/components/credits/context/hooks/useSubscribed.js +2 -0
  311. package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +7 -0
  312. package/dist/esm/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
  313. package/dist/esm/components/credits/context/hooks/useUploadReceipt.js +2 -0
  314. package/dist/esm/components/credits/context/hooks/useUploadReceipt.js.map +7 -0
  315. package/dist/esm/components/credits/context/provider.d.ts +24 -0
  316. package/dist/esm/components/credits/context/provider.js +2 -0
  317. package/dist/esm/components/credits/context/provider.js.map +7 -0
  318. package/dist/esm/components/credits/context/response.d.ts +63 -0
  319. package/dist/esm/components/credits/context/response.js +1 -0
  320. package/dist/esm/components/credits/context/utils.d.ts +25 -0
  321. package/dist/esm/components/credits/context/utils.js +2 -0
  322. package/dist/esm/components/credits/context/utils.js.map +7 -0
  323. package/dist/esm/components/credits/creditsBanner/index.d.ts +23 -0
  324. package/dist/esm/components/credits/creditsBanner/index.js +2 -0
  325. package/dist/esm/components/credits/creditsBanner/index.js.map +7 -0
  326. package/dist/esm/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
  327. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +2 -0
  328. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +7 -0
  329. package/dist/esm/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
  330. package/dist/esm/components/credits/creditsBenefits/iconInfo.js +2 -0
  331. package/dist/esm/components/credits/creditsBenefits/iconInfo.js.map +7 -0
  332. package/dist/esm/components/credits/creditsBenefits/index.d.ts +11 -0
  333. package/dist/esm/components/credits/creditsBenefits/index.js +4 -0
  334. package/dist/esm/components/credits/creditsBenefits/index.js.map +7 -0
  335. package/dist/esm/components/credits/creditsCash/CreditsCash.d.ts +4 -0
  336. package/dist/esm/components/credits/creditsCash/CreditsCash.js +2 -0
  337. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +7 -0
  338. package/dist/esm/components/credits/creditsCash/RedeemableItem.d.ts +9 -0
  339. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +2 -0
  340. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +7 -0
  341. package/dist/esm/components/credits/creditsCash/index.d.ts +2 -0
  342. package/dist/esm/components/credits/creditsCash/index.js +2 -0
  343. package/dist/esm/components/credits/creditsCash/index.js.map +7 -0
  344. package/dist/esm/components/credits/creditsCash/type.d.ts +47 -0
  345. package/dist/esm/components/credits/creditsCash/type.js +1 -0
  346. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
  347. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
  348. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
  349. package/dist/esm/components/credits/creditsFaq/index.d.ts +16 -0
  350. package/dist/esm/components/credits/creditsFaq/index.js +2 -0
  351. package/dist/esm/components/credits/creditsFaq/index.js.map +7 -0
  352. package/dist/esm/components/credits/creditsInfoCard/index.d.ts +16 -0
  353. package/dist/esm/components/credits/creditsInfoCard/index.js +2 -0
  354. package/dist/esm/components/credits/creditsInfoCard/index.js.map +7 -0
  355. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
  356. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
  357. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
  358. package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
  359. package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js +2 -0
  360. package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js.map +7 -0
  361. package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
  362. package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js +2 -0
  363. package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js.map +7 -0
  364. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
  365. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
  366. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
  367. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
  368. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
  369. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
  370. package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
  371. package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js +1 -0
  372. package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js.map +7 -0
  373. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +4 -0
  374. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
  375. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
  376. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.d.ts +4 -0
  377. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js +2 -0
  378. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
  379. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
  380. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
  381. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
  382. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
  383. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
  384. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
  385. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
  386. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js +2 -0
  387. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +7 -0
  388. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
  389. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
  390. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
  391. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
  392. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
  393. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
  394. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
  395. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
  396. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
  397. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
  398. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
  399. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
  400. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
  401. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
  402. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
  403. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
  404. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
  405. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
  406. package/dist/esm/components/credits/creditsRedeemList/index.d.ts +2 -0
  407. package/dist/esm/components/credits/creditsRedeemList/index.js +2 -0
  408. package/dist/esm/components/credits/creditsRedeemList/index.js.map +7 -0
  409. package/dist/esm/components/credits/creditsRedeemList/type.d.ts +63 -0
  410. package/dist/esm/components/credits/creditsRedeemList/type.js +1 -0
  411. package/dist/esm/components/credits/creditsRedeemList/type.js.map +7 -0
  412. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +2 -0
  413. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
  414. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
  415. package/dist/esm/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
  416. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js +2 -0
  417. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
  418. package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +49 -0
  419. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js +2 -0
  420. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
  421. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.d.ts +105 -0
  422. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
  423. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
  424. package/dist/esm/components/credits/index.d.ts +10 -0
  425. package/dist/esm/components/credits/index.js +2 -0
  426. package/dist/esm/components/credits/index.js.map +7 -0
  427. package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +32 -0
  428. package/dist/esm/components/credits/modal/MyRewardsModal.js +2 -0
  429. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +7 -0
  430. package/dist/esm/components/credits/modal/activitiesModal.d.ts +32 -0
  431. package/dist/esm/components/credits/modal/activitiesModal.js +2 -0
  432. package/dist/esm/components/credits/modal/activitiesModal.js.map +7 -0
  433. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
  434. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +2 -0
  435. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +7 -0
  436. package/dist/esm/components/credits/modal/loadingDots.d.ts +6 -0
  437. package/dist/esm/components/credits/modal/loadingDots.js +2 -0
  438. package/dist/esm/components/credits/modal/loadingDots.js.map +7 -0
  439. package/dist/esm/components/credits/modal/modalContainer.d.ts +15 -0
  440. package/dist/esm/components/credits/modal/modalContainer.js +2 -0
  441. package/dist/esm/components/credits/modal/modalContainer.js.map +7 -0
  442. package/dist/esm/components/credits/modal/rulesModal.d.ts +7 -0
  443. package/dist/esm/components/credits/modal/rulesModal.js +2 -0
  444. package/dist/esm/components/credits/modal/rulesModal.js.map +7 -0
  445. package/dist/esm/components/credits/modal/subscribeModal.d.ts +15 -0
  446. package/dist/esm/components/credits/modal/subscribeModal.js +2 -0
  447. package/dist/esm/components/credits/modal/subscribeModal.js.map +7 -0
  448. package/dist/esm/components/credits/modal/tip.d.ts +5 -0
  449. package/dist/esm/components/credits/modal/tip.js +2 -0
  450. package/dist/esm/components/credits/modal/tip.js.map +7 -0
  451. package/dist/esm/components/credits/type.d.ts +72 -0
  452. package/dist/esm/components/credits/type.js +1 -0
  453. package/dist/esm/components/credits/type.js.map +7 -0
  454. package/dist/esm/components/index.d.ts +4 -2
  455. package/dist/esm/components/index.js +1 -1
  456. package/dist/esm/components/index.js.map +2 -2
  457. package/dist/esm/components/registration/authCodeActivate/Message.d.ts +4 -0
  458. package/dist/esm/components/registration/authCodeActivate/Message.js +2 -0
  459. package/dist/esm/components/registration/authCodeActivate/Message.js.map +7 -0
  460. package/dist/esm/components/registration/authCodeActivate/index.d.ts +3 -0
  461. package/dist/esm/components/registration/authCodeActivate/index.js +2 -0
  462. package/dist/esm/components/registration/authCodeActivate/index.js.map +7 -0
  463. package/dist/esm/components/registration/authCodeActivate/type.d.ts +23 -0
  464. package/dist/esm/components/registration/authCodeActivate/type.js +1 -0
  465. package/dist/esm/components/registration/authCodeActivate/type.js.map +7 -0
  466. package/dist/esm/components/registration/context/index.d.ts +1 -0
  467. package/dist/esm/components/registration/context/index.js +2 -0
  468. package/dist/esm/components/registration/context/index.js.map +7 -0
  469. package/dist/esm/components/registration/context/provider.d.ts +25 -0
  470. package/dist/esm/components/registration/context/provider.js +2 -0
  471. package/dist/esm/components/registration/context/provider.js.map +7 -0
  472. package/dist/esm/components/registration/index.d.ts +2 -0
  473. package/dist/esm/components/registration/index.js +2 -0
  474. package/dist/esm/components/registration/index.js.map +7 -0
  475. package/dist/esm/components/registration/modalContainer.d.ts +15 -0
  476. package/dist/esm/components/registration/modalContainer.js +2 -0
  477. package/dist/esm/components/registration/modalContainer.js.map +7 -0
  478. package/dist/esm/debug-env.d.ts +7 -0
  479. package/dist/esm/debug-env.js +2 -0
  480. package/dist/esm/debug-env.js.map +7 -0
  481. package/dist/esm/index.d.ts +2 -1
  482. package/dist/esm/index.js +1 -1
  483. package/dist/esm/index.js.map +2 -2
  484. package/dist/esm/stories/chat.stories.d.ts +1 -1
  485. package/dist/esm/stories/chat.stories.js +1 -1
  486. package/dist/esm/stories/chat.stories.js.map +2 -2
  487. package/dist/esm/templates/credits.d.ts +58 -0
  488. package/dist/esm/templates/credits.js +2 -0
  489. package/dist/esm/templates/credits.js.map +7 -0
  490. package/dist/esm/templates/index.d.ts +1 -0
  491. package/dist/esm/templates/index.js +2 -0
  492. package/dist/esm/templates/index.js.map +7 -0
  493. package/package.json +47 -33
  494. package/src/components/chat/button.tsx +1 -1
  495. package/src/components/chat/index.tsx +6 -6
  496. package/src/components/chat/messages.tsx +2 -2
  497. package/src/components/chat/response.tsx +1 -4
  498. package/src/components/chat/suggestions.tsx +1 -1
  499. package/src/components/credits/const.ts +1 -0
  500. package/src/components/credits/context/const.ts +104 -0
  501. package/src/components/credits/context/hooks/useActivities.ts +70 -0
  502. package/src/components/credits/context/hooks/useAddressValidate.ts +281 -0
  503. package/src/components/credits/context/hooks/useAlpcFetch.ts +295 -0
  504. package/src/components/credits/context/hooks/useClickOutside.ts +34 -0
  505. package/src/components/credits/context/hooks/useCopy.ts +35 -0
  506. package/src/components/credits/context/hooks/useCountries.ts +55 -0
  507. package/src/components/credits/context/hooks/useFirstPurchaseFinished.ts +24 -0
  508. package/src/components/credits/context/hooks/useMyRewards.ts +97 -0
  509. package/src/components/credits/context/hooks/useReceiptUploaded.ts +24 -0
  510. package/src/components/credits/context/hooks/useRedeemAndBuy.ts +57 -0
  511. package/src/components/credits/context/hooks/useRedeemCoupon.ts +34 -0
  512. package/src/components/credits/context/hooks/useRedeemProduct.ts +34 -0
  513. package/src/components/credits/context/hooks/useRedeemableList.ts +77 -0
  514. package/src/components/credits/context/hooks/useSubscribed.ts +36 -0
  515. package/src/components/credits/context/hooks/useUploadReceipt.tsx +29 -0
  516. package/src/components/credits/context/provider.tsx +85 -0
  517. package/src/components/credits/context/response.ts +72 -0
  518. package/src/components/credits/context/utils.ts +149 -0
  519. package/src/components/credits/creditsBanner/index.tsx +103 -0
  520. package/src/components/credits/creditsBenefits/benefitItem.tsx +91 -0
  521. package/src/components/credits/creditsBenefits/iconInfo.tsx +23 -0
  522. package/src/components/credits/creditsBenefits/index.tsx +116 -0
  523. package/src/components/credits/creditsCash/CreditsCash.tsx +85 -0
  524. package/src/components/credits/creditsCash/RedeemableItem.tsx +207 -0
  525. package/src/components/credits/creditsCash/index.ts +2 -0
  526. package/src/components/credits/creditsCash/type.ts +46 -0
  527. package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +95 -0
  528. package/src/components/credits/creditsFaq/index.tsx +89 -0
  529. package/src/components/credits/creditsInfoCard/index.tsx +184 -0
  530. package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +116 -0
  531. package/src/components/credits/creditsRedeemList/AddressForm/FormItem.tsx +23 -0
  532. package/src/components/credits/creditsRedeemList/AddressForm/Input.tsx +58 -0
  533. package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +131 -0
  534. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +157 -0
  535. package/src/components/credits/creditsRedeemList/AddressForm/type.ts +24 -0
  536. package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +178 -0
  537. package/src/components/credits/creditsRedeemList/NonProductValue.tsx +39 -0
  538. package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +211 -0
  539. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +74 -0
  540. package/src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx +14 -0
  541. package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +123 -0
  542. package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +25 -0
  543. package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +74 -0
  544. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +49 -0
  545. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +195 -0
  546. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +183 -0
  547. package/src/components/credits/creditsRedeemList/index.ts +2 -0
  548. package/src/components/credits/creditsRedeemList/type.ts +63 -0
  549. package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +235 -0
  550. package/src/components/credits/creditsWaysToGetCredits/index.ts +2 -0
  551. package/src/components/credits/creditsWaysToGetCredits/type.ts +53 -0
  552. package/src/components/credits/creditsWaysToGetCredits/useActions.ts +228 -0
  553. package/src/components/credits/index.ts +11 -0
  554. package/src/components/credits/modal/MyRewardsModal.tsx +330 -0
  555. package/src/components/credits/modal/activitiesModal.tsx +264 -0
  556. package/src/components/credits/modal/creditsUploadReceiptModal.tsx +150 -0
  557. package/src/components/credits/modal/loadingDots.tsx +19 -0
  558. package/src/components/credits/modal/modalContainer.tsx +117 -0
  559. package/src/components/credits/modal/rulesModal.tsx +44 -0
  560. package/src/components/credits/modal/subscribeModal.tsx +224 -0
  561. package/src/components/credits/modal/tip.tsx +102 -0
  562. package/src/components/credits/type.ts +77 -0
  563. package/src/components/index.ts +6 -4
  564. package/src/components/registration/authCodeActivate/Message.tsx +43 -0
  565. package/src/components/registration/authCodeActivate/index.tsx +298 -0
  566. package/src/components/registration/authCodeActivate/type.ts +24 -0
  567. package/src/components/registration/context/index.tsx +1 -0
  568. package/src/components/registration/context/provider.tsx +77 -0
  569. package/src/components/registration/index.ts +2 -0
  570. package/src/components/registration/modalContainer.tsx +112 -0
  571. package/src/debug-env.ts +18 -0
  572. package/src/index.ts +2 -1
  573. package/src/stories/chat.stories.tsx +1 -1
  574. package/{dist/esm/styles/chat.css → src/styles/global.css} +1 -0
  575. package/src/templates/credits.tsx +124 -0
  576. package/src/templates/index.ts +1 -0
  577. package/style.css +1 -0
  578. package/tailwind.config.ts +82 -0
  579. package/dist/cjs/components/animation/CodeEditor.d.ts +0 -7
  580. package/dist/cjs/components/animation/CodeEditor.js +0 -2
  581. package/dist/cjs/components/animation/CodeEditor.js.map +0 -7
  582. package/dist/cjs/components/animation/Preview.d.ts +0 -5
  583. package/dist/cjs/components/animation/Preview.js +0 -2
  584. package/dist/cjs/components/animation/Preview.js.map +0 -7
  585. package/dist/cjs/components/animation/bannerAni.d.ts +0 -16
  586. package/dist/cjs/components/animation/bannerAni.js +0 -59
  587. package/dist/cjs/components/animation/bannerAni.js.map +0 -7
  588. package/dist/cjs/components/animation/libs.d.js +0 -2
  589. package/dist/cjs/components/animation/textAni.d.ts +0 -9
  590. package/dist/cjs/components/animation/textAni.js +0 -2
  591. package/dist/cjs/components/animation/textAni.js.map +0 -7
  592. package/dist/cjs/components/chat/message.d.ts +0 -2
  593. package/dist/cjs/components/chat/response copy.d.ts +0 -2
  594. package/dist/cjs/components/chat/rresponse.d.ts +0 -2
  595. package/dist/cjs/components/theme.d.ts +0 -13
  596. package/dist/cjs/helpers/component-props.d.ts +0 -7
  597. package/dist/cjs/helpers/component-props.js +0 -2
  598. package/dist/cjs/helpers/component-props.js.map +0 -7
  599. package/dist/cjs/helpers/constants.d.ts +0 -2
  600. package/dist/cjs/helpers/constants.js +0 -2
  601. package/dist/cjs/helpers/constants.js.map +0 -7
  602. package/dist/cjs/helpers/fetchResponse.d.ts +0 -14
  603. package/dist/cjs/helpers/fetchResponse.js +0 -2
  604. package/dist/cjs/helpers/fetchResponse.js.map +0 -7
  605. package/dist/cjs/helpers/fetcher.d.ts +0 -2
  606. package/dist/cjs/helpers/fetcher.js +0 -2
  607. package/dist/cjs/helpers/fetcher.js.map +0 -7
  608. package/dist/cjs/helpers/index.d.ts +0 -2
  609. package/dist/cjs/helpers/index.js +0 -2
  610. package/dist/cjs/helpers/index.js.map +0 -7
  611. package/dist/cjs/helpers/utils.d.ts +0 -3
  612. package/dist/cjs/helpers/utils.js +0 -2
  613. package/dist/cjs/helpers/utils.js.map +0 -7
  614. package/dist/cjs/tsconfig.tsbuildinfo +0 -1
  615. package/dist/esm/components/animation/CodeEditor.d.ts +0 -7
  616. package/dist/esm/components/animation/CodeEditor.js +0 -2
  617. package/dist/esm/components/animation/CodeEditor.js.map +0 -7
  618. package/dist/esm/components/animation/Preview.d.ts +0 -5
  619. package/dist/esm/components/animation/Preview.js +0 -2
  620. package/dist/esm/components/animation/Preview.js.map +0 -7
  621. package/dist/esm/components/animation/bannerAni.d.ts +0 -16
  622. package/dist/esm/components/animation/bannerAni.js +0 -59
  623. package/dist/esm/components/animation/bannerAni.js.map +0 -7
  624. package/dist/esm/components/animation/libs.d.js +0 -2
  625. package/dist/esm/components/animation/libs.d.js.map +0 -7
  626. package/dist/esm/components/animation/textAni.d.ts +0 -9
  627. package/dist/esm/components/animation/textAni.js +0 -2
  628. package/dist/esm/components/animation/textAni.js.map +0 -7
  629. package/dist/esm/components/chat/Markdown.d.ts +0 -5
  630. package/dist/esm/components/chat/marksdown.d.ts +0 -5
  631. package/dist/esm/components/chat/message.d.ts +0 -2
  632. package/dist/esm/components/chat/response copy.d.ts +0 -2
  633. package/dist/esm/components/chat/rresponse.d.ts +0 -2
  634. package/dist/esm/components/theme.d.ts +0 -13
  635. package/dist/esm/helpers/component-props.d.ts +0 -7
  636. package/dist/esm/helpers/component-props.js +0 -1
  637. package/dist/esm/helpers/constants.d.ts +0 -2
  638. package/dist/esm/helpers/constants.js +0 -2
  639. package/dist/esm/helpers/constants.js.map +0 -7
  640. package/dist/esm/helpers/fetchResponse.d.ts +0 -14
  641. package/dist/esm/helpers/fetchResponse.js +0 -2
  642. package/dist/esm/helpers/fetchResponse.js.map +0 -7
  643. package/dist/esm/helpers/fetcher.d.ts +0 -2
  644. package/dist/esm/helpers/fetcher.js +0 -2
  645. package/dist/esm/helpers/fetcher.js.map +0 -7
  646. package/dist/esm/helpers/index.d.ts +0 -2
  647. package/dist/esm/helpers/index.js +0 -2
  648. package/dist/esm/helpers/index.js.map +0 -7
  649. package/dist/esm/helpers/utils.d.ts +0 -3
  650. package/dist/esm/helpers/utils.js +0 -2
  651. package/dist/esm/helpers/utils.js.map +0 -7
  652. package/dist/esm/styles/css/animations.css +0 -35
  653. package/dist/esm/styles/css/button.css +0 -56
  654. package/dist/esm/styles/css/colors.css +0 -12
  655. package/dist/esm/styles/css/console.css +0 -134
  656. package/dist/esm/styles/css/header.css +0 -43
  657. package/dist/esm/styles/css/input.css +0 -89
  658. package/dist/esm/styles/css/markdown.css +0 -131
  659. package/dist/esm/styles/css/messages.css +0 -73
  660. package/dist/esm/styles/css/panel.css +0 -23
  661. package/dist/esm/styles/css/popup.css +0 -44
  662. package/dist/esm/styles/css/response.css +0 -26
  663. package/dist/esm/styles/css/sidebar.css +0 -31
  664. package/dist/esm/styles/css/suggestions.css +0 -35
  665. package/dist/esm/styles/css/window.css +0 -60
  666. package/dist/esm/styles/index.css +0 -1
  667. package/dist/esm/tsconfig.tsbuildinfo +0 -1
  668. package/src/helpers/fetchResponse.ts +0 -35
  669. package/src/helpers/fetcher.ts +0 -44
  670. package/src/helpers/index.ts +0 -2
  671. package/src/helpers/utils.ts +0 -8
  672. /package/dist/cjs/components/chat/{Markdown.d.ts → markdown.d.ts} +0 -0
  673. /package/dist/cjs/components/chat/{Response.d.ts → response.d.ts} +0 -0
  674. /package/dist/{cjs/components/chat/marksdown.d.ts → esm/components/chat/markdown.d.ts} +0 -0
  675. /package/dist/esm/components/chat/{Response.d.ts → response.d.ts} +0 -0
  676. /package/dist/{cjs/components/animation/libs.d.js.map → esm/components/credits/context/response.js.map} +0 -0
  677. /package/dist/esm/{helpers/component-props.js.map → components/credits/creditsCash/type.js.map} +0 -0
@@ -0,0 +1,63 @@
1
+ export type CreditsRedeemListCopy = {
2
+ title: string;
3
+ unlockRewards: string;
4
+ btnRedeem: string;
5
+ list: {
6
+ label: string;
7
+ list: {
8
+ id: string;
9
+ type: string;
10
+ value: string;
11
+ rules: string[];
12
+ }[];
13
+ }[];
14
+ redeemModal: {
15
+ confirmTitle: string;
16
+ confirmButton: string;
17
+ commonError: string;
18
+ redeemLimitError: string;
19
+ inventoryNotEnough: string;
20
+ creditsNotEnough: string;
21
+ crossSiteError: string;
22
+ errorImageUrl: string;
23
+ coupon: {
24
+ successDesc: string;
25
+ successTitle: string;
26
+ successButton: string;
27
+ successButtonUrl: string;
28
+ };
29
+ product: {
30
+ required: string;
31
+ invalidEmail: string;
32
+ shippingAddress: string;
33
+ shippingProduct: string;
34
+ addressForm: {
35
+ key: string;
36
+ type: string;
37
+ label: string;
38
+ isSelect: boolean;
39
+ required: boolean;
40
+ placeholder: string;
41
+ }[][];
42
+ form: {
43
+ key: string;
44
+ type: string;
45
+ isSelect: boolean;
46
+ required: boolean;
47
+ placeholder: string;
48
+ }[][];
49
+ successDesc: string[];
50
+ rules: string[];
51
+ steps: {
52
+ imageUrl: string;
53
+ title: string;
54
+ }[];
55
+ quantityLabel: string;
56
+ totalPriceLabel: string;
57
+ variantLabel: string;
58
+ shippingFeeLabel: string;
59
+ paymentButton: string;
60
+ stepTitle: string;
61
+ };
62
+ };
63
+ };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import { type CreditsWaysToGetCreditsProps } from './type';
2
+ export declare const CreditsWaysToGetCredits: ({ copy, classNames }: CreditsWaysToGetCreditsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import{Fragment as Q,jsx as t,jsxs as i}from"react/jsx-runtime";import{Button as z,Container as O,Heading as p,Picture as f,Text as A}from"@anker-in/headless-ui";import{ChevronDownIcon as P,ChevronUpIcon as G}from"@heroicons/react/24/outline";import{motion as W}from"framer-motion";import{useMemo as j,useState as a}from"react";import{TaskType as b}from"./type";import{useActions as q}from"./useActions";import{useCreditsContext as H}from"../context/provider";import{classNames as c,useHeadlessContext as _}from"@anker-in/lib";import{useRegistration as E}from"../../registration";import{CreditsUploadReceiptModal as V}from"../modal/creditsUploadReceiptModal";import{CreditsSubscribeModal as J}from"../modal/subscribeModal";import{roundedBrands as K}from"../const";const de=({copy:s,classNames:h})=>{const[o,v]=a(!1),{profile:I}=H(),{authCodeActivate:y}=E(),{brand:L}=_(),g=K.includes(L),m=!!I,[M,k]=a(!1),[R,C]=a(!1),[N,T]=a(!1),[w,U]=a(!1),{actions:u}=q({copy:s,subscribe:{openSubscribePopup:()=>C(!0),isSuccess:N},uploadReceipt:{openUploadReceiptPopup:()=>k(!0),isSuccess:w}}),D=j(()=>{const e=s.list.map(n=>{if(!u[n.id])return;const{finished:l,notLogin:F,notFinished:x,completed:B}=u[n.id];let d="",r,S;return m?l?(d=B.buttonLabel,r=void 0):(d=x.buttonLabel,r=x.handleClick,S=x.link):(d=F.buttonLabel,r=F.handleClick),{...n,buttonLabel:d,handleClick:r,finished:l,link:S}}).filter(Boolean);return m?e.sort((n,l)=>n?.finished&&!l?.finished?1:!n?.finished&&l?.finished?-1:0):e},[u,s.list,m]);return i(O,{id:"ways-to-get-credits",className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[i("div",{className:c("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!g&&"rounded-none"),children:[t(p,{as:"h2",size:4,html:s?.title,className:"text-center l:pl-[16px] l:text-left"}),i("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[i("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[t(p,{size:3,as:"h3",html:s.subtitle,className:h?.subtitle}),i("div",{className:"mt-[8px] flex items-center",children:[s.creditsIcon?.url&&t(f,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:s.creditsIcon.url,alt:s.creditsIcon.alt||"credits"}),t(p,{html:s.equalCredits,size:4,as:"h3",className:c("mt-2 text-white md:text-[24px]",h?.equalCreditsText)})]})]}),t(f,{className:"w-full laptop:w-[50%]",source:s.mainImage?.url})]}),i("div",{className:"relative",children:[i(W.div,{className:c("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2"),initial:{height:512},animate:{height:o?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!o&&window.screen.width<768){const e=document.getElementById("ways-to-get-credits");e&&e.scrollIntoView({behavior:"smooth",block:"end"})}},children:[D.map(e=>i("div",{className:c("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!g&&"rounded-none"),children:[i("div",{children:[t(p,{as:"h4",html:e.title,size:2,className:"text-pretty"}),i("div",{className:"mt-[4px] flex items-center",children:[t(f,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),t(A,{as:"p",html:e.credits,size:2,className:"ml-[4px] mt-[6px] lg-desktop:text-[18px]"})]})]}),e.handleClick&&!(e.id===b.UploadReceipt&&w)&&!(e.id===b.Activate&&y.isActivateSuccess)&&!(e.id===b.Subscribe&&N)?t(z,{as:e.link?"a":"button",...e.link&&{href:e.link},...e.handleClick&&{onClick:e.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:e.buttonLabel}):t(z,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:e.buttonLabel})]},e.id)),!o&&t("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),o?t("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{v(!1)},children:t(G,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):t(Q,{children:t("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:t("button",{className:"w-fit",onClick:()=>v(!o),children:t(P,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),s.receipt&&t(V,{isOpen:M,onClose:()=>{k(!1)},copy:s.receipt,onSuccess:()=>{U(!0)}}),s.subscribe&&t(J,{copy:s.subscribe,onSuccess:()=>{T(!0)},isOpen:R,onClose:()=>{C(!1)}})]})};export{de as CreditsWaysToGetCredits};
2
+ //# sourceMappingURL=CreditsWaysToGetCredits.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx"],
4
+ "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\nimport { roundedBrands } from '../const'\n\nexport const CreditsWaysToGetCredits = ({ copy, classNames }: CreditsWaysToGetCreditsProps) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id=\"ways-to-get-credits\" className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div\n className={cn(\n 'rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]',\n !rounded && 'rounded-none'\n )}\n >\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <motion.div\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden md:mt-[16px] md:grid-cols-1 l:gap-[12px] min-md:!h-auto md-l:mt-[32px] md-l:grid-cols-2'\n )}\n initial={{ height: 512 }}\n animate={{ height: showMore ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && window.screen.width < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]',\n !rounded && 'rounded-none'\n )}\n >\n <div>\n <Heading as=\"h4\" html={item.title} size={2} className=\"text-pretty\" />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text as=\"p\" html={item.credits} size={2} className=\"ml-[4px] mt-[6px] lg-desktop:text-[18px]\" />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)' }}\n ></div>\n )}\n </motion.div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
5
+ "mappings": "AAqGQ,OAiGI,YAAAA,EAjGJ,OAAAC,EAII,QAAAC,MAJJ,oBArGR,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,8BAC/C,OAAS,UAAAC,MAAc,gBACvB,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAElC,OAAS,YAAAC,MAAmD,SAC5D,OAAS,cAAAC,MAAkB,eAC3B,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,cA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AA,CACE,SAAAC,EAAC,OAAI,UAAU,6EACb,SAAAA,EAAC,UAAO,UAAU,QAAQ,QAAS,IAAMyB,EAAY,CAACD,CAAQ,EAC5D,SAAAxB,EAACO,EAAA,CAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,GAEJ,GACF,EACCe,EAAK,SACJtB,EAACkB,EAAA,CACC,OAAQa,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMV,EAAK,QACX,UAAW,IAAM,CACfgB,EAA0B,EAAI,CAChC,EACF,EAEDhB,EAAK,WACJtB,EAACmB,EAAA,CACC,KAAMG,EAAK,UACX,UAAW,IAAM,CACfc,EAAsB,EAAI,CAC5B,EACA,OAAQH,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
6
+ "names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "ChevronDownIcon", "ChevronUpIcon", "motion", "useMemo", "useState", "TaskType", "useActions", "useCreditsContext", "cn", "useHeadlessContext", "useRegistration", "CreditsUploadReceiptModal", "CreditsSubscribeModal", "roundedBrands", "CreditsWaysToGetCredits", "copy", "classNames", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "section"]
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './type';
2
+ export * from './CreditsWaysToGetCredits';
@@ -0,0 +1,2 @@
1
+ export*from"./type";export*from"./CreditsWaysToGetCredits";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/index.ts"],
4
+ "sourcesContent": ["export * from './type'\nexport * from './CreditsWaysToGetCredits'\n"],
5
+ "mappings": "AAAA,WAAc,SACd,WAAc",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ import type { ReceiptCopy } from '../modal/creditsUploadReceiptModal';
2
+ import type { CreditsSubscribeModalCopy } from '../modal/subscribeModal';
3
+ export type BenefitItem = {
4
+ title: string;
5
+ credits: string;
6
+ id: string;
7
+ };
8
+ export type CreditsWaysToGetCreditsCopy = {
9
+ title: string;
10
+ subtitle: string;
11
+ equalCredits: string;
12
+ musicIcon: string;
13
+ list: BenefitItem[];
14
+ mainImage: {
15
+ url: string;
16
+ alt: string;
17
+ };
18
+ joinNow: string;
19
+ activate: string;
20
+ completed: string;
21
+ completeProfile: string;
22
+ makeFirstPurchase: string;
23
+ goShopLink: string;
24
+ uploadReceipt: string;
25
+ shopNow: string;
26
+ subscribeLabel: string;
27
+ sendEmailSuccess: string;
28
+ creditsIcon: {
29
+ url: string;
30
+ alt: string;
31
+ };
32
+ receipt: ReceiptCopy;
33
+ subscribe: CreditsSubscribeModalCopy;
34
+ };
35
+ export declare enum TaskType {
36
+ Activate = "activate",
37
+ Subscribe = "subscribe",
38
+ CompleteProfile = "completeProfile",
39
+ FirstPurchase = "firstPurchase",
40
+ UploadReceipt = "uploadReceipt",
41
+ Shop = "shop"
42
+ }
43
+ export type CreditsWaysToGetCreditsProps = {
44
+ copy: CreditsWaysToGetCreditsCopy;
45
+ classNames?: {
46
+ equalCreditsText?: string;
47
+ subtitle?: string;
48
+ };
49
+ };
@@ -0,0 +1,2 @@
1
+ var e=(t=>(t.Activate="activate",t.Subscribe="subscribe",t.CompleteProfile="completeProfile",t.FirstPurchase="firstPurchase",t.UploadReceipt="uploadReceipt",t.Shop="shop",t))(e||{});export{e as TaskType};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/type.ts"],
4
+ "sourcesContent": ["import type { ReceiptCopy } from '../modal/creditsUploadReceiptModal'\nimport type { CreditsSubscribeModalCopy } from '../modal/subscribeModal'\n\nexport type BenefitItem = {\n title: string\n credits: string\n id: string\n}\n\nexport type CreditsWaysToGetCreditsCopy = {\n title: string\n subtitle: string\n equalCredits: string\n musicIcon: string\n list: BenefitItem[]\n mainImage: {\n url: string\n alt: string\n }\n joinNow: string\n activate: string\n completed: string\n completeProfile: string\n makeFirstPurchase: string\n goShopLink: string\n uploadReceipt: string\n shopNow: string\n subscribeLabel: string\n sendEmailSuccess: string\n creditsIcon: {\n url: string\n alt: string\n }\n receipt: ReceiptCopy\n subscribe: CreditsSubscribeModalCopy\n}\n\nexport enum TaskType {\n Activate = 'activate',\n Subscribe = 'subscribe',\n CompleteProfile = 'completeProfile',\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shop = 'shop',\n}\n\nexport type CreditsWaysToGetCreditsProps = {\n copy: CreditsWaysToGetCreditsCopy\n classNames?: {\n equalCreditsText?: string\n subtitle?: string\n }\n}\n"],
5
+ "mappings": "AAqCO,IAAKA,OACVA,EAAA,SAAW,WACXA,EAAA,UAAY,YACZA,EAAA,gBAAkB,kBAClBA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,KAAO,OANGA,OAAA",
6
+ "names": ["TaskType"]
7
+ }
@@ -0,0 +1,105 @@
1
+ import type { CreditsWaysToGetCreditsCopy } from './type';
2
+ export declare const useActions: ({ copy, subscribe, uploadReceipt, gaParameters, }: {
3
+ copy: CreditsWaysToGetCreditsCopy;
4
+ subscribe: {
5
+ openSubscribePopup: () => void;
6
+ isSuccess: boolean;
7
+ };
8
+ uploadReceipt: {
9
+ openUploadReceiptPopup: () => void;
10
+ isSuccess: boolean;
11
+ };
12
+ gaParameters?: {
13
+ position: string;
14
+ };
15
+ }) => {
16
+ actions: {
17
+ activate: {
18
+ finished: any;
19
+ notLogin: {
20
+ buttonLabel: string;
21
+ handleClick: () => void;
22
+ };
23
+ notFinished: {
24
+ buttonLabel: string;
25
+ handleClick: () => void;
26
+ };
27
+ completed: {
28
+ buttonLabel: string;
29
+ };
30
+ };
31
+ subscribe: {
32
+ finished: boolean;
33
+ notLogin: {
34
+ buttonLabel: string;
35
+ handleClick: () => void;
36
+ };
37
+ notFinished: {
38
+ buttonLabel: string;
39
+ handleClick: () => void;
40
+ };
41
+ completed: {
42
+ buttonLabel: string;
43
+ };
44
+ };
45
+ completeProfile: {
46
+ finished: any;
47
+ notLogin: {
48
+ buttonLabel: string;
49
+ handleClick: () => void;
50
+ };
51
+ notFinished: {
52
+ buttonLabel: string;
53
+ link: string;
54
+ handleClick: () => void;
55
+ };
56
+ completed: {
57
+ buttonLabel: string;
58
+ };
59
+ };
60
+ firstPurchase: {
61
+ finished: boolean;
62
+ notLogin: {
63
+ buttonLabel: string;
64
+ handleClick: () => void;
65
+ };
66
+ notFinished: {
67
+ buttonLabel: string;
68
+ link: string;
69
+ handleClick: () => void;
70
+ };
71
+ completed: {
72
+ buttonLabel: string;
73
+ };
74
+ };
75
+ uploadReceipt: {
76
+ finished: boolean;
77
+ notLogin: {
78
+ buttonLabel: string;
79
+ handleClick: () => void;
80
+ };
81
+ notFinished: {
82
+ buttonLabel: string;
83
+ handleClick: () => void;
84
+ };
85
+ completed: {
86
+ buttonLabel: string;
87
+ };
88
+ };
89
+ shop: {
90
+ finished: boolean;
91
+ notLogin: {
92
+ buttonLabel: string;
93
+ handleClick: () => void;
94
+ };
95
+ notFinished: {
96
+ buttonLabel: string;
97
+ link: string;
98
+ handleClick: () => void;
99
+ };
100
+ completed: {
101
+ buttonLabel: string;
102
+ };
103
+ };
104
+ };
105
+ };
@@ -0,0 +1,2 @@
1
+ import{useHeadlessContext as C,gaTrack as P}from"@anker-in/lib";import{TaskType as t}from"./type";import{useCreditsContext as g}from"../context/provider";import{useMemo as d}from"react";import v from"../context/hooks/useReceiptUploaded";import{useFirstPurchaseFinished as F}from"../context/hooks/useFirstPurchaseFinished";import{useSubscribed as S}from"../context/hooks/useSubscribed";import{useRegistration as w}from"../../registration";const W=({copy:e,subscribe:u,uploadReceipt:c,gaParameters:n})=>{const{openSignUpPopup:a,gtm:m,profile:o}=g(),{authCodeActivate:p}=w(),l=S(),s=F(),b=v(),{appName:h,passportUrl:k}=C(),r=d(()=>(o?.first_name||o?.last_name)&&o?.phone_number&&o?.dob,[o]);return d(()=>{const i=({buttonName:L,id:f,callback:N})=>{P({event:"ga4Event",event_name:"lp_button",member_active_status:o?.activated?"active":"not active",event_parameters:{page_group:m.pageGroup,position:n?.position||e.title,button_name:L,info:f}}),N()};return{actions:{[t.Activate]:{finished:o?.activated,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Activate})},notFinished:{buttonLabel:e?.activate,handleClick:()=>i({buttonName:e?.activate,callback:()=>p.open(),id:t.Activate})},completed:{buttonLabel:e?.completed}},[t.Subscribe]:{finished:l,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Subscribe})},notFinished:{buttonLabel:e?.subscribeLabel,handleClick:()=>i({buttonName:e?.subscribeLabel,callback:()=>u.openSubscribePopup(),id:t.Subscribe})},completed:{buttonLabel:e?.completed}},[t.CompleteProfile]:{finished:r,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.CompleteProfile})},notFinished:{buttonLabel:e?.completeProfile,link:`${k}/account/profile?app=${h}`,handleClick:()=>i({buttonName:e?.completeProfile,callback:()=>{},id:t.CompleteProfile})},completed:{buttonLabel:e?.completed}},[t.FirstPurchase]:{finished:s,notLogin:{buttonLabel:e?.makeFirstPurchase,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:a,id:t.FirstPurchase})},notFinished:{buttonLabel:e?.makeFirstPurchase,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.makeFirstPurchase,callback:()=>{},id:t.FirstPurchase})},completed:{buttonLabel:e?.completed}},[t.UploadReceipt]:{finished:b,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.UploadReceipt})},notFinished:{buttonLabel:e?.uploadReceipt,handleClick:()=>i({buttonName:e?.uploadReceipt,callback:()=>c.openUploadReceiptPopup(),id:t.UploadReceipt})},completed:{buttonLabel:e?.completed}},[t.Shop]:{finished:!1,notLogin:{buttonLabel:e?.joinNow,handleClick:()=>i({buttonName:e?.joinNow,callback:a,id:t.Shop})},notFinished:{buttonLabel:e?.shopNow,link:e?.goShopLink,handleClick:()=>i({buttonName:e?.shopNow,callback:()=>{},id:t.Shop})},completed:{buttonLabel:e?.completed}}}}},[o?.activated,e?.joinNow,e?.activate,e?.completed,e?.subscribe,e?.completeProfile,e?.makeFirstPurchase,e?.uploadReceipt,e?.shopNow,e.title,e?.goShopLink,l,r,s,b,n?.position,a])};export{W as useActions};
2
+ //# sourceMappingURL=useActions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/useActions.ts"],
4
+ "sourcesContent": ["import { useHeadlessContext, gaTrack } from '@anker-in/lib'\n\nimport { TaskType } from './type'\nimport { useCreditsContext } from '../context/provider'\nimport { useMemo } from 'react'\nimport useReceiptUploaded from '../context/hooks/useReceiptUploaded'\nimport { useFirstPurchaseFinished } from '../context/hooks/useFirstPurchaseFinished'\nimport { useSubscribed } from '../context/hooks/useSubscribed'\nimport type { CreditsWaysToGetCreditsCopy } from './type'\n\nimport { useRegistration } from '../../registration'\n\nexport const useActions = ({\n copy,\n subscribe,\n uploadReceipt,\n gaParameters,\n}: {\n copy: CreditsWaysToGetCreditsCopy\n subscribe: {\n openSubscribePopup: () => void\n isSuccess: boolean\n }\n uploadReceipt: {\n openUploadReceiptPopup: () => void\n isSuccess: boolean\n }\n gaParameters?: {\n position: string\n }\n}) => {\n const { openSignUpPopup, gtm, profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const isSubscribed = useSubscribed()\n const firstPurchaseFinished = useFirstPurchaseFinished()\n const uploadedReceipt = useReceiptUploaded()\n const { appName, passportUrl } = useHeadlessContext()\n\n const profileCompleted = useMemo(() => {\n return (profile?.first_name || profile?.last_name) && profile?.phone_number && profile?.dob\n }, [profile])\n\n return useMemo(() => {\n const handleClickWithTrack = ({\n buttonName,\n id,\n callback,\n }: {\n buttonName: string\n id?: string\n callback: () => void\n }) => {\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: gtm.pageGroup,\n position: gaParameters?.position || copy.title,\n button_name: buttonName,\n info: id,\n },\n })\n callback()\n }\n return {\n actions: {\n [TaskType.Activate]: {\n finished: profile?.activated,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Activate }),\n },\n notFinished: {\n buttonLabel: copy?.activate,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.activate,\n callback: () => authCodeActivate.open(),\n id: TaskType.Activate,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Subscribe]: {\n finished: isSubscribed,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({ buttonName: copy?.joinNow, callback: openSignUpPopup, id: TaskType.Subscribe }),\n },\n notFinished: {\n buttonLabel: copy?.subscribeLabel,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.subscribeLabel,\n callback: () => subscribe.openSubscribePopup(),\n id: TaskType.Subscribe,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.CompleteProfile]: {\n finished: profileCompleted,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.CompleteProfile,\n }),\n },\n notFinished: {\n buttonLabel: copy?.completeProfile,\n link: `${passportUrl}/account/profile?app=${appName}`,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.completeProfile,\n callback: () => {},\n id: TaskType.CompleteProfile,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.FirstPurchase]: {\n finished: firstPurchaseFinished,\n notLogin: {\n buttonLabel: copy?.makeFirstPurchase,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: openSignUpPopup,\n id: TaskType.FirstPurchase,\n }),\n },\n notFinished: {\n buttonLabel: copy?.makeFirstPurchase,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.makeFirstPurchase,\n callback: () => {},\n id: TaskType.FirstPurchase,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.UploadReceipt]: {\n finished: uploadedReceipt,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.UploadReceipt,\n }),\n },\n notFinished: {\n buttonLabel: copy?.uploadReceipt,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.uploadReceipt,\n callback: () => uploadReceipt.openUploadReceiptPopup(),\n id: TaskType.UploadReceipt,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n [TaskType.Shop]: {\n finished: false,\n notLogin: {\n buttonLabel: copy?.joinNow,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.joinNow,\n callback: openSignUpPopup,\n id: TaskType.Shop,\n }),\n },\n notFinished: {\n buttonLabel: copy?.shopNow,\n link: copy?.goShopLink,\n handleClick: () =>\n handleClickWithTrack({\n buttonName: copy?.shopNow,\n callback: () => {},\n id: TaskType.Shop,\n }),\n },\n completed: {\n buttonLabel: copy?.completed,\n },\n },\n },\n }\n }, [\n profile?.activated,\n copy?.joinNow,\n copy?.activate,\n copy?.completed,\n copy?.subscribe,\n copy?.completeProfile,\n copy?.makeFirstPurchase,\n copy?.uploadReceipt,\n copy?.shopNow,\n copy.title,\n copy?.goShopLink,\n isSubscribed,\n profileCompleted,\n firstPurchaseFinished,\n uploadedReceipt,\n gaParameters?.position,\n openSignUpPopup,\n ])\n}\n"],
5
+ "mappings": "AAAA,OAAS,sBAAAA,EAAoB,WAAAC,MAAe,gBAE5C,OAAS,YAAAC,MAAgB,SACzB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,WAAAC,MAAe,QACxB,OAAOC,MAAwB,sCAC/B,OAAS,4BAAAC,MAAgC,4CACzC,OAAS,iBAAAC,MAAqB,iCAG9B,OAAS,mBAAAC,MAAuB,qBAEzB,MAAMC,EAAa,CAAC,CACzB,KAAAC,EACA,UAAAC,EACA,cAAAC,EACA,aAAAC,CACF,IAaM,CACJ,KAAM,CAAE,gBAAAC,EAAiB,IAAAC,EAAK,QAAAC,CAAQ,EAAIb,EAAkB,EACtD,CAAE,iBAAAc,CAAiB,EAAIT,EAAgB,EACvCU,EAAeX,EAAc,EAC7BY,EAAwBb,EAAyB,EACjDc,EAAkBf,EAAmB,EACrC,CAAE,QAAAgB,EAAS,YAAAC,CAAY,EAAItB,EAAmB,EAE9CuB,EAAmBnB,EAAQ,KACvBY,GAAS,YAAcA,GAAS,YAAcA,GAAS,cAAgBA,GAAS,IACvF,CAACA,CAAO,CAAC,EAEZ,OAAOZ,EAAQ,IAAM,CACnB,MAAMoB,EAAuB,CAAC,CAC5B,WAAAC,EACA,GAAAC,EACA,SAAAC,CACF,IAIM,CACJ1B,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBe,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYD,EAAI,UAChB,SAAUF,GAAc,UAAYH,EAAK,MACzC,YAAae,EACb,KAAMC,CACR,CACF,CAAC,EACDC,EAAS,CACX,EACA,MAAO,CACL,QAAS,CACP,CAACzB,EAAS,QAAQ,EAAG,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L,EACA,YAAa,CACX,YAAaQ,GAAM,kBACnB,KAAMA,GAAM,WACZ,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,kBAClB,SAAU,IAAM,CAAC,EACjB,GAAIR,EAAS,aACf,CAAC,CACL,EACA,UAAW,CACT,YAAaQ,GAAM,SACrB,CACF,EACA,CAACR,EAAS,aAAa,EAAG,CACxB,SAAUkB,EACV,SAAU,CACR,YAAaV,GAAM,QACnB,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,QAClB,SAAUI,EACV,GAAIZ,EAAS,aACf,CAAC,CACL,EACA,YAAa,CACX,YAAaQ,GAAM,cACnB,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,cAClB,SAAU,IAAME,EAAc,uBAAuB,EACrD,GAAIV,EAAS,aACf,CAAC,CACL,EACA,UAAW,CACT,YAAaQ,GAAM,SACrB,CACF,EACA,CAACR,EAAS,IAAI,EAAG,CACf,SAAU,GACV,SAAU,CACR,YAAaQ,GAAM,QACnB,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,QAClB,SAAUI,EACV,GAAIZ,EAAS,IACf,CAAC,CACL,EACA,YAAa,CACX,YAAaQ,GAAM,QACnB,KAAMA,GAAM,WACZ,YAAa,IACXc,EAAqB,CACnB,WAAYd,GAAM,QAClB,SAAU,IAAM,CAAC,EACjB,GAAIR,EAAS,IACf,CAAC,CACL,EACA,UAAW,CACT,YAAaQ,GAAM,SACrB,CACF,CACF,CACF,CACF,EAAG,CACDM,GAAS,UACTN,GAAM,QACNA,GAAM,SACNA,GAAM,UACNA,GAAM,UACNA,GAAM,gBACNA,GAAM,kBACNA,GAAM,cACNA,GAAM,QACNA,EAAK,MACLA,GAAM,WACNQ,EACAK,EACAJ,EACAC,EACAP,GAAc,SACdC,CACF,CAAC,CACH",
6
+ "names": ["useHeadlessContext", "gaTrack", "TaskType", "useCreditsContext", "useMemo", "useReceiptUploaded", "useFirstPurchaseFinished", "useSubscribed", "useRegistration", "useActions", "copy", "subscribe", "uploadReceipt", "gaParameters", "openSignUpPopup", "gtm", "profile", "authCodeActivate", "isSubscribed", "firstPurchaseFinished", "uploadedReceipt", "appName", "passportUrl", "profileCompleted", "handleClickWithTrack", "buttonName", "id", "callback"]
7
+ }
@@ -0,0 +1,10 @@
1
+ export { CreditsProvider, useCreditsContext } from './context/provider';
2
+ export { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt';
3
+ export { CreditsUploadReceiptModal } from './modal/creditsUploadReceiptModal';
4
+ export { CreditsBanner } from './creditsBanner';
5
+ export { CreditsBenefits } from './creditsBenefits';
6
+ export { CreditsInfoCard } from './creditsInfoCard';
7
+ export { CreditsWaysToGetCredits } from './creditsWaysToGetCredits';
8
+ export { CreditsFaq } from './creditsFaq';
9
+ export { CreditsCash } from './creditsCash';
10
+ export { CreditsRedeemList } from './creditsRedeemList';
@@ -0,0 +1,2 @@
1
+ import{CreditsProvider as t,useCreditsContext as o}from"./context/provider";import{useUploadReceipt as d}from"./context/hooks/useUploadReceipt";import{CreditsUploadReceiptModal as p}from"./modal/creditsUploadReceiptModal";import{CreditsBanner as f}from"./creditsBanner";import{CreditsBenefits as x}from"./creditsBenefits";import{CreditsInfoCard as n}from"./creditsInfoCard";import{CreditsWaysToGetCredits as R}from"./creditsWaysToGetCredits";import{CreditsFaq as u}from"./creditsFaq";import{CreditsCash as B}from"./creditsCash";import{CreditsRedeemList as q}from"./creditsRedeemList";export{f as CreditsBanner,x as CreditsBenefits,B as CreditsCash,u as CreditsFaq,n as CreditsInfoCard,t as CreditsProvider,q as CreditsRedeemList,p as CreditsUploadReceiptModal,R as CreditsWaysToGetCredits,o as useCreditsContext,d as useCreditsUploadReceipt};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/components/credits/index.ts"],
4
+ "sourcesContent": ["export { CreditsProvider, useCreditsContext } from './context/provider'\n\nexport { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt'\nexport { CreditsUploadReceiptModal } from './modal/creditsUploadReceiptModal'\nexport { CreditsBanner } from './creditsBanner'\nexport { CreditsBenefits } from './creditsBenefits'\nexport { CreditsInfoCard } from './creditsInfoCard'\nexport { CreditsWaysToGetCredits } from './creditsWaysToGetCredits'\nexport { CreditsFaq } from './creditsFaq'\nexport { CreditsCash } from './creditsCash'\nexport { CreditsRedeemList } from './creditsRedeemList'\n"],
5
+ "mappings": "AAAA,OAAS,mBAAAA,EAAiB,qBAAAC,MAAyB,qBAEnD,OAA6B,oBAApBC,MAAmD,mCAC5D,OAAS,6BAAAC,MAAiC,oCAC1C,OAAS,iBAAAC,MAAqB,kBAC9B,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,2BAAAC,MAA+B,4BACxC,OAAS,cAAAC,MAAkB,eAC3B,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,qBAAAC,MAAyB",
6
+ "names": ["CreditsProvider", "useCreditsContext", "useUploadReceipt", "CreditsUploadReceiptModal", "CreditsBanner", "CreditsBenefits", "CreditsInfoCard", "CreditsWaysToGetCredits", "CreditsFaq", "CreditsCash", "CreditsRedeemList"]
7
+ }
@@ -0,0 +1,32 @@
1
+ import { type ModalContainerProps } from './modalContainer';
2
+ export interface MyRewardsMetafields {
3
+ title: string;
4
+ orderNumberLabel: string;
5
+ valueLabel: string;
6
+ receivedLabel: string;
7
+ failedLabel: string;
8
+ approveSuccessLabel: string;
9
+ couponTab: string;
10
+ productTab: string;
11
+ pendingLabel: string;
12
+ unfulfilledLabel: string;
13
+ fulfilledLabel: string;
14
+ confirmedTip: string;
15
+ pendingTip: string;
16
+ processingTip: string;
17
+ ShippedTip: string;
18
+ emptyListLabel: string;
19
+ pointUnit: string;
20
+ code: string;
21
+ copied: string;
22
+ copy: string;
23
+ emptyListImage: {
24
+ url: string;
25
+ alt?: string;
26
+ };
27
+ }
28
+ interface MyRewardsModalProps extends ModalContainerProps {
29
+ data: MyRewardsMetafields;
30
+ }
31
+ declare function MyRewardsModal({ data, ...props }: MyRewardsModalProps): import("react/jsx-runtime").JSX.Element;
32
+ export default MyRewardsModal;
@@ -0,0 +1,2 @@
1
+ import{jsx as s,jsxs as l}from"react/jsx-runtime";import{Tabs as $,TabsList as z,TabsTrigger as q,Picture as B}from"@anker-in/headless-ui";import m from"classnames";import K from"copy-to-clipboard";import V from"dayjs";import{useCallback as w,useMemo as p,useState as c}from"react";import{ApprovalStatus as g,AlpcConsumeType as n,RewardType as t}from"../context/const";import{CreditsModalContainer as G}from"./modalContainer";import J from"./tip";import Q from"./loadingDots";import S from"../context/hooks/useMyRewards";import{useHeadlessContext as W}from"@anker-in/lib";import{roundedBrands as X}from"../const";function Z({data:o,...a}){const[r,R]=c(n.Coupon),{brand:F}=W(),b=X.includes(F),[d,h]=c(1),[u,_]=c(1),[A,v]=c(-1),D=p(()=>{const e=[];return o.couponTab&&e.push({title:o.couponTab,type:n.Coupon}),o.productTab&&e.push({title:o.productTab,type:n.Product}),e},[o.couponTab,o.productTab]),O=p(()=>({page:a.isOpen?u:0,pageSize:1e3,consumeType:n.Product}),[a.isOpen,u]),I=p(()=>({page:a.isOpen?d:0,pageSize:1e3,consumeType:n.Coupon}),[a.isOpen,d]),{myRewards:x=[],canNext:y,isLoading:k}=S(I),{myRewards:C=[],canNext:T,isLoading:U}=S(O),N=p(()=>r===n.Coupon?x.map(e=>({title:e.goods_title,value:e.consume_credits,type:t.Received,date:new Date(e.create_time*1e3),couponCode:e.coupon_code,orderNumber:""})):r===n.Product?C.map(e=>{let i=t.Pending;return e.fulfillment_status&&e.fulfillment_status!=="null"?e.fulfillment_status==="fulfilled"?i=t.Fulfilled:i=t.Unfulfilled:e.approval_status===g.Success||e.approval_status===g.DoubleConfirm?i=t.ApproveSuccess:e.approval_status===g.Failed&&(i=t.Failed),{title:e.goods_title,value:e.consume_credits,type:i,date:new Date(e.create_time*1e3),orderNumber:e.order_number,couponCode:""}}):[],[r,C,x]),L=p(()=>r===n.Coupon?y:r===n.Product?T:!1,[r,y,T]),Y=p(()=>({[t.Received]:o.receivedLabel,[t.Pending]:o.pendingLabel,[t.ApproveFail]:o.failedLabel,[t.ApproveSuccess]:o.approveSuccessLabel,[t.Unfulfilled]:o.unfulfilledLabel,[t.Fulfilled]:o.fulfilledLabel,[t.Failed]:o.failedLabel}),[o]),P=p(()=>({[t.Received]:"",[t.Pending]:o.pendingTip,[t.ApproveFail]:"",[t.ApproveSuccess]:o.confirmedTip,[t.Unfulfilled]:o.processingTip,[t.Fulfilled]:o.ShippedTip,[t.Failed]:""}),[o]),j=p(()=>({[t.Received]:"#52C41A",[t.Pending]:"#999",[t.ApproveFail]:"#F84D4F",[t.ApproveSuccess]:"#999",[t.Unfulfilled]:"#999",[t.Fulfilled]:"#999",[t.Failed]:"#F84D4F"}),[]),E=w(()=>{L&&(r===n.Coupon?h(d+1):r===n.Product&&_(u+1))},[r,u,d,L]),H=w((e,i)=>{v(i),K(e),setTimeout(()=>{v(-1)},2e3)},[]),M=r===n.Coupon?k:U;return l(G,{title:o.title,className:m("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...a,onScrollEnd:E,children:[s("div",{className:"",children:s($,{align:"left",shape:b?"rounded":"square",value:r.toString(),onValueChange:e=>{R(Number(e))},children:s(z,{children:D.map(e=>s(q,{value:e.type.toString(),children:e.title},e.type))})})}),M&&s("div",{className:"flex h-full flex-col items-center justify-center",children:s(Q,{})}),!M&&s("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:N.length>0?s("div",{className:"grid gap-[18px] md:gap-[12px]",children:N.map((e,i)=>l("div",{className:"grid gap-[8px]",children:[e?.orderNumber&&l("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",e.orderNumber]}),l("div",{className:m("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!b&&"rounded-none"),children:[l("div",{className:"grid gap-[4px]",children:[s("div",{className:"text-[16px] font-bold leading-[1.4]",children:e.title}),l("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",e.value," ",o?.pointUnit]}),l("div",{className:"text-[14px] font-semibold text-[#999]",children:[e?.couponCode?`${o?.code||"Code"}: ${e.couponCode} `:"",e?.couponCode&&s("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{H(e.couponCode,i)},role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&f.preventDefault()},children:A===i?o?.copied||"COPIED":o?.copy||"COPY"})]})]}),l("div",{className:"grid gap-[4px] text-right",children:[l("div",{className:m("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${j[e.type]}]`),children:[s("span",{children:Y[e.type]}),P[e.type]&&s(J,{info:P[e.type],index:i})]}),s("div",{className:"text-[14px] font-semibold text-[#999]",children:V(e.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},i))}):l("div",{className:"flex h-full flex-col items-center justify-center",children:[s(B,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),s("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var ce=Z;export{ce as default};
2
+ //# sourceMappingURL=MyRewardsModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/modal/MyRewardsModal.tsx"],
4
+ "sourcesContent": ["import { Tabs, TabsList, TabsTrigger, Picture } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport clipboard from 'copy-to-clipboard'\nimport dayjs from 'dayjs'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport { ApprovalStatus, AlpcConsumeType, RewardType } from '../context/const'\nimport { CreditsModalContainer, type ModalContainerProps } from './modalContainer'\nimport Tip from './tip'\nimport LoadingDots from './loadingDots'\nimport useMyRewards from '../context/hooks/useMyRewards'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { roundedBrands } from '../const'\n\nexport interface MyRewardsMetafields {\n title: string\n orderNumberLabel: string\n valueLabel: string\n receivedLabel: string\n failedLabel: string\n approveSuccessLabel: string\n couponTab: string\n productTab: string\n pendingLabel: string\n unfulfilledLabel: string\n fulfilledLabel: string\n confirmedTip: string\n pendingTip: string\n processingTip: string\n ShippedTip: string\n emptyListLabel: string\n pointUnit: string\n code: string\n copied: string\n copy: string\n emptyListImage: {\n url: string\n alt?: string\n }\n}\ninterface MyRewardsModalProps extends ModalContainerProps {\n data: MyRewardsMetafields\n}\n\nfunction MyRewardsModal({ data, ...props }: MyRewardsModalProps) {\n const [activeTab, setActiveTab] = useState(AlpcConsumeType.Coupon)\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n\n const [couponPage, setCouponPage] = useState(1)\n const [productPage, setProductPage] = useState(1)\n const [copied, setCopied] = useState(-1)\n\n const tabs = useMemo(() => {\n const availableTabs: { title: string; type: number }[] = []\n\n if (data.couponTab) {\n availableTabs.push({\n title: data.couponTab,\n type: AlpcConsumeType.Coupon,\n })\n }\n\n if (data.productTab) {\n availableTabs.push({\n title: data.productTab,\n type: AlpcConsumeType.Product,\n })\n }\n\n return availableTabs\n }, [data.couponTab, data.productTab])\n\n const myProductRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? productPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Product,\n }\n }, [props.isOpen, productPage])\n const myCouponRewardsOptions = useMemo(() => {\n return {\n page: props.isOpen ? couponPage : 0,\n pageSize: 1000,\n consumeType: AlpcConsumeType.Coupon,\n }\n }, [props.isOpen, couponPage])\n\n const {\n myRewards: myCouponRewards = [],\n canNext: couponCanNext,\n isLoading: couponIsLoading,\n } = useMyRewards(myCouponRewardsOptions)\n const {\n myRewards: myProductRewards = [],\n canNext: productCanNext,\n isLoading: productIsLoading,\n } = useMyRewards(myProductRewardsOptions)\n\n const list = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return myCouponRewards.map(item => ({\n title: item.goods_title,\n value: item.consume_credits,\n type: RewardType.Received,\n date: new Date(item.create_time * 1000),\n couponCode: item.coupon_code,\n orderNumber: '',\n }))\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return myProductRewards.map(item => {\n let type = RewardType.Pending\n\n if (item.fulfillment_status && item.fulfillment_status !== 'null') {\n // \u7269\u6D41\u72B6\u6001\n if (item.fulfillment_status === 'fulfilled') {\n type = RewardType.Fulfilled\n } else {\n type = RewardType.Unfulfilled\n }\n } else {\n if (\n item.approval_status === ApprovalStatus.Success ||\n item.approval_status === ApprovalStatus.DoubleConfirm\n ) {\n type = RewardType.ApproveSuccess\n } else if (item.approval_status === ApprovalStatus.Failed) {\n type = RewardType.Failed\n }\n }\n\n return {\n title: item.goods_title,\n value: item.consume_credits,\n type,\n date: new Date(item.create_time * 1000),\n orderNumber: item.order_number,\n couponCode: '',\n }\n })\n }\n\n return []\n }, [activeTab, myProductRewards, myCouponRewards])\n\n const canNext = useMemo(() => {\n if (activeTab === AlpcConsumeType.Coupon) {\n return couponCanNext\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return productCanNext\n }\n\n return false\n }, [activeTab, couponCanNext, productCanNext])\n\n const TypeMap = useMemo(() => {\n return {\n [RewardType.Received]: data.receivedLabel,\n [RewardType.Pending]: data.pendingLabel,\n [RewardType.ApproveFail]: data.failedLabel,\n [RewardType.ApproveSuccess]: data.approveSuccessLabel,\n [RewardType.Unfulfilled]: data.unfulfilledLabel,\n [RewardType.Fulfilled]: data.fulfilledLabel,\n [RewardType.Failed]: data.failedLabel,\n }\n }, [data])\n\n const TipMap = useMemo(() => {\n return {\n [RewardType.Received]: '',\n [RewardType.Pending]: data.pendingTip,\n [RewardType.ApproveFail]: '',\n [RewardType.ApproveSuccess]: data.confirmedTip,\n [RewardType.Unfulfilled]: data.processingTip,\n [RewardType.Fulfilled]: data.ShippedTip,\n [RewardType.Failed]: '',\n }\n }, [data])\n\n const ColorMap = useMemo(() => {\n return {\n [RewardType.Received]: '#52C41A',\n [RewardType.Pending]: '#999',\n [RewardType.ApproveFail]: '#F84D4F',\n [RewardType.ApproveSuccess]: '#999',\n [RewardType.Unfulfilled]: '#999',\n [RewardType.Fulfilled]: '#999',\n [RewardType.Failed]: '#F84D4F',\n }\n }, [])\n\n const handleScrollEnd = useCallback(() => {\n if (!canNext) {\n return\n }\n\n if (activeTab === AlpcConsumeType.Coupon) {\n setCouponPage(couponPage + 1)\n } else if (activeTab === AlpcConsumeType.Product) {\n setProductPage(productPage + 1)\n }\n }, [activeTab, productPage, couponPage, canNext])\n\n const handleCopy = useCallback((code: string, idx: number) => {\n setCopied(idx)\n clipboard(code)\n setTimeout(() => {\n setCopied(-1)\n }, 2000)\n }, [])\n\n const isLoading = activeTab === AlpcConsumeType.Coupon ? couponIsLoading : productIsLoading\n\n return (\n <CreditsModalContainer\n title={data.title}\n className={classNames('h-[800px] w-[640px]')}\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n scrollClassName=\"md:mb-0\"\n {...props}\n onScrollEnd={handleScrollEnd}\n >\n <div className=\"\">\n <Tabs\n align=\"left\"\n shape={rounded ? 'rounded' : 'square'}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(Number(value))\n }}\n >\n <TabsList>\n {tabs.map(tab => (\n <TabsTrigger key={tab.type} value={tab.type.toString()}>\n {tab.title}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n </div>\n\n {isLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <LoadingDots />\n </div>\n )}\n\n {!isLoading && (\n <div className=\"mt-[24px] overflow-auto overscroll-contain\">\n {list.length > 0 ? (\n <div className=\"grid gap-[18px] md:gap-[12px]\">\n {list.map((item, index) => (\n <div key={index} className=\"grid gap-[8px]\">\n {item?.orderNumber && (\n <div className=\"text-[15px] font-semibold leading-[1.4] text-[#777]\">\n {data.orderNumberLabel}: {item.orderNumber}\n </div>\n )}\n <div\n className={classNames(\n 'flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]',\n !rounded && 'rounded-none'\n )}\n >\n <div className=\"grid gap-[4px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{item.title}</div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {data.valueLabel}: {item.value} {data?.pointUnit}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {item?.couponCode ? `${data?.code || 'Code'}: ${item.couponCode} ` : ''}\n {item?.couponCode && (\n <span\n className=\"cursor-pointer text-[14px] font-semibold text-brand underline\"\n onClick={() => {\n handleCopy(item.couponCode, index)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copied === index ? data?.copied || 'COPIED' : data?.copy || 'COPY'}\n </span>\n )}\n </div>\n </div>\n <div className=\"grid gap-[4px] text-right\">\n <div\n className={classNames(\n 'flex items-center justify-end text-[16px] font-bold leading-[1.4]',\n `text-[${ColorMap[item.type]}]`\n )}\n >\n <span>{TypeMap[item.type]}</span>\n {TipMap[item.type] && <Tip info={TipMap[item.type]} index={index} />}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}\n </div>\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <Picture\n className=\"mb-[12px] w-[160px]\"\n source={data?.emptyListImage?.url}\n alt={data?.emptyListImage?.alt || 'empty list image'}\n ></Picture>\n <div className=\"text-[16px] font-semibold leading-[1.4]\">{data?.emptyListLabel}</div>\n </div>\n )}\n </div>\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default MyRewardsModal\n"],
5
+ "mappings": "AA8Oc,cAAAA,EAqBM,QAAAC,MArBN,oBA9Od,OAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,EAAa,WAAAC,MA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,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAA3B,IAAW0B,EAAQpC,GAAM,QAAU,SAAWA,GAAM,MAAQ,OAC/D,GAEJ,GACF,EACArB,EAAC,OAAI,UAAU,4BACb,UAAAA,EAAC,OACC,UAAWK,EACT,oEACA,SAAS4C,EAASL,EAAK,IAAI,CAAC,GAC9B,EAEA,UAAA7C,EAAC,QAAM,SAAAgD,EAAQH,EAAK,IAAI,EAAE,EACzBI,EAAOJ,EAAK,IAAI,GAAK7C,EAACgB,EAAA,CAAI,KAAMiC,EAAOJ,EAAK,IAAI,EAAG,MAAOa,EAAO,GACpE,EACA1D,EAAC,OAAI,UAAU,wCACZ,SAAAQ,EAAMqC,EAAK,IAAI,EAAE,OAAO,kBAAkB,EAAE,SAAS,EACxD,GACF,GACF,IApDQa,CAqDV,CACD,EACH,EAEAzD,EAAC,OAAI,UAAU,mDACb,UAAAD,EAACK,EAAA,CACC,UAAU,sBACV,OAAQiB,GAAM,gBAAgB,IAC9B,IAAKA,GAAM,gBAAgB,KAAO,mBACnC,EACDtB,EAAC,OAAI,UAAU,0CAA2C,SAAAsB,GAAM,eAAe,GACjF,EAEJ,GAEJ,CAEJ,CAEA,IAAOsC,GAAQvC",
6
+ "names": ["jsx", "jsxs", "Tabs", "TabsList", "TabsTrigger", "Picture", "classNames", "clipboard", "dayjs", "useCallback", "useMemo", "useState", "ApprovalStatus", "AlpcConsumeType", "RewardType", "CreditsModalContainer", "Tip", "LoadingDots", "useMyRewards", "useHeadlessContext", "roundedBrands", "MyRewardsModal", "data", "props", "activeTab", "setActiveTab", "brand", "rounded", "couponPage", "setCouponPage", "productPage", "setProductPage", "copied", "setCopied", "tabs", "availableTabs", "myProductRewardsOptions", "myCouponRewardsOptions", "myCouponRewards", "couponCanNext", "couponIsLoading", "myProductRewards", "productCanNext", "productIsLoading", "list", "item", "type", "canNext", "TypeMap", "TipMap", "ColorMap", "handleScrollEnd", "handleCopy", "code", "idx", "isLoading", "value", "tab", "index", "e", "MyRewardsModal_default"]
7
+ }
@@ -0,0 +1,32 @@
1
+ import { type ModalContainerProps } from './modalContainer';
2
+ export interface MyActivitiesMetafields {
3
+ title: string;
4
+ tips: string;
5
+ allTab: string;
6
+ earnedTab: string;
7
+ deductedTab: string;
8
+ expiredTab: string;
9
+ activationTask: string;
10
+ updateNameTask: string;
11
+ updatePhoneTask: string;
12
+ updateBirthdayTask: string;
13
+ updateAppNameTask: string;
14
+ subscriptionTask: string;
15
+ refundTask: string;
16
+ productUnApprovedTask: string;
17
+ pendingTips?: string;
18
+ pendingTips2?: string;
19
+ firstPurchaseTask: string;
20
+ uploadReceiptTask: string;
21
+ shoppingTask: string;
22
+ emptyListImage: {
23
+ url: string;
24
+ alt?: string;
25
+ };
26
+ emptyListLabel: string;
27
+ }
28
+ interface ActivitiesModalProps extends ModalContainerProps {
29
+ data: MyActivitiesMetafields;
30
+ }
31
+ declare function ActivitiesModal({ data, ...props }: ActivitiesModalProps): import("react/jsx-runtime").JSX.Element;
32
+ export default ActivitiesModal;
@@ -0,0 +1,2 @@
1
+ import{Fragment as V,jsx as i,jsxs as n}from"react/jsx-runtime";import{useCallback as Y,useMemo as g,useState as h}from"react";import{useCreditsContext as w}from"../context/provider";import{CreditType as p,DTC_TASK_TYPE as f,TaskSubType as r,TaskType as E}from"../context/const";import R from"../context/hooks/useActivities";import{CreditsModalContainer as B}from"./modalContainer";import{classNames as v,useHeadlessContext as I}from"@anker-in/lib";import{Tabs as j,TabsList as F,TabsTrigger as H}from"@anker-in/headless-ui";import O from"./loadingDots";import{Picture as z,Text as N}from"@anker-in/headless-ui";import A from"dayjs";import{roundedBrands as q}from"../const";function K({data:e,...c}){const[l,_]=h(1),{taskIdToTypeMapping:u}=w(),{brand:M}=I(),k=q.includes(M),P=g(()=>({page:c.isOpen?l:0,pageSize:1e3}),[c.isOpen,l]),[o,C]=h(p.All),S=g(()=>{const s=[{title:e.allTab,type:p.All},{title:e.earnedTab,type:p.Earned},{title:e.deductedTab,type:p.Deducted}];return e.expiredTab&&s.push({title:e.expiredTab,type:p.Expired}),s},[e]),{activities:x=[],canNext:y,isLoading:b}=R(P),T=g(()=>{const s={[r.Activation]:e.activationTask,[r.UpdateName]:e.updateNameTask,[r.UpdatePhone]:e.updatePhoneTask,[r.UpdateBirthday]:e.updateBirthdayTask,[r.Subscription]:e.subscriptionTask,[r.UpadteAppName]:e.updateAppNameTask,[r.Refund]:e.refundTask,[r.ProductUnApproved]:e.productUnApprovedTask},m={[f.FirstPurchase]:e.firstPurchaseTask,[f.UploadReceipt]:e.uploadReceiptTask,[f.Shopping]:e.shoppingTask};function D(t){return t.task_type===E.Redeem&&t.task_sub_type===r.ProductUnApproved&&e.productUnApprovedTask?t.task_name.replace("Refund",e.productUnApprovedTask):u?.[String(t.task_rule_id)]?m[u?.[String(t.task_rule_id)]]:s[t.task_sub_type]||t.task_name}let a=x.map(t=>({title:D(t),date:new Date(t.create_time*1e3),value:t.credit,type:t.credit_type,pending_time:t.pending_time,credit_type:t.credit_type,status:t.status}))||[];return o===p.Earned?a=a?.filter(t=>t.type===1):o===p.Deducted?a=a?.filter(t=>t.type===2&&t.status!==3):o===p.Expired&&(a=a?.filter(t=>t.type===2&&t.status===3)),a.map(t=>{let{value:d,...L}=t;return t.type===p.Deducted&&d>0&&(d=-d),{value:d,...L}})},[e.activationTask,e.updateNameTask,e.updatePhoneTask,e.updateBirthdayTask,e.subscriptionTask,e.updateAppNameTask,e.refundTask,e.productUnApprovedTask,e.firstPurchaseTask,e.uploadReceiptTask,e.shoppingTask,x,o,u]),U=Y(()=>{y&&_(l+1)},[l,y]);return n(B,{title:e.title,className:v("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"",...c,onScrollEnd:U,children:[i("div",{className:"w-full sticky top-0 bg-white z-10 pb-[24px] overflow-x-auto",children:i(j,{align:"left",shape:k?"rounded":"square",value:o.toString(),onValueChange:s=>{C(Number(s))},className:"",children:i(F,{children:S.map(s=>i(H,{value:s.type.toString(),children:s.title},s.type))})})}),n("div",{className:"grid gap-[18px] overflow-auto overscroll-contain md:gap-[12px]",children:[b&&i("div",{className:"flex h-full flex-col items-center justify-center",children:i(O,{})}),!b&&i(V,{children:T.length>0?T.map((s,m)=>n("div",{className:v("flex h-fit items-center justify-between rounded-[8px] bg-[#f2f0f1] px-[16px] py-[20px] text-[16px]",!k&&"rounded-none"),children:[n("div",{className:"grid gap-[6px]",children:[i("div",{className:"font-bold",children:s.title}),i("div",{className:"text-[14px] font-semibold text-[#999]",children:A(s.date).format("YYYY-MM-DD HH:mm").toString()}),!e.pendingTips&&n("div",{className:`hidden text-[14px] font-semibold text-[#777] ${s.status===2&&s.credit_type===1?"!flex":""}`,children:[i(N,{html:e.pendingTips}),i("span",{children:A.unix(s.pending_time).add(1,"day").format("YYYY-MM-DD")}),e.pendingTips2&&i(N,{html:e.pendingTips2})]})]}),n("div",{className:v("font-bold",s.value>=0||s.credit_type===p.Expired?"text-[#52C41A]":"text-[#F84D4F]"),children:[s.value>=0&&"+",s.value]})]},m)):n("div",{className:"flex h-full flex-col items-center justify-center",children:[i(z,{className:"mb-[16px] h-[120px] w-[160px]",source:e?.emptyListImage?.url,alt:e?.emptyListImage?.alt||"empty list image"}),i("div",{className:"leading-1.4 text-[16px] font-semibold",children:e?.emptyListLabel})]})})]}),T.length>0&&i("div",{className:"mt-[12px] pb-[24px] text-[14px] font-semibold text-[#999]",children:e.tips})]})}var re=K;export{re as default};
2
+ //# sourceMappingURL=activitiesModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/credits/modal/activitiesModal.tsx"],
4
+ "sourcesContent": ["import { useCallback, useMemo, useState } from 'react'\nimport { useCreditsContext } from '../context/provider'\nimport { CreditType, DTC_TASK_TYPE, TaskSubType, TaskType } from '../context/const'\nimport useActivities from '../context/hooks/useActivities'\nimport type { Task } from '../context/response'\nimport { CreditsModalContainer, type ModalContainerProps } from './modalContainer'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport LoadingDots from './loadingDots'\nimport { Picture, Text } from '@anker-in/headless-ui'\nimport dayjs from 'dayjs'\nimport { roundedBrands } from '../const'\n\nexport interface MyActivitiesMetafields {\n title: string\n tips: string\n allTab: string\n earnedTab: string\n deductedTab: string\n expiredTab: string\n activationTask: string\n updateNameTask: string\n updatePhoneTask: string\n updateBirthdayTask: string\n updateAppNameTask: string\n subscriptionTask: string\n refundTask: string\n productUnApprovedTask: string\n pendingTips?: string\n pendingTips2?: string\n firstPurchaseTask: string\n uploadReceiptTask: string\n shoppingTask: string\n emptyListImage: {\n url: string\n alt?: string\n }\n emptyListLabel: string\n}\n\ninterface ActivitiesModalProps extends ModalContainerProps {\n data: MyActivitiesMetafields\n}\n\nfunction ActivitiesModal({ data, ...props }: ActivitiesModalProps) {\n const [page, setPage] = useState(1)\n const { taskIdToTypeMapping } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n\n const myActivitiesOptions = useMemo(() => {\n return {\n page: props.isOpen ? page : 0,\n pageSize: 1000,\n }\n }, [props.isOpen, page])\n\n const [activeTab, setActiveTab] = useState(CreditType.All)\n const tabs = useMemo(() => {\n const tabs = [\n {\n title: data.allTab,\n type: CreditType.All,\n },\n {\n title: data.earnedTab,\n type: CreditType.Earned,\n },\n {\n title: data.deductedTab,\n type: CreditType.Deducted,\n },\n ]\n if (data.expiredTab) {\n tabs.push({\n title: data.expiredTab,\n type: CreditType.Expired,\n })\n }\n return tabs\n }, [data])\n\n const { activities = [], canNext, isLoading } = useActivities(myActivitiesOptions)\n\n const list = useMemo(() => {\n const taskNameMap = {\n [TaskSubType.Activation]: data.activationTask,\n [TaskSubType.UpdateName]: data.updateNameTask,\n [TaskSubType.UpdatePhone]: data.updatePhoneTask,\n [TaskSubType.UpdateBirthday]: data.updateBirthdayTask,\n [TaskSubType.Subscription]: data.subscriptionTask,\n [TaskSubType.UpadteAppName]: data.updateAppNameTask,\n [TaskSubType.Refund]: data.refundTask,\n [TaskSubType.ProductUnApproved]: data.productUnApprovedTask,\n }\n const dtcTaskTypeToNameMap = {\n [DTC_TASK_TYPE.FirstPurchase]: data.firstPurchaseTask,\n [DTC_TASK_TYPE.UploadReceipt]: data.uploadReceiptTask,\n [DTC_TASK_TYPE.Shopping]: data.shoppingTask,\n }\n\n function getTitle(item: Task) {\n if (\n item.task_type === TaskType.Redeem &&\n item.task_sub_type === TaskSubType.ProductUnApproved &&\n data.productUnApprovedTask\n ) {\n // \u65B0\u589E\u7684\u90E8\u5206\u4EFB\u52A1\u90FD\u4F7F\u7528\u4E86 alpc \u540C\u4E00\u4E2A\u4EFB\u52A1\u7C7B\u578B\uFF0C\u9700\u8981\u7528\u4EFB\u52A1 id \u6765\u533A\u5206\n return item.task_name.replace('Refund', data.productUnApprovedTask)\n } else if (taskIdToTypeMapping?.[String(item.task_rule_id)]) {\n return dtcTaskTypeToNameMap[taskIdToTypeMapping?.[String(item.task_rule_id)]]\n } else {\n return taskNameMap[item.task_sub_type] || item.task_name\n }\n }\n\n const all = activities.map(item => ({\n title: getTitle(item),\n date: new Date(item.create_time * 1000),\n value: item.credit,\n type: item.credit_type,\n pending_time: item.pending_time,\n credit_type: item.credit_type,\n status: item.status,\n }))\n\n let filtered = all || []\n if (activeTab === CreditType.Earned) {\n filtered = filtered?.filter(item => item.type === 1)\n } else if (activeTab === CreditType.Deducted) {\n filtered = filtered?.filter(item => item.type === 2 && item.status !== 3)\n } else if (activeTab === CreditType.Expired) {\n filtered = filtered?.filter(item => item.type === 2 && item.status === 3)\n }\n\n return filtered.map(item => {\n let { value, ...otherItem } = item\n if (item.type === CreditType.Deducted && value > 0) {\n value = -value\n }\n\n return {\n value,\n ...otherItem,\n }\n })\n }, [\n data.activationTask,\n data.updateNameTask,\n data.updatePhoneTask,\n data.updateBirthdayTask,\n data.subscriptionTask,\n data.updateAppNameTask,\n data.refundTask,\n data.productUnApprovedTask,\n data.firstPurchaseTask,\n data.uploadReceiptTask,\n data.shoppingTask,\n activities,\n activeTab,\n taskIdToTypeMapping,\n ])\n\n const handleScrollEnd = useCallback(() => {\n if (!canNext) {\n return\n }\n setPage(page + 1)\n }, [page, canNext])\n\n return (\n <CreditsModalContainer\n title={data.title}\n className={cn('h-[800px] w-[640px]')}\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n scrollClassName=\"\"\n {...props}\n onScrollEnd={handleScrollEnd}\n >\n <div className=\"w-full sticky top-0 bg-white z-10 pb-[24px] overflow-x-auto\">\n <Tabs\n align=\"left\"\n shape={rounded ? 'rounded' : 'square'}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(Number(value))\n }}\n className=\"\"\n >\n <TabsList>\n {tabs.map(tab => (\n <TabsTrigger key={tab.type} value={tab.type.toString()}>\n {tab.title}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n </div>\n\n <div className=\"grid gap-[18px] overflow-auto overscroll-contain md:gap-[12px]\">\n {isLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <LoadingDots />\n </div>\n )}\n\n {!isLoading && (\n <>\n {list.length > 0 ? (\n list.map((item, index) => (\n <div\n key={index}\n className={cn(\n 'flex h-fit items-center justify-between rounded-[8px] bg-[#f2f0f1] px-[16px] py-[20px] text-[16px]',\n !rounded && 'rounded-none'\n )}\n >\n <div className=\"grid gap-[6px]\">\n <div className=\"font-bold\">{item.title}</div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}\n </div>\n {!data.pendingTips && (\n <div\n className={`hidden text-[14px] font-semibold text-[#777] ${item.status === 2 && item.credit_type === 1 ? '!flex' : ''}`}\n >\n <Text html={data.pendingTips} />\n <span>{dayjs.unix(item.pending_time).add(1, 'day').format('YYYY-MM-DD')}</span>\n {data.pendingTips2 && <Text html={data.pendingTips2} />}\n </div>\n )}\n </div>\n <div\n className={cn(\n 'font-bold',\n item.value >= 0 || item.credit_type === CreditType.Expired ? 'text-[#52C41A]' : 'text-[#F84D4F]'\n )}\n >\n {item.value >= 0 && '+'}\n {item.value}\n </div>\n </div>\n ))\n ) : (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <Picture\n className=\"mb-[16px] h-[120px] w-[160px]\"\n source={data?.emptyListImage?.url}\n alt={data?.emptyListImage?.alt || 'empty list image'}\n ></Picture>\n <div className=\"leading-1.4 text-[16px] font-semibold\">{data?.emptyListLabel}</div>\n </div>\n )}\n </>\n )}\n </div>\n {/* \u79EF\u5206\u5230\u8D26\u65F6\u95F4\u63D0\u9192 */}\n {list.length > 0 && <div className=\"mt-[12px] pb-[24px] text-[14px] font-semibold text-[#999]\">{data.tips}</div>}\n </CreditsModalContainer>\n )\n}\n\nexport default ActivitiesModal\n"],
5
+ "mappings": "AAgMc,OAgBJ,YAAAA,EAhBI,OAAAC,EAgCQ,QAAAC,MAhCR,oBAhMd,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAC/C,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,cAAAC,EAAY,iBAAAC,EAAe,eAAAC,EAAa,YAAAC,MAAgB,mBACjE,OAAOC,MAAmB,iCAE1B,OAAS,yBAAAC,MAAuD,mBAChE,OAAS,cAAcC,EAAI,sBAAAC,MAA0B,gBACrD,OAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,MAAmB,wBAC5C,OAAOC,MAAiB,gBACxB,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC9B,OAAOC,MAAW,QAClB,OAAS,iBAAAC,MAAqB,WAiC9B,SAASC,EAAgB,CAAE,KAAAC,EAAM,GAAGC,CAAM,EAAyB,CACjE,KAAM,CAACC,EAAMC,CAAO,EAAItB,EAAS,CAAC,EAC5B,CAAE,oBAAAuB,CAAoB,EAAItB,EAAkB,EAC5C,CAAE,MAAAuB,CAAM,EAAIf,EAAmB,EAC/BgB,EAAUR,EA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EACT,YACA6B,EAAK,OAAS,GAAKA,EAAK,cAAgBnC,EAAW,QAAU,iBAAmB,gBAClF,EAEC,UAAAmC,EAAK,OAAS,GAAK,IACnBA,EAAK,OACR,IA7BKM,CA8BP,CACD,EAED9C,EAAC,OAAI,UAAU,mDACb,UAAAD,EAACkB,EAAA,CACC,UAAU,gCACV,OAAQK,GAAM,gBAAgB,IAC9B,IAAKA,GAAM,gBAAgB,KAAO,mBACnC,EACDvB,EAAC,OAAI,UAAU,wCAAyC,SAAAuB,GAAM,eAAe,GAC/E,EAEJ,GAEJ,EAECc,EAAK,OAAS,GAAKrC,EAAC,OAAI,UAAU,4DAA6D,SAAAuB,EAAK,KAAK,GAC5G,CAEJ,CAEA,IAAOyB,GAAQ1B",
6
+ "names": ["Fragment", "jsx", "jsxs", "useCallback", "useMemo", "useState", "useCreditsContext", "CreditType", "DTC_TASK_TYPE", "TaskSubType", "TaskType", "useActivities", "CreditsModalContainer", "cn", "useHeadlessContext", "Tabs", "TabsList", "TabsTrigger", "LoadingDots", "Picture", "Text", "dayjs", "roundedBrands", "ActivitiesModal", "data", "props", "page", "setPage", "taskIdToTypeMapping", "brand", "rounded", "myActivitiesOptions", "activeTab", "setActiveTab", "tabs", "activities", "canNext", "isLoading", "list", "taskNameMap", "dtcTaskTypeToNameMap", "getTitle", "item", "filtered", "value", "otherItem", "handleScrollEnd", "tab", "index", "activitiesModal_default"]
7
+ }
@@ -0,0 +1,24 @@
1
+ export type ReceiptCopy = {
2
+ title: string;
3
+ description: string;
4
+ placeholder: string;
5
+ note: string;
6
+ submit: string;
7
+ successTitle: string;
8
+ successDescription: string;
9
+ gotIt: string;
10
+ failedTitle: string;
11
+ successIcon: string;
12
+ failedIcon: string;
13
+ failedReasons: {
14
+ code: string;
15
+ id: string;
16
+ description: string;
17
+ }[];
18
+ };
19
+ export declare function CreditsUploadReceiptModal({ isOpen, onClose, copy, onSuccess, }: {
20
+ isOpen: boolean;
21
+ onClose: () => void;
22
+ copy: ReceiptCopy;
23
+ onSuccess: () => void;
24
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import{jsx as s,jsxs as h}from"react/jsx-runtime";import{Button as f,Heading as g,Text as n}from"@anker-in/headless-ui";import{useCallback as I,useState as l}from"react";import{CreditsModalContainer as C}from"./modalContainer";import{useUploadReceipt as z}from"../context/hooks/useUploadReceipt";import{useHeadlessContext as M}from"@anker-in/lib";import{roundedBrands as P}from"../const";import k from"classnames";function Y({isOpen:N,onClose:a,copy:e,onSuccess:r}){const{trigger:d,isMutating:b}=z(),[o,c]=l(""),[p,m]=l(!1),[t,u]=l({icon:"",title:"",description:"",isSuccess:!1}),{brand:R}=M(),T=P.includes(R),D=I(()=>{d({orderName:o},{onSuccess:i=>{if(m(!0),i?.ok)r(),u({icon:e.successIcon,title:e.successTitle||"Success",description:e.successDescription||"Your receipt has been uploaded successfully",isSuccess:!0});else{const S=e.failedReasons.find(v=>v.code===i.code?.toString());u({icon:e.failedIcon,title:e.failedTitle||"Failed",description:S?.description||"Please try again",isSuccess:!1})}}})},[d,o,r,e.successIcon,e.successTitle,e.successDescription,e.failedReasons,e.failedIcon,e.failedTitle]),x=()=>{m(!1),c(""),t.isSuccess&&a()};return h(C,{isOpen:N,onClose:a,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-[48px] md:mb-0 md:pb-[24px] md:px-[16px]",titleClassName:"h-[56px]",useAnimation:!0,animationClassName:"md:translate-y-[100vh]",children:[s(g,{size:"3",children:e.title}),s(n,{size:"3",className:"mt-[8px] md:mt-[4px]",children:e.description}),s("input",{placeholder:e.placeholder,className:k("mt-[24px] h-[50px] w-full rounded-[2px] border border-[#6D6D6F] pl-[14px] text-[16px] font-bold placeholder:text-[16px] placeholder:font-bold placeholder:text-[#6D6D6F] focus:outline-none focus:ring-0 md:rounded-[4px] md:placeholder:text-[14px]",!T&&"rounded-none"),value:o,onChange:i=>c(i.target.value)}),s(n,{size:"1",as:"p",className:"mt-[8px] text-[#6D6D6F]",children:e.note}),s(f,{variant:"primary",className:"mt-[24px] w-full",loading:b,onClick:D,children:e.submit}),p&&h(C,{isOpen:p,onClose:x,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-[48px] md:mb-0 md:pb-[24px] md:px-[16px] flex flex-col items-center text-center",titleClassName:"h-[56px]",children:[s(n,{size:"3",className:"size-[64px]",as:"div",html:t.icon}),s(g,{size:"3",className:"mt-[16px]",children:t.title}),s(n,{size:"3",className:"mt-[8px] md:mt-[4px]",children:t.description}),s(f,{variant:"primary",className:"mt-[24px]",onClick:x,children:e.gotIt})]})]})}export{Y as CreditsUploadReceiptModal};
2
+ //# sourceMappingURL=creditsUploadReceiptModal.js.map