@capitalos/react 0.1.0 → 0.1.1-beta.1

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.
@@ -1,2 +1,2 @@
1
1
  "use client";var z=Object.defineProperty,T=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var L=(t,e,r)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d=(t,e)=>{for(var r in e||(e={}))R.call(e,r)&&L(t,r,e[r]);if(h)for(var r of h(e))H.call(e,r)&&L(t,r,e[r]);return t},M=(t,e)=>T(t,O(e));import{connectToChild as A}from"penpal";import l,{useEffect as D,useMemo as P}from"react";var f=class extends Error{constructor(e){super(e),this.name="CapitalOSError"}},m=class extends f{constructor(){super("Invalid token"),this.name="CapitalOSInvalidTokenError"}};import{iframeResizer as k}from"iframe-resizer";import C,{forwardRef as E,useEffect as y,useImperativeHandle as v,useRef as N}from"react";var p=E((t,e)=>{let r=t.title||"iframe",{iframeHTMLAttributes:o,resizerOptions:i}=x(t),a=N(null);return y(()=>{let n=a.current;return k(d({},i),n),()=>n.iFrameResizer&&n.iFrameResizer.removeListeners()}),v(e,()=>a.current),C.createElement("iframe",M(d({},o),{title:r,ref:a}))});p.displayName="IframeResizer";var S=["autoResize","bodyBackground","bodyMargin","bodyPadding","checkOrigin","inPageLinks","heightCalculationMethod","interval","log","maxHeight","maxWidth","minHeight","minWidth","resizeFrom","scrolling","sizeHeight","sizeWidth","warningTimeout","tolerance","widthCalculationMethod","onClosed","onInit","onMessage","onResized","onScroll"],w=new Set(S);function x(t){return Object.keys(t).reduce((r,o)=>(w.has(o)?r.resizerOptions[o]=t[o]:r.iframeHTMLAttributes[o]=t[o],r),{resizerOptions:{},iframeHTMLAttributes:{}})}var W=1e4;function oe(t){let{token:e,className:r,enableLogging:o,onError:i,loadingComponent:a}=t,n=l.useRef(null),[u,I]=l.useState(!1),F=P(()=>{try{let s=decodeURIComponent(e),c=atob(s),b=JSON.parse(c),{path:g}=b;if(!g)throw new m;return`${g}?token=${e}`}catch(s){i==null||i(new m);return}},[e,i]);return D(()=>{let s=A({iframe:n.current,childOrigin:"*",debug:!0,timeout:W,methods:{onLoad:()=>{I(!0)}}});return s.promise.catch(c=>{i==null||i(c),I(!0)}),()=>{s.destroy()}},[e]),l.createElement(l.Fragment,null,!u&&a,l.createElement(p,{src:F,allow:"clipboard-write",checkOrigin:!1,style:{width:"1px",height:"0px",minWidth:"100%"},className:r,log:!!o,ref:n,hidden:!u}))}export{oe as App};
