@jpmorganchase/mosaic-content-editor-plugin 0.1.0-beta.64 → 0.1.0-beta.65
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.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +13 -0
- package/dist/chunk-3LGZ7Z7G.js +1 -0
- package/dist/chunk-LQBKKB6A.js +1 -0
- package/dist/{chunk-4JNXV7AM.js → chunk-WOLMNJ7G.js} +1 -1
- package/dist/components/Editor.js +1 -1
- package/dist/components/PersistEditDialog/index.js +1 -1
- package/dist/hooks/useWorkflowFeed.d.ts +5 -1
- package/dist/hooks/useWorkflowFeed.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/PreviewPlugin.js +1 -1
- package/package.json +3 -3
- package/src/components/PersistEditDialog/index.tsx +1 -0
- package/src/hooks/useWorkflowFeed.ts +43 -30
- package/dist/chunk-GNXBZEEO.js +0 -1
- package/dist/chunk-PIYHEBW7.js +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@jpmorganchase/mosaic-content-editor-plugin:build: cache hit, replaying output
|
|
1
|
+
@jpmorganchase/mosaic-content-editor-plugin:build: cache hit, replaying output c9ebbddd5672f9f8
|
|
2
2
|
@jpmorganchase/mosaic-content-editor-plugin:build: $ npm-run-all --parallel build:*
|
|
3
|
-
@jpmorganchase/mosaic-content-editor-plugin:build: $ tsc
|
|
4
3
|
@jpmorganchase/mosaic-content-editor-plugin:build: $ node ../../scripts/bundle.js
|
|
4
|
+
@jpmorganchase/mosaic-content-editor-plugin:build: $ tsc
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @jpmorganchase/mosaic-content-editor-plugin
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.65
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- abe4f6c8: Fix: Content Editor Websocket
|
|
8
|
+
|
|
9
|
+
Reduce the risk of the websocket connection from closing due to editing/reviewing for a long period.
|
|
10
|
+
|
|
11
|
+
The websocket connection is now established when the _save_ button is clicked rather than the _edit_ button.
|
|
12
|
+
|
|
13
|
+
- @jpmorganchase/mosaic-components@0.1.0-beta.65
|
|
14
|
+
- @jpmorganchase/mosaic-theme@0.1.0-beta.65
|
|
15
|
+
|
|
3
16
|
## 0.1.0-beta.64
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as g,useRef as a}from"react";var u=process.env.NEXT_PUBLIC_MOSAIC_WORKFLOWS_URL||"";function E(n,t,l,f){let e=a(),r=a();return g(function(){try{n&&(e.current=new WebSocket(u),e.current.onopen=()=>console.log(`Workflows websocket open: ${u}`),e.current.onclose=()=>console.log("Workflows websocket closed"),e.current.onmessage=s=>{let o=JSON.parse(s.data);o.channel===r.current&&(o.status==="ERROR"&&t(o),o.status==="COMPLETE"&&f(o),(o.status==="IN_PROGRESS"||o.status==="SUCCESS")&&l(o))})}catch(s){t(s)}return()=>{e.current&&e.current?.OPEN&&(r.current=null,e.current.close())}},[n]),{sendWorkflowProgressMessage:(c,s)=>{e.current?.OPEN&&(r.current=s,e.current?.send(c))}}}export{E as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k}from"./chunk-VDGHHU3F.js";import{a as y}from"./chunk-R2MEEU32.js";import{a as P}from"./chunk-M4ISRNFD.js";import{a as b}from"./chunk-3LGZ7Z7G.js";import{a as D}from"./chunk-XSZUCLBY.js";import{c as C,d as S}from"./chunk-G57W376H.js";import e,{useState as g}from"react";import F from"md5";import{useLexicalComposerContext as G}from"@lexical/react/LexicalComposerContext";import{$convertToMarkdownString as O}from"@lexical/markdown";import{Link as $,P2 as w,Button as v}from"@jpmorganchase/mosaic-components";import{ButtonBar as J,DialogTitle as U,DialogContent as V,DialogActions as _}from"@salt-ds/lab";var j=({isRaising:f,prHref:l,error:c})=>!f&&!l&&!c?e.createElement(e.Fragment,null,e.createElement(w,null,"The content of this page resides in a Git repository and to update it requires a Pull Request which will be reviewed by the content owners."),e.createElement("br",null),e.createElement(w,null,"Should you decide to stop editing before creating the Pull Request then all changes will be lost.")):null,le=({meta:f,persistUrl:l})=>{let{pageState:c,setPageState:B}=C(),{user:p}=S(),[q]=G(),[s,t]=g(!1),[r,n]=g(null),[i,m]=g(null),[E,a]=g([]),d=c==="SAVING",I=r!==null?"success":"info",h=o=>{t(o),o||(B("EDIT"),n(null),a([]))},M=()=>{h(!1)},x=o=>{m(o||"Sorry - an unexpected error has occurred"),n(null),a([]),t(!1)},T=o=>{n(o.message?.links?.self[0]?.href),t(!1)},A=o=>{a(u=>[...u,o])},{sendWorkflowProgressMessage:H}=b(d,x,A,T),L=()=>{t(!0),n(null),m(null);try{q.update(()=>{let o=O(P);if(o&&p&&l){let{sid:u,displayName:N,email:W}=p;H(JSON.stringify({user:{sid:u,name:N,email:W},route:f.route,markdown:o,name:"save"}),F(`${u.toLowerCase()} - save`))}})}catch{m("Sorry - an unexpected error has occurred"),n(null),t(!1),a([])}};return e.createElement(D,{onOpenChange:h,open:d,status:i?"error":I},e.createElement(U,{className:y.title},r?"Pull Request Created Successfully":"Save Changes"),e.createElement(V,null,(s||i)&&!r&&e.createElement(k,{error:i,progress:E}),e.createElement(j,{isRaising:s,prHref:r,error:i}),!s&&r&&e.createElement($,{href:r,target:"_blank"},"A Pull Request for your changes has been created")),e.createElement(_,null,e.createElement(J,null,e.createElement(v,{disabled:s,onClick:M},r?"Done":"Cancel"),e.createElement(v,{disabled:l===void 0||s||r!==null,onClick:L,variant:"cta"},"Raise Pull Request"))))};export{le as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-CBQZGN4Y.js";import{a as y}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-CBQZGN4Y.js";import{a as y}from"./chunk-LQBKKB6A.js";import{a as f}from"./chunk-UWF3FV3R.js";import{a as x}from"./chunk-HKW725NN.js";import{a}from"./chunk-M4ISRNFD.js";import{b as w}from"./chunk-YBFKG74H.js";import{a as M}from"./chunk-ROQUYURQ.js";import{a as h}from"./chunk-3FJGHVH5.js";import{a as k}from"./chunk-QKOQTH4L.js";import{a as P}from"./chunk-RO6ARCLZ.js";import{a as b}from"./chunk-7O2SLISS.js";import{b as S}from"./chunk-EPOQVSZ5.js";import{a as T}from"./chunk-FKL4ZGDB.js";import{a as g}from"./chunk-PXUVNH4P.js";import{a as n}from"./chunk-NXV7KCC5.js";import{a as C,d as v,f as l}from"./chunk-G57W376H.js";import R from"react";import{$convertToMarkdownString as oo}from"@lexical/markdown";import{OnChangePlugin as ro}from"@lexical/react/LexicalOnChangePlugin";import{debounce as to}from"lodash-es";import o,{useRef as B,useState as D}from"react";import H from"clsx";import j from"gray-matter";import{LexicalComposer as A}from"@lexical/react/LexicalComposer";import{ListPlugin as I}from"@lexical/react/LexicalListPlugin";import{TablePlugin as J}from"@lexical/react/LexicalTablePlugin";import{LinkPlugin as W}from"@lexical/react/LexicalLinkPlugin";import{HistoryPlugin as X}from"@lexical/react/LexicalHistoryPlugin";import{MarkdownShortcutPlugin as q}from"@lexical/react/LexicalMarkdownShortcutPlugin";import G from"react-split";import{$convertFromMarkdownString as K}from"@lexical/markdown";function Q(r){console.error(r)}var V={namespace:"mosaic-content-editor",onError:Q,nodes:P,theme:h},Y=()=>{let r=document.createElement("div");return r.className=n.gutter,r},Z=({components:r,content:e,persistUrl:m,PreviewComponent:i,previewUrl:s,source:p,user:t})=>{let L=C()||p,{setUser:N}=v(),[c,u]=D(!1),U=B(null),{data:d,content:z}=j(e),$=()=>{u(!0),N(t)},O=()=>{u(!1)};return o.createElement(A,{initialConfig:{...V,editorState:()=>K(z,a)}},o.createElement("div",{className:n.root,onFocus:$,onBlur:O},o.createElement("div",{className:n.toolbarContainer},o.createElement(E,null),o.createElement(y,{meta:d,persistUrl:m}),o.createElement(k,null)),o.createElement("div",{className:n.editorRoot},o.createElement(G,{className:n.splitter,cursor:"col-resize",direction:"horizontal",dragInterval:1,expandToMin:!1,gutter:Y,gutterAlign:"center",minSize:100,sizes:[50,50],snapOffset:30},o.createElement(f,{className:H({[n.focused]:c,[n.unfocused]:!c}),ref:U},o.createElement(g,null)),o.createElement(f,null,i&&o.createElement(i,{source:L,meta:d,components:r}))),o.createElement(X,null),o.createElement(I,null),o.createElement(J,null),o.createElement(W,null),o.createElement(q,{transformers:a}),s?o.createElement(F,{previewUrl:s}):null,o.createElement(w,null),o.createElement(S,null),o.createElement(x,null),o.createElement(T,null),o.createElement(b,null),o.createElement(M,null))))},_=Z;async function eo(r,e){return await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"markdown",text:e})})).json()}function no(r){let e=to(r,250,{maxWait:500});return{onChange:i=>{i.read(()=>{let s=oo(a);s&&e(s)})}}}var F=({previewUrl:r})=>{let{setErrorMessage:e,setPreviewContent:m}=l(),i=async p=>{try{if(p){let t=await eo(r,p);!t.error&&t?.source?m(t.source):e(`${t.error?.toUpperCase()}: ${t?.exception}`)}}catch(t){t instanceof Error&&e(`MDX Error: ${t.message}`)}},{onChange:s}=no(i);return R.createElement(ro,{onChange:s,ignoreSelectionChange:!0})};export{F as a,_ as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"../chunk-
|
|
1
|
+
import{b as a}from"../chunk-WOLMNJ7G.js";import"../chunk-CBQZGN4Y.js";import"../chunk-4B2NDAA2.js";import"../chunk-4LQ77YZW.js";import"../chunk-DLRFTDUZ.js";import"../chunk-CXTIKD2Y.js";import"../chunk-KZXCNQER.js";import"../chunk-DXTVYP7D.js";import"../chunk-NFA3MZOC.js";import"../chunk-LQBKKB6A.js";import"../chunk-VDGHHU3F.js";import"../chunk-R2MEEU32.js";import"../chunk-UWF3FV3R.js";import"../chunk-KQ2ZCDYD.js";import"../chunk-HKW725NN.js";import"../chunk-BFF3MNBV.js";import"../chunk-5YCBSSDA.js";import"../chunk-NFSXCTUU.js";import"../chunk-6TM3EYFS.js";import"../chunk-M4ISRNFD.js";import"../chunk-ESJNOEFD.js";import"../chunk-WNTJMWYJ.js";import"../chunk-RT5CJ7T5.js";import"../chunk-G4LBXKDE.js";import"../chunk-YBFKG74H.js";import"../chunk-ROQUYURQ.js";import"../chunk-ESKW4XF6.js";import"../chunk-6YPAVQF4.js";import"../chunk-3FJGHVH5.js";import"../chunk-JQUDHJIQ.js";import"../chunk-PC66Q33O.js";import"../chunk-QKOQTH4L.js";import"../chunk-FW7CHFWO.js";import"../chunk-3LGZ7Z7G.js";import"../chunk-RO6ARCLZ.js";import"../chunk-7O2SLISS.js";import"../chunk-5KRV6UWE.js";import"../chunk-SOMQOHNT.js";import"../chunk-U7COOUR6.js";import"../chunk-EPOQVSZ5.js";import"../chunk-WZYDYWT3.js";import"../chunk-YIFLQ5MW.js";import"../chunk-XP37MJCS.js";import"../chunk-P5OBPOC4.js";import"../chunk-TSWYSURQ.js";import"../chunk-FKL4ZGDB.js";import"../chunk-PXUVNH4P.js";import"../chunk-XSZUCLBY.js";import"../chunk-OW5SK4AJ.js";import"../chunk-NXV7KCC5.js";import"../chunk-ZHZ4E2MI.js";import"../chunk-7JRJTNUG.js";import"../chunk-GYUEXLD6.js";import"../chunk-FH2LMMJT.js";import"../chunk-7LK4O57W.js";import"../chunk-3QIETKQW.js";import"../chunk-Y2A2ULLZ.js";import"../chunk-G57W376H.js";import"../chunk-6X665P47.js";export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-LQBKKB6A.js";import"../../chunk-VDGHHU3F.js";import"../../chunk-R2MEEU32.js";import"../../chunk-6TM3EYFS.js";import"../../chunk-M4ISRNFD.js";import"../../chunk-ESJNOEFD.js";import"../../chunk-WNTJMWYJ.js";import"../../chunk-RT5CJ7T5.js";import"../../chunk-3LGZ7Z7G.js";import"../../chunk-XSZUCLBY.js";import"../../chunk-OW5SK4AJ.js";import"../../chunk-G57W376H.js";export{a as PersistDialog};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SourceWorkflowMessageEvent } from '@jpmorganchase/mosaic-types';
|
|
2
|
+
declare type SourceWorkflowMessageEventHandler = (message: SourceWorkflowMessageEvent) => void;
|
|
3
|
+
declare type SourceWorkflowMessageEventExceptionHandler = (errorMessage: any) => void;
|
|
4
|
+
export default function useDataFeed(connect: boolean, onError: SourceWorkflowMessageEventExceptionHandler, onSuccess: SourceWorkflowMessageEventHandler, onComplete: SourceWorkflowMessageEventHandler): {
|
|
2
5
|
sendWorkflowProgressMessage: (message: any, channel: any) => void;
|
|
3
6
|
};
|
|
7
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-3LGZ7Z7G.js";export{a as default};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"./chunk-
|
|
1
|
+
import{b as c}from"./chunk-WOLMNJ7G.js";import"./chunk-CBQZGN4Y.js";import"./chunk-4B2NDAA2.js";import"./chunk-4LQ77YZW.js";import"./chunk-DLRFTDUZ.js";import"./chunk-CXTIKD2Y.js";import"./chunk-KZXCNQER.js";import"./chunk-DXTVYP7D.js";import"./chunk-NFA3MZOC.js";import"./chunk-LQBKKB6A.js";import"./chunk-VDGHHU3F.js";import"./chunk-R2MEEU32.js";import"./chunk-UWF3FV3R.js";import"./chunk-KQ2ZCDYD.js";import"./chunk-HKW725NN.js";import"./chunk-BFF3MNBV.js";import"./chunk-5YCBSSDA.js";import"./chunk-NFSXCTUU.js";import"./chunk-6TM3EYFS.js";import"./chunk-M4ISRNFD.js";import"./chunk-ESJNOEFD.js";import"./chunk-WNTJMWYJ.js";import"./chunk-RT5CJ7T5.js";import"./chunk-G4LBXKDE.js";import"./chunk-YBFKG74H.js";import"./chunk-ROQUYURQ.js";import"./chunk-ESKW4XF6.js";import"./chunk-6YPAVQF4.js";import"./chunk-3FJGHVH5.js";import"./chunk-JQUDHJIQ.js";import"./chunk-PC66Q33O.js";import"./chunk-QKOQTH4L.js";import"./chunk-FW7CHFWO.js";import"./chunk-3LGZ7Z7G.js";import"./chunk-RO6ARCLZ.js";import"./chunk-7O2SLISS.js";import"./chunk-5KRV6UWE.js";import"./chunk-SOMQOHNT.js";import"./chunk-U7COOUR6.js";import"./chunk-EPOQVSZ5.js";import"./chunk-WZYDYWT3.js";import"./chunk-YIFLQ5MW.js";import"./chunk-XP37MJCS.js";import"./chunk-P5OBPOC4.js";import"./chunk-TSWYSURQ.js";import"./chunk-FKL4ZGDB.js";import"./chunk-PXUVNH4P.js";import"./chunk-XSZUCLBY.js";import"./chunk-OW5SK4AJ.js";import"./chunk-NXV7KCC5.js";import{a as d}from"./chunk-ZHZ4E2MI.js";import"./chunk-7JRJTNUG.js";import"./chunk-GYUEXLD6.js";import"./chunk-FH2LMMJT.js";import"./chunk-7LK4O57W.js";import"./chunk-3QIETKQW.js";import"./chunk-Y2A2ULLZ.js";import{c as a,f as b}from"./chunk-G57W376H.js";import"./chunk-6X665P47.js";export{c as Editor,d as EditorControls,b as useContentEditor,a as usePageState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-WOLMNJ7G.js";import"../chunk-CBQZGN4Y.js";import"../chunk-4B2NDAA2.js";import"../chunk-4LQ77YZW.js";import"../chunk-DLRFTDUZ.js";import"../chunk-CXTIKD2Y.js";import"../chunk-KZXCNQER.js";import"../chunk-DXTVYP7D.js";import"../chunk-NFA3MZOC.js";import"../chunk-LQBKKB6A.js";import"../chunk-VDGHHU3F.js";import"../chunk-R2MEEU32.js";import"../chunk-UWF3FV3R.js";import"../chunk-KQ2ZCDYD.js";import"../chunk-HKW725NN.js";import"../chunk-BFF3MNBV.js";import"../chunk-5YCBSSDA.js";import"../chunk-NFSXCTUU.js";import"../chunk-6TM3EYFS.js";import"../chunk-M4ISRNFD.js";import"../chunk-ESJNOEFD.js";import"../chunk-WNTJMWYJ.js";import"../chunk-RT5CJ7T5.js";import"../chunk-G4LBXKDE.js";import"../chunk-YBFKG74H.js";import"../chunk-ROQUYURQ.js";import"../chunk-ESKW4XF6.js";import"../chunk-6YPAVQF4.js";import"../chunk-3FJGHVH5.js";import"../chunk-JQUDHJIQ.js";import"../chunk-PC66Q33O.js";import"../chunk-QKOQTH4L.js";import"../chunk-FW7CHFWO.js";import"../chunk-3LGZ7Z7G.js";import"../chunk-RO6ARCLZ.js";import"../chunk-7O2SLISS.js";import"../chunk-5KRV6UWE.js";import"../chunk-SOMQOHNT.js";import"../chunk-U7COOUR6.js";import"../chunk-EPOQVSZ5.js";import"../chunk-WZYDYWT3.js";import"../chunk-YIFLQ5MW.js";import"../chunk-XP37MJCS.js";import"../chunk-P5OBPOC4.js";import"../chunk-TSWYSURQ.js";import"../chunk-FKL4ZGDB.js";import"../chunk-PXUVNH4P.js";import"../chunk-XSZUCLBY.js";import"../chunk-OW5SK4AJ.js";import"../chunk-NXV7KCC5.js";import"../chunk-ZHZ4E2MI.js";import"../chunk-7JRJTNUG.js";import"../chunk-GYUEXLD6.js";import"../chunk-FH2LMMJT.js";import"../chunk-7LK4O57W.js";import"../chunk-3QIETKQW.js";import"../chunk-Y2A2ULLZ.js";import"../chunk-G57W376H.js";import"../chunk-6X665P47.js";export{a as PreviewPlugin};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-content-editor-plugin",
|
|
3
3
|
"description": "Mosaic - In Browser content editing plugin",
|
|
4
|
-
"version": "0.1.0-beta.
|
|
4
|
+
"version": "0.1.0-beta.65",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "",
|
|
7
7
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"typescript": "^4.8.3"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@jpmorganchase/mosaic-components": "^0.1.0-beta.
|
|
42
|
-
"@jpmorganchase/mosaic-theme": "^0.1.0-beta.
|
|
41
|
+
"@jpmorganchase/mosaic-components": "^0.1.0-beta.65",
|
|
42
|
+
"@jpmorganchase/mosaic-theme": "^0.1.0-beta.65",
|
|
43
43
|
"@salt-ds/core": "^1.15.0",
|
|
44
44
|
"@salt-ds/icons": "^1.9.1",
|
|
45
45
|
"@salt-ds/lab": "1.0.0-alpha.28",
|
|
@@ -3,45 +3,58 @@ import type { SourceWorkflowMessageEvent } from '@jpmorganchase/mosaic-types';
|
|
|
3
3
|
|
|
4
4
|
const ENDPOINT = process.env.NEXT_PUBLIC_MOSAIC_WORKFLOWS_URL || '';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type SourceWorkflowMessageEventHandler = (message: SourceWorkflowMessageEvent) => void;
|
|
7
|
+
type SourceWorkflowMessageEventExceptionHandler = (errorMessage: any) => void;
|
|
8
|
+
|
|
9
|
+
export default function useDataFeed(
|
|
10
|
+
connect: boolean,
|
|
11
|
+
onError: SourceWorkflowMessageEventExceptionHandler,
|
|
12
|
+
onSuccess: SourceWorkflowMessageEventHandler,
|
|
13
|
+
onComplete: SourceWorkflowMessageEventHandler
|
|
14
|
+
) {
|
|
7
15
|
const webSocketRef = useRef<WebSocket>();
|
|
8
16
|
const channelRef = useRef<string | null>();
|
|
9
17
|
|
|
10
|
-
useEffect(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
useEffect(
|
|
19
|
+
function subscribe() {
|
|
20
|
+
try {
|
|
21
|
+
if (connect) {
|
|
22
|
+
webSocketRef.current = new WebSocket(ENDPOINT);
|
|
23
|
+
webSocketRef.current.onopen = () => console.log(`Workflows websocket open: ${ENDPOINT}`);
|
|
24
|
+
webSocketRef.current.onclose = () => console.log('Workflows websocket closed');
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
webSocketRef.current.onmessage = (msg: MessageEvent) => {
|
|
27
|
+
const message: SourceWorkflowMessageEvent = JSON.parse(msg.data);
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
if (message.channel !== channelRef.current) {
|
|
30
|
+
// message is not for us;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
if (message.status === 'ERROR') {
|
|
35
|
+
onError(message);
|
|
36
|
+
}
|
|
37
|
+
if (message.status === 'COMPLETE') {
|
|
38
|
+
onComplete(message);
|
|
39
|
+
}
|
|
40
|
+
if (message.status === 'IN_PROGRESS' || message.status === 'SUCCESS') {
|
|
41
|
+
onSuccess(message);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
26
44
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
} catch (ex) {
|
|
46
|
+
onError(ex);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
if (webSocketRef.current && webSocketRef.current?.OPEN) {
|
|
51
|
+
channelRef.current = null;
|
|
52
|
+
webSocketRef.current.close();
|
|
32
53
|
}
|
|
33
54
|
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return () => {
|
|
39
|
-
if (webSocketRef.current && webSocketRef.current?.OPEN) {
|
|
40
|
-
channelRef.current = null;
|
|
41
|
-
webSocketRef.current.close();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
55
|
+
},
|
|
56
|
+
[connect]
|
|
57
|
+
);
|
|
45
58
|
|
|
46
59
|
const sendWorkflowProgressMessage = (message, channel) => {
|
|
47
60
|
if (webSocketRef.current?.OPEN) {
|
package/dist/chunk-GNXBZEEO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useEffect as l,useRef as c}from"react";var u=process.env.NEXT_PUBLIC_MOSAIC_WORKFLOWS_URL||"";function g(o,a,f){let e=c(),t=c();return l(function(){try{e.current=new WebSocket(u),e.current.onopen=()=>console.log(`Workflows websocket open: ${u}`),e.current.onclose=()=>console.log("Workflows websocket closed"),e.current.onmessage=r=>{let s=JSON.parse(r.data);s.channel===t.current&&(s.status==="ERROR"&&o(s),s.status==="COMPLETE"&&f(s),(s.status==="IN_PROGRESS"||s.status==="SUCCESS")&&a(s))}}catch(r){o(r)}return()=>{e.current&&e.current?.OPEN&&(t.current=null,e.current.close())}},[]),{sendWorkflowProgressMessage:(n,r)=>{e.current?.OPEN&&(t.current=r,e.current?.send(n))}}}export{g as a};
|
package/dist/chunk-PIYHEBW7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as D}from"./chunk-VDGHHU3F.js";import{a as k}from"./chunk-R2MEEU32.js";import{a as h}from"./chunk-M4ISRNFD.js";import{a as y}from"./chunk-GNXBZEEO.js";import{a as S}from"./chunk-XSZUCLBY.js";import{c as P,d as C}from"./chunk-G57W376H.js";import e,{useState as g}from"react";import F from"md5";import{useLexicalComposerContext as G}from"@lexical/react/LexicalComposerContext";import{$convertToMarkdownString as O}from"@lexical/markdown";import{Link as $,P2 as b,Button as w}from"@jpmorganchase/mosaic-components";import{ButtonBar as J,DialogTitle as U,DialogContent as V,DialogActions as _}from"@salt-ds/lab";var j=({isRaising:f,prHref:l,error:c})=>!f&&!l&&!c?e.createElement(e.Fragment,null,e.createElement(b,null,"The content of this page resides in a Git repository and to update it requires a Pull Request which will be reviewed by the content owners."),e.createElement("br",null),e.createElement(b,null,"Should you decide to stop editing before creating the Pull Request then all changes will be lost.")):null,le=({meta:f,persistUrl:l})=>{let{pageState:c,setPageState:v}=P(),{user:p}=C(),[B]=G(),[s,t]=g(!1),[r,n]=g(null),[i,m]=g(null),[q,a]=g([]),E=c==="SAVING",I=r!==null?"success":"info",d=o=>{t(o),o||(v("EDIT"),n(null),a([]))},M=()=>{d(!1)},x=o=>{m(o||"Sorry - an unexpected error has occurred"),n(null),a([]),t(!1)},T=o=>{n(o.message?.links?.self[0]?.href),t(!1)},A=o=>{a(u=>[...u,o])},{sendWorkflowProgressMessage:H}=y(x,A,T),L=()=>{t(!0),n(null),m(null);try{B.update(()=>{let o=O(h);if(o&&p&&l){let{sid:u,displayName:N,email:W}=p;H(JSON.stringify({user:{sid:u,name:N,email:W},route:f.route,markdown:o,name:"save"}),F(`${u.toLowerCase()} - save`))}})}catch{m("Sorry - an unexpected error has occurred"),n(null),t(!1),a([])}};return e.createElement(S,{onOpenChange:d,open:E,status:i?"error":I},e.createElement(U,{className:k.title},r?"Pull Request Created Successfully":"Save Changes"),e.createElement(V,null,(s||i)&&!r&&e.createElement(D,{error:i,progress:q}),e.createElement(j,{isRaising:s,prHref:r,error:i}),!s&&r&&e.createElement($,{href:r,target:"_blank"},"A Pull Request for your changes has been created")),e.createElement(_,null,e.createElement(J,null,e.createElement(w,{disabled:s,onClick:M},r?"Done":"Cancel"),e.createElement(w,{disabled:l===void 0||s||r!==null,onClick:L,variant:"cta"},"Raise Pull Request"))))};export{le as a};
|