be-components 0.7.3 → 0.7.5

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 (450) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +18 -0
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -1
  3. package/lib/commonjs/Authenticator/Components/AuthStrategyIdentifier.js +113 -0
  4. package/lib/commonjs/Authenticator/Components/AuthStrategyIdentifier.js.map +1 -0
  5. package/lib/commonjs/Authenticator/Components/StrategyForm.js +238 -71
  6. package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -1
  7. package/lib/commonjs/Authenticator/index.js +7 -4
  8. package/lib/commonjs/Authenticator/index.js.map +1 -1
  9. package/lib/commonjs/Checkout/api/index.js.map +1 -1
  10. package/lib/commonjs/Checkout/index.js.map +1 -1
  11. package/lib/commonjs/Competition/api/index.js +655 -0
  12. package/lib/commonjs/Competition/api/index.js.map +1 -0
  13. package/lib/commonjs/Competition/components/AthleteMarketCard.js +168 -0
  14. package/lib/commonjs/Competition/components/AthleteMarketCard.js.map +1 -0
  15. package/lib/commonjs/Competition/components/CompetitionCard.js +180 -0
  16. package/lib/commonjs/Competition/components/CompetitionCard.js.map +1 -0
  17. package/lib/commonjs/Competition/components/CompetitionInfoCard.js +264 -0
  18. package/lib/commonjs/Competition/components/CompetitionInfoCard.js.map +1 -0
  19. package/lib/commonjs/Competition/components/CompetitionLeaderboard.js +281 -0
  20. package/lib/commonjs/Competition/components/CompetitionLeaderboard.js.map +1 -0
  21. package/lib/commonjs/Competition/components/CompetitionPlay.js +1269 -0
  22. package/lib/commonjs/Competition/components/CompetitionPlay.js.map +1 -0
  23. package/lib/commonjs/Competition/components/CompetitionSeasonCard.js +111 -0
  24. package/lib/commonjs/Competition/components/CompetitionSeasonCard.js.map +1 -0
  25. package/lib/commonjs/Competition/components/CompetitionSelector.js +122 -0
  26. package/lib/commonjs/Competition/components/CompetitionSelector.js.map +1 -0
  27. package/lib/commonjs/Competition/components/CompetitionTypeCard.js +380 -0
  28. package/lib/commonjs/Competition/components/CompetitionTypeCard.js.map +1 -0
  29. package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js +237 -0
  30. package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js.map +1 -0
  31. package/lib/commonjs/Competition/components/LeaderPicks.js +322 -0
  32. package/lib/commonjs/Competition/components/LeaderPicks.js.map +1 -0
  33. package/lib/commonjs/Competition/components/ManageSeasonForm.js +605 -0
  34. package/lib/commonjs/Competition/components/ManageSeasonForm.js.map +1 -0
  35. package/lib/commonjs/Competition/components/MarketsCard.js +148 -0
  36. package/lib/commonjs/Competition/components/MarketsCard.js.map +1 -0
  37. package/lib/commonjs/Competition/components/MatchMarketCard.js +199 -0
  38. package/lib/commonjs/Competition/components/MatchMarketCard.js.map +1 -0
  39. package/lib/commonjs/Competition/components/NavOutPrompt.js +159 -0
  40. package/lib/commonjs/Competition/components/NavOutPrompt.js.map +1 -0
  41. package/lib/commonjs/Competition/components/SeasonInfoModal.js +400 -0
  42. package/lib/commonjs/Competition/components/SeasonInfoModal.js.map +1 -0
  43. package/lib/commonjs/Competition/components/TeamEventCard.js +217 -0
  44. package/lib/commonjs/Competition/components/TeamEventCard.js.map +1 -0
  45. package/lib/commonjs/Competition/components/WagerPickForm.js +278 -0
  46. package/lib/commonjs/Competition/components/WagerPickForm.js.map +1 -0
  47. package/lib/commonjs/Competition/index.js +42 -0
  48. package/lib/commonjs/Competition/index.js.map +1 -0
  49. package/lib/commonjs/Components/Icons.js.map +1 -1
  50. package/lib/commonjs/Components/Jerseys.js +713 -0
  51. package/lib/commonjs/Components/Jerseys.js.map +1 -0
  52. package/lib/commonjs/Components/LinearDiagnal.js +1 -1
  53. package/lib/commonjs/Components/LinearDiagnal.js.map +1 -1
  54. package/lib/commonjs/Components/Switch.js +81 -0
  55. package/lib/commonjs/Components/Switch.js.map +1 -0
  56. package/lib/commonjs/Components/index.js +14 -0
  57. package/lib/commonjs/Components/index.js.map +1 -1
  58. package/lib/commonjs/Poll/api/index.js +277 -0
  59. package/lib/commonjs/Poll/api/index.js.map +1 -0
  60. package/lib/commonjs/Poll/components/CampaignPlay.js +553 -0
  61. package/lib/commonjs/Poll/components/CampaignPlay.js.map +1 -0
  62. package/lib/commonjs/Poll/components/CampaignProgressBar.js +118 -0
  63. package/lib/commonjs/Poll/components/CampaignProgressBar.js.map +1 -0
  64. package/lib/commonjs/Poll/components/CampaignResult.js +382 -0
  65. package/lib/commonjs/Poll/components/CampaignResult.js.map +1 -0
  66. package/lib/commonjs/Poll/components/CampaignSelector.js +124 -0
  67. package/lib/commonjs/Poll/components/CampaignSelector.js.map +1 -0
  68. package/lib/commonjs/Poll/components/PollCampaignCard.js +66 -0
  69. package/lib/commonjs/Poll/components/PollCampaignCard.js.map +1 -0
  70. package/lib/commonjs/Poll/components/PollCard.js +480 -0
  71. package/lib/commonjs/Poll/components/PollCard.js.map +1 -0
  72. package/lib/commonjs/Poll/components/PollOptionCard.js +158 -0
  73. package/lib/commonjs/Poll/components/PollOptionCard.js.map +1 -0
  74. package/lib/commonjs/Poll/components/PollSelectCard.js +189 -0
  75. package/lib/commonjs/Poll/components/PollSelectCard.js.map +1 -0
  76. package/lib/commonjs/Poll/components/ResponseTimer.js +48 -0
  77. package/lib/commonjs/Poll/components/ResponseTimer.js.map +1 -0
  78. package/lib/commonjs/Poll/components/WidgetHeader.js +83 -0
  79. package/lib/commonjs/Poll/components/WidgetHeader.js.map +1 -0
  80. package/lib/commonjs/Poll/flashmarket/index.js +354 -0
  81. package/lib/commonjs/Poll/flashmarket/index.js.map +1 -0
  82. package/lib/commonjs/Poll/index.js +46 -0
  83. package/lib/commonjs/Poll/index.js.map +1 -0
  84. package/lib/commonjs/ProfileManager/Components/BasicInfoManager.js.map +1 -1
  85. package/lib/commonjs/ProfileManager/Components/BasicStatus.js.map +1 -1
  86. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js +3 -1
  87. package/lib/commonjs/ProfileManager/Components/CodeRedeem.js.map +1 -1
  88. package/lib/commonjs/ProfileManager/Components/DOBManager.js.map +1 -1
  89. package/lib/commonjs/ProfileManager/Components/EmailManager.js.map +1 -1
  90. package/lib/commonjs/ProfileManager/Components/PasswordManager.js.map +1 -1
  91. package/lib/commonjs/ProfileManager/Components/PhoneManager.js.map +1 -1
  92. package/lib/commonjs/ProfileManager/Components/ProfilePicManager.js.map +1 -1
  93. package/lib/commonjs/ProfileManager/Components/ProfileWelcome.js.map +1 -1
  94. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +5 -0
  95. package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -1
  96. package/lib/commonjs/ProfileManager/Components/VouchCard.js.map +1 -1
  97. package/lib/commonjs/ProfileManager/index.js +2 -0
  98. package/lib/commonjs/ProfileManager/index.js.map +1 -1
  99. package/lib/commonjs/Wallet/api/index.js +4 -1
  100. package/lib/commonjs/Wallet/api/index.js.map +1 -1
  101. package/lib/commonjs/Wallet/components/ACHAddCard.js.map +1 -1
  102. package/lib/commonjs/Wallet/components/AddressManager.js.map +1 -1
  103. package/lib/commonjs/Wallet/components/DepositCard.js.map +1 -1
  104. package/lib/commonjs/Wallet/components/FundAccountCard.js.map +1 -1
  105. package/lib/commonjs/Wallet/components/ManageAccountCard.js.map +1 -1
  106. package/lib/commonjs/Wallet/components/ManualACHAdd.js.map +1 -1
  107. package/lib/commonjs/Wallet/components/ManualCardAdd.js.map +1 -1
  108. package/lib/commonjs/Wallet/components/MyBalance.js.map +1 -1
  109. package/lib/commonjs/Wallet/components/WalletActionSelector.js.map +1 -1
  110. package/lib/commonjs/Wallet/components/WalletSettings.js.map +1 -1
  111. package/lib/commonjs/Wallet/components/WalletSetup.js.map +1 -1
  112. package/lib/commonjs/Wallet/components/WithdrawCard.js.map +1 -1
  113. package/lib/commonjs/Wallet/index.js.map +1 -1
  114. package/lib/commonjs/index.js +14 -0
  115. package/lib/commonjs/index.js.map +1 -1
  116. package/lib/module/ApiOverrides/index.js +18 -0
  117. package/lib/module/ApiOverrides/index.js.map +1 -1
  118. package/lib/module/Authenticator/Components/AuthStrategyIdentifier.js +106 -0
  119. package/lib/module/Authenticator/Components/AuthStrategyIdentifier.js.map +1 -0
  120. package/lib/module/Authenticator/Components/StrategyForm.js +239 -72
  121. package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -1
  122. package/lib/module/Authenticator/index.js +7 -4
  123. package/lib/module/Authenticator/index.js.map +1 -1
  124. package/lib/module/Checkout/api/index.js.map +1 -1
  125. package/lib/module/Checkout/index.js.map +1 -1
  126. package/lib/module/Competition/api/index.js +649 -0
  127. package/lib/module/Competition/api/index.js.map +1 -0
  128. package/lib/module/Competition/components/AthleteMarketCard.js +161 -0
  129. package/lib/module/Competition/components/AthleteMarketCard.js.map +1 -0
  130. package/lib/module/Competition/components/CompetitionCard.js +173 -0
  131. package/lib/module/Competition/components/CompetitionCard.js.map +1 -0
  132. package/lib/module/Competition/components/CompetitionInfoCard.js +257 -0
  133. package/lib/module/Competition/components/CompetitionInfoCard.js.map +1 -0
  134. package/lib/module/Competition/components/CompetitionLeaderboard.js +272 -0
  135. package/lib/module/Competition/components/CompetitionLeaderboard.js.map +1 -0
  136. package/lib/module/Competition/components/CompetitionPlay.js +1260 -0
  137. package/lib/module/Competition/components/CompetitionPlay.js.map +1 -0
  138. package/lib/module/Competition/components/CompetitionSeasonCard.js +104 -0
  139. package/lib/module/Competition/components/CompetitionSeasonCard.js.map +1 -0
  140. package/lib/module/Competition/components/CompetitionSelector.js +113 -0
  141. package/lib/module/Competition/components/CompetitionSelector.js.map +1 -0
  142. package/lib/module/Competition/components/CompetitionTypeCard.js +371 -0
  143. package/lib/module/Competition/components/CompetitionTypeCard.js.map +1 -0
  144. package/lib/module/Competition/components/EnterCompetitionPrompt.js +228 -0
  145. package/lib/module/Competition/components/EnterCompetitionPrompt.js.map +1 -0
  146. package/lib/module/Competition/components/LeaderPicks.js +313 -0
  147. package/lib/module/Competition/components/LeaderPicks.js.map +1 -0
  148. package/lib/module/Competition/components/ManageSeasonForm.js +596 -0
  149. package/lib/module/Competition/components/ManageSeasonForm.js.map +1 -0
  150. package/lib/module/Competition/components/MarketsCard.js +139 -0
  151. package/lib/module/Competition/components/MarketsCard.js.map +1 -0
  152. package/lib/module/Competition/components/MatchMarketCard.js +192 -0
  153. package/lib/module/Competition/components/MatchMarketCard.js.map +1 -0
  154. package/lib/module/Competition/components/NavOutPrompt.js +152 -0
  155. package/lib/module/Competition/components/NavOutPrompt.js.map +1 -0
  156. package/lib/module/Competition/components/SeasonInfoModal.js +391 -0
  157. package/lib/module/Competition/components/SeasonInfoModal.js.map +1 -0
  158. package/lib/module/Competition/components/TeamEventCard.js +210 -0
  159. package/lib/module/Competition/components/TeamEventCard.js.map +1 -0
  160. package/lib/module/Competition/components/WagerPickForm.js +269 -0
  161. package/lib/module/Competition/components/WagerPickForm.js.map +1 -0
  162. package/lib/module/Competition/index.js +33 -0
  163. package/lib/module/Competition/index.js.map +1 -0
  164. package/lib/module/Components/Icons.js.map +1 -1
  165. package/lib/module/Components/Jerseys.js +705 -0
  166. package/lib/module/Components/Jerseys.js.map +1 -0
  167. package/lib/module/Components/LinearDiagnal.js +2 -3
  168. package/lib/module/Components/LinearDiagnal.js.map +1 -1
  169. package/lib/module/Components/Switch.js +74 -0
  170. package/lib/module/Components/Switch.js.map +1 -0
  171. package/lib/module/Components/index.js +3 -1
  172. package/lib/module/Components/index.js.map +1 -1
  173. package/lib/module/Poll/api/index.js +271 -0
  174. package/lib/module/Poll/api/index.js.map +1 -0
  175. package/lib/module/Poll/components/CampaignPlay.js +545 -0
  176. package/lib/module/Poll/components/CampaignPlay.js.map +1 -0
  177. package/lib/module/Poll/components/CampaignProgressBar.js +110 -0
  178. package/lib/module/Poll/components/CampaignProgressBar.js.map +1 -0
  179. package/lib/module/Poll/components/CampaignResult.js +374 -0
  180. package/lib/module/Poll/components/CampaignResult.js.map +1 -0
  181. package/lib/module/Poll/components/CampaignSelector.js +115 -0
  182. package/lib/module/Poll/components/CampaignSelector.js.map +1 -0
  183. package/lib/module/Poll/components/PollCampaignCard.js +59 -0
  184. package/lib/module/Poll/components/PollCampaignCard.js.map +1 -0
  185. package/lib/module/Poll/components/PollCard.js +472 -0
  186. package/lib/module/Poll/components/PollCard.js.map +1 -0
  187. package/lib/module/Poll/components/PollOptionCard.js +149 -0
  188. package/lib/module/Poll/components/PollOptionCard.js.map +1 -0
  189. package/lib/module/Poll/components/PollSelectCard.js +182 -0
  190. package/lib/module/Poll/components/PollSelectCard.js.map +1 -0
  191. package/lib/module/Poll/components/ResponseTimer.js +39 -0
  192. package/lib/module/Poll/components/ResponseTimer.js.map +1 -0
  193. package/lib/module/Poll/components/WidgetHeader.js +76 -0
  194. package/lib/module/Poll/components/WidgetHeader.js.map +1 -0
  195. package/lib/module/Poll/flashmarket/index.js +345 -0
  196. package/lib/module/Poll/flashmarket/index.js.map +1 -0
  197. package/lib/module/Poll/index.js +37 -0
  198. package/lib/module/Poll/index.js.map +1 -0
  199. package/lib/module/ProfileManager/Components/BasicInfoManager.js.map +1 -1
  200. package/lib/module/ProfileManager/Components/BasicStatus.js.map +1 -1
  201. package/lib/module/ProfileManager/Components/CodeRedeem.js +3 -1
  202. package/lib/module/ProfileManager/Components/CodeRedeem.js.map +1 -1
  203. package/lib/module/ProfileManager/Components/DOBManager.js.map +1 -1
  204. package/lib/module/ProfileManager/Components/EmailManager.js.map +1 -1
  205. package/lib/module/ProfileManager/Components/PasswordManager.js.map +1 -1
  206. package/lib/module/ProfileManager/Components/PhoneManager.js.map +1 -1
  207. package/lib/module/ProfileManager/Components/ProfilePicManager.js.map +1 -1
  208. package/lib/module/ProfileManager/Components/ProfileWelcome.js.map +1 -1
  209. package/lib/module/ProfileManager/Components/ProfileWizard.js +5 -0
  210. package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -1
  211. package/lib/module/ProfileManager/Components/VouchCard.js.map +1 -1
  212. package/lib/module/ProfileManager/index.js +2 -0
  213. package/lib/module/ProfileManager/index.js.map +1 -1
  214. package/lib/module/Wallet/api/index.js +4 -1
  215. package/lib/module/Wallet/api/index.js.map +1 -1
  216. package/lib/module/Wallet/components/ACHAddCard.js.map +1 -1
  217. package/lib/module/Wallet/components/AddressManager.js.map +1 -1
  218. package/lib/module/Wallet/components/DepositCard.js.map +1 -1
  219. package/lib/module/Wallet/components/FundAccountCard.js.map +1 -1
  220. package/lib/module/Wallet/components/ManageAccountCard.js.map +1 -1
  221. package/lib/module/Wallet/components/ManualACHAdd.js.map +1 -1
  222. package/lib/module/Wallet/components/ManualCardAdd.js.map +1 -1
  223. package/lib/module/Wallet/components/MyBalance.js.map +1 -1
  224. package/lib/module/Wallet/components/WalletActionSelector.js.map +1 -1
  225. package/lib/module/Wallet/components/WalletSettings.js.map +1 -1
  226. package/lib/module/Wallet/components/WalletSetup.js.map +1 -1
  227. package/lib/module/Wallet/components/WithdrawCard.js.map +1 -1
  228. package/lib/module/Wallet/index.js.map +1 -1
  229. package/lib/module/index.js +3 -1
  230. package/lib/module/index.js.map +1 -1
  231. package/lib/typescript/src/ApiOverrides/index.d.ts +1 -0
  232. package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
  233. package/lib/typescript/src/Authenticator/Components/AuthStrategyIdentifier.d.ts +11 -0
  234. package/lib/typescript/src/Authenticator/Components/AuthStrategyIdentifier.d.ts.map +1 -0
  235. package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts +4 -1
  236. package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  237. package/lib/typescript/src/Authenticator/api/index.d.ts +2 -2
  238. package/lib/typescript/src/Authenticator/api/index.d.ts.map +1 -1
  239. package/lib/typescript/src/Authenticator/index.d.ts +2 -1
  240. package/lib/typescript/src/Authenticator/index.d.ts.map +1 -1
  241. package/lib/typescript/src/Checkout/api/index.d.ts +1 -2
  242. package/lib/typescript/src/Checkout/api/index.d.ts.map +1 -1
  243. package/lib/typescript/src/Checkout/index.d.ts.map +1 -1
  244. package/lib/typescript/src/Competition/api/index.d.ts +128 -0
  245. package/lib/typescript/src/Competition/api/index.d.ts.map +1 -0
  246. package/lib/typescript/src/Competition/components/AthleteMarketCard.d.ts +19 -0
  247. package/lib/typescript/src/Competition/components/AthleteMarketCard.d.ts.map +1 -0
  248. package/lib/typescript/src/Competition/components/CompetitionCard.d.ts +12 -0
  249. package/lib/typescript/src/Competition/components/CompetitionCard.d.ts.map +1 -0
  250. package/lib/typescript/src/Competition/components/CompetitionInfoCard.d.ts +16 -0
  251. package/lib/typescript/src/Competition/components/CompetitionInfoCard.d.ts.map +1 -0
  252. package/lib/typescript/src/Competition/components/CompetitionLeaderboard.d.ts +14 -0
  253. package/lib/typescript/src/Competition/components/CompetitionLeaderboard.d.ts.map +1 -0
  254. package/lib/typescript/src/Competition/components/CompetitionPlay.d.ts +20 -0
  255. package/lib/typescript/src/Competition/components/CompetitionPlay.d.ts.map +1 -0
  256. package/lib/typescript/src/Competition/components/CompetitionSeasonCard.d.ts +10 -0
  257. package/lib/typescript/src/Competition/components/CompetitionSeasonCard.d.ts.map +1 -0
  258. package/lib/typescript/src/Competition/components/CompetitionSelector.d.ts +11 -0
  259. package/lib/typescript/src/Competition/components/CompetitionSelector.d.ts.map +1 -0
  260. package/lib/typescript/src/Competition/components/CompetitionTypeCard.d.ts +14 -0
  261. package/lib/typescript/src/Competition/components/CompetitionTypeCard.d.ts.map +1 -0
  262. package/lib/typescript/src/Competition/components/EnterCompetitionPrompt.d.ts +16 -0
  263. package/lib/typescript/src/Competition/components/EnterCompetitionPrompt.d.ts.map +1 -0
  264. package/lib/typescript/src/Competition/components/LeaderPicks.d.ts +22 -0
  265. package/lib/typescript/src/Competition/components/LeaderPicks.d.ts.map +1 -0
  266. package/lib/typescript/src/Competition/components/ManageSeasonForm.d.ts +10 -0
  267. package/lib/typescript/src/Competition/components/ManageSeasonForm.d.ts.map +1 -0
  268. package/lib/typescript/src/Competition/components/MarketsCard.d.ts +15 -0
  269. package/lib/typescript/src/Competition/components/MarketsCard.d.ts.map +1 -0
  270. package/lib/typescript/src/Competition/components/MatchMarketCard.d.ts +21 -0
  271. package/lib/typescript/src/Competition/components/MatchMarketCard.d.ts.map +1 -0
  272. package/lib/typescript/src/Competition/components/NavOutPrompt.d.ts +23 -0
  273. package/lib/typescript/src/Competition/components/NavOutPrompt.d.ts.map +1 -0
  274. package/lib/typescript/src/Competition/components/SeasonInfoModal.d.ts +14 -0
  275. package/lib/typescript/src/Competition/components/SeasonInfoModal.d.ts.map +1 -0
  276. package/lib/typescript/src/Competition/components/TeamEventCard.d.ts +17 -0
  277. package/lib/typescript/src/Competition/components/TeamEventCard.d.ts.map +1 -0
  278. package/lib/typescript/src/Competition/components/WagerPickForm.d.ts +15 -0
  279. package/lib/typescript/src/Competition/components/WagerPickForm.d.ts.map +1 -0
  280. package/lib/typescript/src/Competition/index.d.ts +11 -0
  281. package/lib/typescript/src/Competition/index.d.ts.map +1 -0
  282. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  283. package/lib/typescript/src/Components/Jerseys.d.ts +16 -0
  284. package/lib/typescript/src/Components/Jerseys.d.ts.map +1 -0
  285. package/lib/typescript/src/Components/LinearDiagnal.d.ts.map +1 -1
  286. package/lib/typescript/src/Components/Switch.d.ts +9 -0
  287. package/lib/typescript/src/Components/Switch.d.ts.map +1 -0
  288. package/lib/typescript/src/Components/index.d.ts +3 -1
  289. package/lib/typescript/src/Components/index.d.ts.map +1 -1
  290. package/lib/typescript/src/Poll/api/index.d.ts +65 -0
  291. package/lib/typescript/src/Poll/api/index.d.ts.map +1 -0
  292. package/lib/typescript/src/Poll/components/CampaignPlay.d.ts +14 -0
  293. package/lib/typescript/src/Poll/components/CampaignPlay.d.ts.map +1 -0
  294. package/lib/typescript/src/Poll/components/CampaignProgressBar.d.ts +12 -0
  295. package/lib/typescript/src/Poll/components/CampaignProgressBar.d.ts.map +1 -0
  296. package/lib/typescript/src/Poll/components/CampaignResult.d.ts +13 -0
  297. package/lib/typescript/src/Poll/components/CampaignResult.d.ts.map +1 -0
  298. package/lib/typescript/src/Poll/components/CampaignSelector.d.ts +9 -0
  299. package/lib/typescript/src/Poll/components/CampaignSelector.d.ts.map +1 -0
  300. package/lib/typescript/src/Poll/components/PollCampaignCard.d.ts +10 -0
  301. package/lib/typescript/src/Poll/components/PollCampaignCard.d.ts.map +1 -0
  302. package/lib/typescript/src/Poll/components/PollCard.d.ts +16 -0
  303. package/lib/typescript/src/Poll/components/PollCard.d.ts.map +1 -0
  304. package/lib/typescript/src/Poll/components/PollOptionCard.d.ts +14 -0
  305. package/lib/typescript/src/Poll/components/PollOptionCard.d.ts.map +1 -0
  306. package/lib/typescript/src/Poll/components/PollSelectCard.d.ts +16 -0
  307. package/lib/typescript/src/Poll/components/PollSelectCard.d.ts.map +1 -0
  308. package/lib/typescript/src/Poll/components/ResponseTimer.d.ts +9 -0
  309. package/lib/typescript/src/Poll/components/ResponseTimer.d.ts.map +1 -0
  310. package/lib/typescript/src/Poll/components/WidgetHeader.d.ts +13 -0
  311. package/lib/typescript/src/Poll/components/WidgetHeader.d.ts.map +1 -0
  312. package/lib/typescript/src/Poll/flashmarket/index.d.ts +10 -0
  313. package/lib/typescript/src/Poll/flashmarket/index.d.ts.map +1 -0
  314. package/lib/typescript/src/Poll/index.d.ts +13 -0
  315. package/lib/typescript/src/Poll/index.d.ts.map +1 -0
  316. package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts +1 -1
  317. package/lib/typescript/src/ProfileManager/Components/BasicInfoManager.d.ts.map +1 -1
  318. package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts +1 -2
  319. package/lib/typescript/src/ProfileManager/Components/BasicStatus.d.ts.map +1 -1
  320. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts +9 -2
  321. package/lib/typescript/src/ProfileManager/Components/CodeRedeem.d.ts.map +1 -1
  322. package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts +1 -1
  323. package/lib/typescript/src/ProfileManager/Components/DOBManager.d.ts.map +1 -1
  324. package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts +1 -1
  325. package/lib/typescript/src/ProfileManager/Components/EmailManager.d.ts.map +1 -1
  326. package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts +1 -1
  327. package/lib/typescript/src/ProfileManager/Components/PasswordManager.d.ts.map +1 -1
  328. package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts +1 -1
  329. package/lib/typescript/src/ProfileManager/Components/PhoneManager.d.ts.map +1 -1
  330. package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts +1 -1
  331. package/lib/typescript/src/ProfileManager/Components/ProfilePicManager.d.ts.map +1 -1
  332. package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts +1 -2
  333. package/lib/typescript/src/ProfileManager/Components/ProfileWelcome.d.ts.map +1 -1
  334. package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts +10 -3
  335. package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts.map +1 -1
  336. package/lib/typescript/src/ProfileManager/Components/SettingsManager.d.ts +2 -2
  337. package/lib/typescript/src/ProfileManager/Components/SettingsManager.d.ts.map +1 -1
  338. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts +1 -2
  339. package/lib/typescript/src/ProfileManager/Components/VouchCard.d.ts.map +1 -1
  340. package/lib/typescript/src/ProfileManager/api/index.d.ts +2 -2
  341. package/lib/typescript/src/ProfileManager/api/index.d.ts.map +1 -1
  342. package/lib/typescript/src/ProfileManager/index.d.ts +9 -2
  343. package/lib/typescript/src/ProfileManager/index.d.ts.map +1 -1
  344. package/lib/typescript/src/Wallet/api/index.d.ts +2 -3
  345. package/lib/typescript/src/Wallet/api/index.d.ts.map +1 -1
  346. package/lib/typescript/src/Wallet/components/ACHAddCard.d.ts +1 -2
  347. package/lib/typescript/src/Wallet/components/ACHAddCard.d.ts.map +1 -1
  348. package/lib/typescript/src/Wallet/components/AddressManager.d.ts +1 -2
  349. package/lib/typescript/src/Wallet/components/AddressManager.d.ts.map +1 -1
  350. package/lib/typescript/src/Wallet/components/DepositCard.d.ts +1 -2
  351. package/lib/typescript/src/Wallet/components/DepositCard.d.ts.map +1 -1
  352. package/lib/typescript/src/Wallet/components/FundAccountCard.d.ts +1 -2
  353. package/lib/typescript/src/Wallet/components/FundAccountCard.d.ts.map +1 -1
  354. package/lib/typescript/src/Wallet/components/ManageAccountCard.d.ts +1 -2
  355. package/lib/typescript/src/Wallet/components/ManageAccountCard.d.ts.map +1 -1
  356. package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts +1 -2
  357. package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts.map +1 -1
  358. package/lib/typescript/src/Wallet/components/ManualCardAdd.d.ts +1 -2
  359. package/lib/typescript/src/Wallet/components/ManualCardAdd.d.ts.map +1 -1
  360. package/lib/typescript/src/Wallet/components/MyBalance.d.ts +1 -2
  361. package/lib/typescript/src/Wallet/components/MyBalance.d.ts.map +1 -1
  362. package/lib/typescript/src/Wallet/components/WalletActionSelector.d.ts +1 -2
  363. package/lib/typescript/src/Wallet/components/WalletActionSelector.d.ts.map +1 -1
  364. package/lib/typescript/src/Wallet/components/WalletSettings.d.ts +1 -2
  365. package/lib/typescript/src/Wallet/components/WalletSettings.d.ts.map +1 -1
  366. package/lib/typescript/src/Wallet/components/WalletSetup.d.ts +1 -2
  367. package/lib/typescript/src/Wallet/components/WalletSetup.d.ts.map +1 -1
  368. package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts +1 -2
  369. package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts.map +1 -1
  370. package/lib/typescript/src/Wallet/index.d.ts +1 -2
  371. package/lib/typescript/src/Wallet/index.d.ts.map +1 -1
  372. package/lib/typescript/src/index.d.ts +3 -1
  373. package/lib/typescript/src/index.d.ts.map +1 -1
  374. package/package.json +1 -1
  375. package/src/ApiOverrides/index.ts +19 -0
  376. package/src/Authenticator/Components/AuthStrategyIdentifier.tsx +72 -0
  377. package/src/Authenticator/Components/StrategyForm.tsx +208 -53
  378. package/src/Authenticator/api/index.ts +2 -2
  379. package/src/Authenticator/api/types.d.ts +3 -26
  380. package/src/Authenticator/index.tsx +10 -4
  381. package/src/Checkout/api/index.tsx +1 -2
  382. package/src/Checkout/index.tsx +1 -2
  383. package/src/Competition/api/index.ts +568 -0
  384. package/src/Competition/components/AthleteMarketCard.tsx +116 -0
  385. package/src/Competition/components/CompetitionCard.tsx +82 -0
  386. package/src/Competition/components/CompetitionInfoCard.tsx +149 -0
  387. package/src/Competition/components/CompetitionLeaderboard.tsx +183 -0
  388. package/src/Competition/components/CompetitionPlay.tsx +936 -0
  389. package/src/Competition/components/CompetitionSeasonCard.tsx +48 -0
  390. package/src/Competition/components/CompetitionSelector.tsx +91 -0
  391. package/src/Competition/components/CompetitionTypeCard.tsx +211 -0
  392. package/src/Competition/components/EnterCompetitionPrompt.tsx +127 -0
  393. package/src/Competition/components/LeaderPicks.tsx +214 -0
  394. package/src/Competition/components/ManageSeasonForm.tsx +271 -0
  395. package/src/Competition/components/MarketsCard.tsx +108 -0
  396. package/src/Competition/components/MatchMarketCard.tsx +126 -0
  397. package/src/Competition/components/NavOutPrompt.tsx +87 -0
  398. package/src/Competition/components/SeasonInfoModal.tsx +212 -0
  399. package/src/Competition/components/TeamEventCard.tsx +136 -0
  400. package/src/Competition/components/WagerPickForm.tsx +114 -0
  401. package/src/Competition/index.tsx +36 -0
  402. package/src/Components/Icons.tsx +0 -2
  403. package/src/Components/Jerseys.tsx +268 -0
  404. package/src/Components/LinearDiagnal.tsx +2 -3
  405. package/src/Components/Switch.tsx +55 -0
  406. package/src/Components/index.tsx +5 -1
  407. package/src/Poll/api/index.ts +212 -0
  408. package/src/Poll/components/CampaignPlay.tsx +407 -0
  409. package/src/Poll/components/CampaignProgressBar.tsx +70 -0
  410. package/src/Poll/components/CampaignResult.tsx +180 -0
  411. package/src/Poll/components/CampaignSelector.tsx +96 -0
  412. package/src/Poll/components/PollCampaignCard.tsx +35 -0
  413. package/src/Poll/components/PollCard.tsx +335 -0
  414. package/src/Poll/components/PollOptionCard.tsx +110 -0
  415. package/src/Poll/components/PollSelectCard.tsx +106 -0
  416. package/src/Poll/components/ResponseTimer.tsx +37 -0
  417. package/src/Poll/components/WidgetHeader.tsx +46 -0
  418. package/src/Poll/flashmarket/index.tsx +231 -0
  419. package/src/Poll/index.tsx +45 -0
  420. package/src/ProfileManager/Components/BasicInfoManager.tsx +1 -1
  421. package/src/ProfileManager/Components/BasicStatus.tsx +1 -2
  422. package/src/ProfileManager/Components/CodeRedeem.tsx +10 -3
  423. package/src/ProfileManager/Components/DOBManager.tsx +1 -1
  424. package/src/ProfileManager/Components/EmailManager.tsx +1 -1
  425. package/src/ProfileManager/Components/PasswordManager.tsx +2 -1
  426. package/src/ProfileManager/Components/PhoneManager.tsx +1 -1
  427. package/src/ProfileManager/Components/ProfilePicManager.tsx +1 -1
  428. package/src/ProfileManager/Components/ProfileWelcome.tsx +1 -2
  429. package/src/ProfileManager/Components/ProfileWizard.tsx +14 -3
  430. package/src/ProfileManager/Components/SettingsManager.tsx +2 -2
  431. package/src/ProfileManager/Components/VouchCard.tsx +1 -2
  432. package/src/ProfileManager/api/index.ts +2 -2
  433. package/src/ProfileManager/api/types.d.ts +0 -35
  434. package/src/ProfileManager/index.tsx +11 -3
  435. package/src/Wallet/api/index.ts +6 -4
  436. package/src/Wallet/components/ACHAddCard.tsx +1 -2
  437. package/src/Wallet/components/AddressManager.tsx +1 -2
  438. package/src/Wallet/components/DepositCard.tsx +1 -2
  439. package/src/Wallet/components/FundAccountCard.tsx +1 -2
  440. package/src/Wallet/components/ManageAccountCard.tsx +1 -2
  441. package/src/Wallet/components/ManualACHAdd.tsx +1 -2
  442. package/src/Wallet/components/ManualCardAdd.tsx +1 -2
  443. package/src/Wallet/components/MyBalance.tsx +1 -2
  444. package/src/Wallet/components/WalletActionSelector.tsx +1 -2
  445. package/src/Wallet/components/WalletSettings.tsx +1 -2
  446. package/src/Wallet/components/WalletSetup.tsx +1 -2
  447. package/src/Wallet/components/WithdrawCard.tsx +1 -2
  448. package/src/Wallet/index.tsx +1 -2
  449. package/src/index.tsx +5 -2
  450. package/src/types.d.ts +486 -1
