{"version":3,"file":"make_component.mjs","sources":["../../src/components/make_component.tsx"],"sourcesContent":["import React, { FC } from \"react\"\n\nimport {\n  dispatchWidgetLocationChangeEvent,\n  WidgetPostMessageCallbackProps,\n} from \"@mxenabled/widget-post-message-definitions\"\n\nimport { Type, SsoUrlProps, WidgetConfigurationProps } from \"../sso\"\nimport { useWidgetRenderer, StylingProps } from \"./renderer\"\n\nexport type Props = SsoUrlProps &\n  StylingProps &\n  WidgetConfigurationProps &\n  WidgetPostMessageCallbackProps<string> &\n  JSX.IntrinsicAttributes\n\nexport function makeBaseWidgetComponent(widgetType: Type): FC<Props> {\n  return function Widget(props: Props) {\n    return useWidgetRenderer({ ...props, widgetType }, dispatchWidgetLocationChangeEvent)\n  }\n}\n\nexport function makeWidgetComponentWithDefaults<Props extends JSX.IntrinsicAttributes>(\n  Component: FC<Props>,\n  defaultProps?: Partial<Props>,\n): FC<Props> {\n  return function Widget(props: Props) {\n    return <Component {...defaultProps} {...props} />\n  }\n}\n"],"names":["makeBaseWidgetComponent","widgetType","props","useWidgetRenderer","dispatchWidgetLocationChangeEvent","makeWidgetComponentWithDefaults","Component","defaultProps","React"],"mappings":";;;AAgBO,SAASA,EAAwBC,GAA6B;AACnE,SAAO,SAAgBC,GAAc;AACnC,WAAOC,EAAkB,EAAE,GAAGD,GAAO,YAAAD,EAAA,GAAcG,CAAiC;AAAA,EACtF;AACF;AAEO,SAASC,EACdC,GACAC,GACW;AACX,SAAO,SAAgBL,GAAc;AACnC,WAAO,gBAAAM,EAAA,cAACF,GAAA,EAAW,GAAGC,GAAe,GAAGL,GAAO;AAAA,EACjD;AACF;"}