react-native-stallion 1.0.0

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 (312) hide show
  1. package/README.md +36 -0
  2. package/android/build.gradle +100 -0
  3. package/android/gradle.properties +5 -0
  4. package/android/src/main/AndroidManifest.xml +8 -0
  5. package/android/src/main/java/com/stallion/Stallion.java +26 -0
  6. package/android/src/main/java/com/stallion/StallionConstants.java +27 -0
  7. package/android/src/main/java/com/stallion/StallionDefaultErrorActivity.java +27 -0
  8. package/android/src/main/java/com/stallion/StallionModule.java +250 -0
  9. package/android/src/main/java/com/stallion/StallionPackage.java +29 -0
  10. package/android/src/main/java/com/stallion/StallionStorage.java +54 -0
  11. package/android/src/main/java/com/stallion/StallionZip.java +127 -0
  12. package/android/src/main/res/layout/stallion_default_error_activity.xml +60 -0
  13. package/android/src/noop/java/com/stallion/Stallion.java +13 -0
  14. package/android/src/noop/java/com/stallion/StallionConstants.java +10 -0
  15. package/android/src/noop/java/com/stallion/StallionModule.java +26 -0
  16. package/android/src/noop/java/com/stallion/StallionPackage.java +29 -0
  17. package/ios/Stallion.xcodeproj/project.pbxproj +283 -0
  18. package/ios/main/Stallion-Bridging-Header.h +3 -0
  19. package/ios/main/Stallion.m +21 -0
  20. package/ios/main/Stallion.swift +69 -0
  21. package/ios/main/StallionConstants.swift +42 -0
  22. package/ios/main/StallionDownloader.swift +124 -0
  23. package/ios/main/StallionModule.h +13 -0
  24. package/ios/main/StallionModule.m +71 -0
  25. package/ios/main/StallionUtil.swift +29 -0
  26. package/ios/noop/Stallion-Bridging-Header.h +2 -0
  27. package/ios/noop/Stallion.m +12 -0
  28. package/ios/noop/Stallion.swift +7 -0
  29. package/ios/noop/StallionModule.h +13 -0
  30. package/ios/noop/StallionModule.m +20 -0
  31. package/package.json +62 -0
  32. package/react-native-stallion.podspec +50 -0
  33. package/src/StallionNativeModule.js +5 -0
  34. package/src/StallionNativeModule.js.map +1 -0
  35. package/src/index.js +29 -0
  36. package/src/index.js.map +1 -0
  37. package/src/main/components/common/ButtonFullWidth/index.js +20 -0
  38. package/src/main/components/common/ButtonFullWidth/index.js.map +1 -0
  39. package/src/main/components/common/ButtonFullWidth/styles.js +42 -0
  40. package/src/main/components/common/ButtonFullWidth/styles.js.map +1 -0
  41. package/src/main/components/common/ErrorView/index.js +18 -0
  42. package/src/main/components/common/ErrorView/index.js.map +1 -0
  43. package/src/main/components/common/ErrorView/styles.js +20 -0
  44. package/src/main/components/common/ErrorView/styles.js.map +1 -0
  45. package/src/main/components/common/Footer/index.js +49 -0
  46. package/src/main/components/common/Footer/index.js.map +1 -0
  47. package/src/main/components/common/Footer/styles.js +76 -0
  48. package/src/main/components/common/Footer/styles.js.map +1 -0
  49. package/src/main/components/common/Header/index.js +50 -0
  50. package/src/main/components/common/Header/index.js.map +1 -0
  51. package/src/main/components/common/Header/styles.js +63 -0
  52. package/src/main/components/common/Header/styles.js.map +1 -0
  53. package/src/main/components/common/OverlayLoader/index.js +26 -0
  54. package/src/main/components/common/OverlayLoader/index.js.map +1 -0
  55. package/src/main/components/common/OverlayLoader/styles.js +33 -0
  56. package/src/main/components/common/OverlayLoader/styles.js.map +1 -0
  57. package/src/main/components/common/ProfileOverlay/index.js +39 -0
  58. package/src/main/components/common/ProfileOverlay/index.js.map +1 -0
  59. package/src/main/components/common/ProfileOverlay/styles.js +37 -0
  60. package/src/main/components/common/ProfileOverlay/styles.js.map +1 -0
  61. package/src/main/components/common/Spinner/index.js +9 -0
  62. package/src/main/components/common/Spinner/index.js.map +1 -0
  63. package/src/main/components/modules/listing/components/BucketCard.js +33 -0
  64. package/src/main/components/modules/listing/components/BucketCard.js.map +1 -0
  65. package/src/main/components/modules/listing/components/BucketCardInfoSection.js +56 -0
  66. package/src/main/components/modules/listing/components/BucketCardInfoSection.js.map +1 -0
  67. package/src/main/components/modules/listing/components/BundleCard.js +36 -0
  68. package/src/main/components/modules/listing/components/BundleCard.js.map +1 -0
  69. package/src/main/components/modules/listing/components/BundleCardInfoSection.js +72 -0
  70. package/src/main/components/modules/listing/components/BundleCardInfoSection.js.map +1 -0
  71. package/src/main/components/modules/listing/components/CardDescriptionContent.js +34 -0
  72. package/src/main/components/modules/listing/components/CardDescriptionContent.js.map +1 -0
  73. package/src/main/components/modules/listing/components/styles/index.js +65 -0
  74. package/src/main/components/modules/listing/components/styles/index.js.map +1 -0
  75. package/src/main/components/modules/listing/hooks/useListing.js +71 -0
  76. package/src/main/components/modules/listing/hooks/useListing.js.map +1 -0
  77. package/src/main/components/modules/listing/index.js +39 -0
  78. package/src/main/components/modules/listing/index.js.map +1 -0
  79. package/src/main/components/modules/listing/styles.js +12 -0
  80. package/src/main/components/modules/listing/styles.js.map +1 -0
  81. package/src/main/components/modules/login/components/Email.js +37 -0
  82. package/src/main/components/modules/login/components/Email.js.map +1 -0
  83. package/src/main/components/modules/login/components/Otp.js +41 -0
  84. package/src/main/components/modules/login/components/Otp.js.map +1 -0
  85. package/src/main/components/modules/login/components/styles/index.js +24 -0
  86. package/src/main/components/modules/login/components/styles/index.js.map +1 -0
  87. package/src/main/components/modules/login/hooks/useLoginFlow.js +60 -0
  88. package/src/main/components/modules/login/hooks/useLoginFlow.js.map +1 -0
  89. package/src/main/components/modules/login/index.js +54 -0
  90. package/src/main/components/modules/login/index.js.map +1 -0
  91. package/src/main/components/modules/login/styles/index.js +34 -0
  92. package/src/main/components/modules/login/styles/index.js.map +1 -0
  93. package/src/main/components/modules/modal/StallionModal.js +73 -0
  94. package/src/main/components/modules/modal/StallionModal.js.map +1 -0
  95. package/src/main/components/modules/modal/hooks/useStallionModal.js +92 -0
  96. package/src/main/components/modules/modal/hooks/useStallionModal.js.map +1 -0
  97. package/src/main/constants/apiConstants.js +10 -0
  98. package/src/main/constants/apiConstants.js.map +1 -0
  99. package/src/main/constants/appConstants.js +71 -0
  100. package/src/main/constants/appConstants.js.map +1 -0
  101. package/src/main/constants/colors.js +14 -0
  102. package/src/main/constants/colors.js.map +1 -0
  103. package/src/main/index.js +7 -0
  104. package/src/main/index.js.map +1 -0
  105. package/src/main/state/actionCreators/useBucketActions.js +37 -0
  106. package/src/main/state/actionCreators/useBucketActions.js.map +1 -0
  107. package/src/main/state/actionCreators/useBundleActions.js +45 -0
  108. package/src/main/state/actionCreators/useBundleActions.js.map +1 -0
  109. package/src/main/state/actionCreators/useDownloadActions.js +47 -0
  110. package/src/main/state/actionCreators/useDownloadActions.js.map +1 -0
  111. package/src/main/state/actionCreators/useMetaActions.js +19 -0
  112. package/src/main/state/actionCreators/useMetaActions.js.map +1 -0
  113. package/src/main/state/actionCreators/useUserActions.js +97 -0
  114. package/src/main/state/actionCreators/useUserActions.js.map +1 -0
  115. package/src/main/state/actions/bucketActions.js +19 -0
  116. package/src/main/state/actions/bucketActions.js.map +1 -0
  117. package/src/main/state/actions/bundleActions.js +25 -0
  118. package/src/main/state/actions/bundleActions.js.map +1 -0
  119. package/src/main/state/actions/downloadActions.js +19 -0
  120. package/src/main/state/actions/downloadActions.js.map +1 -0
  121. package/src/main/state/actions/metaActions.js +8 -0
  122. package/src/main/state/actions/metaActions.js.map +1 -0
  123. package/src/main/state/actions/userActions.js +31 -0
  124. package/src/main/state/actions/userActions.js.map +1 -0
  125. package/src/main/state/index.js +70 -0
  126. package/src/main/state/index.js.map +1 -0
  127. package/src/main/state/reducers/bucketReducer.js +36 -0
  128. package/src/main/state/reducers/bucketReducer.js.map +1 -0
  129. package/src/main/state/reducers/bundleReducer.js +47 -0
  130. package/src/main/state/reducers/bundleReducer.js.map +1 -0
  131. package/src/main/state/reducers/downloadReducer.js +39 -0
  132. package/src/main/state/reducers/downloadReducer.js.map +1 -0
  133. package/src/main/state/reducers/metaReducer.js +17 -0
  134. package/src/main/state/reducers/metaReducer.js.map +1 -0
  135. package/src/main/state/reducers/userReducer.js +70 -0
  136. package/src/main/state/reducers/userReducer.js.map +1 -0
  137. package/src/main/utils/ErrorBoundary.js +13 -0
  138. package/src/main/utils/ErrorBoundary.js.map +1 -0
  139. package/src/main/utils/SharedDataManager.js +25 -0
  140. package/src/main/utils/SharedDataManager.js.map +1 -0
  141. package/src/main/utils/StallionNaitveUtils.js +7 -0
  142. package/src/main/utils/StallionNaitveUtils.js.map +1 -0
  143. package/src/main/utils/apiUtils.js +16 -0
  144. package/src/main/utils/apiUtils.js.map +1 -0
  145. package/src/main/utils/dateUtil.js +39 -0
  146. package/src/main/utils/dateUtil.js.map +1 -0
  147. package/src/main/utils/errorUtil.js +10 -0
  148. package/src/main/utils/errorUtil.js.map +1 -0
  149. package/src/main/utils/useStallionModal.js +18 -0
  150. package/src/main/utils/useStallionModal.js.map +1 -0
  151. package/src/main/utils/withStallion.js +16 -0
  152. package/src/main/utils/withStallion.js.map +1 -0
  153. package/src/nativeScripts/getStallionEnabled.js +8 -0
  154. package/src/nativeScripts/getStallionEnabled.js.map +1 -0
  155. package/src/noop/useStallionModal.js +12 -0
  156. package/src/noop/useStallionModal.js.map +1 -0
  157. package/src/noop/withStallion.js +13 -0
  158. package/src/noop/withStallion.js.map +1 -0
  159. package/src/types/bucket.types.js +7 -0
  160. package/src/types/bucket.types.js.map +1 -0
  161. package/src/types/bundle.types.js +8 -0
  162. package/src/types/bundle.types.js.map +1 -0
  163. package/src/types/download.types.js +7 -0
  164. package/src/types/download.types.js.map +1 -0
  165. package/src/types/globalProvider.types.js +2 -0
  166. package/src/types/globalProvider.types.js.map +1 -0
  167. package/src/types/meta.types.js +6 -0
  168. package/src/types/meta.types.js.map +1 -0
  169. package/src/types/user.types.js +9 -0
  170. package/src/types/user.types.js.map +1 -0
  171. package/src/types/utils.types.js +2 -0
  172. package/src/types/utils.types.js.map +1 -0
  173. package/types/StallionNativeModule.d.ts +4 -0
  174. package/types/StallionNativeModule.d.ts.map +1 -0
  175. package/types/__tests__/index.test.d.ts +1 -0
  176. package/types/__tests__/index.test.d.ts.map +1 -0
  177. package/types/index.d.ts +4 -0
  178. package/types/index.d.ts.map +1 -0
  179. package/types/main/components/common/ButtonFullWidth/index.d.ts +10 -0
  180. package/types/main/components/common/ButtonFullWidth/index.d.ts.map +1 -0
  181. package/types/main/components/common/ButtonFullWidth/styles.d.ts +39 -0
  182. package/types/main/components/common/ButtonFullWidth/styles.d.ts.map +1 -0
  183. package/types/main/components/common/ErrorView/index.d.ts +7 -0
  184. package/types/main/components/common/ErrorView/index.d.ts.map +1 -0
  185. package/types/main/components/common/ErrorView/styles.d.ts +17 -0
  186. package/types/main/components/common/ErrorView/styles.d.ts.map +1 -0
  187. package/types/main/components/common/Footer/index.d.ts +13 -0
  188. package/types/main/components/common/Footer/index.d.ts.map +1 -0
  189. package/types/main/components/common/Footer/styles.d.ts +73 -0
  190. package/types/main/components/common/Footer/styles.d.ts.map +1 -0
  191. package/types/main/components/common/Header/index.d.ts +11 -0
  192. package/types/main/components/common/Header/index.d.ts.map +1 -0
  193. package/types/main/components/common/Header/styles.d.ts +59 -0
  194. package/types/main/components/common/Header/styles.d.ts.map +1 -0
  195. package/types/main/components/common/OverlayLoader/index.d.ts +7 -0
  196. package/types/main/components/common/OverlayLoader/index.d.ts.map +1 -0
  197. package/types/main/components/common/OverlayLoader/styles.d.ts +30 -0
  198. package/types/main/components/common/OverlayLoader/styles.d.ts.map +1 -0
  199. package/types/main/components/common/ProfileOverlay/index.d.ts +10 -0
  200. package/types/main/components/common/ProfileOverlay/index.d.ts.map +1 -0
  201. package/types/main/components/common/ProfileOverlay/styles.d.ts +34 -0
  202. package/types/main/components/common/ProfileOverlay/styles.d.ts.map +1 -0
  203. package/types/main/components/common/Spinner/index.d.ts +4 -0
  204. package/types/main/components/common/Spinner/index.d.ts.map +1 -0
  205. package/types/main/components/modules/listing/components/BucketCard.d.ts +13 -0
  206. package/types/main/components/modules/listing/components/BucketCard.d.ts.map +1 -0
  207. package/types/main/components/modules/listing/components/BucketCardInfoSection.d.ts +11 -0
  208. package/types/main/components/modules/listing/components/BucketCardInfoSection.d.ts.map +1 -0
  209. package/types/main/components/modules/listing/components/BundleCard.d.ts +14 -0
  210. package/types/main/components/modules/listing/components/BundleCard.d.ts.map +1 -0
  211. package/types/main/components/modules/listing/components/BundleCardInfoSection.d.ts +12 -0
  212. package/types/main/components/modules/listing/components/BundleCardInfoSection.d.ts.map +1 -0
  213. package/types/main/components/modules/listing/components/CardDescriptionContent.d.ts +8 -0
  214. package/types/main/components/modules/listing/components/CardDescriptionContent.d.ts.map +1 -0
  215. package/types/main/components/modules/listing/components/styles/index.d.ts +62 -0
  216. package/types/main/components/modules/listing/components/styles/index.d.ts.map +1 -0
  217. package/types/main/components/modules/listing/hooks/useListing.d.ts +11 -0
  218. package/types/main/components/modules/listing/hooks/useListing.d.ts.map +1 -0
  219. package/types/main/components/modules/listing/index.d.ts +4 -0
  220. package/types/main/components/modules/listing/index.d.ts.map +1 -0
  221. package/types/main/components/modules/listing/styles.d.ts +10 -0
  222. package/types/main/components/modules/listing/styles.d.ts.map +1 -0
  223. package/types/main/components/modules/login/components/Email.d.ts +13 -0
  224. package/types/main/components/modules/login/components/Email.d.ts.map +1 -0
  225. package/types/main/components/modules/login/components/Otp.d.ts +12 -0
  226. package/types/main/components/modules/login/components/Otp.d.ts.map +1 -0
  227. package/types/main/components/modules/login/components/styles/index.d.ts +21 -0
  228. package/types/main/components/modules/login/components/styles/index.d.ts.map +1 -0
  229. package/types/main/components/modules/login/hooks/useLoginFlow.d.ts +18 -0
  230. package/types/main/components/modules/login/hooks/useLoginFlow.d.ts.map +1 -0
  231. package/types/main/components/modules/login/index.d.ts +4 -0
  232. package/types/main/components/modules/login/index.d.ts.map +1 -0
  233. package/types/main/components/modules/login/styles/index.d.ts +31 -0
  234. package/types/main/components/modules/login/styles/index.d.ts.map +1 -0
  235. package/types/main/components/modules/modal/StallionModal.d.ts +4 -0
  236. package/types/main/components/modules/modal/StallionModal.d.ts.map +1 -0
  237. package/types/main/components/modules/modal/hooks/useStallionModal.d.ts +23 -0
  238. package/types/main/components/modules/modal/hooks/useStallionModal.d.ts.map +1 -0
  239. package/types/main/constants/apiConstants.d.ts +9 -0
  240. package/types/main/constants/apiConstants.d.ts.map +1 -0
  241. package/types/main/constants/appConstants.d.ts +65 -0
  242. package/types/main/constants/appConstants.d.ts.map +1 -0
  243. package/types/main/constants/colors.d.ts +14 -0
  244. package/types/main/constants/colors.d.ts.map +1 -0
  245. package/types/main/index.d.ts +7 -0
  246. package/types/main/index.d.ts.map +1 -0
  247. package/types/main/state/actionCreators/useBucketActions.d.ts +7 -0
  248. package/types/main/state/actionCreators/useBucketActions.d.ts.map +1 -0
  249. package/types/main/state/actionCreators/useBundleActions.d.ts +8 -0
  250. package/types/main/state/actionCreators/useBundleActions.d.ts.map +1 -0
  251. package/types/main/state/actionCreators/useDownloadActions.d.ts +7 -0
  252. package/types/main/state/actionCreators/useDownloadActions.d.ts.map +1 -0
  253. package/types/main/state/actionCreators/useMetaActions.d.ts +7 -0
  254. package/types/main/state/actionCreators/useMetaActions.d.ts.map +1 -0
  255. package/types/main/state/actionCreators/useUserActions.d.ts +12 -0
  256. package/types/main/state/actionCreators/useUserActions.d.ts.map +1 -0
  257. package/types/main/state/actions/bucketActions.d.ts +5 -0
  258. package/types/main/state/actions/bucketActions.d.ts.map +1 -0
  259. package/types/main/state/actions/bundleActions.d.ts +6 -0
  260. package/types/main/state/actions/bundleActions.d.ts.map +1 -0
  261. package/types/main/state/actions/downloadActions.d.ts +5 -0
  262. package/types/main/state/actions/downloadActions.d.ts.map +1 -0
  263. package/types/main/state/actions/metaActions.d.ts +3 -0
  264. package/types/main/state/actions/metaActions.d.ts.map +1 -0
  265. package/types/main/state/actions/userActions.d.ts +7 -0
  266. package/types/main/state/actions/userActions.d.ts.map +1 -0
  267. package/types/main/state/index.d.ts +6 -0
  268. package/types/main/state/index.d.ts.map +1 -0
  269. package/types/main/state/reducers/bucketReducer.d.ts +4 -0
  270. package/types/main/state/reducers/bucketReducer.d.ts.map +1 -0
  271. package/types/main/state/reducers/bundleReducer.d.ts +4 -0
  272. package/types/main/state/reducers/bundleReducer.d.ts.map +1 -0
  273. package/types/main/state/reducers/downloadReducer.d.ts +4 -0
  274. package/types/main/state/reducers/downloadReducer.d.ts.map +1 -0
  275. package/types/main/state/reducers/metaReducer.d.ts +4 -0
  276. package/types/main/state/reducers/metaReducer.d.ts.map +1 -0
  277. package/types/main/state/reducers/userReducer.d.ts +4 -0
  278. package/types/main/state/reducers/userReducer.d.ts.map +1 -0
  279. package/types/main/utils/ErrorBoundary.d.ts +7 -0
  280. package/types/main/utils/ErrorBoundary.d.ts.map +1 -0
  281. package/types/main/utils/SharedDataManager.d.ts +14 -0
  282. package/types/main/utils/SharedDataManager.d.ts.map +1 -0
  283. package/types/main/utils/StallionNaitveUtils.d.ts +7 -0
  284. package/types/main/utils/StallionNaitveUtils.d.ts.map +1 -0
  285. package/types/main/utils/apiUtils.d.ts +7 -0
  286. package/types/main/utils/apiUtils.d.ts.map +1 -0
  287. package/types/main/utils/dateUtil.d.ts +3 -0
  288. package/types/main/utils/dateUtil.d.ts.map +1 -0
  289. package/types/main/utils/errorUtil.d.ts +10 -0
  290. package/types/main/utils/errorUtil.d.ts.map +1 -0
  291. package/types/main/utils/useStallionModal.d.ts +4 -0
  292. package/types/main/utils/useStallionModal.d.ts.map +1 -0
  293. package/types/main/utils/withStallion.d.ts +4 -0
  294. package/types/main/utils/withStallion.d.ts.map +1 -0
  295. package/types/noop/useStallionModal.d.ts +4 -0
  296. package/types/noop/useStallionModal.d.ts.map +1 -0
  297. package/types/noop/withStallion.d.ts +4 -0
  298. package/types/noop/withStallion.d.ts.map +1 -0
  299. package/types/types/bucket.types.d.ts +33 -0
  300. package/types/types/bucket.types.d.ts.map +1 -0
  301. package/types/types/bundle.types.d.ts +41 -0
  302. package/types/types/bundle.types.d.ts.map +1 -0
  303. package/types/types/download.types.d.ts +27 -0
  304. package/types/types/download.types.d.ts.map +1 -0
  305. package/types/types/globalProvider.types.d.ts +36 -0
  306. package/types/types/globalProvider.types.d.ts.map +1 -0
  307. package/types/types/meta.types.d.ts +15 -0
  308. package/types/types/meta.types.d.ts.map +1 -0
  309. package/types/types/user.types.d.ts +40 -0
  310. package/types/types/user.types.d.ts.map +1 -0
  311. package/types/types/utils.types.d.ts +26 -0
  312. package/types/types/utils.types.d.ts.map +1 -0