2
- //# sourceMappingURL=index.mjs.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.tsx","../../src/error.ts","../../src/iframe-resizer.tsx"],"sourcesContent":["'use client'\n\nimport { connectToChild } from 'penpal'\nimport React, { ReactNode, useEffect, useMemo } from 'react'\n\nimport { InvalidTokenError } from './error'\nimport { IframeResizer } from './iframe-resizer'\n\nconst IFRAME_CONNECTION_TIMEOUT_MILLISECONDS = 10_000\n\n/**\n * Renders the CapitalOS App.\n */\nexport function App(props: {\n /**\n * The token provided by initiate-login.\n */\n token: string\n /**\n * Optional CSS class name for the component.\n */\n className?: string\n /**\n * Optional flag indicating whether to log events to the console.\n */\n enableLogging?: boolean\n\n /**\n * Optional callback for when the app encounters an error.\n */\n onError?: (error: Error) => void\n\n /**\n * Optional component to render while the app is loading.\n */\n loadingComponent?: ReactNode\n}) {\n const { token, className, enableLogging, onError, loadingComponent: LoadingComponent } = props\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n // represents the state of whether all required react queries returned and the page should be visible\n const [isLoaded, setIsLoaded] = React.useState(false)\n\n // memoize the url based on the token so we don't redo the computation on each render.\n const url = useMemo(() => {\n try {\n const urlDecodedToken = decodeURIComponent(token)\n const base64DecodedToken = atob(urlDecodedToken)\n const jsonToken = JSON.parse(base64DecodedToken)\n const { path } = jsonToken\n if (!path) {\n throw new InvalidTokenError()\n }\n return `${path}?token=${token}`\n } catch (error) {\n onError?.(new InvalidTokenError())\n return undefined\n }\n }, [token, onError])\n\n // connect to child iframe\n useEffect(() => {\n const connection = connectToChild({\n iframe: iframeRef.current!,\n childOrigin: '*',\n debug: true,\n timeout: IFRAME_CONNECTION_TIMEOUT_MILLISECONDS,\n methods: {\n onLoad: () => {\n setIsLoaded(true)\n },\n },\n })\n\n connection.promise.catch((error) => {\n onError?.(error)\n\n // when connection fails it's probably a handshake timeout with the iframe. we will stop showing the loader\n // since the fact we failed communication doesn't necessarily mean the iframe didn't load\n setIsLoaded(true)\n })\n\n return () => {\n connection.destroy()\n }\n }, [token])\n\n return (\n <>\n {/* show loader as long as we're not loaded */}\n {!isLoaded && LoadingComponent}\n {/* hide the iframe as long as we're not loaded */}\n <IframeResizer\n src={url}\n allow=\"clipboard-write\"\n checkOrigin={false}\n style={{ width: '1px', height: '0px', minWidth: '100%' }}\n className={className}\n log={!!enableLogging}\n ref={iframeRef}\n hidden={!isLoaded}\n />\n </>\n )\n}\n","/**\n * Base class for all SDK errors\n */\nexport class CapitalOSError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'CapitalOSError'\n }\n}\n\n/**\n * Represents an error that occurs when an invalid token is encountered.\n */\nexport class InvalidTokenError extends CapitalOSError {\n constructor() {\n super('Invalid token')\n this.name = 'CapitalOSInvalidTokenError'\n }\n}\n","import {\n IFrameOptions as BrokenIframeOptions,\n IFrameComponent,\n IFrameMessageData,\n IFrameResizedData,\n IFrameScrollData,\n iframeResizer,\n} from 'iframe-resizer'\nimport React, { IframeHTMLAttributes, forwardRef, useEffect, useImperativeHandle, useRef } from 'react'\n\n// the events were renamed but package maintainers didn't update the types.\ntype IFrameOptions = Omit<\n BrokenIframeOptions,\n 'closedCallback' | 'scrollCallback' | 'resizedCallback' | 'messageCallback' | 'initCallback'\n> & {\n onClosed?(iframeId: string): void\n onInit?(iframe: IFrameComponent): void\n onMessage?(data: IFrameMessageData): void\n onResized?(data: IFrameResizedData): void\n onScroll?(data: IFrameScrollData): boolean\n}\n\ntype IframeResizerProps = IFrameOptions & IframeHTMLAttributes<HTMLIFrameElement>\ntype EnrichedHtmlIframeElement = HTMLIFrameElement & { iFrameResizer: { removeListeners: () => void } }\n\nexport const IframeResizer = forwardRef((props: IframeResizerProps, ref: React.Ref<HTMLIFrameElement>) => {\n const title = props.title || 'iframe'\n const { iframeHTMLAttributes, resizerOptions } = splitProps(props)\n const iframeRef = useRef<HTMLIFrameElement>(null)\n\n useEffect(() => {\n // effects run after render, so the ref is guaranteed to be set (unless the component conditionally renders the iframe, which is not the case)\n const iframe = iframeRef.current as EnrichedHtmlIframeElement\n\n iframeResizer({ ...resizerOptions }, iframe)\n\n return () => iframe.iFrameResizer && iframe.iFrameResizer.removeListeners()\n })\n\n // make the ref provided as a prop point to the same place as the internal iframe ref.\n useImperativeHandle(ref, () => iframeRef.current as HTMLIFrameElement)\n\n return <iframe {...iframeHTMLAttributes} title={title} ref={iframeRef} />\n})\n\nIframeResizer.displayName = 'IframeResizer'\n\nconst resizerOptions = [\n 'autoResize',\n 'bodyBackground',\n 'bodyMargin',\n 'bodyPadding',\n 'checkOrigin',\n 'inPageLinks',\n 'heightCalculationMethod',\n 'interval',\n 'log',\n 'maxHeight',\n 'maxWidth',\n 'minHeight',\n 'minWidth',\n 'resizeFrom',\n 'scrolling',\n 'sizeHeight',\n 'sizeWidth',\n 'warningTimeout',\n 'tolerance',\n 'widthCalculationMethod',\n 'onClosed',\n 'onInit',\n 'onMessage',\n 'onResized',\n 'onScroll',\n]\n\nconst resizerOptionsSet = new Set(resizerOptions)\n\n/**\n * split props into the resizer library options and the native iframe attributes.\n * the code is contains many type assertions because typescript doesn't handle reduce well.\n */\nfunction splitProps(props: IframeResizerProps) {\n const split = Object.keys(props).reduce<{\n resizerOptions: IFrameOptions\n iframeHTMLAttributes: IframeHTMLAttributes<HTMLIFrameElement>\n }>(\n (acc, key) => {\n if (resizerOptionsSet.has(key)) {\n acc.resizerOptions[key as keyof IFrameOptions] = props[key as keyof typeof props]\n } else {\n acc.iframeHTMLAttributes[key as keyof IframeHTMLAttributes<HTMLIFrameElement>] =\n props[key as keyof typeof props]\n }\n return acc\n },\n { resizerOptions: {}, iframeHTMLAttributes: {} },\n )\n\n return split\n}\n"],"mappings":"0bAEA,OAAS,kBAAAA,MAAsB,SAC/B,OAAOC,GAAoB,aAAAC,EAAW,WAAAC,MAAe,QCA9C,IAAMC,EAAN,cAA6B,KAAM,CACxC,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,gBACd,CACF,EAKaC,EAAN,cAAgCF,CAAe,CACpD,aAAc,CACZ,MAAM,eAAe,EACrB,KAAK,KAAO,4BACd,CACF,EClBA,OAME,iBAAAG,MACK,iBACP,OAAOC,GAA+B,cAAAC,EAAY,aAAAC,EAAW,uBAAAC,EAAqB,UAAAC,MAAc,QAiBzF,IAAMC,EAAgBC,EAAW,CAACC,EAA2BC,IAAsC,CACxG,IAAMC,EAAQF,EAAM,OAAS,SACvB,CAAE,qBAAAG,EAAsB,eAAAC,CAAe,EAAIC,EAAWL,CAAK,EAC3DM,EAAYC,EAA0B,IAAI,EAEhD,OAAAC,EAAU,IAAM,CAEd,IAAMC,EAASH,EAAU,QAEzB,OAAAI,EAAcC,EAAA,GAAKP,GAAkBK,CAAM,EAEpC,IAAMA,EAAO,eAAiBA,EAAO,cAAc,gBAAgB,CAC5E,CAAC,EAGDG,EAAoBX,EAAK,IAAMK,EAAU,OAA4B,EAE9DO,EAAA,cAAC,SAAAC,EAAAH,EAAA,GAAWR,GAAX,CAAiC,MAAOD,EAAO,IAAKI,GAAW,CACzE,CAAC,EAEDR,EAAc,YAAc,gBAE5B,IAAMM,EAAiB,CACrB,aACA,iBACA,aACA,cACA,cACA,cACA,0BACA,WACA,MACA,YACA,WACA,YACA,WACA,aACA,YACA,aACA,YACA,iBACA,YACA,yBACA,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ACrB,CACF,EAAG,CAAClB,CAAK,CAAC,EAGRM,EAAA,cAAAA,EAAA,cAEG,CAACC,GAAYH,EAEdE,EAAA,cAACc,EAAA,CACC,IAAKX,EACL,MAAM,kBACN,YAAa,GACb,MAAO,CAAE,MAAO,MAAO,OAAQ,MAAO,SAAU,MAAO,EACvD,UAAWR,EACX,IAAK,CAAC,CAACC,EACP,IAAKG,EACL,OAAQ,CAACE,EACX,CACF,CAEJ","names":["connectToChild","React","useEffect","useMemo","CapitalOSError","message","InvalidTokenError","iframeResizer","React","forwardRef","useEffect","useImperativeHandle","useRef","IframeResizer","forwardRef","props","ref","title","iframeHTMLAttributes","resizerOptions","splitProps","iframeRef","useRef","useEffect","iframe","iframeResizer","__spreadValues","useImperativeHandle","React","__spreadProps","resizerOptionsSet","acc","key","IFRAME_CONNECTION_TIMEOUT_MILLISECONDS","App","props","token","className","enableLogging","onError","LoadingComponent","iframeRef","React","isLoaded","setIsLoaded","url","useMemo","urlDecodedToken","base64DecodedToken","jsonToken","path","InvalidTokenError","error","useEffect","connection","connectToChild","IframeResizer"]}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@capitalos/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-beta.1",
4
4
  "description": "integrate CapitalOS into your react app",
