{"version":3,"sources":["webpack:///./src/framework/compatibility/seamless-embed-compat.ts"],"names":["SeamlessEmbedCompatibilityApi","api","_classCallCheck","Object","defineProperty","this","configurable","enumerable","writable","value","key","module","args","options","arguments","length","undefined","id","target","form","mount","resourceName","window","Cognito","resources","overrideText","entry","prefill","success","jqPromise","loadScriptWithGlobal","ready","then","jQuery","noConflict","proxyEventsToJQuery","console","warn"],"mappings":"g8BAcO,IAAMA,EAA6B,WAEzC,SAAAA,EAAYC,I,4FAAUC,CAAA,KAAAF,GAAA,KADbC,SAAG,EAEXE,OAAOC,eAAeC,KAAM,MAAO,CAAEC,cAAc,EAAOC,YAAY,EAAOC,UAAU,EAAOC,MAAOR,I,UA6CrG,O,EA5CAD,G,EAAA,EAAAU,IAAA,OAAAD,MAED,SAAKE,EAAmCC,GAAmF,IAAhDC,EAAuCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,KACpH,GAAe,UAAXH,GAAsBC,GAAQA,EAAKK,GAAI,CAE1C,IAAIC,EAASL,GAAUA,EAAQK,QAAe,GAC/B,KAAXA,IACHA,EAAS,YAGV,IAAMC,EAAOd,KAAKJ,IAAImB,MAAMR,EAAKK,GAAIC,GAErC,IAAK,IAAMG,KAAgBC,OAAOC,QAAQC,UACzCL,EAAKM,aAAaJ,EAAcC,OAAOC,QAAQC,UAAUH,IAQ1D,GAJIT,EAAKc,OACRP,EAAKQ,QAAQf,EAAKc,OAGfb,GAAWA,EAAQe,QAAS,CAC/B,IAAMC,EAAYC,YAAqB,wCAAyC,UAChFX,EAAKY,MAAMC,MAAK,WACfH,EAAUG,MAAK,SAACC,GAEfA,EAAOC,YAAW,GAGlBZ,OAAkB,UAAIW,EAGtBE,YAAoBhB,EAAMc,GAAQ,GAElCpB,EAAQe,sBAMPN,OAAOc,SAAWA,QAAQC,MAC7BD,QAAQC,KAAK,qC,8EAGfrC,EAhDwC","file":"165.a59a094531a5d521e7a3.js","sourcesContent":["import type { Api } from '../public/public-api';\r\nimport { loadScriptWithGlobal } from 'src/util/script-loader';\r\nimport { proxyEventsToJQuery } from './proxy-form-events-to-jquery';\r\n\r\n/**\r\n * The compatibility API that is exposed by the legacy session script for Vue forms compatibility\r\n */\r\nexport type LegacySeamlessEmbedCompatibilityApi = {\r\n\tdeferredLoad?(api: LegacySeamlessEmbedApi): void;\r\n};\r\n\r\n/**\r\n * An API exposed by the Vue forms client for loading a form with legacy embed code\r\n */\r\nexport class SeamlessEmbedCompatibilityApi implements LegacySeamlessEmbedApi {\r\n\treadonly api: Api;\r\n\tconstructor(api: Api) {\r\n\t\tObject.defineProperty(this, 'api', { configurable: false, enumerable: false, writable: false, value: api });\r\n\t}\r\n\r\n\tload(module: LegacySeamlessEmbedModule, args: LegacySeamlessEmbedLoadArgs, options: LegacySeamlessEmbedLoadOptions = null) {\r\n\t\tif (module === 'forms' && args && args.id) {\r\n\t\t\t// Determine the mount target, either the specified selector, or the default '.cognito' div\r\n\t\t\tlet target = options ? options.target || '' : '';\r\n\t\t\tif (target === '')\r\n\t\t\t\ttarget = '.cognito';\r\n\r\n\t\t\t// Mount the form and get the resulting form handle\r\n\t\t\tconst form = this.api.mount(args.id, target);\r\n\r\n\t\t\tfor (const resourceName in window.Cognito.resources) {\r\n\t\t\t\tform.overrideText(resourceName, window.Cognito.resources[resourceName]);\r\n\t\t\t}\r\n\r\n\t\t\t// If there is an \"entry\" object, then call prefill on the form handle\r\n\t\t\tif (args.entry)\r\n\t\t\t\tform.prefill(args.entry);\r\n\r\n\t\t\t// If a 'success' callback is specified, then call it when the form is ready\r\n\t\t\tif (options && options.success) {\r\n\t\t\t\tconst jqPromise = loadScriptWithGlobal('//code.jquery.com/jquery-1.7.2.min.js', 'jQuery');\r\n\t\t\t\tform.ready.then(() => {\r\n\t\t\t\t\tjqPromise.then((jQuery: JQueryStatic) => {\r\n\t\t\t\t\t\t// Relinquish control of the global `$` in case the hosting page has already loaded jQuery\r\n\t\t\t\t\t\tjQuery.noConflict(true);\r\n\r\n\t\t\t\t\t\t// Put our version of jQuery on the window object as `ExoJQuery`, since that is what the documentation advertises\r\n\t\t\t\t\t\twindow['ExoJQuery'] = jQuery;\r\n\r\n\t\t\t\t\t\t// Proxy form events to the hosting page as jQuery events\r\n\t\t\t\t\t\tproxyEventsToJQuery(form, jQuery, true);\r\n\r\n\t\t\t\t\t\toptions.success();\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (window.console && console.warn) {\r\n\t\t\t\tconsole.warn('Invalid call to Cognito.load');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n"],"sourceRoot":""}