@anker-in/campaign-ui 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/dist/cjs/components/chat/index.js +1 -1
  2. package/dist/cjs/components/chat/index.js.map +3 -3
  3. package/dist/cjs/components/credits/const.d.ts +1 -0
  4. package/dist/cjs/components/credits/const.js +2 -0
  5. package/dist/cjs/components/credits/const.js.map +7 -0
  6. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
  7. package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js.map +2 -2
  8. package/dist/cjs/components/credits/context/hooks/useSubscribed.js +1 -1
  9. package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +3 -3
  10. package/dist/cjs/components/credits/context/provider.d.ts +8 -33
  11. package/dist/cjs/components/credits/context/provider.js +1 -1
  12. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  13. package/dist/cjs/components/credits/creditsBanner/index.d.ts +16 -16
  14. package/dist/cjs/components/credits/creditsBanner/index.js +1 -1
  15. package/dist/cjs/components/credits/creditsBanner/index.js.map +2 -2
  16. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +1 -1
  17. package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +3 -3
  18. package/dist/cjs/components/credits/creditsBenefits/index.d.ts +7 -8
  19. package/dist/cjs/components/credits/creditsBenefits/index.js +3 -3
  20. package/dist/cjs/components/credits/creditsBenefits/index.js.map +3 -3
  21. package/dist/cjs/components/credits/creditsCash/CreditsCash.d.ts +4 -0
  22. package/dist/cjs/components/credits/creditsCash/CreditsCash.js +2 -0
  23. package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +7 -0
  24. package/dist/cjs/components/credits/creditsCash/RedeemableItem.d.ts +1 -5
  25. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
  26. package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  27. package/dist/cjs/components/credits/creditsCash/index.d.ts +2 -11
  28. package/dist/cjs/components/credits/creditsCash/index.js +1 -1
  29. package/dist/cjs/components/credits/creditsCash/index.js.map +4 -4
  30. package/dist/cjs/components/credits/creditsCash/type.d.ts +1 -3
  31. package/dist/cjs/components/credits/creditsCash/type.js +1 -1
  32. package/dist/cjs/components/credits/creditsCash/type.js.map +1 -1
  33. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
  34. package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +3 -3
  35. package/dist/cjs/components/credits/creditsFaq/index.d.ts +2 -2
  36. package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
  37. package/dist/cjs/components/credits/creditsFaq/index.js.map +3 -3
  38. package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +9 -15
  39. package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
  40. package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
  41. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  42. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  43. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  44. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  45. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  46. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  47. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +4 -0
  48. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
  49. package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
  50. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.d.ts +1 -3
  51. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js +1 -1
  52. package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js.map +3 -3
  53. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  54. package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
  55. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  56. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  57. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  58. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
  59. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
  60. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
  61. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  62. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +3 -3
  63. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  64. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  65. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  66. package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  67. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  68. package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
  69. package/dist/cjs/components/credits/creditsRedeemList/index.d.ts +2 -12
  70. package/dist/cjs/components/credits/creditsRedeemList/index.js +1 -1
  71. package/dist/cjs/components/credits/creditsRedeemList/index.js.map +4 -4
  72. package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +1 -15
  73. package/dist/cjs/components/credits/creditsRedeemList/type.js +1 -1
  74. package/dist/cjs/components/credits/creditsRedeemList/type.js.map +1 -1
  75. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +2 -0
  76. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
  77. package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
  78. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.d.ts +2 -2
  79. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js +1 -1
  80. package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js.map +4 -4
  81. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +5 -15
  82. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js +1 -1
  83. package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +2 -2
  84. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.d.ts +11 -2
  85. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
  86. package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +3 -3
  87. package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
  88. package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +3 -3
  89. package/dist/cjs/components/credits/modal/activitiesModal.js +1 -1
  90. package/dist/cjs/components/credits/modal/activitiesModal.js.map +3 -3
  91. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  92. package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  93. package/dist/cjs/components/credits/modal/modalContainer.js +1 -1
  94. package/dist/cjs/components/credits/modal/modalContainer.js.map +3 -3
  95. package/dist/cjs/components/credits/modal/rulesModal.js +1 -1
  96. package/dist/cjs/components/credits/modal/rulesModal.js.map +3 -3
  97. package/dist/cjs/components/credits/modal/subscribeModal.d.ts +15 -0
  98. package/dist/cjs/components/credits/modal/subscribeModal.js +2 -0
  99. package/dist/cjs/components/credits/modal/subscribeModal.js.map +7 -0
  100. package/dist/cjs/components/credits/modal/tip.js +1 -1
  101. package/dist/cjs/components/credits/modal/tip.js.map +3 -3
  102. package/dist/cjs/components/credits/type.d.ts +23 -4
  103. package/dist/cjs/components/credits/type.js +1 -1
  104. package/dist/cjs/components/credits/type.js.map +1 -1
  105. package/dist/cjs/components/index.d.ts +1 -0
  106. package/dist/cjs/components/index.js +1 -1
  107. package/dist/cjs/components/index.js.map +2 -2
  108. package/dist/cjs/components/registration/authCodeActivate/Message.js +1 -1
  109. package/dist/cjs/components/registration/authCodeActivate/Message.js.map +2 -2
  110. package/dist/cjs/components/registration/authCodeActivate/index.js +1 -1
  111. package/dist/cjs/components/registration/authCodeActivate/index.js.map +3 -3
  112. package/dist/cjs/components/registration/authCodeActivate/type.d.ts +1 -2
  113. package/dist/cjs/components/registration/authCodeActivate/type.js +1 -1
  114. package/dist/cjs/components/registration/authCodeActivate/type.js.map +1 -1
  115. package/dist/cjs/components/registration/context/index.d.ts +1 -0
  116. package/dist/cjs/components/registration/context/index.js +2 -0
  117. package/dist/cjs/components/registration/context/index.js.map +7 -0
  118. package/dist/cjs/components/registration/context/provider.d.ts +27 -0
  119. package/dist/cjs/components/registration/context/provider.js +2 -0
  120. package/dist/cjs/components/registration/context/provider.js.map +7 -0
  121. package/dist/cjs/components/registration/index.d.ts +1 -0
  122. package/dist/cjs/components/registration/index.js +1 -1
  123. package/dist/cjs/components/registration/index.js.map +2 -2
  124. package/dist/cjs/components/registration/modalContainer.d.ts +1 -2
  125. package/dist/cjs/components/registration/modalContainer.js +1 -1
  126. package/dist/cjs/components/registration/modalContainer.js.map +3 -3
  127. package/dist/cjs/index.d.ts +2 -1
  128. package/dist/cjs/index.js +1 -1
  129. package/dist/cjs/index.js.map +2 -2
  130. package/dist/cjs/templates/credits.d.ts +59 -0
  131. package/dist/cjs/templates/credits.js +2 -0
  132. package/dist/cjs/templates/credits.js.map +7 -0
  133. package/dist/cjs/templates/index.d.ts +1 -0
  134. package/dist/cjs/templates/index.js +2 -0
  135. package/dist/cjs/templates/index.js.map +7 -0
  136. package/dist/esm/components/chat/index.js +1 -1
  137. package/dist/esm/components/chat/index.js.map +2 -2
  138. package/dist/esm/components/credits/const.d.ts +1 -0
  139. package/dist/esm/components/credits/const.js +2 -0
  140. package/dist/esm/components/credits/const.js.map +7 -0
  141. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +1 -1
  142. package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +2 -2
  143. package/dist/esm/components/credits/context/hooks/useSubscribed.js +1 -1
  144. package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +3 -3
  145. package/dist/esm/components/credits/context/provider.d.ts +8 -33
  146. package/dist/esm/components/credits/context/provider.js +1 -1
  147. package/dist/esm/components/credits/context/provider.js.map +3 -3
  148. package/dist/esm/components/credits/creditsBanner/index.d.ts +16 -16
  149. package/dist/esm/components/credits/creditsBanner/index.js +1 -1
  150. package/dist/esm/components/credits/creditsBanner/index.js.map +2 -2
  151. package/dist/esm/components/credits/creditsBenefits/benefitItem.js +1 -1
  152. package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +3 -3
  153. package/dist/esm/components/credits/creditsBenefits/index.d.ts +7 -8
  154. package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
  155. package/dist/esm/components/credits/creditsBenefits/index.js.map +2 -2
  156. package/dist/esm/components/credits/creditsCash/CreditsCash.d.ts +4 -0
  157. package/dist/esm/components/credits/creditsCash/CreditsCash.js +2 -0
  158. package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +7 -0
  159. package/dist/esm/components/credits/creditsCash/RedeemableItem.d.ts +1 -5
  160. package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
  161. package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +3 -3
  162. package/dist/esm/components/credits/creditsCash/index.d.ts +2 -11
  163. package/dist/esm/components/credits/creditsCash/index.js +1 -1
  164. package/dist/esm/components/credits/creditsCash/index.js.map +4 -4
  165. package/dist/esm/components/credits/creditsCash/type.d.ts +1 -3
  166. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +1 -1
  167. package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +2 -2
  168. package/dist/esm/components/credits/creditsFaq/index.d.ts +2 -2
  169. package/dist/esm/components/credits/creditsFaq/index.js +1 -1
  170. package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
  171. package/dist/esm/components/credits/creditsInfoCard/index.d.ts +9 -15
  172. package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
  173. package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
  174. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +1 -1
  175. package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +3 -3
  176. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +1 -1
  177. package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +3 -3
  178. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  179. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  180. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +4 -0
  181. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
  182. package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
  183. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.d.ts +1 -3
  184. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js +1 -1
  185. package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js.map +3 -3
  186. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
  187. package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
  188. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
  189. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +3 -3
  190. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
  191. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +3 -3
  192. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
  193. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
  194. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
  195. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +3 -3
  196. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
  197. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +3 -3
  198. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
  199. package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
  200. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
  201. package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +3 -3
  202. package/dist/esm/components/credits/creditsRedeemList/index.d.ts +2 -12
  203. package/dist/esm/components/credits/creditsRedeemList/index.js +1 -1
  204. package/dist/esm/components/credits/creditsRedeemList/index.js.map +4 -4
  205. package/dist/esm/components/credits/creditsRedeemList/type.d.ts +1 -15
  206. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +2 -0
  207. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
  208. package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
  209. package/dist/esm/components/credits/creditsWaysToGetCredits/index.d.ts +2 -2
  210. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js +1 -1
  211. package/dist/esm/components/credits/creditsWaysToGetCredits/index.js.map +4 -4
  212. package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +5 -15
  213. package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +2 -2
  214. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.d.ts +11 -2
  215. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +1 -1
  216. package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +3 -3
  217. package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
  218. package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
  219. package/dist/esm/components/credits/modal/activitiesModal.js +1 -1
  220. package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
  221. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +1 -1
  222. package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
  223. package/dist/esm/components/credits/modal/modalContainer.js +1 -1
  224. package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
  225. package/dist/esm/components/credits/modal/rulesModal.js +1 -1
  226. package/dist/esm/components/credits/modal/rulesModal.js.map +2 -2
  227. package/dist/esm/components/credits/modal/subscribeModal.d.ts +15 -0
  228. package/dist/esm/components/credits/modal/subscribeModal.js +2 -0
  229. package/dist/esm/components/credits/modal/subscribeModal.js.map +7 -0
  230. package/dist/esm/components/credits/modal/tip.js +1 -1
  231. package/dist/esm/components/credits/modal/tip.js.map +3 -3
  232. package/dist/esm/components/credits/type.d.ts +23 -4
  233. package/dist/esm/components/index.d.ts +1 -0
  234. package/dist/esm/components/index.js +1 -1
  235. package/dist/esm/components/index.js.map +2 -2
  236. package/dist/esm/components/registration/authCodeActivate/Message.js +1 -1
  237. package/dist/esm/components/registration/authCodeActivate/Message.js.map +2 -2
  238. package/dist/esm/components/registration/authCodeActivate/index.js +1 -1
  239. package/dist/esm/components/registration/authCodeActivate/index.js.map +3 -3
  240. package/dist/esm/components/registration/authCodeActivate/type.d.ts +1 -2
  241. package/dist/esm/components/registration/context/index.d.ts +1 -0
  242. package/dist/esm/components/registration/context/index.js +2 -0
  243. package/dist/esm/components/registration/context/index.js.map +7 -0
  244. package/dist/esm/components/registration/context/provider.d.ts +27 -0
  245. package/dist/esm/components/registration/context/provider.js +2 -0
  246. package/dist/esm/components/registration/context/provider.js.map +7 -0
  247. package/dist/esm/components/registration/index.d.ts +1 -0
  248. package/dist/esm/components/registration/index.js +1 -1
  249. package/dist/esm/components/registration/index.js.map +2 -2
  250. package/dist/esm/components/registration/modalContainer.d.ts +1 -2
  251. package/dist/esm/components/registration/modalContainer.js +1 -1
  252. package/dist/esm/components/registration/modalContainer.js.map +3 -3
  253. package/dist/esm/index.d.ts +2 -1
  254. package/dist/esm/index.js +1 -1
  255. package/dist/esm/index.js.map +2 -2
  256. package/dist/esm/templates/credits.d.ts +59 -0
  257. package/dist/esm/templates/credits.js +2 -0
  258. package/dist/esm/templates/credits.js.map +7 -0
  259. package/dist/esm/templates/index.d.ts +1 -0
  260. package/dist/esm/templates/index.js +2 -0
  261. package/dist/esm/templates/index.js.map +7 -0
  262. package/package.json +5 -4
  263. package/src/components/chat/index.tsx +1 -1
  264. package/src/components/credits/context/hooks/useRedeemAndBuy.ts +0 -2
  265. package/src/components/credits/context/hooks/useSubscribed.ts +1 -2
  266. package/src/components/credits/context/provider.tsx +16 -20
  267. package/src/components/credits/creditsBanner/index.tsx +14 -16
  268. package/src/components/credits/creditsBenefits/benefitItem.tsx +19 -4
  269. package/src/components/credits/creditsBenefits/index.tsx +6 -10
  270. package/src/components/credits/creditsCash/{index.tsx → CreditsCash.tsx} +8 -26
  271. package/src/components/credits/creditsCash/RedeemableItem.tsx +35 -17
  272. package/src/components/credits/creditsCash/index.ts +2 -0
  273. package/src/components/credits/creditsCash/type.ts +1 -3
  274. package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +12 -12
  275. package/src/components/credits/creditsFaq/index.tsx +6 -4
  276. package/src/components/credits/creditsInfoCard/index.tsx +38 -33
  277. package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +7 -3
  278. package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +5 -1
  279. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +5 -4
  280. package/src/components/credits/creditsRedeemList/{index.tsx → CreditsRedeemList.tsx} +15 -28
  281. package/src/components/credits/creditsRedeemList/NonProductValue.tsx +4 -3
  282. package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +6 -6
  283. package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +14 -11
  284. package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +4 -2
  285. package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +3 -1
  286. package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +9 -5
  287. package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +4 -1
  288. package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +2 -2
  289. package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +11 -7
  290. package/src/components/credits/creditsRedeemList/index.ts +2 -0
  291. package/src/components/credits/creditsRedeemList/type.ts +1 -16
  292. package/src/components/credits/creditsWaysToGetCredits/{index.tsx → CreditsWaysToGetCredits.tsx} +64 -15
  293. package/src/components/credits/creditsWaysToGetCredits/index.ts +2 -0
  294. package/src/components/credits/creditsWaysToGetCredits/type.ts +5 -15
  295. package/src/components/credits/creditsWaysToGetCredits/useActions.ts +22 -8
  296. package/src/components/credits/modal/MyRewardsModal.tsx +10 -2
  297. package/src/components/credits/modal/activitiesModal.tsx +8 -3
  298. package/src/components/credits/modal/creditsUploadReceiptModal.tsx +9 -1
  299. package/src/components/credits/modal/modalContainer.tsx +5 -1
  300. package/src/components/credits/modal/rulesModal.tsx +1 -1
  301. package/src/components/credits/modal/subscribeModal.tsx +201 -0
  302. package/src/components/credits/modal/tip.tsx +10 -1
  303. package/src/components/credits/type.ts +23 -4
  304. package/src/components/index.ts +2 -2
  305. package/src/components/registration/authCodeActivate/Message.tsx +43 -0
  306. package/src/components/registration/authCodeActivate/index.tsx +338 -0
  307. package/src/components/registration/authCodeActivate/type.ts +23 -0
  308. package/src/components/registration/context/index.tsx +1 -0
  309. package/src/components/registration/context/provider.tsx +86 -0
  310. package/src/components/registration/index.ts +2 -0
  311. package/src/components/registration/modalContainer.tsx +114 -0
  312. package/src/index.ts +2 -1
  313. package/src/templates/credits.tsx +134 -0
  314. package/src/templates/index.ts +1 -0
  315. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.d.ts +0 -1
  316. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js +0 -2
  317. package/dist/cjs/components/credits/context/hooks/useSendEmailValidation.js.map +0 -7
  318. package/dist/cjs/components/credits/context/hooks/useSubscriptions.d.ts +0 -9
  319. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js +0 -2
  320. package/dist/cjs/components/credits/context/hooks/useSubscriptions.js.map +0 -7
  321. package/dist/cjs/helpers/fetchResponse.d.ts +0 -14
  322. package/dist/cjs/helpers/fetchResponse.js +0 -2
  323. package/dist/cjs/helpers/fetchResponse.js.map +0 -7
  324. package/dist/cjs/helpers/fetcher.d.ts +0 -2
  325. package/dist/cjs/helpers/fetcher.js +0 -2
  326. package/dist/cjs/helpers/fetcher.js.map +0 -7
  327. package/dist/cjs/helpers/index.d.ts +0 -2
  328. package/dist/cjs/helpers/index.js +0 -2
  329. package/dist/cjs/helpers/index.js.map +0 -7
  330. package/dist/cjs/helpers/track.d.ts +0 -19
  331. package/dist/cjs/helpers/track.js +0 -2
  332. package/dist/cjs/helpers/track.js.map +0 -7
  333. package/dist/cjs/helpers/utils.d.ts +0 -3
  334. package/dist/cjs/helpers/utils.js +0 -2
  335. package/dist/cjs/helpers/utils.js.map +0 -7
  336. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.d.ts +0 -1
  337. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js +0 -2
  338. package/dist/esm/components/credits/context/hooks/useSendEmailValidation.js.map +0 -7
  339. package/dist/esm/components/credits/context/hooks/useSubscriptions.d.ts +0 -9
  340. package/dist/esm/components/credits/context/hooks/useSubscriptions.js +0 -2
  341. package/dist/esm/components/credits/context/hooks/useSubscriptions.js.map +0 -7
  342. package/dist/esm/helpers/fetchResponse.d.ts +0 -14
  343. package/dist/esm/helpers/fetchResponse.js +0 -2
  344. package/dist/esm/helpers/fetchResponse.js.map +0 -7
  345. package/dist/esm/helpers/fetcher.d.ts +0 -2
  346. package/dist/esm/helpers/fetcher.js +0 -2
  347. package/dist/esm/helpers/fetcher.js.map +0 -7
  348. package/dist/esm/helpers/index.d.ts +0 -2
  349. package/dist/esm/helpers/index.js +0 -2
  350. package/dist/esm/helpers/index.js.map +0 -7
  351. package/dist/esm/helpers/track.d.ts +0 -19
  352. package/dist/esm/helpers/track.js +0 -2
  353. package/dist/esm/helpers/track.js.map +0 -7
  354. package/dist/esm/helpers/utils.d.ts +0 -3
  355. package/dist/esm/helpers/utils.js +0 -2
  356. package/dist/esm/helpers/utils.js.map +0 -7
  357. package/src/components/credits/context/hooks/useSendEmailValidation.ts +0 -20
  358. package/src/components/credits/context/hooks/useSubscriptions.ts +0 -29
  359. package/src/helpers/fetchResponse.ts +0 -35
  360. package/src/helpers/fetcher.ts +0 -44
  361. package/src/helpers/index.ts +0 -2
  362. package/src/helpers/track.ts +0 -73
  363. package/src/helpers/utils.ts +0 -8