5
5
  "main": "dist/index.js",
6
- "module": "dist/index.mjs",
6
+ "module": "dist/esm/index.js",
7
7
  "types": "dist/_tsup-dts-rollup.d.ts",
8
8
  "keywords": [
9
9
  "capitalos",
@@ -41,7 +41,7 @@
41
41
  "react": ">=16.8.0"
42
42
  },
43
43
  "scripts": {
44
- "build": " pnpm lint && tsup src/index.tsx --experimental-dts --minify --format esm,cjs --clean --no-splitting --sourcemap --out-dir dist",
44
+ "build": " pnpm lint && tsup src/index.tsx --experimental-dts --minify --format esm,cjs --clean --no-splitting --sourcemap --legacy-output --out-dir dist",
45
45
  "dev": "pnpm build --watch",
46
46
  "lint": "eslint . --ext .ts,.tsx"
47
47
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.tsx","../src/error.ts","../src/iframe-resizer.tsx"],"sourcesContent":["'use client'\n\nimport { connectToChild } from 'penpal'\nimport React, { ReactNode, useEffect, useMemo } from 'react'\n\nimport { InvalidTokenError } from './error'\nimport { IframeResizer } from './iframe-resizer'\n\nconst IFRAME_CONNECTION_TIMEOUT_MILLISECONDS = 10_000\n\n/**\n * Renders the CapitalOS App.\n */\nexport function App(props: {\n /**\n * The token provided by initiate-login.\n */\n token: string\n /**\n * Optional CSS class name for the component.\n */\n className?: string\n /**\n * Optional flag indicating whether to log events to the console.\n */\n enableLogging?: boolean\n\n /**\n * Optional callback for when the app encounters an error.\n */\n onError?: (error: Error) => void\n\n /**\n * Optional component to render while the app is loading.\n */\n loadingComponent?: ReactNode\n}) {\n const { token, className, enableLogging, onError, loadingComponent: LoadingComponent } = props\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n // represents the state of whether all required react queries returned and the page should be visible\n const [isLoaded, setIsLoaded] = React.useState(false)\n\n // memoize the url based on the token so we don't redo the computation on each render.\n const url = useMemo(() => {\n try {\n const urlDecodedToken = decodeURIComponent(token)\n const base64DecodedToken = atob(urlDecodedToken)\n const jsonToken = JSON.parse(base64DecodedToken)\n const { path } = jsonToken\n if (!path) {\n throw new InvalidTokenError()\n }\n return `${path}?token=${token}`\n } catch (error) {\n onError?.(new InvalidTokenError())\n return undefined\n }\n }, [token, onError])\n\n // connect to child iframe\n useEffect(() => {\n const connection = connectToChild({\n iframe: iframeRef.current!,\n childOrigin: '*',\n debug: true,\n timeout: IFRAME_CONNECTION_TIMEOUT_MILLISECONDS,\n methods: {\n onLoad: () => {\n setIsLoaded(true)\n },\n },\n })\n\n connection.promise.catch((error) => {\n onError?.(error)\n\n // when connection fails it's probably a handshake timeout with the iframe. we will stop showing the loader\n // since the fact we failed communication doesn't necessarily mean the iframe didn't load\n setIsLoaded(true)\n })\n\n return () => {\n connection.destroy()\n }\n }, [token])\n\n return (\n <>\n {/* show loader as long as we're not loaded */}\n {!isLoaded && LoadingComponent}\n {/* hide the iframe as long as we're not loaded */}\n <IframeResizer\n src={url}\n allow=\"clipboard-write\"\n checkOrigin={false}\n style={{ width: '1px', height: '0px', minWidth: '100%' }}\n className={className}\n log={!!enableLogging}\n ref={iframeRef}\n hidden={!isLoaded}\n />\n </>\n )\n}\n","/**\n * Base class for all SDK errors\n */\nexport class CapitalOSError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'CapitalOSError'\n }\n}\n\n/**\n * Represents an error that occurs when an invalid token is encountered.\n */\nexport class InvalidTokenError extends CapitalOSError {\n constructor() {\n super('Invalid token')\n this.name = 'CapitalOSInvalidTokenError'\n }\n}\n","import {\n IFrameOptions as BrokenIframeOptions,\n IFrameComponent,\n IFrameMessageData,\n IFrameResizedData,\n IFrameScrollData,\n iframeResizer,\n} from 'iframe-resizer'\nimport React, { IframeHTMLAttributes, forwardRef, useEffect, useImperativeHandle, useRef } from 'react'\n\n// the events were renamed but package maintainers didn't update the types.\ntype IFrameOptions = Omit<\n BrokenIframeOptions,\n 'closedCallback' | 'scrollCallback' | 'resizedCallback' | 'messageCallback' | 'initCallback'\n> & {\n onClosed?(iframeId: string): void\n onInit?(iframe: IFrameComponent): void\n onMessage?(data: IFrameMessageData): void\n onResized?(data: IFrameResizedData): void\n onScroll?(data: IFrameScrollData): boolean\n}\n\ntype IframeResizerProps = IFrameOptions & IframeHTMLAttributes<HTMLIFrameElement>\ntype EnrichedHtmlIframeElement = HTMLIFrameElement & { iFrameResizer: { removeListeners: () => void } }\n\nexport const IframeResizer = forwardRef((props: IframeResizerProps, ref: React.Ref<HTMLIFrameElement>) => {\n const title = props.title || 'iframe'\n const { iframeHTMLAttributes, resizerOptions } = splitProps(props)\n const iframeRef = useRef<HTMLIFrameElement>(null)\n\n useEffect(() => {\n // effects run after render, so the ref is guaranteed to be set (unless the component conditionally renders the iframe, which is not the case)\n const iframe = iframeRef.current as EnrichedHtmlIframeElement\n\n iframeResizer({ ...resizerOptions }, iframe)\n\n return () => iframe.iFrameResizer && iframe.iFrameResizer.removeListeners()\n })\n\n // make the ref provided as a prop point to the same place as the internal iframe ref.\n useImperativeHandle(ref, () => iframeRef.current as HTMLIFrameElement)\n\n return <iframe {...iframeHTMLAttributes} title={title} ref={iframeRef} />\n})\n\nIframeResizer.displayName = 'IframeResizer'\n\nconst resizerOptions = [\n 'autoResize',\n 'bodyBackground',\n 'bodyMargin',\n 'bodyPadding',\n 'checkOrigin',\n 'inPageLinks',\n 'heightCalculationMethod',\n 'interval',\n 'log',\n 'maxHeight',\n 'maxWidth',\n 'minHeight',\n 'minWidth',\n 'resizeFrom',\n 'scrolling',\n 'sizeHeight',\n 'sizeWidth',\n 'warningTimeout',\n 'tolerance',\n 'widthCalculationMethod',\n 'onClosed',\n 'onInit',\n 'onMessage',\n 'onResized',\n 'onScroll',\n]\n\nconst resizerOptionsSet = new Set(resizerOptions)\n\n/**\n * split props into the resizer library options and the native iframe attributes.\n * the code is contains many type assertions because typescript doesn't handle reduce well.\n */\nfunction splitProps(props: IframeResizerProps) {\n const split = Object.keys(props).reduce<{\n resizerOptions: IFrameOptions\n iframeHTMLAttributes: IframeHTMLAttributes<HTMLIFrameElement>\n }>(\n (acc, key) => {\n if (resizerOptionsSet.has(key)) {\n acc.resizerOptions[key as keyof IFrameOptions] = props[key as keyof typeof props]\n } else {\n acc.iframeHTMLAttributes[key as keyof IframeHTMLAttributes<HTMLIFrameElement>] =\n props[key as keyof typeof props]\n }\n return acc\n },\n { resizerOptions: {}, iframeHTMLAttributes: {} },\n )\n\n return split\n}\n"],"mappings":"0bAEA,OAAS,kBAAAA,MAAsB,SAC/B,OAAOC,GAAoB,aAAAC,EAAW,WAAAC,MAAe,QCA9C,IAAMC,EAAN,cAA6B,KAAM,CACxC,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,gBACd,CACF,EAKaC,EAAN,cAAgCF,CAAe,CACpD,aAAc,CACZ,MA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AC,EAAS,iBAAkBC,CAAiB,EAAIL,EAEnFM,EAAYC,EAAM,OAA0B,IAAI,EAGhD,CAACC,EAAUC,CAAW,EAAIF,EAAM,SAAS,EAAK,EAG9CG,EAAMC,EAAQ,IAAM,CACxB,GAAI,CACF,IAAMC,EAAkB,mBAAmBX,CAAK,EAC1CY,EAAqB,KAAKD,CAAe,EACzCE,EAAY,KAAK,MAAMD,CAAkB,EACzC,CAAE,KAAAE,CAAK,EAAID,EACjB,GAAI,CAACC,EACH,MAAM,IAAIC,EAEZ,MAAO,GAAGD,CAAI,UAAUd,CAAK,EAC/B,OAASgB,EAAO,CACdb,GAAA,MAAAA,EAAU,IAAIY,GACd,MACF,CACF,EAAG,CAACf,EAAOG,CAAO,CAAC,EAGnB,OAAAc,EAAU,IAAM,CACd,IAAMC,EAAaC,EAAe,CAChC,OAAQd,EAAU,QAClB,YAAa,IACb,MAAO,GACP,QAASR,EACT,QAAS,CACP,OAAQ,IAAM,CACZW,EAAY,EAAI,CAClB,CACF,CACF,CAAC,EAED,OAAAU,EAAW,QAAQ,MAAOF,GAAU,CAClCb,GAAA,MAAAA,EAAUa,GAIVR,EAAY,EAAI,CAClB,CAAC,EAEM,IAAM,CACXU,EAAW,QAAQ,CACrB,CACF,EAAG,CAAClB,CAAK,CAAC,EAGRM,EAAA,cAAAA,EAAA,cAEG,CAACC,GAAYH,EAEdE,EAAA,cAACc,EAAA,CACC,IAAKX,EACL,MAAM,kBACN,YAAa,GACb,MAAO,CAAE,MAAO,MAAO,OAAQ,MAAO,SAAU,MAAO,EACvD,UAAWR,EACX,IAAK,CAAC,CAACC,EACP,IAAKG,EACL,OAAQ,CAACE,EACX,CACF,CAEJ","names":["connectToChild","React","useEffect","useMemo","CapitalOSError","message","InvalidTokenError","iframeResizer","React","forwardRef","useEffect","useImperativeHandle","useRef","IframeResizer","forwardRef","props","ref","title","iframeHTMLAttributes","resizerOptions","splitProps","iframeRef","useRef","useEffect","iframe","iframeResizer","__spreadValues","useImperativeHandle","React","__spreadProps","resizerOptionsSet","acc","key","IFRAME_CONNECTION_TIMEOUT_MILLISECONDS","App","props","token","className","enableLogging","onError","LoadingComponent","iframeRef","React","isLoaded","setIsLoaded","url","useMemo","urlDecodedToken","base64DecodedToken","jsonToken","path","InvalidTokenError","error","useEffect","connection","connectToChild","IframeResizer"]}