@corva/ui 3.15.0-7 → 3.15.0-9

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 (321) hide show
  1. package/cjs-bundle/clients/index.js +1 -1
  2. package/cjs-bundle/clients/index.js.map +1 -1
  3. package/cjs-bundle/clients/subscriptions/constants.js +2 -0
  4. package/cjs-bundle/clients/subscriptions/constants.js.map +1 -0
  5. package/cjs-bundle/clients/subscriptions/get-channel-name.js +2 -0
  6. package/cjs-bundle/clients/subscriptions/get-channel-name.js.map +1 -0
  7. package/cjs-bundle/clients/subscriptions/socket-client.v2.js +2 -0
  8. package/cjs-bundle/clients/subscriptions/socket-client.v2.js.map +1 -0
  9. package/cjs-bundle/clients/subscriptions/subscriptions-client.dummy.js +2 -0
  10. package/cjs-bundle/clients/subscriptions/subscriptions-client.dummy.js.map +1 -0
  11. package/cjs-bundle/clients/subscriptions/subscriptions-client.factory.js +2 -0
  12. package/cjs-bundle/clients/subscriptions/subscriptions-client.factory.js.map +1 -0
  13. package/cjs-bundle/clients/subscriptions/subscriptions-client.js +2 -0
  14. package/cjs-bundle/clients/subscriptions/subscriptions-client.js.map +1 -0
  15. package/cjs-bundle/clients/subscriptions.js +1 -1
  16. package/cjs-bundle/clients/subscriptions.js.map +1 -1
  17. package/cjs-bundle/clients/subscriptions.v1.js +2 -0
  18. package/cjs-bundle/clients/subscriptions.v1.js.map +1 -0
  19. package/cjs-bundle/components/AddComment/Popover.js +1 -1
  20. package/cjs-bundle/components/AddComment/Popover.js.map +1 -1
  21. package/cjs-bundle/components/AddComment/components/Content.js +1 -1
  22. package/cjs-bundle/components/AddComment/components/Content.js.map +1 -1
  23. package/cjs-bundle/components/AssetEditor/effects/index.js +1 -1
  24. package/cjs-bundle/components/AssetEditor/effects/index.js.map +1 -1
  25. package/cjs-bundle/components/AssetEditorV2/effects/index.js +1 -1
  26. package/cjs-bundle/components/AssetEditorV2/effects/index.js.map +1 -1
  27. package/cjs-bundle/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js +1 -1
  28. package/cjs-bundle/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js.map +1 -1
  29. package/cjs-bundle/components/Attachment/index.js +1 -1
  30. package/cjs-bundle/components/Attachment/index.js.map +1 -1
  31. package/cjs-bundle/components/BICOffsetPickerDialog/index.js +1 -1
  32. package/cjs-bundle/components/BICOffsetPickerDialog/index.js.map +1 -1
  33. package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
  34. package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
  35. package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js +1 -1
  36. package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js.map +1 -1
  37. package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
  38. package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
  39. package/cjs-bundle/components/CollapsableSidebar.js +1 -1
  40. package/cjs-bundle/components/CollapsableSidebar.js.map +1 -1
  41. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.css.js +1 -1
  42. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js +1 -1
  43. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  44. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.js +1 -1
  45. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/NonPriorityMenus/NonPriorityMenus.js +1 -1
  46. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js +1 -1
  47. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js.map +1 -1
  48. package/cjs-bundle/components/DocumentViewer/DocumentViewer.js +1 -1
  49. package/cjs-bundle/components/DocumentViewer/DocumentViewer.js.map +1 -1
  50. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
  51. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
  52. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
  53. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
  54. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
  55. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
  56. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
  57. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
  58. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
  59. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
  60. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
  61. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
  62. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
  63. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
  64. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
  65. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
  66. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
  67. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
  68. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
  69. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
  70. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
  71. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
  72. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
  73. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
  74. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
  75. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
  76. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
  77. package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
  78. package/cjs-bundle/components/FeedItem/FeedItem.js +1 -1
  79. package/cjs-bundle/components/FeedItem/FeedItem.js.map +1 -1
  80. package/cjs-bundle/components/FeedItem/components/FeedComments.js +1 -1
  81. package/cjs-bundle/components/FeedItem/components/FeedComments.js.map +1 -1
  82. package/cjs-bundle/components/ImageViewer/index.js +1 -1
  83. package/cjs-bundle/components/ImageViewer/index.js.map +1 -1
  84. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js +1 -1
  85. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js.map +1 -1
  86. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js +1 -1
  87. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js.map +1 -1
  88. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
  89. package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
  90. package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
  91. package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
  92. package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
  93. package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
  94. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js +1 -1
  95. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js.map +1 -1
  96. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
  97. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
  98. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
  99. package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
  100. package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
  101. package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
  102. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
  103. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
  104. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
  105. package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
  106. package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
  107. package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
  108. package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
  109. package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
  110. package/cjs-bundle/components/OffsetWellPickerV4/OffsetWellPickerV4.js +1 -1
  111. package/cjs-bundle/components/OffsetWellPickerV4/OffsetWellPickerV4.js.map +1 -1
  112. package/cjs-bundle/components/OffsetWellPickerV4/components/Filter/Filter.js +1 -1
  113. package/cjs-bundle/components/OffsetWellPickerV4/components/Filter/Filter.js.map +1 -1
  114. package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js +1 -1
  115. package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js.map +1 -1
  116. package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js +1 -1
  117. package/cjs-bundle/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js.map +1 -1
  118. package/cjs-bundle/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js +1 -1
  119. package/cjs-bundle/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js.map +1 -1
  120. package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js +1 -1
  121. package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
  122. package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
  123. package/cjs-bundle/components/PinnableFilters/effects/index.js +1 -1
  124. package/cjs-bundle/components/PinnableFilters/effects/index.js.map +1 -1
  125. package/cjs-bundle/components/Popover/Popover.js +1 -1
  126. package/cjs-bundle/components/Popper/Popper.js +1 -1
  127. package/cjs-bundle/components/RealTimeValuesSidebar/SidebarFooter.js +1 -1
  128. package/cjs-bundle/componentsV2/AppFooter/DqPopover/DqPopover.js +1 -1
  129. package/cjs-bundle/componentsV2/AppHeader/AppAssets/utils.js +1 -1
  130. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  131. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  132. package/cjs-bundle/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
  133. package/cjs-bundle/componentsV2/AppHeader/V3/AssetSelector/AssetSelector.js +1 -1
  134. package/cjs-bundle/componentsV2/AppHeader/V3/SettingsPopover/SettingsPopover.js +1 -1
  135. package/cjs-bundle/componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js +1 -1
  136. package/cjs-bundle/componentsV2/PadModeSelect/PadModeSelect.js +1 -1
  137. package/cjs-bundle/effects/subscriptions/useSubscriptions.v1.js +2 -0
  138. package/cjs-bundle/effects/subscriptions/useSubscriptions.v1.js.map +1 -0
  139. package/cjs-bundle/effects/subscriptions/useSubscriptions.v2.js +2 -0
  140. package/cjs-bundle/effects/subscriptions/useSubscriptions.v2.js.map +1 -0
  141. package/cjs-bundle/effects/useSubscriptions.js +1 -1
  142. package/cjs-bundle/effects/useSubscriptions.js.map +1 -1
  143. package/cjs-bundle/testing/AppTestWrapper/AppTestWrapper.js +1 -1
  144. package/clients/index.d.ts +10 -3
  145. package/clients/index.d.ts.map +1 -1
  146. package/clients/index.js +1 -1
  147. package/clients/index.js.map +1 -1
  148. package/clients/subscriptions/__tests__/subscriptions-client.factory.test.d.ts +2 -0
  149. package/clients/subscriptions/__tests__/subscriptions-client.factory.test.d.ts.map +1 -0
  150. package/clients/subscriptions/__tests__/subscriptions-client.test.d.ts +2 -0
  151. package/clients/subscriptions/__tests__/subscriptions-client.test.d.ts.map +1 -0
  152. package/clients/subscriptions/constants.d.ts +5 -0
  153. package/clients/subscriptions/constants.d.ts.map +1 -0
  154. package/clients/subscriptions/constants.js +2 -0
  155. package/clients/subscriptions/constants.js.map +1 -0
  156. package/clients/subscriptions/get-channel-name.d.ts +3 -0
  157. package/clients/subscriptions/get-channel-name.d.ts.map +1 -0
  158. package/clients/subscriptions/get-channel-name.js +2 -0
  159. package/clients/subscriptions/get-channel-name.js.map +1 -0
  160. package/clients/subscriptions/socket-client.v2.d.ts +10 -0
  161. package/clients/subscriptions/socket-client.v2.d.ts.map +1 -0
  162. package/clients/subscriptions/socket-client.v2.js +2 -0
  163. package/clients/subscriptions/socket-client.v2.js.map +1 -0
  164. package/clients/subscriptions/subscriptions-client.d.ts +13 -0
  165. package/clients/subscriptions/subscriptions-client.d.ts.map +1 -0
  166. package/clients/subscriptions/subscriptions-client.dummy.d.ts +7 -0
  167. package/clients/subscriptions/subscriptions-client.dummy.d.ts.map +1 -0
  168. package/clients/subscriptions/subscriptions-client.dummy.js +2 -0
  169. package/clients/subscriptions/subscriptions-client.dummy.js.map +1 -0
  170. package/clients/subscriptions/subscriptions-client.factory.d.ts +7 -0
  171. package/clients/subscriptions/subscriptions-client.factory.d.ts.map +1 -0
  172. package/clients/subscriptions/subscriptions-client.factory.js +2 -0
  173. package/clients/subscriptions/subscriptions-client.factory.js.map +1 -0
  174. package/clients/subscriptions/subscriptions-client.js +2 -0
  175. package/clients/subscriptions/subscriptions-client.js.map +1 -0
  176. package/clients/subscriptions/types.d.ts +37 -0
  177. package/clients/subscriptions/types.d.ts.map +1 -0
  178. package/clients/subscriptions.d.ts +1 -8
  179. package/clients/subscriptions.d.ts.map +1 -1
  180. package/clients/subscriptions.js +1 -1
  181. package/clients/subscriptions.js.map +1 -1
  182. package/clients/subscriptions.v1.d.ts +9 -0
  183. package/clients/subscriptions.v1.d.ts.map +1 -0
  184. package/clients/subscriptions.v1.js +2 -0
  185. package/clients/subscriptions.v1.js.map +1 -0
  186. package/components/AddComment/Popover.js +1 -1
  187. package/components/AddComment/Popover.js.map +1 -1
  188. package/components/AddComment/components/Content.js +1 -1
  189. package/components/AddComment/components/Content.js.map +1 -1
  190. package/components/AssetEditor/effects/index.js +1 -1
  191. package/components/AssetEditor/effects/index.js.map +1 -1
  192. package/components/AssetEditorV2/effects/index.js +1 -1
  193. package/components/AssetEditorV2/effects/index.js.map +1 -1
  194. package/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js +1 -1
  195. package/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js.map +1 -1
  196. package/components/Attachment/index.js +1 -1
  197. package/components/Attachment/index.js.map +1 -1
  198. package/components/BICOffsetPickerDialog/index.js +1 -1
  199. package/components/BICOffsetPickerDialog/index.js.map +1 -1
  200. package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
  201. package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
  202. package/components/Casing/CasingTableV2/components/Component.js +1 -1
  203. package/components/Casing/CasingTableV2/components/Component.js.map +1 -1
  204. package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
  205. package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
  206. package/components/CollapsableSidebar.js +1 -1
  207. package/components/CollapsableSidebar.js.map +1 -1
  208. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.css.js +1 -1
  209. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts.map +1 -1
  210. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js +1 -1
  211. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  212. package/components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchButton.js +1 -1
  213. package/components/DevCenter/DevCenterAppContainer/components/NonPriorityMenus/NonPriorityMenus.js +1 -1
  214. package/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js +1 -1
  215. package/components/DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.js.map +1 -1
  216. package/components/DocumentViewer/DocumentViewer.js +1 -1
  217. package/components/DocumentViewer/DocumentViewer.js.map +1 -1
  218. package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
  219. package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
  220. package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
  221. package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
  222. package/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
  223. package/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
  224. package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
  225. package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
  226. package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
  227. package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
  228. package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
  229. package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
  230. package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
  231. package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
  232. package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
  233. package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
  234. package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
  235. package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
  236. package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
  237. package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
  238. package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
  239. package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
  240. package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
  241. package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
  242. package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
  243. package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
  244. package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
  245. package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
  246. package/components/FeedItem/FeedItem.js +1 -1
  247. package/components/FeedItem/FeedItem.js.map +1 -1
  248. package/components/FeedItem/components/FeedComments.js +1 -1
  249. package/components/FeedItem/components/FeedComments.js.map +1 -1
  250. package/components/ImageViewer/index.js +1 -1
  251. package/components/ImageViewer/index.js.map +1 -1
  252. package/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js +1 -1
  253. package/components/OffsetWellPickerV2/components/Filter/NonEngineeredWellsSwitch.js.map +1 -1
  254. package/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js +1 -1
  255. package/components/OffsetWellPickerV2/components/Filter/SidetrackSwitch.js.map +1 -1
  256. package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
  257. package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
  258. package/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
  259. package/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
  260. package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
  261. package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
  262. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js +1 -1
  263. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Filter/SidetrackSwitch.js.map +1 -1
  264. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
  265. package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
  266. package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
  267. package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
  268. package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
  269. package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
  270. package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
  271. package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
  272. package/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
  273. package/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
  274. package/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
  275. package/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
  276. package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
  277. package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
  278. package/components/OffsetWellPickerV4/OffsetWellPickerV4.js +1 -1
  279. package/components/OffsetWellPickerV4/OffsetWellPickerV4.js.map +1 -1
  280. package/components/OffsetWellPickerV4/components/Filter/Filter.js +1 -1
  281. package/components/OffsetWellPickerV4/components/Filter/Filter.js.map +1 -1
  282. package/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js +1 -1
  283. package/components/OffsetWellPickerV4/components/OffsetWellsTable/MetricsSettingMenu.js.map +1 -1
  284. package/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js +1 -1
  285. package/components/OffsetWellPickerV4/components/OffsetWellsTable/OffsetWellsTable.js.map +1 -1
  286. package/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js +1 -1
  287. package/components/OffsetWellPickerV4/components/Toolbar/Toolbar.js.map +1 -1
  288. package/components/PadOffsetsPicker/StagesSelector.js +1 -1
  289. package/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
  290. package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
  291. package/components/PinnableFilters/effects/index.js +1 -1
  292. package/components/PinnableFilters/effects/index.js.map +1 -1
  293. package/components/Popover/Popover.js +1 -1
  294. package/components/Popper/Popper.js +1 -1
  295. package/components/RealTimeValuesSidebar/SidebarFooter.js +1 -1
  296. package/componentsV2/AppFooter/DqPopover/DqPopover.js +1 -1
  297. package/componentsV2/AppHeader/AppAssets/utils.js +1 -1
  298. package/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  299. package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  300. package/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
  301. package/componentsV2/AppHeader/V3/AssetSelector/AssetSelector.js +1 -1
  302. package/componentsV2/AppHeader/V3/SettingsPopover/SettingsPopover.js +1 -1
  303. package/componentsV2/AppHeader/V3/VersionSelect/VersionSelect.js +1 -1
  304. package/componentsV2/PadModeSelect/PadModeSelect.js +1 -1
  305. package/effects/subscriptions/__tests__/useSubscriptions.v2.test.d.ts +2 -0
  306. package/effects/subscriptions/__tests__/useSubscriptions.v2.test.d.ts.map +1 -0
  307. package/effects/subscriptions/useSubscriptions.v1.d.ts +24 -0
  308. package/effects/subscriptions/useSubscriptions.v1.d.ts.map +1 -0
  309. package/effects/subscriptions/useSubscriptions.v1.js +2 -0
  310. package/effects/subscriptions/useSubscriptions.v1.js.map +1 -0
  311. package/effects/subscriptions/useSubscriptions.v2.d.ts +15 -0
  312. package/effects/subscriptions/useSubscriptions.v2.d.ts.map +1 -0
  313. package/effects/subscriptions/useSubscriptions.v2.js +2 -0
  314. package/effects/subscriptions/useSubscriptions.v2.js.map +1 -0
  315. package/effects/useSubscriptions.d.ts +10 -14
  316. package/effects/useSubscriptions.d.ts.map +1 -1
  317. package/effects/useSubscriptions.js +1 -1
  318. package/effects/useSubscriptions.js.map +1 -1
  319. package/effects/useWellnessAlerts.d.ts.map +1 -1
  320. package/package.json +4 -1
  321. package/testing/AppTestWrapper/AppTestWrapper.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../src/components/AddComment/components/Content.js"],"sourcesContent":["import { useRef } from 'react';\nimport { node, number, func, bool, shape } from 'prop-types';\nimport { makeStyles } from '@material-ui/core';\n\nimport { PostInput } from '~/components';\nimport { isSuggestionsListOpened } from '~/components/UserMention/utils';\n\nconst useStyles = makeStyles({\n postInput: { paddingBottom: 8 },\n filePreviewWrapper: ({ smallerView }) => ({\n width: '100%',\n marginLeft: 0,\n maxHeight: smallerView ? 127 : 251,\n }),\n});\nfunction Content({\n userCompanyId,\n startAdornment,\n endAdornment,\n customContent,\n setComment,\n smallerView,\n onSave,\n comment,\n}) {\n const classes = useStyles({ smallerView });\n const wrapperRef = useRef();\n\n const onKeyDown = e => {\n if (e.key === 'Enter' && !e.shiftKey && !isSuggestionsListOpened()) {\n e.preventDefault();\n onSave(comment);\n }\n };\n\n return (\n <div ref={wrapperRef}>\n {startAdornment}\n\n {customContent || (\n <PostInput\n userCompanyId={userCompanyId}\n onChange={setComment}\n filePreviewWrapperClass={classes.filePreviewWrapper}\n className={classes.postInput}\n smallerView={smallerView}\n onKeyDown={onKeyDown}\n suggestionsPortalHost={wrapperRef.current}\n allowSuggestionsAboveCursor\n />\n )}\n\n {endAdornment}\n </div>\n );\n}\n\nContent.propTypes = {\n startAdornment: node,\n endAdornment: node,\n customContent: node,\n userCompanyId: number.isRequired,\n setComment: func,\n onSave: func,\n smallerView: bool,\n comment: shape(),\n};\n\nContent.defaultProps = {\n startAdornment: null,\n endAdornment: null,\n customContent: null,\n setComment: () => undefined,\n onSave: () => undefined,\n smallerView: false,\n comment: undefined,\n};\n\nexport default Content;\n"],"names":["useStyles","makeStyles","postInput","paddingBottom","filePreviewWrapper","_ref","width","marginLeft","maxHeight","smallerView","Content","_ref2","userCompanyId","startAdornment","endAdornment","customContent","setComment","onSave","comment","classes","wrapperRef","useRef","_jsxs","ref","children","_jsx","PostInput","onChange","filePreviewWrapperClass","className","onKeyDown","e","key","shiftKey","isSuggestionsListOpened","preventDefault","suggestionsPortalHost","current","allowSuggestionsAboveCursor","propTypes","node","number","isRequired","func","bool","shape","defaultProps","undefined"],"mappings":"+nsBAOMA,EAAYC,EAAAA,WAAW,CAC3BC,UAAW,CAAEC,cAAe,GAC5BC,mBAAoB,SAAAC,GAAc,MAAQ,CACxCC,MAAO,OACPC,WAAY,EACZC,YAHqBC,YAGI,IAAM,IAChC,IAEH,SAASC,EASNC,GAAA,IARDC,IAAAA,cACAC,IAAAA,eACAC,IAAAA,aACAC,IAAAA,cACAC,IAAAA,WACAP,IAAAA,YACAQ,IAAAA,OACAC,IAAAA,QAEMC,EAAUnB,EAAU,CAAES,YAAAA,IACtBW,EAAaC,EAAAA,SASnB,OACEC,EAAAA,KAAA,MAAA,CAAKC,IAAKH,EAAWI,SAAA,CAClBX,EAEAE,GACCU,EAAAA,IAACC,EAAS,CACRd,cAAeA,EACfe,SAAUX,EACVY,wBAAyBT,EAAQf,mBACjCyB,UAAWV,EAAQjB,UACnBO,YAAaA,EACbqB,UAlBU,SAAAC,GACF,UAAVA,EAAEC,KAAoBD,EAAEE,UAAaC,EAAAA,4BACvCH,EAAEI,iBACFlB,EAAOC,KAgBHkB,sBAAuBhB,EAAWiB,QAClCC,6BAA2B,IAI9BxB,IAGP,CAEAJ,EAAQ6B,UAAY,CAClB1B,eAAgB2B,EAAIA,KACpB1B,aAAc0B,EAAIA,KAClBzB,cAAeyB,EAAIA,KACnB5B,cAAe6B,EAAMA,OAACC,WACtB1B,WAAY2B,EAAIA,KAChB1B,OAAQ0B,EAAIA,KACZlC,YAAamC,EAAIA,KACjB1B,QAAS2B,EAAAA,SAGXnC,EAAQoC,aAAe,CACrBjC,eAAgB,KAChBC,aAAc,KACdC,cAAe,KACfC,WAAY,WAAe,EAC3BC,OAAQ,WAAe,EACvBR,aAAa,EACbS,aAAS6B"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../src/components/AddComment/components/Content.js"],"sourcesContent":["import { useRef } from 'react';\nimport { node, number, func, bool, shape } from 'prop-types';\nimport { makeStyles } from '@material-ui/core';\n\nimport { PostInput } from '~/components';\nimport { isSuggestionsListOpened } from '~/components/UserMention/utils';\n\nconst useStyles = makeStyles({\n postInput: { paddingBottom: 8 },\n filePreviewWrapper: ({ smallerView }) => ({\n width: '100%',\n marginLeft: 0,\n maxHeight: smallerView ? 127 : 251,\n }),\n});\nfunction Content({\n userCompanyId,\n startAdornment,\n endAdornment,\n customContent,\n setComment,\n smallerView,\n onSave,\n comment,\n}) {\n const classes = useStyles({ smallerView });\n const wrapperRef = useRef();\n\n const onKeyDown = e => {\n if (e.key === 'Enter' && !e.shiftKey && !isSuggestionsListOpened()) {\n e.preventDefault();\n onSave(comment);\n }\n };\n\n return (\n <div ref={wrapperRef}>\n {startAdornment}\n\n {customContent || (\n <PostInput\n userCompanyId={userCompanyId}\n onChange={setComment}\n filePreviewWrapperClass={classes.filePreviewWrapper}\n className={classes.postInput}\n smallerView={smallerView}\n onKeyDown={onKeyDown}\n suggestionsPortalHost={wrapperRef.current}\n allowSuggestionsAboveCursor\n />\n )}\n\n {endAdornment}\n </div>\n );\n}\n\nContent.propTypes = {\n startAdornment: node,\n endAdornment: node,\n customContent: node,\n userCompanyId: number.isRequired,\n setComment: func,\n onSave: func,\n smallerView: bool,\n comment: shape(),\n};\n\nContent.defaultProps = {\n startAdornment: null,\n endAdornment: null,\n customContent: null,\n setComment: () => undefined,\n onSave: () => undefined,\n smallerView: false,\n comment: undefined,\n};\n\nexport default Content;\n"],"names":["useStyles","makeStyles","postInput","paddingBottom","filePreviewWrapper","_ref","width","marginLeft","maxHeight","smallerView","Content","_ref2","userCompanyId","startAdornment","endAdornment","customContent","setComment","onSave","comment","classes","wrapperRef","useRef","_jsxs","ref","children","_jsx","PostInput","onChange","filePreviewWrapperClass","className","onKeyDown","e","key","shiftKey","isSuggestionsListOpened","preventDefault","suggestionsPortalHost","current","allowSuggestionsAboveCursor","propTypes","node","number","isRequired","func","bool","shape","defaultProps","undefined"],"mappings":"mwsBAOMA,EAAYC,EAAAA,WAAW,CAC3BC,UAAW,CAAEC,cAAe,GAC5BC,mBAAoB,SAAAC,GAAc,MAAQ,CACxCC,MAAO,OACPC,WAAY,EACZC,YAHqBC,YAGI,IAAM,IAChC,IAEH,SAASC,EASNC,GAAA,IARDC,IAAAA,cACAC,IAAAA,eACAC,IAAAA,aACAC,IAAAA,cACAC,IAAAA,WACAP,IAAAA,YACAQ,IAAAA,OACAC,IAAAA,QAEMC,EAAUnB,EAAU,CAAES,YAAAA,IACtBW,EAAaC,EAAAA,SASnB,OACEC,EAAAA,KAAA,MAAA,CAAKC,IAAKH,EAAWI,SAAA,CAClBX,EAEAE,GACCU,EAAAA,IAACC,EAAS,CACRd,cAAeA,EACfe,SAAUX,EACVY,wBAAyBT,EAAQf,mBACjCyB,UAAWV,EAAQjB,UACnBO,YAAaA,EACbqB,UAlBU,SAAAC,GACF,UAAVA,EAAEC,KAAoBD,EAAEE,UAAaC,EAAAA,4BACvCH,EAAEI,iBACFlB,EAAOC,KAgBHkB,sBAAuBhB,EAAWiB,QAClCC,6BAA2B,IAI9BxB,IAGP,CAEAJ,EAAQ6B,UAAY,CAClB1B,eAAgB2B,EAAIA,KACpB1B,aAAc0B,EAAIA,KAClBzB,cAAeyB,EAAIA,KACnB5B,cAAe6B,EAAMA,OAACC,WACtB1B,WAAY2B,EAAIA,KAChB1B,OAAQ0B,EAAIA,KACZlC,YAAamC,EAAIA,KACjB1B,QAAS2B,EAAAA,SAGXnC,EAAQoC,aAAe,CACrBjC,eAAgB,KAChBC,aAAc,KACdC,cAAe,KACfC,WAAY,WAAe,EAC3BC,OAAQ,WAAe,EACvBR,aAAa,EACbS,aAAS6B"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/toConsumableArray"),a=require("@babel/runtime/regenerator"),s=require("react"),u=require("lodash"),i=require("../constants.js");require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var c=require("../../../clients/jsonApi/index.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../clients/subscriptions.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js"),require("../../../clients/sso/auth0.js"),require("../../../clients/sso/oauth2.js");var p=o(e),l=o(t),f=o(r),d=o(n),y=o(a);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){f.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{sort:"name",order:"asc",fields:["".concat(e,".name"),"".concat(e,".asset_id")].concat(d.default(t))}},v=function(e){var t,r,n;return m(m({},e.attributes),{},{id:+e.id,programId:+(null===(t=e.relationships)||void 0===t||null===(r=t.program)||void 0===r||null===(n=r.data)||void 0===n?void 0:n.id)})};exports.useAssetAutoCompleteSelectData=function(e){var t=e.appKey,r=e.assetType,n=e.companyId,a=e.currentValue,o=e.isMultiple,f=e.parentAssetId,d=e.parentAssetType,b=e.scrollPage,q=e.searchText,j=e.setCurrentOption,g=e.queryParams,O=e.assetFields,x=s.useState([]),A=l.default(x,2),P=A[0],w=A[1],k=s.useState(!1),E=l.default(k,2),S=E[0],_=E[1],T=s.useRef(),D=s.useRef();return s.useEffect((function(){function e(){return(e=p.default(y.default.mark((function e(){var t;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.mapAssetGetRequest(r)(m(m({},h(r,O)),{},{ids:o?a:[a]},g));case 2:if(t=e.sent,!u.isEmpty(t.data)){e.next=7;break}return e.next=6,c.getAssets(m(m({},h(r,O)),{},{ids:o?a:[a]},g));case 6:t=e.sent;case 7:j((function(){if(o)return t.data.map(v);var e=t.data[0];return e?v(e):null}));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(o?a.length:a)&&function(){e.apply(this,arguments)}()}),[]),s.useEffect((function(){function e(){return(e=p.default(y.default.mark((function e(){var a,s,u,o,p;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,_(!0),a={per_page:i.PER_PAGE,page:b},d&&f&&(a[d]=f),n&&(a.company=n),q&&(a.search=q),t&&(a.app_key=t),s=c.mapAssetGetRequest(r)(m(m(m({},h(r,O)),a),g)),D.current=s,e.next=11,s;case 11:if(u=e.sent,D.current===s){e.next=14;break}return e.abrupt("return");case 14:o=u.data.map(v),p=T.current!==r||1===b,w(p?o:function(e){return e.concat(o)}),T.current=r,e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),console.error(e.t0);case 23:_(!1);case 24:case"end":return e.stop()}}),e,null,[[0,20]])})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[r,d,f,n,q,b,t]),{assets:P,loading:S}},exports.useAssetSelectData=function(e){var t=e.appKey,r=e.assetType,n=e.assetId,a=e.parentAssetType,u=e.parentAssetId,i=e.queryParams,o=void 0===i?null:i,d=s.useState([]),b=l.default(d,2),q=b[0],j=b[1],g=s.useState(!0),O=l.default(g,2),x=O[0],A=O[1];return s.useEffect((function(){function e(){return(e=p.default(y.default.mark((function e(){var n;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.mapAssetGetRequest(r)(m(m(m({},h(r)),{},f.default({per_page:1e4},a,u),t&&{app_key:t}),o));case 2:n=e.sent,j(n.data.map(v)),A(!1);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}A(!0),function(){e.apply(this,arguments)}()}),[r,n,a,u,t]),{assets:q,loading:x}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/regenerator"),a=require("react"),u=require("lodash"),i=require("../constants.js");require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var c=require("../../../clients/jsonApi/index.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../clients/subscriptions/constants.js"),require("../../../clients/subscriptions.v1.js"),require("../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js"),require("../../../clients/sso/auth0.js"),require("../../../clients/sso/oauth2.js");var p=o(e),l=o(t),f=o(r),d=o(n),y=o(s);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){f.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{sort:"name",order:"asc",fields:["".concat(e,".name"),"".concat(e,".asset_id")].concat(d.default(t))}},v=function(e){var t,r,n;return m(m({},e.attributes),{},{id:+e.id,programId:+(null===(t=e.relationships)||void 0===t||null===(r=t.program)||void 0===r||null===(n=r.data)||void 0===n?void 0:n.id)})};exports.useAssetAutoCompleteSelectData=function(e){var t=e.appKey,r=e.assetType,n=e.companyId,s=e.currentValue,o=e.isMultiple,f=e.parentAssetId,d=e.parentAssetType,b=e.scrollPage,q=e.searchText,j=e.setCurrentOption,g=e.queryParams,O=e.assetFields,x=a.useState([]),A=l.default(x,2),P=A[0],w=A[1],k=a.useState(!1),E=l.default(k,2),S=E[0],_=E[1],T=a.useRef(),D=a.useRef();return a.useEffect((function(){function e(){return(e=p.default(y.default.mark((function e(){var t;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.mapAssetGetRequest(r)(m(m({},h(r,O)),{},{ids:o?s:[s]},g));case 2:if(t=e.sent,!u.isEmpty(t.data)){e.next=7;break}return e.next=6,c.getAssets(m(m({},h(r,O)),{},{ids:o?s:[s]},g));case 6:t=e.sent;case 7:j((function(){if(o)return t.data.map(v);var e=t.data[0];return e?v(e):null}));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(o?s.length:s)&&function(){e.apply(this,arguments)}()}),[]),a.useEffect((function(){function e(){return(e=p.default(y.default.mark((function e(){var s,a,u,o,p;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,_(!0),s={per_page:i.PER_PAGE,page:b},d&&f&&(s[d]=f),n&&(s.company=n),q&&(s.search=q),t&&(s.app_key=t),a=c.mapAssetGetRequest(r)(m(m(m({},h(r,O)),s),g)),D.current=a,e.next=11,a;case 11:if(u=e.sent,D.current===a){e.next=14;break}return e.abrupt("return");case 14:o=u.data.map(v),p=T.current!==r||1===b,w(p?o:function(e){return e.concat(o)}),T.current=r,e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),console.error(e.t0);case 23:_(!1);case 24:case"end":return e.stop()}}),e,null,[[0,20]])})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[r,d,f,n,q,b,t]),{assets:P,loading:S}},exports.useAssetSelectData=function(e){var t=e.appKey,r=e.assetType,n=e.assetId,s=e.parentAssetType,u=e.parentAssetId,i=e.queryParams,o=void 0===i?null:i,d=a.useState([]),b=l.default(d,2),q=b[0],j=b[1],g=a.useState(!0),O=l.default(g,2),x=O[0],A=O[1];return a.useEffect((function(){function e(){return(e=p.default(y.default.mark((function e(){var n;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.mapAssetGetRequest(r)(m(m(m({},h(r)),{},f.default({per_page:1e4},s,u),t&&{app_key:t}),o));case 2:n=e.sent,j(n.data.map(v)),A(!1);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}A(!0),function(){e.apply(this,arguments)}()}),[r,n,s,u,t]),{assets:q,loading:x}};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/components/AssetEditor/effects/index.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { isEmpty } from 'lodash';\n\nimport { PER_PAGE } from '../constants';\n\nimport { jsonApi } from '~/clients';\n\nconst getRequestOptions = (assetType, assetFields = []) => ({\n sort: 'name',\n order: 'asc',\n fields: [`${assetType}.name`, `${assetType}.asset_id`, ...assetFields],\n});\n\nconst deserializeAsset = asset => ({\n ...asset.attributes,\n id: +asset.id,\n programId: +asset.relationships?.program?.data?.id,\n});\n\nexport function useAssetSelectData({\n appKey,\n assetType,\n assetId,\n parentAssetType,\n parentAssetId,\n queryParams = null,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(true);\n useEffect(() => {\n setLoading(true);\n async function loadAssets() {\n const response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType),\n per_page: 10000,\n [parentAssetType]: parentAssetId,\n ...(appKey && { app_key: appKey }),\n ...queryParams,\n });\n\n setAssets(response.data.map(deserializeAsset));\n setLoading(false);\n }\n loadAssets();\n }, [assetType, assetId, parentAssetType, parentAssetId, appKey]);\n\n return { assets, loading };\n}\n\nexport function useAssetAutoCompleteSelectData({\n appKey,\n assetType,\n companyId,\n currentValue,\n isMultiple,\n parentAssetId,\n parentAssetType,\n scrollPage,\n searchText,\n setCurrentOption,\n queryParams,\n assetFields,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(false);\n const previousTypeRef = useRef();\n const lastLoadAssetsReqPromise = useRef();\n\n // NOTE: Fetch currently selected option\n useEffect(() => {\n async function loadCurrentOption() {\n let response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFields),\n ids: isMultiple ? currentValue : [currentValue],\n ...queryParams,\n });\n if (isEmpty(response.data)) {\n // NOTE: Try fetch current option from v2/assets\n response = await jsonApi.getAssets({\n ...getRequestOptions(assetType, assetFields),\n ids: isMultiple ? currentValue : [currentValue],\n ...queryParams,\n });\n }\n\n setCurrentOption(() => {\n if (isMultiple) return response.data.map(deserializeAsset);\n const option = response.data[0];\n return option ? deserializeAsset(option) : null;\n });\n }\n if (isMultiple ? currentValue.length : currentValue) loadCurrentOption();\n }, []);\n\n useEffect(() => {\n async function loadAssets() {\n try {\n setLoading(true);\n const requestParams = { per_page: PER_PAGE, page: scrollPage };\n if (parentAssetType && parentAssetId) requestParams[parentAssetType] = parentAssetId;\n if (companyId) requestParams.company = companyId;\n if (searchText) requestParams.search = searchText;\n if (appKey) requestParams.app_key = appKey;\n\n const requestPromise = jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFields),\n ...requestParams,\n ...queryParams,\n });\n\n lastLoadAssetsReqPromise.current = requestPromise;\n const response = await requestPromise;\n\n if (lastLoadAssetsReqPromise.current !== requestPromise) {\n return;\n }\n\n const responseAssets = response.data.map(deserializeAsset);\n const isPaginationDisabled = previousTypeRef.current !== assetType || scrollPage === 1;\n\n setAssets(\n isPaginationDisabled ? responseAssets : prevState => prevState.concat(responseAssets)\n );\n\n previousTypeRef.current = assetType;\n } catch (e) {\n console.error(e);\n }\n setLoading(false);\n }\n loadAssets();\n }, [assetType, parentAssetType, parentAssetId, companyId, searchText, scrollPage, appKey]);\n\n return { assets, loading };\n}\n"],"names":["getRequestOptions","assetType","assetFields","sort","order","fields","deserializeAsset","asset","_asset$relationships","_asset$relationships$","_asset$relationships$2","attributes","id","programId","relationships","program","data","_ref2","appKey","companyId","currentValue","isMultiple","parentAssetId","parentAssetType","scrollPage","searchText","setCurrentOption","queryParams","useState","_useState6","_slicedToArray","_useState5","assets","setAssets","_useState8","_useState7","loading","setLoading","previousTypeRef","useRef","lastLoadAssetsReqPromise","useEffect","_loadCurrentOption","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","response","wrap","_context2","prev","next","jsonApi","ids","sent","isEmpty","getAssets","_objectSpread","map","option","stop","apply","this","arguments","length","loadCurrentOption","_loadAssets2","_callee3","requestParams","requestPromise","responseAssets","isPaginationDisabled","_context3","per_page","PER_PAGE","page","company","search","app_key","mapAssetGetRequest","current","abrupt","prevState","concat","t0","console","error","loadAssets","_ref","assetId","_ref$queryParams","_useState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KiE,EAAA/D,EAAAA,QAAAgE,EAAA,GAArC1D,EAAOyD,EAAA,GAAExD,EAAUwD,EAAA,GAkB1B,OAjBApD,EAAAA,WAAU,WAEiB,SAAAsD,IAWxB,OAXwBA,EAAzBpD,EAAAA,QAAAC,EAAAA,QAAAC,MAAA,SAAAmD,IAAA,IAAAjD,EAAA,OAAAH,UAAAI,MAAA,SAAAiD,GAAA,OAAA,OAAAA,EAAA/C,KAAA+C,EAAA9C,MAAA,KAAA,EAAA,OAAA8C,EAAA9C,KAAA,EACyBC,qBAA2BnD,EAA3BmD,CAClBpD,EAAAA,EAAAA,EAAAA,CAAAA,EAAAA,EAAkBC,IAAU,CAAA,EAAAiG,EAAAA,QAAA,CAC/BzB,SAAU,KACTlD,EAAkBD,GACfJ,GAAU,CAAE4D,QAAS5D,IACtBS,IACH,KAAA,EANIoB,EAAQkD,EAAA3C,KAQdrB,EAAUc,EAAS/B,KAAK0C,IAAIpD,IAC5B+B,GAAW,GAAO,KAAA,EAAA,IAAA,MAAA,OAAA4D,EAAArC,OAAA,GAAAoC,EACnB,MAAAnC,MAAAC,KAAAC,UAAA,CAZD1B,GAAW,GAAM,WACQ0D,EAAAlC,MAAAC,KAAAC,UAAA,CAYzBwB,EACF,GAAG,CAACtF,EAAWwF,EAASlE,EAAiBD,EAAeJ,IAEjD,CAAEc,OAAAA,EAAQI,QAAAA,EACnB"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/AssetEditor/effects/index.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { isEmpty } from 'lodash';\n\nimport { PER_PAGE } from '../constants';\n\nimport { jsonApi } from '~/clients';\n\nconst getRequestOptions = (assetType, assetFields = []) => ({\n sort: 'name',\n order: 'asc',\n fields: [`${assetType}.name`, `${assetType}.asset_id`, ...assetFields],\n});\n\nconst deserializeAsset = asset => ({\n ...asset.attributes,\n id: +asset.id,\n programId: +asset.relationships?.program?.data?.id,\n});\n\nexport function useAssetSelectData({\n appKey,\n assetType,\n assetId,\n parentAssetType,\n parentAssetId,\n queryParams = null,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(true);\n useEffect(() => {\n setLoading(true);\n async function loadAssets() {\n const response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType),\n per_page: 10000,\n [parentAssetType]: parentAssetId,\n ...(appKey && { app_key: appKey }),\n ...queryParams,\n });\n\n setAssets(response.data.map(deserializeAsset));\n setLoading(false);\n }\n loadAssets();\n }, [assetType, assetId, parentAssetType, parentAssetId, appKey]);\n\n return { assets, loading };\n}\n\nexport function useAssetAutoCompleteSelectData({\n appKey,\n assetType,\n companyId,\n currentValue,\n isMultiple,\n parentAssetId,\n parentAssetType,\n scrollPage,\n searchText,\n setCurrentOption,\n queryParams,\n assetFields,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(false);\n const previousTypeRef = useRef();\n const lastLoadAssetsReqPromise = useRef();\n\n // NOTE: Fetch currently selected option\n useEffect(() => {\n async function loadCurrentOption() {\n let response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFields),\n ids: isMultiple ? currentValue : [currentValue],\n ...queryParams,\n });\n if (isEmpty(response.data)) {\n // NOTE: Try fetch current option from v2/assets\n response = await jsonApi.getAssets({\n ...getRequestOptions(assetType, assetFields),\n ids: isMultiple ? currentValue : [currentValue],\n ...queryParams,\n });\n }\n\n setCurrentOption(() => {\n if (isMultiple) return response.data.map(deserializeAsset);\n const option = response.data[0];\n return option ? deserializeAsset(option) : null;\n });\n }\n if (isMultiple ? currentValue.length : currentValue) loadCurrentOption();\n }, []);\n\n useEffect(() => {\n async function loadAssets() {\n try {\n setLoading(true);\n const requestParams = { per_page: PER_PAGE, page: scrollPage };\n if (parentAssetType && parentAssetId) requestParams[parentAssetType] = parentAssetId;\n if (companyId) requestParams.company = companyId;\n if (searchText) requestParams.search = searchText;\n if (appKey) requestParams.app_key = appKey;\n\n const requestPromise = jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFields),\n ...requestParams,\n ...queryParams,\n });\n\n lastLoadAssetsReqPromise.current = requestPromise;\n const response = await requestPromise;\n\n if (lastLoadAssetsReqPromise.current !== requestPromise) {\n return;\n }\n\n const responseAssets = response.data.map(deserializeAsset);\n const isPaginationDisabled = previousTypeRef.current !== assetType || scrollPage === 1;\n\n setAssets(\n isPaginationDisabled ? responseAssets : prevState => prevState.concat(responseAssets)\n );\n\n previousTypeRef.current = assetType;\n } catch (e) {\n console.error(e);\n }\n setLoading(false);\n }\n loadAssets();\n }, [assetType, parentAssetType, parentAssetId, companyId, searchText, scrollPage, appKey]);\n\n return { assets, loading };\n}\n"],"names":["getRequestOptions","assetType","assetFields","sort","order","fields","deserializeAsset","asset","_asset$relationships","_asset$relationships$","_asset$relationships$2","attributes","id","programId","relationships","program","data","_ref2","appKey","companyId","currentValue","isMultiple","parentAssetId","parentAssetType","scrollPage","searchText","setCurrentOption","queryParams","useState","_useState6","_slicedToArray","_useState5","assets","setAssets","_useState8","_useState7","loading","setLoading","previousTypeRef","useRef","lastLoadAssetsReqPromise","useEffect","_loadCurrentOption","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","response","wrap","_context2","prev","next","jsonApi","ids","sent","isEmpty","getAssets","_objectSpread","map","option","stop","apply","this","arguments","length","loadCurrentOption","_loadAssets2","_callee3","requestParams","requestPromise","responseAssets","isPaginationDisabled","_context3","per_page","PER_PAGE","page","company","search","app_key","mapAssetGetRequest","current","abrupt","prevState","concat","t0","console","error","loadAssets","_ref","assetId","_ref$queryParams","_useState2","_useState","_useState4","_useState3","_loadAssets","_callee","_context","_defineProperty"],"mappings":"2iDAOA,IAAMA,EAAoB,SAACC,GAAS,IAAEC,yDAAc,GAAE,MAAM,CAC1DC,KAAM,OACNC,MAAO,MACPC,OAAYJ,CAAAA,GAAAA,OAAAA,EAAqBA,SAAAA,GAAAA,OAAAA,iCAAyBC,IAC3D,EAEKI,EAAmB,SAAAC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AAA,OAAA,OAAAA,EAAA/C,KAAA+C,EAAA9C,MAAA,KAAA,EAAA,OAAA8C,EAAA9C,KAAA,EACyBC,qBAA2BnD,EAA3BmD,CAClBpD,EAAAA,EAAAA,EAAAA,CAAAA,EAAAA,EAAkBC,IAAU,CAAA,EAAAiG,EAAAA,QAAA,CAC/BzB,SAAU,KACTlD,EAAkBD,GACfJ,GAAU,CAAE4D,QAAS5D,IACtBS,IACH,KAAA,EANIoB,EAAQkD,EAAA3C,KAQdrB,EAAUc,EAAS/B,KAAK0C,IAAIpD,IAC5B+B,GAAW,GAAO,KAAA,EAAA,IAAA,MAAA,OAAA4D,EAAArC,OAAA,GAAAoC,EACnB,MAAAnC,MAAAC,KAAAC,UAAA,CAZD1B,GAAW,GAAM,WACQ0D,EAAAlC,MAAAC,KAAAC,UAAA,CAYzBwB,EACF,GAAG,CAACtF,EAAWwF,EAASlE,EAAiBD,EAAeJ,IAEjD,CAAEc,OAAAA,EAAQI,QAAAA,EACnB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/asyncToGenerator"),s=require("@babel/runtime/helpers/slicedToArray"),n=require("@babel/runtime/regenerator"),a=require("react"),u=require("lodash"),i=require("../utils/index.js");require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var o=require("../../../clients/jsonApi/index.js");require("../../../clients/subscriptions.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js"),require("../../../clients/sso/auth0.js"),require("../../../clients/sso/oauth2.js");var c=require("../../../utils/jsonaDataFormatter.js");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/appPackages.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var l=require("../../../constants/assetTypes.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var f=p(e),d=p(t),q=p(r),y=p(s),j=p(n);function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){d.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.usePrimaryAssetSelectData=function(e){var t,r=e.appKey,s=e.assetType,n=e.company,p=e.groups,d=e.isRequiredAssetId,m=e.parentAssetId,v=e.parentAssetType,h=e.searchText,g=e.assetFields,A=e.currentValue,O=e.setCurrentOption,x=e.onActiveAssetIdChange,P=a.useState([]),S=y.default(P,2),I=S[0],w=S[1],T=a.useState(!1),k=y.default(T,2),_=k[0],E=k[1],D=a.useRef(null),R=(t=q.default(j.default.mark((function e(t){var a,p,q,y,P,S,I,T;return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,a=(null==t?void 0:t.type)||s,p={per_page:1e4},v&&m&&(p[v]=m),n&&"all"!==n&&(p.company=n),h&&(p.search=h),r&&(p.app_key=r),D.current=n,q=a===l.ASSET_TYPES.pad.type?[].concat(f.default(g),["pad.active","pad.parent_frac_fleet_id","pad.current"]):g,y=o.mapAssetGetRequest(a)(b(b({},i.getRequestOptions(a,q)),p)),e.next=12,y;case 12:P=e.sent,S=c.jsonaDataFormatter.deserialize(P),I=S.map((function(e){return i.formatAsset({asset:e,group:null==t?void 0:t.name,isRequiredAssetId:d,isPrimaryAsset:!0})})).filter(Boolean).sort(i.sortAsset),D.current===n&&w((function(e){return[].concat(f.default(e),f.default(I))})),A&&a===s&&(T=I.find((function(e){return A===e.id||e.assetId&&A===e.assetId})),u.isEmpty(T)||O(T),a===l.ASSET_TYPES.rig.type&&x(null==T?void 0:T.activeWellId)),e.next=22;break;case 19:e.prev=19,e.t0=e.catch(0),console.error(e.t0);case 22:case"end":return e.stop()}}),e,null,[[0,19]])}))),function(e){return t.apply(this,arguments)});return a.useEffect((function(){n&&w([])}),[n]),a.useEffect((function(){var e,t=(e=q.default(j.default.mark((function e(){return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,E(!0),!p){e.next=7;break}return e.next=5,Promise.all(p.map((function(e){return R(e)})));case 5:e.next=9;break;case 7:return e.next=9,R();case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0);case 14:return e.prev=14,E(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[0,11,14,17]])}))),function(){return e.apply(this,arguments)});t()}),[s,v,m,n,r,null==p?void 0:p.length]),{assets:_?[]:I,loading:_}},exports.useSecondaryAssetSelectData=function(e){var t=e.appKey,r=e.assetType,s=e.assetId,n=e.company,u=e.parentAssetType,l=e.parentAssetId,p=e.queryParams,f=e.assetFields,m=e.activeWellId,v=e.isRequiredAssetId,h=a.useState([]),g=y.default(h,2),A=g[0],O=g[1],x=a.useState(!0),P=y.default(x,2),S=P[0],I=P[1];return a.useEffect((function(){function e(){return(e=q.default(j.default.mark((function e(){var s,a;return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.mapAssetGetRequest(r)(b(b(b({},i.getRequestOptions(r,f)),{},d.default({per_page:1e4,company:"all"!==n?n:null},u,l),t&&{app_key:t}),p));case 2:s=e.sent,a=c.jsonaDataFormatter.deserialize(s),O(a.map((function(e){return i.formatAsset({asset:e,activeWellId:m,isRequiredAssetId:v})})).sort(i.sortAsset)),I(!1);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}I(!0),function(){e.apply(this,arguments)}()}),[r,s,u,l,t,m,n]),{assets:A,loading:S}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/asyncToGenerator"),s=require("@babel/runtime/helpers/slicedToArray"),n=require("@babel/runtime/regenerator"),a=require("react"),u=require("lodash"),i=require("../utils/index.js");require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var o=require("../../../clients/jsonApi/index.js");require("../../../clients/subscriptions/constants.js"),require("../../../clients/subscriptions.v1.js"),require("../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js"),require("../../../clients/sso/auth0.js"),require("../../../clients/sso/oauth2.js");var c=require("../../../utils/jsonaDataFormatter.js");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/appPackages.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var l=require("../../../constants/assetTypes.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var f=p(e),d=p(t),q=p(r),y=p(s),j=p(n);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){d.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.usePrimaryAssetSelectData=function(e){var t,r=e.appKey,s=e.assetType,n=e.company,p=e.groups,d=e.isRequiredAssetId,b=e.parentAssetId,v=e.parentAssetType,h=e.searchText,g=e.assetFields,A=e.currentValue,O=e.setCurrentOption,x=e.onActiveAssetIdChange,P=a.useState([]),S=y.default(P,2),I=S[0],w=S[1],T=a.useState(!1),k=y.default(T,2),_=k[0],E=k[1],D=a.useRef(null),R=(t=q.default(j.default.mark((function e(t){var a,p,q,y,P,S,I,T;return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,a=(null==t?void 0:t.type)||s,p={per_page:1e4},v&&b&&(p[v]=b),n&&"all"!==n&&(p.company=n),h&&(p.search=h),r&&(p.app_key=r),D.current=n,q=a===l.ASSET_TYPES.pad.type?[].concat(f.default(g),["pad.active","pad.parent_frac_fleet_id","pad.current"]):g,y=o.mapAssetGetRequest(a)(m(m({},i.getRequestOptions(a,q)),p)),e.next=12,y;case 12:P=e.sent,S=c.jsonaDataFormatter.deserialize(P),I=S.map((function(e){return i.formatAsset({asset:e,group:null==t?void 0:t.name,isRequiredAssetId:d,isPrimaryAsset:!0})})).filter(Boolean).sort(i.sortAsset),D.current===n&&w((function(e){return[].concat(f.default(e),f.default(I))})),A&&a===s&&(T=I.find((function(e){return A===e.id||e.assetId&&A===e.assetId})),u.isEmpty(T)||O(T),a===l.ASSET_TYPES.rig.type&&x(null==T?void 0:T.activeWellId)),e.next=22;break;case 19:e.prev=19,e.t0=e.catch(0),console.error(e.t0);case 22:case"end":return e.stop()}}),e,null,[[0,19]])}))),function(e){return t.apply(this,arguments)});return a.useEffect((function(){n&&w([])}),[n]),a.useEffect((function(){var e,t=(e=q.default(j.default.mark((function e(){return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,E(!0),!p){e.next=7;break}return e.next=5,Promise.all(p.map((function(e){return R(e)})));case 5:e.next=9;break;case 7:return e.next=9,R();case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),console.error(e.t0);case 14:return e.prev=14,E(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[0,11,14,17]])}))),function(){return e.apply(this,arguments)});t()}),[s,v,b,n,r,null==p?void 0:p.length]),{assets:_?[]:I,loading:_}},exports.useSecondaryAssetSelectData=function(e){var t=e.appKey,r=e.assetType,s=e.assetId,n=e.company,u=e.parentAssetType,l=e.parentAssetId,p=e.queryParams,f=e.assetFields,b=e.activeWellId,v=e.isRequiredAssetId,h=a.useState([]),g=y.default(h,2),A=g[0],O=g[1],x=a.useState(!0),P=y.default(x,2),S=P[0],I=P[1];return a.useEffect((function(){function e(){return(e=q.default(j.default.mark((function e(){var s,a;return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.mapAssetGetRequest(r)(m(m(m({},i.getRequestOptions(r,f)),{},d.default({per_page:1e4,company:"all"!==n?n:null},u,l),t&&{app_key:t}),p));case 2:s=e.sent,a=c.jsonaDataFormatter.deserialize(s),O(a.map((function(e){return i.formatAsset({asset:e,activeWellId:b,isRequiredAssetId:v})})).sort(i.sortAsset)),I(!1);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}I(!0),function(){e.apply(this,arguments)}()}),[r,s,u,l,t,b,n]),{assets:A,loading:S}};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/components/AssetEditorV2/effects/index.js"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { isEmpty } from 'lodash';\n\nimport { formatAsset, getRequestOptions, sortAsset } from '../utils';\n\nimport { jsonApi } from '~/clients';\nimport { jsonaDataFormatter } from '~/utils/jsonaDataFormatter';\nimport { ASSET_TYPES } from '~/constants';\n\nexport function useSecondaryAssetSelectData({\n appKey,\n assetType,\n assetId,\n company,\n parentAssetType,\n parentAssetId,\n queryParams,\n assetFields,\n activeWellId,\n isRequiredAssetId,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(true);\n useEffect(() => {\n setLoading(true);\n async function loadAssets() {\n const response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFields),\n per_page: 10000,\n company: company !== 'all' ? company : null,\n [parentAssetType]: parentAssetId,\n ...(appKey && { app_key: appKey }),\n ...queryParams,\n });\n\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n setAssets(\n deserializedResponse\n .map(asset => formatAsset({ asset, activeWellId, isRequiredAssetId }))\n .sort(sortAsset)\n );\n setLoading(false);\n }\n loadAssets();\n }, [assetType, assetId, parentAssetType, parentAssetId, appKey, activeWellId, company]);\n\n return { assets, loading };\n}\n\nexport function usePrimaryAssetSelectData({\n appKey,\n assetType,\n company,\n groups,\n isRequiredAssetId,\n parentAssetId,\n parentAssetType,\n searchText,\n assetFields,\n currentValue,\n setCurrentOption,\n onActiveAssetIdChange,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(false);\n const prevCompany = useRef(null);\n\n const loadAssets = async group => {\n try {\n const currentAssetType = group?.type || assetType;\n const requestParams = { per_page: 10000 };\n if (parentAssetType && parentAssetId) requestParams[parentAssetType] = parentAssetId;\n if (company && company !== 'all') requestParams.company = company;\n if (searchText) requestParams.search = searchText;\n if (appKey) requestParams.app_key = appKey;\n\n prevCompany.current = company;\n const assetFieldsByAssetType =\n currentAssetType === ASSET_TYPES.pad.type\n ? [...assetFields, 'pad.active', 'pad.parent_frac_fleet_id', 'pad.current']\n : assetFields;\n\n const requestPromise = jsonApi.mapAssetGetRequest(currentAssetType)({\n ...getRequestOptions(currentAssetType, assetFieldsByAssetType),\n ...requestParams,\n });\n\n const response = await requestPromise;\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n const responseAssets = deserializedResponse\n .map(asset =>\n formatAsset({ asset, group: group?.name, isRequiredAssetId, isPrimaryAsset: true })\n )\n .filter(Boolean)\n .sort(sortAsset);\n\n if (prevCompany.current === company) {\n setAssets(prevState => [...prevState, ...responseAssets]);\n }\n if (currentValue && currentAssetType === assetType) {\n const currentAsset = responseAssets.find(\n asset => currentValue === asset.id || (asset.assetId && currentValue === asset.assetId)\n );\n if (!isEmpty(currentAsset)) {\n setCurrentOption(currentAsset);\n }\n\n if (currentAssetType === ASSET_TYPES.rig.type) {\n onActiveAssetIdChange(currentAsset?.activeWellId);\n }\n }\n } catch (e) {\n console.error(e);\n }\n };\n\n useEffect(() => {\n if (company) {\n setAssets([]);\n }\n }, [company]);\n\n useEffect(() => {\n const loadEverything = async () => {\n try {\n setLoading(true);\n\n if (groups) {\n await Promise.all(groups.map(group => loadAssets(group)));\n } else {\n await loadAssets();\n }\n } catch (e) {\n console.error(e);\n } finally {\n setLoading(false);\n }\n };\n\n loadEverything();\n }, [assetType, parentAssetType, parentAssetId, company, appKey, groups?.length]);\n\n return { assets: loading ? [] : assets, loading };\n}\n"],"names":["_ref2","_ref3","appKey","assetType","company","groups","isRequiredAssetId","parentAssetId","parentAssetType","searchText","assetFields","currentValue","setCurrentOption","onActiveAssetIdChange","useState","_useState6","_slicedToArray","_useState5","assets","setAssets","_useState8","_useState7","loading","setLoading","prevCompany","useRef","loadAssets","_asyncToGenerator","_regeneratorRuntime","mark","group","currentAssetType","requestParams","assetFieldsByAssetType","requestPromise","response","deserializedResponse","responseAssets","currentAsset","wrap","_context2","prev","next","type","per_page","search","app_key","current","ASSET_TYPES","pad","jsonApi","_objectSpread","getRequestOptions","sent","jsonaDataFormatter","deserialize","map","asset","formatAsset","name","isPrimaryAsset","filter","Boolean","sort","sortAsset","prevState","find","id","assetId","isEmpty","rig","activeWellId","t0","console","error","stop","_callee2","_x","apply","this","arguments","useEffect","_ref4","loadEverything","_callee3","_context3","Promise","all","finish","length","_ref","queryParams","_useState2","_useState","_useState4","_useState3","_loadAssets","_callee","_context","mapAssetGetRequest","_defineProperty"],"mappings":"8iEAkDO,SAaJA,GAAA,IAKeC,EAjBhBC,IAAAA,OACAC,IAAAA,UACAC,IAAAA,QACAC,IAAAA,OACAC,IAAAA,kBACAC,IAAAA,cACAC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G,EAA3B+C,CAClBE,EAAAA,EAAAA,EAAAA,GAAAA,EAAAA,kBAAkBjD,EAAWO,IAAY,CAAA,EAAA0F,EAAAA,QAAA,CAC5CxD,SAAU,IACVxC,QAAqB,QAAZA,EAAoBA,EAAU,MACtCI,EAAkBD,GACfL,GAAU,CAAE4C,QAAS5C,IACtByF,IACH,KAAA,EAPIxD,EAAQ+D,EAAA7C,KASRjB,EAAuBkB,EAAkBA,mBAACC,YAAYpB,GAE5DhB,EACEiB,EACGoB,KAAI,SAAAC,GAAK,OAAIC,cAAY,CAAED,MAAAA,EAAOc,aAAAA,EAAcjE,kBAAAA,GAAoB,IACpEyD,KAAKC,EAASA,YAEnBzC,GAAW,GAAO,KAAA,EAAA,IAAA,MAAA,OAAA2E,EAAAvB,OAAA,GAAAsB,EACnB,MAAAnB,MAAAC,KAAAC,UAAA,CAnBDzD,GAAW,GAAM,WACQyE,EAAAlB,MAAAC,KAAAC,UAAA,CAmBzBtD,EACF,GAAG,CAACvB,EAAWiE,EAAS5D,EAAiBD,EAAeL,EAAQqE,EAAcnE,IAEvE,CAAEc,OAAAA,EAAQI,QAAAA,EACnB"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/components/AssetEditorV2/effects/index.js"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { isEmpty } from 'lodash';\n\nimport { formatAsset, getRequestOptions, sortAsset } from '../utils';\n\nimport { jsonApi } from '~/clients';\nimport { jsonaDataFormatter } from '~/utils/jsonaDataFormatter';\nimport { ASSET_TYPES } from '~/constants';\n\nexport function useSecondaryAssetSelectData({\n appKey,\n assetType,\n assetId,\n company,\n parentAssetType,\n parentAssetId,\n queryParams,\n assetFields,\n activeWellId,\n isRequiredAssetId,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(true);\n useEffect(() => {\n setLoading(true);\n async function loadAssets() {\n const response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFields),\n per_page: 10000,\n company: company !== 'all' ? company : null,\n [parentAssetType]: parentAssetId,\n ...(appKey && { app_key: appKey }),\n ...queryParams,\n });\n\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n setAssets(\n deserializedResponse\n .map(asset => formatAsset({ asset, activeWellId, isRequiredAssetId }))\n .sort(sortAsset)\n );\n setLoading(false);\n }\n loadAssets();\n }, [assetType, assetId, parentAssetType, parentAssetId, appKey, activeWellId, company]);\n\n return { assets, loading };\n}\n\nexport function usePrimaryAssetSelectData({\n appKey,\n assetType,\n company,\n groups,\n isRequiredAssetId,\n parentAssetId,\n parentAssetType,\n searchText,\n assetFields,\n currentValue,\n setCurrentOption,\n onActiveAssetIdChange,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(false);\n const prevCompany = useRef(null);\n\n const loadAssets = async group => {\n try {\n const currentAssetType = group?.type || assetType;\n const requestParams = { per_page: 10000 };\n if (parentAssetType && parentAssetId) requestParams[parentAssetType] = parentAssetId;\n if (company && company !== 'all') requestParams.company = company;\n if (searchText) requestParams.search = searchText;\n if (appKey) requestParams.app_key = appKey;\n\n prevCompany.current = company;\n const assetFieldsByAssetType =\n currentAssetType === ASSET_TYPES.pad.type\n ? [...assetFields, 'pad.active', 'pad.parent_frac_fleet_id', 'pad.current']\n : assetFields;\n\n const requestPromise = jsonApi.mapAssetGetRequest(currentAssetType)({\n ...getRequestOptions(currentAssetType, assetFieldsByAssetType),\n ...requestParams,\n });\n\n const response = await requestPromise;\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n const responseAssets = deserializedResponse\n .map(asset =>\n formatAsset({ asset, group: group?.name, isRequiredAssetId, isPrimaryAsset: true })\n )\n .filter(Boolean)\n .sort(sortAsset);\n\n if (prevCompany.current === company) {\n setAssets(prevState => [...prevState, ...responseAssets]);\n }\n if (currentValue && currentAssetType === assetType) {\n const currentAsset = responseAssets.find(\n asset => currentValue === asset.id || (asset.assetId && currentValue === asset.assetId)\n );\n if (!isEmpty(currentAsset)) {\n setCurrentOption(currentAsset);\n }\n\n if (currentAssetType === ASSET_TYPES.rig.type) {\n onActiveAssetIdChange(currentAsset?.activeWellId);\n }\n }\n } catch (e) {\n console.error(e);\n }\n };\n\n useEffect(() => {\n if (company) {\n setAssets([]);\n }\n }, [company]);\n\n useEffect(() => {\n const loadEverything = async () => {\n try {\n setLoading(true);\n\n if (groups) {\n await Promise.all(groups.map(group => loadAssets(group)));\n } else {\n await loadAssets();\n }\n } catch (e) {\n console.error(e);\n } finally {\n setLoading(false);\n }\n };\n\n loadEverything();\n }, [assetType, parentAssetType, parentAssetId, company, appKey, groups?.length]);\n\n return { assets: loading ? [] : assets, loading };\n}\n"],"names":["_ref2","_ref3","appKey","assetType","company","groups","isRequiredAssetId","parentAssetId","parentAssetType","searchText","assetFields","currentValue","setCurrentOption","onActiveAssetIdChange","useState","_useState6","_slicedToArray","_useState5","assets","setAssets","_useState8","_useState7","loading","setLoading","prevCompany","useRef","loadAssets","_asyncToGenerator","_regeneratorRuntime","mark","group","currentAssetType","requestParams","assetFieldsByAssetType","requestPromise","response","deserializedResponse","responseAssets","currentAsset","wrap","_context2","prev","next","type","per_page","search","app_key","current","ASSET_TYPES","pad","jsonApi","_objectSpread","getRequestOptions","sent","jsonaDataFormatter","deserialize","map","asset","formatAsset","name","isPrimaryAsset","filter","Boolean","sort","sortAsset","prevState","find","id","assetId","isEmpty","rig","activeWellId","t0","console","error","stop","_callee2","_x","apply","this","arguments","useEffect","_ref4","loadEverything","_callee3","_context3","Promise","all","finish","length","_ref","queryParams","_useState2","_useState","_useState4","_useState3","_loadAssets","_callee","_context","mapAssetGetRequest","_defineProperty"],"mappings":"krEAkDO,SAaJA,GAAA,IAKeC,EAjBhBC,IAAAA,OACAC,IAAAA,UACAC,IAAAA,QACAC,IAAAA,OACAC,IAAAA,kBACAC,IAAAA,cACAC,IAAAA,gBACAC,IAAAA,WACAC,IAAAA,YACAC,IAAAA,aACAC,IAAAA,iBACAC,IAAAA,sBAE4BC,EAAAA,E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AAAA,QAAA,CAC5CxD,SAAU,IACVxC,QAAqB,QAAZA,EAAoBA,EAAU,MACtCI,EAAkBD,GACfL,GAAU,CAAE4C,QAAS5C,IACtByF,IACH,KAAA,EAPIxD,EAAQ+D,EAAA7C,KASRjB,EAAuBkB,EAAkBA,mBAACC,YAAYpB,GAE5DhB,EACEiB,EACGoB,KAAI,SAAAC,GAAK,OAAIC,cAAY,CAAED,MAAAA,EAAOc,aAAAA,EAAcjE,kBAAAA,GAAoB,IACpEyD,KAAKC,EAASA,YAEnBzC,GAAW,GAAO,KAAA,EAAA,IAAA,MAAA,OAAA2E,EAAAvB,OAAA,GAAAsB,EACnB,MAAAnB,MAAAC,KAAAC,UAAA,CAnBDzD,GAAW,GAAM,WACQyE,EAAAlB,MAAAC,KAAAC,UAAA,CAmBzBtD,EACF,GAAG,CAACvB,EAAWiE,EAAS5D,EAAiBD,EAAeL,EAAQqE,EAAcnE,IAEvE,CAAEc,OAAAA,EAAQI,QAAAA,EACnB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/helpers/slicedToArray"),n=require("@babel/runtime/regenerator"),a=require("react"),i=require("lodash"),u=require("../utils/index.js");require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var o=require("../../../clients/jsonApi/index.js");require("../../../clients/subscriptions.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js"),require("../../../clients/sso/auth0.js"),require("../../../clients/sso/oauth2.js");var c=require("../../../utils/jsonaDataFormatter.js"),l=require("../../AssetEditor/constants.js");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/appPackages.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var p=require("../../../constants/assetTypes.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var f=d(e),q=d(t),j=d(r),m=d(s),y=d(n);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){f.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.usePrimaryAssetSelectData=function(e){var t,r,s=e.appKey,n=e.assetType,d=e.company,f=e.groups,b=e.isRequiredAssetId,v=e.parentAssetId,h=e.parentAssetType,A=e.searchValue,O=e.assetFields,P=e.currentValue,E=e.setCurrentOption,x=e.scrollPage,D=e.onActiveAssetIdChange,S=e.isDrillingPlatformApp,w=a.useState([]),R=m.default(w,2),_=R[0],T=R[1],k=a.useState(!1),I=m.default(k,2),G=I[0],C=I[1],F=a.useRef(null),z=n===p.ASSET_TYPES.pad.type?[].concat(j.default(O),["pad.active","pad.parent_frac_fleet_id"]):O,M=(t=q.default(y.default.mark((function e(t){var r,a,p,f,q,m;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=(null==t?void 0:t.type)||n,C(!0),a={per_page:l.PER_PAGE,page:x},h&&v&&(a[h]=v),d&&"all"!==d&&(a.company=d),A&&(a.search=A),s&&(a.app_key=s),F.current=d,p=o.mapAssetGetRequest(r)(g(g({},u.getRequestOptions(r,z)),a)),e.next=12,p;case 12:f=e.sent,q=c.jsonaDataFormatter.deserialize(f),m=i.map(q,(function(e){return u.formatAsset({asset:e,group:null==t?void 0:t.name,isRequiredAssetId:b,isPrimaryAsset:!0,isDrillingPlatformApp:S})})).sort(u.sortAsset),F.current===d&&T((function(e){return i.uniqBy([].concat(j.default(e),j.default(m)),"id")})),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.error(e.t0);case 21:return e.prev=21,C(!1),e.finish(21);case 24:case"end":return e.stop()}}),e,null,[[0,18,21,24]])}))),function(e){return t.apply(this,arguments)}),V=(r=q.default(y.default.mark((function e(){var t,r,s,a,l,d,f;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.mapAssetGetRequest(n)(g(g({},u.getRequestOptions(n,z)),{},{ids:P}));case 2:if(t=e.sent,!i.isEmpty(t.data)){e.next=7;break}return e.next=6,o.getAssets(g(g({},u.getRequestOptions(n,z)),{},{ids:P}));case 6:t=e.sent;case 7:r=c.jsonaDataFormatter.deserialize(t),s=u.formatAsset({asset:r[0],isPrimaryAsset:!0,isRequiredAssetId:b,isDrillingPlatformApp:S}),E(s),n===p.ASSET_TYPES.rig.type&&(f=S?Number(null===(a=t)||void 0===a||null===(l=a.included)||void 0===l||null===(d=l[0])||void 0===d?void 0:d.id):(null==s?void 0:s.activeWellId)||null,D(f));case 11:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)});return a.useEffect((function(){d&&T([])}),[d]),a.useEffect((function(){f?f.forEach((function(e){M(e)})):M()}),[n,h,v,d,s,null==f?void 0:f.length,A,x]),a.useEffect((function(){P&&V()}),[]),{assets:_,loading:G}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/helpers/slicedToArray"),n=require("@babel/runtime/regenerator"),i=require("react"),a=require("lodash"),u=require("../utils/index.js");require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var o=require("../../../clients/jsonApi/index.js");require("../../../clients/subscriptions/constants.js"),require("../../../clients/subscriptions.v1.js"),require("../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js"),require("../../../clients/sso/auth0.js"),require("../../../clients/sso/oauth2.js");var c=require("../../../utils/jsonaDataFormatter.js"),l=require("../../AssetEditor/constants.js");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/appPackages.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var p=require("../../../constants/assetTypes.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var d=f(e),q=f(t),j=f(r),b=f(s),y=f(n);function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){d.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.usePrimaryAssetSelectData=function(e){var t,r,s=e.appKey,n=e.assetType,f=e.company,d=e.groups,m=e.isRequiredAssetId,v=e.parentAssetId,h=e.parentAssetType,A=e.searchValue,O=e.assetFields,P=e.currentValue,E=e.setCurrentOption,x=e.scrollPage,D=e.onActiveAssetIdChange,S=e.isDrillingPlatformApp,w=i.useState([]),R=b.default(w,2),_=R[0],T=R[1],k=i.useState(!1),I=b.default(k,2),G=I[0],C=I[1],F=i.useRef(null),z=n===p.ASSET_TYPES.pad.type?[].concat(j.default(O),["pad.active","pad.parent_frac_fleet_id"]):O,M=(t=q.default(y.default.mark((function e(t){var r,i,p,d,q,b;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=(null==t?void 0:t.type)||n,C(!0),i={per_page:l.PER_PAGE,page:x},h&&v&&(i[h]=v),f&&"all"!==f&&(i.company=f),A&&(i.search=A),s&&(i.app_key=s),F.current=f,p=o.mapAssetGetRequest(r)(g(g({},u.getRequestOptions(r,z)),i)),e.next=12,p;case 12:d=e.sent,q=c.jsonaDataFormatter.deserialize(d),b=a.map(q,(function(e){return u.formatAsset({asset:e,group:null==t?void 0:t.name,isRequiredAssetId:m,isPrimaryAsset:!0,isDrillingPlatformApp:S})})).sort(u.sortAsset),F.current===f&&T((function(e){return a.uniqBy([].concat(j.default(e),j.default(b)),"id")})),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.error(e.t0);case 21:return e.prev=21,C(!1),e.finish(21);case 24:case"end":return e.stop()}}),e,null,[[0,18,21,24]])}))),function(e){return t.apply(this,arguments)}),V=(r=q.default(y.default.mark((function e(){var t,r,s,i,l,f,d;return y.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.mapAssetGetRequest(n)(g(g({},u.getRequestOptions(n,z)),{},{ids:P}));case 2:if(t=e.sent,!a.isEmpty(t.data)){e.next=7;break}return e.next=6,o.getAssets(g(g({},u.getRequestOptions(n,z)),{},{ids:P}));case 6:t=e.sent;case 7:r=c.jsonaDataFormatter.deserialize(t),s=u.formatAsset({asset:r[0],isPrimaryAsset:!0,isRequiredAssetId:m,isDrillingPlatformApp:S}),E(s),n===p.ASSET_TYPES.rig.type&&(d=S?Number(null===(i=t)||void 0===i||null===(l=i.included)||void 0===l||null===(f=l[0])||void 0===f?void 0:f.id):(null==s?void 0:s.activeWellId)||null,D(d));case 11:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)});return i.useEffect((function(){f&&T([])}),[f]),i.useEffect((function(){d?d.forEach((function(e){M(e)})):M()}),[n,h,v,f,s,null==d?void 0:d.length,A,x]),i.useEffect((function(){P&&V()}),[]),{assets:_,loading:G}};
2
2
  //# sourceMappingURL=usePrimaryAssetSelectData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePrimaryAssetSelectData.js","sources":["../../../../../src/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { isEmpty, map, uniqBy } from 'lodash';\n\nimport { formatAsset, getRequestOptions, sortAsset } from '../utils';\n\nimport { jsonApi } from '~/clients';\nimport { jsonaDataFormatter } from '~/utils/jsonaDataFormatter';\nimport { PER_PAGE } from '~/components/AssetEditor/constants';\nimport { ASSET_TYPES } from '~/constants';\n\nexport function usePrimaryAssetSelectData({\n appKey,\n assetType,\n company,\n groups,\n isRequiredAssetId,\n parentAssetId,\n parentAssetType,\n searchValue,\n assetFields,\n currentValue,\n setCurrentOption,\n scrollPage,\n onActiveAssetIdChange,\n isDrillingPlatformApp,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(false);\n const prevCompany = useRef(null);\n\n const assetFieldsByAssetType =\n assetType === ASSET_TYPES.pad.type\n ? [...assetFields, 'pad.active', 'pad.parent_frac_fleet_id']\n : assetFields;\n\n const loadAssets = async group => {\n try {\n const currentAssetType = group?.type || assetType;\n setLoading(true);\n const requestParams = { per_page: PER_PAGE, page: scrollPage };\n if (parentAssetType && parentAssetId) requestParams[parentAssetType] = parentAssetId;\n if (company && company !== 'all') requestParams.company = company;\n if (searchValue) requestParams.search = searchValue;\n if (appKey) requestParams.app_key = appKey;\n\n prevCompany.current = company;\n const requestPromise = jsonApi.mapAssetGetRequest(currentAssetType)({\n ...getRequestOptions(currentAssetType, assetFieldsByAssetType),\n ...requestParams,\n });\n\n const response = await requestPromise;\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n const responseAssets = map(deserializedResponse, asset =>\n formatAsset({\n asset,\n group: group?.name,\n isRequiredAssetId,\n isPrimaryAsset: true,\n isDrillingPlatformApp,\n })\n ).sort(sortAsset);\n\n if (prevCompany.current === company) {\n setAssets(prevState => uniqBy([...prevState, ...responseAssets], 'id'));\n }\n } catch (e) {\n console.error(e);\n } finally {\n setLoading(false);\n }\n };\n\n const loadCurrentOption = async () => {\n let response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFieldsByAssetType),\n ids: currentValue,\n });\n if (isEmpty(response.data)) {\n // NOTE: Try fetch current option from v2/assets\n response = await jsonApi.getAssets({\n ...getRequestOptions(assetType, assetFieldsByAssetType),\n ids: currentValue,\n });\n }\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n const formattedAsset = formatAsset({\n asset: deserializedResponse[0],\n isPrimaryAsset: true,\n isRequiredAssetId,\n isDrillingPlatformApp,\n });\n\n setCurrentOption(formattedAsset);\n if (assetType === ASSET_TYPES.rig.type) {\n const activeWellId = isDrillingPlatformApp\n ? Number(response?.included?.[0]?.id)\n : formattedAsset?.activeWellId || null;\n onActiveAssetIdChange(activeWellId);\n }\n };\n\n useEffect(() => {\n if (company) {\n setAssets([]);\n }\n }, [company]);\n\n useEffect(() => {\n if (groups) {\n groups.forEach(group => {\n loadAssets(group);\n });\n return;\n }\n loadAssets();\n }, [\n assetType,\n parentAssetType,\n parentAssetId,\n company,\n appKey,\n groups?.length,\n searchValue,\n scrollPage,\n ]);\n\n useEffect(() => {\n if (currentValue) {\n loadCurrentOption();\n }\n }, []);\n\n return { assets, loading };\n}\n"],"names":["_ref","_ref2","_ref3","appKey","assetType","company","groups","isRequiredAssetId","parentAssetId","parentAssetType","searchValue","assetFields","currentValue","setCurrentOption","scrollPage","onActiveAssetIdChange","isDrillingPlatformApp","useState","_useState2","_slicedToArray","_useState","assets","setAssets","_useState4","_useState3","loading","setLoading","prevCompany","useRef","assetFieldsByAssetType","ASSET_TYPES","pad","type","concat","_toConsumableArray","loadAssets","_asyncToGenerator","_regeneratorRuntime","mark","group","currentAssetType","requestParams","requestPromise","response","deserializedResponse","responseAssets","wrap","_context","prev","next","per_page","PER_PAGE","page","search","app_key","current","jsonApi","_objectSpread","getRequestOptions","sent","jsonaDataFormatter","deserialize","map","asset","formatAsset","name","isPrimaryAsset","sort","sortAsset","prevState","uniqBy","t0","console","error","finish","stop","_callee","_x","apply","this","arguments","loadCurrentOption","_callee2","formattedAsset","_response","_response$included","_response$included$","activeWellId","_context2","ids","isEmpty","data","getAssets","rig","Number","included","id","useEffect","forEach","length"],"mappings":"0lEAUO,SAeJA,GAAA,IAUeC,EAuCUC,EA/D1BC,IAAAA,OACAC,IAAAA,UACAC,IAAAA,QACAC,IAAAA,OACAC,IAAAA,kBACAC,IAAAA,cACAC,IAAAA,gBACAC,IAAAA,YACAC,IAAAA,YACAC,IAAAA,aACAC,IAAAA,iBACAC,IAAAA,WACAC,IAAAA,sBACAC,IAAAA,sBAE4BC,EAAAA,EAAQA,SAAC,IAAGC,EAAAC,EAAAA,QAAAC,EAAA,GAAjCC,EAAMH,EAAA,GAAEI,EAASJ,EAAA,GACMD,EAAAA,EAAQA,UAAC,GAAMM,EAAAJ,EAAAA,QAAAK,EAAA,GAAtCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAcC,SAAO,MAErBC,EACJzB,IAAc0B,EAAAA,YAAYC,IAAIC,KAAI,GAAAC,OAAAC,EAAAA,QAC1BvB,GAAa,CAAA,aAAc,6BAC/BA,EAEAwB,GAAUlC,EAAAmC,EAAAA,QAAAC,EAAAA,QAAAC,MAAG,WAAMC,GAAK,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAR,UAAAS,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAcxB,OAdwBF,EAAAC,KAAA,EAEpBR,GAAmBD,eAAAA,EAAOP,OAAQ5B,EACxCsB,GAAW,GACLe,EAAgB,CAAES,SAAUC,EAAQA,SAAEC,KAAMtC,GAC9CL,GAAmBD,IAAei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6F,OACRzF,EACAI,IAGFmF,EAAAA,WAAU,WACJrF,GACFqE,GAEH,GAAE,IAEI,CAAE5D,OAAAA,EAAQI,QAAAA,EACnB"}
1
+ {"version":3,"file":"usePrimaryAssetSelectData.js","sources":["../../../../../src/components/AssetEditorV2/effects/usePrimaryAssetSelectData.js"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { isEmpty, map, uniqBy } from 'lodash';\n\nimport { formatAsset, getRequestOptions, sortAsset } from '../utils';\n\nimport { jsonApi } from '~/clients';\nimport { jsonaDataFormatter } from '~/utils/jsonaDataFormatter';\nimport { PER_PAGE } from '~/components/AssetEditor/constants';\nimport { ASSET_TYPES } from '~/constants';\n\nexport function usePrimaryAssetSelectData({\n appKey,\n assetType,\n company,\n groups,\n isRequiredAssetId,\n parentAssetId,\n parentAssetType,\n searchValue,\n assetFields,\n currentValue,\n setCurrentOption,\n scrollPage,\n onActiveAssetIdChange,\n isDrillingPlatformApp,\n}) {\n const [assets, setAssets] = useState([]);\n const [loading, setLoading] = useState(false);\n const prevCompany = useRef(null);\n\n const assetFieldsByAssetType =\n assetType === ASSET_TYPES.pad.type\n ? [...assetFields, 'pad.active', 'pad.parent_frac_fleet_id']\n : assetFields;\n\n const loadAssets = async group => {\n try {\n const currentAssetType = group?.type || assetType;\n setLoading(true);\n const requestParams = { per_page: PER_PAGE, page: scrollPage };\n if (parentAssetType && parentAssetId) requestParams[parentAssetType] = parentAssetId;\n if (company && company !== 'all') requestParams.company = company;\n if (searchValue) requestParams.search = searchValue;\n if (appKey) requestParams.app_key = appKey;\n\n prevCompany.current = company;\n const requestPromise = jsonApi.mapAssetGetRequest(currentAssetType)({\n ...getRequestOptions(currentAssetType, assetFieldsByAssetType),\n ...requestParams,\n });\n\n const response = await requestPromise;\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n const responseAssets = map(deserializedResponse, asset =>\n formatAsset({\n asset,\n group: group?.name,\n isRequiredAssetId,\n isPrimaryAsset: true,\n isDrillingPlatformApp,\n })\n ).sort(sortAsset);\n\n if (prevCompany.current === company) {\n setAssets(prevState => uniqBy([...prevState, ...responseAssets], 'id'));\n }\n } catch (e) {\n console.error(e);\n } finally {\n setLoading(false);\n }\n };\n\n const loadCurrentOption = async () => {\n let response = await jsonApi.mapAssetGetRequest(assetType)({\n ...getRequestOptions(assetType, assetFieldsByAssetType),\n ids: currentValue,\n });\n if (isEmpty(response.data)) {\n // NOTE: Try fetch current option from v2/assets\n response = await jsonApi.getAssets({\n ...getRequestOptions(assetType, assetFieldsByAssetType),\n ids: currentValue,\n });\n }\n const deserializedResponse = jsonaDataFormatter.deserialize(response);\n\n const formattedAsset = formatAsset({\n asset: deserializedResponse[0],\n isPrimaryAsset: true,\n isRequiredAssetId,\n isDrillingPlatformApp,\n });\n\n setCurrentOption(formattedAsset);\n if (assetType === ASSET_TYPES.rig.type) {\n const activeWellId = isDrillingPlatformApp\n ? Number(response?.included?.[0]?.id)\n : formattedAsset?.activeWellId || null;\n onActiveAssetIdChange(activeWellId);\n }\n };\n\n useEffect(() => {\n if (company) {\n setAssets([]);\n }\n }, [company]);\n\n useEffect(() => {\n if (groups) {\n groups.forEach(group => {\n loadAssets(group);\n });\n return;\n }\n loadAssets();\n }, [\n assetType,\n parentAssetType,\n parentAssetId,\n company,\n appKey,\n groups?.length,\n searchValue,\n scrollPage,\n ]);\n\n useEffect(() => {\n if (currentValue) {\n loadCurrentOption();\n }\n }, []);\n\n return { assets, loading };\n}\n"],"names":["_ref","_ref2","_ref3","appKey","assetType","company","groups","isRequiredAssetId","parentAssetId","parentAssetType","searchValue","assetFields","currentValue","setCurrentOption","scrollPage","onActiveAssetIdChange","isDrillingPlatformApp","useState","_useState2","_slicedToArray","_useState","assets","setAssets","_useState4","_useState3","loading","setLoading","prevCompany","useRef","assetFieldsByAssetType","ASSET_TYPES","pad","type","concat","_toConsumableArray","loadAssets","_asyncToGenerator","_regeneratorRuntime","mark","group","currentAssetType","requestParams","requestPromise","response","deserializedResponse","responseAssets","wrap","_context","prev","next","per_page","PER_PAGE","page","search","app_key","current","jsonApi","_objectSpread","getRequestOptions","sent","jsonaDataFormatter","deserialize","map","asset","formatAsset","name","isPrimaryAsset","sort","sortAsset","prevState","uniqBy","t0","console","error","finish","stop","_callee","_x","apply","this","arguments","loadCurrentOption","_callee2","formattedAsset","_response","_response$included","_response$included$","activeWellId","_context2","ids","isEmpty","data","getAssets","rig","Number","included","id","useEffect","forEach","length"],"mappings":"8tEAUO,SAeJA,GAAA,IAUeC,EAuCUC,EA/D1BC,IAAAA,OACAC,IAAAA,UACAC,IAAAA,QACAC,IAAAA,OACAC,IAAAA,kBACAC,IAAAA,cACAC,IAAAA,gBACAC,IAAAA,YACAC,IAAAA,YACAC,IAAAA,aACAC,IAAAA,iBACAC,IAAAA,WACAC,IAAAA,sBACAC,IAAAA,sBAE4BC,EAAAA,EAAQA,SAAC,IAAGC,EAAAC,EAAAA,QAAAC,EAAA,GAAjCC,EAAMH,EAAA,GAAEI,EAASJ,EAAA,GACMD,EAAAA,EAAQA,UAAC,GAAMM,EAAAJ,EAAAA,QAAAK,EAAA,GAAtCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAcC,SAAO,MAErBC,EACJzB,IAAc0B,EAAAA,YAAYC,IAAIC,KAAI,GAAAC,OAAAC,EAAAA,QAC1BvB,GAAa,CAAA,aAAc,6BAC/BA,EAEAwB,GAAUlC,EAAAmC,EAAAA,QAAAC,EAAAA,QAAAC,MAAG,WAAMC,GAAK,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAR,UAAAS,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAcxB,OAdwBF,EAAAC,KAAA,EAEpBR,GAAmBD,eAAAA,EAAOP,OAAQ5B,EACxCsB,GAAW,GACLe,EAAgB,CAAES,SAAUC,EAAQA,SAAEC,KAAMtC,GAC9CL,GAAmBD,IAAeiC,EAAchC,GAAm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I,IAGFmF,EAAAA,WAAU,WACJrF,GACFqE,GAEH,GAAE,IAEI,CAAE5D,OAAAA,EAAQI,QAAAA,EACnB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),i=require("prop-types"),t=require("react-player"),a=require("classnames"),n=require("@material-ui/core/styles"),r=require("@material-ui/core"),o=require("@material-ui/icons/Image"),c=require("@material-ui/icons/Fullscreen"),l=require("@material-ui/core/colors/grey"),u=require("../NewDocumentViewer/NewDocumentViewer.js"),m=require("../NewDocumentViewer/icons/UnavailableFileIcon.js"),d=require("./styles.css.js"),h=require("../FileTypeIcon.js"),p=require("../ImageViewer/index.js"),q=require("../IconButton/index.js"),j=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js"),g=require("../../utils/filePreview.js"),v=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/subscriptions.js"),require("../../clients/jsonApi/index.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../utils/env.js"),require("../GradientManager/configuration/constants.js");var I=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../StatusBadge/constants.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../constants/streamSourceType.js"),require("../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var x=require("react/jsx-runtime");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var b=require("../../utils/main.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w=N(e),y=N(i),C=N(t),F=N(a),A=N(o),P=N(c),D=N(l),S=D.default[200],W=D.default[400],z={label:"small",value:135},R={label:"medium",value:300},U={fileImage:function(e,s){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:s===z.label?z.value:R.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{padding:"10px 10px 10px 5px",border:"1px solid #616161",borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:S,borderRadius:3,marginTop:10,height:135,width:135}},L=function(e){var s=I(e.attachmentFileName)||e.attachmentUrl;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{onClick:e.openLightbox,className:d.cAttachmentImg,children:[x.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:s,style:U.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),x.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:d.cAttachmentImgPreviwBtn,children:x.jsx(P.default,{})})]}),!e.imageIsLoaded&&x.jsx("div",{style:U.imagePlaceholder,children:x.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:W,fontSize:"large"})}),e.lightboxIsOpen&&x.jsx(p,{mainSrc:s,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},k=function(e){var s=b.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),i=I(e.attachmentFileName),t=g.getIsPreviewUnavailable(s);return x.jsxs("div",{className:d.cAttachmentFileWrapper,children:[x.jsxs("div",{className:F.default(d.cAttachmentFileDownloadWrapper,t&&e.classes.disabledPreview),style:U.fileDownloadWrapper,onClick:function(){t||e.openPreview()},children:[t?x.jsx(m.UnavailableFileIcon,{className:e.classes.unavailableFileIcon}):x.jsx(h,{fileName:e.displayName||e.attachmentUrl,className:d.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),x.jsxs("div",{className:e.classes.titleContainer,children:[t&&x.jsx("div",{className:e.classes.caption,children:"Preview unavailable"}),x.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:F.default(d.cAttachmentFileDownloadWrapperFileName,t&&e.classes.fileName),children:x.jsx(r.Typography,{variant:"subtitle2",noWrap:!0,className:e.classes.unavailableFileName,children:s})})]}),x.jsx(u,{fileUrl:i,classes:{root:e.classes.dialogRoot,paper:j.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},fileName:s,fileSize:e.attachmentSize,onClose:e.closePreview,open:e.previewIsOpen})]}),x.jsx("a",{download:e.displayName,href:i,className:d.cAttachmentFileDownloadWrapperForm,children:x.jsx(q,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:x.jsx(v.DownloadIcon,{size:24,className:e.classes.downloadIcon})})})]})};function O(e){var i=s.useState(!1),t=w.default(i,2),a=t[0],n=t[1],r=s.useState(!1),o=w.default(r,2),c=o[0],l=o[1],u=s.useState(!1),m=w.default(u,2),h=m[0],p=m[1],q=e.displayName||e.attachmentUrl||e.fileName,g=f.getIsImage(q),v=f.getIsVideo(q),b=I(!e.attachmentUrl&&e.fileName),N=e.attachmentUrl||b,y=s.useCallback((function(e){return e.preventDefault()}),[]);return g?x.jsx("div",{className:d.cAttachment,children:x.jsx(L,{size:e.size,openLightbox:function(){return l(!0)},attachmentFileName:e.fileName,attachmentUrl:e.attachmentUrl,setImageIsLoaded:function(){return n(!0)},imageIsLoaded:a,lightboxIsOpen:c,handleLightboxOpen:function(){j.isNativeDetected&&document.documentElement.addEventListener("touchmove",y,{passive:!1})},handleLightboxClose:function(){j.isNativeDetected&&document.documentElement.removeEventListener("touchmove",y),l(!1)},classes:e.classes})}):v&&C.default.canPlay(N)?x.jsx("div",{className:d.cAttachment,children:x.jsx(C.default,{"data-testid":"".concat("Attachment","_player"),className:d.cAttachmentReactPlayer,url:N,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===z.label?z.value:R.value,width:null})}):x.jsx("div",{className:d.cAttachment,children:x.jsx(k,{attachmentUrl:N,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return p(!0)},closePreview:function(e){e.stopPropagation(),p(!1)},previewIsOpen:h,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:y.default.string.isRequired,attachmentSize:y.default.number,displayName:y.default.string,fileName:y.default.string,size:y.default.oneOf([z.label,R.label]),classes:y.default.shape({}).isRequired,small:y.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:R.label,small:!1};var E=n.withStyles((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:400},downloadIcon:{color:e.palette.primary.text3},disabledPreview:{backgroundColor:e.palette.primary.text9},unavailableFileIcon:{marginRight:12,minWidth:32},titleContainer:{display:"flex",flexDirection:"column",width:"100%"},caption:{fontSize:12,fontWeight:400,width:"fit-content"},unavailableFileName:{fontSize:12,fontWeight:400}}}))(O);module.exports=E;
1
+ "use strict";var e=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),i=require("prop-types"),t=require("react-player"),a=require("classnames"),n=require("@material-ui/core/styles"),r=require("@material-ui/core"),o=require("@material-ui/icons/Image"),c=require("@material-ui/icons/Fullscreen"),l=require("@material-ui/core/colors/grey"),u=require("../NewDocumentViewer/NewDocumentViewer.js"),m=require("../NewDocumentViewer/icons/UnavailableFileIcon.js"),d=require("./styles.css.js"),h=require("../FileTypeIcon.js"),p=require("../ImageViewer/index.js"),q=require("../IconButton/index.js"),j=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js"),g=require("../../utils/filePreview.js"),v=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/subscriptions.v1.js"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../utils/env.js"),require("../GradientManager/configuration/constants.js");var I=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../StatusBadge/constants.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../constants/streamSourceType.js"),require("../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var b=require("react/jsx-runtime");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var x=require("../../utils/main.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w=N(e),y=N(i),C=N(t),F=N(a),A=N(o),P=N(c),D=N(l),S=D.default[200],W=D.default[400],z={label:"small",value:135},R={label:"medium",value:300},U={fileImage:function(e,s){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:s===z.label?z.value:R.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{padding:"10px 10px 10px 5px",border:"1px solid #616161",borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:S,borderRadius:3,marginTop:10,height:135,width:135}},L=function(e){var s=I(e.attachmentFileName)||e.attachmentUrl;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{onClick:e.openLightbox,className:d.cAttachmentImg,children:[b.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:s,style:U.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),b.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:d.cAttachmentImgPreviwBtn,children:b.jsx(P.default,{})})]}),!e.imageIsLoaded&&b.jsx("div",{style:U.imagePlaceholder,children:b.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:W,fontSize:"large"})}),e.lightboxIsOpen&&b.jsx(p,{mainSrc:s,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},k=function(e){var s=x.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),i=I(e.attachmentFileName),t=g.getIsPreviewUnavailable(s);return b.jsxs("div",{className:d.cAttachmentFileWrapper,children:[b.jsxs("div",{className:F.default(d.cAttachmentFileDownloadWrapper,t&&e.classes.disabledPreview),style:U.fileDownloadWrapper,onClick:function(){t||e.openPreview()},children:[t?b.jsx(m.UnavailableFileIcon,{className:e.classes.unavailableFileIcon}):b.jsx(h,{fileName:e.displayName||e.attachmentUrl,className:d.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),b.jsxs("div",{className:e.classes.titleContainer,children:[t&&b.jsx("div",{className:e.classes.caption,children:"Preview unavailable"}),b.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:F.default(d.cAttachmentFileDownloadWrapperFileName,t&&e.classes.fileName),children:b.jsx(r.Typography,{variant:"subtitle2",noWrap:!0,className:e.classes.unavailableFileName,children:s})})]}),b.jsx(u,{fileUrl:i,classes:{root:e.classes.dialogRoot,paper:j.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},fileName:s,fileSize:e.attachmentSize,onClose:e.closePreview,open:e.previewIsOpen})]}),b.jsx("a",{download:e.displayName,href:i,className:d.cAttachmentFileDownloadWrapperForm,children:b.jsx(q,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:b.jsx(v.DownloadIcon,{size:24,className:e.classes.downloadIcon})})})]})};function O(e){var i=s.useState(!1),t=w.default(i,2),a=t[0],n=t[1],r=s.useState(!1),o=w.default(r,2),c=o[0],l=o[1],u=s.useState(!1),m=w.default(u,2),h=m[0],p=m[1],q=e.displayName||e.attachmentUrl||e.fileName,g=f.getIsImage(q),v=f.getIsVideo(q),x=I(!e.attachmentUrl&&e.fileName),N=e.attachmentUrl||x,y=s.useCallback((function(e){return e.preventDefault()}),[]);return g?b.jsx("div",{className:d.cAttachment,children:b.jsx(L,{size:e.size,openLightbox:function(){return l(!0)},attachmentFileName:e.fileName,attachmentUrl:e.attachmentUrl,setImageIsLoaded:function(){return n(!0)},imageIsLoaded:a,lightboxIsOpen:c,handleLightboxOpen:function(){j.isNativeDetected&&document.documentElement.addEventListener("touchmove",y,{passive:!1})},handleLightboxClose:function(){j.isNativeDetected&&document.documentElement.removeEventListener("touchmove",y),l(!1)},classes:e.classes})}):v&&C.default.canPlay(N)?b.jsx("div",{className:d.cAttachment,children:b.jsx(C.default,{"data-testid":"".concat("Attachment","_player"),className:d.cAttachmentReactPlayer,url:N,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===z.label?z.value:R.value,width:null})}):b.jsx("div",{className:d.cAttachment,children:b.jsx(k,{attachmentUrl:N,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return p(!0)},closePreview:function(e){e.stopPropagation(),p(!1)},previewIsOpen:h,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:y.default.string.isRequired,attachmentSize:y.default.number,displayName:y.default.string,fileName:y.default.string,size:y.default.oneOf([z.label,R.label]),classes:y.default.shape({}).isRequired,small:y.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:R.label,small:!1};var E=n.withStyles((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:400},downloadIcon:{color:e.palette.primary.text3},disabledPreview:{backgroundColor:e.palette.primary.text9},unavailableFileIcon:{marginRight:12,minWidth:32},titleContainer:{display:"flex",flexDirection:"column",width:"100%"},caption:{fontSize:12,fontWeight:400,width:"fit-content"},unavailableFileName:{fontSize:12,fontWeight:400}}}))(O);module.exports=E;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n const fileUrl = useSignedURL(props.attachmentFileName);\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={fileUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={fileUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","jsxs","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","fileUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"k2IA2BMA,EAAUC,EAAAA,QAAK,KACfC,EAAUD,EAAAA,QAAK,KAEfE,EACG,CAAEC,MAAO,QAASC,MAAO,KAD5BF,EAEI,CAAEC,MAAO,SAAUC,MAAO,KAG9BC,EAAQ,CACZC,UAAW,SAACC,EAAeC,GAAI,MAAM,CACnCC,SAAU,OACVC,aAAc,EACdC,SAAU,SAGVC,UAAWJ,IAASN,EAAYC,MAAQD,EAAYE,MAAQF,EAAaE,MACzES,QAASN,EAAgB,UAAY,OACrCO,OAAQ,UACR,EACFC,oBAAqB,CACnBC,QAAS,qBACTC,OAA2B,oBAC3BP,aAAc,EACdD,SAAU,IACVS,MAAO,OAETC,iBAAkB,CAChBC,SAAU,WACVC,gBAAiBtB,EACjBW,aAAc,EACdY,UAAW,GACXC,OAAQ,IACRL,MAAO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R,EAAMS,QAAQC,QAAQC,OAE/BhG,gBAAiB,CACfnD,gBAAiBwI,EAAMS,QAAQC,QAAQE,OAEzC9F,oBAAqB,CACnB+F,YAAa,GACbC,SAAU,IAEZ5F,eAAgB,CACdlE,QAAS,OACT+J,cAAe,SACf1J,MAAO,QAET8D,QAAS,CACP5B,SAAU,GACVgH,WAAY,IACZlJ,MAAO,eAETmE,oBAAqB,CACnBjC,SAAU,GACVgH,WAAY,KAEf,GAmOcR,CAAsBlD"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n const fileUrl = useSignedURL(props.attachmentFileName);\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={fileUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={fileUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","jsxs","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","fileUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"g+IA2BMA,EAAUC,EAAAA,QAAK,KACfC,EAAUD,EAAAA,QAAK,KAEfE,EACG,CAAEC,MAAO,QAASC,MAAO,KAD5BF,EAEI,CAAEC,MAAO,SAAUC,MAAO,KAG9BC,EAAQ,CACZC,UAAW,SAACC,EAAeC,GAAI,MAAM,CACnCC,SAAU,OACVC,aAAc,EACdC,SAAU,SAGVC,UAAWJ,IAASN,EAAYC,MAAQD,EAAYE,MAAQF,EAAaE,MACzES,QAASN,EAAgB,UAAY,OACrCO,OAAQ,UACR,EACFC,oBAAqB,CACnBC,QAAS,qBACTC,OAA2B,oBAC3BP,aAAc,EACdD,SAAU,IACVS,MAAO,OAETC,iBAAkB,CAChBC,SAA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