@@ -0,0 +1,212 @@
1
+ import axios from "axios"
2
+ import type { PollCampaignGoalProps, PollCampaignLeaderProps, PollCampaignProps, PollOptionProps, PollProps, PollResponseProps, PollSummaryProps } from "../../types";
3
+ import { APIOverrides } from "../../ApiOverrides";
4
+ import Colors from "../../constants/colors";
5
+
6
+ let AUTH_SVC_API = ''
7
+
8
+ export {
9
+ PollCampaignApi,
10
+ PollCampaignHelpers,
11
+ PollApi,
12
+ PollCampaignGoalApi,
13
+ PollOptionApi,
14
+ PollResponseApi,
15
+ PollResponseHelpers
16
+ }
17
+
18
+ const PollCampaignApi = {
19
+ setEnvironment: () => {
20
+ const endpoints = APIOverrides.getEndpoints();
21
+ AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
22
+ },
23
+ getPlayersByPlayerIds : async(player_ids:string[]) => {
24
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/players/bulk/get`, { player_ids })
25
+ return resp.data.players
26
+ },
27
+ createPollCampaign: async(poll_campaign:PollCampaignProps):Promise<PollCampaignProps> => {
28
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/campaign/create`, { poll_campaign })
29
+ return resp.data.poll_campaign
30
+ },
31
+ updatePollCampaign: async(poll_campaign:PollCampaignProps):Promise<PollCampaignProps> => {
32
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/campaign/update`, { poll_campaign })
33
+ return resp.data.poll_campaign
34
+ },
35
+ getPollCampaignById : async(poll_campaign_id:string):Promise<PollCampaignProps> => {
36
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/campaigns/campaign/${poll_campaign_id}`)
37
+ return resp.data.poll_campaign
38
+ },
39
+ searchPollCampaigns : async(search_value:string, offset:number):Promise<PollCampaignProps[]> => {
40
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/search`, { search_value, offset })
41
+ return resp.data.poll_campaigns
42
+ },
43
+ closePollCampaign : async(poll_campaign_id:string):Promise<PollCampaignProps> => {
44
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/campaign/close`, { poll_campaign_id })
45
+ return resp.data.poll_campaign
46
+ },
47
+ copyPollCampaign : async(poll_campaign_id:string):Promise<PollCampaignProps> => {
48
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/campaign/copy`, { poll_campaign_id })
49
+ return resp.data.poll_campaign
50
+ },
51
+ archivePollCampaign : async(poll_campaign_id:string):Promise<PollCampaignProps> => {
52
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/campaign/archive`, { poll_campaign_id })
53
+ return resp.data.poll_campaign
54
+ },
55
+ deletePollCampaign : async(poll_campaign_id:string):Promise<PollCampaignProps> => {
56
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/campaign/delete`, { poll_campaign_id })
57
+ return resp.data.poll_campaign
58
+ },
59
+ getPollCampaignsByPlayerId : async(player_id:string, offset:number, status?:string):Promise<PollCampaignProps[]> => {
60
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/campaigns/player/${player_id}?offset=${offset}&status=${status}`)
61
+ return resp.data.poll_campaigns
62
+ },
63
+ getLeadersByCampaignId : async(poll_campaign_id:string, offset:number):Promise<PollCampaignLeaderProps[]> => {
64
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/leaders/campaign/${poll_campaign_id}?offset=${offset}`)
65
+ return resp.data.poll_campaign_leaders
66
+ },
67
+ getPollCampaignsByCompanyCode : async(code:string, offset:number, status:string):Promise<PollCampaignProps[]> => {
68
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/campaigns/company/${code}?offset=${offset}&status=${status}`)
69
+ return resp.data.poll_campaigns
70
+ }
71
+ }
72
+
73
+ const PollCampaignHelpers = {
74
+ isCampaignComplete: (polls:PollProps[], poll_responses:PollResponseProps[], poll_campaign?:PollCampaignProps) => {
75
+ if(!poll_campaign){ return false }
76
+ if(polls.length == 0){ return false }
77
+ if(poll_campaign.status != 'active'){ return true }
78
+ if(poll_responses.length == polls.length){ return true }
79
+ if(!polls.find(p => p.status != 'closed')) { return true }
80
+ let non_closed_polls = polls.filter(p => p.status == 'active')
81
+ let missing_response = false
82
+ non_closed_polls.map(p => {
83
+ if(missing_response){ return }
84
+ let response = poll_responses.find(pr => pr.poll_id == p.poll_id)
85
+ if(!response){ missing_response = true }
86
+ })
87
+ return !missing_response
88
+ }
89
+ }
90
+
91
+ const PollApi = {
92
+ createPoll : async(poll:PollProps):Promise<PollProps> => {
93
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/create`, { poll })
94
+ return resp.data.poll
95
+ },
96
+ updatePoll : async(poll:PollProps):Promise<{ poll: PollProps, poll_options:PollOptionProps[] }> => {
97
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/update`, { poll })
98
+ return { poll: resp.data.poll, poll_options:resp.data.poll_options }
99
+ },
100
+ activatePoll : async(poll_id:string):Promise<{ poll:PollProps, poll_options:PollOptionProps[] }> => {
101
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/activate`, { poll_id })
102
+ return { poll: resp.data.poll, poll_options: resp.data.poll_options }
103
+ },
104
+ closePoll : async(poll_id:string, winning_option_id?:string, winning_value?:string):Promise<PollProps> => {
105
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/close`, { poll_id, winning_option_id, winning_value })
106
+ return resp.data.poll
107
+ },
108
+ deletePoll : async(poll_id:string):Promise<PollProps> => {
109
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/delete`, { poll_id })
110
+ return resp.data.poll
111
+ },
112
+ getPollsByCampaignId : async(poll_campaign_id:string):Promise<{ polls:PollProps[], poll_campaign_goals:PollCampaignGoalProps[] }> => {
113
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/campaign/${poll_campaign_id}`)
114
+ return { polls: resp.data.polls, poll_campaign_goals: resp.data.poll_campaign_goals }
115
+ },
116
+ notifyPollResponders : async(poll_campaign_ids:string[], player_notification:any):Promise<void> => {
117
+ await axios.post(`${AUTH_SVC_API}/v1/polls/campaigns/notify`, { poll_campaign_ids, player_notification })
118
+ return
119
+ },
120
+ getPollsByRelatedIdAndType : async(related_type:string, related_id:string):Promise<PollProps[]> => {
121
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/related/${related_type}/${related_id}`)
122
+ return resp.data.polls
123
+ },
124
+ getPollById : async(poll_id:string):Promise<{ poll:PollProps, poll_options:PollOptionProps[], poll_summaries: PollSummaryProps[] }> => {
125
+ console.log('getting data')
126
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/poll/${poll_id}`)
127
+
128
+ const { poll, poll_options, poll_summaries } = resp.data;
129
+ return { poll, poll_options, poll_summaries }
130
+ }
131
+ }
132
+
133
+ const PollCampaignGoalApi = {
134
+ getPollCampaignGoalById : async(poll_campaign_goal_id:string):Promise<PollCampaignGoalProps> => {
135
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/goals/goal/${poll_campaign_goal_id}`)
136
+ return resp.data.poll_campaign_goal
137
+ },
138
+ createPollCampaignGoal : async(poll_campaign_goal:PollCampaignGoalProps):Promise<PollCampaignGoalProps> => {
139
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/goals/goal/create`, { poll_campaign_goal })
140
+ return resp.data.poll_campaign_goal
141
+ },
142
+ updatePollCampaignGoal : async(poll_campaign_goal:PollCampaignGoalProps):Promise<PollCampaignGoalProps> => {
143
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/goals/goal/update`, { poll_campaign_goal })
144
+ return resp.data.poll_campaign_goal
145
+ }
146
+ }
147
+
148
+ const PollResponseApi = {
149
+ createPollResponse : async(poll_response:PollResponseProps):Promise<PollResponseProps> => {
150
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/response/create`, { poll_response })
151
+ return resp.data.poll_response
152
+ },
153
+ getResponseByPollId: async(poll_id:string):Promise<PollResponseProps | undefined> => {
154
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/response/poll/${poll_id}`)
155
+ return resp.data.poll_response
156
+ },
157
+ getRespondersByPollId: async(poll_id:string, offset:number):Promise<string[]> => {
158
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/responders/poll/${poll_id}?offset=${offset}`)
159
+ return resp.data.player_ids
160
+ },
161
+ getRespondersByCampaignId: async(poll_campaign_id:string, offset:number):Promise<string[]> => {
162
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/responders/campaign/${poll_campaign_id}?offset=${offset}`)
163
+ return resp.data.player_ids
164
+ },
165
+ getMyCampaignResponses: async(poll_campaign_id:string):Promise<PollResponseProps[]> => {
166
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/polls/campaigns/responses/${poll_campaign_id}`)
167
+ return resp.data.poll_responses
168
+ }
169
+ }
170
+
171
+ const PollResponseHelpers = {
172
+ getOptionColor: (po:PollOptionProps, pr?:PollResponseProps) => {
173
+ if(!pr){ return Colors.shades.white }
174
+ if(pr.status == 'pending'){ return Colors.shades.white }
175
+ switch(po.result_ind){
176
+ case 'win':
177
+ return Colors.highlights.highlight400Faded
178
+ case 'lose':
179
+ return Colors.highlights.highlight300Faded
180
+ case 'draw':
181
+ return Colors.brand.slate
182
+ default:
183
+ if(pr?.poll_option_id == po.poll_option_id){ return Colors.brand.midnight }
184
+ return 'transparent'
185
+ }
186
+ },
187
+ updateSummariesWithResponse : (pr:PollResponseProps, summaries:PollSummaryProps[]) => {
188
+ let new_total = summaries.reduce((a,b) => a + parseFloat(b.stake as unknown as string), 0) + parseFloat(pr.stake as string)
189
+ summaries = summaries.map(s => {
190
+ if(s.poll_option_id == pr.poll_option_id){
191
+ s.count += 1
192
+ s.stake += parseFloat(pr.stake as string)
193
+ }
194
+ s.pct = s.stake / new_total
195
+ return s
196
+ })
197
+ return summaries
198
+ }
199
+ }
200
+
201
+ const PollOptionApi = {
202
+ createPollOption : async(poll_option:PollOptionProps):Promise<PollOptionProps> => {
203
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/option/create`, { poll_option })
204
+ return resp.data.poll_option
205
+ },
206
+ updatePollOption : async(poll_option:PollOptionProps):Promise<PollOptionProps> => {
207
+ const resp = await axios.post(`${AUTH_SVC_API}/v1/polls/poll/option/update`, { poll_option })
208
+ return resp.data.poll_option
209
+ }
210
+ }
211
+
212
+
@@ -0,0 +1,407 @@
1
+ import React from 'react';
2
+ import { useEffect, useState } from 'react';
3
+ import { ActivityIndicator, FlatList, Image, ScrollView, TouchableOpacity, View } from 'react-native';
4
+ import type { PollCampaignProps, PollProps, PollResponseProps } from '../../types';
5
+ import Colors from '../../constants/colors';
6
+ import PollCard from './PollCard';
7
+ import CampaignProgressBar from './CampaignProgressBar';
8
+ import CampaignResult from './CampaignResult';
9
+ import PollSelectCard from './PollSelectCard';
10
+ import { PollApi, PollCampaignApi, PollCampaignHelpers, PollResponseApi } from '../api';
11
+ import { Button, Icons, Text } from '../../Components';
12
+
13
+
14
+ type CampaignPlayProps = {
15
+ poll_campaign_id:string,
16
+ player_id?:string,
17
+ onActiveViewChange?:(active_view:string) => void
18
+ onFinished: () => void,
19
+ onRequestAuthenticate: () => void,
20
+ init_poll_id?:string,
21
+ init_view?:string,
22
+ onProfileSelect?: () => void
23
+ }
24
+
25
+ const CampaignPlay = ({ player_id, poll_campaign_id, onActiveViewChange, onRequestAuthenticate, onFinished, init_view, init_poll_id }:CampaignPlayProps) => {
26
+ //const [ show_authenticate, setShowAuthenticate ] = useState(false);
27
+ const [ campaign_data, setCampaignData ] = useState<{
28
+ poll_campaign?:PollCampaignProps,
29
+ polls:PollProps[],
30
+ my_responses:PollResponseProps[]
31
+ }>({
32
+ polls:[],
33
+ my_responses:[]
34
+ })
35
+ const [ loading, setLoading ] = useState(false);
36
+ //const [ shareImage, setImage ] = useState<any>(undefined)
37
+ const [ share_in_process ] = useState(false);
38
+ const [ play_width, setPlayWidth ] = useState(0);
39
+ const [ show_live, setShowLive ] = useState(false);
40
+ const [ active_poll, setActivePoll ] = useState<PollProps|undefined>(undefined);
41
+ const [ active_view, setActiveView ] = useState('select_poll')
42
+
43
+ const { poll_campaign, polls, my_responses } = campaign_data
44
+
45
+ polls.filter(p => p.poll_campaign_id == poll_campaign_id && ['pending','active','paused','closed'].includes(p.status)).sort((a,b) => {
46
+ if(a.priority && b.priority){ return a.priority - b.priority }
47
+ else { return parseInt(b.poll_id) - parseInt(a.poll_id) }
48
+ })
49
+ const playable_polls = polls.filter(p => ['closed','active'].includes(p.status))
50
+ const active_polls = polls.filter(p => p.status == 'active');
51
+ const pending_polls = polls.filter(p => ['pending','paused'].includes(p.status));
52
+ const closed_polls = polls.filter(p => p.status == 'closed');
53
+
54
+ const poll_responses = my_responses.filter(pr => polls.map(p => p.poll_id.toString()).includes(pr.poll_id.toString()))
55
+
56
+ const campaign_complete = PollCampaignHelpers.isCampaignComplete(polls, poll_responses, poll_campaign)
57
+
58
+ const active_responded = poll_responses.find(pr => pr.poll_id == active_poll?.poll_id) ? true : false;
59
+ let active_index = playable_polls.findIndex(p => p.poll_id == active_poll?.poll_id)
60
+
61
+
62
+ //const progressRef = useRef()
63
+
64
+ useEffect(() => {
65
+ getCampaignDetailsFromServer(poll_campaign_id)
66
+ },[poll_campaign_id])
67
+
68
+ useEffect(() => {
69
+ if(onActiveViewChange){ return onActiveViewChange(active_view) }
70
+ },[active_view])
71
+
72
+ useEffect(() => {
73
+ if(!share_in_process){ return }
74
+ /*
75
+ html2canvas(progressRef.current).then(function(canvas:any) {
76
+ var myImage = canvas.toDataURL("image/png");
77
+ setImage(myImage)
78
+ //share(myImage)
79
+ });
80
+ */
81
+ },[share_in_process])
82
+
83
+ useEffect(() => {
84
+ if(polls.length == 0){ return }
85
+ if(!init_poll_id || init_poll_id == 'undefined'){ return }
86
+ if(init_view != 'result'){ return }
87
+ let init_poll = polls.find(p => p.poll_id == init_poll_id)
88
+ if(!init_poll){ return }
89
+ setActivePoll(init_poll)
90
+ setActiveView('respond_poll')
91
+ },[polls.length])
92
+
93
+ const getCampaignDetailsFromServer = async(poll_campaign_id:string) => {
94
+ setLoading(true);
95
+ const pc = await PollCampaignApi.getPollCampaignById(poll_campaign_id)
96
+ const ps_resp = await PollApi.getPollsByCampaignId(poll_campaign_id)
97
+ const pr = await PollResponseApi.getMyCampaignResponses(poll_campaign_id)
98
+ setCampaignData({
99
+ poll_campaign:pc,
100
+ my_responses: pr,
101
+ polls: ps_resp.polls
102
+ })
103
+ setLoading(false);
104
+ }
105
+
106
+ /*
107
+ const getImage = async() => {
108
+ if(!progressRef?.current){ return alert('Nothing to capture') }
109
+ setShareInProcess(true)
110
+ }
111
+ */
112
+
113
+
114
+ /*
115
+ const share = async(newImage:string) => {
116
+ if(!player){ return }
117
+ if(!company){ return alert('no company')}
118
+ let text = '';
119
+ let url = `https://share.mybe.app/polls/${company.short_name}?poll_campaign_id=${poll_campaign.poll_campaign_id}`
120
+ setShareInProcess(false)
121
+ if(!newImage){ return alert('No image!') }
122
+ if(!navigator?.share){ return alert('Browser does not support sharing')}
123
+ const blob = await (await fetch(newImage)).blob();
124
+ const filesArray = [
125
+ new File([blob], `${player.player_id}_poll.png`, { type:blob.type } )
126
+ ]
127
+ navigator.share({ text, files:filesArray, url }).then(() => {
128
+ //segEventTrack({ event: 'Shared Position', properties: { be_type:route.params.be_type, result:shareablePosition.result_ind } })
129
+ }).catch((e) => console.log(e))
130
+ }
131
+ */
132
+
133
+ /*
134
+
135
+ const nativeShare = () => {
136
+ if(!navigator?.share){ return alert('Your browser does not support native sharing') }
137
+ if(!company){ return alert('no company')}
138
+ let text = ``
139
+ let total = playable_polls.length
140
+ let total_resolved = playable_polls.filter(pp => pp.winning_option_id || pp.winning_value).length
141
+ let wins = 0
142
+ playable_polls.sort((a,b) => a.priority - b.priority).map(pp => {
143
+ let resp = poll_responses.find(pr => pr.poll_id == pp.poll_id)
144
+ if(!resp && (!pp.winning_option_id || !pp.winning_value)){ return }
145
+ if(!resp){ text += `🕚`; return }
146
+ if(!resp.result_ind){ text += '🕚'; return }
147
+ if(resp.result_ind == 'win'){ wins += 1; text += '✅'; return }
148
+ if(resp.result_ind == 'lose'){ text += '❌'; return }
149
+ text += '🕚'
150
+ return
151
+ })
152
+ let message = `I just went ${wins} out of ${total} in ${poll_campaign.name}! \n${text}`
153
+ if(total_resolved < total){ message = `I just completed the ${poll_campaign.name}!` }
154
+ let link = window.location.href
155
+ //let link = `https://share.mybe.app/polls/${company.short_name}?poll_campaign_id=${poll_campaign.poll_campaign_id}`
156
+ navigator.share({
157
+ text:`${message}`,
158
+ url: link
159
+ }).then(() => {
160
+ //segEventTrack({ event: 'Shared Position', properties: { be_type:route.params.be_type, result:shareablePosition.result_ind } })
161
+ }).catch((e) => console.log(e))
162
+
163
+ }
164
+ */
165
+
166
+ const handleNavPoll = (poll:PollProps) => {
167
+ if(active_poll?.seconds_allowed){
168
+ let responded = poll_responses.find(pr => pr.poll_id == active_poll.poll_id)
169
+ if(!responded){ return }
170
+ }
171
+ if(init_view == 'result'){ return } //Dont navigate if init view is a result only
172
+ if(active_view != 'respond_poll'){ setActiveView('respond_poll') }
173
+ return setActivePoll(poll)
174
+ }
175
+
176
+ const handleSkip = () => {
177
+ if(active_index == polls.length - 1){
178
+ return setActivePoll(polls[0])
179
+ }
180
+ return setActivePoll(polls[active_index + 1])
181
+ }
182
+
183
+ const renderPolls = (data: {item:PollProps, index:number}) => {
184
+ if(!poll_campaign){ return <></> }
185
+ const selected = active_poll?.poll_id == data.item.poll_id ? true : false;
186
+ const poll_response = poll_responses.find(pr => pr.poll_id == data.item.poll_id);
187
+ const response_option = data.item.poll_options?.find(po => po.poll_option_id == poll_response?.poll_option_id)
188
+ return (
189
+ <PollSelectCard
190
+ index={data.index}
191
+ poll_campaign={poll_campaign}
192
+ disabled={data.item.status == 'pending' ? true : false}
193
+ poll={data.item}
194
+ selected={selected}
195
+ response_option={response_option}
196
+ show_response={poll_response ? true : false}
197
+ poll_response={poll_response}
198
+ onSelect={(poll) => {
199
+ if(poll.status == 'pending'){ return alert('Poll is not yet active!') }
200
+ if(selected){ setActivePoll(undefined) }
201
+ else { setActivePoll(poll) }
202
+ }}
203
+ />
204
+ )
205
+ }
206
+
207
+ if(!poll_campaign || loading){
208
+ return (
209
+ <View style={{ padding:20 }}>
210
+ <ActivityIndicator style={{ alignSelf:'center' }} size='large' color={Colors.brand.midnight} />
211
+ </View>
212
+ )
213
+ }
214
+
215
+ return (
216
+ <View style={{ flex:1, backgroundColor:Colors.shades.white }} onLayout={(ev) => {
217
+ const { width } = ev.nativeEvent.layout;
218
+ setPlayWidth(width)
219
+ }}>
220
+ <View style={{ backgroundColor:Colors.shades.shade600, padding:10 }}>
221
+ <View style={{ flexDirection:'row' }}>
222
+ <Image
223
+ source={{ uri: poll_campaign.campaign_image?.url }}
224
+ style={{ height:play_width * 0.15, width:play_width * 0.25, borderRadius:8 }}
225
+ resizeMode='cover'
226
+ />
227
+ <View style={{ flex:1, marginLeft:10, marginRight:10, justifyContent:'center'}}>
228
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>{poll_campaign.name}</Text>
229
+ <Text style={{ marginTop:3 }} size={12} color={Colors.brand.midnight} weight='regular'>{poll_campaign.total_responses} Responses</Text>
230
+ </View>
231
+ <View style={{ flexDirection:'row' }}>
232
+ <TouchableOpacity style={{ padding:10 }} onPress={() => console.log('NATIVE SHARE')}>
233
+ <Icons.ShareIcon color={Colors.brand.midnight} size={12}/>
234
+ </TouchableOpacity>
235
+ {poll_campaign.stream ?
236
+ <TouchableOpacity style={{ padding:10 }} onPress={() => setShowLive(!show_live)}>
237
+ {show_live ?
238
+ <Icons.CloseIcon color={Colors.utility.error} size={14}/>
239
+ :
240
+ <Icons.TVIcon color={Colors.brand.midnight} size={14} />
241
+ }
242
+ </TouchableOpacity>
243
+ :<></>}
244
+ </View>
245
+ </View>
246
+ {poll_campaign.stream ?
247
+ <View nativeID='campaign_stream' style={{ marginTop: show_live ? 5: 0, height:show_live ? undefined : 0, overflow:'hidden', justifyContent:'center', alignItems:'center' }}>
248
+ <Text>STREAM!</Text>
249
+ </View>
250
+ :<></>}
251
+ </View>
252
+ <View style={{ flex:1 }}>
253
+ <View nativeID='progress' style={{ padding:10, backgroundColor:Colors.shades.shade600 }}>
254
+ <View>
255
+ <CampaignProgressBar
256
+ polls={playable_polls}
257
+ onPollSelect={(poll:PollProps) => handleNavPoll(poll)}
258
+ poll_responses={poll_responses}
259
+ active_poll={active_poll ? active_poll.poll_id : playable_polls[0]?.poll_id ?? ''}
260
+ poll_campaign={poll_campaign}
261
+ />
262
+ </View>
263
+ </View>
264
+ { active_view == 'select_poll' ?
265
+ <View nativeID='pre_start' style={{ flex:1 }}>
266
+ <ScrollView style={{ flex:1 }}>
267
+ <View style={{ padding:10 }}>
268
+ {active_polls.length > 0 ?
269
+ <View nativeID='active_questions'>
270
+ <View style={{ flexDirection:'row', alignItems:'center' }}>
271
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>Active Questions</Text>
272
+ <View style={{ marginLeft:5, borderRadius:4, padding:4, backgroundColor:Colors.utility.success }}>
273
+ <Text style={{ alignSelf:'center' }} size={10} color={Colors.shades.white} weight='semibold' textAlign='center'>{active_polls.length}</Text>
274
+ </View>
275
+ </View>
276
+ <View nativeID='active_questions_list' style={{ marginTop: 10, backgroundColor:Colors.shades.shade100, borderRadius:22 }}>
277
+ <FlatList
278
+ data={active_polls}
279
+ renderItem={renderPolls}
280
+ />
281
+ </View>
282
+ </View>
283
+ :<></>}
284
+ {false && pending_polls.length > 0 ?
285
+ <View nativeID='pending_questions' style={{ marginTop:10 }}>
286
+ <View style={{ flexDirection:'row', alignItems:'center' }}>
287
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>Pending Questions</Text>
288
+ <View style={{ marginLeft:5, borderRadius:4, padding:4, backgroundColor:Colors.brand.slate }}>
289
+ <Text style={{ alignSelf:'center' }} size={10} color={Colors.shades.white} weight='semibold' textAlign='center'>{pending_polls.length}</Text>
290
+ </View>
291
+ </View>
292
+ {false ?
293
+ <View nativeID='pending_questions_list' style={{ marginTop: 10, backgroundColor:Colors.brand.slate, borderRadius:22 }}>
294
+ <FlatList
295
+ data={pending_polls}
296
+ renderItem={renderPolls}
297
+ />
298
+ </View>
299
+ :<></>}
300
+ </View>
301
+ :<></>}
302
+ {closed_polls.length > 0 ?
303
+ <View nativeID='closed_questions' style={{ marginTop:10 }}>
304
+ <View style={{ flexDirection:'row', alignItems:'center' }}>
305
+ <Text size={14} color={Colors.brand.midnight} weight='bold'>Closed Questions</Text>
306
+ <View style={{ marginLeft:5, borderRadius:4, padding:4, backgroundColor:Colors.utility.success }}>
307
+ <Text style={{ alignSelf:'center' }} size={10} color={Colors.shades.white} weight='semibold' textAlign='center'>{closed_polls.length}</Text>
308
+ </View>
309
+ </View>
310
+ <View nativeID='closed_questions_list' style={{ marginTop: 10, backgroundColor:Colors.shades.shade100, borderRadius:22 }}>
311
+ <FlatList
312
+ data={closed_polls}
313
+ renderItem={renderPolls}
314
+ />
315
+ </View>
316
+ </View>
317
+ :<></>}
318
+ </View>
319
+ </ScrollView>
320
+ <View style={{ flexDirection:'row', padding:10, borderRadius:22 }}>
321
+ <Button
322
+ style={{flex:1, marginRight:4}}
323
+ title='Exit'
324
+ backgroundColor={Colors.utility.error}
325
+ title_size={12}
326
+ padding={14}
327
+ title_color={Colors.shades.white}
328
+ borderRadius={22}
329
+ onPress={() => onFinished()}
330
+ />
331
+ <Button
332
+ style={{flex:2}}
333
+ title_size={12}
334
+ padding={14}
335
+ disabled={active_poll?false:true}
336
+ title={active_poll?active_responded||active_poll.status!='active'?'View Question':'Respond':'Select Question'}
337
+ title_color={Colors.shades.white}
338
+ backgroundColor={active_poll?Colors.utility.success:Colors.brand.slate}
339
+ borderRadius={22}
340
+ onPress={() => {
341
+ if(!player_id){ return onRequestAuthenticate() }
342
+ setActiveView('respond_poll')
343
+ }}
344
+ />
345
+ </View>
346
+ <View style={{ flexDirection:'row', padding:10, backgroundColor:Colors.shades.shade100, borderBottomLeftRadius:22, borderBottomRightRadius:22 }}>
347
+ {campaign_complete && active_view == 'select_poll' ?
348
+ <Button
349
+ icon_name='trophy'
350
+ icon_side='left'
351
+ title='Results'
352
+ title_size={12}
353
+ backgroundColor={Colors.incentive.gold}
354
+ title_color={Colors.shades.white}
355
+ borderRadius={22}
356
+ onPress={() => setActiveView('campaign_results')}
357
+ />
358
+ :<></>}
359
+ </View>
360
+ </View>
361
+ : active_view == 'respond_poll' && active_poll ?
362
+ <View nativeID='respond_poll' style={{ flex:1 }}>
363
+ <PollCard
364
+ poll={active_poll}
365
+ view={init_view == 'result' ? 'result' : 'play'}
366
+ question_number={active_index + 1}
367
+ onShowAuthenticate={() => {
368
+ console.log('show authenticate!!')
369
+ }}
370
+ onResponse={(response) => {
371
+ setCampaignData({
372
+ ...campaign_data,
373
+ my_responses: my_responses.filter(r => r.poll_response_id != response.poll_response_id).concat(response)
374
+ })
375
+ }}
376
+ total_questions={playable_polls.length}
377
+ onSkip={() => handleSkip()}
378
+ onSeeResults={() => {
379
+ if(campaign_complete){ return setActiveView('campaign_results') }
380
+ return handleSkip()
381
+ }}
382
+ onCancel={() => {
383
+ setActivePoll(undefined)
384
+ setActiveView('select_poll')
385
+ }}
386
+ />
387
+ </View>
388
+ : active_view == 'campaign_results' ?
389
+ <View nativeID='campaign_results' style={{ flex:1 }}>
390
+ <CampaignResult
391
+ poll_campaign={poll_campaign}
392
+ polls={polls}
393
+ //hide_back={init_view && init_view !='undefined' ? true : false}
394
+ onShare={() => console.log('Share this bad boi!')}
395
+ poll_responses={poll_responses}
396
+ onClose={() => setActiveView('select_poll')}
397
+ />
398
+ </View>
399
+ :<></>}
400
+ </View>
401
+
402
+ </View>
403
+ )
404
+
405
+ }
406
+
407
+ export default CampaignPlay