{"version":3,"sources":["webpack:///./src/framework/compatibility/iframe-embed-compat.ts"],"names":["IFrameEmbedCompatibilityApi","getApi","_classCallCheck","this","key","value","action","iframe","method","entry","arguments","targetFrame","prefill","css","console","warn","setCss","jQuery","proxyEventsToJQuery"],"mappings":"q7BA2CO,IAAMA,EAA2B,WAEvC,SAAAA,EAAYC,I,4FAAgCC,CAAA,KAAAF,GAAA,KAD3BC,YAAM,EAEtBE,KAAKF,OAASA,E,UAgCd,O,EA7BDD,G,EAAA,EAAAI,IAAA,uBAAAC,MAKA,SAAqBC,EAAkEC,GACtF,GAAsB,YAAlBD,EAAOE,OAAsB,CAEhC,IAAMC,EAAQH,EAAOI,UAAU,GACzBC,EAAcL,EAAOK,YAC3BR,KAAKF,OAAOU,GAAaC,QAAQH,QAE7B,GAAsB,WAAlBH,EAAOE,OAAqB,CAEpC,IAAMK,EAAMP,EAAOI,UAAU,GACLJ,EAAOI,UAAU,IAExCI,QAAQC,KAAK,qHACdZ,KAAKF,OAAOM,GAAQS,OAAOH,MAI7B,CAAAT,IAAA,oBAAAC,MAKA,SAAkBE,EAA2BU,GAC5CC,YAAoBf,KAAKF,OAAOM,GAASU,GAAQ,Q,8EACjDjB,EAnCsC","file":"154.45fc7bf4f4fb1be2bfa1.js","sourcesContent":["import type { IframeFormHandleGetter } from '../public/iframe-form-handle';\r\nimport { proxyEventsToJQuery } from './proxy-form-events-to-jquery';\r\n\r\n/**\r\n * The information that is captured when a 'prefill' method call was made using the legacy (embed.js) iframe embed API\r\n */\r\nexport type DeferredIFramePrefillAction = {\r\n\tmethod: 'prefill';\r\n\targuments: [object, HTMLIFrameElement];\r\n\ttargetFrame: HTMLIFrameElement;\r\n\tmessage: {\r\n\t\tevent: 'prefill';\r\n\t\tdata: {\r\n\t\t\tentry: object\r\n\t\t};\r\n\t};\r\n};\r\n\r\n/**\r\n * The information that is captured when a 'setCss' method call was made using the legacy (embed.js) iframe embed API\r\n */\r\nexport type DeferredIFrameSetCssAction = {\r\n\tmethod: 'setCss';\r\n\targuments: [string, boolean];\r\n\ttargetFrame: null;\r\n\tmessage: {\r\n\t\tevent: 'setCss';\r\n\t\tdata: {\r\n\t\t\tcss: string\r\n\t\t};\r\n\t};\r\n};\r\n\r\n/**\r\n * The compatibility API that is exposed by the legacy iframe API (embed.js) for V2 forms compatibility\r\n */\r\nexport type LegacyIFrameEmbedCompatibilityApi = {\r\n\tactivateV2Api(compat: IFrameEmbedCompatibilityApi): void;\r\n};\r\n\r\n/**\r\n * An API exposed by the Vue forms client for processing method calls that were made using the legacy (embed.js) iframe embed API\r\n */\r\nexport class IFrameEmbedCompatibilityApi {\r\n\tprivate readonly getApi: IframeFormHandleGetter;\r\n\tconstructor(getApi: IframeFormHandleGetter) {\r\n\t\tthis.getApi = getApi;\r\n\t}\r\n\r\n\t/**\r\n\t * Handles deferred actions that occured prior to the iframe API loading\r\n\t * @param action The action that was deferred until the iframe could accept messages\r\n\t * @param iframe The iframe that is now ready to accept messages\r\n\t */\r\n\thandleDeferredAction(action: DeferredIFramePrefillAction | DeferredIFrameSetCssAction, iframe: HTMLIFrameElement) {\r\n\t\tif (action.method === 'prefill') {\r\n\t\t\t// Proxy the prefill call from the legacy API (embed.js) to the new V2 forms iframe API\r\n\t\t\tconst entry = action.arguments[0];\r\n\t\t\tconst targetFrame = action.targetFrame;\r\n\t\t\tthis.getApi(targetFrame).prefill(entry);\r\n\t\t}\r\n\t\telse if (action.method === 'setCss') {\r\n\t\t\t// Proxy the setCss call from the legacy API (embed.js) to the new V2 forms iframe API\r\n\t\t\tconst css = action.arguments[0];\r\n\t\t\tconst suppressWarning = action.arguments[1];\r\n\t\t\tif (!suppressWarning)\r\n\t\t\t\tconsole.warn('The form CSS has changed significantly with V2 forms, please consider making updates and using the new forms API.');\r\n\t\t\tthis.getApi(iframe).setCss(css);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Proxy events from the iframe as jQuery events on the hosting page\r\n\t * @param iframe The iframe to listen for events\r\n\t * @param jQuery The jQuery object to proxy events to\r\n\t */\r\n\tproxyJQueryEvents(iframe: HTMLIFrameElement, jQuery: JQueryStatic): void {\r\n\t\tproxyEventsToJQuery(this.getApi(iframe), jQuery, false);\r\n\t}\r\n}\r\n"],"sourceRoot":""}