@genesislcap/design-system-configurator 14.197.0-ng.2 → 14.197.1-alpha-bd261ef.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{531.531.687984a744340415dd03.js → 531.531.43c274d35f64eaf57092.js} +2 -2
- package/dist/531.53e294f660c1f4abc11f72d50e2d41c0.js.map +1 -0
- package/dist/{designSystemConfigurator.283f3997e279fe286a9015c8007d9a3c.js.map → designSystemConfigurator.d43ecd13efd6df180e0c7ee4038b59d7.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/{main.1a0423a582598d0ee8f3.js → main.d686a50eeb5547184400.js} +2 -2
- package/dist/{main.e398d55bf70d58ae3059bdee69a20fc4.js.map → main.e432c01c8da1fa3ec73aa58643c31f13.js.map} +1 -1
- package/dist/remoteEntry.js +2 -2
- package/package.json +12 -12
- package/dist/531.92d2f29a0743f35894874721d1cf2bde.js.map +0 -1
|
@@ -2254,7 +2254,7 @@
|
|
|
2254
2254
|
${(0,n.endSlotTemplate)(e,t)}
|
|
2255
2255
|
</div>
|
|
2256
2256
|
</template>
|
|
2257
|
-
`;class Ks extends s.NumberField{constructor(){super(...arguments),this.hideStep=!1,this.value="",this.withFormatting=!1,this.locale="en-US",this.options={maximumFractionDigits:3,minimumFractionDigits:0}}autocompleteChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.autocomplete=this.autocomplete)}sanitiseInputVal(e){return String(new Ys(this.locale).parse(String(e)))}toIntlNumberFormat(e){return Intl.NumberFormat(this.locale,this.options).format(Number(e))}validateValue(e,t=!0){let o=parseFloat(parseFloat(t?this.sanitiseInputVal(e):e).toPrecision(12));return isNaN(o)&&(o=""),String(o)}validateMinMax(e,t=!0){var o,i;let a=parseFloat(this.validateValue(e,t));return isNaN(a)?a="":(a=Math.min(a,null!==(o=this.max)&&void 0!==o?o:a),a=Math.max(a,null!==(i=this.min)&&void 0!==i?i:a)),String(a)}stepUp(){const e=parseFloat(this.value),t=isNaN(e)?this.min>0?this.min:this.max<0?this.max:this.min?0:this.step:e+this.step;this.value=t.toString(),this.control.value=this.validateMinMax(t.toString(),this.withFormatting),this.handleTextInput()}stepDown(){const e=parseFloat(this.value),t=isNaN(e)?this.min>0?this.min:this.max<0?this.max:this.min?0:0-this.step:e-this.step;this.value=t.toString(),this.control.value=this.validateMinMax(t.toString(),this.withFormatting),this.handleTextInput()}hasSeparatorWithoutDecimals(){return new RegExp("[.]$")}handleTextInput(){this.isUserInput=!0,this.withFormatting&&!new Ys(this.locale).hasSeparator(this.control.value)?r.DOM.queueUpdate((()=>{const e=this.validateValue(this.control.value);this.control.value=this.toIntlNumberFormat(e),this.value=e,this.$emit("input")})):this.withFormatting||this.hasSeparatorWithoutDecimals().test(this.control.value)||r.DOM.queueUpdate((()=>{this.control.value=this.control.value.replace(/[^0-9\-+e.]/g,""),this.value=this.control.value,this.$emit("input")}))}valueChanged(e,t){if(null==t&&this.control)this.control.value="";else if(null!=t&&t!==e){if(!this.isUserInput)return this.value=this.withFormatting?this.validateMinMax(this.value):this.validateMinMax(this.value,!1),void r.DOM.queueUpdate((()=>{this.control.value=this.withFormatting&&this.value?this.toIntlNumberFormat(this.value):this.value}));const e=t;r.DOM.queueUpdate((()=>{var o;""!==(null===(o=this.control)||void 0===o?void 0:o.value)?""!==this.value?(this.control.value=this.withFormatting?this.toIntlNumberFormat(e):e,this.value=this.withFormatting?this.sanitiseInputVal(this.control.value):this.control.value):this.control.value=t:this.control.value=this.withFormatting?this.toIntlNumberFormat(e):e}))}}handleBlur(){this.isUserInput=!1,this.value=this.validateMinMax(this.control.value,this.withFormatting),this.control.value=this.withFormatting&&this.value?this.toIntlNumberFormat(this.value):this.value,this.$emit("input")}}(0,x.__decorate)([r.attr],Ks.prototype,"autocomplete",void 0),(0,x.__decorate)([(0,r.attr)({mode:"boolean"})],Ks.prototype,"hideStep",void 0),(0,x.__decorate)([r.attr],Ks.prototype,"value",void 0),(0,x.__decorate)([(0,r.attr)({mode:"boolean"})],Ks.prototype,"withFormatting",void 0),(0,x.__decorate)([r.attr],Ks.prototype,"locale",void 0);const Xs={delegatesFocus:!0,mode:"open"},Zs={stepDownGlyph:'\n <svg class="step-down-glyph" viewBox="0 0 24 24" width="1rem" height="1rem" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.1018 8C5.02785 8 4.45387 9.2649 5.16108 10.0731L10.6829 16.3838C11.3801 17.1806 12.6197 17.1806 13.3169 16.3838L18.8388 10.0731C19.5459 9.2649 18.972 8 17.898 8H6.1018Z"/>\n </svg>\n ',stepUpGlyph:'\n <svg class="step-up-glyph" viewBox="0 0 24 24" width="1rem" height="1rem" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.1018 16.9814C5.02785 16.9814 4.45387 15.7165 5.16108 14.9083L10.6829 8.59762C11.3801 7.80079 12.6197 7.80079 13.3169 8.59762L18.8388 14.9083C19.5459 15.7165 18.972 16.9814 17.898 16.9814H6.1018Z"/>\n </svg>\n '},Qs=Ks.compose(Object.assign({baseName:"number-field",template:qs,styles:Ws,shadowOptions:Xs},Zs));var Js=o(8202),er=o(92277);var tr=o(72154),or=o.n(tr),ir=o(57565),ar=o.n(ir),nr=o(13160),sr=o(24669),rr=o(5709),lr=o(45230);const dr={windowEvents:["online","offline","pageshow"],documentEvents:["visibilitychange"],genesisConnectEvents:["stream","commit"],ignoredGenesisResources:[],startDelay:5e3,checkInterval:1e4,checkTimeout:3e3,resourceChecks:e=>(0,Js.__awaiter)(void 0,void 0,void 0,(function*(){var t;const o=(0,ut.tn)(),i=yield o.getMoreColumns(e),a=Date.now(),n=i;return{isConnected:null!==(t=(null==i?void 0:i.MESSAGE_TYPE)===dt.Go.MORE_COLUMNS_ACK)&&void 0!==t&&t,lastUpdated:a,lastMessage:n}})),resourceDataLogon:({message:e,functions:t})=>{const{onMessage:o,onError:i}=t;(0,lr.Ol)().sendForStream(e,o,i)}},cr=n.DI.createInterface((e=>e.instance(dr))),ur="system-health-changed";var hr;const pr=(0,ie.createLogger)("network-monitor",{level:ie.LogLevel.Info}),mr=Date.now(),vr=(null===(hr=window.navigator)||void 0===hr?void 0:hr.userAgent)?or().parse(window.navigator.userAgent):void 0,gr=(e,t={depthLimit:10,edgesLimit:10})=>e instanceof Event?`'${e.type}' Event`:"string"==typeof e?e:ar()(e,void 0,2,t);class fr{constructor(){this.unsubscribableObservers=[],this.runAllChecks=(e,t)=>(0,Js.__awaiter)(this,void 0,void 0,(function*(){if(!this.isReady||this.isRunningChecks&&!t)return;pr.info("Run health checks, triggered by",gr(e),"| Active resources",this.resources.size),this.isRunningChecks=!0,this.synchroniseCheckInterval();let o=this.getFormattedTimestamp(this.getNowTimestamp());const i=yield this.isOnlineCheck();i?pr.debug(`Network connected at ${o}`):pr.warn(`Network disconnected at ${o}`);const a=this.normaliseSerializedSocketStatus(this.socketStatus.serialize(),i),n=this.preFlightSocketChecks(a);if(n||pr.debug("Socket pre-flight checks failed"),!i||!n){pr.debug("Aborting remaining health checks");const e=[...this.resources].reduce(((e,[t,o])=>{const a=e[o.resourceName];return a?(a.sourceRef=[...a.sourceRef,o.message.SOURCE_REF],e):Object.assign(Object.assign({},e),{[o.resourceName]:this.normaliseResourceHealth({name:o.resourceName,sourceRef:[o.message.SOURCE_REF],isConnected:o.isConnected,lastUpdated:o.lastUpdated},i)})}),{});return this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:i,resources:e,resourcesAllConnected:!1,socket:a}),void(this.isRunningChecks=!1)}let s=!0;const r=[];this.resources.forEach(((e,t)=>{const{resourceName:i,message:a,functions:n}=e,{resourceChecks:l=this.config.resourceChecks,resourceDataLogon:d=this.config.resourceDataLogon}=n,{SOURCE_REF:c}=a;let u,h,p,m,v,g=!1;r.push((()=>(0,Js.__awaiter)(this,void 0,void 0,(function*(){var a,n,r;try{pr.debug(`Running health check against ${i}`);const e=yield Promise.race([l(c,t),(n=this.config.checkTimeout,r=()=>({isConnected:!1,lastUpdated:this.getNowTimestamp(),timeout:!0}),new Promise((e=>{setTimeout((()=>{e(r())}),n)})))]);g=e.isConnected,u=e.lastUpdated,h=e.lastMessage,m=e.timeout}catch(e){g=!1,u=this.getNowTimestamp(),p=e,h=null!==(a=null==e?void 0:e.receivedMessage)&&void 0!==a?a:e}return v=(null==h?void 0:h.MESSAGE_TYPE)===dt.Go.MSG_NACK||(0,dt.z2)(h,nr.v.NOT_FOUND),o=this.getFormattedTimestamp(null!=u?u:this.getNowTimestamp()),g?pr.debug(`${i} is healthy at ${o}`):pr.warn(`${i} is not healthy at ${o}`),h&&pr.debug(`${i} messaged at ${o}`,gr(h)),p&&pr.error(`${i} errored at ${o}`,gr(p)),m&&pr.warn(`${i} timed out at ${o}`),v&&(pr.error(`${i} issue, re-attempting data logon at ${o}`),d(e)),s&&(s=g),{name:i,sourceRef:[c],isConnected:g,lastUpdated:u,lastError:p}})))())}));const l=(yield Promise.allSettled(r)).reduce(((e,t)=>{if("fulfilled"===t.status){const o=e[t.value.name];return o?(o.sourceRef=[...o.sourceRef,...t.value.sourceRef],e):Object.assign(Object.assign({},e),{[t.value.name]:this.normaliseResourceHealth(t.value)})}return pr.warn("Unexpected promise rejection occurred. Please check any custom resourceChecks return MonitoredResourceChecksResult."),e}),{});pr.debug("Health checks complete"),this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:i,resources:l,resourcesAllConnected:s,socket:a}),this.isRunningChecks=!1})),void 0!==this.config.logLevel&&(pr.level=this.config.logLevel)}create(){this.resources?pr.warn("NetworkMonitor already created. If this is intentional, please call NetworkMonitor.destroy first."):(this.addListeners(),this.resources=new Map,setTimeout((()=>{this.isReady=!0,this.synchroniseCheckInterval(),this.runAllChecks("NetworkMonitor.create()")}),this.config.startDelay))}destroy(){this.removeListeners(),clearInterval(this.internalId),this.resources.clear(),this.resources=void 0,this.status=void 0,this.isReady=void 0}isOnlineCheck(){return Promise.resolve(navigator.onLine)}addResource(e,t){this.resources||this.create(),this.resources.set(e,t)}removeResource(e){this.resources.delete(e)}addListeners(){var e,t;null===(e=this.config.windowEvents)||void 0===e||e.forEach((e=>window.addEventListener(e,this.runAllChecks))),null===(t=this.config.documentEvents)||void 0===t||t.forEach((e=>document.addEventListener(e,this.runAllChecks))),this.config.genesisConnectEvents.includes("stream")&&this.unsubscribableObservers.push(this.connectEvents.addStreamListener((({detail:e})=>{const{functions:t,message:o,resourceName:i,stream:a}=e;this.config.ignoredGenesisResources.includes(i)||this.addResource(a,{functions:t,message:o,resourceName:i})}),(({detail:e})=>{const{resourceName:t,stream:o}=e;this.config.ignoredGenesisResources.includes(t)||this.removeResource(o)}),(({detail:e})=>{var t;const{resourceName:o,stream:i,error:a}=e,n=null!==(t=a.receivedMessage)&&void 0!==t?t:a;let s="";(0,dt.z2)(n,nr.v.NOT_FOUND)?s="Please check the resource is running.":(0,dt.z2)(n,nr.v.FORBIDDEN)&&(s="You are not authorised to access this resource, removing it from monitoring.",this.removeResource(i)),pr.error(`${o} errored at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,s,a)}))),this.config.genesisConnectEvents.includes("commit")&&this.unsubscribableObservers.push(this.connectEvents.addCommitListener((e=>{this.config.ignoredGenesisResources.includes(e.detail.eventName)||this.runAllChecks(e)}))),this.unsubscribableObservers.push(this.connectEvents.addMetadataListener((({detail:e})=>{const{resourceName:t,error:o}=e;o&&pr.error(`${t} had an unrecoverable error at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,"Please check the resource is running.",o)})))}removeListeners(){var e,t;null===(e=this.config.windowEvents)||void 0===e||e.forEach((e=>window.removeEventListener(e,this.runAllChecks))),null===(t=this.config.documentEvents)||void 0===t||t.forEach((e=>document.removeEventListener(e,this.runAllChecks))),this.unsubscribableObservers.forEach((e=>e())),this.unsubscribableObservers.length=0}reportSystemHealth(e){var t;const o=null!==(t=this.config.eventEmitter)&&void 0!==t?t:document;this.status=this.normaliseEventDetail(e);(this.status.isHealthy?pr.debug:pr.warn)("Emitting 'system-health-changed' event",gr(this.status)),null==o||o.dispatchEvent(new CustomEvent(ur,{detail:this.status,bubbles:o!==document,composed:!0})),this.status.socket.reconnectionLimitReached&&(pr.debug("Network monitoring no longer required. Please check your network and reload your application."),this.destroy())}reportStabilityToGenesis(e){return(0,Js.__awaiter)(this,void 0,void 0,(function*(){return pr.debug("User requested report stability to Genesis."),pr.info("Please attach this data to your Genesis Support request: \n",JSON.stringify(e,null,2)),!0}))}normaliseResourceHealth(e,t=!0){var o;const i=!!t&&e.isConnected,a=null!==(o=e.lastUpdated)&&void 0!==o?o:this.getNowTimestamp();return Object.assign(Object.assign({},e),{isConnected:i,lastUpdated:a})}normaliseSerializedSocketStatus(e,t=!0){const o=!!t&&e.isConnected,i=!o;return Object.assign(Object.assign({},e),{isConnected:o,isDisconnected:i})}normaliseEventDetail(e){var t,o,i,a;const n=!!((null===(t=e.socket)||void 0===t?void 0:t.isConfigured)?e.isOnline&&(null===(o=e.socket)||void 0===o?void 0:o.isConnected)&&e.resourcesAllConnected:e.isOnline),s=null!==(i=e.lastUpdated)&&void 0!==i?i:this.getNowTimestamp(),r=null!==(a=e.nextUpdate)&&void 0!==a?a:this.getNextTimestamp(),l=e.isAuthenticated&&this.user?this.user.username:void 0,d=Object.assign(Object.assign({},e),{browserInformation:vr,username:l,isHealthy:n,lastUpdated:s,nextUpdate:r,firstUpdated:mr,runAllChecks:()=>{pr.debug("User activated run checks command starting."),this.runAllChecks("user requested")},reportStabilityToGenesis:()=>this.reportStabilityToGenesis(d)});return d}preFlightSocketChecks(e){if(!e.isConfigured)return pr.debug("Socket not configured"),!1;if(e.isReconnecting)return pr.debug("Socket reconnecting"),!1;if(e.isConnecting)return pr.debug("Socket connecting"),!1;if(e.isDisconnected){const t=e.isDisconnectedByServer?`by the server, code: ${e.closedCode}, reason: ${e.closedReason}`:"";return pr.debug(`Socket disconnected ${t}`),e.reconnectionLimitReached&&pr.debug("Socket reconnection limit reached"),!1}const t=this.user.isAuthenticated?"with":"without";return pr.debug(`Socket connected ${t} valid session`),!0}getFormattedTimestamp(e){return(0,ma.zT)(e)}getNowTimestamp(){return Date.now()}getNextTimestamp(){return new Date(Date.now()+this.config.checkInterval).getTime()}synchroniseCheckInterval(){clearInterval(this.internalId),this.internalId=setInterval((()=>this.runAllChecks("check interval")),this.config.checkInterval)}}(0,Js.__decorate)([cr],fr.prototype,"config",void 0),(0,Js.__decorate)([rr.S5],fr.prototype,"socketStatus",void 0),(0,Js.__decorate)([sr.a4],fr.prototype,"connectEvents",void 0),(0,Js.__decorate)([er.KJ],fr.prototype,"user",void 0),(0,Js.__decorate)([r.observable],fr.prototype,"status",void 0);const br=n.DI.createInterface((e=>e.singleton(fr)));var yr=o(6526);const xr=(e,t)=>r.css`
|
|
2257
|
+
`;class Ks extends s.NumberField{constructor(){super(...arguments),this.hideStep=!1,this.value="",this.withFormatting=!1,this.locale="en-US",this.options={maximumFractionDigits:3,minimumFractionDigits:0}}autocompleteChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.autocomplete=this.autocomplete)}sanitiseInputVal(e){return String(new Ys(this.locale).parse(String(e)))}toIntlNumberFormat(e){return Intl.NumberFormat(this.locale,this.options).format(Number(e))}validateValue(e,t=!0){let o=parseFloat(parseFloat(t?this.sanitiseInputVal(e):e).toPrecision(12));return isNaN(o)&&(o=""),String(o)}validateMinMax(e,t=!0){var o,i;let a=parseFloat(this.validateValue(e,t));return isNaN(a)?a="":(a=Math.min(a,null!==(o=this.max)&&void 0!==o?o:a),a=Math.max(a,null!==(i=this.min)&&void 0!==i?i:a)),String(a)}stepUp(){const e=parseFloat(this.value),t=isNaN(e)?this.min>0?this.min:this.max<0?this.max:this.min?0:this.step:e+this.step;this.value=t.toString(),this.control.value=this.validateMinMax(t.toString(),this.withFormatting),this.handleTextInput()}stepDown(){const e=parseFloat(this.value),t=isNaN(e)?this.min>0?this.min:this.max<0?this.max:this.min?0:0-this.step:e-this.step;this.value=t.toString(),this.control.value=this.validateMinMax(t.toString(),this.withFormatting),this.handleTextInput()}hasSeparatorWithoutDecimals(){return new RegExp("[.]$")}handleTextInput(){"-"!==this.control.value&&(this.isUserInput=!0,this.withFormatting&&!new Ys(this.locale).hasSeparator(this.control.value)?r.DOM.queueUpdate((()=>{const e=this.validateValue(this.control.value);this.control.value=this.toIntlNumberFormat(e),this.value=e,this.$emit("input")})):this.withFormatting||this.hasSeparatorWithoutDecimals().test(this.control.value)||r.DOM.queueUpdate((()=>{this.control.value=this.control.value.replace(/[^0-9\-+e.]/g,""),this.value=this.control.value,this.$emit("input")})))}valueChanged(e,t){if(null==t&&this.control)this.control.value="";else if(null!=t&&t!==e){if(!this.isUserInput)return this.value=this.withFormatting?this.validateMinMax(this.value):this.validateMinMax(this.value,!1),void r.DOM.queueUpdate((()=>{this.control.value=this.withFormatting&&this.value?this.toIntlNumberFormat(this.value):this.value}));const e=t;r.DOM.queueUpdate((()=>{var o;""!==(null===(o=this.control)||void 0===o?void 0:o.value)?""!==this.value?(this.control.value=this.withFormatting?this.toIntlNumberFormat(e):e,this.value=this.withFormatting?this.sanitiseInputVal(this.control.value):this.control.value):this.control.value=t:this.control.value=this.withFormatting?this.toIntlNumberFormat(e):e}))}}handleBlur(){this.isUserInput=!1,this.value=this.validateMinMax(this.control.value,this.withFormatting),this.control.value=this.withFormatting&&this.value?this.toIntlNumberFormat(this.value):this.value,this.$emit("input")}}(0,x.__decorate)([r.attr],Ks.prototype,"autocomplete",void 0),(0,x.__decorate)([(0,r.attr)({mode:"boolean"})],Ks.prototype,"hideStep",void 0),(0,x.__decorate)([r.attr],Ks.prototype,"value",void 0),(0,x.__decorate)([(0,r.attr)({mode:"boolean"})],Ks.prototype,"withFormatting",void 0),(0,x.__decorate)([r.attr],Ks.prototype,"locale",void 0);const Xs={delegatesFocus:!0,mode:"open"},Zs={stepDownGlyph:'\n <svg class="step-down-glyph" viewBox="0 0 24 24" width="1rem" height="1rem" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.1018 8C5.02785 8 4.45387 9.2649 5.16108 10.0731L10.6829 16.3838C11.3801 17.1806 12.6197 17.1806 13.3169 16.3838L18.8388 10.0731C19.5459 9.2649 18.972 8 17.898 8H6.1018Z"/>\n </svg>\n ',stepUpGlyph:'\n <svg class="step-up-glyph" viewBox="0 0 24 24" width="1rem" height="1rem" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.1018 16.9814C5.02785 16.9814 4.45387 15.7165 5.16108 14.9083L10.6829 8.59762C11.3801 7.80079 12.6197 7.80079 13.3169 8.59762L18.8388 14.9083C19.5459 15.7165 18.972 16.9814 17.898 16.9814H6.1018Z"/>\n </svg>\n '},Qs=Ks.compose(Object.assign({baseName:"number-field",template:qs,styles:Ws,shadowOptions:Xs},Zs));var Js=o(8202),er=o(92277);var tr=o(72154),or=o.n(tr),ir=o(57565),ar=o.n(ir),nr=o(13160),sr=o(24669),rr=o(5709),lr=o(45230);const dr={windowEvents:["online","offline","pageshow"],documentEvents:["visibilitychange"],genesisConnectEvents:["stream","commit"],ignoredGenesisResources:[],startDelay:5e3,checkInterval:1e4,checkTimeout:3e3,resourceChecks:e=>(0,Js.__awaiter)(void 0,void 0,void 0,(function*(){var t;const o=(0,ut.tn)(),i=yield o.getMoreColumns(e),a=Date.now(),n=i;return{isConnected:null!==(t=(null==i?void 0:i.MESSAGE_TYPE)===dt.Go.MORE_COLUMNS_ACK)&&void 0!==t&&t,lastUpdated:a,lastMessage:n}})),resourceDataLogon:({message:e,functions:t})=>{const{onMessage:o,onError:i}=t;(0,lr.Ol)().sendForStream(e,o,i)}},cr=n.DI.createInterface((e=>e.instance(dr))),ur="system-health-changed";var hr;const pr=(0,ie.createLogger)("network-monitor",{level:ie.LogLevel.Info}),mr=Date.now(),vr=(null===(hr=window.navigator)||void 0===hr?void 0:hr.userAgent)?or().parse(window.navigator.userAgent):void 0,gr=(e,t={depthLimit:10,edgesLimit:10})=>e instanceof Event?`'${e.type}' Event`:"string"==typeof e?e:ar()(e,void 0,2,t);class fr{constructor(){this.unsubscribableObservers=[],this.runAllChecks=(e,t)=>(0,Js.__awaiter)(this,void 0,void 0,(function*(){if(!this.isReady||this.isRunningChecks&&!t)return;pr.info("Run health checks, triggered by",gr(e),"| Active resources",this.resources.size),this.isRunningChecks=!0,this.synchroniseCheckInterval();let o=this.getFormattedTimestamp(this.getNowTimestamp());const i=yield this.isOnlineCheck();i?pr.debug(`Network connected at ${o}`):pr.warn(`Network disconnected at ${o}`);const a=this.normaliseSerializedSocketStatus(this.socketStatus.serialize(),i),n=this.preFlightSocketChecks(a);if(n||pr.debug("Socket pre-flight checks failed"),!i||!n){pr.debug("Aborting remaining health checks");const e=[...this.resources].reduce(((e,[t,o])=>{const a=e[o.resourceName];return a?(a.sourceRef=[...a.sourceRef,o.message.SOURCE_REF],e):Object.assign(Object.assign({},e),{[o.resourceName]:this.normaliseResourceHealth({name:o.resourceName,sourceRef:[o.message.SOURCE_REF],isConnected:o.isConnected,lastUpdated:o.lastUpdated},i)})}),{});return this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:i,resources:e,resourcesAllConnected:!1,socket:a}),void(this.isRunningChecks=!1)}let s=!0;const r=[];this.resources.forEach(((e,t)=>{const{resourceName:i,message:a,functions:n}=e,{resourceChecks:l=this.config.resourceChecks,resourceDataLogon:d=this.config.resourceDataLogon}=n,{SOURCE_REF:c}=a;let u,h,p,m,v,g=!1;r.push((()=>(0,Js.__awaiter)(this,void 0,void 0,(function*(){var a,n,r;try{pr.debug(`Running health check against ${i}`);const e=yield Promise.race([l(c,t),(n=this.config.checkTimeout,r=()=>({isConnected:!1,lastUpdated:this.getNowTimestamp(),timeout:!0}),new Promise((e=>{setTimeout((()=>{e(r())}),n)})))]);g=e.isConnected,u=e.lastUpdated,h=e.lastMessage,m=e.timeout}catch(e){g=!1,u=this.getNowTimestamp(),p=e,h=null!==(a=null==e?void 0:e.receivedMessage)&&void 0!==a?a:e}return v=(null==h?void 0:h.MESSAGE_TYPE)===dt.Go.MSG_NACK||(0,dt.z2)(h,nr.v.NOT_FOUND),o=this.getFormattedTimestamp(null!=u?u:this.getNowTimestamp()),g?pr.debug(`${i} is healthy at ${o}`):pr.warn(`${i} is not healthy at ${o}`),h&&pr.debug(`${i} messaged at ${o}`,gr(h)),p&&pr.error(`${i} errored at ${o}`,gr(p)),m&&pr.warn(`${i} timed out at ${o}`),v&&(pr.error(`${i} issue, re-attempting data logon at ${o}`),d(e)),s&&(s=g),{name:i,sourceRef:[c],isConnected:g,lastUpdated:u,lastError:p}})))())}));const l=(yield Promise.allSettled(r)).reduce(((e,t)=>{if("fulfilled"===t.status){const o=e[t.value.name];return o?(o.sourceRef=[...o.sourceRef,...t.value.sourceRef],e):Object.assign(Object.assign({},e),{[t.value.name]:this.normaliseResourceHealth(t.value)})}return pr.warn("Unexpected promise rejection occurred. Please check any custom resourceChecks return MonitoredResourceChecksResult."),e}),{});pr.debug("Health checks complete"),this.reportSystemHealth({isAuthenticated:this.user.isAuthenticated,isOnline:i,resources:l,resourcesAllConnected:s,socket:a}),this.isRunningChecks=!1})),void 0!==this.config.logLevel&&(pr.level=this.config.logLevel)}create(){this.resources?pr.warn("NetworkMonitor already created. If this is intentional, please call NetworkMonitor.destroy first."):(this.addListeners(),this.resources=new Map,setTimeout((()=>{this.isReady=!0,this.synchroniseCheckInterval(),this.runAllChecks("NetworkMonitor.create()")}),this.config.startDelay))}destroy(){this.removeListeners(),clearInterval(this.internalId),this.resources.clear(),this.resources=void 0,this.status=void 0,this.isReady=void 0}isOnlineCheck(){return Promise.resolve(navigator.onLine)}addResource(e,t){this.resources||this.create(),this.resources.set(e,t)}removeResource(e){this.resources.delete(e)}addListeners(){var e,t;null===(e=this.config.windowEvents)||void 0===e||e.forEach((e=>window.addEventListener(e,this.runAllChecks))),null===(t=this.config.documentEvents)||void 0===t||t.forEach((e=>document.addEventListener(e,this.runAllChecks))),this.config.genesisConnectEvents.includes("stream")&&this.unsubscribableObservers.push(this.connectEvents.addStreamListener((({detail:e})=>{const{functions:t,message:o,resourceName:i,stream:a}=e;this.config.ignoredGenesisResources.includes(i)||this.addResource(a,{functions:t,message:o,resourceName:i})}),(({detail:e})=>{const{resourceName:t,stream:o}=e;this.config.ignoredGenesisResources.includes(t)||this.removeResource(o)}),(({detail:e})=>{var t;const{resourceName:o,stream:i,error:a}=e,n=null!==(t=a.receivedMessage)&&void 0!==t?t:a;let s="";(0,dt.z2)(n,nr.v.NOT_FOUND)?s="Please check the resource is running.":(0,dt.z2)(n,nr.v.FORBIDDEN)&&(s="You are not authorised to access this resource, removing it from monitoring.",this.removeResource(i)),pr.error(`${o} errored at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,s,a)}))),this.config.genesisConnectEvents.includes("commit")&&this.unsubscribableObservers.push(this.connectEvents.addCommitListener((e=>{this.config.ignoredGenesisResources.includes(e.detail.eventName)||this.runAllChecks(e)}))),this.unsubscribableObservers.push(this.connectEvents.addMetadataListener((({detail:e})=>{const{resourceName:t,error:o}=e;o&&pr.error(`${t} had an unrecoverable error at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`,"Please check the resource is running.",o)})))}removeListeners(){var e,t;null===(e=this.config.windowEvents)||void 0===e||e.forEach((e=>window.removeEventListener(e,this.runAllChecks))),null===(t=this.config.documentEvents)||void 0===t||t.forEach((e=>document.removeEventListener(e,this.runAllChecks))),this.unsubscribableObservers.forEach((e=>e())),this.unsubscribableObservers.length=0}reportSystemHealth(e){var t;const o=null!==(t=this.config.eventEmitter)&&void 0!==t?t:document;this.status=this.normaliseEventDetail(e);(this.status.isHealthy?pr.debug:pr.warn)("Emitting 'system-health-changed' event",gr(this.status)),null==o||o.dispatchEvent(new CustomEvent(ur,{detail:this.status,bubbles:o!==document,composed:!0})),this.status.socket.reconnectionLimitReached&&(pr.debug("Network monitoring no longer required. Please check your network and reload your application."),this.destroy())}reportStabilityToGenesis(e){return(0,Js.__awaiter)(this,void 0,void 0,(function*(){return pr.debug("User requested report stability to Genesis."),pr.info("Please attach this data to your Genesis Support request: \n",JSON.stringify(e,null,2)),!0}))}normaliseResourceHealth(e,t=!0){var o;const i=!!t&&e.isConnected,a=null!==(o=e.lastUpdated)&&void 0!==o?o:this.getNowTimestamp();return Object.assign(Object.assign({},e),{isConnected:i,lastUpdated:a})}normaliseSerializedSocketStatus(e,t=!0){const o=!!t&&e.isConnected,i=!o;return Object.assign(Object.assign({},e),{isConnected:o,isDisconnected:i})}normaliseEventDetail(e){var t,o,i,a;const n=!!((null===(t=e.socket)||void 0===t?void 0:t.isConfigured)?e.isOnline&&(null===(o=e.socket)||void 0===o?void 0:o.isConnected)&&e.resourcesAllConnected:e.isOnline),s=null!==(i=e.lastUpdated)&&void 0!==i?i:this.getNowTimestamp(),r=null!==(a=e.nextUpdate)&&void 0!==a?a:this.getNextTimestamp(),l=e.isAuthenticated&&this.user?this.user.username:void 0,d=Object.assign(Object.assign({},e),{browserInformation:vr,username:l,isHealthy:n,lastUpdated:s,nextUpdate:r,firstUpdated:mr,runAllChecks:()=>{pr.debug("User activated run checks command starting."),this.runAllChecks("user requested")},reportStabilityToGenesis:()=>this.reportStabilityToGenesis(d)});return d}preFlightSocketChecks(e){if(!e.isConfigured)return pr.debug("Socket not configured"),!1;if(e.isReconnecting)return pr.debug("Socket reconnecting"),!1;if(e.isConnecting)return pr.debug("Socket connecting"),!1;if(e.isDisconnected){const t=e.isDisconnectedByServer?`by the server, code: ${e.closedCode}, reason: ${e.closedReason}`:"";return pr.debug(`Socket disconnected ${t}`),e.reconnectionLimitReached&&pr.debug("Socket reconnection limit reached"),!1}const t=this.user.isAuthenticated?"with":"without";return pr.debug(`Socket connected ${t} valid session`),!0}getFormattedTimestamp(e){return(0,ma.zT)(e)}getNowTimestamp(){return Date.now()}getNextTimestamp(){return new Date(Date.now()+this.config.checkInterval).getTime()}synchroniseCheckInterval(){clearInterval(this.internalId),this.internalId=setInterval((()=>this.runAllChecks("check interval")),this.config.checkInterval)}}(0,Js.__decorate)([cr],fr.prototype,"config",void 0),(0,Js.__decorate)([rr.S5],fr.prototype,"socketStatus",void 0),(0,Js.__decorate)([sr.a4],fr.prototype,"connectEvents",void 0),(0,Js.__decorate)([er.KJ],fr.prototype,"user",void 0),(0,Js.__decorate)([r.observable],fr.prototype,"status",void 0);const br=n.DI.createInterface((e=>e.singleton(fr)));var yr=o(6526);const xr=(e,t)=>r.css`
|
|
2258
2258
|
${(0,s.progressStyles)(e,t)}
|
|
2259
2259
|
:host {
|
|
2260
2260
|
height: calc(var(--design-unit) * 2px);
|
|
@@ -3783,4 +3783,4 @@
|
|
|
3783
3783
|
<slot></slot>
|
|
3784
3784
|
</template>
|
|
3785
3785
|
`;var mu;!function(e){e.NOTIFICATION_EVENT="notification-event"}(mu||(mu={}));const vu={mode:"open",delegatesFocus:!0};class gu extends n.FoundationElement{constructor(){super(...arguments),this.closeTimeout=0,this.toastButtons=[]}connectedCallback(){const e=Object.create(null,{connectedCallback:{get:()=>super.connectedCallback}});var t;return(0,x.__awaiter)(this,void 0,void 0,(function*(){if(e.connectedCallback.call(this),this.addEventListener(mu.NOTIFICATION_EVENT,(e=>{e.stopImmediatePropagation(),Fa(e.detail,this.tagName,this.notificationListener)})),this.resourceName){if(!(yield this.datasource.init({resourceName:this.resourceName},!0)))return void ae.debug(`Genesis Datasource init failed for ${this.resourceName}`);this.dataSub=null===(t=this.datasource.stream)||void 0===t?void 0:t.subscribe((e=>{e.ROW&&e.SEQUENCE_ID>1&&this.handleStreamUpdate((0,ct.d)(e))}))}}))}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(e=this.dataSub)||void 0===e||e.unsubscribe(),delete this.dataSub,null===(t=this.datasource)||void 0===t||t.destroy(),delete this.datasource}handleStreamUpdate(e){const t=e.inserts;t.length>0&&t.forEach((e=>{this.showNotificationToast(e)}))}showNotificationToast(e){const{HEADER:t,MESSAGE:o,NOTIFY_SEVERITY:i}=e,a=e.CREATED_AT?new Date(e.CREATED_AT):void 0,n=e.EXPIRY?e.EXPIRY-e.CREATED_AT:void 0;let s=[];this.toastButtons&&this.toastButtons.length>0&&(s=this.toastButtons.filter((({condition:t})=>!t||t({details:e}))));((e,t,o)=>{if(!e.title)throw new Error("Title is required");if(!e.body)throw new Error("Missing required param 'body'");let i={title:e.title,body:e.body},a={};e.createdAt&&(i=Object.assign({createdAt:e.createdAt},i)),e.logLevel in ie.LogLevel&&(i=Object.assign({logLevel:e.logLevel},i)),e.toast&&(a=Object.assign({toast:e.toast},a),i=Object.assign({config:a},i)),Ca(i,t,o)})({title:t,body:o,createdAt:a,toast:{details:e,type:null==i?void 0:i.toLowerCase(),buttons:s,autoClose:void 0!==n?!!n:!!this.closeTimeout,closeTimeout:null!=n?n:this.closeTimeout}},this.tagName)}}(0,x.__decorate)([r.observable],gu.prototype,"notificationListener",void 0),(0,x.__decorate)([(0,r.attr)({attribute:"resource-name"})],gu.prototype,"resourceName",void 0),(0,x.__decorate)([(0,r.attr)({attribute:"close-timeout",converter:r.nullableNumberConverter})],gu.prototype,"closeTimeout",void 0),(0,x.__decorate)([r.observable],gu.prototype,"toastButtons",void 0),(0,x.__decorate)([ht.yW],gu.prototype,"datasource",void 0);const fu=gu.compose({baseName:"notification-listener",template:pu,shadowOptions:vu}),bu=(e,t)=>o=>{const i="function"==typeof t?t:(a=t,e=>Object.assign(Object.assign({},a),e));var a;return r.FASTElement.define(class extends e{},i(o))};function yu(e){if("string"==typeof e)return e;if("function"==typeof e&&!(e=r.FASTElementDefinition.forType(e)))throw new Error("Missing FASTElement definition.");return e.name}const xu=e=>!e.navId||"header"===e.navId,wu=10;function $u(e,t=xu,o=wu){const i=[];return e.filter((e=>e.navItems&&e.navItems.some(t))).forEach(((e,a)=>{e.navItems.filter(t).map(((t,i)=>{var n,s,r,l;const d=null!==(n=t.placementIndex)&&void 0!==n?n:a*o+i;return Object.assign(Object.assign({},t),{navId:null!==(s=t.navId)&&void 0!==s?s:"header",placementIndex:d,routePath:null!==(r=t.routePath)&&void 0!==r?r:e.path,routeName:null!==(l=t.routeName)&&void 0!==l?l:e.name})})).forEach((e=>i.push(e)))})),i.sort(((e,t)=>e.placementIndex-t.placementIndex))}var Su,Cu=o(63734);!function(e){e.controlClicked="controlClicked",e.routeChanged="routeChanged"}(Su||(Su={}));class ku{constructor(e){this.analytics=(0,Cu.Ay)(e)}trackEvent(e,t){pa.v.debug(`FoundationAnalytics.trackEvent ${e} : ${JSON.stringify(t)}`),this.analytics.track(e,t)}}const Fu=n.DI.createInterface((e=>e.singleton(ku)));var _u=o(3479),Ou=o(80751),Du=o(98647);let Tu=class extends(_u.Ix.from(r.FASTElement)){connectedCallback(){super.connectedCallback(),r.DOM.queueUpdate((()=>(0,x.__awaiter)(this,void 0,void 0,(function*(){this.$router.config=this.config}))))}};Tu=(0,x.__decorate)([(0,r.customElement)({name:"foundation-router"})],Tu);class Lu extends Ou.s{constructor(){super(...arguments),this.definitions=[]}map(...e){this.definitions=[...e,...this.definitions],super.map(...e)}}(0,x.__decorate)([r.observable],Lu.prototype,"definitions",void 0);class Eu extends Du.Y{constructor(){super(...arguments),this.routes=new Lu(this)}getNavItems(e=xu){return $u(this.routes.definitions,e)}configureAnalytics(){this.contributors.push({navigate:e=>(0,x.__awaiter)(this,void 0,void 0,(function*(){this.analytics.trackEvent(Su.routeChanged,{path:e.route.endpoint.path})}))})}construct(e){return this.container.get(e)}}(0,x.__decorate)([n.Container],Eu.prototype,"container",void 0),(0,x.__decorate)([Fu],Eu.prototype,"analytics",void 0),(0,x.__decorate)([er.KJ],Eu.prototype,"user",void 0);const Au=()=>_r().register(cu)}}]);
|
|
3786
|
-
//# sourceMappingURL=531.
|
|
3786
|
+
//# sourceMappingURL=531.53e294f660c1f4abc11f72d50e2d41c0.js.map
|