@corva/ui 3.76.0-0 → 3.76.0-10

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 (99) hide show
  1. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js +1 -1
  2. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
  3. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  4. package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js +2 -0
  5. package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
  6. package/cjs-bundle/components/Comment/index.js +1 -1
  7. package/cjs-bundle/components/Comment/index.js.map +1 -1
  8. package/cjs-bundle/components/Comment/useComment.js +2 -0
  9. package/cjs-bundle/components/Comment/useComment.js.map +1 -0
  10. package/cjs-bundle/components/CommentCard/CommentCard.scss.js +1 -1
  11. package/cjs-bundle/components/CommentInput/index.js +1 -1
  12. package/cjs-bundle/components/CommentInput/index.js.map +1 -1
  13. package/cjs-bundle/components/CommentInput/useCommentInput.js +2 -0
  14. package/cjs-bundle/components/CommentInput/useCommentInput.js.map +1 -0
  15. package/cjs-bundle/components/CommentInputNext/CommentInputNext.scss.js +1 -1
  16. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  17. package/cjs-bundle/components/FeedCard/FeedCard.scss.js +1 -1
  18. package/cjs-bundle/components/FileUploadIconButton.js +1 -1
  19. package/cjs-bundle/components/FileUploadIconButton.js.map +1 -1
  20. package/cjs-bundle/components/useFileUploadIconButton.js +2 -0
  21. package/cjs-bundle/components/useFileUploadIconButton.js.map +1 -0
  22. package/cjs-bundle/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  23. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  24. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  25. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  26. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  27. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  28. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  29. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  30. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  31. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  32. package/components/AttachmentPreview/AttachmentPreview.d.ts +1 -0
  33. package/components/AttachmentPreview/AttachmentPreview.d.ts.map +1 -1
  34. package/components/AttachmentPreview/AttachmentPreview.js +1 -1
  35. package/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
  36. package/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  37. package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts +2 -0
  38. package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts.map +1 -0
  39. package/components/AttachmentPreview/useScrollOverflow.d.ts +16 -0
  40. package/components/AttachmentPreview/useScrollOverflow.d.ts.map +1 -0
  41. package/components/AttachmentPreview/useScrollOverflow.js +2 -0
  42. package/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
  43. package/components/Comment/__tests__/useComment.test.d.ts +2 -0
  44. package/components/Comment/__tests__/useComment.test.d.ts.map +1 -0
  45. package/components/Comment/index.d.ts +2 -22
  46. package/components/Comment/index.js +1 -1
  47. package/components/Comment/index.js.map +1 -1
  48. package/components/Comment/useComment.d.ts +22 -0
  49. package/components/Comment/useComment.d.ts.map +1 -0
  50. package/components/Comment/useComment.js +2 -0
  51. package/components/Comment/useComment.js.map +1 -0
  52. package/components/CommentCard/CommentCard.scss.js +1 -1
  53. package/components/CommentInput/__tests__/useCommentInput.test.d.ts +2 -0
  54. package/components/CommentInput/__tests__/useCommentInput.test.d.ts.map +1 -0
  55. package/components/CommentInput/index.d.ts +26 -24
  56. package/components/CommentInput/index.js +1 -1
  57. package/components/CommentInput/index.js.map +1 -1
  58. package/components/CommentInput/useCommentInput.d.ts +26 -0
  59. package/components/CommentInput/useCommentInput.d.ts.map +1 -0
  60. package/components/CommentInput/useCommentInput.js +2 -0
  61. package/components/CommentInput/useCommentInput.js.map +1 -0
  62. package/components/CommentInputNext/CommentInputNext.scss.js +1 -1
  63. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts +2 -9
  64. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts.map +1 -1
  65. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  66. package/components/FeedCard/FeedCard.scss.js +1 -1
  67. package/components/FileUploadIconButton.d.ts +4 -60
  68. package/components/FileUploadIconButton.d.ts.map +1 -1
  69. package/components/FileUploadIconButton.js +1 -1
  70. package/components/FileUploadIconButton.js.map +1 -1
  71. package/components/__tests__/useFileUploadIconButton.test.d.ts +2 -0
  72. package/components/__tests__/useFileUploadIconButton.test.d.ts.map +1 -0
  73. package/components/useFileUploadIconButton.d.ts +15 -0
  74. package/components/useFileUploadIconButton.d.ts.map +1 -0
  75. package/components/useFileUploadIconButton.js +2 -0
  76. package/components/useFileUploadIconButton.js.map +1 -0
  77. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts +19 -6
  78. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts.map +1 -1
  79. package/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  80. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts +1 -0
  81. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts.map +1 -1
  82. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  83. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  84. package/componentsV2/AppHeader/V3/Actions/Actions.d.ts.map +1 -1
  85. package/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  86. package/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  87. package/componentsV2/AppHeader/V3/AppHeaderV3.d.ts.map +1 -1
  88. package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  89. package/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  90. package/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  91. package/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  92. package/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  93. package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts +2 -0
  94. package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts.map +1 -0
  95. package/mcp-server/server.mjs +7 -3
  96. package/package.json +1 -1
  97. package/styles/common.scss +14 -0
  98. package/styles/mixins.scss +14 -0
  99. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCommentInput.js","sources":["../../../../src/components/CommentInput/useCommentInput.js"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { patchFeedItemComment } from '../../clients/jsonApi';\nimport { isSuggestionsListOpened } from '~components/UserMention/utils';\nimport utils from '~utils/main';\nimport { notifyCommentEdit, notifyCommentPost } from '~utils/nativeMessages';\n\nconst clearedComment = {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n};\n\nexport default function useCommentInput(props) {\n const [state, setState] = useState({\n ...clearedComment,\n attachmentLoadingError: null,\n isInputFocused: false,\n });\n const latest = useRef({ props, state });\n const previousProps = useRef(null);\n const afterCommit = useRef([]);\n const update = useCallback(patch => setState(current => ({ ...current, ...patch })), []);\n const focusOnRef = () => {\n if (latest.current.props.inputRef) latest.current.props.inputRef.current.focus();\n };\n const setInitialCommentValue = () => {\n const current = latest.current.props;\n const attachmentUrl = current.editAttachment ? current.editAttachment.url : null;\n update({\n comment: current.editComment,\n attachmentUrl,\n attachmentName: attachmentUrl\n ? current.editAttachment.file_name || utils.getFileNameWithExtensionFromPath(attachmentUrl)\n : null,\n attachmentSize: current.editAttachment ? current.editAttachment.size : null,\n });\n };\n\n useLayoutEffect(() => {\n latest.current = { props, state };\n const previous = previousProps.current;\n previousProps.current = props;\n if (\n (!previous && props.editFeedItemId) ||\n (props.editFeedItemId && previous && !previous.editFeedItemId) ||\n (previous && props.editCommentId && props.editCommentId !== previous.editCommentId)\n ) {\n setInitialCommentValue();\n }\n const pending = afterCommit.current;\n afterCommit.current = [];\n pending.forEach(({ focus, callback }) => {\n if (focus) focusOnRef();\n if (typeof callback === 'function') callback();\n });\n });\n\n const clearCommentField = callback => {\n afterCommit.current.push({ focus: true, callback });\n update(clearedComment);\n };\n const handleNativeFileUpload = () => {\n const current = latest.current;\n if (current.props.editFeedItemId) {\n notifyCommentEdit(current.state.comment);\n clearCommentField(latest.current.props.exitEditMode);\n } else {\n notifyCommentPost(current.state.comment);\n clearCommentField();\n }\n };\n const handleSendComment = async () => {\n const current = latest.current;\n const textComment = current.state.comment ? current.state.comment.trim() : null;\n if (!textComment && !current.state.attachmentUrl) return;\n const payload = {\n comment: {\n body: textComment,\n attachment: {\n url: current.state.attachmentUrl,\n size: current.state.attachmentSize,\n file_name: current.state.attachmentName,\n },\n },\n };\n let response;\n if (current.props.editFeedItemId) {\n current.props.setIsEditting(true);\n try {\n const { editFeedItemId, editCommentId } = latest.current.props;\n response = await patchFeedItemComment(editFeedItemId, editCommentId, payload);\n } catch (error) {\n console.error(error.message);\n }\n await latest.current.props.patchCommentCallback(response);\n latest.current.props.setIsEditting(false);\n clearCommentField();\n latest.current.props.exitEditMode();\n } else {\n current.props.setIsPosting(true);\n try {\n response = await latest.current.props.postComment(payload);\n } catch (error) {\n console.error(error.message);\n }\n await latest.current.props.postCommentCallback(response);\n latest.current.props.setIsPosting(false);\n clearCommentField();\n }\n };\n\n const imperativeHandle = useRef({\n clearCommentField,\n focusOnRef,\n setInitialCommentValue,\n handleNativeFileUpload,\n handleSendComment,\n });\n\n const handleSelectEmoji = useCallback(\n emoji => setState(current => ({ ...current, comment: `${current.comment}${emoji.native}` })),\n []\n );\n const handleAttachmentLoadingError = useCallback(\n attachmentLoadingError =>\n update({\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n attachmentLoadingError,\n }),\n [update]\n );\n const handleFileUpload = useCallback(\n (attachmentUrl, attachmentName, attachmentSize) =>\n update({ attachmentUrl, attachmentName, attachmentSize, attachmentLoadingError: null }),\n [update]\n );\n\n return {\n state,\n update,\n imperativeHandle: imperativeHandle.current,\n handleSendComment,\n handleKeyDown: event => {\n if (event.key === 'Escape') latest.current.props.exitEditMode();\n if (event.key === 'Enter' && !isSuggestionsListOpened()) {\n event.preventDefault();\n handleSendComment();\n }\n },\n handleSelectEmoji,\n handleAttachmentLoadingError,\n handleFileUpload,\n handleFileDelete: () =>\n update({ attachmentUrl: null, attachmentName: null, attachmentSize: null }),\n handleCancelClick: () => {\n // The legacy cancel handler exits synchronously, before clearing commits.\n const callback = latest.current.props.exitEditMode();\n if (typeof callback === 'function') afterCommit.current.push({ callback });\n update(clearedComment);\n },\n };\n}\n"],"names":["clearedComment","comment","attachmentUrl","attachmentName","attachmentSize","props","useState","attachmentLoadingError","isInputFocused","_useState2","_slicedToArray","_useState","state","setState","latest","useRef","previousProps","afterCommit","update","useCallback","patch","current","focusOnRef","inputRef","focus","setInitialCommentValue","editAttachment","url","editComment","file_name","utils","getFileNameWithExtensionFromPath","size","useLayoutEffect","previous","editFeedItemId","editCommentId","pending","forEach","_ref","callback","_ref2","clearCommentField","push","handleSendComment","_asyncToGenerator","_regeneratorRuntime","mark","_callee","textComment","payload","response","_latest$current$props","wrap","_context","prev","next","trim","abrupt","body","attachment","setIsEditting","patchFeedItemComment","sent","t0","console","error","message","patchCommentCallback","exitEditMode","setIsPosting","postComment","t1","postCommentCallback","stop","apply","this","arguments","imperativeHandle","handleNativeFileUpload","notifyCommentEdit","notifyCommentPost","handleSelectEmoji","emoji","_objectSpread","native","handleAttachmentLoadingError","handleFileUpload","handleKeyDown","event","key","isSuggestionsListOpened","preventDefault","handleFileDelete","handleCancelClick"],"mappings":"wjCAMA,IAAMA,EAAiB,CACrBC,QAAS,GACTC,cAAe,KACfC,eAAgB,KAChBC,eAAgB,qBAGH,SAAyBC,GACtC,IAA0BC,EAAAA,EAAAA,gBACrBN,GAAc,GAAA,CACjBO,uBAAwB,KACxBC,gBAAgB,KAChBC,EAAAC,EAAAA,QAAAC,EAAA,GAJKC,EAAKH,EAAA,GAAEI,EAAQJ,EAAA,GAKhBK,EAASC,EAAAA,OAAO,CAAEV,MAAAA,EAAOO,MAAAA,IACzBI,EAAgBD,SAAO,MACvBE,EAAcF,SAAO,IACrBG,EAASC,eAAY,SAAAC,GAAK,OAAIP,GAAS,SAAAQ,GAAO,OAAUA,EAAAA,EAAAA,CAAAA,EAAAA,GAAYD,EAAK,GAAI,GAAE,IAC/EE,EAAa,WACbR,EAAOO,QAAQhB,MAAMkB,UAAUT,EAAOO,QAAQhB,MAAMkB,SAASF,QAAQG,SAErEC,EAAyB,WAC7B,IAAMJ,EAAUP,EAAOO,QAAQhB,MACzBH,EAAgBmB,EAAQK,eAAiBL,EAAQK,eAAeC,IAAM,KAC5ET,EAAO,CACLjB,QAASoB,EAAQO,YACjB1B,cAAAA,EACAC,eAAgBD,EACZmB,EAAQK,eAAeG,WAAaC,UAAMC,iCAAiC7B,GAC3E,KACJE,eAAgBiB,EAAQK,eAAiBL,EAAQK,eAAeM,KAAO,QAI3EC,EAAAA,iBAAgB,WACdnB,EAAOO,QAAU,CAAEhB,MAAAA,EAAOO,MAAAA,GAC1B,IAAMsB,EAAWlB,EAAcK,QAC/BL,EAAcK,QAAUhB,IAEpB6B,GAAY7B,EAAM8B,gBACnB9B,EAAM8B,gBAAkBD,IAAaA,EAASC,gBAC9CD,GAAY7B,EAAM+B,eAAiB/B,EAAM+B,gBAAkBF,EAASE,gBAErEX,IAEF,IAAMY,EAAUp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CAAA,EAAA,CAAEpB,kBAAYoB,EAAQpB,SAAUkF,OAAAA,EAAME,SAAQ,GAAI,GAC5F,IAEIC,EAA+BnE,eACnC,SAAAZ,GAAsB,OACpBW,EAAO,CACLhB,cAAe,KACfC,eAAgB,KAChBC,eAAgB,KAChBG,uBAAAA,MAEJ,CAACW,IAEGqE,EAAmBpE,EAAWA,aAClC,SAACjB,EAAeC,EAAgBC,GAAc,OAC5Cc,EAAO,CAAEhB,cAAAA,EAAeC,eAAAA,EAAgBC,eAAAA,EAAgBG,uBAAwB,SAClF,CAACW,IAGH,MAAO,CACLN,MAAAA,EACAM,OAAAA,EACA4D,iBAAkBA,EAAiBzD,QACnCuB,kBAAAA,EACA4C,cAAe,SAAAC,GACK,WAAdA,EAAMC,KAAkB5E,EAAOO,QAAQhB,MAAMgE,eAC/B,UAAdoB,EAAMC,KAAoBC,EAAuBA,4BACnDF,EAAMG,iBACNhD,IAEH,EACDsC,kBAAAA,EACAI,6BAAAA,EACAC,iBAAAA,EACAM,iBAAkB,WAAA,OAChB3E,EAAO,CAAEhB,cAAe,KAAMC,eAAgB,KAAMC,eAAgB,MAAO,EAC7E0F,kBAAmB,WAEjB,IAAMtD,EAAW1B,EAAOO,QAAQhB,MAAMgE,eACd,mBAAb7B,GAAyBvB,EAAYI,QAAQsB,KAAK,CAAEH,SAAAA,IAC/DtB,EAAOlB,EACT,EAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentInputNext_root__5uxKl{background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{flex:1 0 0;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}"),module.exports={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};
