{"version":3,"sources":["webpack:///./src/framework/compatibility/iframe-embed-compat.ts"],"names":["IFrameEmbedCompatibilityApi","constructor","getApi","this","handleDeferredAction","action","iframe","method","entry","arguments","targetFrame","prefill","css","console","warn","setCss","proxyJQueryEvents","jQuery","proxyEventsToJQuery"],"mappings":"gGACA,gFA0CO,MAAMA,EAEZC,YAAYC,GAAgC,KAD3BA,YAAM,EAEtBC,KAAKD,OAASA,EAQfE,qBAAqBC,EAAkEC,GACtF,GAAsB,YAAlBD,EAAOE,OAAsB,CAEhC,MAAMC,EAAQH,EAAOI,UAAU,GACzBC,EAAcL,EAAOK,YAC3BP,KAAKD,OAAOQ,GAAaC,QAAQH,QAE7B,GAAsB,WAAlBH,EAAOE,OAAqB,CAEpC,MAAMK,EAAMP,EAAOI,UAAU,GACLJ,EAAOI,UAAU,IAExCI,QAAQC,KAAK,qHACdX,KAAKD,OAAOI,GAAQS,OAAOH,IAS7BI,kBAAkBV,EAA2BW,GAC5CC,YAAoBf,KAAKD,OAAOI,GAASW,GAAQ","file":"155.84b37b42ebbb9eb79a5f.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":""}