@dintero/checkout-web-sdk 0.8.6 → 0.8.8

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.
@@ -6,7 +6,7 @@ require('native-promise-only');
6
6
 
7
7
  var pkg = {
8
8
  name: "@dintero/checkout-web-sdk",
9
- version: "0.8.6",
9
+ version: "0.8.8",
10
10
  description: "Dintero Checkout SDK for web frontends",
11
11
  main: "dist/dintero-checkout-web-sdk.cjs.js",
12
12
  module: "dist/dintero-checkout-web-sdk.esm.js",
@@ -38,17 +38,17 @@ var pkg = {
38
38
  url: "https://github.com/Dintero/Dintero.Checkout.Web.SDK/issues"
39
39
  },
40
40
  devDependencies: {
41
- "@babel/core": "7.24.3",
42
- "@babel/preset-typescript": "7.24.1",
43
- "@preconstruct/cli": "2.8.3",
41
+ "@babel/core": "7.24.7",
42
+ "@babel/preset-typescript": "7.24.7",
43
+ "@preconstruct/cli": "2.8.4",
44
44
  "@semantic-release/exec": "6.0.3",
45
45
  "@semantic-release/git": "10.0.1",
46
- "@vitest/browser": "1.4.0",
47
- prettier: "3.2.5",
48
- "semantic-release": "23.0.6",
49
- typescript: "5.4.3",
50
- vitest: "1.4.0",
51
- webdriverio: "8.35.1"
46
+ "@vitest/browser": "1.6.0",
47
+ prettier: "3.3.1",
48
+ "semantic-release": "24.0.0",
49
+ typescript: "5.4.5",
50
+ vitest: "1.6.0",
51
+ webdriverio: "8.38.2"
52
52
  },
53
53
  dependencies: {
54
54
  "native-promise-only": "0.8.1"
@@ -814,7 +814,6 @@ const removePopOutButton = () => {
814
814
 
815
815
  const WIDTH = Math.min(480, window.screen.width);
816
816
  const HEIGHT = Math.min(840, window.screen.height);
817
- let popOutWindow;
818
817
  const createPopOutWindow = (sid, url, width, height) => {
819
818
  return new Promise(resolve => {
820
819
  try {
@@ -859,6 +858,7 @@ const createPopOutWindow = (sid, url, width, height) => {
859
858
  const openPopOut = async options => {
860
859
  let unsubscribe;
861
860
  let intervalId = -1;
861
+ let popOutWindow;
862
862
  if (popOutWindow && !popOutWindow.closed) {
863
863
  // Skip if already open.
864
864
  return;
@@ -908,8 +908,48 @@ const openPopOut = async options => {
908
908
  popOutWindow
909
909
  };
910
910
  };
911
- const popOut = {
912
- openPopOut
911
+ const postPopOutSessionLock = (popOutWindow, sid) => {
912
+ try {
913
+ if (popOutWindow) {
914
+ popOutWindow.postMessage({
915
+ type: "LockSession",
916
+ sid
917
+ }, "*");
918
+ }
919
+ } catch (e) {
920
+ console.error(e);
921
+ }
922
+ };
923
+ const postPopOutSessionRefresh = (popOutWindow, sid) => {
924
+ try {
925
+ if (popOutWindow) {
926
+ popOutWindow.postMessage({
927
+ type: "RefreshSession",
928
+ sid
929
+ }, "*");
930
+ }
931
+ } catch (e) {
932
+ console.error(e);
933
+ }
934
+ };
935
+ const postPopOutActivePaymentProductType = (popOutWindow, sid, paymentProductType) => {
936
+ try {
937
+ if (popOutWindow) {
938
+ popOutWindow.postMessage({
939
+ type: "SetActivePaymentProductType",
940
+ sid,
941
+ payment_product_type: paymentProductType
942
+ }, "*");
943
+ }
944
+ } catch (e) {
945
+ console.error(e);
946
+ }
947
+ };
948
+ const popOutModule = {
949
+ openPopOut,
950
+ postPopOutSessionLock,
951
+ postPopOutSessionRefresh,
952
+ postPopOutActivePaymentProductType
913
953
  };
914
954
 
915
955
  /**
@@ -1039,7 +1079,7 @@ const showPopOut = async (event, checkout) => {
1039
1079
  close,
1040
1080
  focus,
1041
1081
  popOutWindow
1042
- } = await popOut.openPopOut({
1082
+ } = await popOutModule.openPopOut({
1043
1083
  sid: checkout.options.sid,
1044
1084
  endpoint: checkout.options.endpoint,
1045
1085
  shouldCallValidateSession: Boolean(checkout.options.onValidateSession),
@@ -1293,18 +1333,26 @@ const embed = async options => {
1293
1333
  const lockSession = () => {
1294
1334
  return promisifyAction(() => {
1295
1335
  postSessionLock(iframe, sid);
1336
+ popOutModule.postPopOutSessionLock(checkout?.popOutWindow, sid);
1296
1337
  }, CheckoutEvents.SessionLocked, CheckoutEvents.SessionLockFailed);
1297
1338
  };
1298
1339
  const refreshSession = () => {
1299
1340
  return promisifyAction(() => {
1300
1341
  postSessionRefresh(iframe, sid);
1342
+ popOutModule.postPopOutSessionRefresh(checkout?.popOutWindow, sid);
1301
1343
  }, CheckoutEvents.SessionUpdated, CheckoutEvents.SessionNotFound);
1302
1344
  };
1303
1345
  const setActivePaymentProductType = paymentProductType => {
1304
- postActivePaymentProductType(iframe, sid, paymentProductType);
1346
+ // Send to either embed or pop out
1347
+ if (options.popOut) {
1348
+ popOutModule.postPopOutActivePaymentProductType(checkout?.popOutWindow, sid, paymentProductType);
1349
+ } else {
1350
+ postActivePaymentProductType(iframe, sid, paymentProductType);
1351
+ }
1305
1352
  };
1306
1353
  const submitValidationResult = result => {
1307
1354
  postValidationResult(iframe, sid, result);
1355
+ // For pop out we do validation when opening the pop out
1308
1356
  };
1309
1357
 
1310
1358
  /**
@@ -6,7 +6,7 @@ require('native-promise-only');
6
6
 
7
7
  var pkg = {
8
8
  name: "@dintero/checkout-web-sdk",
9
- version: "0.8.6",
9
+ version: "0.8.8",
10
10
  description: "Dintero Checkout SDK for web frontends",
11
11
  main: "dist/dintero-checkout-web-sdk.cjs.js",
12
12
  module: "dist/dintero-checkout-web-sdk.esm.js",
@@ -38,17 +38,17 @@ var pkg = {
38
38
  url: "https://github.com/Dintero/Dintero.Checkout.Web.SDK/issues"
39
39
  },
40
40
  devDependencies: {
41
- "@babel/core": "7.24.3",
42
- "@babel/preset-typescript": "7.24.1",
43
- "@preconstruct/cli": "2.8.3",
41
+ "@babel/core": "7.24.7",
42
+ "@babel/preset-typescript": "7.24.7",
43
+ "@preconstruct/cli": "2.8.4",
44
44
  "@semantic-release/exec": "6.0.3",
45
45
  "@semantic-release/git": "10.0.1",
46
- "@vitest/browser": "1.4.0",
47
- prettier: "3.2.5",
48
- "semantic-release": "23.0.6",
49
- typescript: "5.4.3",
50
- vitest: "1.4.0",
51
- webdriverio: "8.35.1"
46
+ "@vitest/browser": "1.6.0",
47
+ prettier: "3.3.1",
48
+ "semantic-release": "24.0.0",
49
+ typescript: "5.4.5",
50
+ vitest: "1.6.0",
51
+ webdriverio: "8.38.2"
52
52
  },
53
53
  dependencies: {
54
54
  "native-promise-only": "0.8.1"
@@ -814,7 +814,6 @@ const removePopOutButton = () => {
814
814
 
815
815
  const WIDTH = Math.min(480, window.screen.width);
816
816
  const HEIGHT = Math.min(840, window.screen.height);
817
- let popOutWindow;
818
817
  const createPopOutWindow = (sid, url, width, height) => {
819
818
  return new Promise(resolve => {
820
819
  try {
@@ -859,6 +858,7 @@ const createPopOutWindow = (sid, url, width, height) => {
859
858
  const openPopOut = async options => {
860
859
  let unsubscribe;
861
860
  let intervalId = -1;
861
+ let popOutWindow;
862
862
  if (popOutWindow && !popOutWindow.closed) {
863
863
  // Skip if already open.
864
864
  return;
@@ -908,8 +908,48 @@ const openPopOut = async options => {
908
908
  popOutWindow
909
909
  };
910
910
  };
911
- const popOut = {
912
- openPopOut
911
+ const postPopOutSessionLock = (popOutWindow, sid) => {
912
+ try {
913
+ if (popOutWindow) {
914
+ popOutWindow.postMessage({
915
+ type: "LockSession",
916
+ sid
917
+ }, "*");
918
+ }
919
+ } catch (e) {
920
+ console.error(e);
921
+ }
922
+ };
923
+ const postPopOutSessionRefresh = (popOutWindow, sid) => {
924
+ try {
925
+ if (popOutWindow) {
926
+ popOutWindow.postMessage({
927
+ type: "RefreshSession",
928
+ sid
929
+ }, "*");
930
+ }
931
+ } catch (e) {
932
+ console.error(e);
933
+ }
934
+ };
935
+ const postPopOutActivePaymentProductType = (popOutWindow, sid, paymentProductType) => {
936
+ try {
937
+ if (popOutWindow) {
938
+ popOutWindow.postMessage({
939
+ type: "SetActivePaymentProductType",
940
+ sid,
941
+ payment_product_type: paymentProductType
942
+ }, "*");
943
+ }
944
+ } catch (e) {
945
+ console.error(e);
946
+ }
947
+ };
948
+ const popOutModule = {
949
+ openPopOut,
950
+ postPopOutSessionLock,
951
+ postPopOutSessionRefresh,
952
+ postPopOutActivePaymentProductType
913
953
  };
914
954
 
915
955
  /**
@@ -1039,7 +1079,7 @@ const showPopOut = async (event, checkout) => {
1039
1079
  close,
1040
1080
  focus,
1041
1081
  popOutWindow
1042
- } = await popOut.openPopOut({
1082
+ } = await popOutModule.openPopOut({
1043
1083
  sid: checkout.options.sid,
1044
1084
  endpoint: checkout.options.endpoint,
1045
1085
  shouldCallValidateSession: Boolean(checkout.options.onValidateSession),
@@ -1293,18 +1333,26 @@ const embed = async options => {
1293
1333
  const lockSession = () => {
1294
1334
  return promisifyAction(() => {
1295
1335
  postSessionLock(iframe, sid);
1336
+ popOutModule.postPopOutSessionLock(checkout?.popOutWindow, sid);
1296
1337
  }, CheckoutEvents.SessionLocked, CheckoutEvents.SessionLockFailed);
1297
1338
  };
1298
1339
  const refreshSession = () => {
1299
1340
  return promisifyAction(() => {
1300
1341
  postSessionRefresh(iframe, sid);
1342
+ popOutModule.postPopOutSessionRefresh(checkout?.popOutWindow, sid);
1301
1343
  }, CheckoutEvents.SessionUpdated, CheckoutEvents.SessionNotFound);
1302
1344
  };
1303
1345
  const setActivePaymentProductType = paymentProductType => {
1304
- postActivePaymentProductType(iframe, sid, paymentProductType);
1346
+ // Send to either embed or pop out
1347
+ if (options.popOut) {
1348
+ popOutModule.postPopOutActivePaymentProductType(checkout?.popOutWindow, sid, paymentProductType);
1349
+ } else {
1350
+ postActivePaymentProductType(iframe, sid, paymentProductType);
1351
+ }
1305
1352
  };
1306
1353
  const submitValidationResult = result => {
1307
1354
  postValidationResult(iframe, sid, result);
1355
+ // For pop out we do validation when opening the pop out
1308
1356
  };
1309
1357
 
1310
1358
  /**
@@ -2,7 +2,7 @@ import 'native-promise-only';
2
2
 
3
3
  var pkg = {
4
4
  name: "@dintero/checkout-web-sdk",
5
- version: "0.8.6",
5
+ version: "0.8.8",
6
6
  description: "Dintero Checkout SDK for web frontends",
7
7
  main: "dist/dintero-checkout-web-sdk.cjs.js",
8
8
  module: "dist/dintero-checkout-web-sdk.esm.js",
@@ -34,17 +34,17 @@ var pkg = {
34
34
  url: "https://github.com/Dintero/Dintero.Checkout.Web.SDK/issues"
35
35
  },
36
36
  devDependencies: {
37
- "@babel/core": "7.24.3",
38
- "@babel/preset-typescript": "7.24.1",
39
- "@preconstruct/cli": "2.8.3",
37
+ "@babel/core": "7.24.7",
38
+ "@babel/preset-typescript": "7.24.7",
39
+ "@preconstruct/cli": "2.8.4",
40
40
  "@semantic-release/exec": "6.0.3",
41
41
  "@semantic-release/git": "10.0.1",
42
- "@vitest/browser": "1.4.0",
43
- prettier: "3.2.5",
44
- "semantic-release": "23.0.6",
45
- typescript: "5.4.3",
46
- vitest: "1.4.0",
47
- webdriverio: "8.35.1"
42
+ "@vitest/browser": "1.6.0",
43
+ prettier: "3.3.1",
44
+ "semantic-release": "24.0.0",
45
+ typescript: "5.4.5",
46
+ vitest: "1.6.0",
47
+ webdriverio: "8.38.2"
48
48
  },
49
49
  dependencies: {
50
50
  "native-promise-only": "0.8.1"
@@ -810,7 +810,6 @@ const removePopOutButton = () => {
810
810
 
811
811
  const WIDTH = Math.min(480, window.screen.width);
812
812
  const HEIGHT = Math.min(840, window.screen.height);
813
- let popOutWindow;
814
813
  const createPopOutWindow = (sid, url, width, height) => {
815
814
  return new Promise(resolve => {
816
815
  try {
@@ -855,6 +854,7 @@ const createPopOutWindow = (sid, url, width, height) => {
855
854
  const openPopOut = async options => {
856
855
  let unsubscribe;
857
856
  let intervalId = -1;
857
+ let popOutWindow;
858
858
  if (popOutWindow && !popOutWindow.closed) {
859
859
  // Skip if already open.
860
860
  return;
@@ -904,8 +904,48 @@ const openPopOut = async options => {
904
904
  popOutWindow
905
905
  };
906
906
  };
907
- const popOut = {
908
- openPopOut
907
+ const postPopOutSessionLock = (popOutWindow, sid) => {
908
+ try {
909
+ if (popOutWindow) {
910
+ popOutWindow.postMessage({
911
+ type: "LockSession",
912
+ sid
913
+ }, "*");
914
+ }
915
+ } catch (e) {
916
+ console.error(e);
917
+ }
918
+ };
919
+ const postPopOutSessionRefresh = (popOutWindow, sid) => {
920
+ try {
921
+ if (popOutWindow) {
922
+ popOutWindow.postMessage({
923
+ type: "RefreshSession",
924
+ sid
925
+ }, "*");
926
+ }
927
+ } catch (e) {
928
+ console.error(e);
929
+ }
930
+ };
931
+ const postPopOutActivePaymentProductType = (popOutWindow, sid, paymentProductType) => {
932
+ try {
933
+ if (popOutWindow) {
934
+ popOutWindow.postMessage({
935
+ type: "SetActivePaymentProductType",
936
+ sid,
937
+ payment_product_type: paymentProductType
938
+ }, "*");
939
+ }
940
+ } catch (e) {
941
+ console.error(e);
942
+ }
943
+ };
944
+ const popOutModule = {
945
+ openPopOut,
946
+ postPopOutSessionLock,
947
+ postPopOutSessionRefresh,
948
+ postPopOutActivePaymentProductType
909
949
  };
910
950
 
911
951
  /**
@@ -1035,7 +1075,7 @@ const showPopOut = async (event, checkout) => {
1035
1075
  close,
1036
1076
  focus,
1037
1077
  popOutWindow
1038
- } = await popOut.openPopOut({
1078
+ } = await popOutModule.openPopOut({
1039
1079
  sid: checkout.options.sid,
1040
1080
  endpoint: checkout.options.endpoint,
1041
1081
  shouldCallValidateSession: Boolean(checkout.options.onValidateSession),
@@ -1289,18 +1329,26 @@ const embed = async options => {
1289
1329
  const lockSession = () => {
1290
1330
  return promisifyAction(() => {
1291
1331
  postSessionLock(iframe, sid);
1332
+ popOutModule.postPopOutSessionLock(checkout?.popOutWindow, sid);
1292
1333
  }, CheckoutEvents.SessionLocked, CheckoutEvents.SessionLockFailed);
1293
1334
  };
1294
1335
  const refreshSession = () => {
1295
1336
  return promisifyAction(() => {
1296
1337
  postSessionRefresh(iframe, sid);
1338
+ popOutModule.postPopOutSessionRefresh(checkout?.popOutWindow, sid);
1297
1339
  }, CheckoutEvents.SessionUpdated, CheckoutEvents.SessionNotFound);
1298
1340
  };
1299
1341
  const setActivePaymentProductType = paymentProductType => {
1300
- postActivePaymentProductType(iframe, sid, paymentProductType);
1342
+ // Send to either embed or pop out
1343
+ if (options.popOut) {
1344
+ popOutModule.postPopOutActivePaymentProductType(checkout?.popOutWindow, sid, paymentProductType);
1345
+ } else {
1346
+ postActivePaymentProductType(iframe, sid, paymentProductType);
1347
+ }
1301
1348
  };
1302
1349
  const submitValidationResult = result => {
1303
1350
  postValidationResult(iframe, sid, result);
1351
+ // For pop out we do validation when opening the pop out
1304
1352
  };
1305
1353
 
1306
1354
  /**
@@ -1,7 +1,7 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).dintero={})}(this,(function(e){"use strict";var n="undefined"!=typeof globalThis?globalThis:"undefined"!="object"?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e,n,t){e(t={path:n,exports:{},require:function(e,n){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==n&&t.path)}},t.exports),t.exports}((function(e){
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).dintero={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!="object"?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e,t,n){e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(e){
2
2
  /*! Native Promise Only
3
3
  v0.8.1 (c) Kyle Simpson
4
4
  MIT License: http://getify.mit-license.org
5
5
  */
6
- var t,o,i;i=function(){var e,n,t,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,o){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==o})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,o){t.add(e,o),n||(n=i(t.drain))}function s(e){var n,t=typeof e;return null==e||"object"!=t&&"function"!=t||(n=e.then),"function"==typeof n&&n}function a(){for(var e=0;e<this.chain.length;e++)d(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function d(e,n,t){var o,i;try{!1===n?t.reject(e.msg):(o=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=s(o))?i.call(o,t.resolve,t.reject):t.resolve(o)}catch(e){t.reject(e)}}function c(e){var n,t=this;if(!t.triggered){t.triggered=!0,t.def&&(t=t.def);try{(n=s(e))?r((function(){var o=new u(t);try{n.call(e,(function(){c.apply(o,arguments)}),(function(){l.apply(o,arguments)}))}catch(e){l.call(o,e)}})):(t.msg=e,t.state=1,t.chain.length>0&&r(a,t))}catch(e){l.call(new u(t),e)}}}function l(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&r(a,n))}function p(e,n,t,o){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then((function(e){t(i,e)}),o)}(i)}function u(e){this.def=e,this.triggered=!1}function f(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function h(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new f(this);this.then=function(e,t){var o={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return o.promise=new this.constructor((function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");o.resolve=e,o.reject=n})),n.chain.push(o),0!==n.state&&r(a,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,(function(e){c.call(n,e)}),(function(e){l.call(n,e)}))}catch(e){l.call(n,e)}}t=function(){var e,t,o;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){o=new i(n,r),t?t.next=o:e=o,t=o,o=void 0},drain:function(){var o=e;for(e=t=n=void 0;o;)o.fn.call(o.self),o=o.next}}}();var m=e({},"constructor",h,!1);return h.prototype=m,e(m,"__NPO__",0,!1),e(h,"resolve",(function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this((function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");n(e)}))})),e(h,"reject",(function(e){return new this((function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");t(e)}))})),e(h,"all",(function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n((function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),s=0;p(n,e,(function(e,n){r[e]=n,++s===i&&t(r)}),o)}))})),e(h,"race",(function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):new n((function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");p(n,e,(function(e,n){t(n)}),o)}))})),h},(o=n)[t="Promise"]=o[t]||i(),e.exports&&(e.exports=o[t])}));var t="0.8.6";let o=function(e){return e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentOnHold="SessionPaymentOnHold",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError",e.SessionLocked="SessionLocked",e.SessionLockFailed="SessionLockFailed",e.ActivePaymentProductType="ActivePaymentProductType",e.ValidateSession="ValidateSession",e}({}),i=function(e){return e.HeightChanged="HeightChanged",e.LanguageChanged="LanguageChanged",e.ScrollToTop="ScrollToTop",e.ShowPopOutButton="ShowPopOutButton",e.HidePopOutButton="HidePopOutButton",e}({});const r=e=>e.endsWith("/")?e:`${e}/`,s=({sid:e,endpoint:n,language:o,shouldCallValidateSession:i})=>{const s=new URLSearchParams;return s.append("ui","fullscreen"),s.append("role","pop_out_payment"),s.append("sid",e),s.append("sdk",t),o&&s.append("language",o),i?(s.append("loader","true"),`${r(n)}?${s.toString()}`):`${r(n)}?${s.toString()}`},a=e=>{const{sid:n,endpoint:o,language:i,ui:s,shouldCallValidateSession:a,popOut:d}=e;if(!o)throw new Error("Invalid endpoint");const c=new URLSearchParams;return c.append("sdk",t),s&&c.append("ui",s),i&&c.append("language",i),a&&c.append("client_side_validation","true"),d&&c.append("role","pop_out_launcher"),e.hasOwnProperty("hideTestMessage")&&void 0!==e.hideTestMessage&&!0===e.hideTestMessage&&c.append("hide_test_message","true"),"https://checkout.dintero.com"===o?`${o}/v1/view/${n}?${c.toString()}`:(c.append("sid",n),`${r(o)}?${c.toString()}`)},d=e=>{window.location.assign(e)},c=(e,n,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"ValidationResult",sid:n,...t},"*")},l=e=>{const{sid:n,endpoint:t,handler:o,eventTypes:i,checkout:r}=e,s=new URL(t),a=e=>{const t=e.origin===s.origin,a=e.source===r.iframe.contentWindow,d=e.data&&e.data.sid===n,c=-1!==i.indexOf(e.data&&e.data.type);t&&a&&d&&c&&(((e,n)=>{n.data.mid&&e&&e.postMessage({ack:n.data.mid},n.origin||"*")})(r.iframe.contentWindow,e),o(e.data,r))};window.addEventListener("message",a,!1);return{unsubscribe:()=>{window.removeEventListener("message",a,!1)}}},p="dintero-checkout-sdk-style",u="dintero-checkout-sdk-backdrop",f="dintero-checkout-sdk-backdrop-description",h="dintero-checkout-sdk-backdrop-focus",m="dintero-checkout-sdk-backdrop-close",g=e=>n=>(n.preventDefault(),n.stopPropagation(),e(),!1),y=()=>{const e=document.createElement("div");return e.setAttribute("id",u),e.setAttribute("role","dialog"),e.style.zIndex=(()=>{const e=document.getElementsByTagName("*"),n=Array.from(e).reduce(((e,n)=>{try{const t=document.defaultView.getComputedStyle(n,null).getPropertyValue("z-index"),o=parseInt(t||"0");if(!isNaN(o)&&o>e)return o}catch(e){console.error(e)}return e}),0);return n<9999?"9999":(n+1).toString()})(),e},w=e=>{const n=document.getElementById(h),t=document.getElementById(m);"Tab"!==e.key&&"Tab"!==e.code||(document.activeElement===n?(t.focus(),e.preventDefault()):(n.focus(),e.preventDefault()))},v=e=>{(()=>{if(document.getElementById(p))return;const e=document.createElement("style");e.setAttribute("id",p),e.innerHTML=`\n @keyframes ${u}-fade-in {\n from {opacity: 0;}\n to {opacity: 1;}\n }\n\n #${u} {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n height: 100vh;\n width: 100vw;\n background-color: rgba(0,0,0,0.9);\n background: radial-gradient(rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.8) 100%);\n cursor: pointer;\n animation: 20ms ease-out ${u}-fade-in;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 20px;\n color: #ffffff;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n font-size: 18px;\n font-weight: 400;\n line-height: normal;\n text-rendering: geometricPrecision;\n margin: 0;\n padding: 0;\n border: 0;\n vertical-align: baseline;\n line-height: normal;\n }\n\n #${u} p {\n padding: 0;\n margin: 0;\n border: 0;\n user-select: none;\n }\n\n #${h} {\n background-color: #efefef !important;\n color: #000000 !important;\n font-size: 16px !important;\n font-weight: 600 !important;\n border-radius: 200px !important;\n margin: 0 !important;\n line-height: normal !important;\n border: none !important;\n padding: 10px 20px !important;\n user-select: none !important;\n cursor: pointer !important;\n }\n #${h}:hover,\n #${h}:focus {\n outline: none !important;\n background-color: #ffffff !important;\n border: none !important;\n color: #000000 !important;\n padding: 10px 20px !important;\n margin: 0 !important;\n }\n #${h}:focus{\n outline-offset: 2px;\n outline: 1px #ffffff solid !important;\n }\n\n #${m} {\n background: transparent !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n border-radius: 4px !important;\n height: 24px !important;\n width: 24px !important;\n color: #efefef !important;\n position: absolute !important;\n top: 16px !important;\n right: 24px !important;\n transition: all 200ms ease-out !important;\n cursor: pointer !important;\n }\n\n #${m}:hover,\n #${m}:focus {\n outline: none !important;\n color: #ffffff !important;\n border: none !important;\n background: transparent !important;\n padding: 0 !important;\n margin: 0 !important;\n position: absolute;\n top: 16px;\n right: 24px;\n }\n #${m}:focus{\n outline: 1px #ffffff solid !important;\n }\n\n #${u}:before,\n #${u}:after,\n #${u} > *:before,\n #${u} > *:after {\n content: '';\n content: none;\n }\n `,document.head.appendChild(e)})();const n=y(),t=(e=>{const n=document.createElement("button");return n.setAttribute("id",m),n.setAttribute("type","button"),n.setAttribute("aria-label",e),n.innerHTML='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n fill="none"\n stroke="currentColor"\n stroke-width="2"\n stroke-linecap="round"\n stroke-linejoin="round"\n alt="close icon"\n >\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>',n})(e.event.closeLabel),o=(()=>{const e=document.createElement("div");return e.innerHTML='\n <svg width="120px" height="22px" viewBox="0 0 630 111" version="1.1" >\n <g id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">\n <g id="Dintero" fill="#ffffff" fillRule="nonzero">\n <path d="M376.23,60.48 L376.23,73.54 L454.13,73.54 C456.31,41.55 435.85,23.71 410.61,23.71 C385.37,23.71 367.09,41.77 367.09,66.79 C367.09,92.03 386.02,110.31 411.91,110.31 C433.02,110.31 448.9,97.25 453.25,82.24 L436.5,82.24 C432.37,89.42 423.88,95.51 411.91,95.51 C395.16,95.51 382.75,83.11 382.75,66.79 C382.75,50.69 394.72,38.5 410.6,38.5 C426.48,38.5 438.45,50.68 438.45,66.79 L444.54,60.48 L376.23,60.48 Z M154.29,17.83 L171.7,17.83 L171.7,0.42 L154.29,0.42 L154.29,17.83 Z M120.34,108.13 L191.27,108.13 L191.27,93.77 L120.34,93.77 L120.34,108.13 Z M156.46,40.24 L156.46,108.13 L171.69,108.13 L171.69,45.47 C171.69,32.85 165.82,25.89 151.89,25.89 L120.34,25.89 L120.34,40.25 L156.46,40.25 L156.46,40.24 Z M499.17,25.88 L464.36,25.88 L464.36,40.24 L483.94,40.24 L484.16,108.13 L499.39,108.13 L499.17,62.44 C499.17,48.51 508.53,40.25 521.58,40.25 L535.29,40.25 L535.29,25.89 L524.41,25.89 C509.18,25.89 501.78,31.33 497.65,41.56 L495.47,47 L499.17,47.65 L499.17,25.88 Z M288.76,25.88 L310.52,25.88 L310.52,6.3 L325.75,6.3 L325.75,25.88 L359.69,25.88 L359.69,40.24 L325.75,40.24 L325.75,93.77 L359.69,93.77 L359.69,108.13 L332.49,108.13 C318.56,108.13 310.51,98.99 310.51,86.37 L310.51,40.24 L288.75,40.24 L288.75,25.88 L288.76,25.88 Z M464.35,108.13 L535.28,108.13 L535.28,93.77 L464.35,93.77 L464.35,108.13 Z M108.6,54.17 C108.6,23.06 85.54,0.43 53.77,0.43 L0.9,0.43 L0.9,108.14 L53.77,108.14 C85.53,108.13 108.6,85.5 108.6,54.17 M248.07,23.71 C234.58,23.71 223.92,31.98 220,41.55 L220,25.88 L204.77,25.88 L204.77,108.13 L220,108.13 L220,66.35 C220,53.08 224.79,38.93 243.72,38.93 C259.39,38.93 267.44,48.07 267.44,67.43 L267.44,108.12 L282.67,108.12 L282.67,64.6 C282.67,35.02 265.91,23.71 248.07,23.71 M586.2,110.31 C611.22,110.31 629.72,92.03 629.72,67.01 C629.72,41.99 611.23,23.71 586.2,23.71 C560.96,23.71 542.68,41.99 542.68,67.01 C542.68,92.03 560.96,110.31 586.2,110.31 M586.2,95.51 C570.32,95.51 558.35,83.33 558.35,67.01 C558.35,50.69 570.32,38.51 586.2,38.51 C602.08,38.51 614.05,50.69 614.05,67.01 C614.05,83.33 602.08,95.51 586.2,95.51 M16.99,92.9 L16.99,15.66 L51.8,15.66 C75.3,15.66 92.05,31.98 92.05,54.61 C92.05,76.8 75.3,92.91 51.8,92.91 L16.99,92.91 L16.99,92.9 Z" id="Shape"></path>\n </g>\n </g>\n </svg>',e})(),i=(e=>{const n=document.createElement("p");return n.setAttribute("id",f),n.innerText=e,n})(e.event.descriptionLabel),r=(e=>{const n=document.createElement("button");return n.setAttribute("id",h),n.setAttribute("type","button"),n.innerText=e,n})(e.event.focusLabel);return n.onclick=g(e.focus),r.onclick=g(e.focus),t.onclick=g(e.close),document.addEventListener("keydown",w),n.appendChild(t),n.appendChild(o),n.appendChild(i),n.appendChild(r),document.body.appendChild(n),n.focus(),n},b=()=>{try{const e=document.getElementById(u);e&&document.body.removeChild(e),document.removeEventListener("keydown",w)}catch(e){console.error(e)}},L="dintero-checkout-sdk-launch-pop-out",S=(e,n)=>{if(!e&&!n)return;const t=`${L}-styles`;if(document.getElementById(t))return;const o=document.createElement("style");o.setAttribute("id",t);let i=[];e&&i.push(C(`#${L}:hover:not(:disabled)`,e)),n&&i.push(C(`#${L}:focus-visible`,n)),o.textContent=i.join("\n"),document.head.appendChild(o)},C=(e,n)=>[`${e} {`,T(n),"}"].join("\n"),T=e=>Object.entries(e).map((([e,n])=>` ${k(e)}: ${n} !important;`)).join("\n"),k=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),x=e=>{const{container:n}=e,t=document.getElementById(L),o=t||document.createElement("button");((e,{label:n,disabled:t,top:o,left:i,right:r,styles:s,onClick:a,stylesHover:d,stylesFocusVisible:c})=>{e.setAttribute("id",L),e.setAttribute("type","button"),"true"===t?e.setAttribute("disabled",t):e.removeAttribute("disabled"),e.onclick=n=>{n.preventDefault(),n.stopPropagation(),e.style.boxShadow="inset 0 0 10px rgba(34, 84, 65, 0.9)",a(),window.setTimeout((()=>{e.style.boxShadow="none"}),200)},e.innerText=n,e.style.position="absolute",e.style.top=o+"px",e.style.left=i+"px",e.style.right=r+"px";const{...l}=s;for(const[n,t]of Object.entries(l))e.style[n]=t;try{S(d,c)}catch(e){console.error(e)}})(o,e),t||n.appendChild(o)},E=()=>{try{const e=document.getElementById(L);e&&e.remove()}catch(e){console.error(e)}},P=Math.min(480,window.screen.width),O=Math.min(840,window.screen.height);let $;const A=async e=>{let n,t=-1;if($&&!$.closed)return;const o=s(e);$=await((e,n,t,o)=>new Promise((i=>{try{const r=window.screenX+(window.outerWidth-t)/2,s=window.screenY+(window.outerHeight-o)/2,a=`width=${t},height=${o},left=${r},top=${s},location=no,menubar=no,toolbar=no,status=no`;let d,c=-1;const l=t=>{const o=t.source===d,r=t.origin===new URL(n).origin,s=t.data&&"AppLoaded"===t.data.type,a="popOut"===t.data.context,p=t.data.sid===e;o&&r&&s&&a&&p&&(clearTimeout(c),i(d),window.removeEventListener("message",l))};if(window.addEventListener("message",l),d=window.open(n,"dintero-checkout",a),!d)return console.log("createPopOutWindow no popOut"),void i(void 0);c=window.setTimeout((()=>{console.log("createPopOutWindow timeout"),i(void 0)}),3e3)}catch(e){i(void 0)}})))(e.sid,o,P,O);const i=()=>{window.clearInterval(t),t=-1,window.removeEventListener("beforeunload",r),$=void 0,e.onClose(),n&&n()},r=()=>{$&&$.close(),i()};return window.addEventListener("beforeunload",r),t=window.setInterval((()=>{$&&$.closed&&i()}),200),n=e.onOpen($),{close:r,focus:()=>{$&&$.focus()},popOutWindow:$}},W=(e,n)=>{F(n),e.href&&d(e.href)},M=(e,n)=>{(e.height||0===e.height)&&n.iframe.setAttribute("style",`width:100%; height:${e.height}px;`)},_=(e,n)=>{try{n.iframe.scrollIntoView({block:"start",behavior:"smooth"})}catch(e){console.error(e)}},j=(e,n)=>{e.language&&(n.language=e.language)},V=(e,n)=>{const t={internalPopOutHandler:!0,eventTypes:[i.LanguageChanged],handler:(e,n)=>{var t,o,i;t=n.iframe,o=n.options.sid,i=e.language,t.contentWindow&&t.contentWindow.postMessage({type:"SetLanguage",sid:o,language:i},"*")}},r={internalPopOutHandler:!0,eventTypes:[o.SessionCancel,o.SessionPaymentOnHold,o.SessionPaymentAuthorized,o.SessionPaymentError],handler:(n,t)=>{if(n.href){E();try{e.close()}catch(e){console.error(e)}}else console.error("Payment Complete event missing href property")}},s=o=>{o.source===e&&"popOut"===o.data.context&&o.data.sid===n.options.sid&&[t,r,...n.handlers].forEach((e=>{e.eventTypes.includes(o.data.type)&&e.handler&&(e=>{try{e()}catch(e){console.error(e)}})((()=>{e.handler(o.data,n)}))}))};return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},B=async(e,n)=>{const{close:t,focus:o,popOutWindow:i}=await A({sid:n.options.sid,endpoint:n.options.endpoint,shouldCallValidateSession:Boolean(n.options.onValidateSession),language:e.language,onOpen:e=>V(e,n),onClose:()=>{var e,t;b(),e=n.iframe,t=n.options.sid,e.contentWindow&&e.contentWindow.postMessage({type:"ClosedPopOut",sid:t},"*"),(e=>{try{const n=document.getElementById(L);n&&(e?n.setAttribute("disabled",e.toString()):n.removeAttribute("disabled"))}catch(e){console.error(e)}})(!1),n.popOutWindow=void 0}});return i?(r=n.iframe,s=n.options.sid,r.contentWindow&&r.contentWindow.postMessage({type:"OpenedPopOut",sid:s},"*"),n.popOutWindow=i,(e=>{try{if(document.getElementById(u))return;return v(e)}catch(e){console.error(e)}})({focus:o,close:t,event:e}),!0):(((e,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"OpenPopOutFailed",sid:n},"*")})(n.iframe,n.options.sid),!1);var r,s},I=async(e,n)=>{if(await B(e,n)&&n.options.onValidateSession){t=n.iframe,i=n.options.sid,t.contentWindow&&t.contentWindow.postMessage({type:"ValidatingPopOut",sid:i},"*");const r=((e,n)=>t=>{c(n.iframe,n.options.sid,t),t.success&&n.popOutWindow?n.popOutWindow.location.href=s({sid:n.options.sid,endpoint:n.options.endpoint,shouldCallValidateSession:!1,language:e.language}):(n.popOutWindow&&n.popOutWindow.close(),console.error(t.clientValidationError))})(e,n);try{n.options.onValidateSession({type:o.ValidateSession,session:n.session,callback:r},n,r)}catch(e){console.error(e),c(n.iframe,n.options.sid,{success:!1,clientValidationError:"Validation runtime error"})}}var t,i},H=(e,n)=>{(e=>e&&e.type===i.ShowPopOutButton)(e)&&(x({container:n.options.innerContainer,label:e.openLabel,top:e.top,left:e.left,right:e.right,styles:e.styles,stylesHover:e.stylesHover,stylesFocusVisible:e.stylesFocusVisible,disabled:e.disabled,onClick:()=>I(e,n)}),(e=>{const n=document.getElementById(h);n&&(n.innerText=e.focusLabel);const t=document.getElementById(f);t&&(t.innerText=e.descriptionLabel);const o=document.getElementById(m);o&&o.setAttribute("aria-label",e.descriptionLabel)})(e))},N=(e,n)=>{e.type===i.HidePopOutButton&&E()},F=e=>{if(E(),b(),e.popOutWindow)try{e.popOutWindow.close()}catch(e){console.error(e)}};e.embed=async e=>{const n=document.createElement("div");n.style.position="relative",n.style["box-sizing"]="border-box";const r={endpoint:"https://checkout.dintero.com",innerContainer:n,...e},{container:s,sid:d,language:p,endpoint:u,onSession:f,onSessionCancel:h,onPayment:m,onPaymentAuthorized:g,onPaymentError:y,onSessionNotFound:w,onSessionLocked:v,onSessionLockFailed:L,onActivePaymentType:S,onValidateSession:C,popOut:T}=r;let k;const x=[];let E=!1;s.appendChild(n);const{iframe:P,initiate:O}=((e,n,t)=>{if(!e||!e.appendChild)throw new Error("Invalid container");const o=document.createElement("iframe");return o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:0;"),o.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"),o.setAttribute("allow","payment"),o.setAttribute("importance","high"),o.setAttribute("src",t),{iframe:o,initiate:async()=>new Promise(((n,t)=>{o.onload=()=>n(),o.onerror=()=>t(),e.appendChild(o)}))}})(n,0,a({sid:d,endpoint:u,language:p,ui:e.ui||"inline",shouldCallValidateSession:void 0!==C,popOut:T,...e.hasOwnProperty("hideTestMessage")&&{hideTestMessage:e.hideTestMessage}})),$=(e,n,t)=>{if(!k)throw new Error("Unable to create action promise: checkout is undefined");return new Promise(((o,i)=>{const r=[];r.push(l({sid:d,endpoint:u,handler:e=>{r.forEach((e=>e.unsubscribe())),o(e)},eventTypes:[n],checkout:k,source:k.iframe.contentWindow})),r.push(l({sid:d,endpoint:u,handler:()=>{r.forEach((e=>e.unsubscribe())),i(`Received unexpected event: ${t}`)},eventTypes:[t],checkout:k,source:k.iframe.contentWindow})),e()}))},A=()=>$((()=>{((e,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"RefreshSession",sid:n},"*")})(P,d)}),o.SessionUpdated,o.SessionNotFound),V=e=>{c(P,d,e)},B=(e,n,i)=>(e,r)=>{if(!E){E=!0,F(r);const s=["sid","merchant_reference","transaction_id","error"].map((n=>[n,e[n]]));e.type!==o.SessionCancel||e.error||s.push(["error","cancelled"]),s.push(["language",r.language]),s.push(["sdk",t]);const a=s.filter((([e,n])=>n)).map((([e,n])=>`${e}=${n}`)).join("&");r.iframe.setAttribute("src",((e,n,t)=>{const o=e.endsWith("/")?"":"/";return`${e}${o}${n}?${t}`})(n,"embedResult/",a)),i(e,r)}},I=[{handler:j,eventTypes:[i.LanguageChanged]},{handler:M,eventTypes:[i.HeightChanged]},{handler:_,eventTypes:[i.ScrollToTop]},{handler:(e,n)=>{n.session=e.session,f&&f(e,n)},eventTypes:[o.SessionLoaded,o.SessionUpdated]},{eventTypes:[o.SessionPaymentOnHold],handler:B(0,u,m||W)},{eventTypes:[o.SessionPaymentAuthorized],handler:B(0,u,g||m||W)},{handler:B(0,u,h||W),eventTypes:[o.SessionCancel]},{handler:B(0,u,y||W),eventTypes:[o.SessionPaymentError]},{handler:w,eventTypes:[o.SessionNotFound]},{handler:(e,n)=>{v&&v(e,n,A)},eventTypes:[o.SessionLocked]},{handler:L,eventTypes:[o.SessionLockFailed]},{handler:S,eventTypes:[o.ActivePaymentProductType]},{handler:(e,n)=>{if(C)try{C({...e,callback:V},n,V)}catch(e){console.error(e),V({success:!1,clientValidationError:"Validation runtime error"})}},eventTypes:[o.ValidateSession]},{handler:H,eventTypes:[i.ShowPopOutButton]},{handler:N,eventTypes:[i.HidePopOutButton]}];return k={destroy:()=>{F(k),P&&(r.popOut&&b(),x.forEach((e=>e.unsubscribe())),P.parentElement&&n.removeChild(P)),n.parentElement&&s.removeChild(n)},iframe:P,language:p,lockSession:()=>$((()=>{((e,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"LockSession",sid:n},"*")})(P,d)}),o.SessionLocked,o.SessionLockFailed),refreshSession:A,setActivePaymentProductType:e=>{((e,n,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"SetActivePaymentProductType",sid:n,payment_product_type:t},"*")})(P,d,e)},submitValidationResult:V,options:r,handlers:I,session:void 0,popOutWindow:void 0},I.forEach((({handler:e,eventTypes:n})=>{e&&x.push(l({sid:d,endpoint:u,handler:e,eventTypes:n,checkout:k,source:k.iframe.contentWindow}))})),await O(),k},e.redirect=e=>{const{sid:n,language:t,endpoint:o="https://checkout.dintero.com"}=e;d(a({sid:n,endpoint:o,language:t,shouldCallValidateSession:!1}))},Object.defineProperty(e,"__esModule",{value:!0})}));
6
+ var n,o,i;i=function(){var e,t,n,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,t,n,o){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:!1!==o})}}catch(t){e=function(e,t,n){return e[t]=n,e}}function r(e,o){n.add(e,o),t||(t=i(n.drain))}function s(e){var t,n=typeof e;return null==e||"object"!=n&&"function"!=n||(t=e.then),"function"==typeof t&&t}function a(){for(var e=0;e<this.chain.length;e++)d(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function d(e,t,n){var o,i;try{!1===t?n.reject(e.msg):(o=!0===t?e.msg:t.call(void 0,e.msg))===n.promise?n.reject(TypeError("Promise-chain cycle")):(i=s(o))?i.call(o,n.resolve,n.reject):n.resolve(o)}catch(e){n.reject(e)}}function c(e){var t,n=this;if(!n.triggered){n.triggered=!0,n.def&&(n=n.def);try{(t=s(e))?r((function(){var o=new u(n);try{t.call(e,(function(){c.apply(o,arguments)}),(function(){l.apply(o,arguments)}))}catch(e){l.call(o,e)}})):(n.msg=e,n.state=1,n.chain.length>0&&r(a,n))}catch(e){l.call(new u(n),e)}}}function l(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&r(a,t))}function p(e,t,n,o){for(var i=0;i<t.length;i++)!function(i){e.resolve(t[i]).then((function(e){n(i,e)}),o)}(i)}function u(e){this.def=e,this.triggered=!1}function f(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function h(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var t=new f(this);this.then=function(e,n){var o={success:"function"!=typeof e||e,failure:"function"==typeof n&&n};return o.promise=new this.constructor((function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");o.resolve=e,o.reject=t})),t.chain.push(o),0!==t.state&&r(a,t),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,(function(e){c.call(t,e)}),(function(e){l.call(t,e)}))}catch(e){l.call(t,e)}}n=function(){var e,n,o;function i(e,t){this.fn=e,this.self=t,this.next=void 0}return{add:function(t,r){o=new i(t,r),n?n.next=o:e=o,n=o,o=void 0},drain:function(){var o=e;for(e=n=t=void 0;o;)o.fn.call(o.self),o=o.next}}}();var m=e({},"constructor",h,!1);return h.prototype=m,e(m,"__NPO__",0,!1),e(h,"resolve",(function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this((function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");t(e)}))})),e(h,"reject",(function(e){return new this((function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");n(e)}))})),e(h,"all",(function(e){var t=this;return"[object Array]"!=o.call(e)?t.reject(TypeError("Not an array")):0===e.length?t.resolve([]):new t((function(n,o){if("function"!=typeof n||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),s=0;p(t,e,(function(e,t){r[e]=t,++s===i&&n(r)}),o)}))})),e(h,"race",(function(e){var t=this;return"[object Array]"!=o.call(e)?t.reject(TypeError("Not an array")):new t((function(n,o){if("function"!=typeof n||"function"!=typeof o)throw TypeError("Not a function");p(t,e,(function(e,t){n(t)}),o)}))})),h},(o=t)[n="Promise"]=o[n]||i(),e.exports&&(e.exports=o[n])}));var n="0.8.8";let o=function(e){return e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentOnHold="SessionPaymentOnHold",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError",e.SessionLocked="SessionLocked",e.SessionLockFailed="SessionLockFailed",e.ActivePaymentProductType="ActivePaymentProductType",e.ValidateSession="ValidateSession",e}({}),i=function(e){return e.HeightChanged="HeightChanged",e.LanguageChanged="LanguageChanged",e.ScrollToTop="ScrollToTop",e.ShowPopOutButton="ShowPopOutButton",e.HidePopOutButton="HidePopOutButton",e}({});const r=e=>e.endsWith("/")?e:`${e}/`,s=({sid:e,endpoint:t,language:o,shouldCallValidateSession:i})=>{const s=new URLSearchParams;return s.append("ui","fullscreen"),s.append("role","pop_out_payment"),s.append("sid",e),s.append("sdk",n),o&&s.append("language",o),i?(s.append("loader","true"),`${r(t)}?${s.toString()}`):`${r(t)}?${s.toString()}`},a=e=>{const{sid:t,endpoint:o,language:i,ui:s,shouldCallValidateSession:a,popOut:d}=e;if(!o)throw new Error("Invalid endpoint");const c=new URLSearchParams;return c.append("sdk",n),s&&c.append("ui",s),i&&c.append("language",i),a&&c.append("client_side_validation","true"),d&&c.append("role","pop_out_launcher"),e.hasOwnProperty("hideTestMessage")&&void 0!==e.hideTestMessage&&!0===e.hideTestMessage&&c.append("hide_test_message","true"),"https://checkout.dintero.com"===o?`${o}/v1/view/${t}?${c.toString()}`:(c.append("sid",t),`${r(o)}?${c.toString()}`)},d=e=>{window.location.assign(e)},c=(e,t,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"ValidationResult",sid:t,...n},"*")},l=e=>{const{sid:t,endpoint:n,handler:o,eventTypes:i,checkout:r}=e,s=new URL(n),a=e=>{const n=e.origin===s.origin,a=e.source===r.iframe.contentWindow,d=e.data&&e.data.sid===t,c=-1!==i.indexOf(e.data&&e.data.type);n&&a&&d&&c&&(((e,t)=>{t.data.mid&&e&&e.postMessage({ack:t.data.mid},t.origin||"*")})(r.iframe.contentWindow,e),o(e.data,r))};window.addEventListener("message",a,!1);return{unsubscribe:()=>{window.removeEventListener("message",a,!1)}}},p="dintero-checkout-sdk-style",u="dintero-checkout-sdk-backdrop",f="dintero-checkout-sdk-backdrop-description",h="dintero-checkout-sdk-backdrop-focus",m="dintero-checkout-sdk-backdrop-close",g=e=>t=>(t.preventDefault(),t.stopPropagation(),e(),!1),y=()=>{const e=document.createElement("div");return e.setAttribute("id",u),e.setAttribute("role","dialog"),e.style.zIndex=(()=>{const e=document.getElementsByTagName("*"),t=Array.from(e).reduce(((e,t)=>{try{const n=document.defaultView.getComputedStyle(t,null).getPropertyValue("z-index"),o=parseInt(n||"0");if(!isNaN(o)&&o>e)return o}catch(e){console.error(e)}return e}),0);return t<9999?"9999":(t+1).toString()})(),e},w=e=>{const t=document.getElementById(h),n=document.getElementById(m);"Tab"!==e.key&&"Tab"!==e.code||(document.activeElement===t?(n.focus(),e.preventDefault()):(t.focus(),e.preventDefault()))},v=e=>{(()=>{if(document.getElementById(p))return;const e=document.createElement("style");e.setAttribute("id",p),e.innerHTML=`\n @keyframes ${u}-fade-in {\n from {opacity: 0;}\n to {opacity: 1;}\n }\n\n #${u} {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n height: 100vh;\n width: 100vw;\n background-color: rgba(0,0,0,0.9);\n background: radial-gradient(rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.8) 100%);\n cursor: pointer;\n animation: 20ms ease-out ${u}-fade-in;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: 20px;\n color: #ffffff;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n font-size: 18px;\n font-weight: 400;\n line-height: normal;\n text-rendering: geometricPrecision;\n margin: 0;\n padding: 0;\n border: 0;\n vertical-align: baseline;\n line-height: normal;\n }\n\n #${u} p {\n padding: 0;\n margin: 0;\n border: 0;\n user-select: none;\n }\n\n #${h} {\n background-color: #efefef !important;\n color: #000000 !important;\n font-size: 16px !important;\n font-weight: 600 !important;\n border-radius: 200px !important;\n margin: 0 !important;\n line-height: normal !important;\n border: none !important;\n padding: 10px 20px !important;\n user-select: none !important;\n cursor: pointer !important;\n }\n #${h}:hover,\n #${h}:focus {\n outline: none !important;\n background-color: #ffffff !important;\n border: none !important;\n color: #000000 !important;\n padding: 10px 20px !important;\n margin: 0 !important;\n }\n #${h}:focus{\n outline-offset: 2px;\n outline: 1px #ffffff solid !important;\n }\n\n #${m} {\n background: transparent !important;\n padding: 0 !important;\n margin: 0 !important;\n border: none !important;\n border-radius: 4px !important;\n height: 24px !important;\n width: 24px !important;\n color: #efefef !important;\n position: absolute !important;\n top: 16px !important;\n right: 24px !important;\n transition: all 200ms ease-out !important;\n cursor: pointer !important;\n }\n\n #${m}:hover,\n #${m}:focus {\n outline: none !important;\n color: #ffffff !important;\n border: none !important;\n background: transparent !important;\n padding: 0 !important;\n margin: 0 !important;\n position: absolute;\n top: 16px;\n right: 24px;\n }\n #${m}:focus{\n outline: 1px #ffffff solid !important;\n }\n\n #${u}:before,\n #${u}:after,\n #${u} > *:before,\n #${u} > *:after {\n content: '';\n content: none;\n }\n `,document.head.appendChild(e)})();const t=y(),n=(e=>{const t=document.createElement("button");return t.setAttribute("id",m),t.setAttribute("type","button"),t.setAttribute("aria-label",e),t.innerHTML='\n <svg\n xmlns="http://www.w3.org/2000/svg"\n width="24"\n height="24"\n viewBox="0 0 24 24"\n fill="none"\n stroke="currentColor"\n stroke-width="2"\n stroke-linecap="round"\n stroke-linejoin="round"\n alt="close icon"\n >\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>',t})(e.event.closeLabel),o=(()=>{const e=document.createElement("div");return e.innerHTML='\n <svg width="120px" height="22px" viewBox="0 0 630 111" version="1.1" >\n <g id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">\n <g id="Dintero" fill="#ffffff" fillRule="nonzero">\n <path d="M376.23,60.48 L376.23,73.54 L454.13,73.54 C456.31,41.55 435.85,23.71 410.61,23.71 C385.37,23.71 367.09,41.77 367.09,66.79 C367.09,92.03 386.02,110.31 411.91,110.31 C433.02,110.31 448.9,97.25 453.25,82.24 L436.5,82.24 C432.37,89.42 423.88,95.51 411.91,95.51 C395.16,95.51 382.75,83.11 382.75,66.79 C382.75,50.69 394.72,38.5 410.6,38.5 C426.48,38.5 438.45,50.68 438.45,66.79 L444.54,60.48 L376.23,60.48 Z M154.29,17.83 L171.7,17.83 L171.7,0.42 L154.29,0.42 L154.29,17.83 Z M120.34,108.13 L191.27,108.13 L191.27,93.77 L120.34,93.77 L120.34,108.13 Z M156.46,40.24 L156.46,108.13 L171.69,108.13 L171.69,45.47 C171.69,32.85 165.82,25.89 151.89,25.89 L120.34,25.89 L120.34,40.25 L156.46,40.25 L156.46,40.24 Z M499.17,25.88 L464.36,25.88 L464.36,40.24 L483.94,40.24 L484.16,108.13 L499.39,108.13 L499.17,62.44 C499.17,48.51 508.53,40.25 521.58,40.25 L535.29,40.25 L535.29,25.89 L524.41,25.89 C509.18,25.89 501.78,31.33 497.65,41.56 L495.47,47 L499.17,47.65 L499.17,25.88 Z M288.76,25.88 L310.52,25.88 L310.52,6.3 L325.75,6.3 L325.75,25.88 L359.69,25.88 L359.69,40.24 L325.75,40.24 L325.75,93.77 L359.69,93.77 L359.69,108.13 L332.49,108.13 C318.56,108.13 310.51,98.99 310.51,86.37 L310.51,40.24 L288.75,40.24 L288.75,25.88 L288.76,25.88 Z M464.35,108.13 L535.28,108.13 L535.28,93.77 L464.35,93.77 L464.35,108.13 Z M108.6,54.17 C108.6,23.06 85.54,0.43 53.77,0.43 L0.9,0.43 L0.9,108.14 L53.77,108.14 C85.53,108.13 108.6,85.5 108.6,54.17 M248.07,23.71 C234.58,23.71 223.92,31.98 220,41.55 L220,25.88 L204.77,25.88 L204.77,108.13 L220,108.13 L220,66.35 C220,53.08 224.79,38.93 243.72,38.93 C259.39,38.93 267.44,48.07 267.44,67.43 L267.44,108.12 L282.67,108.12 L282.67,64.6 C282.67,35.02 265.91,23.71 248.07,23.71 M586.2,110.31 C611.22,110.31 629.72,92.03 629.72,67.01 C629.72,41.99 611.23,23.71 586.2,23.71 C560.96,23.71 542.68,41.99 542.68,67.01 C542.68,92.03 560.96,110.31 586.2,110.31 M586.2,95.51 C570.32,95.51 558.35,83.33 558.35,67.01 C558.35,50.69 570.32,38.51 586.2,38.51 C602.08,38.51 614.05,50.69 614.05,67.01 C614.05,83.33 602.08,95.51 586.2,95.51 M16.99,92.9 L16.99,15.66 L51.8,15.66 C75.3,15.66 92.05,31.98 92.05,54.61 C92.05,76.8 75.3,92.91 51.8,92.91 L16.99,92.91 L16.99,92.9 Z" id="Shape"></path>\n </g>\n </g>\n </svg>',e})(),i=(e=>{const t=document.createElement("p");return t.setAttribute("id",f),t.innerText=e,t})(e.event.descriptionLabel),r=(e=>{const t=document.createElement("button");return t.setAttribute("id",h),t.setAttribute("type","button"),t.innerText=e,t})(e.event.focusLabel);return t.onclick=g(e.focus),r.onclick=g(e.focus),n.onclick=g(e.close),document.addEventListener("keydown",w),t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(r),document.body.appendChild(t),t.focus(),t},b=()=>{try{const e=document.getElementById(u);e&&document.body.removeChild(e),document.removeEventListener("keydown",w)}catch(e){console.error(e)}},L="dintero-checkout-sdk-launch-pop-out",S=(e,t)=>{if(!e&&!t)return;const n=`${L}-styles`;if(document.getElementById(n))return;const o=document.createElement("style");o.setAttribute("id",n);let i=[];e&&i.push(C(`#${L}:hover:not(:disabled)`,e)),t&&i.push(C(`#${L}:focus-visible`,t)),o.textContent=i.join("\n"),document.head.appendChild(o)},C=(e,t)=>[`${e} {`,T(t),"}"].join("\n"),T=e=>Object.entries(e).map((([e,t])=>` ${k(e)}: ${t} !important;`)).join("\n"),k=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),x=e=>{const{container:t}=e,n=document.getElementById(L),o=n||document.createElement("button");((e,{label:t,disabled:n,top:o,left:i,right:r,styles:s,onClick:a,stylesHover:d,stylesFocusVisible:c})=>{e.setAttribute("id",L),e.setAttribute("type","button"),"true"===n?e.setAttribute("disabled",n):e.removeAttribute("disabled"),e.onclick=t=>{t.preventDefault(),t.stopPropagation(),e.style.boxShadow="inset 0 0 10px rgba(34, 84, 65, 0.9)",a(),window.setTimeout((()=>{e.style.boxShadow="none"}),200)},e.innerText=t,e.style.position="absolute",e.style.top=o+"px",e.style.left=i+"px",e.style.right=r+"px";const{...l}=s;for(const[t,n]of Object.entries(l))e.style[t]=n;try{S(d,c)}catch(e){console.error(e)}})(o,e),n||t.appendChild(o)},P=()=>{try{const e=document.getElementById(L);e&&e.remove()}catch(e){console.error(e)}},E=Math.min(480,window.screen.width),O=Math.min(840,window.screen.height),A=async e=>{let t,n,o=-1;if(n&&!n.closed)return;const i=s(e);n=await((e,t,n,o)=>new Promise((i=>{try{const r=window.screenX+(window.outerWidth-n)/2,s=window.screenY+(window.outerHeight-o)/2,a=`width=${n},height=${o},left=${r},top=${s},location=no,menubar=no,toolbar=no,status=no`;let d,c=-1;const l=n=>{const o=n.source===d,r=n.origin===new URL(t).origin,s=n.data&&"AppLoaded"===n.data.type,a="popOut"===n.data.context,p=n.data.sid===e;o&&r&&s&&a&&p&&(clearTimeout(c),i(d),window.removeEventListener("message",l))};if(window.addEventListener("message",l),d=window.open(t,"dintero-checkout",a),!d)return console.log("createPopOutWindow no popOut"),void i(void 0);c=window.setTimeout((()=>{console.log("createPopOutWindow timeout"),i(void 0)}),3e3)}catch(e){i(void 0)}})))(e.sid,i,E,O);const r=()=>{window.clearInterval(o),o=-1,window.removeEventListener("beforeunload",a),n=void 0,e.onClose(),t&&t()},a=()=>{n&&n.close(),r()};return window.addEventListener("beforeunload",a),o=window.setInterval((()=>{n&&n.closed&&r()}),200),t=e.onOpen(n),{close:a,focus:()=>{n&&n.focus()},popOutWindow:n}},$=(e,t)=>{try{e&&e.postMessage({type:"LockSession",sid:t},"*")}catch(e){console.error(e)}},W=(e,t)=>{try{e&&e.postMessage({type:"RefreshSession",sid:t},"*")}catch(e){console.error(e)}},M=(e,t,n)=>{try{e&&e.postMessage({type:"SetActivePaymentProductType",sid:t,payment_product_type:n},"*")}catch(e){console.error(e)}},_=(e,t)=>{z(t),e.href&&d(e.href)},j=(e,t)=>{(e.height||0===e.height)&&t.iframe.setAttribute("style",`width:100%; height:${e.height}px;`)},V=(e,t)=>{try{t.iframe.scrollIntoView({block:"start",behavior:"smooth"})}catch(e){console.error(e)}},B=(e,t)=>{e.language&&(t.language=e.language)},I=(e,t)=>{const n={internalPopOutHandler:!0,eventTypes:[i.LanguageChanged],handler:(e,t)=>{var n,o,i;n=t.iframe,o=t.options.sid,i=e.language,n.contentWindow&&n.contentWindow.postMessage({type:"SetLanguage",sid:o,language:i},"*")}},r={internalPopOutHandler:!0,eventTypes:[o.SessionCancel,o.SessionPaymentOnHold,o.SessionPaymentAuthorized,o.SessionPaymentError],handler:(t,n)=>{if(t.href){P();try{e.close()}catch(e){console.error(e)}}else console.error("Payment Complete event missing href property")}},s=o=>{o.source===e&&"popOut"===o.data.context&&o.data.sid===t.options.sid&&[n,r,...t.handlers].forEach((e=>{e.eventTypes.includes(o.data.type)&&e.handler&&(e=>{try{e()}catch(e){console.error(e)}})((()=>{e.handler(o.data,t)}))}))};return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},H=async(e,t)=>{const{close:n,focus:o,popOutWindow:i}=await A({sid:t.options.sid,endpoint:t.options.endpoint,shouldCallValidateSession:Boolean(t.options.onValidateSession),language:e.language,onOpen:e=>I(e,t),onClose:()=>{var e,n;b(),e=t.iframe,n=t.options.sid,e.contentWindow&&e.contentWindow.postMessage({type:"ClosedPopOut",sid:n},"*"),(e=>{try{const t=document.getElementById(L);t&&(e?t.setAttribute("disabled",e.toString()):t.removeAttribute("disabled"))}catch(e){console.error(e)}})(!1),t.popOutWindow=void 0}});return i?(r=t.iframe,s=t.options.sid,r.contentWindow&&r.contentWindow.postMessage({type:"OpenedPopOut",sid:s},"*"),t.popOutWindow=i,(e=>{try{if(document.getElementById(u))return;return v(e)}catch(e){console.error(e)}})({focus:o,close:n,event:e}),!0):(((e,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"OpenPopOutFailed",sid:t},"*")})(t.iframe,t.options.sid),!1);var r,s},N=async(e,t)=>{if(await H(e,t)&&t.options.onValidateSession){n=t.iframe,i=t.options.sid,n.contentWindow&&n.contentWindow.postMessage({type:"ValidatingPopOut",sid:i},"*");const r=((e,t)=>n=>{c(t.iframe,t.options.sid,n),n.success&&t.popOutWindow?t.popOutWindow.location.href=s({sid:t.options.sid,endpoint:t.options.endpoint,shouldCallValidateSession:!1,language:e.language}):(t.popOutWindow&&t.popOutWindow.close(),console.error(n.clientValidationError))})(e,t);try{t.options.onValidateSession({type:o.ValidateSession,session:t.session,callback:r},t,r)}catch(e){console.error(e),c(t.iframe,t.options.sid,{success:!1,clientValidationError:"Validation runtime error"})}}var n,i},F=(e,t)=>{(e=>e&&e.type===i.ShowPopOutButton)(e)&&(x({container:t.options.innerContainer,label:e.openLabel,top:e.top,left:e.left,right:e.right,styles:e.styles,stylesHover:e.stylesHover,stylesFocusVisible:e.stylesFocusVisible,disabled:e.disabled,onClick:()=>N(e,t)}),(e=>{const t=document.getElementById(h);t&&(t.innerText=e.focusLabel);const n=document.getElementById(f);n&&(n.innerText=e.descriptionLabel);const o=document.getElementById(m);o&&o.setAttribute("aria-label",e.descriptionLabel)})(e))},R=(e,t)=>{e.type===i.HidePopOutButton&&P()},z=e=>{if(P(),b(),e.popOutWindow)try{e.popOutWindow.close()}catch(e){console.error(e)}};e.embed=async e=>{const t=document.createElement("div");t.style.position="relative",t.style["box-sizing"]="border-box";const r={endpoint:"https://checkout.dintero.com",innerContainer:t,...e},{container:s,sid:d,language:p,endpoint:u,onSession:f,onSessionCancel:h,onPayment:m,onPaymentAuthorized:g,onPaymentError:y,onSessionNotFound:w,onSessionLocked:v,onSessionLockFailed:L,onActivePaymentType:S,onValidateSession:C,popOut:T}=r;let k;const x=[];let P=!1;s.appendChild(t);const{iframe:E,initiate:O}=((e,t,n)=>{if(!e||!e.appendChild)throw new Error("Invalid container");const o=document.createElement("iframe");return o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:0;"),o.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"),o.setAttribute("allow","payment"),o.setAttribute("importance","high"),o.setAttribute("src",n),{iframe:o,initiate:async()=>new Promise(((t,n)=>{o.onload=()=>t(),o.onerror=()=>n(),e.appendChild(o)}))}})(t,0,a({sid:d,endpoint:u,language:p,ui:e.ui||"inline",shouldCallValidateSession:void 0!==C,popOut:T,...e.hasOwnProperty("hideTestMessage")&&{hideTestMessage:e.hideTestMessage}})),A=(e,t,n)=>{if(!k)throw new Error("Unable to create action promise: checkout is undefined");return new Promise(((o,i)=>{const r=[];r.push(l({sid:d,endpoint:u,handler:e=>{r.forEach((e=>e.unsubscribe())),o(e)},eventTypes:[t],checkout:k,source:k.iframe.contentWindow})),r.push(l({sid:d,endpoint:u,handler:()=>{r.forEach((e=>e.unsubscribe())),i(`Received unexpected event: ${n}`)},eventTypes:[n],checkout:k,source:k.iframe.contentWindow})),e()}))},I=()=>A((()=>{((e,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"RefreshSession",sid:t},"*")})(E,d),W(k?.popOutWindow,d)}),o.SessionUpdated,o.SessionNotFound),H=e=>{c(E,d,e)},N=(e,t,i)=>(e,r)=>{if(!P){P=!0,z(r);const s=["sid","merchant_reference","transaction_id","error"].map((t=>[t,e[t]]));e.type!==o.SessionCancel||e.error||s.push(["error","cancelled"]),s.push(["language",r.language]),s.push(["sdk",n]);const a=s.filter((([e,t])=>t)).map((([e,t])=>`${e}=${t}`)).join("&");r.iframe.setAttribute("src",((e,t,n)=>{const o=e.endsWith("/")?"":"/";return`${e}${o}${t}?${n}`})(t,"embedResult/",a)),i(e,r)}},U=[{handler:B,eventTypes:[i.LanguageChanged]},{handler:j,eventTypes:[i.HeightChanged]},{handler:V,eventTypes:[i.ScrollToTop]},{handler:(e,t)=>{t.session=e.session,f&&f(e,t)},eventTypes:[o.SessionLoaded,o.SessionUpdated]},{eventTypes:[o.SessionPaymentOnHold],handler:N(0,u,m||_)},{eventTypes:[o.SessionPaymentAuthorized],handler:N(0,u,g||m||_)},{handler:N(0,u,h||_),eventTypes:[o.SessionCancel]},{handler:N(0,u,y||_),eventTypes:[o.SessionPaymentError]},{handler:w,eventTypes:[o.SessionNotFound]},{handler:(e,t)=>{v&&v(e,t,I)},eventTypes:[o.SessionLocked]},{handler:L,eventTypes:[o.SessionLockFailed]},{handler:S,eventTypes:[o.ActivePaymentProductType]},{handler:(e,t)=>{if(C)try{C({...e,callback:H},t,H)}catch(e){console.error(e),H({success:!1,clientValidationError:"Validation runtime error"})}},eventTypes:[o.ValidateSession]},{handler:F,eventTypes:[i.ShowPopOutButton]},{handler:R,eventTypes:[i.HidePopOutButton]}];return k={destroy:()=>{z(k),E&&(r.popOut&&b(),x.forEach((e=>e.unsubscribe())),E.parentElement&&t.removeChild(E)),t.parentElement&&s.removeChild(t)},iframe:E,language:p,lockSession:()=>A((()=>{((e,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"LockSession",sid:t},"*")})(E,d),$(k?.popOutWindow,d)}),o.SessionLocked,o.SessionLockFailed),refreshSession:I,setActivePaymentProductType:t=>{e.popOut?M(k?.popOutWindow,d,t):((e,t,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"SetActivePaymentProductType",sid:t,payment_product_type:n},"*")})(E,d,t)},submitValidationResult:H,options:r,handlers:U,session:void 0,popOutWindow:void 0},U.forEach((({handler:e,eventTypes:t})=>{e&&x.push(l({sid:d,endpoint:u,handler:e,eventTypes:t,checkout:k,source:k.iframe.contentWindow}))})),await O(),k},e.redirect=e=>{const{sid:t,language:n,endpoint:o="https://checkout.dintero.com"}=e;d(a({sid:t,endpoint:o,language:n,shouldCallValidateSession:!1}))},Object.defineProperty(e,"__esModule",{value:!0})}));
7
7
  //# sourceMappingURL=dintero-checkout-web-sdk.umd.min.js.map