Last active
September 23, 2020 11:13
-
-
Save dsngo/529fb60af32fd808640dcf4ad76d57dc to your computer and use it in GitHub Desktop.
Revisions
-
dsngo revised this gist
Sep 23, 2020 . 1 changed file with 49 additions and 50 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ const preCheck = () => new Promise((res,rej)=>res("OK")) // const preCheck = () => new Promise() const services = { authPin: (ctx, e) => { return new Promise((res, rej) => { @@ -57,6 +58,7 @@ const actionsDef = { authorizedPIN: assign({ loginStatus: true }), setInitTime: assign({ initTime: (ctx, e) => e?.payload || ctx.initTime }), toggleMedia: assign((_, e) => {}), assignContext: assign((_, e) => ({ [e.key]: e.value })), }; const guards = { @@ -77,7 +79,7 @@ const guards = { const delays = { INIT_DEFAULT: (_, e) => (e?.payload == undefined ? 6e5 : Number(e.playload)), WAIT_TIME: 3000, }; const appMachine = Machine( @@ -222,74 +224,71 @@ const appMachine = Machine( initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200", INVALID: "ms_110" }, }, ms_110: { after: { WAIT_TIME: { actions: send("RESET") }, }, }, ms_200: { after: { WAIT_TIME: "ms_300", }, }, ms_300: { on: { NEXT: "#interviewing", }, }, }, }, interviewing: { id: "interviewing", states: { start: {}, reconnecting: { entry: ["showLoad", "incrRetry"], exit: ["hideLoad", "resetRetry"], on: { DONE: "start", ERR: [ { target: "reconnecting", cond: { type: "validRetry", maxRetry: 20 }, }, { actions: send("RESET") }, ], }, }, end: { initial: "routing", states: { routing: { on: { "": [ { target: "me_200", cond: "rME200" }, { target: "me_100" }, ], }, }, me_100: { type: "final" }, me_200: { type: "final" }, }, }, }, on: { TOGGLE: { actions: "toggleMedia" }, END: ".end", ERR: ".reconnecting", }, }, }, }, }, on: { ASSIGN: { actions: "assignContext" }, }, }, { delays, services, actions: actionsDef, guards } ); -
dsngo revised this gist
Sep 22, 2020 . 1 changed file with 290 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,295 @@ const preCheck = () => new Promise((res,rej)=>res("OK")) const services = { authPin: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, authorizing: (ctx, e) => { return new Promise((res, rej) => { switch (e.payload) { case "PIN_SUCCESS": return res("PIN_SUCCESS"); case "ID_SUCCESS": return res("ID_SUCCESS"); default: return rej(e.payload); } }); }, initAppStream: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, reconnectAPI: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, getInitTime: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, }; const actionsDef = { toggleAgree: assign({ agreed: (ctx) => !ctx.agreed }), showLoad: assign({ loading: true }), hideLoad: assign({ loading: false }), resetRetry: assign({ retry: 0 }), incrRetry: assign({ retry: (ctx) => ctx.retry + 1 }), doneChk: assign({ mic: true, video: true, speaker: true, network: true, }), rejCtx: assign({ mic: (_, e) => e.data != "AudioError", video: (_, e) => e.data != "VideoError", network: (_, e) => e.data != "NetworkError", }), rejPIN: assign({ pinErrMsg: "Invalid PIN" }), assignErrMsg: assign({ pinErrMsg: (_, e) => e.data }), clearErrMsg: assign({ pinErrMsg: "" }), authorizedPIN: assign({ loginStatus: true }), setInitTime: assign({ initTime: (ctx, e) => e?.payload || ctx.initTime }), toggleMedia: assign((_, e) => {}), }; const guards = { validRetry: (context, _, { cond }) => { return context.retry <= cond.maxRetry; }, isAgreed: (ctx) => ctx.agreed, invalidPermission: (_, e) => e?.data == "NotAllowedError", invalidBrowser: (_, e) => e?.data == "BrowserNotSupported", invalidTime: (_, e) => e?.payload == "MS_110", pinSuccess: (_, e) => e?.data == "PIN_SUCCESS", idSuccess: (_, e) => e?.data == "ID_SUCCESS", rMR610: (_, e) => e?.payload == "MR_610", rMR620: (_, e) => e?.payload == "MR_620", rMR630: (_, e) => e?.payload == "MR_630", rME200: (_, e) => e?.payload == "ME_200", }; const delays = { INIT_DEFAULT: (_, e) => (e?.payload == undefined ? 6e5 : Number(e.playload)), RECON_DEFAULT: 3000, }; const appMachine = Machine( { id: "rjs-visitor", initial: "interview", context: { loading: false, agreed: false, pinErrMsg: "", mic: true, video: true, speaker: true, network: true, loginStatus: false, retry: 0, initTime: 33e4, }, states: { testing: {}, landing: { id: "landing", initial: "mr_100", states: { mr_100: { on: { NEXT: { target: "mr_200", cond: "isAgreed" } }, exit: "toggleAgree", }, mr_200: { on: { NEXT: { target: "checking", cond: "isAgreed" } }, exit: "toggleAgree", }, checking: { id: "checking", invoke: { id: "preCheck", src: preCheck, onDone: { target: "#verify", actions: "doneChk" }, onError: [ { target: "mr_130", cond: "invalidBrowser", }, { target: "mr_110", cond: "invalidPermission", }, { target: "mr_120", actions: "rejCtx", }, ], }, entry: "showLoad", exit: "hideLoad", }, mr_110: {}, mr_120: {}, mr_130: {}, }, on: { RESET: ".mr_100", TOGGLE: { actions: "toggleAgree" }, }, }, verify: { id: "verify", initial: "idle", states: { idle: { id: "idle", initial: "mr_300", states: { mr_300: {}, mr_400: { on: { BACK: "mr_300", ALT: "mr_410" } }, mr_410: { on: { BACK: "mr_400" } }, hist: { type: "history" }, }, on: { CLEAR_MSG: { actions: "clearErrMsg" }, TEST: { actions: assign({ pinErrMsg: "test" }) }, AUTHORIZE: "authorize", SETTING: "#setting", }, }, authorize: { entry: "showLoad", exit: "hideLoad", invoke: { id: "authorize", src: "authorizing", onDone: [ { target: "idle.mr_400", cond: "pinSuccess" }, { target: "mr_500", cond: "idSuccess" }, ], onError: { target: "idle.hist", actions: "assignErrMsg" }, }, }, setting: { id: "setting", initial: "mr_600", states: { mr_600: { on: { NEXT: [ { target: "mr_610", cond: "rMR610", }, { target: "mr_620", cond: "rMR620", }, { target: "mr_630", cond: "rMR630", }, ], }, }, mr_610: {}, mr_620: {}, mr_630: {}, }, on: { BACK: ".mr_600" }, }, mr_500: { on: { BACK: "idle.hist", NEXT: "#interview" } }, }, on: { RESET: ".idle" }, }, interview: { id: "interview", on: { RESET: "#verify" }, invoke: { id: "getInitTime", src: "getInitTime", onDone: { actions: "setInitTime" }, }, initial: "ms_prepare", states: { ms_prepare: { initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200" }, }, ms_200: { invoke: { id: "initStream", src: "initAppStream", onDone: { actions: send("NEXT") }, }, after: { RECON_DEFAULT: "#reconnecting", }, }, }, on: { NEXT: "interviewing" }, }, reconnecting: { id: "reconnecting", invoke: { id: "reconnect", src: "reconnectAPI", onDone: { target: "interviewing", actions: "resetRetry", }, onError: [ { target: "reconnecting", actions: "incrRetry", cond: { type: "validRetry", maxRetry: 5, }, }, { target: "#interview", actions: "resetRetry" }, ], }, initial: "ms_300", states: { ms_300: {}, mc_160: {}, }, }, interviewing: { on: { TOGGLE: { actions: "toggleMedia" }, END: "end", ERR: "#reconnecting.mc_160", }, }, end: { type: "final", initial: "routing", states: { routing: { on: { "": [ { target: "me_200", cond: "rME200" }, { target: "me_100" }, ], }, }, me_100: {}, me_200: {}, }, }, }, }, }, }, { delays, services, actions: actionsDef, guards } ); -
dsngo revised this gist
Sep 14, 2020 . 1 changed file with 17 additions and 289 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,295 +1,23 @@ const preCheck = () => new Promise((res,rej)=>res("OK")) const appMachine = Machine({ initial: "idle", states: { idle: { on: {NEXT: "authorize"}}, authorize: { entry: "showLoad", exit: "hideLoad", after: { 2000: { invoke: { id: "authorize", src: preCheck, onDone: "#success", onError: "#failure", }, }, }, }, success: {id: "success"}, failure: {id: "failure"} } }) -
dsngo revised this gist
Aug 24, 2020 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const preCheck = () => new Promise() const appMachine = Machine( { id: "rjs-visitor", initial: "testing", context: { pinErrMsg: "", mic: true, @@ -13,6 +13,7 @@ const appMachine = Machine( retry: 0, }, states: { testing: {}, landing: { id: "landing", initial: "mr_100", @@ -204,8 +205,8 @@ const appMachine = Machine( initial: "zoomIn", states: { hist: { type: "history" }, zoomIn: { on: { TOGGLE: "zoomOut" } }, zoomOut: { on: { TOGGLE: "zoomIn" } }, }, on: { END: "end", -
dsngo revised this gist
Aug 21, 2020 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const preCheck = () => new Promise() const appMachine = Machine( { id: "rjs-visitor", initial: "landing", context: { pinErrMsg: "", mic: true, @@ -25,7 +25,7 @@ const appMachine = Machine( states: { checking: { invoke: { id: "preCheck", src: preCheck, onDone: { target: "#verify", @@ -34,7 +34,6 @@ const appMachine = Machine( onError: [ { target: "#req_check.mr_110", cond: "invalidPermission", }, { @@ -104,7 +103,7 @@ const appMachine = Machine( id: "authorizing", src: "authID", onDone: "mr_500", onError: { actions: "rejID" }, }, }, mr_500: { @@ -241,22 +240,22 @@ const appMachine = Machine( services: { authPin: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, authID: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, initAppStream: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, reconnectAPI: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("RESOLVED") : rej(e.payload); }); }, }, @@ -275,6 +274,7 @@ const appMachine = Machine( network: (_, e) => e.data != "NetworkError", }), rejPIN: assign({ pinErrMsg: "Invalid PIN" }), rejID: [send("BACK"), assign({ pinErrMsg: (_, e) => e.data })], retryPIN: assign({ pinErrMsg: "" }), authorizedPIN: assign({ loginStatus: true }), }, -
dsngo revised this gist
Aug 21, 2020 . 1 changed file with 27 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,4 @@ const preCheck = () => new Promise() const appMachine = Machine( { id: "rjs-visitor", @@ -87,7 +73,7 @@ const appMachine = Machine( pin_authorize: { invoke: { id: "pinAuth", src: "authPin", onError: { target: "idle", actions: "rejPIN", @@ -116,7 +102,7 @@ const appMachine = Machine( authorizing: { invoke: { id: "authorizing", src: "authID", onDone: "mr_500", onError: { actions: send("BACK") }, }, @@ -178,7 +164,7 @@ const appMachine = Machine( ms_200: { invoke: { id: "initStream", src: "initAppStream", onDone: { actions: send("NEXT") }, }, after: { @@ -192,7 +178,7 @@ const appMachine = Machine( id: "reconnecting", invoke: { id: "reconnect", src: "reconnectAPI", onDone: { target: "interviewing.hist", actions: "resetRetry", @@ -252,6 +238,28 @@ const appMachine = Machine( INIT_DEFAULT: 6e5, RECON_DEFAULT: 3500, }, services: { authPin: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("AUTHORIZED") : rej("REJECTED"); }); }, authID: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("AUTHORIZED") : rej("REJECTED"); }); }, initAppStream: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("AUTHORIZED") : rej("REJECTED"); }); }, reconnectAPI: (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("AUTHORIZED") : rej("REJECTED"); }); }, }, actions: { resetRetry: assign({ retry: 0 }), incrRetry: assign({ retry: (ctx) => ctx.retry + 1 }), -
dsngo revised this gist
Aug 20, 2020 . 1 changed file with 16 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,18 @@ const authPin = (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("AUTHORIZED") : rej("REJECTED"); }); }; const authID = (ctx, e) => { return new Promise((res, rej) => { e.payload == "RESOLVE" ? res("AUTHORIZED") : rej("REJECTED"); }); }; const initAppStream = (ctx, e) => new Promise(); const reconnectAPI = (ctx, e) => new Promise(); const preCheck = () => new Promise(); const appMachine = Machine( { id: "rjs-visitor", @@ -86,7 +87,7 @@ const appMachine = Machine( pin_authorize: { invoke: { id: "pinAuth", src: authPin, onError: { target: "idle", actions: "rejPIN", @@ -110,11 +111,12 @@ const appMachine = Machine( on: { NEXT: "id_authorizing" }, }, id_authorizing: { initial: "authorizing", states: { authorizing: { invoke: { id: "authorizing", src: authID, onDone: "mr_500", onError: { actions: send("BACK") }, }, -
dsngo revised this gist
Aug 20, 2020 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const assignCtx = (k,v) => assign({[k]:v}) const appMachine = Machine( { id: "rjs-visitor", initial: "verify", context: { pinErrMsg: "", mic: true, @@ -80,6 +80,7 @@ const appMachine = Machine( on: { SETTING: "#setting", NEXT: "pin_authorize", RETRY: { actions: "retryPIN" }, }, }, pin_authorize: { @@ -171,9 +172,6 @@ const appMachine = Machine( states: { ms_100: { on: { NEXT: "ms_200" }, }, ms_200: { invoke: { @@ -223,8 +221,8 @@ const appMachine = Machine( zoomOut: { on: { ZIN: "zoomIn" } }, }, on: { END: "end", ERR: "#reconnecting.mc_160", }, }, end: { @@ -267,6 +265,7 @@ const appMachine = Machine( network: (_, e) => e.data != "NetworkError", }), rejPIN: assign({ pinErrMsg: "Invalid PIN" }), retryPIN: assign({ pinErrMsg: "" }), authorizedPIN: assign({ loginStatus: true }), }, guards: { -
dsngo revised this gist
Aug 17, 2020 . 1 changed file with 27 additions and 37 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ const pinVerify = (ctx, e) => { return new Promise((res,rej)=>{ e.payload == "RESOLVE" ? res : rej @@ -21,7 +22,6 @@ const appMachine = Machine( video: true, speaker: true, network: true, loginStatus: false, retry: 0, }, @@ -42,22 +42,21 @@ const appMachine = Machine( src: preCheck, onDone: { target: "#verify", actions: "doneChk", }, onError: [ { target: "#req_check.mr_110", actions: "rejMedia", cond: "invalidPermission", }, { target: "#req_check.mr_130", cond: "invalidBrowser", }, { target: "#req_check.mr_120", actions: "rejCtx", }, ], }, @@ -183,12 +182,7 @@ const appMachine = Machine( onDone: { actions: send("NEXT") }, }, after: { RECON_DEFAULT: "#reconnecting", }, }, }, @@ -200,7 +194,7 @@ const appMachine = Machine( id: "reconnect", src: reconnectAPI, onDone: { target: "interviewing.hist", actions: "resetRetry", }, onError: [ @@ -215,26 +209,21 @@ const appMachine = Machine( { target: "#interview", actions: "resetRetry" }, ], }, initial: "ms_300", states: { ms_300: {}, mc_160: {}, }, }, interviewing: { initial: "zoomIn", states: { hist: { type: "history" }, zoomIn: { on: { ZOUT: "zoomOut" } }, zoomOut: { on: { ZIN: "zoomIn" } }, }, on: { ERR: "#reconnecting.mc_160", END: "end", }, }, @@ -271,20 +260,21 @@ const appMachine = Machine( video: true, speaker: true, network: true, }), rejCtx: assign({ mic: (_, e) => e.data != "AudioError", video: (_, e) => e.data != "VideoError", network: (_, e) => e.data != "NetworkError", }), rejPIN: assign({ pinErrMsg: "Invalid PIN" }), authorizedPIN: assign({ loginStatus: true }), }, guards: { validRetry: (context, _, { cond }) => { return context.retry <= cond.maxRetry; }, invalidPermission: (_, e) => e?.data == "NotAllowedError", invalidBrowser: (_, e) => e?.data == "BrowserNotSupported", invalidTime: (_, e) => e?.payload == "MS_110", rMR610: (_, e) => e?.payload == "MR_610", rMR620: (_, e) => e?.payload == "MR_620", -
dsngo revised this gist
Aug 13, 2020 . No changes.There are no files selected for viewing
-
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 26 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -183,23 +183,26 @@ const appMachine = Machine( onDone: { actions: send("NEXT") }, }, after: { RECON_DEFAULT: "ms_300", }, }, ms_300: { on: { "": "#reconnecting", }, }, }, on: { NEXT: "interviewing" }, }, reconnecting: { id: "reconnecting", invoke: { id: "reconnect", src: reconnectAPI, onDone: { target: "interviewing.mc_100.hist", actions: "resetRetry", }, onError: [ { target: "reconnecting", @@ -212,21 +215,26 @@ const appMachine = Machine( { target: "#interview", actions: "resetRetry" }, ], }, }, interviewing: { initial: "mc_100", states: { mc_100: { initial: "zoomIn", states: { hist: { type: "history" }, zoomIn: { on: { ZOUT: "zoomOut" } }, zoomOut: { on: { ZIN: "zoomIn" } }, }, on: { ERR: "mc_150" }, }, mc_150: { on: { "": "#reconnecting", }, }, }, on: { END: "end", }, }, -
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -221,9 +221,9 @@ const appMachine = Machine( interviewing: { initial: "zoomIn", states: { hist: { type: "history" }, zoomIn: { on: { ZOUT: "zoomOut" } }, zoomOut: { on: { ZIN: "zoomIn" } }, }, on: { ERR: "reconnecting.mc_150", -
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -187,7 +187,7 @@ const appMachine = Machine( }, }, }, on: { NEXT: "interviewing", ERR: "reconnecting" }, }, reconnecting: { id: "reconnecting", @@ -212,6 +212,7 @@ const appMachine = Machine( { target: "#interview", actions: "resetRetry" }, ], }, initial: "ms_300", states: { ms_300: {}, mc_150: {}, -
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 43 additions and 50 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,11 +77,12 @@ const appMachine = Machine( mr_300: { initial: "idle", states: { idle: { on: { SETTING: "#setting", NEXT: "pin_authorize", }, }, pin_authorize: { invoke: { id: "pinAuth", @@ -115,19 +116,19 @@ const appMachine = Machine( id: "authorizing", src: idVerify, onDone: "mr_500", onError: { actions: send("BACK") }, }, }, mr_500: { on: { NEXT: { target: "ms_110", cond: "invalidTime" } }, }, ms_110: { after: { RECON_DEFAULT: { actions: send("RESET") } } }, }, on: { BACK: "id_authorize.hist", NEXT: "#interview", }, }, }, on: { RESET: ".mr_300" }, }, @@ -169,7 +170,7 @@ const appMachine = Machine( ms_prepare: { initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200" }, after: { INIT_DEFAULT: "ms_110", @@ -182,59 +183,51 @@ const appMachine = Machine( onDone: { actions: send("NEXT") }, }, after: { RECON_DEFAULT: { actions: send("ERR") }, }, }, }, on: { NEXT: "interviewing", ERR: "reconnecting.ms_300" }, }, reconnecting: { id: "reconnecting", invoke: { id: "reconnect", src: reconnectAPI, onDone: { target: "interviewing.hist", actions: "resetRetry", }, onError: [ { target: "reconnecting", actions: "incrRetry", cond: { type: "validRetry", maxRetry: 5, }, }, { target: "#interview", actions: "resetRetry" }, ], }, states: { ms_300: {}, mc_150: {}, }, }, interviewing: { initial: "zoomIn", states: { zoomIn: { on: { ZOUT: "zoomOut" } }, zoomOut: { on: { ZIN: "zoomIn" } }, hist: { type: "history" }, }, on: { ERR: "reconnecting.mc_150", END: "end", }, }, end: { type: "final", -
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 28 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const pinVerify = (ctx, e) => { e.payload == "RESOLVE" ? res : rej }) } const idVerify = (ctx, e) => new Promise() const preCheck = (ctx, e) => { return new Promise(); } @@ -98,27 +99,35 @@ const appMachine = Machine( }, }, id_authorize: { id: "authorize", initial: "mr_400", states: { mr_400: { on: { ALT: "mr_410" } }, mr_410: { on: { BACK: "mr_400" } }, hist: { type: "history" }, }, on: { NEXT: "id_authorizing" }, }, id_authorizing: { states: { authorizing: { invoke: { id: "authorizing", src: idVerify, onDone: "mr_500", onError: {actions: send("BACK")} } }, mr_500: {on:{NEXT: {target: "ms_110", cond: "invalidTime"}}}, ms_110: { after: { RECON_DEFAULT: { actions: send("RESET") } } }, }, on: { BACK: "id_authorize.hist", NEXT: "#interview" }, }, }, on: { RESET: ".mr_300" }, }, @@ -160,7 +169,12 @@ const appMachine = Machine( ms_prepare: { initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200" }, after: { INIT_DEFAULT: "ms_110", }, }, ms_200: { invoke: { id: "initStream", @@ -175,11 +189,11 @@ const appMachine = Machine( invoke: { id: "rcMS", src: reconnectAPI, onDone: { actions: [send("NEXT"),"resetRetry"]}, onError: [ { target: "#interview.ms_prepare.ms_300", actions: "incrRetry", cond: { type: "validRetry", maxRetry: 5, @@ -269,7 +283,7 @@ const appMachine = Machine( }, networkChk: (_, e) => e?.message == "Network is offline!", userMediaChk: (_, e) => e?.name == "NotAllowedError", invalidTime: (_, e) => e?.payload == "MS_110", rMR610: (_, e) => e?.payload == "MR_610", rMR620: (_, e) => e?.payload == "MR_620", rMR630: (_, e) => e?.payload == "MR_630", -
dsngo revised this gist
Aug 13, 2020 . No changes.There are no files selected for viewing
-
dsngo revised this gist
Aug 13, 2020 . No changes.There are no files selected for viewing
-
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 25 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,22 +41,22 @@ const appMachine = Machine( src: preCheck, onDone: { target: "#verify", exit: "doneChk", }, onError: [ { target: "#req_check.mr_110", actions: "rejMedia", cond: "userMediaChk", }, { target: "#req_check.mr_120", actions: "rejNetwork", cond: "networkChk", }, { target: "#req_check.mr_130", actions: "rejBrowser", }, ], }, @@ -76,14 +76,18 @@ const appMachine = Machine( mr_300: { initial: "idle", states: { idle: { on: { SETTING: "#setting", NEXT: "pin_authorize", } }, pin_authorize: { invoke: { id: "pinAuth", src: pinVerify, onError: { target: "idle", actions: "rejPIN", }, onDone: { target: "#verify.id_authorize", @@ -92,7 +96,6 @@ const appMachine = Machine( }, }, }, }, id_authorize: { initial: "mr_400", @@ -172,23 +175,19 @@ const appMachine = Machine( invoke: { id: "rcMS", src: reconnectAPI, onDone: { actions: send("NEXT"), exit: "resetRetry" }, onError: [ { target: "#interview.ms_prepare.ms_300", exit: "incrRetry", cond: { type: "validRetry", maxRetry: 5, }, }, { target: "#interview", exit: "resetRetry" }, ], }, }, }, on: { NEXT: "interviewing" }, @@ -209,10 +208,11 @@ const appMachine = Machine( invoke: { id: "rcMC", src: reconnectAPI, onDone: { target: "interviewing.hist", actions: "resetRetry" }, onError: [ { target: "#interview.mc_150", actions: "incrRetry", cond: { type: "validRetry", maxRetry: 6, @@ -221,7 +221,6 @@ const appMachine = Machine( { target: "#interview" }, ], }, }, end: { type: "final", @@ -251,26 +250,26 @@ const appMachine = Machine( actions: { resetRetry: assign({ retry: 0 }), incrRetry: assign({ retry: (ctx) => ctx.retry + 1 }), doneChk: assign({ mic: true, video: true, speaker: true, network: true, browser: true, }), rejMedia: assign({ mic: false, video: false }), rejBrowser: assign({ browser: false }), rejNetwork: assign({ network: false }), rejPIN: assign({ pinErrMsg: "Invalid PIN" }), authorizedPIN: assign({ loginStatus: true }), }, guards: { validRetry: (context, event, { cond }) => { return context.retry <= cond.maxRetry; }, networkChk: (_, e) => e?.message == "Network is offline!", userMediaChk: (_, e) => e?.name == "NotAllowedError", inTime: (_, e) => e?.payload == "#interview", rMR610: (_, e) => e?.payload == "MR_610", rMR620: (_, e) => e?.payload == "MR_620", rMR630: (_, e) => e?.payload == "MR_630", -
dsngo revised this gist
Aug 13, 2020 . No changes.There are no files selected for viewing
-
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,9 +30,9 @@ const appMachine = Machine( initial: "mr_100", states: { mr_100: { on: { NEXT: "mr_200" } }, mr_200: { on: { NEXT: "req_check" } }, req_check: { id: "req_check", initial: "checking", states: { checking: { @@ -45,17 +45,17 @@ const appMachine = Machine( }, onError: [ { target: "#req_check.mr_110", actions: "failMedia", cond: "userMediaFail", }, { target: "#req_check.mr_120", actions: "failNetwork", cond: "networkFail", }, { target: "#req_check.mr_130", actions: "failBrowser", }, ], @@ -86,15 +86,15 @@ const appMachine = Machine( actions: "InvalidPIN", }, onDone: { target: "#verify.id_authorize", actions: "authorizedPIN", }, }, }, }, on: { SETTING: "#setting" }, }, id_authorize: { initial: "mr_400", states: { mr_400: { on: { ALT: "mr_410" } }, @@ -105,7 +105,7 @@ const appMachine = Machine( }, mr_500: { on: { BACK: "id_authorize.hist", NEXT: { target: "#interview", cond: "inTime", @@ -191,9 +191,9 @@ const appMachine = Machine( exit: "resetRetry", }, }, on: { NEXT: "interviewing" }, }, interviewing: { initial: "zoomIn", states: { zoomIn: { on: { ZOUT: "zoomOut" } }, @@ -209,7 +209,7 @@ const appMachine = Machine( invoke: { id: "rcMC", src: reconnectAPI, onDone: { target: "interviewing.hist" }, onError: [ { target: "#interview.mc_150", -
dsngo revised this gist
Aug 13, 2020 . 1 changed file with 59 additions and 59 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const appMachine = Machine( id: "reqChk", src: preCheck, onDone: { target: "#verify", exit: "allPass", }, onError: [ @@ -65,7 +65,6 @@ const appMachine = Machine( mr_120: {}, mr_130: {}, }, }, }, on: { RESET: ".mr_100" }, @@ -77,23 +76,23 @@ const appMachine = Machine( mr_300: { initial: "idle", states: { idle: { on: { NEXT: "pin_authorize" } }, pin_authorize: { invoke: { id: "pinAuth", src: pinVerify, onError: { target: "idle", actions: "InvalidPIN", }, onDone: { target: "#verify.mr_4X0", actions: "authorizedPIN", }, }, }, }, on: { SETTING: "#setting" }, }, mr_4X0: { initial: "mr_400", @@ -108,48 +107,48 @@ const appMachine = Machine( on: { BACK: "mr_4X0.hist", NEXT: { target: "#interview", cond: "inTime", }, }, after: { INIT_DEFAULT: "ms_110", }, }, ms_110: { after: { RECON_DEFAULT: { actions: send("RESET") } } }, }, on: { RESET: ".mr_300" }, }, setting: { id: "setting", initial: "mr_600", states: { mr_600: { on: { NEXT: [ { target: "mr_610", cond: "rMR610", }, { target: "mr_620", cond: "rMR620", }, { target: "mr_630", cond: "rMR630", }, ], }, }, mr_610: {}, mr_620: {}, mr_630: {}, }, on: { RESET: "#verify", BACK: ".mr_600", }, }, interview: { id: "interview", @@ -175,74 +174,73 @@ const appMachine = Machine( src: reconnectAPI, onDone: { actions: send("NEXT"), }, onError: [ { target: "#interview.ms_prepare.ms_300", cond: { type: "validRetry", maxRetry: 5, }, }, { target: "#interview", }, ], }, exit: "resetRetry", }, }, on: { NEXT: "mc_1X0" }, }, mc_1X0: { initial: "zoomIn", states: { zoomIn: { on: { ZOUT: "zoomOut" } }, zoomOut: { on: { ZIN: "zoomIn" } }, hist: { type: "history" }, }, on: { ERR: "mc_150", END: "end", }, }, mc_150: { invoke: { id: "rcMC", src: reconnectAPI, onDone: { target: "mc_1X0.hist" }, onError: [ { target: "#interview.mc_150", cond: { type: "validRetry", maxRetry: 6, }, }, { target: "#interview" }, ], }, exit: "resetRetry", }, end: { type: "final", initial: "routing", states: { routing: { on: { "": [ { target: "me_200", cond: "rME200" }, { target: "me_100" }, ], }, }, me_100: {}, me_200: {}, }, }, }, }, }, }, { @@ -263,14 +261,16 @@ const appMachine = Machine( failMedia: assign({ mic: false, video: false }), failBrowser: assign({ browser: false }), failNetwork: assign({ network: false }), InvalidPIN: assign({ pinErrMsg: "Invalid PIN" }), authorizedPIN: assign({ loginStatus: true }), }, guards: { validRetry: (context, event, { cond }) => { return context.retry <= cond.maxRetry; }, networkFail: (_, e) => e?.message == "Network is offline!", userMediaFail: (_, e) => e.name == "NotAllowedError", inTime: (_, e) => e.payload == "#interview", rMR610: (_, e) => e?.payload == "MR_610", rMR620: (_, e) => e?.payload == "MR_620", rMR630: (_, e) => e?.payload == "MR_630", -
dsngo revised this gist
Aug 12, 2020 . 1 changed file with 40 additions and 32 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -93,7 +93,7 @@ const appMachine = Machine( }, }, }, on: { NEXT: "mr_4X0",SETTING: "#mr_6X0" }, }, mr_4X0: { initial: "mr_400", @@ -107,45 +107,49 @@ const appMachine = Machine( mr_500: { on: { BACK: "mr_4X0.hist", NEXT: { target: "ms_110", cond: "invalidTime", }, }, after: { INIT_DEFAULT: "ms_110" } }, ms_110: { after: { RECON_DEFAULT: { actions: send("RESET") } } }, }, on: { RESET: ".mr_300", }, }, mr_6X0: { id: "mr_6X0", initial: "mr_600", states: { mr_600: { on: { NEXT: [ { target: "mr_610", cond: "rMR610", }, { target: "mr_620", cond: "rMR620", }, { target: "mr_630", cond: "rMR630", }, ], }, }, mr_610: {}, mr_620: {}, mr_630: {}, }, on: { RESET: "#verify", BACK: ".mr_600", } }, interview: { id: "interview", @@ -162,7 +166,7 @@ const appMachine = Machine( onDone: { actions: send("NEXT") }, }, after: { RECON_DEFAULT: "ms_300", }, }, ms_300: { @@ -242,6 +246,10 @@ const appMachine = Machine( }, }, { delays: { INIT_DEFAULT: 6e5, RECON_DEFAULT: 3500, }, actions: { resetRetry: assign({ retry: 0 }), incrRetry: assign({ retry: (ctx) => ctx.retry + 1 }), -
dsngo revised this gist
Aug 12, 2020 . 1 changed file with 32 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ const appMachine = Machine( states: { checking: { invoke: { id: "reqChk", src: preCheck, onDone: { actions: send("NEXT"), @@ -80,7 +80,7 @@ const appMachine = Machine( idle: { on: { NEXT: "verify_pin" } }, verify_pin: { invoke: { id: "pinAuth", src: pinVerify, onError: { target: "idle", @@ -93,7 +93,7 @@ const appMachine = Machine( }, }, }, on: { NEXT: "mr_4X0",SETTING: "mr_6X0" }, }, mr_4X0: { initial: "mr_400", @@ -110,7 +110,7 @@ const appMachine = Machine( NEXT: [ { target: "ms_110", cond: "invalidTime", }, { target: "#interview" }, ], @@ -120,30 +120,32 @@ const appMachine = Machine( mr_6X0: { initial: "mr_600", states: { mr_600: { on: { NEXT: [ { target: "mr_610", cond: "rMR610", }, { target: "mr_620", cond: "rMR620", }, { target: "mr_630", cond: "rMR630", }, ], }, }, mr_610: {}, mr_620: {}, mr_630: {}, }, }, }, on: { RESET: ".mr_300", }, }, interview: { id: "interview", @@ -165,11 +167,11 @@ const appMachine = Machine( }, ms_300: { invoke: { id: "rcMS", src: reconnectAPI, onDone: { actions: send("NEXT"), exit: "resetPass", }, onError: [ { @@ -203,23 +205,20 @@ const appMachine = Machine( }, on: { ERR: "mc_150", FSCR: ".mc_130", NEXT: "end", }, }, mc_150: { invoke: { id: "rcMC", src: reconnectAPI, onDone: { target: "mc_1X0.hist", exit: "resetRetry" }, onError: [ { target: "#interview.mc_150", cond: { type: "retryPass", maxRetry: 6, }, }, @@ -230,16 +229,16 @@ const appMachine = Machine( ], }, }, end: { initial: "me_100", states: { me_100: { type: "final" }, me_200: { type: "final" }, }, } }, }, }, }, { @@ -258,12 +257,12 @@ const appMachine = Machine( failNetwork: assign({ network: false }), }, guards: { retryPass: (context, event, { cond }) => { return context.retry <= cond.maxRetry; }, networkFail: (_, e) => e?.message == "Network is offline!", userMediaFail: (_, e) => e.name == "NotAllowedError", invalidTime: (_, e) => e.payload == "MS_110", rMR610: (_, e) => e?.payload == "MR_610", rMR620: (_, e) => e?.payload == "MR_620", rMR630: (_, e) => e?.payload == "MR_630", -
dsngo revised this gist
Aug 11, 2020 . 1 changed file with 37 additions and 35 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,21 +41,22 @@ const appMachine = Machine( src: preCheck, onDone: { actions: send("NEXT"), exit: "allPass", }, onError: [ { target: "#MR_1X0.mr_110", actions: "failMedia", cond: "userMediaFail", }, { target: "#MR_1X0.mr_120", actions: "failNetwork", cond: "networkFail", }, { target: "#MR_1X0.mr_130", actions: "failBrowser", }, ], }, @@ -64,7 +65,7 @@ const appMachine = Machine( mr_120: {}, mr_130: {}, }, on: { NEXT: "#verify" }, }, }, on: { RESET: ".mr_100" }, @@ -83,16 +84,16 @@ const appMachine = Machine( src: pinVerify, onError: { target: "idle", actions: assign({ pinErrMsg: "PIN Incorrect!" }), }, onDone: { exit: "resetRetry", actions: [assign({ loginStatus: true }), send("NEXT")], }, }, }, }, on: { NEXT: "mr_4X0" }, }, mr_4X0: { initial: "mr_400", @@ -152,16 +153,15 @@ const appMachine = Machine( initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200" } }, ms_200: { invoke: { id: "initStream", src: initAppStream, onDone: { actions: send("NEXT") }, }, after: { 3500: "ms_300", }, }, ms_300: { invoke: { @@ -185,9 +185,9 @@ const appMachine = Machine( }, ], }, }, }, on: { NEXT: "mc_1X0" }, }, mc_1X0: { initial: "mc_100", @@ -198,8 +198,8 @@ const appMachine = Machine( mc_130: {}, mc_140: {}, mc_160: {}, hist: { type: "history" }, }, on: { ERR: "mc_150", @@ -210,26 +210,26 @@ const appMachine = Machine( ], }, }, mc_150: { invoke: { id: "reconMC150", src: reconnectAPI, onDone: { target: "mc_1X0.hist", exit: "resetRetry" }, onError: [ { target: "#interview.mc_150", cond: { type: "retryValid", maxRetry: 6, }, }, { target: "#interview", exit: "resetRetry", }, ], }, }, }, }, end: { @@ -252,8 +252,10 @@ const appMachine = Machine( speaker: true, network: true, browser: true, }), failMedia: assign({ mic: false, video: false }), failBrowser: assign({ browser: false }), failNetwork: assign({ network: false }), }, guards: { retryValid: (context, event, { cond }) => { -
dsngo revised this gist
Aug 11, 2020 . 1 changed file with 46 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const preCheck = (ctx, e) => { const initAppStream = (ctx,e)=> new Promise(); const reconnectAPI = (ctx,e) => new Promise() const assignCtx = (k,v) => assign({[k]:v}) const appMachine = Machine( { id: "rjs-visitor", @@ -82,11 +83,11 @@ const appMachine = Machine( src: pinVerify, onError: { target: "idle", actions: assignCtx("pinErrMsg","PIN Incorrect!" ), }, onDone: { exit: "resetRetry", actions: [assignCtx("loginStatus", true), send("NEXT")], }, }, }, @@ -156,8 +157,10 @@ const appMachine = Machine( id: "initStream", src: initAppStream, onDone: {actions: send("NEXT")}, }, after: { 3500: "ms_300" }, }, ms_300: { @@ -166,19 +169,19 @@ const appMachine = Machine( src: reconnectAPI, onDone: { actions: send("NEXT"), exit: "resetRetry", }, onError: [ { target: "#interview.ms_prepare.ms_300", cond: { type: "retryValid", maxRetry: 5, }, }, { target: "#interview", exit: "incrRetry", }, ], }, @@ -195,36 +198,38 @@ const appMachine = Machine( mc_130: {}, mc_140: {}, mc_160: {}, hist: {type: "history"} }, on: { ERR: "mc_150", ENLARGE: ".mc_130", END: [ { target: "#end.me_200", cond: "rME200" }, { target: "#end" }, ], }, }, mc_150: { invoke: { id: "reconMC150", src: reconnectAPI, onDone: { target: "mc_1X0.hist", exit: 'resetRetry' }, onError: [ { target: "#interview.mc_150", cond: { type: "retryValid", maxRetry: 6, }, }, { target: "#interview", exit: "resetRetry", }, ], }, }, }, }, end: { @@ -241,10 +246,18 @@ const appMachine = Machine( actions: { resetRetry: assign({ retry: 0 }), incrRetry: assign({ retry: (ctx) => ctx.retry + 1 }), allPass: assign({ mic: true, video: true, speaker: true, network: true, browser: true, }) }, guards: { retryValid: (context, event, { cond }) => { return context.retry <= cond.maxRetry; }, networkFail: (_, e) => e?.message == "Network is offline!", userMediaFail: (_, e) => e.name == "NotAllowedError", -
dsngo revised this gist
Aug 11, 2020 . 1 changed file with 20 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const pinVerify = (ctx, e) => { const preCheck = (ctx, e) => { return new Promise(); } const initAppStream = (ctx,e)=> new Promise(); const reconnectAPI = (ctx,e) => new Promise() const appMachine = Machine( @@ -38,7 +39,7 @@ const appMachine = Machine( id: "reqCheck", src: preCheck, onDone: { actions: send("NEXT"), }, onError: [ { @@ -62,6 +63,7 @@ const appMachine = Machine( mr_120: {}, mr_130: {}, }, on: { NEXT: "#verify" } }, }, on: { RESET: ".mr_100" }, @@ -83,13 +85,13 @@ const appMachine = Machine( actions: assign({ pinErrMsg: "PIN Incorrect!" }), }, onDone: { exit: assign({ retry: 0 }), actions: [assign({ loginStatus: true }), send("NEXT")], }, }, }, }, on: {NEXT: "mr_4X0"} }, mr_4X0: { initial: "mr_400", @@ -149,14 +151,22 @@ const appMachine = Machine( initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200" } }, ms_200: { invoke: { id: "initStream", src: initAppStream, onDone: {actions: send("NEXT")}, onError: "ms_300" } }, ms_300: { invoke: { id: "reconMS300", src: reconnectAPI, onDone: { actions: send("NEXT"), exit: assign({ retry: 0 }), }, onError: [ { @@ -172,10 +182,9 @@ const appMachine = Machine( }, ], }, } }, on: {NEXT: "mc_1X0"} }, mc_1X0: { initial: "mc_100", @@ -209,6 +218,7 @@ const appMachine = Machine( }, on: { ERR: ".mc_150", ENLARGE: ".mc_130", END: [ { target: "#end.me_200", cond: "rME200" }, { target: "#end" }, -
dsngo revised this gist
Aug 11, 2020 . No changes.There are no files selected for viewing
-
dsngo revised this gist
Aug 11, 2020 . 1 changed file with 210 additions and 207 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,238 +8,241 @@ const preCheck = (ctx, e) => { } const reconnectAPI = (ctx,e) => new Promise() const appMachine = Machine( { id: "rjs-visitor", initial: "landing", context: { pinErrMsg: "", mic: true, video: true, speaker: true, network: true, browser: true, loginStatus: false, retry: 0, }, states: { landing: { id: "landing", initial: "mr_100", states: { mr_100: { on: { NEXT: "mr_200" } }, mr_200: { on: { NEXT: "mr_1X0" } }, mr_1X0: { id: "MR_1X0", initial: "checking", states: { checking: { invoke: { id: "reqCheck", src: preCheck, onDone: { target: "#verify", }, onError: [ { target: "#MR_1X0.mr_110", actions: assign({ mic: false, video: false }), cond: "userMediaFail", }, { target: "#MR_1X0.mr_120", actions: assign({ network: false }), cond: "networkFail", }, { target: "#MR_1X0.mr_130", actions: assign({ browser: false }), }, ], }, }, mr_110: {}, mr_120: {}, mr_130: {}, }, }, }, on: { RESET: ".mr_100" }, }, verify: { id: "verify", initial: "mr_300", states: { mr_300: { initial: "idle", states: { idle: { on: { NEXT: "verify_pin" } }, verify_pin: { invoke: { id: "PINAuth", src: pinVerify, onError: { target: "idle", actions: assign({ pinErrMsg: "PIN Incorrect!" }), }, onDone: { entry: assign({ retry: 0 }), target: "#verify.mr_4X0", actions: assign({ loginStatus: true }), }, }, }, }, }, mr_4X0: { initial: "mr_400", states: { mr_400: { on: { ALT: "mr_410" } }, mr_410: { on: { BACK: "mr_400" } }, hist: { type: "history" }, }, on: { NEXT: "mr_500" }, }, mr_500: { on: { BACK: "mr_4X0.hist", NEXT: [ { target: "ms_110", cond: "notCorrectTime", }, { target: "#interview" }, ], }, }, ms_110: { after: { 3500: { actions: send("RESET") } } }, mr_6X0: { initial: "mr_600", states: { mr_600: {}, mr_610: {}, mr_620: {}, mr_630: {}, }, on: { NEXT: [ { target: ".mr_610", cond: "rMR610", }, { target: ".mr_620", cond: "rMR620", }, { target: ".mr_630", cond: "rMR630", }, ], }, }, }, on: { RESET: ".mr_300", SETTING: ".mr_6X0" }, }, interview: { id: "interview", initial: "ms_prepare", states: { ms_prepare: { initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200" } }, ms_200: { on: { NEXT: "#interview.mc_1X0" } }, ms_300: { invoke: { id: "reconMS300", src: reconnectAPI, onDone: { entry: assign({ retry: 0 }), target: "#interview.ms_prepare.hist", }, onError: [ { target: "#interview", cond: { type: "retryInvalid", maxRetry: 5, }, exit: "incrRetry", }, { target: "#interview.ms_prepare.ms_300", }, ], }, }, hist: { type: "history" }, }, on: { ERR: ".ms_300" }, }, mc_1X0: { initial: "mc_100", states: { mc_100: {}, mc_110: {}, mc_120: {}, mc_130: {}, mc_140: {}, mc_160: {}, mc_150: { invoke: { id: "reconMC150", src: reconnectAPI, onDone: { target: "mc_100", exit: assign }, onError: [ { target: "#interview", cond: { type: "retryInvalid", maxRetry: 6, }, exit: "resetRetry", }, { target: "#interview.mc_1X0.mc_150", }, ], }, }, }, on: { ERR: ".mc_150", END: [ { target: "#end.me_200", cond: "rME200" }, { target: "#end" }, ], }, }, }, }, end: { id: "end", initial: "me_100", states: { me_100: { type: "final" }, me_200: { type: "final" }, }, }, }, }, { actions: { resetRetry: assign({ retry: 0 }), incrRetry: assign({ retry: (ctx) => ctx.retry + 1 }), }, guards: { retryInvalid: (context, event, { cond }) => { return context.retry > cond.maxRetry; }, networkFail: (_, e) => e?.message == "Network is offline!", userMediaFail: (_, e) => e.name == "NotAllowedError", notCorrectTime: (_, e) => e.payload == "MS_110", rMR610: (_, e) => e?.payload == "MR_610", rMR620: (_, e) => e?.payload == "MR_620", rMR630: (_, e) => e?.payload == "MR_630", rME200: (_, e) => e?.payload == "ME_200", }, } ); -
dsngo revised this gist
Aug 11, 2020 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,9 +32,6 @@ const appMachine = Machine({ id: "MR_1X0", initial: "checking", states: { checking: { invoke: { id: "reqCheck", @@ -61,6 +58,9 @@ const appMachine = Machine({ }, }, mr_110: {}, mr_120: {}, mr_130: {}, }, }, }, @@ -105,13 +105,14 @@ const appMachine = Machine({ BACK: "mr_4X0.hist", NEXT: [ { target: "ms_110", cond: "notCorrectTime", }, { target: "#interview" }, ], }, }, ms_110: { after:{3500: {actions: send("RESET")}} }, mr_6X0: { initial: "mr_600", states: { @@ -147,7 +148,7 @@ const appMachine = Machine({ ms_prepare: { initial: "ms_100", states: { ms_100: { on: { NEXT: "ms_200" } }, ms_200: { on: { NEXT: "#interview.mc_1X0" } }, ms_300: { -
dsngo revised this gist
Aug 11, 2020 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -106,7 +106,7 @@ const appMachine = Machine({ NEXT: [ { target: "#interview.ms_prepare.ms_110", cond: "notCorrectTime", }, { target: "#interview" }, ], @@ -147,7 +147,7 @@ const appMachine = Machine({ ms_prepare: { initial: "ms_100", states: { ms_110: { after:{3500: "#verify"} }, ms_100: { on: { NEXT: "ms_200" } }, ms_200: { on: { NEXT: "#interview.mc_1X0" } }, ms_300: { @@ -235,6 +235,7 @@ const appMachine = Machine({ }, networkFail: (_, e) => e?.message == "Network is offline!", userMediaFail: (_, e) => e.name == "NotAllowedError", notCorrectTime: (_, e) => e.payload == "MS_110", rMR610:(_, e) => e?.payload == "MR_610", rMR620:(_, e) => e?.payload == "MR_620", rMR630:(_, e) => e?.payload == "MR_630",
NewerOlder