1
+ "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentInputNext_root__5uxKl{overflow-clip-margin:12px;background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;overflow:clip;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{--attachment-arrow-outset:8px;align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{flex:1 0 0;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}"),module.exports={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};
2
2
  //# sourceMappingURL=CommentInputNext.scss.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DevCenterAppContainer.js","sources":["../../../../../src/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.tsx"],"sourcesContent":["import { useContext, useMemo, useState } from 'react';\nimport type { ComponentType, FC } from 'react';\nimport classNames from 'classnames';\nimport { noop, pick, pickBy } from 'lodash';\nimport { useTheme } from '@material-ui/core';\n\nimport AppContext from '../AppContext';\nimport { DevCenterRouterContext } from '../DevCenterRouterContext';\n\nimport {\n useAnnotationsData,\n useAnnotationsList,\n useAppMaximized,\n useAppSettings,\n useDevCenterAppProps,\n} from './effects';\nimport { DcFullscreenElemsCoordinatorProvider } from './components/DcFullscreenElemsCoordinatorProvider';\nimport { DevCenterAppDialogs } from './components/DevCenterAppDialogs';\nimport DevCenterAppView from './components/DevCenterAppView';\nimport { LegacyAppActions } from './components/LegacyAppActions';\nimport RestoreAppSizeButton from './components/RestoreAppSizeButton';\nimport { getAppAvailability, getAppVersion } from './utils';\nimport {\n APP_DATA_ASSET_KEYS,\n HOME_PATH_PREFIX,\n MOBILE_CLI_APP_GRID_WIDTH,\n PAGE_NAME,\n} from './constants';\nimport type {\n AppCoordinates,\n AppDataEntry,\n ChatActions,\n DashboardAppLastAnnotation,\n DevCenterAppResource,\n DevCenterCurrentUser,\n DevCenterMenuItem,\n DevCenterRouter,\n LayoutEnvironment,\n RegisterAITools,\n SetIsFullscreenModalMode,\n UpdateDashboardAppLastAnnotation,\n} from './types';\nimport type { FullscreenModes } from '../../../types';\n// Relative on purpose: a `~/` alias does not resolve from the published `.d.ts`.\nimport type { GlobalOffsetWell } from '../../../componentsV2/AppCommonsProvider/AppCommonsContext';\nimport { CommentsSwitchProvider } from './components/CommentsSwitch';\n\nimport styles from './DevCenterAppContainer.scss';\n\nimport { isInsideNewMobileApp, isMobileDetected, isNativeDetected } from '~/utils/mobileDetect';\nimport { ToastContainer } from '~/components/Toaster';\nimport { useDevCenterApp } from '~/effects';\nimport { DEV_CENTER_CLI_APP_ID } from '~/constants';\nimport {\n getAppName,\n getAppSegment,\n getTimestampFromQuery,\n isDCAppMultiRig,\n} from '~/utils/devcenter';\nimport { AppCommonsProvider } from '~/componentsV2/AppCommonsProvider';\n\n/**\n * `Partial<FullscreenModes>` carries the seven browser-fullscreen and separate-window members.\n * `AppCommonsProvider` derives `isExpanded` from them and republishes them to the app bundle,\n * so dropping them silently disables both features — and nothing type-checks it, because every\n * member is optional on the provider.\n */\nexport type DevCenterAppContainerProps = Partial<FullscreenModes> & {\n app: DevCenterAppResource;\n currentUser: DevCenterCurrentUser;\n /** Platform router. Not React Router — the DC shell supplies its own. */\n devCenterRouter: DevCenterRouter;\n\n /**\n * Slots for the CLI app bundle's own components. `any` rather than a narrower prop type on\n * purpose: this accepts arbitrary app components, and any narrowing would reject the concretely\n * typed ones consumers pass.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppComponent?: ComponentType<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppSettings?: ComponentType<any> | null;\n /** Defaults to `app.id` when omitted. */\n appId?: number;\n className?: string | null;\n chatActions?: ChatActions | null;\n coordinates?: AppCoordinates | null;\n currentDashboardAppsLastAnnotations?: DashboardAppLastAnnotation[] | null;\n dashboardMeta?: {\n isMultiAsset?: boolean;\n isMultiWell?: boolean;\n isChiplessDashboard?: boolean;\n globalOffsetWells?: GlobalOffsetWell[];\n globalOffsetWellsVersion?: number;\n globalOffsetWellsToken?: number;\n };\n disableAppAssetSelection?: boolean;\n isActionsDisabled?: boolean;\n /**\n * [REACT-18-MIGRATION-TAG] PLT-3099: the platform's isolation decision, passed only by the\n * in-process branch of DevCenterIsolatedApp; iframe mounts leave it false.\n */\n isNonIsolatedApp?: boolean;\n isSettingsDialogHidden?: boolean;\n layoutEnvironment?: LayoutEnvironment | null;\n onAppContainerClick?: () => void;\n onAppRemove?: () => void;\n onCloneDashboard?: () => void;\n onHelpCenterClick?: () => void;\n onIsMaximizedChange?: (isMaximized: boolean) => void;\n onReportBugClick?: (() => void) | null;\n onSettingChange?: (key: string, value: unknown) => void;\n onSettingsChange?: (value: unknown) => void;\n openIntercom?: () => void;\n registerAITools?: RegisterAITools;\n reloadApp?: () => void;\n setIsFullscreenModalMode?: SetIsFullscreenModalMode;\n timestamp?: number | null;\n updateCurrentDashboardAppLastAnnotation?: UpdateDashboardAppLastAnnotation;\n};\n\nconst isHomePage = (router: DevCenterRouter) =>\n !!router.location.pathname?.startsWith(HOME_PATH_PREFIX);\n\nconst DevCenterAppContainer: FC<DevCenterAppContainerProps> = ({\n CLIAppComponent,\n CLIAppSettings,\n app,\n appId,\n className,\n coordinates,\n currentDashboardAppsLastAnnotations,\n currentUser,\n devCenterRouter,\n disableAppAssetSelection,\n isActionsDisabled,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n setSeparateWindowTitle,\n isNonIsolatedApp = false,\n isSettingsDialogHidden,\n layoutEnvironment,\n onAppContainerClick = noop,\n onAppRemove,\n onReportBugClick,\n onCloneDashboard,\n onHelpCenterClick,\n onIsMaximizedChange,\n onSettingChange = noop,\n onSettingsChange = noop,\n openIntercom = noop,\n registerAITools,\n setIsFullscreenModalMode = noop,\n timestamp,\n updateCurrentDashboardAppLastAnnotation,\n dashboardMeta,\n reloadApp,\n chatActions,\n}) => {\n // `AppContext` is still JavaScript and calls `createContext()` with no argument, so it hands\n // back `undefined`. Declared here rather than asserted; the real fix is a type argument on the\n // context itself, which belongs to `DevCenter/AppContext`.\n const appsData: Record<string, AppDataEntry> | undefined = useContext(AppContext);\n const theme = useTheme();\n const isMobileView = isNativeDetected || isMobileDetected;\n const [mainMenuItems, setMainMenuItems] = useState<DevCenterMenuItem[]>([]);\n const [secondaryMenuItems, setSecondaryMenuItems] = useState<DevCenterMenuItem[]>([]);\n // `||`, not `??`: DevCenterEmbeddedApp uses 0 as its unset sentinel for appId.\n const appDataKey = appId || app.id;\n const appData: AppDataEntry = (appDataKey ? appsData?.[appDataKey] : undefined) ?? {\n isLoading: true,\n };\n const application = app.package?.manifest?.application;\n const segment = getAppSegment(app);\n const isChiplessDashboard = !!dashboardMeta?.isChiplessDashboard;\n const isMultiRig = isDCAppMultiRig({\n uiSettings: application?.ui,\n isChiplessDashboard,\n });\n const isCommentsEnabled = !!application?.ui?.enable_comments;\n const appName = getAppName(app);\n const { isMaximized, setIsMaximized } = useAppMaximized({\n onIsMaximizedChange,\n devCenterRouter,\n appId,\n });\n\n // Isolated apps are mounted without the router query the timestamp normally comes from,\n // so the host passes it as a prop instead.\n const appTimestamp = timestamp || getTimestampFromQuery(devCenterRouter.location.query?.query);\n const isCLIApp = app.id === DEV_CENTER_CLI_APP_ID;\n // Memoised because the CLI-on-mobile branch builds a new object: unmemoised it would be a fresh\n // reference on every render and would keep `useDevCenterAppProps` from ever holding its memo.\n const updatedCoordinates = useMemo(\n () =>\n isCLIApp && isMobileView ? { ...coordinates, w: MOBILE_CLI_APP_GRID_WIDTH } : coordinates,\n [isCLIApp, isMobileView, coordinates]\n );\n const version = getAppVersion(app);\n\n const {\n isLoading: isAppLoading,\n AppSettings,\n AppComponent,\n } = useDevCenterApp({\n CLIAppComponent,\n CLIAppSettings,\n app,\n version,\n });\n\n const { isAppSettingsDialogOpened, toggleAppSettingsDialog } = useAppSettings({\n setIsFullscreenModalMode,\n });\n const { isAnnotationsListOpened, toggleAnnotationsList } = useAnnotationsList();\n\n const isLoading = !!(isAppLoading || !currentUser || (!isMultiRig && appData.isLoading));\n\n const {\n appLastAnnotation,\n assetCompanyId,\n assetIdForAnnotation,\n isAppSupportsAnnotations: isAnnotationsSupported,\n } = useAnnotationsData({\n app,\n appData,\n currentDashboardAppsLastAnnotations,\n });\n\n const filteredAppData = useMemo(\n () => pickBy(pick(appData, APP_DATA_ASSET_KEYS), Boolean),\n [appData]\n );\n\n const simplifiedSecondaryMenuItems = useMemo(\n () =>\n secondaryMenuItems.map(item => ({\n ...item,\n onClick: () => {\n item.onClick?.();\n if (item.to) {\n devCenterRouter.push(item.to);\n }\n },\n })),\n [secondaryMenuItems, devCenterRouter]\n );\n\n const isAppHeadersV3Enabled = !!application?.ui?.use_app_header_v3;\n const isInsideHomePage = isHomePage(devCenterRouter);\n\n const appProps = useDevCenterAppProps({\n app,\n appLastAnnotation,\n appTimestamp,\n chatActions,\n coordinates: updatedCoordinates,\n currentUser,\n devCenterRouter,\n filteredAppData,\n isMaximized,\n layoutEnvironment,\n onSettingChange,\n onSettingsChange,\n registerAITools,\n segment,\n setIsFullscreenModalMode,\n setIsMaximized,\n setMainMenuItems,\n setSecondaryMenuItems,\n toggleAnnotationsList,\n toggleAppSettingsDialog,\n updateCurrentDashboardAppLastAnnotation,\n });\n\n // Called without the native event: this crosses an iframe boundary, where a DOM event\n // cannot be serialised.\n const handleAppContainerClick = () => onAppContainerClick();\n\n // ⚠️⚠️⚠️ When adding/changing providers, also add them to/change /src/testing/AppTestWrapper\n return (\n <DevCenterRouterContext.Provider value={devCenterRouter}>\n <DcFullscreenElemsCoordinatorProvider setIsFullscreenModalMode={setIsFullscreenModalMode}>\n <AppCommonsProvider\n maximized={isMaximized}\n setMaximized={setIsMaximized}\n appId={app.app.id}\n app={app}\n appSettings={app.settings}\n onSettingChange={onSettingChange}\n onSettingsChange={onSettingsChange}\n appHeadersV3Enabled={isAppHeadersV3Enabled}\n isBrowserFullscreen={isBrowserFullscreen}\n enterBrowserFullscreen={enterBrowserFullscreen}\n exitBrowserFullscreen={exitBrowserFullscreen}\n isSeparateWindow={isSeparateWindow}\n openSeparateWindow={openSeparateWindow}\n closeSeparateWindow={closeSeparateWindow}\n setSeparateWindowTitle={setSeparateWindowTitle}\n isNonIsolatedApp={isNonIsolatedApp}\n disableAppAssetSelection={disableAppAssetSelection}\n isMultiRig={isMultiRig}\n currentUser={currentUser}\n appData={appData}\n layoutEnvironment={layoutEnvironment}\n appSettingsComponent={AppSettings}\n dashboardMeta={dashboardMeta}\n toggleAnnotationsList={isAnnotationsSupported ? toggleAnnotationsList : undefined}\n onHelpCenterClick={onHelpCenterClick}\n secondaryMenuItems={simplifiedSecondaryMenuItems}\n onAppRemove={onAppRemove}\n isInsideNewMobileApp={isInsideNewMobileApp}\n globalOffsetWells={dashboardMeta?.globalOffsetWells}\n globalOffsetWellsVersion={dashboardMeta?.globalOffsetWellsVersion}\n globalOffsetWellsToken={dashboardMeta?.globalOffsetWellsToken}\n reloadApp={reloadApp}\n {...filteredAppData}\n >\n <CommentsSwitchProvider>\n <article\n className={classNames(\n 'dc-app-container',\n isInsideNewMobileApp && 'dc-app-container--inside-new-mobile-app',\n isInsideHomePage && 'dc-app-container--inside-home-page',\n className,\n // This class is applied so that DC apps developers can style their content\n // when an app is in fullscreen\n isMaximized && 'dc-app-container__maximized',\n theme.isLightTheme && 'dc-app-container__light-theme',\n styles.container\n )}\n data-testid={`${PAGE_NAME}_${appName}`}\n onClick={handleAppContainerClick}\n >\n <ToastContainer />\n <div className={styles.containerContent}>\n <DevCenterAppView\n // DC apps keep per-asset state in mount-time hooks, so a new asset means a\n // new mount. React 18 batching collapses away the `isLoading` frame this used\n // to rely on whenever AppsDataProvider serves the asset from its cache.\n key={appData.appHash}\n AppComponent={AppComponent}\n app={app}\n appData={filteredAppData}\n availability={getAppAvailability(\n app.availability,\n currentUser.company.with_subscription\n )}\n isCLIApp={isCLIApp}\n isLoading={isLoading}\n isMultiRig={isMultiRig}\n layoutEnvironment={layoutEnvironment ?? null}\n openIntercom={openIntercom}\n segment={segment}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n appProps={appProps}\n />\n </div>\n <DevCenterAppDialogs\n app={app}\n appData={appData}\n appName={appName}\n appSettingsComponent={AppSettings}\n assetCompanyId={assetCompanyId}\n assetIdForAnnotation={assetIdForAnnotation}\n currentUser={currentUser}\n disableAppAssetSelection={disableAppAssetSelection}\n isAnnotationsListOpened={isAnnotationsListOpened}\n isAppSettingsDialogOpened={isAppSettingsDialogOpened}\n isMultiRig={isMultiRig}\n isSettingsDialogHidden={isSettingsDialogHidden}\n layoutEnvironment={layoutEnvironment}\n onAppRemove={onAppRemove}\n onCloneDashboard={onCloneDashboard}\n onSettingsChange={onSettingsChange}\n openIntercom={openIntercom}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n {isMaximized && !isAppHeadersV3Enabled && (\n <RestoreAppSizeButton setIsMaximized={setIsMaximized} />\n )}\n\n {!isActionsDisabled && (!isAppHeadersV3Enabled || isLoading) && (\n <LegacyAppActions\n app={app}\n currentUser={currentUser}\n devCenterRouter={devCenterRouter}\n isAnnotationsSupported={isAnnotationsSupported}\n isCLIApp={isCLIApp}\n isCommentsEnabled={isCommentsEnabled}\n isInsideNewMobileApp={isInsideNewMobileApp}\n isMaximized={isMaximized}\n isMobileView={isMobileView}\n mainMenuItems={mainMenuItems}\n secondaryMenuItems={secondaryMenuItems}\n onHelpCenterClick={onHelpCenterClick}\n onReportBugClick={onReportBugClick}\n setIsFullscreenModalMode={setIsFullscreenModalMode}\n setIsMaximized={setIsMaximized}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n )}\n </article>\n </CommentsSwitchProvider>\n </AppCommonsProvider>\n </DcFullscreenElemsCoordinatorProvider>\n </DevCenterRouterContext.Provider>\n );\n};\n\nexport default DevCenterAppContainer;\n"],"names":["_ref","_ref2","_app$package","_app$package$manifest","_application$ui","_devCenterRouter$loca","_application$ui2","_router$location$path","CLIAppComponent","CLIAppSettings","app","appId","className","coordinates","currentDashboardAppsLastAnnotations","currentUser","devCenterRouter","disableAppAssetSelection","isActionsDisabled","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","setSeparateWindowTitle","_ref$isNonIsolatedApp","isNonIsolatedApp","isSettingsDialogHidden","layoutEnvironment","_ref$onAppContainerCl","onAppContainerClick","noop","onAppRemove","onReportBugClick","onCloneDashboard","onHelpCenterClick","onIsMaximizedChange","_ref$onSettingChange","onSettingChange","_ref$onSettingsChange","onSettingsChange","_ref$openIntercom","openIntercom","registerAITools","_ref$setIsFullscreenM","setIsFullscreenModalMode","timestamp","updateCurrentDashboardAppLastAnnotation","dashboardMeta","reloadApp","chatActions","appsData","useContext","AppContext","theme","useTheme","isMobileView","isNativeDetected","isMobileDetected","useState","_useState2","_slicedToArray","_useState","mainMenuItems","setMainMenuItems","_useState4","_useState3","secondaryMenuItems","setSecondaryMenuItems","appDataKey","id","appData","undefined","isLoading","application","package","manifest","segment","getAppSegment","isChiplessDashboard","isMultiRig","isDCAppMultiRig","uiSettings","ui","isCommentsEnabled","enable_comments","appName","getAppName","_useAppMaximized","useAppMaximized","isMaximized","setIsMaximized","appTimestamp","getTimestampFromQuery","location","query","isCLIApp","DEV_CENTER_CLI_APP_ID","updatedCoordinates","useMemo","_objectSpread","w","MOBILE_CLI_APP_GRID_WIDTH","version","getAppVersion","_useDevCenterApp","useDevCenterApp","isAppLoading","AppSettings","AppComponent","_useAppSettings","useAppSettings","isAppSettingsDialogOpened","toggleAppSettingsDialog","_useAnnotationsList","useAnnotationsList","isAnnotationsListOpened","toggleAnnotationsList","_useAnnotationsData","useAnnotationsData","appLastAnnotation","assetCompanyId","assetIdForAnnotation","isAnnotationsSupported","isAppSupportsAnnotations","filteredAppData","pickBy","pick","APP_DATA_ASSET_KEYS","Boolean","simplifiedSecondaryMenuItems","map","item","onClick","_item$onClick","call","to","push","isAppHeadersV3Enabled","use_app_header_v3","isInsideHomePage","pathname","startsWith","HOME_PATH_PREFIX","appProps","useDevCenterAppProps","_jsx","jsx","DevCenterRouterContext","Provider","value","children","DcFullscreenElemsCoordinatorProvider","AppCommonsProvider","maximized","setMaximized","appSettings","settings","appHeadersV3Enabled","appSettingsComponent","isInsideNewMobileApp","globalOffsetWells","globalOffsetWellsVersion","globalOffsetWellsToken","CommentsSwitchProvider","_jsxs","jsxs","classNames","isLightTheme","styles","container","PAGE_NAME","ToastContainer","containerContent","DevCenterAppView","availability","getAppAvailability","company","with_subscription","appHash","DevCenterAppDialogs","RestoreAppSizeButton","LegacyAppActions"],"mappings":"q5gBA4H8D,SAsCxDA,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAzCqCC,EAIzCC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,IACAC,IAAAA,MACAC,IAAAA,UACAC,IAAAA,YACAC,IAAAA,oCACAC,IAAAA,YACAC,IAAAA,gBACAC,IAAAA,yBACAC,IAAAA,kBACAC,IAAAA,oBACAC,IAAAA,uBACAC,IAAAA,sBACAC,IAAAA,iBACAC,IAAAA,mBACAC,IAAAA,oBACAC,KAAAA,uBAAsBC,GAAA1B,EACtB2B,iBAAAA,gBAAwBD,GACxBE,KAAAA,uBACAC,KAAAA,kBAAiBC,GAAA9B,EACjB+B,oBAAAA,eAAsBC,EAAIA,KAAAF,GAC1BG,KAAAA,YACAC,KAAAA,iBACAC,KAAAA,iBACAC,KAAAA,kBACAC,KAAAA,oBAAmBC,GAAAtC,EACnBuC,gBAAAA,eAAkBP,EAAIA,KAAAM,GAAAE,GAAAxC,EACtByC,iBAAAA,eAAmBT,EAAIA,KAAAQ,GAAAE,GAAA1C,EACvB2C,aAAAA,eAAeX,EAAIA,KAAAU,GACnBE,KAAAA,gBAAeC,GAAA7C,EACf8C,yBAAAA,eAA2Bd,EAAIA,KAAAa,GAC/BE,KAAAA,UACAC,KAAAA,wCACAC,KAAAA,cACAC,KAAAA,UACAC,KAAAA,YAKMC,GAAqDC,aAAWC,GAChEC,GA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AAAL,EAAAA,IAAC0B,EAAAA,eAAc,CAAA,GACf1B,EAAAC,IAAA,MAAA,CAAKxI,UAAW8J,EAAOI,iBAAiBtB,SACtCL,EAACC,IAAA2B,EAAA,QAGC,CAEAjE,aAAcA,GACdpG,IAAKA,EACL8D,QAASsD,GACTkD,aAAcC,EAAkBA,mBAC9BvK,EAAIsK,aACJjK,EAAYmK,QAAQC,mBAEtBlF,SAAUA,GACVvB,UAAWA,GACXO,WAAYA,GACZpD,kBAAmBA,SAAAA,GAAqB,KACxCc,aAAcA,GACdmC,QAASA,GACToC,wBAAyBA,GACzB+B,SAAUA,IAfLzE,GAAQ4G,WAkBjBjC,MAACkC,sBAAmB,CAClB3K,IAAKA,EACL8D,QAASA,GACTe,QAASA,GACTyE,qBAAsBnD,GACtBa,eAAgBA,GAChBC,qBAAsBA,GACtB5G,YAAaA,EACbE,yBAA0BA,EAC1BoG,wBAAyBA,GACzBJ,0BAA2BA,GAC3BhC,WAAYA,GACZrD,uBAAwBA,GACxBC,kBAAmBA,GACnBI,YAAaA,GACbE,iBAAkBA,GAClBM,iBAAkBA,GAClBE,aAAcA,GACd2E,sBAAuBA,GACvBJ,wBAAyBA,KAE1BvB,KAAgBgD,IACfQ,EAAAA,IAACmC,EAAoB,CAAC1F,eAAgBA,MAGtC1E,KAAuByH,IAAyBjE,KAChDyE,EAAAC,IAACmC,mBAAgB,CACf7K,IAAKA,EACLK,YAAaA,EACbC,gBAAiBA,EACjB4G,uBAAwBA,GACxB3B,SAAUA,GACVZ,kBAAmBA,GACnB4E,qBAAsBA,EAAqBA,qBAC3CtE,YAAaA,GACblC,aAAcA,GACdO,cAAeA,GACfI,mBAAoBA,GACpBhC,kBAAmBA,GACnBF,iBAAkBA,GAClBY,yBAA0BA,GAC1B8C,eAAgBA,GAChB0B,sBAAuBA,GACvBJ,wBAAyBA,gBAS3C"}