@@ -0,0 +1,86 @@
1
+ import { createContext, Dispatch, PropsWithChildren, SetStateAction, useContext, useState } from 'react'
2
+ import { AuthCodeActivate } from '../authCodeActivate'
3
+
4
+ interface RegistrationContextType {
5
+ email?: string
6
+ copy?: any
7
+ authCodeActivate: {
8
+ isOpen: boolean
9
+ open: () => void
10
+ close: () => void
11
+ isActivateSuccess: boolean
12
+ activeToken?: string
13
+ onAuthSuccess: (() => void) | undefined
14
+ isSendingActivateEmail: boolean
15
+ setIsSendingActivateEmail: Dispatch<SetStateAction<boolean>>
16
+ setActiveToken: Dispatch<SetStateAction<string | undefined>>
17
+ setIsActivateSuccess: Dispatch<SetStateAction<boolean>>
18
+ setOnAuthSuccess: Dispatch<SetStateAction<(() => void) | undefined>>
19
+ autoSendEmail: boolean
20
+ setAutoSendEmail: Dispatch<SetStateAction<boolean>>
21
+ }
22
+ }
23
+
24
+ export const RegistrationContext = createContext<RegistrationContextType>({
25
+ email: undefined,
26
+ copy: undefined,
27
+ authCodeActivate: {
28
+ activeToken: undefined,
29
+ setActiveToken: () => {},
30
+ isOpen: false,
31
+ open: () => {},
32
+ close: () => {},
33
+ isActivateSuccess: false,
34
+ isSendingActivateEmail: false,
35
+ setIsSendingActivateEmail: () => {},
36
+ setIsActivateSuccess: () => {},
37
+ setOnAuthSuccess: () => {},
38
+ onAuthSuccess: undefined,
39
+ autoSendEmail: false,
40
+ setAutoSendEmail: () => {},
41
+ },
42
+ })
43
+
44
+ export const useRegistration = () => {
45
+ const context = useContext(RegistrationContext)
46
+ if (!context) {
47
+ throw new Error('useRegistration must be used within a RegistrationProvider')
48
+ }
49
+ return context
50
+ }
51
+
52
+ export const RegistrationProvider = ({ children, email, copy }: PropsWithChildren<{ email?: string; copy?: any }>) => {
53
+ const [popAuthCode, setPopAuthCode] = useState(false)
54
+ const [onAuthSuccess, setOnAuthSuccess] = useState<(() => void) | undefined>(undefined)
55
+ const [isActivateSuccess, setIsActivateSuccess] = useState(false)
56
+ const [activeToken, setActiveToken] = useState<string>()
57
+ const [isSendingActivateEmail, setIsSendingActivateEmail] = useState(false)
58
+ const [autoSendEmail, setAutoSendEmail] = useState(false)
59
+
60
+ return (
61
+ <RegistrationContext.Provider
62
+ value={{
63
+ email,
64
+ copy,
65
+ authCodeActivate: {
66
+ activeToken,
67
+ isOpen: popAuthCode,
68
+ open: () => setPopAuthCode(true),
69
+ close: () => setPopAuthCode(false),
70
+ isActivateSuccess,
71
+ setIsActivateSuccess,
72
+ onAuthSuccess,
73
+ setOnAuthSuccess,
74
+ isSendingActivateEmail,
75
+ setIsSendingActivateEmail,
76
+ setActiveToken,
77
+ autoSendEmail,
78
+ setAutoSendEmail,
79
+ },
80
+ }}
81
+ >
82
+ {children}
83
+ {copy?.authCodeActivate && <AuthCodeActivate copy={copy.authCodeActivate} />}
84
+ </RegistrationContext.Provider>
85
+ )
86
+ }
@@ -0,0 +1,2 @@
1
+ export * from './authCodeActivate'
2
+ export * from './context'
@@ -0,0 +1,114 @@
1
+ import { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'
2
+ import { useEffect, useState, type UIEvent } from 'react'
3
+ import ReactModal from 'react-modal'
4
+
5
+ export type ModalContainerProps = {
6
+ overlayClassName?: string
7
+ className?: string
8
+ scrollClassName?: string
9
+ title?: string
10
+ titleClassName?: string
11
+ useAnimation?: boolean // 使用动画展示
12
+ isOpen: boolean
13
+ children?: any
14
+ onClose: () => void
15
+ onScrollEnd?: (event: UIEvent<HTMLDivElement>) => void
16
+ }
17
+
18
+ export const RegistrationModalContainer = ({
19
+ isOpen,
20
+ title,
21
+ className = '',
22
+ overlayClassName = '',
23
+ scrollClassName = '',
24
+ onClose,
25
+ onScrollEnd,
26
+ children,
27
+ useAnimation = true,
28
+ titleClassName = '',
29
+ ...props
30
+ }: ModalContainerProps): React.ReactElement => {
31
+ const { brand } = useHeadlessContext()
32
+ const rounded = ROUNDED_BRANDS.includes(brand)
33
+ const [animationShow, setAnimationShow] = useState(false)
34
+
35
+ useEffect(() => {
36
+ if (!useAnimation) {
37
+ return
38
+ }
39
+ requestAnimationFrame(() => {
40
+ setAnimationShow(isOpen ?? false)
41
+ })
42
+ }, [isOpen, useAnimation])
43
+
44
+ return (
45
+ <ReactModal
46
+ isOpen={isOpen ?? false}
47
+ overlayClassName={cn(
48
+ 'fixed inset-0 z-[999] flex items-center justify-center bg-black/70 leading-[1.2] md:items-end',
49
+ overlayClassName
50
+ )}
51
+ className={cn(
52
+ 'min-md:max-h-[calc(100vh-96px)] w-[540px] relative flex min-h-[200px] flex-col overflow-hidden bg-white outline-none transition-all duration-300 md:h-auto md:w-full',
53
+ rounded && 'rounded-[16px] md:rounded-b-none',
54
+ useAnimation && 'md:translate-y-[100vh]',
55
+ animationShow && 'md:translate-y-0',
56
+ className
57
+ )}
58
+ onRequestClose={onClose}
59
+ {...props}
60
+ >
61
+ <div
62
+ className={cn(
63
+ 'flex w-full shrink-0 items-center justify-between',
64
+ title ? 'min-l:px-[32px] h-[70px] border-b border-[#e2e2e2] px-[24px]' : 'h-[48px] px-[16px]',
65
+ titleClassName
66
+ )}
67
+ >
68
+ <div className="text-[18px] font-bold">{title}</div>
69
+ <div
70
+ className="size-[22px] cursor-pointer"
71
+ onClick={onClose}
72
+ onKeyDown={e => {
73
+ if (e.key === 'Enter' || e.key === ' ') {
74
+ e.preventDefault()
75
+ onClose?.()
76
+ }
77
+ }}
78
+ role="button"
79
+ tabIndex={0}
80
+ >
81
+ <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
82
+ <path
83
+ fillRule="evenodd"
84
+ clipRule="evenodd"
85
+ d="M16.8525 5.31015C16.4558 4.91337 15.8125 4.91338 15.4157 5.31015L11.1268 9.5991L6.83815 5.31049C6.44138 4.91372 5.79808 4.91372 5.40131 5.31049C5.00454 5.70726 5.00455 6.35055 5.40131 6.74732L9.68993 11.0359L5.40105 15.3248C5.00428 15.7216 5.00428 16.3649 5.40105 16.7616C5.79782 17.1584 6.44111 17.1584 6.83788 16.7616L11.1268 12.4728L15.416 16.762C15.8128 17.1588 16.456 17.1588 16.8528 16.762C17.2496 16.3652 17.2496 15.7219 16.8528 15.3252L12.5636 11.0359L16.8525 6.74698C17.2493 6.35021 17.2493 5.70692 16.8525 5.31015ZM16.921 6.02856C16.921 6.22992 16.8441 6.43127 16.6905 6.5849L14.465 8.8104L12.2395 11.0359L12.2395 11.0359L16.6905 6.58493C16.8441 6.43129 16.921 6.22993 16.921 6.02856ZM5.34966 6.19087C5.37992 6.3354 5.45115 6.47307 5.56336 6.58528L10.014 11.0359L10.014 11.0359L5.56336 6.58524C5.45116 6.47304 5.37992 6.33539 5.34966 6.19087ZM5.35087 16.2121C5.38193 16.3541 5.45267 16.4891 5.56309 16.5996C5.87037 16.9068 6.36856 16.9068 6.67583 16.5996L11.1268 12.1486L15.578 16.5999C15.8853 16.9072 16.3835 16.9072 16.6908 16.5999C16.8498 16.4409 16.9265 16.2307 16.9209 16.0223C16.9265 16.2307 16.8498 16.4409 16.6908 16.5999C16.3835 16.9072 15.8853 16.9072 15.578 16.5999L11.1268 12.1487L6.67583 16.5996C6.36856 16.9069 5.87037 16.9069 5.56309 16.5996C5.45267 16.4892 5.38192 16.3541 5.35087 16.2121Z"
86
+ fill="#333333"
87
+ />
88
+ </svg>
89
+ </div>
90
+ </div>
91
+ <div
92
+ className={cn(
93
+ 'my-[32px] flex-1 overflow-auto overscroll-contain px-[24px] md:mb-[48px]',
94
+ !title && 'mt-0',
95
+ 'min-l:px-[32px]',
96
+ scrollClassName
97
+ )}
98
+ onScroll={event => {
99
+ const targetElement = event.target as HTMLDivElement
100
+
101
+ if (targetElement.scrollHeight <= targetElement.clientHeight) {
102
+ return
103
+ }
104
+
105
+ if (targetElement.scrollTop + targetElement.clientHeight >= targetElement.scrollHeight - 50) {
106
+ onScrollEnd && onScrollEnd(event)
107
+ }
108
+ }}
109
+ >
110
+ {children}
111
+ </div>
112
+ </ReactModal>
113
+ )
114
+ }
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
- export * from './components/index'
1
+ export * from './components'
2
+ export * from './templates'
@@ -0,0 +1,134 @@
1
+ import { classNames, HeadlessConfig, HeadlessProvider } from '@anker-in/lib'
2
+ import { RegistrationProvider } from '../components/registration/context/provider'
3
+
4
+ import { DTC_TASK_TYPE } from '../components/credits/context/const'
5
+ import { CreditsProvider } from '../components/credits/context/provider'
6
+ import { CreditsPageCommon } from '../components/credits/type'
7
+
8
+ import { CreditsBanner, CreditsBannerCopy } from '../components/credits/creditsBanner'
9
+ import { CreditsInfoCard, CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'
10
+ import { CreditsBenefits, CreditsBenefitsCopy } from '../components/credits/creditsBenefits'
11
+ import { CreditsWaysToGetCredits, CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'
12
+ import { CreditsRedeemList, CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'
13
+ import { CreditsCash, CreditsCashCopy } from '../components/credits/creditsCash'
14
+ import { CreditsFaq, CreditsFaqCopy } from '../components/credits/creditsFaq'
15
+ import { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'
16
+
17
+ export enum ComponentKey {
18
+ Banner = 'creditsBanner',
19
+ InfoCard = 'creditsInfoCard',
20
+ Benefits = 'creditsBenefits',
21
+ WaysToGetCredits = 'creditsWaysToGetCredits',
22
+ RedeemList = 'creditsRedeemList',
23
+ SpendCreditsLikeCash = 'creditsCash',
24
+ Faqs = 'creditsFaq',
25
+ }
26
+ export type CreditsTemplateProps = {
27
+ headlessConfig: HeadlessConfig
28
+ siteConfig: {
29
+ registrationsSettings: {
30
+ authCodeActivate: AuthCodeActivateCopy
31
+ }
32
+ taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>
33
+ }
34
+ pageConfig: {
35
+ order: ComponentKey[]
36
+ common: CreditsPageCommon
37
+ components: {
38
+ [ComponentKey.Banner]?: CreditsBannerCopy
39
+ [ComponentKey.InfoCard]?: CreditsInfoCardCopy
40
+ [ComponentKey.Benefits]?: CreditsBenefitsCopy
41
+ [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy
42
+ [ComponentKey.RedeemList]?: CreditsRedeemListCopy
43
+ [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy
44
+ [ComponentKey.Faqs]?: CreditsFaqCopy
45
+ }
46
+ }
47
+ userContext: {
48
+ profile: any
49
+ removeProfile: () => void
50
+ isLoadingProfile: boolean
51
+ creditInfo: any
52
+ customer: any
53
+ customerLoading: boolean
54
+ fetchCreditInfo: () => void
55
+ }
56
+ registrationContext: {
57
+ openSignUpPopup: () => void
58
+ openSignInPopup: () => void
59
+ }
60
+ gtm: {
61
+ pageGroup: string
62
+ }
63
+ }
64
+
65
+ export const CreditsTemplate = ({
66
+ headlessConfig,
67
+ siteConfig,
68
+ userContext,
69
+ pageConfig,
70
+ registrationContext,
71
+ gtm,
72
+ }: CreditsTemplateProps) => {
73
+ return (
74
+ <HeadlessProvider headlessConfig={headlessConfig}>
75
+ <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>
76
+ <CreditsProvider
77
+ profile={userContext?.profile}
78
+ removeProfile={userContext?.removeProfile}
79
+ isLoadingProfile={userContext?.isLoadingProfile}
80
+ openSignInPopup={registrationContext.openSignInPopup}
81
+ openSignUpPopup={registrationContext.openSignUpPopup}
82
+ creditInfo={userContext?.creditInfo}
83
+ taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}
84
+ customer={userContext?.customer}
85
+ fetchCreditInfo={userContext?.fetchCreditInfo}
86
+ customerLoading={userContext?.customerLoading}
87
+ gtm={gtm}
88
+ pageCommon={pageConfig.common}
89
+ >
90
+ <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>
91
+ {pageConfig.order.map(key => {
92
+ const componentCopy = pageConfig.components?.[key]
93
+ if (!componentCopy) return null
94
+ return (
95
+ <>
96
+ {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} />}
97
+ {key === ComponentKey.InfoCard && userContext?.profile && (
98
+ <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} />
99
+ )}
100
+ {key === ComponentKey.Benefits && <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} />}
101
+ {key === ComponentKey.WaysToGetCredits && (
102
+ <CreditsWaysToGetCredits
103
+ copy={componentCopy as CreditsWaysToGetCreditsCopy}
104
+ classNames={
105
+ headlessConfig.brand === 'anker'
106
+ ? {
107
+ subtitle: 'text-white',
108
+ equalCreditsText:
109
+ 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',
110
+ }
111
+ : {
112
+ subtitle: 'text-[#D1D1D1]',
113
+ equalCreditsText: 'text-[#F6EAD0]',
114
+ }
115
+ }
116
+ />
117
+ )}
118
+ {key === ComponentKey.RedeemList && (
119
+ <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} />
120
+ )}
121
+ {key === ComponentKey.SpendCreditsLikeCash && <CreditsCash copy={componentCopy as CreditsCashCopy} />}
122
+ {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} />}
123
+ {key !== ComponentKey.Banner && (
124
+ <div className="laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16" />
125
+ )}
126
+ </>
127
+ )
128
+ })}
129
+ </div>
130
+ </CreditsProvider>
131
+ </RegistrationProvider>
132
+ </HeadlessProvider>
133
+ )
134
+ }
@@ -0,0 +1 @@
1
+ export * from './credits'
@@ -1 +0,0 @@
1
- export declare function useSendEmailValidation(): import("swr/mutation").SWRMutationResponse<any, any, "send-email-validation", never>;
@@ -1,2 +0,0 @@
1
- "use strict";var c=Object.create;var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var x=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},r=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of f(t))!v.call(e,a)&&a!==o&&i(e,a,{get:()=>t[a],enumerable:!(n=d(t,a))||n.enumerable});return e};var m=(e,t,o)=>(o=e!=null?c(h(e)):{},r(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),C=e=>r(i({},"__esModule",{value:!0}),e);var y={};x(y,{useSendEmailValidation:()=>S});module.exports=C(y);var s=m(require("../../../../helpers/fetcher")),l=m(require("swr/mutation")),p=require("../provider"),u=require("@anker-in/lib");function S(){const{profile:e}=(0,p.useCreditsContext)(),{appName:t,locale:o}=(0,u.useHeadlessContext)();return(0,l.default)("send-email-validation",()=>(0,s.default)({locale:o,url:"/api/multipass/account/users/send_validation_email",method:"POST",body:{email:e?.email,app:t},needRecaptcha:!0,action:"verifyAccount"}))}
2
- //# sourceMappingURL=useSendEmailValidation.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../src/components/credits/context/hooks/useSendEmailValidation.ts"],
4
- "sourcesContent": ["import fetcher from '../../../../helpers/fetcher'\nimport useSWRMutation from 'swr/mutation'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nexport function useSendEmailValidation() {\n const { profile } = useCreditsContext()\n const { appName, locale } = useHeadlessContext()\n\n return useSWRMutation('send-email-validation', () =>\n fetcher({\n locale,\n url: '/api/multipass/account/users/send_validation_email',\n method: 'POST',\n body: { email: profile?.email, app: appName },\n needRecaptcha: true,\n action: 'verifyAccount',\n })\n )\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoB,0CACpBC,EAA2B,2BAC3BC,EAAkC,uBAClCC,EAAmC,yBAE5B,SAASL,GAAyB,CACvC,KAAM,CAAE,QAAAM,CAAQ,KAAI,qBAAkB,EAChC,CAAE,QAAAC,EAAS,OAAAC,CAAO,KAAI,sBAAmB,EAE/C,SAAO,EAAAC,SAAe,wBAAyB,OAC7C,EAAAC,SAAQ,CACN,OAAAF,EACA,IAAK,qDACL,OAAQ,OACR,KAAM,CAAE,MAAOF,GAAS,MAAO,IAAKC,CAAQ,EAC5C,cAAe,GACf,OAAQ,eACV,CAAC,CACH,CACF",
6
- "names": ["useSendEmailValidation_exports", "__export", "useSendEmailValidation", "__toCommonJS", "import_fetcher", "import_mutation", "import_provider", "import_lib", "profile", "appName", "locale", "useSWRMutation", "fetcher"]
7
- }
@@ -1,9 +0,0 @@
1
- import { SWRResponse } from 'swr';
2
- import type { Subscription } from '../../type';
3
- export type SubscriptionApiResponse = {
4
- data: Subscription;
5
- };
6
- export type FetchSubscriptionResponse = SWRResponse<Subscription>;
7
- export declare function useSubscriptions({ email }: {
8
- email?: string;
9
- }): FetchSubscriptionResponse;
@@ -1,2 +0,0 @@
1
- "use strict";var b=Object.create;var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var y=(s,t)=>{for(var e in t)i(s,e,{get:t[e],enumerable:!0})},n=(s,t,e,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R(t))!l.call(s,o)&&o!==e&&i(s,o,{get:()=>t[o],enumerable:!(p=m(t,o))||p.enumerable});return s};var r=(s,t,e)=>(e=s!=null?b(d(s)):{},n(t||!s||!s.__esModule?i(e,"default",{value:s,enumerable:!0}):e,s)),f=s=>n(i({},"__esModule",{value:!0}),s);var x={};y(x,{useSubscriptions:()=>h});module.exports=f(x);var c=r(require("swr")),u=r(require("../../../../helpers/fetcher")),a=require("@anker-in/lib");function h({email:s}){const{locale:t}=(0,a.useHeadlessContext)(),{data:e,...p}=(0,c.default)(s?["/api/multipass/account/subscriptions",s]:null,async([o,S])=>(0,u.default)({method:"GET",url:o,body:{email:S},action:"login",locale:t,headers:{},type:""}));return{data:e?.data,...p}}
2
- //# sourceMappingURL=useSubscriptions.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../src/components/credits/context/hooks/useSubscriptions.ts"],
4
- "sourcesContent": ["import useSWR, { SWRResponse } from 'swr'\nimport type { Subscription } from '../../type'\nimport fetcher from '../../../../helpers/fetcher'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nexport type SubscriptionApiResponse = { data: Subscription }\nexport type FetchSubscriptionResponse = SWRResponse<Subscription>\n\nexport function useSubscriptions({ email }: { email?: string }): FetchSubscriptionResponse {\n const { locale } = useHeadlessContext()\n\n const { data, ...rest } = useSWR<SubscriptionApiResponse>(\n email ? ['/api/multipass/account/subscriptions', email] : null,\n async ([url, email]) =>\n fetcher({\n method: 'GET',\n url,\n body: {\n email,\n },\n action: 'login',\n locale,\n headers: {},\n type: '',\n })\n )\n\n return { data: data?.data, ...rest } as unknown as FetchSubscriptionResponse\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,kBAEpCC,EAAoB,0CACpBC,EAAmC,yBAK5B,SAASJ,EAAiB,CAAE,MAAAK,CAAM,EAAkD,CACzF,KAAM,CAAE,OAAAC,CAAO,KAAI,sBAAmB,EAEhC,CAAE,KAAAC,EAAM,GAAGC,CAAK,KAAI,EAAAC,SACxBJ,EAAQ,CAAC,uCAAwCA,CAAK,EAAI,KAC1D,MAAO,CAACK,EAAKL,CAAK,OAChB,EAAAM,SAAQ,CACN,OAAQ,MACR,IAAAD,EACA,KAAM,CACJ,MAAAL,CACF,EACA,OAAQ,QACR,OAAAC,EACA,QAAS,CAAC,EACV,KAAM,EACR,CAAC,CACL,EAEA,MAAO,CAAE,KAAMC,GAAM,KAAM,GAAGC,CAAK,CACrC",
6
- "names": ["useSubscriptions_exports", "__export", "useSubscriptions", "__toCommonJS", "import_swr", "import_fetcher", "import_lib", "email", "locale", "data", "rest", "useSWR", "url", "fetcher"]
7
- }
@@ -1,14 +0,0 @@
1
- export declare function getAsyncError(res: {
2
- json: () => any;
3
- status: any;
4
- statusText: any;
5
- }): Promise<{
6
- status: any;
7
- statusText: any;
8
- errors: any;
9
- type: any;
10
- data: any;
11
- message: any;
12
- } | undefined>;
13
- declare const handleFetchResponse: (res: Response) => Promise<any>;
14
- export default handleFetchResponse;
@@ -1,2 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(a,t)=>{for(var s in t)o(a,s,{get:t[s],enumerable:!0})},l=(a,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of c(t))!y.call(a,e)&&e!==s&&o(a,e,{get:()=>t[e],enumerable:!(n=u(t,e))||n.enumerable});return a};var g=a=>l(o({},"__esModule",{value:!0}),a);var x={};d(x,{default:()=>p,getAsyncError:()=>r});module.exports=g(x);async function r(a){try{const t=await a.json();return{status:a.status,statusText:a.statusText,errors:t?.data?.error||t?.data?.code||a.statusText||a.status,type:t?.data?.type,data:t?.data,message:t?.data?.message}}catch(t){console.log(t)}}const i=async a=>{if(a.ok)try{const t=await a.json(),{errors:s}=t;return s&&s.length?{errors:s,status:a.status}:t}catch(t){console.log(t)}return await r(a)};var p=i;
2
- //# sourceMappingURL=fetchResponse.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/fetchResponse.ts"],
4
- "sourcesContent": ["export async function getAsyncError(res: { json: () => any; status: any; statusText: any }) {\n try {\n const result = await res.json()\n return {\n status: res.status,\n statusText: res.statusText,\n errors: result?.data?.error || result?.data?.code || res.statusText || res.status,\n type: result?.data?.type,\n data: result?.data,\n message: result?.data?.message,\n }\n } catch (error) {\n console.log(error)\n }\n}\n\nconst handleFetchResponse = async (res: Response) => {\n if (res.ok) {\n try {\n const result = await res.json()\n const { errors } = result\n if (errors && errors.length) {\n return { errors, status: res.status }\n }\n\n return result\n } catch (error) {\n console.log(error)\n }\n }\n\n return await getAsyncError(res)\n}\n\nexport default handleFetchResponse\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,kBAAAC,IAAA,eAAAC,EAAAJ,GAAA,eAAsBG,EAAcE,EAAwD,CAC1F,GAAI,CACF,MAAMC,EAAS,MAAMD,EAAI,KAAK,EAC9B,MAAO,CACL,OAAQA,EAAI,OACZ,WAAYA,EAAI,WAChB,OAAQC,GAAQ,MAAM,OAASA,GAAQ,MAAM,MAAQD,EAAI,YAAcA,EAAI,OAC3E,KAAMC,GAAQ,MAAM,KACpB,KAAMA,GAAQ,KACd,QAASA,GAAQ,MAAM,OACzB,CACF,OAASC,EAAO,CACd,QAAQ,IAAIA,CAAK,CACnB,CACF,CAEA,MAAMC,EAAsB,MAAOH,GAAkB,CACnD,GAAIA,EAAI,GACN,GAAI,CACF,MAAMC,EAAS,MAAMD,EAAI,KAAK,EACxB,CAAE,OAAAI,CAAO,EAAIH,EACnB,OAAIG,GAAUA,EAAO,OACZ,CAAE,OAAAA,EAAQ,OAAQJ,EAAI,MAAO,EAG/BC,CACT,OAASC,EAAO,CACd,QAAQ,IAAIA,CAAK,CACnB,CAGF,OAAO,MAAMJ,EAAcE,CAAG,CAChC,EAEA,IAAOH,EAAQM",
6
- "names": ["fetchResponse_exports", "__export", "fetchResponse_default", "getAsyncError", "__toCommonJS", "res", "result", "error", "handleFetchResponse", "errors"]
7
- }
@@ -1,2 +0,0 @@
1
- declare const fetcher: ({ locale, url, method, headers, repeatKey, body, type, timeout, }: any) => Promise<any>;
2
- export default fetcher;
@@ -1,2 +0,0 @@
1
- "use strict";var g=Object.create;var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var O=(e,r)=>{for(var t in r)o(e,t,{get:r[t],enumerable:!0})},f=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of b(r))!A.call(e,n)&&n!==t&&o(e,n,{get:()=>r[n],enumerable:!(a=u(r,n))||a.enumerable});return e};var T=(e,r,t)=>(t=e!=null?g(h(e)):{},f(r||!e||!e.__esModule?o(t,"default",{value:e,enumerable:!0}):t,e)),j=e=>f(o({},"__esModule",{value:!0}),e);var S={};O(S,{default:()=>F});module.exports=j(S);var y=T(require("./fetchResponse"));const x=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),w=async({locale:e="en",url:r,method:t="POST",headers:a={},repeatKey:n,body:s,type:p,timeout:l=9e4})=>{let c="";p==="uploadFile"?c=s:c=s?JSON.stringify(s):"";const i=new AbortController;l&&setTimeout(()=>i.abort(),l);const d=await fetch(r,{method:t,mode:"cors",headers:{"current-language":e,...a},...l&&{signal:i.signal},...t!=="GET"&&{body:c}});return(0,y.default)(d)};var F=w;
2
- //# sourceMappingURL=fetcher.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/fetcher.ts"],
4
- "sourcesContent": ["import handleFetchResponse from './fetchResponse'\n\nconst isObject = (value: null) => {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\nconst fetcher = async ({\n locale = 'en',\n url,\n method = 'POST',\n headers = {},\n repeatKey,\n body,\n type,\n timeout = 90000,\n}: any) => {\n // \u6DFB\u52A0\u8C37\u6B4C\u9A8C\u8BC1\n let bodyData = ''\n if (type === 'uploadFile') {\n bodyData = body\n } else {\n bodyData = body ? JSON.stringify(body) : ''\n }\n\n const controller = new AbortController()\n if (timeout) {\n // \u8D85\u65F6\u62A5\u9519\n setTimeout(() => controller.abort(), timeout)\n }\n\n const data = await fetch(url, {\n method,\n mode: 'cors',\n headers: {\n 'current-language': locale,\n ...headers,\n },\n ...(timeout && { signal: controller.signal }),\n ...(method !== 'GET' && { body: bodyData }),\n })\n return handleFetchResponse(data)\n}\n\nexport default fetcher\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,8BAEhC,MAAMC,EAAYC,GACTA,IAAU,MAAQ,OAAOA,GAAU,UAAY,CAAC,MAAM,QAAQA,CAAK,EAGtEC,EAAU,MAAO,CACrB,OAAAC,EAAS,KACT,IAAAC,EACA,OAAAC,EAAS,OACT,QAAAC,EAAU,CAAC,EACX,UAAAC,EACA,KAAAC,EACA,KAAAC,EACA,QAAAC,EAAU,GACZ,IAAW,CAET,IAAIC,EAAW,GACXF,IAAS,aACXE,EAAWH,EAEXG,EAAWH,EAAO,KAAK,UAAUA,CAAI,EAAI,GAG3C,MAAMI,EAAa,IAAI,gBACnBF,GAEF,WAAW,IAAME,EAAW,MAAM,EAAGF,CAAO,EAG9C,MAAMG,EAAO,MAAM,MAAMT,EAAK,CAC5B,OAAAC,EACA,KAAM,OACN,QAAS,CACP,mBAAoBF,EACpB,GAAGG,CACL,EACA,GAAII,GAAW,CAAE,OAAQE,EAAW,MAAO,EAC3C,GAAIP,IAAW,OAAS,CAAE,KAAMM,CAAS,CAC3C,CAAC,EACD,SAAO,EAAAG,SAAoBD,CAAI,CACjC,EAEA,IAAOhB,EAAQK",
6
- "names": ["fetcher_exports", "__export", "fetcher_default", "__toCommonJS", "import_fetchResponse", "isObject", "value", "fetcher", "locale", "url", "method", "headers", "repeatKey", "body", "type", "timeout", "bodyData", "controller", "data", "handleFetchResponse"]
7
- }
@@ -1,2 +0,0 @@
1
- export { cn } from './utils';
2
- export { noop } from './utils';
@@ -1,2 +0,0 @@
1
- "use strict";var f=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o)=>{for(var e in o)f(r,e,{get:o[e],enumerable:!0})},d=(r,o,e,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of c(o))!a.call(r,p)&&p!==e&&f(r,p,{get:()=>o[p],enumerable:!(m=x(o,p))||m.enumerable});return r};var g=r=>d(f({},"__esModule",{value:!0}),r);var h={};b(h,{cn:()=>n.cn,noop:()=>t.noop});module.exports=g(h);var n=require("./utils"),t=require("./utils");
2
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/index.ts"],
4
- "sourcesContent": ["export { cn } from './utils'\nexport { noop } from './utils'\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8CAAAE,EAAAF,GAAA,IAAAG,EAAmB,mBACnBA,EAAqB",
6
- "names": ["helpers_exports", "__export", "__toCommonJS", "import_utils"]
7
- }
@@ -1,19 +0,0 @@
1
- declare global {
2
- interface Window {
3
- dataLayer?: Array<any>;
4
- fbq?: (...args: any[]) => void;
5
- klaviyo?: any;
6
- gtag?: any;
7
- }
8
- }
9
- export declare const gaTrack: (data: any) => "" | undefined;
10
- export declare function gaNormalClick({ position, label }: {
11
- position: string;
12
- label: string;
13
- }): void;
14
- export declare const fbq: (...args: any[]) => "" | undefined;
15
- export declare const gtag: (...args: any[]) => "" | undefined;
16
- export declare const getGtmGroup: ({ query, asPath }: {
17
- query: any;
18
- asPath: string;
19
- }) => any;
@@ -1,2 +0,0 @@
1
- "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var p=(e,n)=>{for(var t in n)a(e,t,{get:n[t],enumerable:!0})},s=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of g(n))!w.call(e,r)&&r!==t&&a(e,r,{get:()=>n[r],enumerable:!(o=d(n,r))||o.enumerable});return e};var u=e=>s(a({},"__esModule",{value:!0}),e);var m={};p(m,{fbq:()=>f,gaNormalClick:()=>c,gaTrack:()=>i,getGtmGroup:()=>y,gtag:()=>l});module.exports=u(m);const i=e=>{if(typeof window>"u"||(window.dataLayer=window?.dataLayer||[],!Array.isArray(window.dataLayer)))return"";try{window?.dataLayer?.push({event_parameters:null}),window?.dataLayer?.push(e||{})}catch(n){console.log("pageGTMEvent error",n)}};function c({position:e,label:n}){i({event:"ga4Event",event_name:"lp_button",event_parameters:{page_group:"soundcoreCredits Rewards Program",position:e,button_name:n}})}const f=(...e)=>{if(typeof window>"u")return"";window.fbq&&window.fbq(...e)},l=(...e)=>{if(typeof window>"u")return"";window.gtag&&window.gtag(...e)},y=({query:e,asPath:n})=>n.includes("collections")?`Product List Page_${e?.handle}`:n.includes("products")?"Product Detail Page_"+e?.handle:n==="/"||n==="/app-home"?"Home Page":"Activity Page_"+e?.handle||e?.paths?.[0]?.replace("storefront-","");
2
- //# sourceMappingURL=track.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/track.ts"],
4
- "sourcesContent": ["declare global {\n interface Window {\n dataLayer?: Array<any>\n fbq?: (...args: any[]) => void\n klaviyo?: any\n gtag?: any\n }\n}\n\n// GA \u57CB\u70B9\nexport const gaTrack = (data: any) => {\n if (typeof window === 'undefined') {\n return ''\n }\n window.dataLayer = window?.dataLayer || []\n if (!Array.isArray(window.dataLayer)) {\n return ''\n }\n\n try {\n window?.dataLayer?.push({ event_parameters: null })\n window?.dataLayer?.push(data || {})\n } catch (error) {\n console.log('pageGTMEvent error', error)\n }\n}\n\nexport function gaNormalClick({ position, label }: { position: string; label: string }) {\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n event_parameters: {\n page_group: 'soundcoreCredits Rewards Program',\n position: position,\n button_name: label,\n },\n })\n}\n\n// facebook \u57CB\u70B9\nexport const fbq = (...args: any[]) => {\n if (typeof window === 'undefined') {\n return ''\n }\n if (window.fbq) {\n window.fbq(...args)\n }\n}\n\nexport const gtag = (...args: any[]) => {\n if (typeof window === 'undefined') {\n return ''\n }\n if (window.gtag) {\n window.gtag(...args)\n }\n}\n\nexport const getGtmGroup = ({ query, asPath }: { query: any; asPath: string }) => {\n if (asPath.includes('collections')) {\n return `Product List Page_${query?.handle}`\n }\n\n if (asPath.includes('products')) {\n return 'Product Detail Page_' + query?.handle\n }\n\n if (asPath === '/' || asPath === '/app-home') {\n return 'Home Page'\n }\n\n return 'Activity Page_' + query?.handle || query?.paths?.[0]?.replace('storefront-', '')\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,SAAAE,EAAA,kBAAAC,EAAA,YAAAC,EAAA,gBAAAC,EAAA,SAAAC,IAAA,eAAAC,EAAAP,GAUO,MAAMI,EAAWI,GAAc,CAKpC,GAJI,OAAO,OAAW,MAGtB,OAAO,UAAY,QAAQ,WAAa,CAAC,EACrC,CAAC,MAAM,QAAQ,OAAO,SAAS,GACjC,MAAO,GAGT,GAAI,CACF,QAAQ,WAAW,KAAK,CAAE,iBAAkB,IAAK,CAAC,EAClD,QAAQ,WAAW,KAAKA,GAAQ,CAAC,CAAC,CACpC,OAASC,EAAO,CACd,QAAQ,IAAI,qBAAsBA,CAAK,CACzC,CACF,EAEO,SAASN,EAAc,CAAE,SAAAO,EAAU,MAAAC,CAAM,EAAwC,CACtFP,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,iBAAkB,CAChB,WAAY,mCACZ,SAAUM,EACV,YAAaC,CACf,CACF,CAAC,CACH,CAGO,MAAMT,EAAM,IAAIU,IAAgB,CACrC,GAAI,OAAO,OAAW,IACpB,MAAO,GAEL,OAAO,KACT,OAAO,IAAI,GAAGA,CAAI,CAEtB,EAEaN,EAAO,IAAIM,IAAgB,CACtC,GAAI,OAAO,OAAW,IACpB,MAAO,GAEL,OAAO,MACT,OAAO,KAAK,GAAGA,CAAI,CAEvB,EAEaP,EAAc,CAAC,CAAE,MAAAQ,EAAO,OAAAC,CAAO,IACtCA,EAAO,SAAS,aAAa,EACxB,qBAAqBD,GAAO,MAAM,GAGvCC,EAAO,SAAS,UAAU,EACrB,uBAAyBD,GAAO,OAGrCC,IAAW,KAAOA,IAAW,YACxB,YAGF,iBAAmBD,GAAO,QAAUA,GAAO,QAAQ,CAAC,GAAG,QAAQ,cAAe,EAAE",
6
- "names": ["track_exports", "__export", "fbq", "gaNormalClick", "gaTrack", "getGtmGroup", "gtag", "__toCommonJS", "data", "error", "position", "label", "args", "query", "asPath"]
7
- }
@@ -1,3 +0,0 @@
1
- import { type ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
3
- export declare function noop(): any;
@@ -1,2 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(o,r)=>{for(var e in r)n(o,e,{get:r[e],enumerable:!0})},i=(o,r,e,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of u(r))!c.call(o,t)&&t!==e&&n(o,t,{get:()=>r[t],enumerable:!(p=s(r,t))||p.enumerable});return o};var m=o=>i(n({},"__esModule",{value:!0}),o);var C={};f(C,{cn:()=>x,noop:()=>y});module.exports=m(C);var a=require("clsx"),l=require("tailwind-merge");function x(...o){return(0,l.twMerge)((0,a.clsx)(o))}function y(){}
2
- //# sourceMappingURL=utils.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/utils.ts"],
4
- "sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,QAAAE,EAAA,SAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAsC,gBACtCC,EAAwB,0BAEjB,SAASJ,KAAMK,EAAsB,CAC1C,SAAO,cAAQ,QAAKA,CAAM,CAAC,CAC7B,CAEO,SAASJ,GAAY,CAAC",
6
- "names": ["utils_exports", "__export", "cn", "noop", "__toCommonJS", "import_clsx", "import_tailwind_merge", "inputs"]
7
- }
@@ -1 +0,0 @@
1
- export declare function useSendEmailValidation(): import("swr/mutation").SWRMutationResponse<any, any, "send-email-validation", never>;
@@ -1,2 +0,0 @@
1
- import a from"../../../../helpers/fetcher";import i from"swr/mutation";import{useCreditsContext as n}from"../provider";import{useHeadlessContext as r}from"@anker-in/lib";function u(){const{profile:e}=n(),{appName:t,locale:o}=r();return i("send-email-validation",()=>a({locale:o,url:"/api/multipass/account/users/send_validation_email",method:"POST",body:{email:e?.email,app:t},needRecaptcha:!0,action:"verifyAccount"}))}export{u as useSendEmailValidation};
2
- //# sourceMappingURL=useSendEmailValidation.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../src/components/credits/context/hooks/useSendEmailValidation.ts"],
4
- "sourcesContent": ["import fetcher from '../../../../helpers/fetcher'\nimport useSWRMutation from 'swr/mutation'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nexport function useSendEmailValidation() {\n const { profile } = useCreditsContext()\n const { appName, locale } = useHeadlessContext()\n\n return useSWRMutation('send-email-validation', () =>\n fetcher({\n locale,\n url: '/api/multipass/account/users/send_validation_email',\n method: 'POST',\n body: { email: profile?.email, app: appName },\n needRecaptcha: true,\n action: 'verifyAccount',\n })\n )\n}\n"],
5
- "mappings": "AAAA,OAAOA,MAAa,8BACpB,OAAOC,MAAoB,eAC3B,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAE5B,SAASC,GAAyB,CACvC,KAAM,CAAE,QAAAC,CAAQ,EAAIH,EAAkB,EAChC,CAAE,QAAAI,EAAS,OAAAC,CAAO,EAAIJ,EAAmB,EAE/C,OAAOF,EAAe,wBAAyB,IAC7CD,EAAQ,CACN,OAAAO,EACA,IAAK,qDACL,OAAQ,OACR,KAAM,CAAE,MAAOF,GAAS,MAAO,IAAKC,CAAQ,EAC5C,cAAe,GACf,OAAQ,eACV,CAAC,CACH,CACF",
6
- "names": ["fetcher", "useSWRMutation", "useCreditsContext", "useHeadlessContext", "useSendEmailValidation", "profile", "appName", "locale"]
7
- }
@@ -1,9 +0,0 @@
1
- import { SWRResponse } from 'swr';
2
- import type { Subscription } from '../../type';
3
- export type SubscriptionApiResponse = {
4
- data: Subscription;
5
- };
6
- export type FetchSubscriptionResponse = SWRResponse<Subscription>;
7
- export declare function useSubscriptions({ email }: {
8
- email?: string;
9
- }): FetchSubscriptionResponse;
@@ -1,2 +0,0 @@
1
- import n from"swr";import r from"../../../../helpers/fetcher";import{useHeadlessContext as c}from"@anker-in/lib";function m({email:s}){const{locale:t}=c(),{data:e,...o}=n(s?["/api/multipass/account/subscriptions",s]:null,async([p,i])=>r({method:"GET",url:p,body:{email:i},action:"login",locale:t,headers:{},type:""}));return{data:e?.data,...o}}export{m as useSubscriptions};
2
- //# sourceMappingURL=useSubscriptions.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../src/components/credits/context/hooks/useSubscriptions.ts"],
4
- "sourcesContent": ["import useSWR, { SWRResponse } from 'swr'\nimport type { Subscription } from '../../type'\nimport fetcher from '../../../../helpers/fetcher'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nexport type SubscriptionApiResponse = { data: Subscription }\nexport type FetchSubscriptionResponse = SWRResponse<Subscription>\n\nexport function useSubscriptions({ email }: { email?: string }): FetchSubscriptionResponse {\n const { locale } = useHeadlessContext()\n\n const { data, ...rest } = useSWR<SubscriptionApiResponse>(\n email ? ['/api/multipass/account/subscriptions', email] : null,\n async ([url, email]) =>\n fetcher({\n method: 'GET',\n url,\n body: {\n email,\n },\n action: 'login',\n locale,\n headers: {},\n type: '',\n })\n )\n\n return { data: data?.data, ...rest } as unknown as FetchSubscriptionResponse\n}\n"],
5
- "mappings": "AAAA,OAAOA,MAA6B,MAEpC,OAAOC,MAAa,8BACpB,OAAS,sBAAAC,MAA0B,gBAK5B,SAASC,EAAiB,CAAE,MAAAC,CAAM,EAAkD,CACzF,KAAM,CAAE,OAAAC,CAAO,EAAIH,EAAmB,EAEhC,CAAE,KAAAI,EAAM,GAAGC,CAAK,EAAIP,EACxBI,EAAQ,CAAC,uCAAwCA,CAAK,EAAI,KAC1D,MAAO,CAACI,EAAKJ,CAAK,IAChBH,EAAQ,CACN,OAAQ,MACR,IAAAO,EACA,KAAM,CACJ,MAAAJ,CACF,EACA,OAAQ,QACR,OAAAC,EACA,QAAS,CAAC,EACV,KAAM,EACR,CAAC,CACL,EAEA,MAAO,CAAE,KAAMC,GAAM,KAAM,GAAGC,CAAK,CACrC",
6
- "names": ["useSWR", "fetcher", "useHeadlessContext", "useSubscriptions", "email", "locale", "data", "rest", "url"]
7
- }
@@ -1,14 +0,0 @@
1
- export declare function getAsyncError(res: {
2
- json: () => any;
3
- status: any;
4
- statusText: any;
5
- }): Promise<{
6
- status: any;
7
- statusText: any;
8
- errors: any;
9
- type: any;
10
- data: any;
11
- message: any;
12
- } | undefined>;
13
- declare const handleFetchResponse: (res: Response) => Promise<any>;
14
- export default handleFetchResponse;
@@ -1,2 +0,0 @@
1
- async function e(a){try{const t=await a.json();return{status:a.status,statusText:a.statusText,errors:t?.data?.error||t?.data?.code||a.statusText||a.status,type:t?.data?.type,data:t?.data,message:t?.data?.message}}catch(t){console.log(t)}}const o=async a=>{if(a.ok)try{const t=await a.json(),{errors:s}=t;return s&&s.length?{errors:s,status:a.status}:t}catch(t){console.log(t)}return await e(a)};var n=o;export{n as default,e as getAsyncError};
2
- //# sourceMappingURL=fetchResponse.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/helpers/fetchResponse.ts"],
4
- "sourcesContent": ["export async function getAsyncError(res: { json: () => any; status: any; statusText: any }) {\n try {\n const result = await res.json()\n return {\n status: res.status,\n statusText: res.statusText,\n errors: result?.data?.error || result?.data?.code || res.statusText || res.status,\n type: result?.data?.type,\n data: result?.data,\n message: result?.data?.message,\n }\n } catch (error) {\n console.log(error)\n }\n}\n\nconst handleFetchResponse = async (res: Response) => {\n if (res.ok) {\n try {\n const result = await res.json()\n const { errors } = result\n if (errors && errors.length) {\n return { errors, status: res.status }\n }\n\n return result\n } catch (error) {\n console.log(error)\n }\n }\n\n return await getAsyncError(res)\n}\n\nexport default handleFetchResponse\n"],
5
- "mappings": "AAAA,eAAsBA,EAAcC,EAAwD,CAC1F,GAAI,CACF,MAAMC,EAAS,MAAMD,EAAI,KAAK,EAC9B,MAAO,CACL,OAAQA,EAAI,OACZ,WAAYA,EAAI,WAChB,OAAQC,GAAQ,MAAM,OAASA,GAAQ,MAAM,MAAQD,EAAI,YAAcA,EAAI,OAC3E,KAAMC,GAAQ,MAAM,KACpB,KAAMA,GAAQ,KACd,QAASA,GAAQ,MAAM,OACzB,CACF,OAASC,EAAO,CACd,QAAQ,IAAIA,CAAK,CACnB,CACF,CAEA,MAAMC,EAAsB,MAAOH,GAAkB,CACnD,GAAIA,EAAI,GACN,GAAI,CACF,MAAMC,EAAS,MAAMD,EAAI,KAAK,EACxB,CAAE,OAAAI,CAAO,EAAIH,EACnB,OAAIG,GAAUA,EAAO,OACZ,CAAE,OAAAA,EAAQ,OAAQJ,EAAI,MAAO,EAG/BC,CACT,OAASC,EAAO,CACd,QAAQ,IAAIA,CAAK,CACnB,CAGF,OAAO,MAAMH,EAAcC,CAAG,CAChC,EAEA,IAAOK,EAAQF",
6
- "names": ["getAsyncError", "res", "result", "error", "handleFetchResponse", "errors", "fetchResponse_default"]
7
- }
@@ -1,2 +0,0 @@
1
- declare const fetcher: ({ locale, url, method, headers, repeatKey, body, type, timeout, }: any) => Promise<any>;
2
- export default fetcher;
@@ -1,2 +0,0 @@
1
- import f from"./fetchResponse";const g=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),y=async({locale:e="en",url:s,method:a="POST",headers:l={},repeatKey:p,body:r,type:c,timeout:t=9e4})=>{let n="";c==="uploadFile"?n=r:n=r?JSON.stringify(r):"";const o=new AbortController;t&&setTimeout(()=>o.abort(),t);const i=await fetch(s,{method:a,mode:"cors",headers:{"current-language":e,...l},...t&&{signal:o.signal},...a!=="GET"&&{body:n}});return f(i)};var u=y;export{u as default};
2
- //# sourceMappingURL=fetcher.js.map