@flipdish/portal-library 1.0.3 → 1.0.4
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/components/index.d.ts +0 -1
- package/dist/components/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/ui/FDErrorBoundary/FDErrorBoundary.d.ts +0 -9
- package/dist/components/ui/FDErrorBoundary/FDErrorBoundary.js +0 -2
- package/dist/components/ui/FDErrorBoundary/FDErrorBoundary.js.map +0 -1
- package/dist/node_modules/.pnpm/react-error-boundary@4.1.1_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.esm.js +0 -2
- package/dist/node_modules/.pnpm/react-error-boundary@4.1.1_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.esm.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as flipdishPublicTheme } from './themes/flipdishPublicTheme.js';
|
|
2
2
|
export { default as NotFoundPage } from './ui/NotFoundPage/NotFoundPage.js';
|
|
3
|
-
export { default as FDErrorBoundary } from './ui/FDErrorBoundary/FDErrorBoundary.js';
|
|
4
3
|
export { default as PortalMock } from './ui/PortalMock/PortalMock.js';
|
|
5
4
|
export { default as LazyComponent } from './ui/LazyComponent/LazyComponent.js';
|
|
6
5
|
export { default as Spacer } from './ui/Spacer/Spacer.js';
|
package/dist/components/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as
|
|
1
|
+
export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as PortalMock}from"./ui/PortalMock/PortalMock.js";export{default as LazyComponent}from"./ui/LazyComponent/LazyComponent.js";export{default as Spacer}from"./ui/Spacer/Spacer.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
declare const FDErrorBoundary: ({ identifier, children }: {
|
|
5
|
-
identifier: string;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
8
|
-
|
|
9
|
-
export { FDErrorBoundary as default };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{ErrorBoundary as r}from"../../../node_modules/.pnpm/react-error-boundary@4.1.1_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.esm.js";import{useTranslation as o}from"../../../providers/TranslationProvider.js";import t from"../../../node_modules/.pnpm/@mui_material@5.16.7_@emotion_react@11.13.3_@types_react@18.3.11_react@18.3.1__@emotion_style_oc5snlirzewyt2bjqzs6ppevzu/node_modules/@mui/material/styles/styled.js";const n=t("div")((({theme:e})=>({marginTop:e.spacing(2),display:"flex",justifyContent:"center",alignItems:"center"}))),s=({identifier:t,children:s})=>{const{translate:a}=o();return e(r,{FallbackComponent:()=>e(n,{children:a("Something_went_wrong_please_refresh_the_page")}),onError:(e,r)=>{window.fdlogger?.error(`${t?.toString()} Error Boundary`,{message:e?.message,stack:r})},children:s})};export{s as default};
|
|
2
|
-
//# sourceMappingURL=FDErrorBoundary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FDErrorBoundary.js","sources":["../../../../src/components/ui/FDErrorBoundary/FDErrorBoundary.tsx"],"sourcesContent":["import { ErrorBoundary } from 'react-error-boundary';\nimport { useTranslation } from '../../../providers/TranslationProvider';\nimport { ReactNode } from 'react';\nimport { styled } from '@mui/material/styles';\n\nconst StyledTextContainer = styled('div')(({ theme }) => ({\n marginTop: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}));\n\nconst FDErrorBoundary = ({ identifier, children }: { identifier: string; children: ReactNode }) => {\n const { translate } = useTranslation();\n return (\n <ErrorBoundary\n FallbackComponent={() => <StyledTextContainer>{translate('Something_went_wrong_please_refresh_the_page')}</StyledTextContainer>}\n onError={(error, info) => {\n window.fdlogger?.error(`${identifier?.toString()} Error Boundary`, {\n message: error?.message,\n stack: info,\n });\n }}\n >\n {children}\n </ErrorBoundary>\n );\n};\n\nexport default FDErrorBoundary;\n"],"names":["StyledTextContainer","styled","theme","marginTop","spacing","display","justifyContent","alignItems","FDErrorBoundary","identifier","children","translate","useTranslation","_jsx","ErrorBoundary","FallbackComponent","onError","error","info","window","fdlogger","toString","message","stack"],"mappings":"0eAKA,MAAMA,EAAsBC,EAAO,MAAPA,EAAc,EAAGC,YAAa,CACtDC,UAAWD,EAAME,QAAQ,GACzBC,QAAS,OACTC,eAAgB,SAChBC,WAAY,aAGVC,EAAkB,EAAGC,aAAYC,eACnC,MAAMC,UAAEA,GAAcC,IACtB,OACIC,EAACC,EACG,CAAAC,kBAAmB,IAAMF,EAACb,EAAmB,CAAAU,SAAEC,EAAU,kDACzDK,QAAS,CAACC,EAAOC,KACbC,OAAOC,UAAUH,MAAM,GAAGR,GAAYY,4BAA6B,CAC/DC,QAASL,GAAOK,QAChBC,MAAOL,GACT,EAGLR,SAAAA,GAEP"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createContext as r,Component as e,createElement as t}from"react";const o=r(null),s={didCatch:!1,error:null};class n extends e{constructor(r){super(r),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=s}static getDerivedStateFromError(r){return{didCatch:!0,error:r}}resetErrorBoundary(){const{error:r}=this.state;if(null!==r){for(var e,t,o=arguments.length,n=new Array(o),i=0;i<o;i++)n[i]=arguments[i];null===(e=(t=this.props).onReset)||void 0===e||e.call(t,{args:n,reason:"imperative-api"}),this.setState(s)}}componentDidCatch(r,e){var t,o;null===(t=(o=this.props).onError)||void 0===t||t.call(o,r,e)}componentDidUpdate(r,e){const{didCatch:t}=this.state,{resetKeys:o}=this.props;var n,i;t&&null!==e.error&&function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return r.length!==e.length||r.some(((r,t)=>!Object.is(r,e[t])))}(r.resetKeys,o)&&(null===(n=(i=this.props).onReset)||void 0===n||n.call(i,{next:o,prev:r.resetKeys,reason:"keys"}),this.setState(s))}render(){const{children:r,fallbackRender:e,FallbackComponent:s,fallback:n}=this.props,{didCatch:i,error:a}=this.state;let l=r;if(i){const r={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof e)l=e(r);else if(s)l=t(s,r);else{if(void 0===n)throw a;l=n}}return t(o.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},l)}}export{n as ErrorBoundary,o as ErrorBoundaryContext};
|
|
2
|
-
//# sourceMappingURL=react-error-boundary.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-error-boundary.esm.js","sources":["../../../../../../../../../node_modules/.pnpm/react-error-boundary@4.1.1_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.esm.js"],"sourcesContent":["'use client';\nimport { createContext, Component, createElement, useContext, useState, useMemo, forwardRef } from 'react';\n\nconst ErrorBoundaryContext = createContext(null);\n\nconst initialState = {\n didCatch: false,\n error: null\n};\nclass ErrorBoundary extends Component {\n constructor(props) {\n super(props);\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n this.state = initialState;\n }\n static getDerivedStateFromError(error) {\n return {\n didCatch: true,\n error\n };\n }\n resetErrorBoundary() {\n const {\n error\n } = this.state;\n if (error !== null) {\n var _this$props$onReset, _this$props;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props, {\n args,\n reason: \"imperative-api\"\n });\n this.setState(initialState);\n }\n }\n componentDidCatch(error, info) {\n var _this$props$onError, _this$props2;\n (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);\n }\n componentDidUpdate(prevProps, prevState) {\n const {\n didCatch\n } = this.state;\n const {\n resetKeys\n } = this.props;\n\n // There's an edge case where if the thing that triggered the error happens to *also* be in the resetKeys array,\n // we'd end up resetting the error boundary immediately.\n // This would likely trigger a second error to be thrown.\n // So we make sure that we don't check the resetKeys on the first call of cDU after the error is set.\n\n if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {\n var _this$props$onReset2, _this$props3;\n (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {\n next: resetKeys,\n prev: prevProps.resetKeys,\n reason: \"keys\"\n });\n this.setState(initialState);\n }\n }\n render() {\n const {\n children,\n fallbackRender,\n FallbackComponent,\n fallback\n } = this.props;\n const {\n didCatch,\n error\n } = this.state;\n let childToRender = children;\n if (didCatch) {\n const props = {\n error,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof fallbackRender === \"function\") {\n childToRender = fallbackRender(props);\n } else if (FallbackComponent) {\n childToRender = createElement(FallbackComponent, props);\n } else if (fallback !== undefined) {\n childToRender = fallback;\n } else {\n throw error;\n }\n }\n return createElement(ErrorBoundaryContext.Provider, {\n value: {\n didCatch,\n error,\n resetErrorBoundary: this.resetErrorBoundary\n }\n }, childToRender);\n }\n}\nfunction hasArrayChanged() {\n let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));\n}\n\nfunction assertErrorBoundaryContext(value) {\n if (value == null || typeof value.didCatch !== \"boolean\" || typeof value.resetErrorBoundary !== \"function\") {\n throw new Error(\"ErrorBoundaryContext not found\");\n }\n}\n\nfunction useErrorBoundary() {\n const context = useContext(ErrorBoundaryContext);\n assertErrorBoundaryContext(context);\n const [state, setState] = useState({\n error: null,\n hasError: false\n });\n const memoized = useMemo(() => ({\n resetBoundary: () => {\n context.resetErrorBoundary();\n setState({\n error: null,\n hasError: false\n });\n },\n showBoundary: error => setState({\n error,\n hasError: true\n })\n }), [context.resetErrorBoundary]);\n if (state.hasError) {\n throw state.error;\n }\n return memoized;\n}\n\nfunction withErrorBoundary(component, errorBoundaryProps) {\n const Wrapped = forwardRef((props, ref) => createElement(ErrorBoundary, errorBoundaryProps, createElement(component, {\n ...props,\n ref\n })));\n\n // Format for display in DevTools\n const name = component.displayName || component.name || \"Unknown\";\n Wrapped.displayName = \"withErrorBoundary(\".concat(name, \")\");\n return Wrapped;\n}\n\nexport { ErrorBoundary, ErrorBoundaryContext, useErrorBoundary, withErrorBoundary };\n"],"names":["ErrorBoundaryContext","createContext","initialState","didCatch","error","ErrorBoundary","Component","constructor","props","super","this","resetErrorBoundary","bind","state","getDerivedStateFromError","_this$props$onReset","_this$props","_len","arguments","length","args","Array","_key","onReset","call","reason","setState","componentDidCatch","info","_this$props$onError","_this$props2","onError","componentDidUpdate","prevProps","prevState","resetKeys","_this$props$onReset2","_this$props3","a","undefined","b","some","item","index","Object","is","hasArrayChanged","next","prev","render","children","fallbackRender","FallbackComponent","fallback","childToRender","createElement","Provider","value"],"mappings":"wEAGK,MAACA,EAAuBC,EAAc,MAErCC,EAAe,CACnBC,UAAU,EACVC,MAAO,MAET,MAAMC,UAAsBC,EAC1B,WAAAC,CAAYC,GACVC,MAAMD,GACNE,KAAKC,mBAAqBD,KAAKC,mBAAmBC,KAAKF,MACvDA,KAAKG,MAAQX,CACd,CACD,+BAAOY,CAAyBV,GAC9B,MAAO,CACLD,UAAU,EACVC,QAEH,CACD,kBAAAO,GACE,MAAMP,MACJA,GACEM,KAAKG,MACT,GAAc,OAAVT,EAAgB,CAElB,IADA,IAAIW,EAAqBC,EAChB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