1
+ {"version":3,"file":"DevCenterAppContainer.js","sources":["../../../../../src/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.tsx"],"sourcesContent":["import { useContext, useMemo, useState } from 'react';\nimport type { ComponentType, FC } from 'react';\nimport classNames from 'classnames';\nimport { noop, pick, pickBy } from 'lodash';\nimport { useTheme } from '@material-ui/core';\n\nimport AppContext from '../AppContext';\nimport { DevCenterRouterContext } from '../DevCenterRouterContext';\n\nimport {\n useAnnotationsData,\n useAnnotationsList,\n useAppMaximized,\n useAppSettings,\n useDevCenterAppProps,\n} from './effects';\nimport { DcFullscreenElemsCoordinatorProvider } from './components/DcFullscreenElemsCoordinatorProvider';\nimport { DevCenterAppDialogs } from './components/DevCenterAppDialogs';\nimport DevCenterAppView from './components/DevCenterAppView';\nimport { LegacyAppActions } from './components/LegacyAppActions';\nimport RestoreAppSizeButton from './components/RestoreAppSizeButton';\nimport { getAppAvailability, getAppVersion } from './utils';\nimport {\n APP_DATA_ASSET_KEYS,\n HOME_PATH_PREFIX,\n MOBILE_CLI_APP_GRID_WIDTH,\n PAGE_NAME,\n} from './constants';\nimport type {\n AppCoordinates,\n AppDataEntry,\n ChatActions,\n DashboardAppLastAnnotation,\n DevCenterAppResource,\n DevCenterCurrentUser,\n DevCenterMenuItem,\n DevCenterRouter,\n LayoutEnvironment,\n RegisterAITools,\n SetIsFullscreenModalMode,\n UpdateDashboardAppLastAnnotation,\n} from './types';\nimport type { FullscreenModes } from '../../../types';\n// Relative on purpose: a `~/` alias does not resolve from the published `.d.ts`.\nimport type { AppDashboardMeta } from '../../../componentsV2/AppCommonsProvider/AppCommonsContext';\nimport { CommentsSwitchProvider } from './components/CommentsSwitch';\n\nimport styles from './DevCenterAppContainer.scss';\n\nimport { isInsideNewMobileApp, isMobileDetected, isNativeDetected } from '~/utils/mobileDetect';\nimport { ToastContainer } from '~/components/Toaster';\nimport { useDevCenterApp } from '~/effects';\nimport { DEV_CENTER_CLI_APP_ID } from '~/constants';\nimport {\n getAppName,\n getAppSegment,\n getTimestampFromQuery,\n isDCAppMultiRig,\n} from '~/utils/devcenter';\nimport { AppCommonsProvider } from '~/componentsV2/AppCommonsProvider';\n\n/**\n * `Partial<FullscreenModes>` carries the seven browser-fullscreen and separate-window members.\n * `AppCommonsProvider` derives `isExpanded` from them and republishes them to the app bundle,\n * so dropping them silently disables both features — and nothing type-checks it, because every\n * member is optional on the provider.\n */\nexport type DevCenterAppContainerProps = Partial<FullscreenModes> & {\n app: DevCenterAppResource;\n currentUser: DevCenterCurrentUser;\n /** Platform router. Not React Router — the DC shell supplies its own. */\n devCenterRouter: DevCenterRouter;\n\n /**\n * Slots for the CLI app bundle's own components. `any` rather than a narrower prop type on\n * purpose: this accepts arbitrary app components, and any narrowing would reject the concretely\n * typed ones consumers pass.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppComponent?: ComponentType<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- see the note above\n CLIAppSettings?: ComponentType<any> | null;\n /** Defaults to `app.id` when omitted. */\n appId?: number;\n className?: string | null;\n chatActions?: ChatActions | null;\n coordinates?: AppCoordinates | null;\n currentDashboardAppsLastAnnotations?: DashboardAppLastAnnotation[] | null;\n dashboardMeta?: AppDashboardMeta;\n disableAppAssetSelection?: boolean;\n isActionsDisabled?: boolean;\n /**\n * [REACT-18-MIGRATION-TAG] PLT-3099: the platform's isolation decision, passed only by the\n * in-process branch of DevCenterIsolatedApp; iframe mounts leave it false.\n */\n isNonIsolatedApp?: boolean;\n isSettingsDialogHidden?: boolean;\n layoutEnvironment?: LayoutEnvironment | null;\n onAppContainerClick?: () => void;\n onAppRemove?: () => void;\n onCloneDashboard?: () => void;\n onHelpCenterClick?: () => void;\n onIsMaximizedChange?: (isMaximized: boolean) => void;\n onReportBugClick?: (() => void) | null;\n onSettingChange?: (key: string, value: unknown) => void;\n onSettingsChange?: (value: unknown) => void;\n openIntercom?: () => void;\n registerAITools?: RegisterAITools;\n reloadApp?: () => void;\n setIsFullscreenModalMode?: SetIsFullscreenModalMode;\n timestamp?: number | null;\n updateCurrentDashboardAppLastAnnotation?: UpdateDashboardAppLastAnnotation;\n};\n\nconst isHomePage = (router: DevCenterRouter) =>\n !!router.location.pathname?.startsWith(HOME_PATH_PREFIX);\n\nconst DevCenterAppContainer: FC<DevCenterAppContainerProps> = ({\n CLIAppComponent,\n CLIAppSettings,\n app,\n appId,\n className,\n coordinates,\n currentDashboardAppsLastAnnotations,\n currentUser,\n devCenterRouter,\n disableAppAssetSelection,\n isActionsDisabled,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n setSeparateWindowTitle,\n isNonIsolatedApp = false,\n isSettingsDialogHidden,\n layoutEnvironment,\n onAppContainerClick = noop,\n onAppRemove,\n onReportBugClick,\n onCloneDashboard,\n onHelpCenterClick,\n onIsMaximizedChange,\n onSettingChange = noop,\n onSettingsChange = noop,\n openIntercom = noop,\n registerAITools,\n setIsFullscreenModalMode = noop,\n timestamp,\n updateCurrentDashboardAppLastAnnotation,\n dashboardMeta,\n reloadApp,\n chatActions,\n}) => {\n // `AppContext` is still JavaScript and calls `createContext()` with no argument, so it hands\n // back `undefined`. Declared here rather than asserted; the real fix is a type argument on the\n // context itself, which belongs to `DevCenter/AppContext`.\n const appsData: Record<string, AppDataEntry> | undefined = useContext(AppContext);\n const theme = useTheme();\n const isMobileView = isNativeDetected || isMobileDetected;\n const [mainMenuItems, setMainMenuItems] = useState<DevCenterMenuItem[]>([]);\n const [secondaryMenuItems, setSecondaryMenuItems] = useState<DevCenterMenuItem[]>([]);\n // `||`, not `??`: DevCenterEmbeddedApp uses 0 as its unset sentinel for appId.\n const appDataKey = appId || app.id;\n const appData: AppDataEntry = (appDataKey ? appsData?.[appDataKey] : undefined) ?? {\n isLoading: true,\n };\n const application = app.package?.manifest?.application;\n const segment = getAppSegment(app);\n const isChiplessDashboard = !!dashboardMeta?.isChiplessDashboard;\n const isMultiRig = isDCAppMultiRig({\n uiSettings: application?.ui,\n isChiplessDashboard,\n });\n const isCommentsEnabled = !!application?.ui?.enable_comments;\n const appName = getAppName(app);\n const { isMaximized, setIsMaximized } = useAppMaximized({\n onIsMaximizedChange,\n devCenterRouter,\n appId,\n });\n\n // Isolated apps are mounted without the router query the timestamp normally comes from,\n // so the host passes it as a prop instead.\n const appTimestamp = timestamp || getTimestampFromQuery(devCenterRouter.location.query?.query);\n const isCLIApp = app.id === DEV_CENTER_CLI_APP_ID;\n // Memoised because the CLI-on-mobile branch builds a new object: unmemoised it would be a fresh\n // reference on every render and would keep `useDevCenterAppProps` from ever holding its memo.\n const updatedCoordinates = useMemo(\n () =>\n isCLIApp && isMobileView ? { ...coordinates, w: MOBILE_CLI_APP_GRID_WIDTH } : coordinates,\n [isCLIApp, isMobileView, coordinates]\n );\n const version = getAppVersion(app);\n\n const {\n isLoading: isAppLoading,\n AppSettings,\n AppComponent,\n } = useDevCenterApp({\n CLIAppComponent,\n CLIAppSettings,\n app,\n version,\n });\n\n const { isAppSettingsDialogOpened, toggleAppSettingsDialog } = useAppSettings({\n setIsFullscreenModalMode,\n });\n const { isAnnotationsListOpened, toggleAnnotationsList } = useAnnotationsList();\n\n const isLoading = !!(isAppLoading || !currentUser || (!isMultiRig && appData.isLoading));\n\n const {\n appLastAnnotation,\n assetCompanyId,\n assetIdForAnnotation,\n isAppSupportsAnnotations: isAnnotationsSupported,\n } = useAnnotationsData({\n app,\n appData,\n currentDashboardAppsLastAnnotations,\n });\n\n const filteredAppData = useMemo(\n () => pickBy(pick(appData, APP_DATA_ASSET_KEYS), Boolean),\n [appData]\n );\n\n const simplifiedSecondaryMenuItems = useMemo(\n () =>\n secondaryMenuItems.map(item => ({\n ...item,\n onClick: () => {\n item.onClick?.();\n if (item.to) {\n devCenterRouter.push(item.to);\n }\n },\n })),\n [secondaryMenuItems, devCenterRouter]\n );\n\n const isAppHeadersV3Enabled = !!application?.ui?.use_app_header_v3;\n const isInsideHomePage = isHomePage(devCenterRouter);\n\n const appProps = useDevCenterAppProps({\n app,\n appLastAnnotation,\n appTimestamp,\n chatActions,\n coordinates: updatedCoordinates,\n currentUser,\n devCenterRouter,\n filteredAppData,\n isMaximized,\n layoutEnvironment,\n onSettingChange,\n onSettingsChange,\n registerAITools,\n segment,\n setIsFullscreenModalMode,\n setIsMaximized,\n setMainMenuItems,\n setSecondaryMenuItems,\n toggleAnnotationsList,\n toggleAppSettingsDialog,\n updateCurrentDashboardAppLastAnnotation,\n });\n\n // Called without the native event: this crosses an iframe boundary, where a DOM event\n // cannot be serialised.\n const handleAppContainerClick = () => onAppContainerClick();\n\n // ⚠️⚠️⚠️ When adding/changing providers, also add them to/change /src/testing/AppTestWrapper\n return (\n <DevCenterRouterContext.Provider value={devCenterRouter}>\n <DcFullscreenElemsCoordinatorProvider setIsFullscreenModalMode={setIsFullscreenModalMode}>\n <AppCommonsProvider\n maximized={isMaximized}\n setMaximized={setIsMaximized}\n appId={app.app.id}\n app={app}\n appSettings={app.settings}\n onSettingChange={onSettingChange}\n onSettingsChange={onSettingsChange}\n appHeadersV3Enabled={isAppHeadersV3Enabled}\n isBrowserFullscreen={isBrowserFullscreen}\n enterBrowserFullscreen={enterBrowserFullscreen}\n exitBrowserFullscreen={exitBrowserFullscreen}\n isSeparateWindow={isSeparateWindow}\n openSeparateWindow={openSeparateWindow}\n closeSeparateWindow={closeSeparateWindow}\n setSeparateWindowTitle={setSeparateWindowTitle}\n isNonIsolatedApp={isNonIsolatedApp}\n disableAppAssetSelection={disableAppAssetSelection}\n isMultiRig={isMultiRig}\n currentUser={currentUser}\n appData={appData}\n layoutEnvironment={layoutEnvironment}\n appSettingsComponent={AppSettings}\n dashboardMeta={dashboardMeta}\n toggleAnnotationsList={isAnnotationsSupported ? toggleAnnotationsList : undefined}\n onHelpCenterClick={onHelpCenterClick}\n secondaryMenuItems={simplifiedSecondaryMenuItems}\n onAppRemove={onAppRemove}\n isInsideNewMobileApp={isInsideNewMobileApp}\n globalOffsetWells={dashboardMeta?.globalOffsetWells}\n globalOffsetWellsVersion={dashboardMeta?.globalOffsetWellsVersion}\n globalOffsetWellsToken={dashboardMeta?.globalOffsetWellsToken}\n reloadApp={reloadApp}\n {...filteredAppData}\n >\n <CommentsSwitchProvider>\n <article\n className={classNames(\n 'dc-app-container',\n isInsideNewMobileApp && 'dc-app-container--inside-new-mobile-app',\n isInsideHomePage && 'dc-app-container--inside-home-page',\n className,\n // This class is applied so that DC apps developers can style their content\n // when an app is in fullscreen\n isMaximized && 'dc-app-container__maximized',\n theme.isLightTheme && 'dc-app-container__light-theme',\n styles.container\n )}\n data-testid={`${PAGE_NAME}_${appName}`}\n onClick={handleAppContainerClick}\n >\n <ToastContainer />\n <div className={styles.containerContent}>\n <DevCenterAppView\n // DC apps keep per-asset state in mount-time hooks, so a new asset means a\n // new mount. React 18 batching collapses away the `isLoading` frame this used\n // to rely on whenever AppsDataProvider serves the asset from its cache.\n key={appData.appHash}\n AppComponent={AppComponent}\n app={app}\n appData={filteredAppData}\n availability={getAppAvailability(\n app.availability,\n currentUser.company.with_subscription\n )}\n isCLIApp={isCLIApp}\n isLoading={isLoading}\n isMultiRig={isMultiRig}\n layoutEnvironment={layoutEnvironment ?? null}\n openIntercom={openIntercom}\n segment={segment}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n appProps={appProps}\n />\n </div>\n <DevCenterAppDialogs\n app={app}\n appData={appData}\n appName={appName}\n appSettingsComponent={AppSettings}\n assetCompanyId={assetCompanyId}\n assetIdForAnnotation={assetIdForAnnotation}\n currentUser={currentUser}\n disableAppAssetSelection={disableAppAssetSelection}\n isAnnotationsListOpened={isAnnotationsListOpened}\n isAppSettingsDialogOpened={isAppSettingsDialogOpened}\n isMultiRig={isMultiRig}\n isSettingsDialogHidden={isSettingsDialogHidden}\n layoutEnvironment={layoutEnvironment}\n onAppRemove={onAppRemove}\n onCloneDashboard={onCloneDashboard}\n onSettingsChange={onSettingsChange}\n openIntercom={openIntercom}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n {isMaximized && !isAppHeadersV3Enabled && (\n <RestoreAppSizeButton setIsMaximized={setIsMaximized} />\n )}\n\n {!isActionsDisabled && (!isAppHeadersV3Enabled || isLoading) && (\n <LegacyAppActions\n app={app}\n currentUser={currentUser}\n devCenterRouter={devCenterRouter}\n isAnnotationsSupported={isAnnotationsSupported}\n isCLIApp={isCLIApp}\n isCommentsEnabled={isCommentsEnabled}\n isInsideNewMobileApp={isInsideNewMobileApp}\n isMaximized={isMaximized}\n isMobileView={isMobileView}\n mainMenuItems={mainMenuItems}\n secondaryMenuItems={secondaryMenuItems}\n onHelpCenterClick={onHelpCenterClick}\n onReportBugClick={onReportBugClick}\n setIsFullscreenModalMode={setIsFullscreenModalMode}\n setIsMaximized={setIsMaximized}\n toggleAnnotationsList={toggleAnnotationsList}\n toggleAppSettingsDialog={toggleAppSettingsDialog}\n />\n )}\n </article>\n </CommentsSwitchProvider>\n </AppCommonsProvider>\n </DcFullscreenElemsCoordinatorProvider>\n </DevCenterRouterContext.Provider>\n );\n};\n\nexport default DevCenterAppContainer;\n"],"names":["_ref","_ref2","_app$package","_app$package$manifest","_application$ui","_devCenterRouter$loca","_application$ui2","_router$location$path","CLIAppComponent","CLIAppSettings","app","appId","className","coordinates","currentDashboardAppsLastAnnotations","currentUser","devCenterRouter","disableAppAssetSelection","isActionsDisabled","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","setSeparateWindowTitle","_ref$isNonIsolatedApp","isNonIsolatedApp","isSettingsDialogHidden","layoutEnvironment","_ref$onAppContainerCl","onAppContainerClick","noop","onAppRemove","onReportBugClick","onCloneDashboard","onHelpCenterClick","onIsMaximizedChange","_ref$onSettingChange","onSettingChange","_ref$onSettingsChange","onSettingsChange","_ref$openIntercom","openIntercom","registerAITools","_ref$setIsFullscreenM","setIsFullscreenModalMode","timestamp","updateCurrentDashboardAppLastAnnotation","dashboardMeta","reloadApp","chatActions","appsData","useContext","AppContext","theme","useTheme","isMobileView","isNativeDetected","isMobileDetected","useState","_useState2","_slicedToArray","_useState","mainMenuItems","setMainMenuItems","_useState4","_useState3","secondaryMenuItems","setSecondaryMenuItems","appDataKey","id","appData","undefined","isLoading","application","package","manifest","segment","getAppSegment","isChiplessDashboard","isMultiRig","isDCAppMultiRig","uiSettings","ui","isCommentsEnabled","enable_comments","appName","getAppName","_useAppMaximized","useAppMaximized","isMaximized","setIsMaximized","appTimestamp","getTimestampFromQuery","location","query","isCLIApp","DEV_CENTER_CLI_APP_ID","updatedCoordinates","useMemo","_objectSpread","w","MOBILE_CLI_APP_GRID_WIDTH","version","getAppVersion","_useDevCenterApp","useDevCenterApp","isAppLoading","AppSettings","AppComponent","_useAppSettings","useAppSettings","isAppSettingsDialogOpened","toggleAppSettingsDialog","_useAnnotationsList","useAnnotationsList","isAnnotationsListOpened","toggleAnnotationsList","_useAnnotationsData","useAnnotationsData","appLastAnnotation","assetCompanyId","assetIdForAnnotation","isAnnotationsSupported","isAppSupportsAnnotations","filteredAppData","pickBy","pick","APP_DATA_ASSET_KEYS","Boolean","simplifiedSecondaryMenuItems","map","item","onClick","_item$onClick","call","to","push","isAppHeadersV3Enabled","use_app_header_v3","isInsideHomePage","pathname","startsWith","HOME_PATH_PREFIX","appProps","useDevCenterAppProps","_jsx","jsx","DevCenterRouterContext","Provider","value","children","DcFullscreenElemsCoordinatorProvider","AppCommonsProvider","maximized","setMaximized","appSettings","settings","appHeadersV3Enabled","appSettingsComponent","isInsideNewMobileApp","globalOffsetWells","globalOffsetWellsVersion","globalOffsetWellsToken","CommentsSwitchProvider","_jsxs","jsxs","classNames","isLightTheme","styles","container","PAGE_NAME","ToastContainer","containerContent","DevCenterAppView","availability","getAppAvailability","company","with_subscription","appHash","DevCenterAppDialogs","RestoreAppSizeButton","LegacyAppActions"],"mappings":"q5gBAqH8D,SAsCxDA,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAzCqCC,EAIzCC,IAAAA,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ASA,GACTe,QAASA,GACTyE,qBAAsBnD,GACtBa,eAAgBA,GAChBC,qBAAsBA,GACtB5G,YAAaA,EACbE,yBAA0BA,EAC1BoG,wBAAyBA,GACzBJ,0BAA2BA,GAC3BhC,WAAYA,GACZrD,uBAAwBA,GACxBC,kBAAmBA,GACnBI,YAAaA,GACbE,iBAAkBA,GAClBM,iBAAkBA,GAClBE,aAAcA,GACd2E,sBAAuBA,GACvBJ,wBAAyBA,KAE1BvB,KAAgBgD,IACfQ,EAAAA,IAACmC,EAAoB,CAAC1F,eAAgBA,MAGtC1E,KAAuByH,IAAyBjE,KAChDyE,EAAAC,IAACmC,mBAAgB,CACf7K,IAAKA,EACLK,YAAaA,EACbC,gBAAiBA,EACjB4G,uBAAwBA,GACxB3B,SAAUA,GACVZ,kBAAmBA,GACnB4E,qBAAsBA,EAAqBA,qBAC3CtE,YAAaA,GACblC,aAAcA,GACdO,cAAeA,GACfI,mBAAoBA,GACpBhC,kBAAmBA,GACnBF,iBAAkBA,GAClBY,yBAA0BA,GAC1B8C,eAAgBA,GAChB0B,sBAAuBA,GACvBJ,wBAAyBA,gBAS3C"}
@@ -1,2 +1,2 @@
1
- "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".FeedCard_root__3hrMo{backdrop-filter:blur(2px);background:rgb(from var(--palette-background-b-6) r g b/.9);border-radius:16px;display:flex;flex-direction:column;overflow:hidden}"),module.exports={spacing:"8",root:"FeedCard_root__3hrMo"};
1
+ "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".FeedCard_root__3hrMo{overflow-clip-margin:12px;backdrop-filter:blur(2px);background:rgb(from var(--palette-background-b-6) r g b/.9);border-radius:16px;display:flex;flex-direction:column;overflow:hidden;overflow:clip}"),module.exports={spacing:"8",root:"FeedCard_root__3hrMo"};
2
2
  //# sourceMappingURL=FeedCard.scss.js.map