@@ -0,0 +1,92 @@
1
+ import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
2
+ import { GlobalContext } from '../../../../state';
3
+ import { getApiKeyNative, setApiKeyNative, toggleStallionSwitchNative } from '../../../../utils/StallionNaitveUtils';
4
+ import SharedDataManager from '../../../../utils/SharedDataManager';
5
+ const useStallionModal = () => {
6
+ var _downloadState$data2;
7
+ const {
8
+ isModalVisible,
9
+ userState,
10
+ metaState,
11
+ bucketState,
12
+ bundleState,
13
+ downloadState,
14
+ actions: {
15
+ setIsModalVisible,
16
+ setUserRequiresLogin,
17
+ selectBucket,
18
+ refreshMeta
19
+ }
20
+ } = useContext(GlobalContext);
21
+ const onBackPress = useCallback(() => {
22
+ requestAnimationFrame(() => selectBucket());
23
+ }, [selectBucket]);
24
+ const onClosePress = useCallback(() => {
25
+ requestAnimationFrame(() => setIsModalVisible(false));
26
+ }, [setIsModalVisible]);
27
+ const loginRequired = userState === null || userState === void 0 ? void 0 : userState.loginRequired;
28
+ useEffect(() => {
29
+ getApiKeyNative(apiKey => {
30
+ if (apiKey) {
31
+ var _SharedDataManager$ge;
32
+ (_SharedDataManager$ge = SharedDataManager.getInstance()) === null || _SharedDataManager$ge === void 0 ? void 0 : _SharedDataManager$ge.setAccessToken(apiKey);
33
+ } else {
34
+ setUserRequiresLogin(true);
35
+ }
36
+ });
37
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38
+ }, []);
39
+ const isBackEnabled = useMemo(() => bundleState.selectedBucketId ? true : false, [bundleState.selectedBucketId]);
40
+ const activeBucketMeta = useMemo(() => {
41
+ var _bucketState$data, _bucketState$data$fil, _bucketState$data$fil2;
42
+ const bucketName = ((_bucketState$data = bucketState.data) === null || _bucketState$data === void 0 ? void 0 : (_bucketState$data$fil = _bucketState$data.filter(bucketData => bucketData.id === metaState.activeBucket)) === null || _bucketState$data$fil === void 0 ? void 0 : (_bucketState$data$fil2 = _bucketState$data$fil[0]) === null || _bucketState$data$fil2 === void 0 ? void 0 : _bucketState$data$fil2.name) || '';
43
+ return {
44
+ bucketName,
45
+ version: metaState.activeVersion || ''
46
+ };
47
+ }, [metaState.activeBucket, metaState.activeVersion, bucketState.data]);
48
+ const toggleStallionSwitch = useCallback(() => {
49
+ toggleStallionSwitchNative(!metaState.switchState);
50
+ refreshMeta();
51
+ }, [metaState.switchState, refreshMeta]);
52
+ const isDownloading = useMemo(() => downloadState.isLoading, [downloadState.isLoading]);
53
+ const downloadProgress = useMemo(() => {
54
+ var _downloadState$data;
55
+ return ((_downloadState$data = downloadState.data) === null || _downloadState$data === void 0 ? void 0 : _downloadState$data.currentProgress) || 0;
56
+ }, [(_downloadState$data2 = downloadState.data) === null || _downloadState$data2 === void 0 ? void 0 : _downloadState$data2.currentProgress]);
57
+ const downloadError = useMemo(() => downloadState.error, [downloadState.error]);
58
+ const [showProfileSection, setShowProfileSection] = useState(false);
59
+ const closeProfileSection = useCallback(() => {
60
+ setShowProfileSection(false);
61
+ }, []);
62
+ const presentProfileSection = useCallback(() => {
63
+ setShowProfileSection(true);
64
+ }, []);
65
+ const performLogout = useCallback(() => {
66
+ var _SharedDataManager$ge2;
67
+ closeProfileSection();
68
+ setApiKeyNative('');
69
+ (_SharedDataManager$ge2 = SharedDataManager.getInstance()) === null || _SharedDataManager$ge2 === void 0 ? void 0 : _SharedDataManager$ge2.setAccessToken('');
70
+ setUserRequiresLogin(true);
71
+ }, [setUserRequiresLogin, closeProfileSection]);
72
+ return {
73
+ isModalVisible,
74
+ onBackPress,
75
+ onClosePress,
76
+ loginRequired,
77
+ metaState,
78
+ isBackEnabled,
79
+ activeBucketMeta,
80
+ toggleStallionSwitch,
81
+ isDownloading,
82
+ downloadProgress,
83
+ downloadError,
84
+ userState,
85
+ showProfileSection,
86
+ closeProfileSection,
87
+ presentProfileSection,
88
+ performLogout
89
+ };
90
+ };
91
+ export default useStallionModal;
92
+ //# sourceMappingURL=useStallionModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useContext","useEffect","useMemo","useState","GlobalContext","getApiKeyNative","setApiKeyNative","toggleStallionSwitchNative","SharedDataManager","useStallionModal","_downloadState$data2","isModalVisible","userState","metaState","bucketState","bundleState","downloadState","actions","setIsModalVisible","setUserRequiresLogin","selectBucket","refreshMeta","onBackPress","requestAnimationFrame","onClosePress","loginRequired","apiKey","_SharedDataManager$ge","getInstance","setAccessToken","isBackEnabled","selectedBucketId","activeBucketMeta","_bucketState$data","_bucketState$data$fil","_bucketState$data$fil2","bucketName","data","filter","bucketData","id","activeBucket","name","version","activeVersion","toggleStallionSwitch","switchState","isDownloading","isLoading","downloadProgress","_downloadState$data","currentProgress","downloadError","error","showProfileSection","setShowProfileSection","closeProfileSection","presentProfileSection","performLogout","_SharedDataManager$ge2"],"sourceRoot":"../../../../../../../src","sources":["main/components/modules/modal/hooks/useStallionModal.ts"],"mappings":"AAAA,SAASA,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAE7E,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SACEC,eAAe,EACfC,eAAe,EACfC,0BAA0B,QACrB,uCAAuC;AAC9C,OAAOC,iBAAiB,MAAM,qCAAqC;AAEnE,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EAAA,IAAAC,oBAAA;EAC7B,MAAM;IACJC,cAAc;IACdC,SAAS;IACTC,SAAS;IACTC,WAAW;IACXC,WAAW;IACXC,aAAa;IACbC,OAAO,EAAE;MACPC,iBAAiB;MACjBC,oBAAoB;MACpBC,YAAY;MACZC;IACF;EACF,CAAC,GAAGrB,UAAU,CAACI,aAAa,CAAC;EAC7B,MAAMkB,WAAW,GAAGvB,WAAW,CAAC,MAAM;IACpCwB,qBAAqB,CAAC,MAAMH,YAAY,CAA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,sBAAA;IACtCH,mBAAmB,CAAC,CAAC;IACrBlD,eAAe,CAAC,EAAE,CAAC;IACnB,CAAAqD,sBAAA,GAAAnD,iBAAiB,CAACoB,WAAW,CAAC,CAAC,cAAA+B,sBAAA,uBAA/BA,sBAAA,CAAiC9B,cAAc,CAAC,EAAE,CAAC;IACnDV,oBAAoB,CAAC,IAAI,CAAC;EAC5B,CAAC,EAAE,CAACA,oBAAoB,EAAEqC,mBAAmB,CAAC,CAAC;EAE/C,OAAO;IACL7C,cAAc;IACdW,WAAW;IACXE,YAAY;IACZC,aAAa;IACbZ,SAAS;IACTiB,aAAa;IACbE,gBAAgB;IAChBa,oBAAoB;IACpBE,aAAa;IACbE,gBAAgB;IAChBG,aAAa;IACbxC,SAAS;IACT0C,kBAAkB;IAClBE,mBAAmB;IACnBC,qBAAqB;IACrBC;EACF,CAAC;AACH,CAAC;AAED,eAAejD,gBAAgB"}
@@ -0,0 +1,10 @@
1
+ export const API_BASE_URL = 'https://stallion-api.redhorse.tech';
2
+ export let API_PATHS = /*#__PURE__*/function (API_PATHS) {
3
+ API_PATHS["LOGIN"] = "/api/v1/auth/client/login";
4
+ API_PATHS["VERIFY_OTP"] = "/api/v1/auth/verify-otp";
5
+ API_PATHS["FETCH_BUCKETS"] = "/api/v1/bucket/list";
6
+ API_PATHS["FETCH_BUNDLES"] = "/api/v1/bundle/list";
7
+ API_PATHS["USER_PROFILE"] = "/api/v1/auth/user-profile";
8
+ return API_PATHS;
9
+ }({});
10
+ //# sourceMappingURL=apiConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["API_BASE_URL","API_PATHS"],"sourceRoot":"../../../../src","sources":["main/constants/apiConstants.ts"],"mappings":"AAAA,OAAO,MAAMA,YAAY,GAAG,oCAAoC;AAEhE,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA"}
@@ -0,0 +1,71 @@
1
+ import { Platform } from 'react-native';
2
+ export const HEADER_TITLE = 'Stallion';
3
+ export const Login_TITLE = 'Stallion';
4
+ export const PROFILE_TITLE = 'Profile';
5
+ export const HEADER_SLAB_HEIGHT = 50;
6
+ export const STD_MARGIN = HEADER_SLAB_HEIGHT / 5;
7
+ export const CLOSE_BUTTON_TEXT = 'close';
8
+ export const BACK_BUTTON_TEXT = 'back';
9
+ export const DOWNLOAD_BUTTON_TEXT = 'Download';
10
+ export const DOWNLOADED_TEXT = 'Downloaded';
11
+ export const LOGOUT_BUTTON_TEXT = 'Logout';
12
+ export const FOOTER_INFO_TITLE = 'Active Bucket: ';
13
+ export const FOOTER_INFO_SUBTITLE = 'Version: ';
14
+ export let SWITCH_TEXTS = /*#__PURE__*/function (SWITCH_TEXTS) {
15
+ SWITCH_TEXTS["ON"] = "Enabled";
16
+ SWITCH_TEXTS["OFF"] = "Disabled";
17
+ return SWITCH_TEXTS;
18
+ }({});
19
+ export const SWITCH_TITLE = 'Switch ';
20
+ export const BUCKET_CARD_UPDATED_TEXT = 'Updated at: ';
21
+ export const BUCKET_CARD_BUNDLE_COUNT_TEXT = 'Bundles: ';
22
+ export const BUCKET_CARD_AUTHOR_TEXT = 'Author: ';
23
+ export const BUNDLE_CARD_RELEASE_NOTE = 'Release Note: ';
24
+ export const BUNDLE_CARD_AUTHOR = 'Author';
25
+ export const DOWNLOAD_PROGRESS_EVENT = 'StallionDownloadProgress';
26
+ export const DEFAULT_ERROR_MESSAGE = 'Something went wrong. Check your network connection';
27
+ export const EMPTY_ERROR_MESSAGE = 'No buckets found';
28
+ export const EMPTY_ERROR_MESSAGE_BUNDLE = 'No bundles found';
29
+ export const EMPTY_DOWNLOAD_MESSAGE = 'No bundle is downloaded yet';
30
+ export const DEFAULT_ERROR_PREFIX = 'Error: ';
31
+ export const VERSION_PREFIX = 'V';
32
+ export const IS_ANDROID = Platform.OS === 'android';
33
+ export const KEYBOARD_AVOIDING_BEHAVIOUR = IS_ANDROID ? 'height' : 'padding';
34
+ export let LOGIN_PAGE_KEYS = /*#__PURE__*/function (LOGIN_PAGE_KEYS) {
35
+ LOGIN_PAGE_KEYS["email"] = "Email";
36
+ LOGIN_PAGE_KEYS["password"] = "Password";
37
+ return LOGIN_PAGE_KEYS;
38
+ }({});
39
+ export let CARD_TYPES = /*#__PURE__*/function (CARD_TYPES) {
40
+ CARD_TYPES["BUNDLE"] = "BUNDLE";
41
+ CARD_TYPES["BUCKET"] = "BUCKET";
42
+ return CARD_TYPES;
43
+ }({});
44
+ export const BUNDLE_APPLIED_TEXT = 'Applied';
45
+ export const DOWNLOADING_TEXT = 'Downloading';
46
+ export const EMPTY_STATE = {
47
+ data: null,
48
+ isLoading: false,
49
+ error: null
50
+ };
51
+ export const OTP_LENGTH = 6;
52
+ export const SUBMIT_BUTTON_TEXT = 'SUBMIT';
53
+ export const OTP_BACK_BUTTON_TEXT = 'BACK';
54
+ export const OTP_INPUT_KEY = 'Enter OTP';
55
+ export const NOT_APPLICABLE_TEXT = 'N/A';
56
+ export let BUCKET_CARD_TEXTS = /*#__PURE__*/function (BUCKET_CARD_TEXTS) {
57
+ BUCKET_CARD_TEXTS["DOWNLOADED"] = "Downloaded";
58
+ BUCKET_CARD_TEXTS["APPLIED"] = "Applied";
59
+ BUCKET_CARD_TEXTS["VERSION"] = "Version";
60
+ BUCKET_CARD_TEXTS["BUNDLES"] = "Bundles";
61
+ BUCKET_CARD_TEXTS["UPDATED"] = "Updated";
62
+ return BUCKET_CARD_TEXTS;
63
+ }({});
64
+ export let SWITCH_STATE_KEYS = /*#__PURE__*/function (SWITCH_STATE_KEYS) {
65
+ SWITCH_STATE_KEYS["Enabled"] = "True";
66
+ SWITCH_STATE_KEYS["Disabled"] = "False";
67
+ return SWITCH_STATE_KEYS;
68
+ }({});
69
+ export const NO_RELEASE_NOTE_TEXT = 'No release note provided';
70
+ export const STALLION_LOGO_URL = 'https://d2shjbuzwp1rpv.cloudfront.net/stallion_logo.png';
71
+ //# sourceMappingURL=appConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","HEADER_TITLE","Login_TITLE","PROFILE_TITLE","HEADER_SLAB_HEIGHT","STD_MARGIN","CLOSE_BUTTON_TEXT","BACK_BUTTON_TEXT","DOWNLOAD_BUTTON_TEXT","DOWNLOADED_TEXT","LOGOUT_BUTTON_TEXT","FOOTER_INFO_TITLE","FOOTER_INFO_SUBTITLE","SWITCH_TEXTS","SWITCH_TITLE","BUCKET_CARD_UPDATED_TEXT","BUCKET_CARD_BUNDLE_COUNT_TEXT","BUCKET_CARD_AUTHOR_TEXT","BUNDLE_CARD_RELEASE_NOTE","BUNDLE_CARD_AUTHOR","DOWNLOAD_PROGRESS_EVENT","DEFAULT_ERROR_MESSAGE","EMPTY_ERROR_MESSAGE","EMPTY_ERROR_MESSAGE_BUNDLE","EMPTY_DOWNLOAD_MESSAGE","DEFAULT_ERROR_PREFIX","VERSION_PREFIX","IS_ANDROID","OS","KEYBOARD_AVOIDING_BEHAVIOUR","LOGIN_PAGE_KEYS","CARD_TYPES","BUNDLE_APPLIED_TEXT","DOWNLOADING_TEXT","EMPTY_STATE","data","isLoading","error","OTP_LENGTH","SUBMIT_BUTTON_TEXT","OTP_BACK_BUTTON_TEXT","OTP_INPUT_KEY","NOT_APPLICABLE_TEXT","BUCKET_CARD_TEXTS","SWITCH_STATE_KEYS","NO_RELEASE_NOTE_TEXT","STALLION_LOGO_URL"],"sourceRoot":"../../../../src","sources":["main/constants/appConstants.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,YAAY,GAAG,UAAU;AACtC,OAAO,MAAMC,WAAW,GAAG,UAAU;AACrC,OAAO,MAAMC,aAAa,GAAG,SAAS;AACtC,OAAO,MAAMC,kBAAkB,GAAG,EAAE;AACpC,OAAO,MAAMC,UAAU,GAAGD,kBAAkB,GAAG,CAAC;AAEhD,OAAO,MAAME,iBAAiB,GAAG,OAAO;AACxC,OAAO,MAAMC,gBA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AAE7C,OAAO,MAAMC,WAAW,GAAG;EACzBC,IAAI,EAAE,IAAI;EACVC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE;AACT,CAAC;AAED,OAAO,MAAMC,UAAU,GAAG,CAAC;AAE3B,OAAO,MAAMC,kBAAkB,GAAG,QAAQ;AAC1C,OAAO,MAAMC,oBAAoB,GAAG,MAAM;AAC1C,OAAO,MAAMC,aAAa,GAAG,WAAW;AAExC,OAAO,MAAMC,mBAAmB,GAAG,KAAK;AAExC,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAQ7B,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAK7B,OAAO,MAAMC,oBAAoB,GAAG,0BAA0B;AAE9D,OAAO,MAAMC,iBAAiB,GAC5B,yDAAyD"}
@@ -0,0 +1,14 @@
1
+ export const COLORS = {
2
+ indigo: '#4f46e5',
3
+ white: '#ffffff',
4
+ black: '#000000',
5
+ background_grey: '#f2f2f4',
6
+ error: '#ef5350',
7
+ green: '#016e03',
8
+ red: '#d60027',
9
+ black7: 'rgba(0,0,0,0.7)',
10
+ black2: 'rgba(0,0,0,0.2)',
11
+ orange: 'orange',
12
+ blue: 'blue'
13
+ };
14
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COLORS","indigo","white","black","background_grey","error","green","red","black7","black2","orange","blue"],"sourceRoot":"../../../../src","sources":["main/constants/colors.ts"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,MAAM,EAAE,SAAS;EACjBC,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE,SAAS;EAChBC,eAAe,EAAE,SAAS;EAC1BC,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE,SAAS;EAChBC,GAAG,EAAE,SAAS;EACdC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE;AACR,CAAC"}
@@ -0,0 +1,7 @@
1
+ import withStallion from '../main/utils/withStallion';
2
+ import useStallionModal from '../main/utils/useStallionModal';
3
+ export default {
4
+ withStallion,
5
+ useStallionModal
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withStallion","useStallionModal"],"sourceRoot":"../../../src","sources":["main/index.ts"],"mappings":"AAAA,OAAOA,YAAY,MAAM,4BAA4B;AACrD,OAAOC,gBAAgB,MAAM,gCAAgC;AAE7D,eAAe;EACbD,YAAY;EACZC;AACF,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { useCallback } from 'react';
2
+ import SharedDataManager from '../../utils/SharedDataManager';
3
+ import { extractError } from '../../utils/errorUtil';
4
+ import { apiAuthMiddleware, getApiHeaders } from '../../utils/apiUtils';
5
+ import { setBucketData, setBucketError, setBucketLoading } from '../actions/bucketActions';
6
+ import { DEFAULT_ERROR_MESSAGE, EMPTY_ERROR_MESSAGE } from '../../constants/appConstants';
7
+ import { API_BASE_URL, API_PATHS } from '../../constants/apiConstants';
8
+ const useBucketActions = (dispatch, setUserRequiresLogin) => {
9
+ const dataManager = SharedDataManager.getInstance();
10
+ const fetchBuckets = useCallback(() => {
11
+ dispatch(setBucketLoading());
12
+ fetch(API_BASE_URL + API_PATHS.FETCH_BUCKETS, {
13
+ method: 'POST',
14
+ body: JSON.stringify({
15
+ projectId: dataManager === null || dataManager === void 0 ? void 0 : dataManager.getProjectId()
16
+ }),
17
+ headers: getApiHeaders()
18
+ }).then(res => apiAuthMiddleware(res, setUserRequiresLogin)).then(bucketResponse => {
19
+ if (bucketResponse !== null && bucketResponse !== void 0 && bucketResponse.data) {
20
+ if (bucketResponse.data.length) {
21
+ dispatch(setBucketData(bucketResponse.data));
22
+ } else {
23
+ dispatch(setBucketError(EMPTY_ERROR_MESSAGE));
24
+ }
25
+ } else {
26
+ dispatch(setBucketError(extractError(bucketResponse)));
27
+ }
28
+ }).catch(_ => {
29
+ dispatch(setBucketError(DEFAULT_ERROR_MESSAGE));
30
+ });
31
+ }, [dispatch, dataManager, setUserRequiresLogin]);
32
+ return {
33
+ fetchBuckets
34
+ };
35
+ };
36
+ export default useBucketActions;
37
+ //# sourceMappingURL=useBucketActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","SharedDataManager","extractError","apiAuthMiddleware","getApiHeaders","setBucketData","setBucketError","setBucketLoading","DEFAULT_ERROR_MESSAGE","EMPTY_ERROR_MESSAGE","API_BASE_URL","API_PATHS","useBucketActions","dispatch","setUserRequiresLogin","dataManager","getInstance","fetchBuckets","fetch","FETCH_BUCKETS","method","body","JSON","stringify","projectId","getProjectId","headers","then","res","bucketResponse","data","length","catch","_"],"sourceRoot":"../../../../../src","sources":["main/state/actionCreators/useBucketActions.ts"],"mappings":"AAAA,SAAgBA,WAAW,QAAQ,OAAO;AAE1C,OAAOC,iBAAiB,MAAM,+BAA+B;AAC7D,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,sBAAsB;AACvE,SACEC,aAAa,EACbC,cAAc,EACdC,gBAAgB,QACX,0BAA0B;AAEjC,SACEC,qBAAqB,EACrBC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,YAAY,EAAEC,SAAS,QAAQ,8BAA8B;AAGtE,MAAMC,gBAAgB,GAAGA,CACvBC,QAAuC,EACvCC,oBAAsD,KACnD;EACH,MAAMC,WAAW,GAAGd,iBAAiB,CAACe,WAAW,CAAC,CAAC;EACnD,MAAMC,YAAY,GAAGjB,WAAW,CAAC,MAAM;IACrCa,QAAQ,CAACN,gBAAgB,CAAC,CAAC,CAAC;IAC5BW,KAAK,CAACR,YAAY,GAAGC,SAAS,CAACQ,aAAa,EAAE;MAC5CC,MAAM,EAAE,MAAM;MACdC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;QACnBC,SAAS,EAAET,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEU,YAAY,CAAC;MACvC,CAAC,CAAC;MACFC,OAAO,EAAEtB,aAAa,CAAC;IACzB,CAAC,CAAC,CACCuB,IAAI,CAAEC,GAAG,IAAKzB,iBAAiB,CAACyB,GAAG,EAAEd,oBAAoB,CAAC,CAAC,CAC3Da,IAAI,CAAEE,cAAc,IAAK;MACxB,IAAIA,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAEC,IAAI,EAAE;QACxB,IAAID,cAAc,CAACC,IAAI,CAACC,MAAM,EAAE;UAC9BlB,QAAQ,CAACR,aAAa,CAACwB,cAAc,CAACC,IAAuB,CAAC,CAAC;QACjE,CAAC,MAAM;UACLjB,QAAQ,CAACP,cAAc,CAACG,mBAAmB,CAAC,CAAC;QAC/C;MACF,CAAC,MAAM;QACLI,QAAQ,CAACP,cAAc,CAACJ,YAAY,CAAC2B,cAAc,CAAC,CAAC,CAAC;MACxD;IACF,CAAC,CAAC,CACDG,KAAK,CAAEC,CAAC,IAAK;MACZpB,QAAQ,CAACP,cAAc,CAACE,qBAAqB,CAAC,CAAC;IACjD,CAAC,CAAC;EACN,CAAC,EAAE,CAACK,QAAQ,EAAEE,WAAW,EAAED,oBAAoB,CAAC,CAAC;EAEjD,OAAO;IACLG;EACF,CAAC;AACH,CAAC;AAED,eAAeL,gBAAgB"}
@@ -0,0 +1,45 @@
1
+ import { useCallback } from 'react';
2
+ import { API_BASE_URL, API_PATHS } from '../../constants/apiConstants';
3
+ import { apiAuthMiddleware, getApiHeaders } from '../../utils/apiUtils';
4
+ import SharedDataManager from '../../utils/SharedDataManager';
5
+ import { DEFAULT_ERROR_MESSAGE, EMPTY_ERROR_MESSAGE_BUNDLE, IS_ANDROID } from '../../constants/appConstants';
6
+ import { extractError } from '../../utils/errorUtil';
7
+ import { setBundleData, setBundleError, setBundleLoading, setSelectedBucketId } from '../actions/bundleActions';
8
+ const useBundleActions = (dispatch, bundleState, setUserRequiresLogin) => {
9
+ const dataManager = SharedDataManager.getInstance();
10
+ const fetchBundles = useCallback(bucketId => {
11
+ const selectedBucketId = bucketId || bundleState.selectedBucketId;
12
+ dispatch(setBundleLoading());
13
+ fetch(API_BASE_URL + API_PATHS.FETCH_BUNDLES, {
14
+ method: 'POST',
15
+ body: JSON.stringify({
16
+ projectId: dataManager === null || dataManager === void 0 ? void 0 : dataManager.getProjectId(),
17
+ bucketId: selectedBucketId
18
+ }),
19
+ headers: getApiHeaders()
20
+ }).then(res => apiAuthMiddleware(res, setUserRequiresLogin)).then(bundleResponse => {
21
+ var _bundleResponse$data, _bundleResponse$data2;
22
+ const bundlesData = IS_ANDROID ? bundleResponse === null || bundleResponse === void 0 ? void 0 : (_bundleResponse$data = bundleResponse.data) === null || _bundleResponse$data === void 0 ? void 0 : _bundleResponse$data.androidBundles : bundleResponse === null || bundleResponse === void 0 ? void 0 : (_bundleResponse$data2 = bundleResponse.data) === null || _bundleResponse$data2 === void 0 ? void 0 : _bundleResponse$data2.iosBundles;
23
+ if (bundlesData) {
24
+ if (bundlesData.length) {
25
+ dispatch(setBundleData(bundlesData));
26
+ } else {
27
+ dispatch(setBundleError(EMPTY_ERROR_MESSAGE_BUNDLE));
28
+ }
29
+ } else {
30
+ dispatch(setBundleError(extractError(bundleResponse)));
31
+ }
32
+ }).catch(_ => {
33
+ dispatch(setBundleError(DEFAULT_ERROR_MESSAGE));
34
+ });
35
+ }, [dispatch, dataManager, bundleState.selectedBucketId, setUserRequiresLogin]);
36
+ const selectBucket = useCallback(selectedBucketId => {
37
+ dispatch(setSelectedBucketId(selectedBucketId));
38
+ }, [dispatch]);
39
+ return {
40
+ fetchBundles,
41
+ selectBucket
42
+ };
43
+ };
44
+ export default useBundleActions;
45
+ //# sourceMappingURL=useBundleActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","API_BASE_URL","API_PATHS","apiAuthMiddleware","getApiHeaders","SharedDataManager","DEFAULT_ERROR_MESSAGE","EMPTY_ERROR_MESSAGE_BUNDLE","IS_ANDROID","extractError","setBundleData","setBundleError","setBundleLoading","setSelectedBucketId","useBundleActions","dispatch","bundleState","setUserRequiresLogin","dataManager","getInstance","fetchBundles","bucketId","selectedBucketId","fetch","FETCH_BUNDLES","method","body","JSON","stringify","projectId","getProjectId","headers","then","res","bundleResponse","_bundleResponse$data","_bundleResponse$data2","bundlesData","data","androidBundles","iosBundles","length","catch","_","selectBucket"],"sourceRoot":"../../../../../src","sources":["main/state/actionCreators/useBundleActions.ts"],"mappings":"AAAA,SAAgBA,WAAW,QAAQ,OAAO;AAE1C,SAASC,YAAY,EAAEC,SAAS,QAAQ,8BAA8B;AACtE,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,sBAAsB;AACvE,OAAOC,iBAAiB,MAAM,+BAA+B;AAE7D,SACEC,qBAAqB,EACrBC,0BAA0B,EAC1BC,UAAU,QACL,8BAA8B;AACrC,SAASC,YAAY,QAAQ,uBAAuB;AAMpD,SACEC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,mBAAmB,QACd,0BAA0B;AAEjC,MAAMC,gBAAgB,GAAGA,CACvBC,QAAuC,EACvCC,WAAyB,EACzBC,oBAAsD,KACnD;EACH,MAAMC,WAAW,GAAGb,iBAAiB,CAACc,WAAW,CAAC,CAAC;EACnD,MAAMC,YAAY,GAAGpB,WAAW,CAC7BqB,QAAwB,IAAK;IAC5B,MAAMC,gBAAgB,GAAGD,QAAQ,IAAIL,WAAW,CAACM,gBAAgB;IACjEP,QAAQ,CAACH,gBAAgB,CAAC,CAAC,CAAC;IAC5BW,KAAK,CAACtB,YAAY,GAAGC,SAAS,CAACsB,aAAa,EAAE;MAC5CC,MAAM,EAAE,MAAM;MACdC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;QACnBC,SAAS,EAAEX,WAAW,aAAXA,WAAW,uBAAXA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B;EACF,CAAC;AACH,CAAC;AAED,eAAe9B,gBAAgB"}
@@ -0,0 +1,47 @@
1
+ import { useEffect, useCallback } from 'react';
2
+ import { NativeEventEmitter } from 'react-native';
3
+ import SharedDataManager from '../../utils/SharedDataManager';
4
+ import StallionNativeModule from '../../../StallionNativeModule';
5
+ import { downloadBundleNative } from '../../utils/StallionNaitveUtils';
6
+ import { setDownloadData, setDownloadError, setDownloadLoading } from '../actions/downloadActions';
7
+ import { DOWNLOAD_PROGRESS_EVENT } from '../../constants/appConstants';
8
+ const useDownloadActions = (dispatch, refreshStallionMeta) => {
9
+ const dataManager = SharedDataManager.getInstance();
10
+ const downloadBundle = useCallback((version, bucketId) => {
11
+ dispatch(setDownloadLoading());
12
+ const projectId = (dataManager === null || dataManager === void 0 ? void 0 : dataManager.getProjectId()) || '';
13
+ requestAnimationFrame(() => {
14
+ downloadBundleNative({
15
+ projectId,
16
+ bucketId,
17
+ version
18
+ }).then(_ => {
19
+ dispatch(setDownloadData({
20
+ currentProgress: 1
21
+ }));
22
+ refreshStallionMeta();
23
+ }).catch(err => {
24
+ dispatch(setDownloadError(err.toString()));
25
+ });
26
+ });
27
+ }, [dispatch, dataManager, refreshStallionMeta]);
28
+ useEffect(() => {
29
+ const eventEmitter = new NativeEventEmitter(StallionNativeModule);
30
+ eventEmitter.addListener(DOWNLOAD_PROGRESS_EVENT, downloadFraction => {
31
+ if (downloadFraction) {
32
+ dispatch(setDownloadData({
33
+ currentProgress: downloadFraction
34
+ }));
35
+ }
36
+ });
37
+ return () => {
38
+ eventEmitter.removeAllListeners(DOWNLOAD_PROGRESS_EVENT);
39
+ };
40
+ // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ }, []);
42
+ return {
43
+ downloadBundle
44
+ };
45
+ };
46
+ export default useDownloadActions;
47
+ //# sourceMappingURL=useDownloadActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useCallback","NativeEventEmitter","SharedDataManager","StallionNativeModule","downloadBundleNative","setDownloadData","setDownloadError","setDownloadLoading","DOWNLOAD_PROGRESS_EVENT","useDownloadActions","dispatch","refreshStallionMeta","dataManager","getInstance","downloadBundle","version","bucketId","projectId","getProjectId","requestAnimationFrame","then","_","currentProgress","catch","err","toString","eventEmitter","addListener","downloadFraction","removeAllListeners"],"sourceRoot":"../../../../../src","sources":["main/state/actionCreators/useDownloadActions.ts"],"mappings":"AAAA,SAAgBA,SAAS,EAAEC,WAAW,QAAQ,OAAO;AACrD,SAASC,kBAAkB,QAAQ,cAAc;AAEjD,OAAOC,iBAAiB,MAAM,+BAA+B;AAC7D,OAAOC,oBAAoB,MAAM,+BAA+B;AAChE,SAASC,oBAAoB,QAAQ,iCAAiC;AACtE,SACEC,eAAe,EACfC,gBAAgB,EAChBC,kBAAkB,QACb,4BAA4B;AAEnC,SAASC,uBAAuB,QAAQ,8BAA8B;AAGtE,MAAMC,kBAAkB,GAAGA,CACzBC,QAAyC,EACzCC,mBAA+B,KAC5B;EACH,MAAMC,WAAW,GAAGV,iBAAiB,CAACW,WAAW,CAAC,CAAC;EACnD,MAAMC,cAAc,GAAGd,WAAW,CAChC,CAACe,OAAe,EAAEC,QAAgB,KAAK;IACrCN,QAAQ,CAACH,kBAAkB,CAAC,CAAC,CAAC;IAC9B,MAAMU,SAAS,GAAG,CAAAL,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEM,YAAY,CAAC,CAAC,KAAI,EAAE;IACnDC,qBAAqB,CAAC,MAAM;MAC1Bf,oBAAoB,CAAC;QACnBa,SAAS;QACTD,QAAQ;QACRD;MACF,CAAC,CAAC,CACCK,IAAI,CAAEC,CAAC,IAAK;QACXX,QAAQ,CACNL,eAAe,CAAC;UACdiB,eAAe,EAAE;QACnB,CAAC,CACH,CAAC;QACDX,mBAAmB,CAAC,CAAC;MACvB,CAAC,CAAC,CACDY,KAAK,CAAEC,GAAG,IAAK;QACdd,QAAQ,CAACJ,gBAAgB,CAACkB,GAAG,CAACC,QAAQ,CAAC,CAAC,CAAC,CAAC;MAC5C,CAAC,CAAC;IACN,CAAC,CAAC;EACJ,CAAC,EACD,CAACf,QAAQ,EAAEE,WAAW,EAAED,mBAAmB,CAC7C,CAAC;EAEDZ,SAAS,CAAC,MAAM;IACd,MAAM2B,YAAY,GAAG,IAAIzB,kBAAkB,CAACE,oBAAoB,CAAC;IACjEuB,YAAY,CAACC,WAAW,CACtBnB,uBAAuB,EACtBoB,gBAAwB,IAAK;MAC5B,IAAIA,gBAAgB,EAAE;QACpBlB,QAAQ,CACNL,eAAe,CAAC;UACdiB,eAAe,EAAEM;QACnB,CAAC,CACH,CAAC;MACH;IACF,CACF,CAAC;IACD,OAAO,MAAM;MACXF,YAAY,CAACG,kBAAkB,CAACrB,uBAAuB,CAAC;IAC1D,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACLM;EACF,CAAC;AACH,CAAC;AAED,eAAeL,kBAAkB"}
@@ -0,0 +1,19 @@
1
+ import { useCallback, useEffect } from 'react';
2
+ import { getStallionMeta } from '../../utils/StallionNaitveUtils';
3
+ import { setMeta } from '../actions/metaActions';
4
+ const useMetaActions = dispatch => {
5
+ const refreshMeta = useCallback(() => {
6
+ getStallionMeta(meta => {
7
+ dispatch(setMeta(meta));
8
+ });
9
+ }, [dispatch]);
10
+ useEffect(() => {
11
+ refreshMeta();
12
+ // eslint-disable-next-line react-hooks/exhaustive-deps
13
+ }, []);
14
+ return {
15
+ refreshMeta
16
+ };
17
+ };
18
+ export default useMetaActions;
19
+ //# sourceMappingURL=useMetaActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","getStallionMeta","setMeta","useMetaActions","dispatch","refreshMeta","meta"],"sourceRoot":"../../../../../src","sources":["main/state/actionCreators/useMetaActions.ts"],"mappings":"AAAA,SAAgBA,WAAW,EAAEC,SAAS,QAAQ,OAAO;AAErD,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,OAAO,QAAQ,wBAAwB;AAIhD,MAAMC,cAAc,GAAIC,QAAqC,IAAK;EAChE,MAAMC,WAAW,GAAGN,WAAW,CAAC,MAAM;IACpCE,eAAe,CAAEK,IAAI,IAAK;MACxBF,QAAQ,CAACF,OAAO,CAACI,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;EACJ,CAAC,EAAE,CAACF,QAAQ,CAAC,CAAC;EAEdJ,SAAS,CAAC,MAAM;IACdK,WAAW,CAAC,CAAC;IACb;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACLA;EACF,CAAC;AACH,CAAC;AAED,eAAeF,cAAc"}
@@ -0,0 +1,97 @@
1
+ import { useCallback } from 'react';
2
+ import SharedDataManager from '../../utils/SharedDataManager';
3
+ import { DEFAULT_ERROR_MESSAGE } from '../../constants/appConstants';
4
+ import { extractError } from '../../utils/errorUtil';
5
+ import { setRequiresLogin, setTempOtp, setUserData, setUserError } from '../../state/actions/userActions';
6
+ import { apiAuthMiddleware, getApiHeaders } from '../../utils/apiUtils';
7
+ import { setUserLoading } from '../../state/actions/userActions';
8
+ import { API_BASE_URL, API_PATHS } from '../../constants/apiConstants';
9
+ import { setApiKeyNative } from '../../utils/StallionNaitveUtils';
10
+ const useUserActions = (dispatch, userState) => {
11
+ const dataManager = SharedDataManager.getInstance();
12
+ const setUserRequiresLogin = useCallback(requiresLogin => {
13
+ dispatch(setUserData({}));
14
+ dispatch(setRequiresLogin(requiresLogin));
15
+ }, [dispatch]);
16
+ const loginUser = useCallback(loginPayload => {
17
+ dispatch(setUserLoading());
18
+ fetch(API_BASE_URL + API_PATHS.LOGIN, {
19
+ method: 'POST',
20
+ body: JSON.stringify({
21
+ ...loginPayload,
22
+ projectId: dataManager === null || dataManager === void 0 ? void 0 : dataManager.getProjectId()
23
+ }),
24
+ headers: getApiHeaders()
25
+ }).then(res => res.json()).then(loginResponse => {
26
+ var _loginResponse$data;
27
+ const otpToken = loginResponse === null || loginResponse === void 0 ? void 0 : (_loginResponse$data = loginResponse.data) === null || _loginResponse$data === void 0 ? void 0 : _loginResponse$data.otpToken;
28
+ if (otpToken) {
29
+ dispatch(setTempOtp(otpToken));
30
+ } else {
31
+ dispatch(setUserError(extractError(loginResponse)));
32
+ }
33
+ }).catch(_ => {
34
+ dispatch(setUserError(DEFAULT_ERROR_MESSAGE));
35
+ });
36
+ }, [dispatch, dataManager]);
37
+ const verifyOtp = useCallback(verifyOtpPayload => {
38
+ dispatch(setUserLoading());
39
+ fetch(API_BASE_URL + API_PATHS.VERIFY_OTP, {
40
+ method: 'POST',
41
+ body: JSON.stringify({
42
+ ...verifyOtpPayload,
43
+ otpToken: userState.tempOtpToken
44
+ }),
45
+ headers: getApiHeaders()
46
+ }).then(res => apiAuthMiddleware(res, setUserRequiresLogin)).then(otpResponse => {
47
+ var _otpResponse$data;
48
+ const accessToken = otpResponse === null || otpResponse === void 0 ? void 0 : (_otpResponse$data = otpResponse.data) === null || _otpResponse$data === void 0 ? void 0 : _otpResponse$data.accessToken;
49
+ if (accessToken) {
50
+ var _otpResponse$data2, _otpResponse$data2$us, _otpResponse$data3, _otpResponse$data3$us;
51
+ dataManager === null || dataManager === void 0 ? void 0 : dataManager.setAccessToken(accessToken);
52
+ setApiKeyNative(accessToken);
53
+ dispatch(setUserData({
54
+ fullName: otpResponse === null || otpResponse === void 0 ? void 0 : (_otpResponse$data2 = otpResponse.data) === null || _otpResponse$data2 === void 0 ? void 0 : (_otpResponse$data2$us = _otpResponse$data2.user) === null || _otpResponse$data2$us === void 0 ? void 0 : _otpResponse$data2$us.fullName,
55
+ email: otpResponse === null || otpResponse === void 0 ? void 0 : (_otpResponse$data3 = otpResponse.data) === null || _otpResponse$data3 === void 0 ? void 0 : (_otpResponse$data3$us = _otpResponse$data3.user) === null || _otpResponse$data3$us === void 0 ? void 0 : _otpResponse$data3$us.email
56
+ }));
57
+ dispatch(setRequiresLogin(false));
58
+ } else {
59
+ dispatch(setUserError(extractError(otpResponse)));
60
+ }
61
+ }).catch(_ => {
62
+ dispatch(setUserError(DEFAULT_ERROR_MESSAGE));
63
+ });
64
+ }, [dispatch, userState.tempOtpToken, dataManager, setUserRequiresLogin]);
65
+ const retryLogin = useCallback(() => {
66
+ dispatch(setTempOtp(null));
67
+ }, [dispatch]);
68
+ const getUserProfile = useCallback(() => {
69
+ dispatch(setUserLoading());
70
+ fetch(API_BASE_URL + API_PATHS.USER_PROFILE, {
71
+ method: 'GET',
72
+ headers: getApiHeaders()
73
+ }).then(res => res.json()).then(userProfileResponse => {
74
+ var _userProfileResponse$;
75
+ if (userProfileResponse !== null && userProfileResponse !== void 0 && (_userProfileResponse$ = userProfileResponse.data) !== null && _userProfileResponse$ !== void 0 && _userProfileResponse$.email) {
76
+ var _userProfileResponse$2, _userProfileResponse$3;
77
+ dispatch(setUserData({
78
+ fullName: userProfileResponse === null || userProfileResponse === void 0 ? void 0 : (_userProfileResponse$2 = userProfileResponse.data) === null || _userProfileResponse$2 === void 0 ? void 0 : _userProfileResponse$2.fullName,
79
+ email: userProfileResponse === null || userProfileResponse === void 0 ? void 0 : (_userProfileResponse$3 = userProfileResponse.data) === null || _userProfileResponse$3 === void 0 ? void 0 : _userProfileResponse$3.email
80
+ }));
81
+ } else {
82
+ dispatch(setUserError(extractError(userProfileResponse)));
83
+ }
84
+ }).catch(_ => {
85
+ dispatch(setUserError(DEFAULT_ERROR_MESSAGE));
86
+ });
87
+ }, [dispatch]);
88
+ return {
89
+ loginUser,
90
+ verifyOtp,
91
+ retryLogin,
92
+ setUserRequiresLogin,
93
+ getUserProfile
94
+ };
95
+ };
96
+ export default useUserActions;
97
+ //# sourceMappingURL=useUserActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","SharedDataManager","DEFAULT_ERROR_MESSAGE","extractError","setRequiresLogin","setTempOtp","setUserData","setUserError","apiAuthMiddleware","getApiHeaders","setUserLoading","API_BASE_URL","API_PATHS","setApiKeyNative","useUserActions","dispatch","userState","dataManager","getInstance","setUserRequiresLogin","requiresLogin","loginUser","loginPayload","fetch","LOGIN","method","body","JSON","stringify","projectId","getProjectId","headers","then","res","json","loginResponse","_loginResponse$data","otpToken","data","catch","_","verifyOtp","verifyOtpPayload","VERIFY_OTP","tempOtpToken","otpResponse","_otpResponse$data","accessToken","_otpResponse$data2","_otpResponse$data2$us","_otpResponse$data3","_otpResponse$data3$us","setAccessToken","fullName","user","email","retryLogin","getUserProfile","USER_PROFILE","userProfileResponse","_userProfileResponse$","_userProfileResponse$2","_userProfileResponse$3"],"sourceRoot":"../../../../../src","sources":["main/state/actionCreators/useUserActions.ts"],"mappings":"AAAA,SAAgBA,WAAW,QAAQ,OAAO;AAE1C,OAAOC,iBAAiB,MAAM,+BAA+B;AAE7D,SAASC,qBAAqB,QAAQ,8BAA8B;AACpE,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SACEC,gBAAgB,EAChBC,UAAU,EACVC,WAAW,EACXC,YAAY,QACP,iCAAiC;AACxC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,sBAAsB;AACvE,SAASC,cAAc,QAAQ,iCAAiC;AAEhE,SAASC,YAAY,EAAEC,SAAS,QAAQ,8BAA8B;AAMtE,SAASC,eAAe,QAAQ,iCAAiC;AAEjE,MAAMC,cAAc,GAAGA,CACrBC,QAAqC,EACrCC,SAAqB,KAClB;EACH,MAAMC,WAAW,GAAGhB,iBAAiB,CAACiB,WAAW,CAAC,CAAC;EAEnD,MAAMC,oBAAoB,GAAGnB,WAAW,CACrCoB,aAAsB,IAAK;IAC1BL,QAAQ,CAACT,WAAW,CAAC,CAAC,CAAc,CAAC,CAAC;IACtCS,QAAQ,CAACX,gBAAgB,CAACgB,aAAa,CAAC,CAAC;EAC3C,CAAC,EACD,CAACL,QAAQ,CACX,CAAC;EAED,MAAMM,SAAS,GAAGrB,WAAW,CAC1BsB,YAAiC,IAAK;IACrCP,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC;IAC1Ba,KAAK,CAACZ,YAAY,GAAGC,SAAS,CAACY,KAAK,EAAE;MACpCC,MAAM,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AQ,CAAC,CAAC;EAEd,OAAO;IACLM,SAAS;IACToB,SAAS;IACTe,UAAU;IACVrC,oBAAoB;IACpBsC;EACF,CAAC;AACH,CAAC;AAED,eAAe3C,cAAc"}
@@ -0,0 +1,19 @@
1
+ import { BucketActionKind } from '../../../types/bucket.types';
2
+ export const setBucketLoading = () => {
3
+ return {
4
+ type: BucketActionKind.SET_BUCKET_LOADING
5
+ };
6
+ };
7
+ export const setBucketData = bucketData => {
8
+ return {
9
+ type: BucketActionKind.SET_BUCKET_DATA,
10
+ payload: bucketData
11
+ };
12
+ };
13
+ export const setBucketError = errorString => {
14
+ return {
15
+ type: BucketActionKind.SET_BUCKET_ERROR,
16
+ payload: errorString
17
+ };
18
+ };
19
+ //# sourceMappingURL=bucketActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BucketActionKind","setBucketLoading","type","SET_BUCKET_LOADING","setBucketData","bucketData","SET_BUCKET_DATA","payload","setBucketError","errorString","SET_BUCKET_ERROR"],"sourceRoot":"../../../../../src","sources":["main/state/actions/bucketActions.ts"],"mappings":"AAAA,SACEA,gBAAgB,QAGX,6BAA6B;AAEpC,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAqB;EACnD,OAAO;IACLC,IAAI,EAAEF,gBAAgB,CAACG;EACzB,CAAC;AACH,CAAC;AAED,OAAO,MAAMC,aAAa,GAAIC,UAA2B,IAAoB;EAC3E,OAAO;IACLH,IAAI,EAAEF,gBAAgB,CAACM,eAAe;IACtCC,OAAO,EAAEF;EACX,CAAC;AACH,CAAC;AAED,OAAO,MAAMG,cAAc,GAAIC,WAAmB,IAAoB;EACpE,OAAO;IACLP,IAAI,EAAEF,gBAAgB,CAACU,gBAAgB;IACvCH,OAAO,EAAEE;EACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { BundleActionKind } from '../../../types/bundle.types';
2
+ export const setBundleLoading = () => {
3
+ return {
4
+ type: BundleActionKind.SET_BUNDLE_LOADING
5
+ };
6
+ };
7
+ export const setBundleData = bundleData => {
8
+ return {
9
+ type: BundleActionKind.SET_BUNDLE_DATA,
10
+ payload: bundleData
11
+ };
12
+ };
13
+ export const setBundleError = errorString => {
14
+ return {
15
+ type: BundleActionKind.SET_BUNDLE_ERROR,
16
+ payload: errorString
17
+ };
18
+ };
19
+ export const setSelectedBucketId = bucketId => {
20
+ return {
21
+ type: BundleActionKind.SET_SELECTED_BUCKET,
22
+ payload: bucketId
23
+ };
24
+ };
25
+ //# sourceMappingURL=bundleActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BundleActionKind","setBundleLoading","type","SET_BUNDLE_LOADING","setBundleData","bundleData","SET_BUNDLE_DATA","payload","setBundleError","errorString","SET_BUNDLE_ERROR","setSelectedBucketId","bucketId","SET_SELECTED_BUCKET"],"sourceRoot":"../../../../../src","sources":["main/state/actions/bundleActions.ts"],"mappings":"AAAA,SACEA,gBAAgB,QAGX,6BAA6B;AAEpC,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAqB;EACnD,OAAO;IACLC,IAAI,EAAEF,gBAAgB,CAACG;EACzB,CAAC;AACH,CAAC;AAED,OAAO,MAAMC,aAAa,GAAIC,UAA2B,IAAoB;EAC3E,OAAO;IACLH,IAAI,EAAEF,gBAAgB,CAACM,eAAe;IACtCC,OAAO,EAAEF;EACX,CAAC;AACH,CAAC;AAED,OAAO,MAAMG,cAAc,GAAIC,WAAmB,IAAoB;EACpE,OAAO;IACLP,IAAI,EAAEF,gBAAgB,CAACU,gBAAgB;IACvCH,OAAO,EAAEE;EACX,CAAC;AACH,CAAC;AAED,OAAO,MAAME,mBAAmB,GAC9BC,QAAwB,IACN;EAClB,OAAO;IACLV,IAAI,EAAEF,gBAAgB,CAACa,mBAAmB;IAC1CN,OAAO,EAAEK;EACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { DownloadActionKind } from '../../../types/download.types';
2
+ export const setDownloadLoading = () => {
3
+ return {
4
+ type: DownloadActionKind.SET_DOWNLOAD_LOADING
5
+ };
6
+ };
7
+ export const setDownloadData = downloadData => {
8
+ return {
9
+ type: DownloadActionKind.SET_DOWNLOAD_DATA,
10
+ payload: downloadData
11
+ };
12
+ };
13
+ export const setDownloadError = errorString => {
14
+ return {
15
+ type: DownloadActionKind.SET_DOWNLOAD_ERROR,
16
+ payload: errorString
17
+ };
18
+ };
19
+ //# sourceMappingURL=downloadActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DownloadActionKind","setDownloadLoading","type","SET_DOWNLOAD_LOADING","setDownloadData","downloadData","SET_DOWNLOAD_DATA","payload","setDownloadError","errorString","SET_DOWNLOAD_ERROR"],"sourceRoot":"../../../../../src","sources":["main/state/actions/downloadActions.ts"],"mappings":"AAAA,SACEA,kBAAkB,QAGb,+BAA+B;AAEtC,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAuB;EACvD,OAAO;IACLC,IAAI,EAAEF,kBAAkB,CAACG;EAC3B,CAAC;AACH,CAAC;AAED,OAAO,MAAMC,eAAe,GAC1BC,YAA2B,IACP;EACpB,OAAO;IACLH,IAAI,EAAEF,kBAAkB,CAACM,iBAAiB;IAC1CC,OAAO,EAAEF;EACX,CAAC;AACH,CAAC;AAED,OAAO,MAAMG,gBAAgB,GAAIC,WAAmB,IAAsB;EACxE,OAAO;IACLP,IAAI,EAAEF,kBAAkB,CAACU,kBAAkB;IAC3CH,OAAO,EAAEE;EACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { MetaActionKind } from '../../../types/meta.types';
2
+ export const setMeta = newMeta => {
3
+ return {
4
+ type: MetaActionKind.SET_META,
5
+ payload: newMeta
6
+ };
7
+ };
8
+ //# sourceMappingURL=metaActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MetaActionKind","setMeta","newMeta","type","SET_META","payload"],"sourceRoot":"../../../../../src","sources":["main/state/actions/metaActions.ts"],"mappings":"AAAA,SAGEA,cAAc,QACT,2BAA2B;AAElC,OAAO,MAAMC,OAAO,GAAIC,OAAsB,IAAkB;EAC9D,OAAO;IACLC,IAAI,EAAEH,cAAc,CAACI,QAAQ;IAC7BC,OAAO,EAAEH;EACX,CAAC;AACH,CAAC"}