@@ -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/classCallCheck"),r=require("@babel/runtime/helpers/createClass"),l=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/inherits"),a=require("@babel/runtime/helpers/possibleConstructorReturn"),n=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),s=require("@babel/runtime/regenerator"),u=require("react"),d=require("prop-types"),p=require("react-s3-uploader/s3upload"),c=require("@material-ui/core/CircularProgress"),f=require("@material-ui/icons/PhotoCamera"),h=require("./PostPreviewDialog/index.js"),b=require("./Icons/AttachIcon.js"),g=require("./IconButton/index.js"),F=require("../clients/jsonApi/index.js"),v=require("../utils/mobileDetect.js"),m=require("react/jsx-runtime");function U(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var P=U(e),y=U(t),S=U(r),j=U(l),O=U(i),q=U(a),w=U(n),D=U(o),x=U(s),I=U(d),C=U(p),T=U(c),E=U(f);function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,l)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){D.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,l=w.default(e);if(t){var i=w.default(this).constructor;r=Reflect.construct(l,arguments,i)}else r=l.apply(this,arguments);return q.default(this,r)}}var k=function(e){O.default(r,e);var t=_(r);function r(e){var l,i;return y.default(this,r),l=t.call(this,e),D.default(j.default(l),"onFinish",P.default(x.default.mark((function e(){var t;return x.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F.getS3DownloadLink(l.state.s3FileName);case 2:t=e.sent,l.setState({currentUpload:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:l.props.openPreviewDialogOnUpload,s3FileUrl:t.url},(function(){l.props.onFinish&&l.props.onFinish(l.state.s3FileUrl,l.state.s3FileName,l.state.s3FileSize)}));case 4:case"end":return e.stop()}}),e)})))),D.default(j.default(l),"onError",(function(e){l.props.onError&&l.props.onError(e),console.error(e)})),D.default(j.default(l),"getSignedUrl",(i=P.default(x.default.mark((function e(t,r){var i;return x.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,F.getS3SignedUrl(t.name,t.type);case 3:i=e.sent,e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(0),l.setState({uploadingFileToS3:null,currentUpload:null},(function(){l.onError(e.t0.message)})),e.abrupt("return");case 10:l.setState({s3FileUrl:i.signed_url,s3FileName:i.file_name,s3FileSize:t.size}),r(R(R({},i),{},{signedUrl:i.signed_url}));case 12:case"end":return e.stop()}}),e,null,[[0,6]])}))),function(e,t){return i.apply(this,arguments)})),D.default(j.default(l),"preprocess",(function(e,t){t(e)})),D.default(j.default(l),"uploadFile",(function(e){if(e.target.files[0]){l.clearUpload();var t=new C.default({fileElement:l.fileInput.current,getSignedUrl:l.getSignedUrl,preprocess:l.preprocess,onProgress:function(){},onFinishS3Put:l.onFinish,onError:l.onError});l.setState({uploadingFileToS3:!0,currentUpload:{uploader:t}})}})),D.default(j.default(l),"handleCloseFileUploadPreviewDialog",(function(){l.setState({openFileUploadPreviewDialog:!1})})),D.default(j.default(l),"handleShare",(function(e,t,r){l.setState({openFileUploadPreviewDialog:!1},(function(){l.props.handleShare&&l.props.handleShare(e,t,r)}))})),l.state={currentUpload:null,s3FileUrl:null,s3FileName:null,s3FileSize:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:!1},l.fileInput=u.createRef(),l}return S.default(r,[{key:"clearUpload",value:function(){var e=this.state.currentUpload;e&&e.uploader&&e.uploader.abortUpload()}},{key:"renderUploadButton",value:function(){var e=v.isNativeDetected?E.default:b,t=D.default({},"data-file-upload-button","");return m.jsxs("label",R(R({htmlFor:this.props.inputId},t),{},{children:[m.jsx("input",{ref:this.fileInput,id:this.props.inputId,type:"file",disabled:this.props.disabled,onChange:this.uploadFile,style:{display:"none"}}),m.jsx(g,{"data-testid":"".concat("fileUpload","_attachFileButton"),"aria-label":"File Upload",disabled:this.props.disabled,component:this.props.disabled?"button":"span",className:this.props.fileUploadIconClassName,disableRipple:this.props.disableRipple,tooltipProps:this.props.tooltipProps,children:m.jsx(e,{})})]}))}},{key:"render",value:function(){return m.jsxs(m.Fragment,{children:[this.state.uploadingFileToS3?m.jsx(T.default,{"data-testid":"generic_uploadProgress",size:18}):this.renderUploadButton(),this.state.openFileUploadPreviewDialog&&m.jsx(h,{open:this.state.openFileUploadPreviewDialog,fileUrl:this.state.s3FileUrl,fileName:this.state.s3FileName,fileSize:this.state.s3FileSize,handleShare:this.handleShare,handleClose:this.handleCloseFileUploadPreviewDialog,additionalFields:this.props.additionalFields,requiredFields:this.props.requiredFields,message:this.props.message})]})}}]),r}(u.PureComponent);k.propTypes={additionalFields:I.default.arrayOf(I.default.node),classes:I.default.shape({}),tooltipProps:I.default.shape({}),disableRipple:I.default.bool,disabled:I.default.bool,fileUploadIconClassName:I.default.string,handleShare:I.default.func,inputId:I.default.string,message:I.default.string,onError:I.default.func,onFinish:I.default.func,openPreviewDialogOnUpload:I.default.bool,requiredFields:I.default.arrayOf(I.default.string)},k.defaultProps={additionalFields:[],classes:{},disableRipple:!1,disabled:!1,fileUploadIconClassName:void 0,handleShare:void 0,inputId:"icon-button-file",message:void 0,onError:void 0,onFinish:void 0,openPreviewDialogOnUpload:!0,requiredFields:[],tooltipProps:{title:"Attach File"}},exports.FILE_UPLOAD_BUTTON_DATA_ATTR="data-file-upload-button",exports.default=k;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),i=require("react"),t=require("prop-types"),r=require("./useFileUploadIconButton.js"),l=require("@material-ui/core/CircularProgress"),a=require("@material-ui/icons/PhotoCamera"),o=require("./PostPreviewDialog/index.js"),n=require("./Icons/AttachIcon.js"),d=require("./IconButton/index.js"),s=require("../utils/mobileDetect.js"),u=require("react/jsx-runtime");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=p(e),f=p(t),b=p(l),h=p(a);function g(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);i&&(r=r.filter((function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable}))),t.push.apply(t,r)}return t}function j(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{};i%2?g(Object(t),!0).forEach((function(i){c.default(e,i,t[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach((function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}))}return e}var v=[],O={title:"Attach File"};function P(e){var i,t,l=e.additionalFields,a=void 0===l?v:l,p=e.tooltipProps,f=void 0===p?O:p,g=e.disableRipple,P=void 0!==g&&g,F=e.disabled,m=void 0!==F&&F,y=e.fileUploadIconClassName,D=e.handleShare,U=e.inputId,q=void 0===U?"icon-button-file":U,w=e.message,x=e.onError,I=e.onFinish,S=e.openPreviewDialogOnUpload,_=void 0===S||S,C=e.requiredFields,N=void 0===C?v:C,T=r({onError:x,onFinish:I,openPreviewDialogOnUpload:_,handleShare:D}),A=T.state,E=T.fileInput,B=T.uploadFile,R=T.handleCloseFileUploadPreviewDialog,z=T.handleShare;return u.jsxs(u.Fragment,{children:[A.uploadingFileToS3?u.jsx(b.default,{"data-testid":"generic_uploadProgress",size:18}):(i=s.isNativeDetected?h.default:n,t=c.default({},"data-file-upload-button",""),u.jsxs("label",j(j({htmlFor:q},t),{},{children:[u.jsx("input",{ref:E,id:q,type:"file",disabled:m,onChange:B,style:{display:"none"}}),u.jsx(d,{"data-testid":"".concat("fileUpload","_attachFileButton"),"aria-label":"File Upload",disabled:m,component:m?"button":"span",className:y,disableRipple:P,tooltipProps:f,children:u.jsx(i,{})})]}))),A.openFileUploadPreviewDialog&&u.jsx(o,{open:A.openFileUploadPreviewDialog,fileUrl:A.s3FileUrl,fileName:A.s3FileName,fileSize:A.s3FileSize,handleShare:z,handleClose:R,additionalFields:a,requiredFields:N,message:w})]})}P.propTypes={additionalFields:f.default.arrayOf(f.default.node),classes:f.default.shape({}),tooltipProps:f.default.shape({}),disableRipple:f.default.bool,disabled:f.default.bool,fileUploadIconClassName:f.default.string,handleShare:f.default.func,inputId:f.default.string,message:f.default.string,onError:f.default.func,onFinish:f.default.func,openPreviewDialogOnUpload:f.default.bool,requiredFields:f.default.arrayOf(f.default.string)};var F=i.memo(P);exports.FILE_UPLOAD_BUTTON_DATA_ATTR="data-file-upload-button",exports.default=F;
2
2
  //# sourceMappingURL=FileUploadIconButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadIconButton.js","sources":["../../../src/components/FileUploadIconButton.js"],"sourcesContent":["import { createRef, PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport S3Upload from 'react-s3-uploader/s3upload';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport PhotoCameraIcon from '@material-ui/icons/PhotoCamera';\n\nimport PostPreviewDialog from '~components/PostPreviewDialog';\nimport AttachIcon from '~components/Icons/AttachIcon';\nimport IconButton from '~components/IconButton';\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'fileUpload';\n\n// Data attr helps to identify the select file action; Is used to prevent the tooltip from closing\nexport const FILE_UPLOAD_BUTTON_DATA_ATTR = 'data-file-upload-button';\n\n/** @extends {PureComponent<any, any, any>} */\nclass FileUploadIconButton extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n currentUpload: null,\n\n s3FileUrl: null,\n s3FileName: null,\n s3FileSize: null,\n\n uploadingFileToS3: false,\n\n openFileUploadPreviewDialog: false,\n };\n\n this.fileInput = createRef();\n }\n\n onFinish = async () => {\n const s3DownloadLinkResponse = await getS3DownloadLink(this.state.s3FileName);\n this.setState(\n {\n currentUpload: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: this.props.openPreviewDialogOnUpload,\n s3FileUrl: s3DownloadLinkResponse.url,\n },\n () => {\n if (this.props.onFinish)\n this.props.onFinish(this.state.s3FileUrl, this.state.s3FileName, this.state.s3FileSize);\n }\n );\n };\n\n onError = fileUploadingError => {\n if (this.props.onError) this.props.onError(fileUploadingError);\n console.error(fileUploadingError);\n };\n\n getSignedUrl = async (file, callback) => {\n let data;\n try {\n data = await getS3SignedUrl(file.name, file.type);\n } catch (e) {\n this.setState(\n {\n uploadingFileToS3: null,\n currentUpload: null,\n },\n () => {\n this.onError(e.message);\n }\n );\n return;\n }\n\n this.setState({\n s3FileUrl: data.signed_url,\n s3FileName: data.file_name,\n s3FileSize: file.size,\n });\n\n // NOTE: Add node for 'signedUrl' which is the expected name by uploader component\n callback({\n ...data,\n signedUrl: data.signed_url,\n });\n };\n\n preprocess = (file, next) => {\n next(file);\n };\n\n uploadFile = event => {\n if (!event.target.files[0]) {\n return;\n }\n\n this.clearUpload();\n const uploader = new S3Upload({\n fileElement: this.fileInput.current,\n getSignedUrl: this.getSignedUrl,\n preprocess: this.preprocess,\n onProgress: () => {}, // NOTE: Prevents logging to console\n onFinishS3Put: this.onFinish,\n onError: this.onError,\n });\n\n this.setState({\n uploadingFileToS3: true,\n currentUpload: {\n uploader,\n },\n });\n };\n\n clearUpload() {\n const { currentUpload } = this.state;\n if (currentUpload && currentUpload.uploader) {\n currentUpload.uploader.abortUpload();\n }\n }\n\n handleCloseFileUploadPreviewDialog = () => {\n this.setState({ openFileUploadPreviewDialog: false });\n };\n\n handleShare = (comment, fileName, fileSize) => {\n this.setState({ openFileUploadPreviewDialog: false }, () => {\n if (this.props.handleShare) {\n this.props.handleShare(comment, fileName, fileSize);\n }\n });\n };\n\n renderUploadButton() {\n const Icon = isNativeDetected ? PhotoCameraIcon : AttachIcon;\n const labelDataAttributes = { [FILE_UPLOAD_BUTTON_DATA_ATTR]: '' };\n\n return (\n <label htmlFor={this.props.inputId} {...labelDataAttributes}>\n <input\n ref={this.fileInput}\n id={this.props.inputId}\n type=\"file\"\n disabled={this.props.disabled}\n onChange={this.uploadFile}\n style={{ display: 'none' }}\n />\n <IconButton\n data-testid={`${PAGE_NAME}_attachFileButton`}\n aria-label=\"File Upload\"\n disabled={this.props.disabled}\n component={this.props.disabled ? 'button' : 'span'}\n className={this.props.fileUploadIconClassName}\n disableRipple={this.props.disableRipple}\n tooltipProps={this.props.tooltipProps}\n >\n <Icon />\n </IconButton>\n </label>\n );\n }\n\n render() {\n return (\n <>\n {this.state.uploadingFileToS3 ? (\n <CircularProgress data-testid=\"generic_uploadProgress\" size={18} />\n ) : (\n this.renderUploadButton()\n )}\n\n {this.state.openFileUploadPreviewDialog && (\n <PostPreviewDialog\n open={this.state.openFileUploadPreviewDialog}\n fileUrl={this.state.s3FileUrl}\n fileName={this.state.s3FileName}\n fileSize={this.state.s3FileSize}\n handleShare={this.handleShare}\n handleClose={this.handleCloseFileUploadPreviewDialog}\n additionalFields={this.props.additionalFields}\n requiredFields={this.props.requiredFields}\n message={this.props.message}\n />\n )}\n </>\n );\n }\n}\n\nFileUploadIconButton.propTypes = {\n additionalFields: PropTypes.arrayOf(PropTypes.node),\n classes: PropTypes.shape({}),\n tooltipProps: PropTypes.shape({}),\n disableRipple: PropTypes.bool,\n disabled: PropTypes.bool,\n fileUploadIconClassName: PropTypes.string,\n handleShare: PropTypes.func,\n inputId: PropTypes.string,\n message: PropTypes.string,\n onError: PropTypes.func,\n onFinish: PropTypes.func,\n openPreviewDialogOnUpload: PropTypes.bool,\n requiredFields: PropTypes.arrayOf(PropTypes.string),\n};\n\nFileUploadIconButton.defaultProps = {\n additionalFields: [],\n classes: {},\n disableRipple: false,\n disabled: false,\n fileUploadIconClassName: undefined,\n handleShare: undefined,\n inputId: 'icon-button-file',\n message: undefined,\n onError: undefined,\n onFinish: undefined,\n openPreviewDialogOnUpload: true,\n requiredFields: [],\n tooltipProps: { title: 'Attach File' },\n};\n\nexport default FileUploadIconButton;\n"],"names":["FileUploadIconButton","_PureComponent","_inherits","_super","_createSuper","props","_this","_ref2","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","_asyncToGenerator","_regeneratorRuntime","mark","_callee","s3DownloadLinkResponse","wrap","_context","prev","next","getS3DownloadLink","state","s3FileName","sent","setState","currentUpload","uploadingFileToS3","openFileUploadPreviewDialog","openPreviewDialogOnUpload","s3FileUrl","url","onFinish","s3FileSize","stop","fileUploadingError","onError","console","error","_callee2","file","callback","data","_context2","getS3SignedUrl","name","type","t0","message","abrupt","signed_url","file_name","size","signedUrl","_x","_x2","apply","arguments","event","target","files","clearUpload","uploader","S3Upload","fileElement","fileInput","current","getSignedUrl","preprocess","onProgress","onFinishS3Put","comment","fileName","fileSize","handleShare","createRef","_createClass","key","value","abortUpload","Icon","isNativeDetected","PhotoCameraIcon","AttachIcon","labelDataAttributes","_jsxs","_objectSpread","htmlFor","inputId","children","_jsx","jsx","ref","id","disabled","onChange","uploadFile","style","display","IconButton","concat","component","className","fileUploadIconClassName","disableRipple","tooltipProps","_Fragment","CircularProgress","renderUploadButton","PostPreviewDialog","open","fileUrl","handleClose","handleCloseFileUploadPreviewDialog","additionalFields","requiredFields","PureComponent","propTypes","PropTypes","arrayOf","node","classes","shape","bool","string","func","defaultProps","undefined","title"],"mappings":"6kEAYA,IAMMA,EAAoB,SAAAC,GAAAC,UAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GACxB,SAAAA,EAAYK,GAAO,IAAAC,EAu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M,4BACjBmF,QAASvG,KAAKc,MAAMQ,UACpB0C,SAAUhE,KAAKc,MAAMC,WACrBkD,SAAUjE,KAAKc,MAAMW,WACrByC,YAAalE,KAAKkE,YAClBsC,YAAaxG,KAAKyG,mCAClBC,iBAAkB1G,KAAKJ,MAAM8G,iBAC7BC,eAAgB3G,KAAKJ,MAAM+G,eAC3BnE,QAASxC,KAAKJ,MAAM4C,YAK9B,KAACjD,CAAA,CAzKuB,CAASqH,iBA4KnCrH,EAAqBsH,UAAY,CAC/BH,iBAAkBI,EAAS,QAACC,QAAQD,EAAAA,QAAUE,MAC9CC,QAASH,EAAAA,QAAUI,MAAM,IACzBjB,aAAca,EAAAA,QAAUI,MAAM,IAC9BlB,cAAec,EAAS,QAACK,KACzB7B,SAAUwB,EAAS,QAACK,KACpBpB,wBAAyBe,EAAS,QAACM,OACnClD,YAAa4C,EAAS,QAACO,KACvBrC,QAAS8B,EAAS,QAACM,OACnB5E,QAASsE,EAAS,QAACM,OACnBxF,QAASkF,EAAS,QAACO,KACnB7F,SAAUsF,EAAS,QAACO,KACpBhG,0BAA2ByF,EAAS,QAACK,KACrCR,eAAgBG,EAAS,QAACC,QAAQD,EAAAA,QAAUM,SAG9C7H,EAAqB+H,aAAe,CAClCZ,iBAAkB,GAClBO,QAAS,CAAE,EACXjB,eAAe,EACfV,UAAU,EACVS,6BAAyBwB,EACzBrD,iBAAaqD,EACbvC,QAAS,mBACTxC,aAAS+E,EACT3F,aAAS2F,EACT/F,cAAU+F,EACVlG,2BAA2B,EAC3BsF,eAAgB,GAChBV,aAAc,CAAEuB,MAAO,qDA5MmB"}
1
+ {"version":3,"file":"FileUploadIconButton.js","sources":["../../../src/components/FileUploadIconButton.js"],"sourcesContent":["import { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport useFileUploadIconButton from './useFileUploadIconButton';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport PhotoCameraIcon from '@material-ui/icons/PhotoCamera';\n\nimport PostPreviewDialog from '~components/PostPreviewDialog';\nimport AttachIcon from '~components/Icons/AttachIcon';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'fileUpload';\n\n// Data attr helps to identify the select file action; Is used to prevent the tooltip from closing\nexport const FILE_UPLOAD_BUTTON_DATA_ATTR = 'data-file-upload-button';\n\nconst emptyFields = [];\nconst defaultTooltipProps = { title: 'Attach File' };\n\n/** @param {any} props Preserve the legacy component's permissive public prop type. */\nfunction FileUploadIconButton({\n additionalFields = emptyFields,\n tooltipProps = defaultTooltipProps,\n disableRipple = false,\n disabled = false,\n fileUploadIconClassName,\n handleShare: onShare,\n inputId = 'icon-button-file',\n message,\n onError,\n onFinish,\n openPreviewDialogOnUpload = true,\n requiredFields = emptyFields,\n}) {\n const { state, fileInput, uploadFile, handleCloseFileUploadPreviewDialog, handleShare } =\n useFileUploadIconButton({ onError, onFinish, openPreviewDialogOnUpload, handleShare: onShare });\n const renderUploadButton = () => {\n const Icon = isNativeDetected ? PhotoCameraIcon : AttachIcon;\n const labelDataAttributes = { [FILE_UPLOAD_BUTTON_DATA_ATTR]: '' };\n\n return (\n <label htmlFor={inputId} {...labelDataAttributes}>\n <input\n ref={fileInput}\n id={inputId}\n type=\"file\"\n disabled={disabled}\n onChange={uploadFile}\n style={{ display: 'none' }}\n />\n <IconButton\n data-testid={`${PAGE_NAME}_attachFileButton`}\n aria-label=\"File Upload\"\n disabled={disabled}\n component={disabled ? 'button' : 'span'}\n className={fileUploadIconClassName}\n disableRipple={disableRipple}\n tooltipProps={tooltipProps}\n >\n <Icon />\n </IconButton>\n </label>\n );\n };\n\n return (\n <>\n {state.uploadingFileToS3 ? (\n <CircularProgress data-testid=\"generic_uploadProgress\" size={18} />\n ) : (\n renderUploadButton()\n )}\n\n {state.openFileUploadPreviewDialog && (\n <PostPreviewDialog\n open={state.openFileUploadPreviewDialog}\n fileUrl={state.s3FileUrl}\n fileName={state.s3FileName}\n fileSize={state.s3FileSize}\n handleShare={handleShare}\n handleClose={handleCloseFileUploadPreviewDialog}\n additionalFields={additionalFields}\n requiredFields={requiredFields}\n message={message}\n />\n )}\n </>\n );\n}\n\nFileUploadIconButton.propTypes = {\n additionalFields: PropTypes.arrayOf(PropTypes.node),\n classes: PropTypes.shape({}),\n tooltipProps: PropTypes.shape({}),\n disableRipple: PropTypes.bool,\n disabled: PropTypes.bool,\n fileUploadIconClassName: PropTypes.string,\n handleShare: PropTypes.func,\n inputId: PropTypes.string,\n message: PropTypes.string,\n onError: PropTypes.func,\n onFinish: PropTypes.func,\n openPreviewDialogOnUpload: PropTypes.bool,\n requiredFields: PropTypes.arrayOf(PropTypes.string),\n};\n\nexport default memo(FileUploadIconButton);\n"],"names":["emptyFields","defaultTooltipProps","title","FileUploadIconButton","_ref","Icon","labelDataAttributes","_ref$additionalFields","additionalFields","_ref$tooltipProps","tooltipProps","_ref$disableRipple","disableRipple","_ref$disabled","disabled","fileUploadIconClassName","onShare","handleShare","_ref$inputId","inputId","message","onError","onFinish","_ref$openPreviewDialo","openPreviewDialogOnUpload","_ref$requiredFields","requiredFields","_useFileUploadIconBut","useFileUploadIconButton","state","fileInput","uploadFile","handleCloseFileUploadPreviewDialog","_jsxs","_Fragment","children","uploadingFileToS3","_jsx","CircularProgress","size","isNativeDetected","PhotoCameraIcon","AttachIcon","_defineProperty","_objectSpread","htmlFor","jsx","ref","id","type","onChange","style","display","IconButton","concat","component","className","openFileUploadPreviewDialog","PostPreviewDialog","open","fileUrl","s3FileUrl","fileName","s3FileName","fileSize","s3FileSize","handleClose","propTypes","PropTypes","arrayOf","node","classes","shape","bool","string","func","memo"],"mappings":"gpCAWA,IAKMA,EAAc,GACdC,EAAsB,CAAEC,MAAO,eAGrC,SAASC,EAaNC,GAAA,IAIOC,EACAC,EALPC,EAAAH,EAZDI,iBAAAA,aAAmBR,EAAWO,EAAAE,EAAAL,EAC9BM,aAAAA,aAAeT,EAAmBQ,EAAAE,EAAAP,EAClCQ,cAAAA,cAAq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AClBkB,eAAgBA,EAChBN,QAASA,MAKnB,CAEAjB,EAAqBgE,UAAY,CAC/B3D,iBAAkB4D,EAAS,QAACC,QAAQD,EAAAA,QAAUE,MAC9CC,QAASH,EAAAA,QAAUI,MAAM,IACzB9D,aAAc0D,EAAAA,QAAUI,MAAM,IAC9B5D,cAAewD,EAAS,QAACK,KACzB3D,SAAUsD,EAAS,QAACK,KACpB1D,wBAAyBqD,EAAS,QAACM,OACnCzD,YAAamD,EAAS,QAACO,KACvBxD,QAASiD,EAAS,QAACM,OACnBtD,QAASgD,EAAS,QAACM,OACnBrD,QAAS+C,EAAS,QAACO,KACnBrD,SAAU8C,EAAS,QAACO,KACpBnD,0BAA2B4C,EAAS,QAACK,KACrC/C,eAAgB0C,EAAS,QAACC,QAAQD,EAAAA,QAAUM,SAG9C,IAAeE,EAAAA,EAAAA,KAAKzE,wCA5FwB"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/toConsumableArray"),n=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/regenerator"),l=require("react"),a=require("react-s3-uploader/s3upload"),i=require("../clients/jsonApi/index.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(e),p=u(r),c=u(t),f=u(n),d=u(o),g=u(a);function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach((function(r){p.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}module.exports=function(e){var r=l.useState({currentUpload:null,s3FileUrl:null,s3FileName:null,s3FileSize:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:!1}),t=f.default(r,2),n=t[0],o=t[1],a=l.useRef(null),u=l.useRef({props:e,state:n}),p=l.useRef([]);l.useLayoutEffect((function(){u.current={props:e,state:n};var r=p.current;p.current=[],r.forEach((function(e){var r=u.current;if("finish"===e.type&&r.props.onFinish)r.props.onFinish(r.state.s3FileUrl,r.state.s3FileName,r.state.s3FileSize);else if("error"===e.type)r.props.onError&&r.props.onError(e.message),console.error(e.message);else if("share"===e.type&&r.props.handleShare){var t;(t=r.props).handleShare.apply(t,c.default(e.args))}}))}));var b,y,v=function(e,r){r&&p.current.push(r),o((function(r){return h(h({},r),e)}))},F=function(e){u.current.props.onError&&u.current.props.onError(e),console.error(e)},m=(b=s.default(d.default.mark((function e(r,t){var n;return d.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,i.getS3SignedUrl(r.name,r.type);case 3:n=e.sent,e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(0),v({uploadingFileToS3:null,currentUpload:null},{type:"error",message:e.t0.message}),e.abrupt("return");case 10:v({s3FileUrl:n.signed_url,s3FileName:n.file_name,s3FileSize:r.size}),t(h(h({},n),{},{signedUrl:n.signed_url}));case 12:case"end":return e.stop()}}),e,null,[[0,6]])}))),function(e,r){return b.apply(this,arguments)}),U=(y=s.default(d.default.mark((function e(){var r;return d.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.getS3DownloadLink(u.current.state.s3FileName);case 2:r=e.sent,v({currentUpload:null,uploadingFileToS3:!1,openFileUploadPreviewDialog:u.current.props.openPreviewDialogOnUpload,s3FileUrl:r.url},{type:"finish"});case 4:case"end":return e.stop()}}),e)}))),function(){return y.apply(this,arguments)});return{state:n,fileInput:a,uploadFile:function(e){if(e.target.files[0]){var r=u.current.state.currentUpload;r&&r.uploader&&r.uploader.abortUpload();var t=new g.default({fileElement:a.current,getSignedUrl:m,preprocess:function(e,r){return r(e)},onProgress:function(){},onFinishS3Put:U,onError:F});v({uploadingFileToS3:!0,currentUpload:{uploader:t}})}},handleCloseFileUploadPreviewDialog:function(){return v({openFileUploadPreviewDialog:!1})},handleShare:function(e,r,t){return v({openFileUploadPreviewDialog:!1},{type:"share",args:[e,r,t]})}}};
2
+ //# sourceMappingURL=useFileUploadIconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFileUploadIconButton.js","sources":["../../../src/components/useFileUploadIconButton.js"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from 'react';\nimport S3Upload from 'react-s3-uploader/s3upload';\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\n\nexport default function useFileUploadIconButton(props) {\n const [state, setState] = useState({\n currentUpload: null,\n s3FileUrl: null,\n s3FileName: null,\n s3FileSize: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: false,\n });\n const fileInput = useRef(null);\n const latest = useRef({ props, state });\n const notifications = useRef([]);\n\n // The uploader retains callbacks; notify with current data only after the UI commits.\n useLayoutEffect(() => {\n latest.current = { props, state };\n const pending = notifications.current;\n notifications.current = [];\n pending.forEach(notification => {\n const current = latest.current;\n if (notification.type === 'finish' && current.props.onFinish) {\n current.props.onFinish(\n current.state.s3FileUrl,\n current.state.s3FileName,\n current.state.s3FileSize\n );\n } else if (notification.type === 'error') {\n if (current.props.onError) current.props.onError(notification.message);\n console.error(notification.message);\n } else if (notification.type === 'share' && current.props.handleShare) {\n current.props.handleShare(...notification.args);\n }\n });\n });\n\n const update = (patch, notification) => {\n if (notification) notifications.current.push(notification);\n setState(current => ({ ...current, ...patch }));\n };\n\n const onError = error => {\n if (latest.current.props.onError) latest.current.props.onError(error);\n console.error(error);\n };\n\n const getSignedUrl = async (file, callback) => {\n let data;\n try {\n data = await getS3SignedUrl(file.name, file.type);\n } catch (error) {\n update(\n { uploadingFileToS3: null, currentUpload: null },\n { type: 'error', message: error.message }\n );\n return;\n }\n update({ s3FileUrl: data.signed_url, s3FileName: data.file_name, s3FileSize: file.size });\n callback({ ...data, signedUrl: data.signed_url });\n };\n\n const onFinish = async () => {\n const response = await getS3DownloadLink(latest.current.state.s3FileName);\n update(\n {\n currentUpload: null,\n uploadingFileToS3: false,\n openFileUploadPreviewDialog: latest.current.props.openPreviewDialogOnUpload,\n s3FileUrl: response.url,\n },\n { type: 'finish' }\n );\n };\n\n const uploadFile = event => {\n if (!event.target.files[0]) return;\n const { currentUpload } = latest.current.state;\n if (currentUpload && currentUpload.uploader) currentUpload.uploader.abortUpload();\n const uploader = new S3Upload({\n fileElement: fileInput.current,\n getSignedUrl,\n preprocess: (file, next) => next(file),\n onProgress: () => undefined, // Prevent the uploader's default progress logging.\n onFinishS3Put: onFinish,\n onError,\n });\n update({ uploadingFileToS3: true, currentUpload: { uploader } });\n };\n\n return {\n state,\n fileInput,\n uploadFile,\n handleCloseFileUploadPreviewDialog: () => update({ openFileUploadPreviewDialog: false }),\n handleShare: (comment, fileName, fileSize) =>\n update(\n { openFileUploadPreviewDialog: false },\n { type: 'share', args: [comment, fileName, fileSize] }\n ),\n };\n}\n"],"names":["props","_useState","useState","currentUpload","s3FileUrl","s3FileName","s3FileSize","uploadingFileToS3","openFileUploadPreviewDialog","_useState2","_slicedToArray","state","setState","fileInput","useRef","latest","notifications","useLayoutEffect","current","pending","forEach","notification","type","onFinish","onError","message","console","error","handleShare","_current$props","args","_ref","_ref2","update","patch","push","getSignedUrl","_asyncToGenerator","_regeneratorRuntime","mark","_callee","file","callback","data","wrap","_context","prev","next","getS3SignedUrl","name","sent","t0","abrupt","signed_url","file_name","size","signedUrl","stop","_x","_x2","apply","this","arguments","_callee2","response","_context2","getS3DownloadLink","openPreviewDialogOnUpload","url","uploadFile","event","target","files","uploader","abortUpload","S3Upload","fileElement","preprocess","onProgress","onFinishS3Put","handleCloseFileUploadPreviewDialog","comment","fileName","fileSize"],"mappings":"yjCAIe,SAAiCA,GAC9C,IAAAC,EAA0BC,E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AA/B,EAAA4B,MAAAC,KAAAC,UAAA,GA4Bd,MAAO,CACLnD,MAAAA,EACAE,UAAAA,EACAwD,WAlBiB,SAAAC,GACjB,GAAKA,EAAMC,OAAOC,MAAM,GAAxB,CACA,IAAQrE,EAAkBY,EAAOG,QAAQP,MAAjCR,cACJA,GAAiBA,EAAcsE,UAAUtE,EAAcsE,SAASC,cACpE,IAAMD,EAAW,IAAIE,UAAS,CAC5BC,YAAa/D,EAAUK,QACvBkB,aAAAA,EACAyC,WAAY,SAACpC,EAAMM,GAAI,OAAKA,EAAKN,EAAK,EACtCqC,WAAY,WAAe,EAC3BC,cAAexD,EACfC,QAAAA,IAEFS,EAAO,CAAE1B,mBAAmB,EAAMJ,cAAe,CAAEsE,SAAAA,IAXvB,GAkB5BO,mCAAoC,WAAA,OAAM/C,EAAO,CAAEzB,6BAA6B,GAAQ,EACxFoB,YAAa,SAACqD,EAASC,EAAUC,GAAQ,OACvClD,EACE,CAAEzB,6BAA6B,GAC/B,CAAEc,KAAM,QAASQ,KAAM,CAACmD,EAASC,EAAUC,IAC5C,EAEP"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppCommonsContext.js","sources":["../../../../src/componentsV2/AppCommonsProvider/AppCommonsContext.ts"],"sourcesContent":["import { ComponentType, createContext, ReactNode, useContext } from 'react';\n\nimport {\n App,\n AppSettings,\n Asset,\n FracFleet,\n FullscreenModes,\n InterventionUnit,\n User,\n Well,\n} from '../../types';\n\nexport type GlobalOffsetWell = {\n id: number;\n [key: string]: unknown;\n};\n\n// ⚠️⚠️⚠️ Mentioned in storybook, please update when editing this type\n// Used in AppTestWrapper\nexport type AppCommonsContextType = {\n maximized: boolean;\n appId: number;\n app: App;\n appKey: string;\n appName: string;\n appSettings?: AppSettings;\n onSettingChange: (key: string, value: unknown) => void;\n onSettingsChange: (value: unknown) => void;\n\n well?: Well;\n rig?: Asset;\n fracFleet?: FracFleet;\n interventionUnit?: InterventionUnit;\n wells?: Well[];\n\n // Passed down from corva-web-frontend. May not exist, so everything must be optional\n dashboardMeta?: {\n isMultiAsset?: boolean;\n isMultiWell?: boolean;\n isChiplessDashboard?: boolean;\n globalOffsetWellsToken?: number;\n };\n appHeadersV3Enabled?: boolean;\n // [REACT-18-MIGRATION-TAG] PLT-3099: true when the app renders in-process on the host\n // (the platform isolation decision from DevCenterIsolatedApp); iframe realms leave it unset.\n isNonIsolatedApp?: boolean;\n disableAppAssetSelection?: boolean;\n isMultiRig?: boolean;\n currentUser?: User;\n globalOffsetWells?: GlobalOffsetWell[];\n globalOffsetWellsVersion?: number;\n globalOffsetWellsToken?: number;\n removeApp?: () => void;\n};\n\nexport type AppCommonsContextTypeInternal = AppCommonsContextType &\n Partial<FullscreenModes> & {\n /** True in any of the three modes: dashboard maximize, browser fullscreen, separate window */\n isExpanded?: boolean;\n setMaximized: (maximized: boolean) => void;\n appData?: unknown;\n layoutEnvironment?: ({ type?: string } & Record<string, unknown>) | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n appSettingsComponent?: ComponentType<any>;\n toggleAnnotationsList?: () => void;\n onHelpCenterClick?: () => void;\n secondaryMenuItems?: { title: ReactNode; onClick?: () => void; icon?: ReactNode }[];\n isInsideNewMobileApp?: boolean;\n reloadApp?: () => void;\n };\n\nexport const AppCommonsContext = createContext<AppCommonsContextTypeInternal>(\n // TODO provide defaults\n null as unknown as AppCommonsContextTypeInternal\n);\n\nexport const useAppCommonsInternal = () => useContext(AppCommonsContext);\n\nexport const useAppCommons = () => useContext(AppCommonsContext) as AppCommonsContextType;\n"],"names":["AppCommonsContext","createContext","useContext"],"mappings":"2FAwEaA,EAAoBC,EAAaA,cAE5C,wDAK2B,WAAH,OAASC,EAAAA,WAAWF,EAAkB,gCAF3B,WAAH,OAASE,EAAAA,WAAWF,EAAkB"}
1
+ {"version":3,"file":"AppCommonsContext.js","sources":["../../../../src/componentsV2/AppCommonsProvider/AppCommonsContext.ts"],"sourcesContent":["import { ComponentType, createContext, ReactNode, useContext } from 'react';\n\nimport {\n App,\n AppSettings,\n Asset,\n FracFleet,\n FullscreenModes,\n InterventionUnit,\n User,\n Well,\n} from '../../types';\n\nexport type GlobalOffsetWell = {\n id: number;\n [key: string]: unknown;\n};\n\n/** Host-owned planning scope. Presence identifies a Well Planning dashboard. */\nexport type WellPlanningDashboardMeta = {\n assetId: number | null;\n dashboardId: string;\n defaultDashboardKind?: string;\n segment: string | null;\n};\n\nexport type AppDashboardMeta = {\n /** The host owns app identity and maximization controls. */\n isEmbedded?: boolean;\n isMultiAsset?: boolean;\n isMultiWell?: boolean;\n isChiplessDashboard?: boolean;\n globalOffsetWells?: GlobalOffsetWell[];\n globalOffsetWellsVersion?: number;\n globalOffsetWellsToken?: number;\n wellPlanning?: WellPlanningDashboardMeta;\n};\n\n// ⚠️⚠️⚠️ Mentioned in storybook, please update when editing this type\n// Used in AppTestWrapper\nexport type AppCommonsContextType = {\n maximized: boolean;\n appId: number;\n app: App;\n appKey: string;\n appName: string;\n appSettings?: AppSettings;\n onSettingChange: (key: string, value: unknown) => void;\n onSettingsChange: (value: unknown) => void;\n\n well?: Well;\n rig?: Asset;\n fracFleet?: FracFleet;\n interventionUnit?: InterventionUnit;\n wells?: Well[];\n\n // Passed down from corva-web-frontend. May not exist, so everything must be optional\n dashboardMeta?: AppDashboardMeta;\n appHeadersV3Enabled?: boolean;\n // [REACT-18-MIGRATION-TAG] PLT-3099: true when the app renders in-process on the host\n // (the platform isolation decision from DevCenterIsolatedApp); iframe realms leave it unset.\n isNonIsolatedApp?: boolean;\n disableAppAssetSelection?: boolean;\n isMultiRig?: boolean;\n currentUser?: User;\n globalOffsetWells?: GlobalOffsetWell[];\n globalOffsetWellsVersion?: number;\n globalOffsetWellsToken?: number;\n removeApp?: () => void;\n};\n\nexport type AppCommonsContextTypeInternal = AppCommonsContextType &\n Partial<FullscreenModes> & {\n /** True in any of the three modes: dashboard maximize, browser fullscreen, separate window */\n isExpanded?: boolean;\n setMaximized: (maximized: boolean) => void;\n appData?: unknown;\n layoutEnvironment?: ({ type?: string } & Record<string, unknown>) | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n appSettingsComponent?: ComponentType<any>;\n toggleAnnotationsList?: () => void;\n onHelpCenterClick?: () => void;\n secondaryMenuItems?: { title: ReactNode; onClick?: () => void; icon?: ReactNode }[];\n isInsideNewMobileApp?: boolean;\n reloadApp?: () => void;\n };\n\nexport const AppCommonsContext = createContext<AppCommonsContextTypeInternal>(\n // TODO provide defaults\n null as unknown as AppCommonsContextTypeInternal\n);\n\nexport const useAppCommonsInternal = () => useContext(AppCommonsContext);\n\nexport const useAppCommons = () => useContext(AppCommonsContext) as AppCommonsContextType;\n"],"names":["AppCommonsContext","createContext","useContext"],"mappings":"2FAuFaA,EAAoBC,EAAaA,cAE5C,wDAK2B,WAAH,OAASC,EAAAA,WAAWF,EAAkB,gCAF3B,WAAH,OAASE,EAAAA,WAAWF,EAAkB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ActionsTestIds=void 0,(e=exports.ActionsTestIds||(exports.ActionsTestIds={})).CollapseButtonTestId="CorvaUI.AppHeader.Actions.CollapseButtonTestId",e.ExpandButtonTestId="CorvaUI.AppHeader.Actions.ExpandButtonTestId",e.AdditionalActionItemTestId="CorvaUI.AppHeader.Actions.AdditionalActionItemTestId",e.CloseCommentButtonTestId="CorvaUI.AppHeader.Actions.CloseCommentButtonTestId",e.AddMessageButtonTestId="CorvaUI.AppHeader.Actions.AddMessageButtonTestId",e.MaximizeItemTestId="CorvaUI.AppHeader.Actions.MaximizeItemTestId",e.BrowserFullscreenItemTestId="CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId",e.SeparateWindowItemTestId="CorvaUI.AppHeader.Actions.SeparateWindowItemTestId";
1
+ "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ActionsTestIds=void 0,(e=exports.ActionsTestIds||(exports.ActionsTestIds={})).MoreButtonTestId="CorvaUI.AppHeader.Actions.MoreButtonTestId",e.CollapseButtonTestId="CorvaUI.AppHeader.Actions.CollapseButtonTestId",e.ExpandButtonTestId="CorvaUI.AppHeader.Actions.ExpandButtonTestId",e.AdditionalActionItemTestId="CorvaUI.AppHeader.Actions.AdditionalActionItemTestId",e.CloseCommentButtonTestId="CorvaUI.AppHeader.Actions.CloseCommentButtonTestId",e.AddMessageButtonTestId="CorvaUI.AppHeader.Actions.AddMessageButtonTestId",e.MaximizeItemTestId="CorvaUI.AppHeader.Actions.MaximizeItemTestId",e.BrowserFullscreenItemTestId="CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId",e.SeparateWindowItemTestId="CorvaUI.AppHeader.Actions.SeparateWindowItemTestId";
2
2
  //# sourceMappingURL=Actions.constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.constants.js","sources":["../../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.constants.ts"],"sourcesContent":["export enum ActionsTestIds {\n CollapseButtonTestId = 'CorvaUI.AppHeader.Actions.CollapseButtonTestId',\n ExpandButtonTestId = 'CorvaUI.AppHeader.Actions.ExpandButtonTestId',\n AdditionalActionItemTestId = 'CorvaUI.AppHeader.Actions.AdditionalActionItemTestId',\n CloseCommentButtonTestId = 'CorvaUI.AppHeader.Actions.CloseCommentButtonTestId',\n AddMessageButtonTestId = 'CorvaUI.AppHeader.Actions.AddMessageButtonTestId',\n MaximizeItemTestId = 'CorvaUI.AppHeader.Actions.MaximizeItemTestId',\n BrowserFullscreenItemTestId = 'CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId',\n SeparateWindowItemTestId = 'CorvaUI.AppHeader.Actions.SeparateWindowItemTestId',\n}\n"],"names":["ActionsTestIds"],"mappings":"aASC,IATWA,yDAAAA,QAAcA,oBAAA,GAAdA,EAAAA,QAAcA,iBAAdA,uBAAc,CAAA,IAAA,qBAAA,iDAAdA,EAAc,mBAAA,+CAAdA,EAAc,2BAAA,uDAAdA,EAAc,yBAAA,qDAAdA,EAAc,uBAAA,mDAAdA,EAAc,mBAAA,+CAAdA,EAAc,4BAAA,wDAAdA,EAAc,yBAAA"}
1
+ {"version":3,"file":"Actions.constants.js","sources":["../../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.constants.ts"],"sourcesContent":["export enum ActionsTestIds {\n MoreButtonTestId = 'CorvaUI.AppHeader.Actions.MoreButtonTestId',\n CollapseButtonTestId = 'CorvaUI.AppHeader.Actions.CollapseButtonTestId',\n ExpandButtonTestId = 'CorvaUI.AppHeader.Actions.ExpandButtonTestId',\n AdditionalActionItemTestId = 'CorvaUI.AppHeader.Actions.AdditionalActionItemTestId',\n CloseCommentButtonTestId = 'CorvaUI.AppHeader.Actions.CloseCommentButtonTestId',\n AddMessageButtonTestId = 'CorvaUI.AppHeader.Actions.AddMessageButtonTestId',\n MaximizeItemTestId = 'CorvaUI.AppHeader.Actions.MaximizeItemTestId',\n BrowserFullscreenItemTestId = 'CorvaUI.AppHeader.Actions.BrowserFullscreenItemTestId',\n SeparateWindowItemTestId = 'CorvaUI.AppHeader.Actions.SeparateWindowItemTestId',\n}\n"],"names":["ActionsTestIds"],"mappings":"aAUC,IAVWA,yDAAAA,QAAcA,oBAAA,GAAdA,EAAAA,QAAcA,iBAAdA,uBAAc,CAAA,IAAA,iBAAA,6CAAdA,EAAc,qBAAA,iDAAdA,EAAc,mBAAA,+CAAdA,EAAc,2BAAA,uDAAdA,EAAc,yBAAA,qDAAdA,EAAc,uBAAA,mDAAdA,EAAc,mBAAA,+CAAdA,EAAc,4BAAA,wDAAdA,EAAc,yBAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/typeof"),i=require("react"),r=require("classnames"),c=require("../../../ButtonIcon/ButtonIcon.js"),t=require("../../../Tooltip/Tooltip.js"),u=require("../SettingsButton/SettingsButton.js");require("../SettingsButton/SettingsButton.constants.js");var l=require("../../../Menu/Menu.js");require("../../../AppCommonsProvider/AppCommonsProvider.js");var a=require("../../../AppCommonsProvider/AppCommonsContext.js"),m=require("../../../AppPanel/AppPanelsContext.js"),d=require("../../../HideInNativeApp/index.js"),j=require("./Actions.constants.js"),p=require("./Actions.scss.js"),q=require("../../../../icons/iconParkIcons.js"),I=require("../../../../icons/customIcons/icons/AddMessage.js");require("../../../../icons/customIcons/icons/DragOne.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/SearchOne.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/InfoRounded.js"),require("../../../../icons/customIcons/icons/FlameFilled.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/Global.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/PinOne.js"),require("../../../../icons/customIcons/icons/PinOneCrossed.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("../../../../icons/customIcons/icons/InterventionUnit.js"),require("../../../../icons/customIcons/icons/CloudDelete.js"),require("../../../../icons/customIcons/icons/Lasso.js"),require("../../../../icons/customIcons/icons/Radius.js"),require("../../../../icons/customIcons/icons/ErrorOps.js"),require("../../../../icons/customIcons/icons/DataTypeOps.js"),require("../../../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../../../icons/customIcons/icons/CalibrationOps.js"),require("../../../../icons/customIcons/icons/CriticalOps.js"),require("../../../../icons/customIcons/icons/Company.js"),require("../../../../icons/customIcons/icons/ArchiveOne.js"),require("../../../../icons/customIcons/icons/ParseBotFusion.js"),require("../../../../icons/customIcons/icons/Connect.js"),require("../../../../icons/customIcons/icons/PuzzleOne.js"),require("../../../../icons/customIcons/icons/Feed.js"),require("../../../../icons/customIcons/icons/Prompt.js"),require("../../../../icons/customIcons/icons/Companies.js"),require("../../../../icons/customIcons/icons/ClipboardAi.js"),require("../../../../icons/customIcons/icons/Key.js"),require("../../../../icons/customIcons/icons/AtSignCrossed.js"),require("../../../../icons/customIcons/icons/MappingManual.js"),require("../../../../icons/customIcons/icons/Mapping.js"),require("../../../../icons/customIcons/icons/Metrics.js"),require("../../../../icons/customIcons/icons/Drops.js"),require("../../../../icons/customIcons/icons/ClipboardSearch.js"),require("../../../../icons/customIcons/icons/Template.js"),require("../../../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../../../icons/customIcons/icons/UnitConversion.js"),require("../../../../icons/customIcons/icons/NPT.js"),require("../../../../icons/customIcons/icons/GuidedFrac.js"),require("../../../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),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("immutable"),require("query-string"),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("../../../../constants/corvaCompanyId.js"),require("../../../../components/GradientManager/configuration/constants.js"),require("../../../../utils/index.js"),require("uuid"),require("jsona"),require("../../../../utils/env.js"),require("../../../../components/StatusBadge/constants.js"),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("../../../../clients/api/rateLimiter.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../../../constants/streamSourceType.js");var C=require("../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js"),f=require("../../../../utils/mobileDetect.js"),b=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(e),A=h(s),g=h(n),v=h(o),M=h(r);function y(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function O(e){for(var s=1;s<arguments.length;s++){var n=null!=arguments[s]?arguments[s]:{};s%2?y(Object(n),!0).forEach((function(s){A.default(e,s,n[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))}))}return e}var S=function(e){return!!e&&"object"===v.default(e)&&"title"in e};exports.Actions=function(e){var s=e.additionalActions,n=e.showComments,o=e.disableSettings,r=e.hideSettingsUnderMore,h=a.useAppCommonsInternal(),A=h.maximized,v=h.setMaximized,y=h.appSettingsComponent,k=h.isExpanded,B=h.isBrowserFullscreen,T=h.enterBrowserFullscreen,P=h.exitBrowserFullscreen,F=h.isSeparateWindow,w=h.openSeparateWindow,E=h.closeSeparateWindow,D=C.useAppCommentsMode(),N=C.useSetAppCommentsMode(),z=i.useState(!1),R=g.default(z,2),W=R[0],U=R[1],G=i.useRef(null),H=i.useRef(null),L=i.useState(!0),_=g.default(L,2),K=_[0],Z=_[1],J=i.useState(!1),Q=g.default(J,2),V=Q[0],X=Q[1],Y=i.useRef(null),$=i.useRef(!1),ee=m.useAppSettingsPanel(),se=ee.open,ne=ee.isOpen,oe=!!y&&!o,ie=i.useCallback((function(){U((function(e){return!e}))}),[]),re=i.useCallback((function(){N((function(e){return!e}))}),[N]),ce=i.useCallback((function(){$.current=!1,X(!1)}),[]),te=i.useCallback((function(){Z(!1),ce(),F?null==E||E():B?null==P||P():v(!A)}),[ce,E,P,B,F,A,v]),ue=F?"Close Separate Window":k?"Restore":"Maximize",le=i.useCallback((function(){Y.current&&(clearTimeout(Y.current),Y.current=null)}),[]),ae=i.useCallback((function(){!k&&T&&(le(),Y.current=setTimeout((function(){$.current=!0,X(!0)}),500))}),[le,T,k]);i.useEffect((function(){return le}),[le]);var me=i.useCallback((function(){$.current?$.current=!1:te()}),[te]),de=i.useCallback((function(){ce(),null==w||w()}),[ce,w]),je=i.useCallback((function(){ce(),null==T||T()}),[ce,T]);i.useEffect((function(){Z(!0)}),[k]);var pe=i.useMemo((function(){if(f.isInsideNewMobileApp)return[];var e=function(e){return function(){ie(),null==e||e()}},o=(s||[]).filter(S).map((function(s){return O(O({},s),{},{onClick:e(s.onClick)})})),i={icon:b.jsx(q.MessageIcon,{}),onClick:e(re),title:D?"Close Comments Mode":"Add Comment"},c={title:ue,onClick:e(te),icon:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})},t={title:"Settings",onClick:e(se),icon:b.jsx(q.SettingTwoIcon,{})};return[].concat(x.default(o),x.default(n?[i]:[]),x.default(r&&oe?[t]:[]),[c])}),[s,D,r,k,ue,se,oe,n,re,te,ie]),qe=pe.length>1,Ie=b.jsx(c.ButtonIcon,{size:"small",type:"tertiaryBg",ref:H,onClick:me,onMouseDown:ae,onMouseUp:le,onMouseLeave:le,className:qe?p.fullscreenButton:void 0,testId:k?j.ActionsTestIds.CollapseButtonTestId:j.ActionsTestIds.ExpandButtonTestId,children:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})});return b.jsxs(b.Fragment,{children:[b.jsx(d.HideInNativeApp,{children:null==s?void 0:s.map((function(e,s){return S(e)?b.jsx(t.Tooltip,{title:e.title,children:b.jsx(c.ButtonIcon,{size:"small",type:"tertiary",onClick:e.onClick,className:M.default(p.additionalActionButton),testId:j.ActionsTestIds.AdditionalActionItemTestId,children:e.icon})},s):b.jsx(i.Fragment,{children:e},s)}))}),b.jsx(d.HideInNativeApp,{children:n&&b.jsx(t.Tooltip,{title:D?"Close Comments Mode":"Add Comment",children:b.jsx(c.ButtonIcon,{size:"small",type:D?"secondaryBg":"tertiaryBg",onClick:re,className:qe?p.commentButton:void 0,testId:D?j.ActionsTestIds.CloseCommentButtonTestId:j.ActionsTestIds.AddMessageButtonTestId,children:D?b.jsx(q.CloseSmallIcon,{}):b.jsx(I.AddMessageCustomIcon,{fill:"currentColor"})})})}),oe&&b.jsx(u.SettingsButton,{className:r&&!f.isInsideNewMobileApp?p.settingsHiddenUnderMore:void 0}),b.jsxs(d.HideInNativeApp,{children:[K?b.jsx(t.Tooltip,{title:ue,children:Ie}):Ie,H.current&&b.jsxs(l.Menu,{anchorEl:H.current,open:V,onClose:ce,placement:"bottom-end",children:[b.jsx(l.Menu.Item,{onClick:te,testId:j.ActionsTestIds.MaximizeItemTestId,children:"Maximize"}),b.jsx(l.Menu.Item,{onClick:je,testId:j.ActionsTestIds.BrowserFullscreenItemTestId,children:"Full Screen"}),b.jsx(l.Menu.Item,{onClick:de,testId:j.ActionsTestIds.SeparateWindowItemTestId,children:"Separate Window"})]})]}),b.jsxs(d.HideInNativeApp,{children:[qe&&b.jsx(t.Tooltip,{title:"More",children:b.jsx(c.ButtonIcon,{type:W||r&&ne?"secondaryBg":"tertiaryBg",className:p.moreButton,ref:G,onClick:ie,size:"small",children:b.jsx(q.MoreOneIcon,{})})}),qe&&G.current&&b.jsx(l.Menu,{anchorEl:G.current,open:W,onClose:ie,placement:"bottom-end",children:pe.map((function(e,s){return b.jsx(l.Menu.Item,{size:"large",prefix:e.icon,onClick:e.onClick,children:e.title},s)}))})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),s=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/slicedToArray"),o=require("@babel/runtime/helpers/typeof"),i=require("react"),r=require("classnames"),c=require("../../../ButtonIcon/ButtonIcon.js"),t=require("../../../Tooltip/Tooltip.js"),u=require("../SettingsButton/SettingsButton.js");require("../SettingsButton/SettingsButton.constants.js");var l=require("../../../Menu/Menu.js");require("../../../AppCommonsProvider/AppCommonsProvider.js");var a=require("../../../AppCommonsProvider/AppCommonsContext.js"),m=require("../../../AppPanel/AppPanelsContext.js"),d=require("../../../HideInNativeApp/index.js"),j=require("./Actions.constants.js"),p=require("./Actions.scss.js"),q=require("../../../../icons/iconParkIcons.js"),I=require("../../../../icons/customIcons/icons/AddMessage.js");require("../../../../icons/customIcons/icons/DragOne.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/SearchOne.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/InfoRounded.js"),require("../../../../icons/customIcons/icons/FlameFilled.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/Global.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/PinOne.js"),require("../../../../icons/customIcons/icons/PinOneCrossed.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("../../../../icons/customIcons/icons/InterventionUnit.js"),require("../../../../icons/customIcons/icons/CloudDelete.js"),require("../../../../icons/customIcons/icons/Lasso.js"),require("../../../../icons/customIcons/icons/Radius.js"),require("../../../../icons/customIcons/icons/ErrorOps.js"),require("../../../../icons/customIcons/icons/DataTypeOps.js"),require("../../../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../../../icons/customIcons/icons/CalibrationOps.js"),require("../../../../icons/customIcons/icons/CriticalOps.js"),require("../../../../icons/customIcons/icons/Company.js"),require("../../../../icons/customIcons/icons/ArchiveOne.js"),require("../../../../icons/customIcons/icons/ParseBotFusion.js"),require("../../../../icons/customIcons/icons/Connect.js"),require("../../../../icons/customIcons/icons/PuzzleOne.js"),require("../../../../icons/customIcons/icons/Feed.js"),require("../../../../icons/customIcons/icons/Prompt.js"),require("../../../../icons/customIcons/icons/Companies.js"),require("../../../../icons/customIcons/icons/ClipboardAi.js"),require("../../../../icons/customIcons/icons/Key.js"),require("../../../../icons/customIcons/icons/AtSignCrossed.js"),require("../../../../icons/customIcons/icons/MappingManual.js"),require("../../../../icons/customIcons/icons/Mapping.js"),require("../../../../icons/customIcons/icons/Metrics.js"),require("../../../../icons/customIcons/icons/Drops.js"),require("../../../../icons/customIcons/icons/ClipboardSearch.js"),require("../../../../icons/customIcons/icons/Template.js"),require("../../../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../../../icons/customIcons/icons/UnitConversion.js"),require("../../../../icons/customIcons/icons/NPT.js"),require("../../../../icons/customIcons/icons/GuidedFrac.js"),require("../../../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),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("immutable"),require("query-string"),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("../../../../constants/corvaCompanyId.js"),require("../../../../components/GradientManager/configuration/constants.js"),require("../../../../utils/index.js"),require("uuid"),require("jsona"),require("../../../../utils/env.js"),require("../../../../components/StatusBadge/constants.js"),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("../../../../clients/api/rateLimiter.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../../../constants/streamSourceType.js");var C=require("../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js"),f=require("../../../../utils/mobileDetect.js"),b=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(e),A=h(s),g=h(n),v=h(o),M=h(r);function y(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function O(e){for(var s=1;s<arguments.length;s++){var n=null!=arguments[s]?arguments[s]:{};s%2?y(Object(n),!0).forEach((function(s){A.default(e,s,n[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))}))}return e}var S=function(e){return!!e&&"object"===v.default(e)&&"title"in e};exports.Actions=function(e){var s=e.additionalActions,n=e.showComments,o=e.disableSettings,r=e.hideSettingsUnderMore,h=a.useAppCommonsInternal(),A=h.maximized,v=h.setMaximized,y=h.appSettingsComponent,k=h.isExpanded,B=h.isBrowserFullscreen,T=h.enterBrowserFullscreen,P=h.exitBrowserFullscreen,F=h.isSeparateWindow,w=h.openSeparateWindow,E=h.closeSeparateWindow,D=h.dashboardMeta,N=!(null==D||!D.isEmbedded),z=C.useAppCommentsMode(),R=C.useSetAppCommentsMode(),W=i.useState(!1),U=g.default(W,2),G=U[0],H=U[1],L=i.useRef(null),_=i.useRef(null),K=i.useState(!0),Z=g.default(K,2),J=Z[0],Q=Z[1],V=i.useState(!1),X=g.default(V,2),Y=X[0],$=X[1],ee=i.useRef(null),se=i.useRef(!1),ne=m.useAppSettingsPanel(),oe=ne.open,ie=ne.isOpen,re=!!y&&!o,ce=i.useCallback((function(){H((function(e){return!e}))}),[]),te=i.useCallback((function(){R((function(e){return!e}))}),[R]),ue=i.useCallback((function(){se.current=!1,$(!1)}),[]),le=i.useCallback((function(){Q(!1),ue(),F?null==E||E():B?null==P||P():v(!A)}),[ue,E,P,B,F,A,v]),ae=F?"Close Separate Window":k?"Restore":"Maximize",me=i.useCallback((function(){ee.current&&(clearTimeout(ee.current),ee.current=null)}),[]),de=i.useCallback((function(){!k&&T&&(me(),ee.current=setTimeout((function(){se.current=!0,$(!0)}),500))}),[me,T,k]);i.useEffect((function(){return me}),[me]);var je=i.useCallback((function(){se.current?se.current=!1:le()}),[le]),pe=i.useCallback((function(){ue(),null==w||w()}),[ue,w]),qe=i.useCallback((function(){ue(),null==T||T()}),[ue,T]);i.useEffect((function(){Q(!0)}),[k]);var Ie=i.useMemo((function(){if(f.isInsideNewMobileApp)return[];var e=function(e){return function(){ce(),null==e||e()}},o=(s||[]).filter(S).map((function(s){return O(O({},s),{},{onClick:e(s.onClick)})})),i={icon:b.jsx(q.MessageIcon,{}),onClick:e(te),title:z?"Close Comments Mode":"Add Comment"},c={title:ae,onClick:e(le),icon:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})},t={title:"Settings",onClick:e(oe),icon:b.jsx(q.SettingTwoIcon,{})};return[].concat(x.default(o),x.default(n?[i]:[]),x.default(r&&re?[t]:[]),x.default(N?[]:[c]))}),[s,z,r,k,ae,oe,re,n,N,te,le,ce]),Ce=Ie.length>(N?0:1),fe=b.jsx(c.ButtonIcon,{size:"small",type:"tertiaryBg",ref:_,onClick:je,onMouseDown:de,onMouseUp:me,onMouseLeave:me,className:Ce?p.fullscreenButton:void 0,testId:k?j.ActionsTestIds.CollapseButtonTestId:j.ActionsTestIds.ExpandButtonTestId,children:k?b.jsx(q.CollapseIcon,{}):b.jsx(q.ExpandIcon,{})}),be=J?b.jsx(t.Tooltip,{title:ae,children:fe}):fe;return b.jsxs(b.Fragment,{children:[b.jsx(d.HideInNativeApp,{children:null==s?void 0:s.map((function(e,s){return S(e)?b.jsx(t.Tooltip,{title:e.title,children:b.jsx(c.ButtonIcon,{size:"small",type:"tertiary",onClick:e.onClick,className:M.default(p.additionalActionButton),testId:j.ActionsTestIds.AdditionalActionItemTestId,children:e.icon})},s):b.jsx(i.Fragment,{children:e},s)}))}),b.jsx(d.HideInNativeApp,{children:n&&b.jsx(t.Tooltip,{title:z?"Close Comments Mode":"Add Comment",children:b.jsx(c.ButtonIcon,{size:"small",type:z?"secondaryBg":"tertiaryBg",onClick:te,className:Ce?p.commentButton:void 0,testId:z?j.ActionsTestIds.CloseCommentButtonTestId:j.ActionsTestIds.AddMessageButtonTestId,children:z?b.jsx(q.CloseSmallIcon,{}):b.jsx(I.AddMessageCustomIcon,{fill:"currentColor"})})})}),re&&b.jsx(u.SettingsButton,{className:r&&!f.isInsideNewMobileApp?p.settingsHiddenUnderMore:void 0}),b.jsxs(d.HideInNativeApp,{children:[!N&&be,!N&&_.current&&b.jsxs(l.Menu,{anchorEl:_.current,open:Y,onClose:ue,placement:"bottom-end",children:[b.jsx(l.Menu.Item,{onClick:le,testId:j.ActionsTestIds.MaximizeItemTestId,children:"Maximize"}),b.jsx(l.Menu.Item,{onClick:qe,testId:j.ActionsTestIds.BrowserFullscreenItemTestId,children:"Full Screen"}),b.jsx(l.Menu.Item,{onClick:pe,testId:j.ActionsTestIds.SeparateWindowItemTestId,children:"Separate Window"})]})]}),b.jsxs(d.HideInNativeApp,{children:[Ce&&b.jsx(t.Tooltip,{title:"More",children:b.jsx(c.ButtonIcon,{type:G||r&&ie?"secondaryBg":"tertiaryBg",className:p.moreButton,ref:L,testId:j.ActionsTestIds.MoreButtonTestId,onClick:ce,size:"small",children:b.jsx(q.MoreOneIcon,{})})}),Ce&&L.current&&b.jsx(l.Menu,{anchorEl:L.current,open:G,onClose:ce,placement:"bottom-end",children:Ie.map((function(e,s){return b.jsx(l.Menu.Item,{size:"large",prefix:e.icon,onClick:e.onClick,children:e.title},s)}))})]})]})};
2
2
  //# sourceMappingURL=Actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.tsx"],"sourcesContent":["import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../../ButtonIcon';\nimport { Tooltip } from '../../../Tooltip';\nimport { SettingsButton } from '../SettingsButton';\nimport { AdditionalAction, AdditionalActionObject } from '../constants';\nimport { Menu } from '../../../Menu';\nimport { useAppCommonsInternal } from '../../../AppCommonsProvider';\nimport { useAppSettingsPanel } from '../../../AppPanel/AppPanelsContext';\nimport { HideInNativeApp } from '../../../HideInNativeApp';\n\nimport { ActionsTestIds } from './Actions.constants';\n\nimport styles from './Actions.scss';\n\nimport {\n AddMessageCustomIcon,\n CloseSmallIcon,\n CollapseIcon,\n ExpandIcon,\n MessageIcon,\n MoreOneIcon,\n SettingTwoIcon,\n} from '~/icons';\nimport { useAppCommentsMode, useSetAppCommentsMode } from '~/effects';\nimport { isInsideNewMobileApp } from '~/utils/mobileDetect';\n\ntype ActionsProps = {\n additionalActions?: AdditionalAction[];\n showComments?: boolean;\n disableSettings?: boolean;\n hideSettingsUnderMore?: boolean;\n};\n\nconst isActionObject = (action: AdditionalAction): action is AdditionalActionObject =>\n !!action && typeof action === 'object' && 'title' in action;\n\nconst LONG_PRESS_DELAY_MS = 500;\n\nexport const Actions = ({\n additionalActions,\n showComments,\n disableSettings,\n hideSettingsUnderMore,\n}: ActionsProps) => {\n const {\n maximized,\n setMaximized,\n appSettingsComponent,\n isExpanded,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n } = useAppCommonsInternal();\n const commentsEnabled = useAppCommentsMode();\n const setCommentsMode = useSetAppCommentsMode();\n const [moreMenuOpen, setMoreMenuOpen] = useState(false);\n const moreButtonRef = useRef<HTMLButtonElement>(null);\n const maximizeButtonRef = useRef<HTMLButtonElement>(null);\n const [showMaximizeTooltip, setShowMaximizeTooltip] = useState(true);\n const [isModesMenuOpen, setIsModesMenuOpen] = useState(false);\n const longPressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const isLongPressRef = useRef(false);\n\n const { open, isOpen } = useAppSettingsPanel();\n const settingsVisible = !!appSettingsComponent && !disableSettings;\n\n const toggleMoreMenu = useCallback(() => {\n setMoreMenuOpen(value => !value);\n }, []);\n\n const toggleCommentsMode = useCallback(() => {\n setCommentsMode(value => !value);\n }, [setCommentsMode]);\n\n const closeModesMenu = useCallback(() => {\n isLongPressRef.current = false;\n setIsModesMenuOpen(false);\n }, []);\n\n const toggleMaximized = useCallback(() => {\n setShowMaximizeTooltip(false);\n closeModesMenu();\n\n if (isSeparateWindow) {\n closeSeparateWindow?.();\n return;\n }\n\n if (isBrowserFullscreen) {\n exitBrowserFullscreen?.();\n return;\n }\n\n setMaximized(!maximized);\n }, [\n closeModesMenu,\n closeSeparateWindow,\n exitBrowserFullscreen,\n isBrowserFullscreen,\n isSeparateWindow,\n maximized,\n setMaximized,\n ]);\n\n const maximizeTooltip = isSeparateWindow\n ? 'Close Separate Window'\n : isExpanded\n ? 'Restore'\n : 'Maximize';\n\n const cancelLongPress = useCallback(() => {\n if (longPressTimerRef.current) {\n clearTimeout(longPressTimerRef.current);\n longPressTimerRef.current = null;\n }\n }, []);\n\n const handleMaximizeMouseDown = useCallback(() => {\n if (isExpanded || !enterBrowserFullscreen) return;\n\n cancelLongPress();\n longPressTimerRef.current = setTimeout(() => {\n isLongPressRef.current = true;\n setIsModesMenuOpen(true);\n }, LONG_PRESS_DELAY_MS);\n }, [cancelLongPress, enterBrowserFullscreen, isExpanded]);\n\n useEffect(() => cancelLongPress, [cancelLongPress]);\n\n const handleMaximizeClick = useCallback(() => {\n if (isLongPressRef.current) {\n isLongPressRef.current = false;\n return;\n }\n\n toggleMaximized();\n }, [toggleMaximized]);\n\n const handleSeparateWindowClick = useCallback(() => {\n closeModesMenu();\n openSeparateWindow?.();\n }, [closeModesMenu, openSeparateWindow]);\n\n const handleBrowserFullscreenClick = useCallback(() => {\n closeModesMenu();\n enterBrowserFullscreen?.();\n }, [closeModesMenu, enterBrowserFullscreen]);\n\n useEffect(() => {\n setShowMaximizeTooltip(true);\n }, [isExpanded]);\n\n const menuActionItems = useMemo(() => {\n if (isInsideNewMobileApp) return [];\n\n const getOnClick = (handler: AdditionalActionObject['onClick']) => () => {\n toggleMoreMenu();\n handler?.();\n };\n\n const objectActions = (additionalActions || [])\n .filter(isActionObject)\n .map(item => ({ ...item, onClick: getOnClick(item.onClick) }));\n\n const commentItem: AdditionalActionObject = {\n icon: <MessageIcon />,\n onClick: getOnClick(toggleCommentsMode),\n title: commentsEnabled ? 'Close Comments Mode' : 'Add Comment',\n };\n\n const maximizeItem: AdditionalActionObject = {\n title: maximizeTooltip,\n onClick: getOnClick(toggleMaximized),\n icon: isExpanded ? <CollapseIcon /> : <ExpandIcon />,\n };\n\n const settingsItem = {\n title: 'Settings',\n onClick: getOnClick(open),\n icon: <SettingTwoIcon />,\n };\n\n return [\n ...objectActions,\n ...(showComments ? [commentItem] : []),\n ...(hideSettingsUnderMore && settingsVisible ? [settingsItem] : []),\n maximizeItem,\n ];\n }, [\n additionalActions,\n commentsEnabled,\n hideSettingsUnderMore,\n isExpanded,\n maximizeTooltip,\n open,\n settingsVisible,\n showComments,\n toggleCommentsMode,\n toggleMaximized,\n toggleMoreMenu,\n ]);\n\n // Show menu only if there's something there besides the fullscreen item\n const hasMenu = menuActionItems.length > 1;\n\n const maximizeButton = (\n <ButtonIcon\n size=\"small\"\n type=\"tertiaryBg\"\n ref={maximizeButtonRef}\n onClick={handleMaximizeClick}\n onMouseDown={handleMaximizeMouseDown}\n onMouseUp={cancelLongPress}\n onMouseLeave={cancelLongPress}\n className={hasMenu ? styles.fullscreenButton : undefined}\n testId={isExpanded ? ActionsTestIds.CollapseButtonTestId : ActionsTestIds.ExpandButtonTestId}\n >\n {isExpanded ? <CollapseIcon /> : <ExpandIcon />}\n </ButtonIcon>\n );\n\n return (\n <>\n <HideInNativeApp>\n {additionalActions?.map((action, index) =>\n !isActionObject(action) ? (\n <Fragment key={index}>{action}</Fragment>\n ) : (\n <Tooltip title={action.title} key={index}>\n <ButtonIcon\n size=\"small\"\n type=\"tertiary\"\n onClick={action.onClick}\n className={classNames(styles.additionalActionButton)}\n testId={ActionsTestIds.AdditionalActionItemTestId}\n >\n {action.icon}\n </ButtonIcon>\n </Tooltip>\n )\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {showComments && (\n <Tooltip title={commentsEnabled ? 'Close Comments Mode' : 'Add Comment'}>\n <ButtonIcon\n size=\"small\"\n type={commentsEnabled ? 'secondaryBg' : 'tertiaryBg'}\n onClick={toggleCommentsMode}\n className={hasMenu ? styles.commentButton : undefined}\n testId={\n commentsEnabled\n ? ActionsTestIds.CloseCommentButtonTestId\n : ActionsTestIds.AddMessageButtonTestId\n }\n >\n {commentsEnabled ? <CloseSmallIcon /> : <AddMessageCustomIcon fill=\"currentColor\" />}\n </ButtonIcon>\n </Tooltip>\n )}\n </HideInNativeApp>\n\n {settingsVisible && (\n <SettingsButton\n className={\n hideSettingsUnderMore && !isInsideNewMobileApp\n ? styles.settingsHiddenUnderMore\n : undefined\n }\n />\n )}\n\n {/* \n Our \"pseudo-fullscreen\" system gets a stroke when we try to go fullscreen when a tooltip is shown (and we're in a \"pseudo-fullscreen\" mode) \n and we change actual \"fullscreen\" status of an app.\n So we don't show tooltip when user clicks the button, and we expect the \"fullscreen\" status to change.\n */}\n <HideInNativeApp>\n {showMaximizeTooltip ? (\n <Tooltip title={maximizeTooltip}>{maximizeButton}</Tooltip>\n ) : (\n maximizeButton\n )}\n\n {maximizeButtonRef.current && (\n <Menu\n anchorEl={maximizeButtonRef.current}\n open={isModesMenuOpen}\n onClose={closeModesMenu}\n placement=\"bottom-end\"\n >\n <Menu.Item onClick={toggleMaximized} testId={ActionsTestIds.MaximizeItemTestId}>\n Maximize\n </Menu.Item>\n <Menu.Item\n onClick={handleBrowserFullscreenClick}\n testId={ActionsTestIds.BrowserFullscreenItemTestId}\n >\n Full Screen\n </Menu.Item>\n <Menu.Item\n onClick={handleSeparateWindowClick}\n testId={ActionsTestIds.SeparateWindowItemTestId}\n >\n Separate Window\n </Menu.Item>\n </Menu>\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {hasMenu && (\n <Tooltip title=\"More\">\n <ButtonIcon\n type={\n moreMenuOpen || (hideSettingsUnderMore && isOpen) ? 'secondaryBg' : 'tertiaryBg'\n }\n className={styles.moreButton}\n ref={moreButtonRef}\n onClick={toggleMoreMenu}\n size=\"small\"\n >\n <MoreOneIcon />\n </ButtonIcon>\n </Tooltip>\n )}\n\n {hasMenu && moreButtonRef.current && (\n <Menu\n anchorEl={moreButtonRef.current}\n open={moreMenuOpen}\n onClose={toggleMoreMenu}\n placement=\"bottom-end\"\n >\n {menuActionItems.map((item, index) => (\n <Menu.Item size=\"large\" prefix={item.icon} key={index} onClick={item.onClick}>\n {item.title}\n </Menu.Item>\n ))}\n </Menu>\n )}\n </HideInNativeApp>\n </>\n );\n};\n"],"names":["isActionObject","action","_typeof","_ref","additionalActions","showComments","disableSettings","hideSettingsUnderMore","_useAppCommonsInterna","useAppCommonsInternal","maximized","setMaximized","appSettingsComponent","isExpanded","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","commentsEnabled","useAppCommentsMode","setCommentsMode","useSetAppCommentsMode","useState","_useState2","_slicedToArray","_useState","moreMenuOpen","setMoreMenuOpen","moreButtonRef","useRef","maximizeButtonRef","_useState4","_useState3","showMaximizeTooltip","setShowMaximizeTooltip","_useState6","_useState5","isModesMenuOpen","setIsModesMenuOpen","longPressTimerRef","isLongPressRef","_useAppSettingsPanel","useAppSettingsPanel","open","isOpen","settingsVisible","toggleMoreMenu","useCallback","value","toggleCommentsMode","closeModesMenu","current","toggleMaximized","maximizeTooltip","cancelLongPress","clearTimeout","handleMaximizeMouseDown","setTimeout","useEffect","handleMaximizeClick","handleSeparateWindowClick","handleBrowserFullscreenClick","menuActionItems","useMemo","isInsideNewMobileApp","getOnClick","handler","objectActions","filter","map","item","_objectSpread","onClick","commentItem","icon","_jsx","MessageIcon","title","maximizeItem","CollapseIcon","ExpandIcon","settingsItem","SettingTwoIcon","_toConsumableArray","hasMenu","length","maximizeButton","jsx","ButtonIcon","size","type","ref","onMouseDown","onMouseUp","onMouseLeave","className","styles","fullscreenButton","undefined","testId","ActionsTestIds","CollapseButtonTestId","ExpandButtonTestId","children","_jsxs","_Fragment","HideInNativeApp","index","Tooltip","classNames","additionalActionButton","AdditionalActionItemTestId","Fragment","commentButton","CloseCommentButtonTestId","AddMessageButtonTestId","CloseSmallIcon","AddMessageCustomIcon","fill","SettingsButton","settingsHiddenUnderMore","Menu","anchorEl","onClose","placement","Item","MaximizeItemTestId","BrowserFullscreenItemTestId","SeparateWindowItemTestId","moreButton","MoreOneIcon","prefix"],"mappings":"6uPAmCA,IAAMA,EAAiB,SAACC,GAAwB,QAC5CA,GAA4B,WAAlBC,EAAA,QAAOD,IAAuB,U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9F,EAAcuB,QACxBR,KAAMjB,EACNiG,QAAS7E,GACT8E,UAAU,aAAYrB,SAErBzC,GAAgBO,KAAI,SAACC,EAAMqC,GAAK,OAC/BhC,EAAAY,IAACkC,EAAIA,KAACI,KAAI,CAACpC,KAAK,QAAQ0C,OAAQ7D,EAAKI,KAAkBF,QAASF,EAAKE,QAAQ+B,SAC1EjC,EAAKO,OADwC8B,aAS9D"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../../src/componentsV2/AppHeader/V3/Actions/Actions.tsx"],"sourcesContent":["import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../../ButtonIcon';\nimport { Tooltip } from '../../../Tooltip';\nimport { SettingsButton } from '../SettingsButton';\nimport { AdditionalAction, AdditionalActionObject } from '../constants';\nimport { Menu } from '../../../Menu';\nimport { useAppCommonsInternal } from '../../../AppCommonsProvider';\nimport { useAppSettingsPanel } from '../../../AppPanel/AppPanelsContext';\nimport { HideInNativeApp } from '../../../HideInNativeApp';\n\nimport { ActionsTestIds } from './Actions.constants';\n\nimport styles from './Actions.scss';\n\nimport {\n AddMessageCustomIcon,\n CloseSmallIcon,\n CollapseIcon,\n ExpandIcon,\n MessageIcon,\n MoreOneIcon,\n SettingTwoIcon,\n} from '~/icons';\nimport { useAppCommentsMode, useSetAppCommentsMode } from '~/effects';\nimport { isInsideNewMobileApp } from '~/utils/mobileDetect';\n\ntype ActionsProps = {\n additionalActions?: AdditionalAction[];\n showComments?: boolean;\n disableSettings?: boolean;\n hideSettingsUnderMore?: boolean;\n};\n\nconst isActionObject = (action: AdditionalAction): action is AdditionalActionObject =>\n !!action && typeof action === 'object' && 'title' in action;\n\nconst LONG_PRESS_DELAY_MS = 500;\n\nexport const Actions = ({\n additionalActions,\n showComments,\n disableSettings,\n hideSettingsUnderMore,\n}: ActionsProps) => {\n const {\n maximized,\n setMaximized,\n appSettingsComponent,\n isExpanded,\n isBrowserFullscreen,\n enterBrowserFullscreen,\n exitBrowserFullscreen,\n isSeparateWindow,\n openSeparateWindow,\n closeSeparateWindow,\n dashboardMeta,\n } = useAppCommonsInternal();\n const isEmbedded = !!dashboardMeta?.isEmbedded;\n const commentsEnabled = useAppCommentsMode();\n const setCommentsMode = useSetAppCommentsMode();\n const [moreMenuOpen, setMoreMenuOpen] = useState(false);\n const moreButtonRef = useRef<HTMLButtonElement>(null);\n const maximizeButtonRef = useRef<HTMLButtonElement>(null);\n const [showMaximizeTooltip, setShowMaximizeTooltip] = useState(true);\n const [isModesMenuOpen, setIsModesMenuOpen] = useState(false);\n const longPressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const isLongPressRef = useRef(false);\n\n const { open, isOpen } = useAppSettingsPanel();\n const settingsVisible = !!appSettingsComponent && !disableSettings;\n\n const toggleMoreMenu = useCallback(() => {\n setMoreMenuOpen(value => !value);\n }, []);\n\n const toggleCommentsMode = useCallback(() => {\n setCommentsMode(value => !value);\n }, [setCommentsMode]);\n\n const closeModesMenu = useCallback(() => {\n isLongPressRef.current = false;\n setIsModesMenuOpen(false);\n }, []);\n\n const toggleMaximized = useCallback(() => {\n setShowMaximizeTooltip(false);\n closeModesMenu();\n\n if (isSeparateWindow) {\n closeSeparateWindow?.();\n return;\n }\n\n if (isBrowserFullscreen) {\n exitBrowserFullscreen?.();\n return;\n }\n\n setMaximized(!maximized);\n }, [\n closeModesMenu,\n closeSeparateWindow,\n exitBrowserFullscreen,\n isBrowserFullscreen,\n isSeparateWindow,\n maximized,\n setMaximized,\n ]);\n\n const maximizeTooltip = isSeparateWindow\n ? 'Close Separate Window'\n : isExpanded\n ? 'Restore'\n : 'Maximize';\n\n const cancelLongPress = useCallback(() => {\n if (longPressTimerRef.current) {\n clearTimeout(longPressTimerRef.current);\n longPressTimerRef.current = null;\n }\n }, []);\n\n const handleMaximizeMouseDown = useCallback(() => {\n if (isExpanded || !enterBrowserFullscreen) return;\n\n cancelLongPress();\n longPressTimerRef.current = setTimeout(() => {\n isLongPressRef.current = true;\n setIsModesMenuOpen(true);\n }, LONG_PRESS_DELAY_MS);\n }, [cancelLongPress, enterBrowserFullscreen, isExpanded]);\n\n useEffect(() => cancelLongPress, [cancelLongPress]);\n\n const handleMaximizeClick = useCallback(() => {\n if (isLongPressRef.current) {\n isLongPressRef.current = false;\n return;\n }\n\n toggleMaximized();\n }, [toggleMaximized]);\n\n const handleSeparateWindowClick = useCallback(() => {\n closeModesMenu();\n openSeparateWindow?.();\n }, [closeModesMenu, openSeparateWindow]);\n\n const handleBrowserFullscreenClick = useCallback(() => {\n closeModesMenu();\n enterBrowserFullscreen?.();\n }, [closeModesMenu, enterBrowserFullscreen]);\n\n useEffect(() => {\n setShowMaximizeTooltip(true);\n }, [isExpanded]);\n\n const menuActionItems = useMemo(() => {\n if (isInsideNewMobileApp) return [];\n\n const getOnClick = (handler: AdditionalActionObject['onClick']) => () => {\n toggleMoreMenu();\n handler?.();\n };\n\n const objectActions = (additionalActions || [])\n .filter(isActionObject)\n .map(item => ({ ...item, onClick: getOnClick(item.onClick) }));\n\n const commentItem: AdditionalActionObject = {\n icon: <MessageIcon />,\n onClick: getOnClick(toggleCommentsMode),\n title: commentsEnabled ? 'Close Comments Mode' : 'Add Comment',\n };\n\n const maximizeItem: AdditionalActionObject = {\n title: maximizeTooltip,\n onClick: getOnClick(toggleMaximized),\n icon: isExpanded ? <CollapseIcon /> : <ExpandIcon />,\n };\n\n const settingsItem = {\n title: 'Settings',\n onClick: getOnClick(open),\n icon: <SettingTwoIcon />,\n };\n\n return [\n ...objectActions,\n ...(showComments ? [commentItem] : []),\n ...(hideSettingsUnderMore && settingsVisible ? [settingsItem] : []),\n ...(!isEmbedded ? [maximizeItem] : []),\n ];\n }, [\n additionalActions,\n commentsEnabled,\n hideSettingsUnderMore,\n isExpanded,\n maximizeTooltip,\n open,\n settingsVisible,\n showComments,\n isEmbedded,\n toggleCommentsMode,\n toggleMaximized,\n toggleMoreMenu,\n ]);\n\n // Maximization is already available as a button.\n const hasMenu = menuActionItems.length > (isEmbedded ? 0 : 1);\n\n const maximizeButton = (\n <ButtonIcon\n size=\"small\"\n type=\"tertiaryBg\"\n ref={maximizeButtonRef}\n onClick={handleMaximizeClick}\n onMouseDown={handleMaximizeMouseDown}\n onMouseUp={cancelLongPress}\n onMouseLeave={cancelLongPress}\n className={hasMenu ? styles.fullscreenButton : undefined}\n testId={isExpanded ? ActionsTestIds.CollapseButtonTestId : ActionsTestIds.ExpandButtonTestId}\n >\n {isExpanded ? <CollapseIcon /> : <ExpandIcon />}\n </ButtonIcon>\n );\n\n // Hide the tooltip during maximization changes to avoid fullscreen positioning issues.\n const maximizeWithTooltip = showMaximizeTooltip ? (\n <Tooltip title={maximizeTooltip}>{maximizeButton}</Tooltip>\n ) : (\n maximizeButton\n );\n\n return (\n <>\n <HideInNativeApp>\n {additionalActions?.map((action, index) =>\n !isActionObject(action) ? (\n <Fragment key={index}>{action}</Fragment>\n ) : (\n <Tooltip title={action.title} key={index}>\n <ButtonIcon\n size=\"small\"\n type=\"tertiary\"\n onClick={action.onClick}\n className={classNames(styles.additionalActionButton)}\n testId={ActionsTestIds.AdditionalActionItemTestId}\n >\n {action.icon}\n </ButtonIcon>\n </Tooltip>\n )\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {showComments && (\n <Tooltip title={commentsEnabled ? 'Close Comments Mode' : 'Add Comment'}>\n <ButtonIcon\n size=\"small\"\n type={commentsEnabled ? 'secondaryBg' : 'tertiaryBg'}\n onClick={toggleCommentsMode}\n className={hasMenu ? styles.commentButton : undefined}\n testId={\n commentsEnabled\n ? ActionsTestIds.CloseCommentButtonTestId\n : ActionsTestIds.AddMessageButtonTestId\n }\n >\n {commentsEnabled ? <CloseSmallIcon /> : <AddMessageCustomIcon fill=\"currentColor\" />}\n </ButtonIcon>\n </Tooltip>\n )}\n </HideInNativeApp>\n\n {settingsVisible && (\n <SettingsButton\n className={\n hideSettingsUnderMore && !isInsideNewMobileApp\n ? styles.settingsHiddenUnderMore\n : undefined\n }\n />\n )}\n\n <HideInNativeApp>\n {!isEmbedded && maximizeWithTooltip}\n\n {!isEmbedded && maximizeButtonRef.current && (\n <Menu\n anchorEl={maximizeButtonRef.current}\n open={isModesMenuOpen}\n onClose={closeModesMenu}\n placement=\"bottom-end\"\n >\n <Menu.Item onClick={toggleMaximized} testId={ActionsTestIds.MaximizeItemTestId}>\n Maximize\n </Menu.Item>\n <Menu.Item\n onClick={handleBrowserFullscreenClick}\n testId={ActionsTestIds.BrowserFullscreenItemTestId}\n >\n Full Screen\n </Menu.Item>\n <Menu.Item\n onClick={handleSeparateWindowClick}\n testId={ActionsTestIds.SeparateWindowItemTestId}\n >\n Separate Window\n </Menu.Item>\n </Menu>\n )}\n </HideInNativeApp>\n\n <HideInNativeApp>\n {hasMenu && (\n <Tooltip title=\"More\">\n <ButtonIcon\n type={\n moreMenuOpen || (hideSettingsUnderMore && isOpen) ? 'secondaryBg' : 'tertiaryBg'\n }\n className={styles.moreButton}\n ref={moreButtonRef}\n testId={ActionsTestIds.MoreButtonTestId}\n onClick={toggleMoreMenu}\n size=\"small\"\n >\n <MoreOneIcon />\n </ButtonIcon>\n </Tooltip>\n )}\n\n {hasMenu && moreButtonRef.current && (\n <Menu\n anchorEl={moreButtonRef.current}\n open={moreMenuOpen}\n onClose={toggleMoreMenu}\n placement=\"bottom-end\"\n >\n {menuActionItems.map((item, index) => (\n <Menu.Item size=\"large\" prefix={item.icon} key={index} onClick={item.onClick}>\n {item.title}\n </Menu.Item>\n ))}\n </Menu>\n )}\n </HideInNativeApp>\n </>\n );\n};\n"],"names":["isActionObject","action","_typeof","_ref","additionalActions","showComments","disableSettings","hideSettingsUnderMore","_useAppCommonsInterna","useAppCommonsInternal","maximized","setMaximized","appSettingsComponent","isExpanded","isBrowserFullscreen","enterBrowserFullscreen","exitBrowserFullscreen","isSeparateWindow","openSeparateWindow","closeSeparateWindow","dashboardMeta","isEmbedded","commentsEnabled","useAppCommentsMode","setCommentsMode","useSetAppCommentsMode","useState","_useState2","_slicedToArray","_useState","moreMenuOpen","setMoreMenuOpen","moreButtonRef","useRef","maximizeButtonRef","_useState4","_useState3","showMaximizeTooltip","setShowMaximizeTooltip","_useState6","_useState5","isModesMenuOpen","setIsModesMenuOpen","longPressTimerRef","isLongPressRef","_useAppSettingsPanel","useAppSettingsPanel","open","isOpen","settingsVisible","toggleMoreMenu","useCallback","value","toggleCommentsMode","closeModesMenu","current","toggleMaximized","maximizeTooltip","cancelLongPress","clearTimeout","handleMaximizeMouseDown","setTimeout","useEffect","handleMaximizeClick","handleSeparateWindowClick","handleBrowserFullscreenClick","menuActionItems","useMemo","isInsideNewMobileApp","getOnClick","handler","objectActions","filter","map","item","_objectSpread","onClick","commentItem","icon","_jsx","MessageIcon","title","maximizeItem","CollapseIcon","ExpandIcon","settingsItem","SettingTwoIcon","_toConsumableArray","hasMenu","length","maximizeButton","jsx","ButtonIcon","size","type","ref","onMouseDown","onMouseUp","onMouseLeave","className","styles","fullscreenButton","undefined","testId","ActionsTestIds","CollapseButtonTestId","ExpandButtonTestId","children","maximizeWithTooltip","Tooltip","_jsxs","_Fragment","HideInNativeApp","index","classNames","additionalActionButton","AdditionalActionItemTestId","Fragment","commentButton","CloseCommentButtonTestId","AddMessageButtonTestId","CloseSmallIcon","AddMessageCustomIcon","fill","SettingsButton","settingsHiddenUnderMore","Menu","anchorEl","onClose","placement","Item","MaximizeItemTestId","BrowserFullscreenItemTestId","SeparateWindowItemTestId","moreButton","MoreButtonTestId","MoreOneIcon","prefix"],"mappings":"6uPAmCA,IAAMA,EAAiB,SAACC,GAAwB,QAC5CA,GAA4B,WAAlBC,EAAA,QAAOD,IAAuB,UAAWA,CAAM,kBAItC,SAKHE,GAAA,IAJlBC,IAAAA,kBACAC,IAAAA,aACAC,IAAAA,gBACAC,IAAAA,sBAEAC,EAYIC,EAAAA,wBAXFC,IAAAA,UACAC,IAAAA,aACAC,IAAAA,qBACAC,IAAAA,WACAC,IAAAA,oBACAC,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,QACxBR,KAAMjB,EACNkG,QAAS9E,GACT+E,UAAU,aAAYtB,SAErBzC,GAAgBO,KAAI,SAACC,EAAMuC,GAAK,OAC/BlC,EAAAY,IAACmC,EAAIA,KAACI,KAAI,CAACrC,KAAK,QAAQ4C,OAAQ/D,EAAKI,KAAkBF,QAASF,EAAKE,QAAQ+B,SAC1EjC,EAAKO,OADwCgC,aAS9D"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),s=require("classnames"),i=require("lodash"),l=require("../../../constants/segment.js"),n=require("../../../utils/devcenter.js"),o=require("../../PadModeSelect/PadModeSelect.js");require("../../PadModeSelect/PadModeSelect.constants.js");var r=require("../AppHeader.constants.js");require("../../AppCommonsProvider/AppCommonsProvider.js");var d=require("../../AppCommonsProvider/AppCommonsContext.js"),a=require("../../HideInNativeApp/index.js"),u=require("../../utils.js"),p=require("./VersionSelect/VersionSelect.js"),c=require("./AssetChips/AssetChips.js"),v=require("./AppTitle/AppTitle.js");require("./AppTitle/AppTitle.constants.js");var f=require("./useResponsivity.js"),j=require("./Actions/Actions.js");require("./Actions/Actions.constants.js");var m=require("./AppHeaderV3.scss.js"),A=require("react/jsx-runtime");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=C(e),y=C(s);function b(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function g(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?b(Object(s),!0).forEach((function(t){h.default(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):b(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}exports.AppHeaderV3=function(e){var s,C,h,b,q,I,x,S,P,M,N,O,R,L,w,T,H=e.elementsClassNames,E=e.className,D=e.testId,U=e.logo,V=e.additionalControls,W=e.title,k=e.padModeDisabled,B=e.padModeWells,F=e.dqData,_=e.asset,G=e.lastUpdate,z=e.additionalActions,J=e.showComments,K=e.titleControls,Q=e.disableSettings,X=e.showAssetChips,Y=e.disableAssetSelector,Z=e.titleMenuActions,$=e.titleControlsPosition,ee=void 0===$?"right":$,te=e.responsivenessConfig,se=t.useRef(null),ie=d.useAppCommonsInternal(),le=ie.app,ne=ie.appName,oe=ie.well,re=ie.wells,de=ie.rig,ae=ie.fracFleet,ue=ie.interventionUnit,pe=ie.isExpanded,ce=ie.setSeparateWindowTitle,ve=ie.isInsideNewMobileApp,fe=ie.disableAppAssetSelection,je=ie.isMultiRig,me=B||re,Ae=n.getAppSegment(le)===l.SEGMENTS.COMPLETION&&!oe,Ce=!i.isEmpty(me)&&!!ae,he=fe||je,ye=!fe&&!k&&!ve&&Ae&&Ce,be=U?"ultranarrow":ye||V||K?"narrow":void 0,ge="left"===ee&&!!K,qe=t.useRef(null),Ie=t.useRef(null),xe=t.useRef(null),Se=t.useRef(null),Pe=t.useRef(null),Me=t.useRef(null),Ne=t.useRef(null),Oe=null!==(s=null!==(C=null!==(h=null==oe?void 0:oe.name)&&void 0!==h?h:null==de?void 0:de.name)&&void 0!==C?C:null==ae?void 0:ae.name)&&void 0!==s?s:null==ue?void 0:ue.name;t.useEffect((function(){null==ce||ce([ne,Oe].filter(Boolean).join(" - "))}),[ce,ne,Oe]);var Re=f.useResponsivity({disabled:ve,titleControlsLeft:ge,rootRef:se,versionRef:qe,additionalControlsRef:xe,titleControlsRef:Se,logoRef:Me,padModeRef:Ie,chipsRef:Pe,actionsRef:Ne});return A.jsxs("div",g(g({className:y.default(m.root,E),"data-testid":D,ref:se,style:null===(b=Re.root)||void 0===b?void 0:b.style},u.AppHeaderFinderProps),{},{children:[A.jsx("div",{className:y.default(m.logoContainer,null==H?void 0:H.logoContainer),ref:Me,children:U&&"string"==typeof U?A.jsx("img",{className:m.logo,src:U,alt:"Logo"}):U}),A.jsx(v.AppTitle,{title:pe&&null!=Oe?Oe:W,asset:_,dqData:F,lastUpdate:G,className:y.default(m.title,ge&&m.titleWithControlsLeft,null==H?void 0:H.title),disableAssetSelector:Y,titleMenuActions:Z,style:null===(q=Re.title)||void 0===q?void 0:q.style}),K&&A.jsx("div",{className:y.default(m.titleControls,ge&&m.titleControlsLeft,(null===(I=Re.titleControls)||void 0===I?void 0:I.lastInLine)&&m.lastInLine,null==H?void 0:H.titleControls),ref:Se,style:null===(x=Re.titleControls)||void 0===x?void 0:x.style,children:K}),A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:m.version,ref:qe,children:A.jsx(p.VersionSelect,{className:null==H?void 0:H.versionSelect})})}),ye&&A.jsx("div",{className:y.default(m.padMode,(null===(S=Re.padMode)||void 0===S?void 0:S.lastInLine)&&m.lastInLine),ref:Ie,style:null===(P=Re.padMode)||void 0===P?void 0:P.style,children:A.jsx(o.PadModeSelect,{testId:r.AppHeaderTestIds.PadModeSelectTestId})}),V&&A.jsx("div",{className:y.default(m.additionalControls,(null===(M=Re.additionalControls)||void 0===M?void 0:M.lastInLine)&&m.lastInLine,null==H?void 0:H.additionalControls),ref:xe,style:null===(N=Re.additionalControls)||void 0===N?void 0:N.style,"data-testid":r.AppHeaderTestIds.AdditionalControlsTestId,children:V}),!he&&X&&A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:y.default(m.assetChips,(null===(O=Re.chips)||void 0===O?void 0:O.lastInLine)&&m.lastInLine,null==H?void 0:H.chips),ref:Pe,style:null===(R=Re.chips)||void 0===R?void 0:R.style,children:A.jsx(c.AssetChips,{chipsWidth:be})})}),A.jsx("div",{className:y.default(m.actions,(null===(L=Re.actions)||void 0===L?void 0:L.lastInLine)&&m.lastInLine,null==H?void 0:H.actions),ref:Ne,style:null===(w=Re.actions)||void 0===w?void 0:w.style,"data-testid":r.AppHeaderTestIds.ActionsRootTestId,children:A.jsx(j.Actions,{additionalActions:z,showComments:J,disableSettings:Q,hideSettingsUnderMore:null==te?void 0:te.hideSettingsUnderMore})}),null===(T=Re.linebreaks)||void 0===T?void 0:T.map((function(e,t){return A.jsx("div",{className:m.responsivenessLineBreak,style:e},t)}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),s=require("classnames"),i=require("lodash"),l=require("../../../constants/segment.js"),n=require("../../../utils/devcenter.js"),o=require("../../PadModeSelect/PadModeSelect.js");require("../../PadModeSelect/PadModeSelect.constants.js");var r=require("../AppHeader.constants.js");require("../../AppCommonsProvider/AppCommonsProvider.js");var d=require("../../AppCommonsProvider/AppCommonsContext.js"),a=require("../../HideInNativeApp/index.js"),u=require("../../utils.js"),c=require("./VersionSelect/VersionSelect.js"),p=require("./AssetChips/AssetChips.js"),v=require("./AppTitle/AppTitle.js");require("./AppTitle/AppTitle.constants.js");var f=require("./useResponsivity.js"),j=require("./Actions/Actions.js");require("./Actions/Actions.constants.js");var m=require("./AppHeaderV3.scss.js"),A=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=h(e),y=h(s);function b(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function g(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?b(Object(s),!0).forEach((function(t){C.default(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):b(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}exports.AppHeaderV3=function(e){var s,h,C,b,q,x,I,S,M,P,N,O,R,L,w,T,H=e.elementsClassNames,E=e.className,D=e.testId,U=e.logo,V=e.additionalControls,W=e.title,k=e.padModeDisabled,F=e.padModeWells,B=e.dqData,_=e.asset,G=e.lastUpdate,z=e.additionalActions,J=e.showComments,K=e.titleControls,Q=e.disableSettings,X=e.showAssetChips,Y=e.disableAssetSelector,Z=e.titleMenuActions,$=e.titleControlsPosition,ee=void 0===$?"right":$,te=e.responsivenessConfig,se=t.useRef(null),ie=d.useAppCommonsInternal(),le=ie.app,ne=ie.appName,oe=ie.well,re=ie.wells,de=ie.rig,ae=ie.fracFleet,ue=ie.interventionUnit,ce=ie.isExpanded,pe=ie.setSeparateWindowTitle,ve=ie.isInsideNewMobileApp,fe=ie.disableAppAssetSelection,je=ie.isMultiRig,me=ie.dashboardMeta,Ae=!(null==me||!me.isEmbedded),he=F||re,Ce=n.getAppSegment(le)===l.SEGMENTS.COMPLETION&&!oe,ye=!i.isEmpty(he)&&!!ae,be=fe||je,ge=!(Ae||fe||k||ve)&&Ce&&ye,qe=U?"ultranarrow":ge||V||K?"narrow":void 0,xe="left"===ee&&!!K,Ie=t.useRef(null),Se=t.useRef(null),Me=t.useRef(null),Pe=t.useRef(null),Ne=t.useRef(null),Oe=t.useRef(null),Re=t.useRef(null),Le=null!==(s=null!==(h=null!==(C=null==oe?void 0:oe.name)&&void 0!==C?C:null==de?void 0:de.name)&&void 0!==h?h:null==ae?void 0:ae.name)&&void 0!==s?s:null==ue?void 0:ue.name;t.useEffect((function(){null==pe||pe([ne,Le].filter(Boolean).join(" - "))}),[pe,ne,Le]);var we=f.useResponsivity({disabled:ve||Ae,titleControlsLeft:xe,rootRef:se,versionRef:Ie,additionalControlsRef:Me,titleControlsRef:Pe,logoRef:Oe,padModeRef:Se,chipsRef:Ne,actionsRef:Re});return A.jsxs("div",g(g({className:y.default(m.root,Ae&&m.embedded,E),"data-testid":D,ref:se,style:null===(b=we.root)||void 0===b?void 0:b.style},u.AppHeaderFinderProps),{},{children:[!Ae&&A.jsxs(A.Fragment,{children:[A.jsx("div",{className:y.default(m.logoContainer,null==H?void 0:H.logoContainer),ref:Oe,children:U&&"string"==typeof U?A.jsx("img",{className:m.logo,src:U,alt:"Logo"}):U}),A.jsx(v.AppTitle,{title:ce&&null!=Le?Le:W,asset:_,dqData:B,lastUpdate:G,className:y.default(m.title,xe&&m.titleWithControlsLeft,null==H?void 0:H.title),disableAssetSelector:Y,titleMenuActions:Z,style:null===(q=we.title)||void 0===q?void 0:q.style})]}),K&&A.jsx("div",{className:y.default(m.titleControls,xe&&m.titleControlsLeft,(null===(x=we.titleControls)||void 0===x?void 0:x.lastInLine)&&m.lastInLine,null==H?void 0:H.titleControls),ref:Pe,style:null===(I=we.titleControls)||void 0===I?void 0:I.style,children:K}),A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:m.version,ref:Ie,children:A.jsx(c.VersionSelect,{className:null==H?void 0:H.versionSelect})})}),ge&&A.jsx("div",{className:y.default(m.padMode,(null===(S=we.padMode)||void 0===S?void 0:S.lastInLine)&&m.lastInLine),ref:Se,style:null===(M=we.padMode)||void 0===M?void 0:M.style,children:A.jsx(o.PadModeSelect,{testId:r.AppHeaderTestIds.PadModeSelectTestId})}),V&&A.jsx("div",{className:y.default(m.additionalControls,(null===(P=we.additionalControls)||void 0===P?void 0:P.lastInLine)&&m.lastInLine,null==H?void 0:H.additionalControls),ref:Me,style:null===(N=we.additionalControls)||void 0===N?void 0:N.style,"data-testid":r.AppHeaderTestIds.AdditionalControlsTestId,children:V}),!Ae&&!be&&X&&A.jsx(a.HideInNativeApp,{children:A.jsx("div",{className:y.default(m.assetChips,(null===(O=we.chips)||void 0===O?void 0:O.lastInLine)&&m.lastInLine,null==H?void 0:H.chips),ref:Ne,style:null===(R=we.chips)||void 0===R?void 0:R.style,children:A.jsx(p.AssetChips,{chipsWidth:qe})})}),A.jsx("div",{className:y.default(m.actions,(null===(L=we.actions)||void 0===L?void 0:L.lastInLine)&&m.lastInLine,null==H?void 0:H.actions),ref:Re,style:null===(w=we.actions)||void 0===w?void 0:w.style,"data-testid":r.AppHeaderTestIds.ActionsRootTestId,children:A.jsx(j.Actions,{additionalActions:z,showComments:J,disableSettings:Q,hideSettingsUnderMore:null==te?void 0:te.hideSettingsUnderMore})}),null===(T=we.linebreaks)||void 0===T?void 0:T.map((function(e,t){return A.jsx("div",{className:m.responsivenessLineBreak,style:e},t)}))]}))};
2
2
  //# sourceMappingURL=AppHeaderV3.js.map