@paydock/client-sdk 1.103.11-beta → 1.103.24-beta

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.
Files changed (79) hide show
  1. package/README.md +266 -444
  2. package/bundles/widget.umd.js +303 -646
  3. package/bundles/widget.umd.min.js +1 -1
  4. package/lib/api/api-service-internal.d.ts +2 -1
  5. package/lib/api/api-service-internal.js +1 -0
  6. package/lib/api/api-service-internal.js.map +1 -1
  7. package/lib/components/container.d.ts +0 -1
  8. package/lib/components/container.js +0 -3
  9. package/lib/components/container.js.map +1 -1
  10. package/lib/components/iframe-event.d.ts +2 -0
  11. package/lib/components/iframe-event.js +2 -0
  12. package/lib/components/iframe-event.js.map +1 -1
  13. package/lib/components/link.d.ts +3 -2
  14. package/lib/components/link.js +1 -0
  15. package/lib/components/link.js.map +1 -1
  16. package/lib/components/param.d.ts +2 -2
  17. package/lib/components/param.js.map +1 -1
  18. package/lib/components/wallet-background.d.ts +1 -2
  19. package/lib/components/wallet-background.js +1 -4
  20. package/lib/components/wallet-background.js.map +1 -1
  21. package/lib/configs/env/env.d.ts +3 -0
  22. package/lib/configs/env/env.js +9 -0
  23. package/lib/configs/env/env.js.map +1 -1
  24. package/lib/configs/sdk.js +1 -1
  25. package/lib/secure-remote-commerce/index.d.ts +102 -1
  26. package/lib/secure-remote-commerce/index.js +102 -1
  27. package/lib/secure-remote-commerce/index.js.map +1 -1
  28. package/lib/secure-remote-commerce/interfaces.d.ts +109 -32
  29. package/lib/secure-remote-commerce/interfaces.js +31 -11
  30. package/lib/secure-remote-commerce/interfaces.js.map +1 -1
  31. package/lib/secure-remote-commerce/mastercard-secure-remote-commerce.d.ts +30 -0
  32. package/lib/secure-remote-commerce/mastercard-secure-remote-commerce.js +39 -0
  33. package/lib/secure-remote-commerce/mastercard-secure-remote-commerce.js.map +1 -0
  34. package/lib/secure-remote-commerce/providers/mastercard-src/index.d.ts +1 -0
  35. package/lib/secure-remote-commerce/providers/mastercard-src/index.js +2 -0
  36. package/lib/secure-remote-commerce/providers/mastercard-src/index.js.map +1 -0
  37. package/lib/secure-remote-commerce/providers/{visa-src/visa-src.d.ts → mastercard-src/mastercard-src.d.ts} +4 -7
  38. package/lib/secure-remote-commerce/providers/mastercard-src/mastercard-src.js +88 -0
  39. package/lib/secure-remote-commerce/providers/mastercard-src/mastercard-src.js.map +1 -0
  40. package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +13 -91
  41. package/lib/secure-remote-commerce/secure-remote-commerce.js +15 -98
  42. package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -1
  43. package/lib/wallet-buttons/apple.wallet-service.d.ts +0 -2
  44. package/lib/wallet-buttons/apple.wallet-service.js +5 -38
  45. package/lib/wallet-buttons/apple.wallet-service.js.map +1 -1
  46. package/lib/wallet-buttons/flypay-v2.wallet-service.d.ts +1 -9
  47. package/lib/wallet-buttons/flypay-v2.wallet-service.js +132 -105
  48. package/lib/wallet-buttons/flypay-v2.wallet-service.js.map +1 -1
  49. package/lib/wallet-buttons/google.wallet-service.d.ts +0 -3
  50. package/lib/wallet-buttons/google.wallet-service.js +8 -41
  51. package/lib/wallet-buttons/google.wallet-service.js.map +1 -1
  52. package/lib/wallet-buttons/index.d.ts +0 -126
  53. package/lib/wallet-buttons/index.js +0 -126
  54. package/lib/wallet-buttons/index.js.map +1 -1
  55. package/lib/wallet-buttons/interfaces.d.ts +0 -3
  56. package/lib/wallet-buttons/paypal.wallet-service.js +2 -17
  57. package/lib/wallet-buttons/paypal.wallet-service.js.map +1 -1
  58. package/lib/wallet-buttons/wallet-buttons.d.ts +120 -62
  59. package/lib/wallet-buttons/wallet-buttons.js +60 -84
  60. package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
  61. package/lib/wallet-buttons/wallet-service.d.ts +0 -7
  62. package/lib/wallet-buttons/wallet-service.js +0 -11
  63. package/lib/wallet-buttons/wallet-service.js.map +1 -1
  64. package/package.json +1 -1
  65. package/slate.md +78 -132
  66. package/lib/secure-remote-commerce/providers/visa-src/helper.d.ts +0 -7
  67. package/lib/secure-remote-commerce/providers/visa-src/helper.js +0 -36
  68. package/lib/secure-remote-commerce/providers/visa-src/helper.js.map +0 -1
  69. package/lib/secure-remote-commerce/providers/visa-src/index.d.ts +0 -1
  70. package/lib/secure-remote-commerce/providers/visa-src/index.js +0 -2
  71. package/lib/secure-remote-commerce/providers/visa-src/index.js.map +0 -1
  72. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +0 -113
  73. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +0 -1
  74. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +0 -8
  75. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +0 -10
  76. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map +0 -1
  77. package/lib/wallet-buttons/helpers/flypay-v2.helper.d.ts +0 -3
  78. package/lib/wallet-buttons/helpers/flypay-v2.helper.js +0 -151
  79. package/lib/wallet-buttons/helpers/flypay-v2.helper.js.map +0 -1
@@ -684,7 +684,7 @@
684
684
  // the empty string is set in case if version not provided.
685
685
  //
686
686
  // e.g: grunt build --sdk-version=v1.0.0
687
- SDK._version = 'v1.103.11-beta';
687
+ SDK._version = 'v1.103.24-beta';
688
688
 
689
689
  var ENV = {
690
690
  SANDBOX: 'sandbox',
@@ -707,7 +707,10 @@
707
707
  STAGING_12: 'staging_12',
708
708
  STAGING_13: 'staging_13',
709
709
  STAGING_14: 'staging_14',
710
- STAGING_15: 'staging_15'
710
+ STAGING_15: 'staging_15',
711
+ STAGING_CBA: 'staging_cba',
712
+ PREPROD_CBA: 'preproduction_cba',
713
+ PROD_CBA: 'production_cba'
711
714
  };
712
715
  var WIDGET_URL = [{
713
716
  env: ENV.SANDBOX,
@@ -772,6 +775,15 @@
772
775
  }, {
773
776
  env: ENV.STAGING_15,
774
777
  url: 'https://widsta-15.'
778
+ }, {
779
+ env: ENV.STAGING_CBA,
780
+ url: 'https://widget.staging.powerboard.'
781
+ }, {
782
+ env: ENV.PREPROD_CBA,
783
+ url: 'https://widget.preproduction.powerboard.'
784
+ }, {
785
+ env: ENV.PROD_CBA,
786
+ url: 'https://widget.powerboard.'
775
787
  }];
776
788
  var API_URL = [{
777
789
  env: ENV.SANDBOX,
@@ -827,6 +839,15 @@
827
839
  }, {
828
840
  env: ENV.STAGING_15,
829
841
  url: 'https://apista-15.'
842
+ }, {
843
+ env: ENV.STAGING_CBA,
844
+ url: 'https://api.staging.powerboard.'
845
+ }, {
846
+ env: ENV.PREPROD_CBA,
847
+ url: 'https://api.preproduction.powerboard.'
848
+ }, {
849
+ env: ENV.PROD_CBA,
850
+ url: 'https://api.powerboard.'
830
851
  }];
831
852
  var ADDITIONAL_ENV = [ENV.SANDBOX_KOVENA, ENV.SANDBOX_DEMO_KOVENA];
832
853
  var REGEX_ALIAS = '^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$';
@@ -939,7 +960,7 @@
939
960
  var SECURE_3D = '/3ds/webhook';
940
961
  var FLYPAY_LINK = '/wallet/flypay';
941
962
  var FLYPAY_LOGO_LINK = '/images/logo.png';
942
- var VISA_SRC = '/secure-remote-commerce/visa';
963
+ var MASTERCARD_SRC = '/secure-remote-commerce/mastercard';
943
964
  var Link = /*#__PURE__*/function () {
944
965
  function Link(linkResource) {
945
966
  _classCallCheck(this, Link);
@@ -2112,11 +2133,6 @@
2112
2133
  value: function getElement() {
2113
2134
  return document.querySelector(this.selector);
2114
2135
  }
2115
- }, {
2116
- key: "getSelector",
2117
- value: function getSelector() {
2118
- return this.selector;
2119
- }
2120
2136
  }, {
2121
2137
  key: "convertConfigs",
2122
2138
  value: function convertConfigs(params, allowValue) {
@@ -2225,6 +2241,8 @@
2225
2241
  CHECKOUT_READY: 'checkoutReady',
2226
2242
  CHECKOUT_ERROR: 'checkoutError',
2227
2243
  CHECKOUT_COMPLETED: 'checkoutCompleted',
2244
+ CHECKOUT_POPUP_OPEN: 'checkoutPopupOpen',
2245
+ CHECKOUT_POPUP_CLOSE: 'checkoutPopupClose',
2228
2246
  VALIDATION: 'validation',
2229
2247
  SELECT: 'select',
2230
2248
  UNSELECT: 'unselect',
@@ -6497,11 +6515,9 @@
6497
6515
  var _super = _createSuper(WalletBackground);
6498
6516
  function WalletBackground(bgImageUrl) {
6499
6517
  var _this;
6500
- var hideCloseButton = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6501
6518
  _classCallCheck(this, WalletBackground);
6502
6519
  _this = _super.call(this);
6503
6520
  _this.bgImageUrl = bgImageUrl;
6504
- _this.hideCloseButton = hideCloseButton;
6505
6521
  _this.imageStyle = null;
6506
6522
  return _this;
6507
6523
  }
@@ -6524,7 +6540,6 @@
6524
6540
  var _this2 = this;
6525
6541
  var body = document.body || document.getElementsByTagName("body")[0];
6526
6542
  var template = String(TEMPLATE$2);
6527
- if (this.hideCloseButton === true) template = template.replace('<a href="#" data-close>Close</a>', '');
6528
6543
  this.overlay = document.createElement("div");
6529
6544
  this.overlay.classList.add("checkout-overlay");
6530
6545
  this.overlay.setAttribute("checkout-overlay", " ");
@@ -6558,10 +6573,7 @@
6558
6573
  PAYMENT_IN_REVIEW: 'payment_in_review',
6559
6574
  PAYMENT_ERROR: 'payment_error',
6560
6575
  CALLBACK: 'callback',
6561
- AUTH_TOKENS_CHANGED: 'auth_tokens_changed',
6562
- BUTTON_CLICK: 'button_click',
6563
- CHECKOUT_OPEN: 'checkout_open',
6564
- CHECKOUT_CLOSE: 'checkout_close'
6576
+ AUTH_TOKENS_CHANGED: 'auth_tokens_changed'
6565
6577
  };
6566
6578
  var WalletService = /*#__PURE__*/function () {
6567
6579
  function WalletService(publicKey, meta) {
@@ -6603,18 +6615,6 @@
6603
6615
  // do nothing unless current wallet service overrides this method;
6604
6616
  return;
6605
6617
  }
6606
- }, {
6607
- key: "enable",
6608
- value: function enable() {
6609
- // do nothing unless current wallet service overrides this method;
6610
- return;
6611
- }
6612
- }, {
6613
- key: "disable",
6614
- value: function disable() {
6615
- // do nothing unless current wallet service overrides this method;
6616
- return;
6617
- }
6618
6618
  }, {
6619
6619
  key: "on",
6620
6620
  value: function on(eventName, cb) {
@@ -6888,23 +6888,6 @@
6888
6888
  return _extends(_extends({}, this.meta.style && {
6889
6889
  style: this.meta.style
6890
6890
  }), {
6891
- onClick: function onClick(_data, actions) {
6892
- var responseValue;
6893
- _this4.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
6894
- attachResult: function attachResult(value) {
6895
- if (value && value instanceof Promise) {
6896
- responseValue = value.then(function () {
6897
- return actions.resolve();
6898
- })["catch"](function () {
6899
- return actions.reject();
6900
- });
6901
- } else {
6902
- responseValue = value;
6903
- }
6904
- }
6905
- });
6906
- return responseValue;
6907
- },
6908
6891
  createOrder: function createOrder() {
6909
6892
  return new Promise(function (resolve, reject) {
6910
6893
  _this4.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
@@ -6954,9 +6937,6 @@
6954
6937
  });
6955
6938
  return _this4.pendingApprovalPromise;
6956
6939
  },
6957
- onCancel: function onCancel() {
6958
- return _this4.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
6959
- },
6960
6940
  onError: function onError(err) {
6961
6941
  // Error handling so that paypal does not throw an uncaught error
6962
6942
  // We're already handling errors and notifying Merchants at "wallet-buttons.ts"
@@ -7273,20 +7253,11 @@
7273
7253
  _this.gatewayName = gatewayName;
7274
7254
  _this.eventEmitter = eventEmitter;
7275
7255
  _this.latestShippingData = {};
7276
- _this.onCancelPayment = function (event) {
7277
- return _this.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
7278
- };
7279
7256
  _this.onValidateMerchant = function (event) {
7280
- _this.handleMerchantOnButtonClickEvent().then(function () {
7281
- _this.getMerchantSession().then(function (merchantSession) {
7282
- _this.paymentSession.completeMerchantValidation(merchantSession);
7283
- })["catch"](function (err) {
7284
- console.error("Error fetching merchant session", err);
7285
- _this.paymentSession.abort();
7286
- });
7257
+ _this.getMerchantSession().then(function (merchantSession) {
7258
+ _this.paymentSession.completeMerchantValidation(merchantSession);
7287
7259
  })["catch"](function (err) {
7288
- console.error('Error while processing merchant callback', err);
7289
- _this.paymentSession.abort();
7260
+ return console.error("Error fetching merchant session", err);
7290
7261
  });
7291
7262
  };
7292
7263
  _this.onPaymentAuthorized = function (event) {
@@ -7537,7 +7508,6 @@
7537
7508
  this.paymentSession = new ApplePaySession(3, this.createRequest());
7538
7509
  this.paymentSession.onvalidatemerchant = this.onValidateMerchant;
7539
7510
  this.paymentSession.onpaymentauthorized = this.onPaymentAuthorized;
7540
- this.paymentSession.oncancel = this.onCancelPayment;
7541
7511
  this.paymentSession.onshippingcontactselected = this.onShippingContactSelected;
7542
7512
  this.paymentSession.onshippingmethodselected = this.onShippingMethodSelected;
7543
7513
  this.paymentSession.begin();
@@ -7597,28 +7567,6 @@
7597
7567
  });
7598
7568
  });
7599
7569
  }
7600
- }, {
7601
- key: "handleMerchantOnButtonClickEvent",
7602
- value: function handleMerchantOnButtonClickEvent() {
7603
- var _this6 = this;
7604
- return new Promise(function (resolve, reject) {
7605
- var merchantResult;
7606
- _this6.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
7607
- attachResult: function attachResult(value) {
7608
- merchantResult = value;
7609
- }
7610
- });
7611
- if (merchantResult instanceof Promise) {
7612
- merchantResult.then(resolve)["catch"](reject);
7613
- } else {
7614
- if (merchantResult === false) {
7615
- reject();
7616
- } else {
7617
- resolve();
7618
- }
7619
- }
7620
- });
7621
- }
7622
7570
  }, {
7623
7571
  key: "createButtonStyle",
7624
7572
  value: function createButtonStyle() {
@@ -7638,7 +7586,6 @@
7638
7586
  _this = _super.call(this, publicKey, meta);
7639
7587
  _this.gatewayName = gatewayName;
7640
7588
  _this.eventEmitter = eventEmitter;
7641
- _this.processingButtonClick = false;
7642
7589
  _this.parseUpdateData = function (data) {
7643
7590
  var _a, _b, _c, _d, _e, _f;
7644
7591
  var shippingOption = (_b = (_a = _this.meta) === null || _a === void 0 ? void 0 : _a.shipping_options) === null || _b === void 0 ? void 0 : _b.find(function (o) {
@@ -7816,64 +7763,29 @@
7816
7763
  var _a, _b, _c;
7817
7764
  container.getElement().appendChild(this.paymentsClient.createButton({
7818
7765
  onClick: function onClick() {
7819
- return _this3.onGooglePayButtonClicked();
7766
+ return _this3.loadPaymentData();
7820
7767
  },
7821
7768
  buttonType: ((_a = this.getMetaStyles()) === null || _a === void 0 ? void 0 : _a.button_type) || 'pay',
7822
7769
  buttonSizeMode: ((_b = this.getMetaStyles()) === null || _b === void 0 ? void 0 : _b.button_size_mode) || "fill",
7823
7770
  buttonColor: ((_c = this.getMetaStyles()) === null || _c === void 0 ? void 0 : _c.button_color) || "default"
7824
7771
  }));
7825
7772
  }
7826
- }, {
7827
- key: "onGooglePayButtonClicked",
7828
- value: function onGooglePayButtonClicked() {
7829
- var _this4 = this;
7830
- if (this.processingButtonClick) return;
7831
- this.processingButtonClick = true;
7832
- this.handleMerchantOnButtonClickEvent().then(function () {
7833
- _this4.loadPaymentData()["finally"](function () {
7834
- _this4.processingButtonClick = false;
7835
- });
7836
- })["catch"](function (err) {
7837
- _this4.processingButtonClick = false;
7838
- console.error('Error while processing merchant callback', err);
7839
- });
7840
- }
7841
- }, {
7842
- key: "handleMerchantOnButtonClickEvent",
7843
- value: function handleMerchantOnButtonClickEvent() {
7844
- var _this5 = this;
7845
- return new Promise(function (resolve, reject) {
7846
- var merchantResult;
7847
- _this5.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
7848
- attachResult: function attachResult(value) {
7849
- merchantResult = value;
7850
- }
7851
- });
7852
- if (merchantResult instanceof Promise) {
7853
- merchantResult.then(resolve)["catch"](reject);
7854
- } else {
7855
- if (merchantResult === false) {
7856
- reject();
7857
- } else {
7858
- resolve();
7859
- }
7860
- }
7861
- });
7862
- }
7863
7773
  }, {
7864
7774
  key: "loadPaymentData",
7865
7775
  value: function loadPaymentData() {
7866
- var _this6 = this;
7867
- return this.paymentsClient.loadPaymentData(this.createPaymentDataRequest())["catch"](function (err) {
7868
- _this6.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
7869
- console.error('Error while loading payment data', err);
7870
- throw err;
7776
+ this.paymentsClient.loadPaymentData(this.createPaymentDataRequest())
7777
+ // .then((paymentData) => {
7778
+ // // if using gateway tokenization, pass this token without modification
7779
+ // // this.paymentToken = paymentData.paymentMethodData.tokenizationData.token;
7780
+ // })
7781
+ ["catch"](function () {
7782
+ console.error('Error while loading payment data');
7871
7783
  });
7872
7784
  }
7873
7785
  }, {
7874
7786
  key: "onPaymentAuthorized",
7875
7787
  value: function onPaymentAuthorized(paymentData) {
7876
- var _this7 = this;
7788
+ var _this4 = this;
7877
7789
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
7878
7790
  var billingAddressLine1 = (_c = (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.billingAddress) === null || _c === void 0 ? void 0 : _c.address1;
7879
7791
  var billingAddressLine2 = (_f = (_e = (_d = paymentData.paymentMethodData) === null || _d === void 0 ? void 0 : _d.info) === null || _e === void 0 ? void 0 : _e.billingAddress) === null || _f === void 0 ? void 0 : _f.address2;
@@ -7889,7 +7801,7 @@
7889
7801
  var shippingContactPhone = (_q = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _q === void 0 ? void 0 : _q.phoneNumber;
7890
7802
  return new Promise(function (resolve) {
7891
7803
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
7892
- return _this7.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
7804
+ return _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
7893
7805
  data: _extends({
7894
7806
  customer: {
7895
7807
  payment_source: _extends(_extends(_extends(_extends({
@@ -7911,11 +7823,11 @@
7911
7823
  ref_token: paymentData.paymentMethodData.tokenizationData.token
7912
7824
  })
7913
7825
  }
7914
- }, _this7.isShippingRequired() && {
7826
+ }, _this4.isShippingRequired() && {
7915
7827
  shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && {
7916
7828
  method: shippingOptionMethod
7917
- }), _this7.hasShippingOptions() && {
7918
- options: _this7.meta.shipping_options
7829
+ }), _this4.hasShippingOptions() && {
7830
+ options: _this4.meta.shipping_options
7919
7831
  }), shippingAddressLine1 && {
7920
7832
  address_line1: shippingAddressLine1
7921
7833
  }), shippingAddressLine2 && {
@@ -7959,12 +7871,12 @@
7959
7871
  }, {
7960
7872
  key: "onPaymentDataChanged",
7961
7873
  value: function onPaymentDataChanged(intermediatePaymentData) {
7962
- var _this8 = this;
7874
+ var _this5 = this;
7963
7875
  if (!this.isShippingRequired()) return;
7964
7876
  var parsedUpdateData = this.parseUpdateData(intermediatePaymentData);
7965
7877
  var returnPromise = new Promise(function (res, rej) {
7966
- _this8.latestShippingChangePromiseResolve = res;
7967
- _this8.latestShippingChangePromiseReject = rej;
7878
+ _this5.latestShippingChangePromiseResolve = res;
7879
+ _this5.latestShippingChangePromiseReject = rej;
7968
7880
  });
7969
7881
  this.eventEmitter.emit(WALLET_EVENT.UPDATE, parsedUpdateData);
7970
7882
  return returnPromise;
@@ -8266,6 +8178,7 @@
8266
8178
  var CARD_SCHEME_SERVICE;
8267
8179
  (function (CARD_SCHEME_SERVICE) {
8268
8180
  CARD_SCHEME_SERVICE["VISA_SRC"] = "VisaSRC";
8181
+ CARD_SCHEME_SERVICE["MASTERCARD_SRC"] = "MastercardSRCClickToPay";
8269
8182
  })(CARD_SCHEME_SERVICE || (CARD_SCHEME_SERVICE = {}));
8270
8183
 
8271
8184
  var ApiInternal = /*#__PURE__*/function (_ApiBase) {
@@ -8647,16 +8560,6 @@
8647
8560
  return Checkout;
8648
8561
  }();
8649
8562
 
8650
- function getFlypayV2Button() {
8651
- return "\n <div id=\"loading-overlay\"></div>\n <div class=\"flypay-v2-checkout-btn__wrapper\">\n <svg viewBox=\"0 0 384 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_34013_168361)\">\n <rect width=\"384\" height=\"48\" rx=\"24\" fill=\"#212121\"/>\n <path d=\"M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z\" fill=\"white\"/>\n <path d=\"M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z\" fill=\"white\"/>\n <path d=\"M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z\" fill=\"white\"/>\n <path d=\"M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z\" fill=\"white\"/>\n <path d=\"M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z\" fill=\"white\"/>\n <path d=\"M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z\" fill=\"white\"/>\n <path d=\"M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z\" fill=\"white\"/>\n <path d=\"M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z\" fill=\"white\"/>\n <path d=\"M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z\" fill=\"white\"/>\n <path d=\"M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z\" fill=\"white\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_34013_168361\">\n <rect width=\"384\" height=\"48\" rx=\"24\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ";
8652
- }
8653
- function getDisabledFlypayV2Button() {
8654
- return "\n <div id=\"loading-overlay\"></div>\n <div class=\"flypay-v2-checkout-btn-disabled\">\n <svg viewBox=\"0 0 384 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_34032_180021)\">\n <rect x=\"0.5\" y=\"0.5\" width=\"383\" height=\"47\" rx=\"23.5\" stroke=\"#212121\"/>\n <path d=\"M134.985 24.6006H132.387V29H129.847V16.7646H135.176C136.404 16.7646 137.384 17.0801 138.114 17.7109C138.845 18.3418 139.21 19.3185 139.21 20.6411C139.21 22.0854 138.845 23.1064 138.114 23.7041C137.384 24.3018 136.341 24.6006 134.985 24.6006ZM136.18 22.0522C136.512 21.759 136.678 21.2941 136.678 20.6577C136.678 20.0213 136.509 19.5675 136.172 19.2964C135.84 19.0252 135.372 18.8896 134.769 18.8896H132.387V22.4922H134.769C135.372 22.4922 135.843 22.3455 136.18 22.0522ZM141.277 20.9316C141.902 20.1348 142.976 19.7363 144.498 19.7363C145.488 19.7363 146.368 19.9328 147.137 20.3257C147.906 20.7186 148.291 21.4601 148.291 22.5503V26.7007C148.291 26.9884 148.297 27.3371 148.308 27.7466C148.324 28.0565 148.371 28.2668 148.449 28.3774C148.526 28.4881 148.642 28.5794 148.797 28.6514V29H146.224C146.152 28.8174 146.102 28.6458 146.075 28.4854C146.047 28.3249 146.025 28.1423 146.008 27.9375C145.682 28.2917 145.306 28.5933 144.879 28.8423C144.37 29.1356 143.795 29.2822 143.153 29.2822C142.334 29.2822 141.656 29.0498 141.119 28.585C140.588 28.1146 140.322 27.4505 140.322 26.5928C140.322 25.4805 140.751 24.6753 141.609 24.1772C142.079 23.9061 142.771 23.7124 143.684 23.5962L144.489 23.4966C144.926 23.4412 145.239 23.3721 145.427 23.2891C145.765 23.1452 145.934 22.9211 145.934 22.6167C145.934 22.2459 145.804 21.9914 145.543 21.853C145.289 21.7091 144.913 21.6372 144.415 21.6372C143.856 21.6372 143.46 21.7756 143.228 22.0522C143.062 22.257 142.951 22.5337 142.896 22.8823H140.613C140.663 22.091 140.884 21.4408 141.277 20.9316ZM143.037 27.29C143.258 27.4727 143.529 27.564 143.85 27.564C144.359 27.564 144.827 27.4146 145.253 27.1157C145.685 26.8169 145.909 26.2718 145.925 25.4805V24.6006C145.776 24.6947 145.624 24.7721 145.469 24.833C145.319 24.8883 145.112 24.9409 144.846 24.9907L144.315 25.0903C143.817 25.1789 143.46 25.2868 143.244 25.4141C142.879 25.6299 142.696 25.9647 142.696 26.4185C142.696 26.8224 142.81 27.113 143.037 27.29ZM154.077 26.626L155.944 19.9521H158.459L155.355 28.8506C154.757 30.5661 154.284 31.6286 153.936 32.0381C153.587 32.4531 152.89 32.6606 151.844 32.6606C151.633 32.6606 151.465 32.6579 151.337 32.6523C151.21 32.6523 151.019 32.644 150.765 32.6274V30.7349L151.063 30.7515C151.296 30.7625 151.517 30.7542 151.728 30.7266C151.938 30.6989 152.115 30.6353 152.259 30.5356C152.397 30.4416 152.524 30.2451 152.641 29.9463C152.762 29.6475 152.812 29.4648 152.79 29.3984L149.47 19.9521H152.101L154.077 26.626ZM171.458 29L170.039 22.4092L168.603 29H166.146L163.606 19.9521H166.146L167.557 26.4434L168.86 19.9521H171.259L172.637 26.4683L174.048 19.9521H176.514L173.891 29H171.458ZM180.257 19.9521V29H177.858V19.9521H180.257ZM180.257 16.6899V18.873H177.858V16.6899H180.257ZM186.699 27.3149V29.083L185.578 29.1245C184.46 29.1632 183.697 28.9696 183.287 28.5435C183.021 28.2723 182.889 27.8545 182.889 27.29V21.7202H181.627V20.0352H182.889V17.5117H185.229V20.0352H186.699V21.7202H185.229V26.5015C185.229 26.8722 185.277 27.1047 185.371 27.1987C185.465 27.2873 185.752 27.3315 186.234 27.3315C186.306 27.3315 186.381 27.3315 186.458 27.3315C186.541 27.326 186.621 27.3205 186.699 27.3149ZM196.394 23.6875V29H193.979V23.4966C193.979 23.0096 193.896 22.6167 193.729 22.3179C193.514 21.8973 193.104 21.687 192.501 21.687C191.876 21.687 191.4 21.8973 191.073 22.3179C190.752 22.7329 190.592 23.3278 190.592 24.1025V29H188.234V16.8062H190.592V21.1309C190.935 20.6051 191.331 20.2399 191.779 20.0352C192.233 19.8249 192.708 19.7197 193.207 19.7197C193.765 19.7197 194.272 19.8166 194.726 20.0103C195.185 20.2039 195.561 20.5 195.854 20.8984C196.104 21.236 196.256 21.5846 196.311 21.9443C196.366 22.2985 196.394 22.8796 196.394 23.6875Z\" fill=\"#212121\"/>\n <path d=\"M231.702 14.0094C231.71 13.9026 231.673 13.7973 231.601 13.7164C231.529 13.6354 231.428 13.5852 231.318 13.5766C231.296 13.5734 231.272 13.5734 231.25 13.5766H217.787C217.679 13.5725 217.573 13.6092 217.492 13.6791C217.411 13.749 217.362 13.8467 217.353 13.9517C217.344 14.0567 217.378 14.1609 217.446 14.2424C217.515 14.324 217.613 14.3765 217.72 14.3891C217.743 14.3924 217.767 14.3924 217.79 14.3891H231.256C231.367 14.396 231.476 14.3599 231.56 14.2888C231.643 14.2177 231.694 14.1172 231.702 14.0094V14.0094Z\" fill=\"#212121\"/>\n <path d=\"M226.501 35.2805C226.497 35.3338 226.503 35.3874 226.52 35.4382C226.537 35.4891 226.564 35.5362 226.6 35.5769C226.635 35.6176 226.679 35.6511 226.728 35.6754C226.776 35.6997 226.83 35.7144 226.884 35.7186H240.409C240.52 35.7272 240.629 35.6927 240.714 35.6227C240.798 35.5528 240.85 35.453 240.859 35.3454C240.868 35.2378 240.832 35.1312 240.761 35.049C240.689 34.9668 240.586 34.9158 240.476 34.9072H226.945C226.836 34.8998 226.728 34.9348 226.644 35.0047C226.561 35.0746 226.51 35.1738 226.501 35.2805Z\" fill=\"#212121\"/>\n <path d=\"M248.245 30.3548L251.02 19.1664C251.211 18.3788 251.052 17.6345 250.576 17.0708C250.109 16.5299 249.402 16.2227 248.578 16.2227H215.233C215.126 16.228 215.025 16.2733 214.951 16.3491C214.877 16.4249 214.836 16.5254 214.836 16.63C214.836 16.7345 214.877 16.8351 214.951 16.9108C215.025 16.9866 215.126 17.0319 215.233 17.0373H248.579C249.134 17.0373 249.597 17.2309 249.894 17.5782C250.203 17.9417 250.304 18.4437 250.172 18.9846L247.397 30.1731C247.112 31.3447 245.867 32.2989 244.622 32.2989H223.787C223.73 32.2961 223.674 32.3045 223.62 32.3237C223.567 32.3428 223.519 32.3724 223.477 32.4105C223.436 32.4486 223.403 32.4945 223.381 32.5453C223.359 32.5961 223.347 32.6509 223.347 32.7062C223.347 32.7616 223.359 32.8163 223.381 32.8671C223.403 32.918 223.436 32.9638 223.477 33.0019C223.519 33.0401 223.567 33.0696 223.62 33.0888C223.674 33.108 223.73 33.1164 223.787 33.1135H244.619C246.249 33.1157 247.876 31.8759 248.245 30.3548Z\" fill=\"#212121\"/>\n <path d=\"M213.705 16.2227L211.328 16.7625V28.9657H213.715V16.2227H213.705Z\" fill=\"#212121\"/>\n <path d=\"M218.82 29.0569C219.368 29.0431 219.909 28.9313 220.416 28.7269V30.2112C220.416 31.61 219.6 31.9908 218.89 31.9908H218.3V34.3406H218.896C221.322 34.3406 222.826 32.7579 222.826 30.2112V20.3945L220.416 20.9355V24.9762C220.416 26.0872 219.879 26.7071 218.823 26.7071C217.768 26.7071 217.231 26.0894 217.231 24.9762V20.3978L214.82 20.9387V24.9794C214.817 27.3822 216.427 29.0569 218.82 29.0569Z\" fill=\"#212121\"/>\n <path d=\"M206.282 22.6056H209.279V20.4765H206.282V20.4667H206.264C206.272 19.2951 207.062 18.3409 208.655 18.3409H210.542V16.2227H208.655C205.366 16.2227 203.906 18.1202 203.898 20.4635V28.9657H206.282V22.6056Z\" fill=\"#212121\"/>\n <path d=\"M226.233 28.9713L226.93 26.3749H228.558C229.111 26.3815 229.663 26.3086 230.195 26.1585C230.671 26.0264 231.117 25.806 231.508 25.5094C231.877 25.2255 232.178 24.8662 232.39 24.4568C232.613 24.0151 232.725 23.5276 232.715 23.0352C232.715 22.3017 232.493 21.7154 232.049 21.2761C231.742 20.9673 231.36 20.7386 230.939 20.6108C230.43 20.4649 229.901 20.3963 229.371 20.4074H226.652L224.352 28.9605H226.23L226.233 28.9713ZM229.302 22.1124C229.541 22.1057 229.778 22.1367 230.006 22.2044C230.186 22.2621 230.348 22.3612 230.48 22.4932C230.574 22.587 230.647 22.6982 230.695 22.8201C230.744 22.942 230.767 23.0722 230.762 23.2029C230.773 23.4234 230.726 23.6428 230.626 23.8407C230.525 24.0385 230.375 24.2081 230.188 24.3334C229.804 24.5985 229.3 24.7305 228.669 24.7305H227.386L228.084 22.1156H229.305L229.302 22.1124Z\" fill=\"#212121\"/>\n <path d=\"M230.516 28.9656H232.546L233.843 27.0475H237.462L237.731 28.9656H239.665L238.306 20.3477H236.498L230.516 28.9656ZM236.85 22.5752L237.239 25.4031H234.965L236.85 22.5752Z\" fill=\"#212121\"/>\n <path d=\"M241.671 25.5911L240.765 28.9632H242.651L243.518 25.761L248.204 20.4102H248.201H245.929L242.992 23.9543L241.989 20.4102H239.898L241.671 25.5911Z\" fill=\"#212121\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_34032_180021\">\n <rect width=\"384\" height=\"48\" rx=\"24\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n ";
8655
- }
8656
- function createFlypayV2ButtonStyle(containerId) {
8657
- return "\n ".concat(containerId, " {\n position: relative;\n }\n\n #loading-overlay {\n position: absolute;\n height: 100%;\n width: 100%;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n cursor: not-allowed; /* Make it look not clickable */\n }\n\n #loading-overlay::after {\n content: \"\";\n height: 60%;\n aspect-ratio: 1 / 1;\n display: inline-block;\n border: 4px solid #ccc;\n border-top-color: #333;\n border-radius: 50%;\n\n /* Vendor prefixes for animation property */\n -webkit-animation: spin 1s infinite linear;\n -moz-animation: spin 1s infinite linear;\n -o-animation: spin 1s infinite linear;\n animation: spin 1s infinite linear;\n }\n\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-moz-keyframes spin {\n 0% {\n -moz-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -moz-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @-o-keyframes spin {\n 0% {\n -o-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -o-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n\n .flypay-v2-checkout-btn {\n width: 100%;\n height: fit-content;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: pointer; /* Make it look clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n\n .flypay-v2-checkout-btn-disabled {\n width: 100%;\n height: fit-content;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: not-allowed; /* Make it look not clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n ");
8658
- }
8659
-
8660
8563
  var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
8661
8564
  function adopt(value) {
8662
8565
  return value instanceof P ? value : new P(function (resolve) {
@@ -8691,79 +8594,47 @@
8691
8594
  var _this;
8692
8595
  _classCallCheck(this, FlypayV2WalletService);
8693
8596
  _this = _super.call(this, publicKey, meta);
8694
- _this.processingButtonClick = false;
8695
8597
  _this.onFlypayV2ButtonClick = function () {
8696
- return __awaiter(_assertThisInitialized(_this), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
8697
- var _this2 = this;
8698
- var setLoadingOverlayDisplay;
8699
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
8700
- while (1) switch (_context2.prev = _context2.next) {
8598
+ return __awaiter(_assertThisInitialized(_this), void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8599
+ var loadingOverlay, button;
8600
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8601
+ while (1) switch (_context.prev = _context.next) {
8701
8602
  case 0:
8702
- setLoadingOverlayDisplay = function setLoadingOverlayDisplay(displayStyle) {
8703
- var loadingOverlay = document.getElementById('loading-overlay');
8704
- if (loadingOverlay) loadingOverlay.style.display = displayStyle;
8705
- };
8706
- this.disable();
8707
- setLoadingOverlayDisplay('flex');
8708
- if (!this.processingButtonClick) {
8709
- _context2.next = 5;
8603
+ loadingOverlay = document.getElementById('loading-overlay');
8604
+ button = document.getElementById('flypay-v2-button');
8605
+ if (button) button.disabled = true;
8606
+ _context.prev = 3;
8607
+ if (this.orderId) {
8608
+ _context.next = 9;
8710
8609
  break;
8711
8610
  }
8712
- return _context2.abrupt("return");
8713
- case 5:
8714
- this.processingButtonClick = true;
8715
- this.handleMerchantOnButtonClickEvent().then(function () {
8716
- return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8717
- var _a, _b;
8718
- return _regeneratorRuntime().wrap(function _callee$(_context) {
8719
- while (1) switch (_context.prev = _context.next) {
8720
- case 0:
8721
- _context.prev = 0;
8722
- this.processingButtonClick = false;
8723
- if (this.orderId) {
8724
- _context.next = 6;
8725
- break;
8726
- }
8727
- _context.next = 5;
8728
- return this.getOrderId();
8729
- case 5:
8730
- this.orderId = _context.sent;
8731
- case 6:
8732
- setLoadingOverlayDisplay('none');
8733
- this.background = this.initBackground();
8734
- if (this.orderId) {
8735
- (_a = this.background) === null || _a === void 0 ? void 0 : _a.initControl();
8736
- this.flypayV2Checkout(this.orderId);
8737
- } else {
8738
- this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE);
8739
- }
8740
- _context.next = 17;
8741
- break;
8742
- case 11:
8743
- _context.prev = 11;
8744
- _context.t0 = _context["catch"](0);
8745
- (_b = this.background) === null || _b === void 0 ? void 0 : _b.clear();
8746
- setLoadingOverlayDisplay('none');
8747
- this.enable();
8748
- this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
8749
- err: _context.t0
8750
- });
8751
- case 17:
8752
- case "end":
8753
- return _context.stop();
8754
- }
8755
- }, _callee, this, [[0, 11]]);
8756
- }));
8757
- })["catch"](function (err) {
8758
- _this2.processingButtonClick = false;
8759
- setLoadingOverlayDisplay('none');
8760
- _this2.enable();
8611
+ if (loadingOverlay) loadingOverlay.style.display = 'flex';
8612
+ _context.next = 8;
8613
+ return this.getOrderId();
8614
+ case 8:
8615
+ this.orderId = _context.sent;
8616
+ case 9:
8617
+ if (loadingOverlay) loadingOverlay.style.display = 'none';
8618
+ if (this.orderId) {
8619
+ this.flypayV2Checkout(this.orderId);
8620
+ } else {
8621
+ this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE);
8622
+ }
8623
+ _context.next = 18;
8624
+ break;
8625
+ case 13:
8626
+ _context.prev = 13;
8627
+ _context.t0 = _context["catch"](3);
8628
+ if (loadingOverlay) loadingOverlay.style.display = 'none';
8629
+ if (button) button.disabled = false;
8630
+ this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
8631
+ err: _context.t0
8761
8632
  });
8762
- case 7:
8633
+ case 18:
8763
8634
  case "end":
8764
- return _context2.stop();
8635
+ return _context.stop();
8765
8636
  }
8766
- }, _callee2, this);
8637
+ }, _callee, this, [[3, 13]]);
8767
8638
  }));
8768
8639
  };
8769
8640
  _this.accessToken = meta === null || meta === void 0 ? void 0 : meta.access_token;
@@ -8774,7 +8645,6 @@
8774
8645
  _createClass(FlypayV2WalletService, [{
8775
8646
  key: "load",
8776
8647
  value: function load(container) {
8777
- this.containerId = container.getSelector();
8778
8648
  this.mount(container);
8779
8649
  }
8780
8650
  }, {
@@ -8783,73 +8653,37 @@
8783
8653
  this.link.setEnv(env);
8784
8654
  return _get(_getPrototypeOf(FlypayV2WalletService.prototype), "setEnv", this).call(this, env);
8785
8655
  }
8786
- }, {
8787
- key: "enable",
8788
- value: function enable() {
8789
- var button = document.getElementById('flypay-v2-button');
8790
- if (button) {
8791
- button.disabled = false;
8792
- this.flypayV2Button.innerHTML = getFlypayV2Button();
8793
- }
8794
- }
8795
- }, {
8796
- key: "disable",
8797
- value: function disable() {
8798
- var button = document.getElementById('flypay-v2-button');
8799
- if (button) {
8800
- button.disabled = true;
8801
- this.flypayV2Button.innerHTML = getDisabledFlypayV2Button();
8802
- }
8803
- }
8804
8656
  }, {
8805
8657
  key: "mount",
8806
8658
  value: function mount(container) {
8807
- this.flypayV2Button = this.getButton();
8808
- this.flypayV2Button.onclick = this.onFlypayV2ButtonClick;
8809
- container.getElement().appendChild(this.flypayV2Button);
8659
+ var flypayV2Button = this.getButton();
8660
+ flypayV2Button.onclick = this.onFlypayV2ButtonClick;
8661
+ container.getElement().appendChild(flypayV2Button);
8810
8662
  }
8811
8663
  }, {
8812
8664
  key: "getButton",
8813
8665
  value: function getButton() {
8814
8666
  var style = document.createElement('style');
8815
- style.innerHTML = createFlypayV2ButtonStyle(this.containerId);
8667
+ style.innerHTML = this.createButtonStyle();
8816
8668
  document.head.appendChild(style);
8817
- this.flypayV2Button = document.createElement('button');
8818
- this.flypayV2Button.classList.add('flypay-v2-checkout-btn');
8819
- this.flypayV2Button.setAttribute('type', 'button');
8820
- this.flypayV2Button.setAttribute('aria-label', 'Pay with flypay');
8821
- this.flypayV2Button.setAttribute('id', 'flypay-v2-button');
8822
- this.flypayV2Button.innerHTML = getFlypayV2Button();
8823
- return this.flypayV2Button;
8669
+ var flypayV2Button = document.createElement('button');
8670
+ flypayV2Button.classList.add('flypay-v2-checkout-btn');
8671
+ flypayV2Button.setAttribute('type', 'button');
8672
+ flypayV2Button.setAttribute('id', 'flypay-v2-button');
8673
+ flypayV2Button.innerHTML = "\n <div id=\"loading-overlay\"></div>\n <div class=\"flypay-v2-checkout-btn__wrapper\">\n <img src=\"".concat(this.link.getBaseUrl(), "/images/flypay-checkout.png\" alt=\"Flypay Checkout\" class=\"flypay-v2-image\">\n </div>\n ");
8674
+ return flypayV2Button;
8824
8675
  }
8825
8676
  }, {
8826
- key: "handleMerchantOnButtonClickEvent",
8827
- value: function handleMerchantOnButtonClickEvent() {
8828
- var _this3 = this;
8829
- return new Promise(function (resolve, reject) {
8830
- var merchantResult;
8831
- _this3.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
8832
- attachResult: function attachResult(value) {
8833
- merchantResult = value;
8834
- }
8835
- });
8836
- if (merchantResult instanceof Promise) {
8837
- merchantResult.then(resolve)["catch"](reject);
8838
- } else {
8839
- if (merchantResult === false) {
8840
- reject();
8841
- } else {
8842
- resolve();
8843
- }
8844
- }
8845
- });
8677
+ key: "createButtonStyle",
8678
+ value: function createButtonStyle() {
8679
+ return "\n\t\t\t#widget {\n\t\t\t\tposition: relative;\n\t\t\t}\n\n\t\t\t#loading-overlay {\n\t\t\t\tposition: absolute;\n\t\t\t\twidth: 268px;\n\t\t\t\theight: 74px;\n\t\t\t\tbackground: rgba(255, 255, 255, 0.7);\n\t\t\t\tdisplay: none;\n\t\t\t\tjustify-content: center;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t#loading-overlay::after {\n\t\t\t\tcontent: \"\";\n\t\t\t\tdisplay: inline-block;\n\t\t\t\twidth: 40px;\n\t\t\t\theight: 40px;\n\t\t\t\tborder: 4px solid #ccc;\n\t\t\t\tborder-top-color: #333;\n\t\t\t\tborder-radius: 50%;\n\n\t\t\t\t/* Vendor prefixes for animation property */\n\t\t\t\t-webkit-animation: spin 1s infinite linear;\n\t\t\t\t-moz-animation: spin 1s infinite linear;\n\t\t\t\t-o-animation: spin 1s infinite linear;\n\t\t\t\tanimation: spin 1s infinite linear;\n\t\t\t}\n\n\t\t\t@-webkit-keyframes spin {\n\t\t\t\t0% {\n\t\t\t\t-webkit-transform: rotate(0deg);\n\t\t\t\ttransform: rotate(0deg);\n\t\t\t\t}\n\t\t\t\t100% {\n\t\t\t\t-webkit-transform: rotate(360deg);\n\t\t\t\ttransform: rotate(360deg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@-moz-keyframes spin {\n\t\t\t\t0% {\n\t\t\t\t-moz-transform: rotate(0deg);\n\t\t\t\ttransform: rotate(0deg);\n\t\t\t\t}\n\t\t\t\t100% {\n\t\t\t\t-moz-transform: rotate(360deg);\n\t\t\t\ttransform: rotate(360deg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@-o-keyframes spin {\n\t\t\t\t0% {\n\t\t\t\t-o-transform: rotate(0deg);\n\t\t\t\ttransform: rotate(0deg);\n\t\t\t\t}\n\t\t\t\t100% {\n\t\t\t\t-o-transform: rotate(360deg);\n\t\t\t\ttransform: rotate(360deg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@keyframes spin {\n\t\t\t\t0% {\n\t\t\t\ttransform: rotate(0deg);\n\t\t\t\t}\n\t\t\t\t100% {\n\t\t\t\ttransform: rotate(360deg);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t.flypay-v2-checkout-btn {\n\t\t\t\tborder: none; /* Remove borders */\n\t\t\t\tbackground: transparent; /* Make the button background transparent */\n\t\t\t\tcursor: pointer; /* Make it look clickable */\n\t\t\t\toutline: none; /* Remove focus outline */\n\t\t\t\tpadding: 0; /* Remove any default padding */\n\t\t\t}\n\n\t\t\t.flypay-v2-image {\n\t\t\t\tdisplay: block; /* Display the image as block to remove any gaps */\n\t\t\t\tborder: none; /* Ensure the image doesn't have a border */\n\t\t\t\twidth: 100%; /* Make the image take full width of the container */\n\t\t\t}\n\t\t";
8846
8680
  }
8847
8681
  }, {
8848
8682
  key: "getOrderId",
8849
8683
  value: function getOrderId() {
8850
- var _this4 = this;
8684
+ var _this2 = this;
8851
8685
  return new Promise(function (resolve, reject) {
8852
- return _this4.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
8686
+ return _this2.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
8853
8687
  data: {
8854
8688
  request_type: 'CREATE_SESSION'
8855
8689
  },
@@ -8865,7 +8699,7 @@
8865
8699
  }, {
8866
8700
  key: "flypayV2Checkout",
8867
8701
  value: function flypayV2Checkout(orderId) {
8868
- var _this5 = this;
8702
+ var _this3 = this;
8869
8703
  var _a, _b;
8870
8704
  this.checkout = new Checkout(_extends(_extends({
8871
8705
  orderId: orderId
@@ -8875,59 +8709,41 @@
8875
8709
  }), this.refreshToken && {
8876
8710
  refresh_token: this.refreshToken
8877
8711
  }),
8878
- mode: 'express'
8712
+ mode: "express"
8879
8713
  }), {
8880
8714
  clientId: ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.gateway_mode) === 'live' ? 'dbbd114e-3583-4db5-915e-59f1b3dcd08b' : '924ac1ce-00f4-44e4-8277-06cae751ef1a',
8881
- url: ((_b = this.meta) === null || _b === void 0 ? void 0 : _b.gateway_mode) === 'live' ? 'https://checkout.cxbflypay.com.au' : 'https://checkout.sandbox.cxbflypay.com.au',
8715
+ url: ((_b = this.meta) === null || _b === void 0 ? void 0 : _b.gateway_mode) === 'live' ? 'https://checkout.beem.com.au' : 'https://release.checkout.beem.com.au',
8882
8716
  onCheckoutClosed: function onCheckoutClosed() {
8883
- var _a;
8884
- _this5.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE);
8885
- (_a = _this5.background) === null || _a === void 0 ? void 0 : _a.clear();
8886
- _this5.enable();
8717
+ var button = document.getElementById('flypay-v2-button');
8718
+ if (button) button.disabled = false;
8887
8719
  },
8888
8720
  onError: function onError(err) {
8889
- return _this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
8721
+ return _this3.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
8890
8722
  error: err
8891
8723
  });
8892
8724
  },
8893
8725
  onPaymentSuccess: function onPaymentSuccess(data) {
8894
- return _this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_SUCCESS, data);
8726
+ return _this3.eventEmitter.emit(WALLET_EVENT.PAYMENT_SUCCESS, data);
8895
8727
  },
8896
8728
  onPaymentError: function onPaymentError(err) {
8897
- return _this5.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
8729
+ return _this3.eventEmitter.emit(WALLET_EVENT.PAYMENT_ERROR, {
8898
8730
  error: err
8899
8731
  });
8900
8732
  },
8901
8733
  onTokensChanged: function onTokensChanged(_ref) {
8902
8734
  var accessToken = _ref.accessToken,
8903
8735
  refreshToken = _ref.refreshToken;
8904
- _this5.accessToken = accessToken;
8905
- _this5.refreshToken = refreshToken;
8906
- _this5.eventEmitter.emit(WALLET_EVENT.AUTH_TOKENS_CHANGED, {
8736
+ _this3.accessToken = accessToken;
8737
+ _this3.refreshToken = refreshToken;
8738
+ _this3.eventEmitter.emit(WALLET_EVENT.AUTH_TOKENS_CHANGED, {
8907
8739
  accessToken: accessToken,
8908
8740
  refreshToken: refreshToken
8909
8741
  });
8910
8742
  }
8911
8743
  }));
8912
8744
  this.checkout.open();
8913
- if (this.checkout.isCheckoutOpen) this.eventEmitter.emit(WALLET_EVENT.CHECKOUT_OPEN, {});
8914
8745
  this.checkout.listenMessage();
8915
8746
  }
8916
- }, {
8917
- key: "initBackground",
8918
- value: function initBackground() {
8919
- var _this6 = this;
8920
- var hideCloseButton = true;
8921
- var bg = new WalletBackground(this.link.getNetUrl() + FLYPAY_LOGO_LINK, hideCloseButton);
8922
- bg.setBackdropTitle("");
8923
- bg.setBackdropDescription("");
8924
- bg.onTrigger(TRIGGER$1.CLOSE, function () {
8925
- var _a;
8926
- _this6.checkout.close();
8927
- (_a = _this6.background) === null || _a === void 0 ? void 0 : _a.clear();
8928
- });
8929
- return bg;
8930
- }
8931
8747
  }]);
8932
8748
  return FlypayV2WalletService;
8933
8749
  }(WalletService);
@@ -8941,7 +8757,6 @@
8941
8757
  * @param {string} UPDATE=update
8942
8758
  * @param {string} PAYMENT_SUCCESSFUL=paymentSuccessful
8943
8759
  * @param {string} PAYMENT_ERROR=paymentError
8944
- * @param {string} ON_CLICK=onClick
8945
8760
  */
8946
8761
  var EVENT$1 = {
8947
8762
  UNAVAILABLE: "unavailable",
@@ -8949,11 +8764,68 @@
8949
8764
  PAYMENT_SUCCESSFUL: "paymentSuccessful",
8950
8765
  PAYMENT_ERROR: "paymentError",
8951
8766
  PAYMENT_IN_REVIEW: "paymentInReview",
8952
- AUTH_TOKENS_CHANGED: "authTokensChanged",
8953
- ON_CLICK: "onClick",
8954
- ON_CHECKOUT_OPEN: "onCheckoutOpen",
8955
- ON_CHECKOUT_CLOSE: "onCheckoutClose"
8767
+ AUTH_TOKENS_CHANGED: "authTokensChanged"
8956
8768
  };
8769
+ /**
8770
+ * Interface of data used by the wallet checkout and payment proccess.
8771
+ * @interface IWalletMeta
8772
+ *
8773
+ * @type {object}
8774
+ * @param {string} [amount_label] Label shown next to the total amount to be paid. Required for [Stripe, ApplePay, GooglePay]. N/A for [FlyPay, Flypay V2, PayPal, Afterpay].
8775
+ * @param {string} [country] Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay, GooglePay, Afterpay]. N/A for [FlyPay, Flypay V2, PayPal].
8776
+ * @param {boolean} [pay_later] Used to enable Pay Later feature in PayPal Smart Checkout WalletButton integration when available. Optional for [PayPal]. N/A for other wallets.
8777
+ * @param {boolean} [standalone] Used to enable Standalone Buttons feature in PayPal Smart Checkout WalletButton integration. Used together with `pay_later`. Optional for [PayPal]. N/A for other wallets.
8778
+ * @param {boolean} [show_billing_address] Used to hide/show the billing address on ApplePay and GooglePay popups. Default value is false. Optional for [ApplePay, GooglePay]. N/A for other wallets.
8779
+ * @param {boolean} [request_payer_name] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
8780
+ * @param {boolean} [request_payer_email] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
8781
+ * @param {boolean} [request_payer_phone] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
8782
+ * @param {string} [access_token] Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets.
8783
+ * @param {string} [refresh_token] Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets.
8784
+ * @param {boolean} [request_shipping] Used to request or not shipping address in the Wallet checkout, being able to handle amount changes via the `update` event. Optional for [FlyPay, PayPal, ApplePay, GooglePay]. N/A for [Flypay V2, Stripe, Afterpay].
8785
+ * @param {IApplePayShippingOption[] | IPayPalShippingOption[]} [shipping_options] Used to provide available shipping options.(To use shipping_options the request_shipping flag should be true). Optional for [ApplePay]. N/A for the other wallets.
8786
+ * @param {string} [merchant_name] Merchant Name used for GooglePay integration via MPGS. Required for [GooglePay]. N/A for other wallets.
8787
+ * @param {object} [raw_data_initialization] Used to provide values to initialize wallet with raw data. Optional for [ApplePay]. N/A for the other wallets.
8788
+ * @param {object} [style] For **Paypal**: used to style the buttons, check possible values in the [style guide](https://developer.paypal.com/docs/business/checkout/reference/style-guide).
8789
+ * When `standalone` and `pay_later`, extra options can be provided in `style.messages` with the [messages style options](https://developer.paypal.com/docs/checkout/pay-later/us/integrate/reference/#stylelayout).
8790
+ * Also used at **ApplePay**, **GooglePay** and **Afterpay** to select button type.
8791
+ * Optional for [PayPal, ApplePay, GooglePay, Afterpay]. N/A for [Stripe, FlyPay, Flypay V2].
8792
+ * @param {object} [style.button_type] Used to select ApplePay button type (e.g: 'buy','donate', etc), check possible values at https://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_css.
8793
+ * Also select button type for GooglePay (check GooglePayStyles) and Afterpay (check AfterpayStyles). Optional for [ApplePay, GooglePay, Afterpay]. N/A for other wallets.
8794
+ * @param {object} [style.height] Used to select Afterpay button height. Optional for [Afterpay]. N/A for other wallets.
8795
+ * @param {array} [wallets] By default if this is not sent or empty, we will try to show either Apple Pay or Google Pay buttons. This can be limited sending the following array in this field: ['apple','google]. Optional for [Stripe, ApplePay, GooglePay]. N/A for other wallets.
8796
+ */
8797
+ /**
8798
+ * Interface of Shipping Options for ApplePay
8799
+ * @interface IApplePayShippingOption
8800
+ *
8801
+ * @type {object}
8802
+ * @param {string} [id] Identifier of the Shipping Option. Required.
8803
+ * @param {string} [label] Identifier of the Shipping Option. Required.
8804
+ * @param {string} [amount] Amount of the Shipping Option. Required.
8805
+ * @param {string} [detail] Details of the Shipping Option. Required.
8806
+ * @param {string} [type] Type of the Shipping Option. Values can be 'ELECTRONIC', 'GROUND', 'NOT_SHIPPED', 'OVERNIGHT', 'PICKUP', 'PRIORITY', 'SAME_DAY'. Optional.
8807
+ */
8808
+ /**
8809
+ * Interface of Shipping Options for GooglePay
8810
+ * @interface IGooglePayShippingOption
8811
+ *
8812
+ * @type {object}
8813
+ * @param {string} [id] Identifier of the Shipping Option. Required.
8814
+ * @param {string} [label] Identifier of the Shipping Option. Required.
8815
+ * @param {string} [detail] Details of the Shipping Option. Optional.
8816
+ * @param {string} [type] Type of the Shipping Option. Values can be 'ELECTRONIC', 'GROUND', 'NOT_SHIPPED', 'OVERNIGHT', 'PICKUP', 'PRIORITY', 'SAME_DAY'. Optional.
8817
+ */
8818
+ /**
8819
+ * Interface of Shipping Options for PayPal
8820
+ * @interface IPayPalShippingOption
8821
+ *
8822
+ * @type {object}
8823
+ * @param {string} [id] Identifier of the Shipping Option. Required.
8824
+ * @param {string} [label] Identifier of the Shipping Option. Required.
8825
+ * @param {string} [amount] Amount of the Shipping Option. Required.
8826
+ * @param {string} [currency] Currency of the Shipping Option. Required.
8827
+ * @param {string} [type] Type of the Shipping Option. Values can be 'SHIPPING' or 'PICKUP'. Required.
8828
+ */
8957
8829
  /**
8958
8830
  * Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay, Flypay V2, Paypal, Afterpay)
8959
8831
  * @constructor
@@ -9128,28 +9000,6 @@
9128
9000
  this.api.setEnv(env, alias);
9129
9001
  this.service.setEnv(env);
9130
9002
  }
9131
- /**
9132
- * Current method can enable the payment button. This method is only supported for Flypay V2.
9133
- *
9134
- * @example
9135
- * button.enable();
9136
- */
9137
- }, {
9138
- key: "enable",
9139
- value: function enable() {
9140
- this.service.enable();
9141
- }
9142
- /**
9143
- * Current method can disable the payment button. This method is only supported for Flypay V2.
9144
- *
9145
- * @example
9146
- * button.disable('production', 'paydock.com');
9147
- */
9148
- }, {
9149
- key: "disable",
9150
- value: function disable() {
9151
- this.service.disable();
9152
- }
9153
9003
  /**
9154
9004
  * Closes the checkout forcibly. Currently supported in Flypay wallet.
9155
9005
  *
@@ -9353,69 +9203,6 @@
9353
9203
  });
9354
9204
  });
9355
9205
  }
9356
- /**
9357
- * Registers a callback function to be invoked when the wallet button gets clicked.
9358
- * There are two operational modes supported, Synchronous and Asynchronous.
9359
- * When asynchronous operations need to occur on the callback handler, attaching the Promise via `attachResult` is required to have the wallet wait for a result.
9360
- * When synchronous operations occur on the callback handler, attaching a boolean result via `attachResult` is optional to control the execution flow.
9361
- * Note this is supported for Paypal, GooglePay and ApplePay wallet buttons at the moment.
9362
- *
9363
- * @example
9364
- * button.onClick((data) => {
9365
- * performValidationLogic();
9366
- * });
9367
- *
9368
- * @param {listener} handler - Function to be called when the wallet button is clicked.
9369
- */
9370
- }, {
9371
- key: "onClick",
9372
- value: function onClick(handler) {
9373
- if (typeof handler === 'function') return this.eventEmitter.subscribe(EVENT$1.ON_CLICK, handler);
9374
- }
9375
- /**
9376
- * Registers a callback function to be invoked when the wallet checkout opens.
9377
- * Note this is supported for FlypayV2 wallet button at the moment.
9378
- *
9379
- * @example
9380
- * button.onCheckoutOpen((data) => {
9381
- * console.log('Checkout opens');
9382
- * });
9383
- *
9384
- * @param {listener} handler - Function to be called when the wallet checkout opens.
9385
- */
9386
- }, {
9387
- key: "onCheckoutOpen",
9388
- value: function onCheckoutOpen(handler) {
9389
- var _this8 = this;
9390
- if (typeof handler === 'function') return this.eventEmitter.subscribe(EVENT$1.ON_CHECKOUT_OPEN, handler);
9391
- return new Promise(function (resolve) {
9392
- return _this8.eventEmitter.subscribe(EVENT$1.ON_CHECKOUT_OPEN, function (err) {
9393
- return resolve(err);
9394
- });
9395
- });
9396
- }
9397
- /**
9398
- * Registers a callback function to be invoked when the wallet checkout closes.
9399
- * Note this is supported for FlypayV2 wallet button at the moment.
9400
- *
9401
- * @example
9402
- * button.onCheckoutClose(() => {
9403
- * console.log('Wallet checkout closes');
9404
- * });
9405
- *
9406
- * @param {listener} handler - Function to be called when the wallet checkout closes.
9407
- */
9408
- }, {
9409
- key: "onCheckoutClose",
9410
- value: function onCheckoutClose(handler) {
9411
- var _this9 = this;
9412
- if (typeof handler === 'function') return this.eventEmitter.subscribe(EVENT$1.ON_CHECKOUT_CLOSE, handler);
9413
- return new Promise(function (resolve) {
9414
- return _this9.eventEmitter.subscribe(EVENT$1.ON_CHECKOUT_CLOSE, function (err) {
9415
- return resolve(err);
9416
- });
9417
- });
9418
- }
9419
9206
  }, {
9420
9207
  key: "setupServiceCallbacks",
9421
9208
  value: function setupServiceCallbacks() {
@@ -9427,16 +9214,13 @@
9427
9214
  this.setupPaymentInReviewCallback();
9428
9215
  this.setupPaymentErrorCallback();
9429
9216
  this.setupAuthTokensChangedCallback();
9430
- this.setupOnClickCallback();
9431
- this.setupOnCheckoutOpenCallback();
9432
- this.setupOnCheckoutCloseCallback();
9433
9217
  }
9434
9218
  }, {
9435
9219
  key: "setupUnavailableCallback",
9436
9220
  value: function setupUnavailableCallback() {
9437
- var _this10 = this;
9221
+ var _this8 = this;
9438
9222
  this.service.on(WALLET_EVENT.UNAVAILABLE, function (eventData) {
9439
- return _this10.eventEmitter.emit(EVENT$1.UNAVAILABLE, {
9223
+ return _this8.eventEmitter.emit(EVENT$1.UNAVAILABLE, {
9440
9224
  event: EVENT$1.UNAVAILABLE,
9441
9225
  data: eventData
9442
9226
  });
@@ -9445,58 +9229,25 @@
9445
9229
  }, {
9446
9230
  key: "setupUpdateCallback",
9447
9231
  value: function setupUpdateCallback() {
9448
- var _this11 = this;
9232
+ var _this9 = this;
9449
9233
  this.service.on(WALLET_EVENT.UPDATE, function (eventData) {
9450
- return _this11.hasUpdateHandler ? _this11.eventEmitter.emit(EVENT$1.UPDATE, {
9234
+ return _this9.hasUpdateHandler ? _this9.eventEmitter.emit(EVENT$1.UPDATE, {
9451
9235
  event: EVENT$1.UPDATE,
9452
9236
  data: eventData
9453
- }) : _this11.update({
9237
+ }) : _this9.update({
9454
9238
  success: true
9455
9239
  });
9456
9240
  });
9457
9241
  }
9458
- }, {
9459
- key: "setupOnClickCallback",
9460
- value: function setupOnClickCallback() {
9461
- var _this12 = this;
9462
- this.service.on(WALLET_EVENT.BUTTON_CLICK, function (data) {
9463
- return _this12.eventEmitter.emit(EVENT$1.ON_CLICK, {
9464
- event: EVENT$1.ON_CLICK,
9465
- data: data
9466
- });
9467
- });
9468
- }
9469
- }, {
9470
- key: "setupOnCheckoutOpenCallback",
9471
- value: function setupOnCheckoutOpenCallback() {
9472
- var _this13 = this;
9473
- this.service.on(WALLET_EVENT.CHECKOUT_OPEN, function (data) {
9474
- return _this13.eventEmitter.emit(EVENT$1.ON_CHECKOUT_OPEN, {
9475
- event: EVENT$1.ON_CHECKOUT_OPEN,
9476
- data: data
9477
- });
9478
- });
9479
- }
9480
- }, {
9481
- key: "setupOnCheckoutCloseCallback",
9482
- value: function setupOnCheckoutCloseCallback() {
9483
- var _this14 = this;
9484
- this.service.on(WALLET_EVENT.CHECKOUT_CLOSE, function (data) {
9485
- return _this14.eventEmitter.emit(EVENT$1.ON_CHECKOUT_CLOSE, {
9486
- event: EVENT$1.ON_CHECKOUT_CLOSE,
9487
- data: data
9488
- });
9489
- });
9490
- }
9491
9242
  }, {
9492
9243
  key: "setupWalletCallback",
9493
9244
  value: function setupWalletCallback() {
9494
- var _this15 = this;
9245
+ var _this10 = this;
9495
9246
  this.service.on(WALLET_EVENT.CALLBACK, function (eventData) {
9496
9247
  var data = eventData.data,
9497
9248
  onSuccess = eventData.onSuccess,
9498
9249
  onError = eventData.onError;
9499
- _this15.api.charge().walletCallback(data).then(function (res) {
9250
+ _this10.api.charge().walletCallback(data).then(function (res) {
9500
9251
  return onSuccess(res);
9501
9252
  }, function (err) {
9502
9253
  return onError(err.message);
@@ -9506,15 +9257,15 @@
9506
9257
  }, {
9507
9258
  key: "setupPaymentCallback",
9508
9259
  value: function setupPaymentCallback() {
9509
- var _this16 = this;
9260
+ var _this11 = this;
9510
9261
  this.service.on(WALLET_EVENT.PAYMENT_METHOD_SELECTED, function (eventData) {
9511
9262
  var data = eventData.data,
9512
9263
  onSuccess = eventData.onSuccess,
9513
9264
  onError = eventData.onError;
9514
- _this16.api.charge().walletCapture(data).then(function (captureResult) {
9265
+ _this11.api.charge().walletCapture(data).then(function (captureResult) {
9515
9266
  if (typeof onSuccess === 'function') onSuccess();
9516
9267
  var event = captureResult.status === 'inreview' ? EVENT$1.PAYMENT_IN_REVIEW : EVENT$1.PAYMENT_SUCCESSFUL;
9517
- _this16.eventEmitter.emit(event, {
9268
+ _this11.eventEmitter.emit(event, {
9518
9269
  event: event,
9519
9270
  data: _extends(_extends({}, captureResult), data.customer && {
9520
9271
  payer_name: data.customer.payer_name,
@@ -9524,7 +9275,7 @@
9524
9275
  });
9525
9276
  }, function (err) {
9526
9277
  if (typeof onError === 'function') onError(err);
9527
- _this16.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9278
+ _this11.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9528
9279
  event: EVENT$1.PAYMENT_ERROR,
9529
9280
  data: err
9530
9281
  });
@@ -9534,9 +9285,9 @@
9534
9285
  }, {
9535
9286
  key: "setupPaymentSuccessCallback",
9536
9287
  value: function setupPaymentSuccessCallback() {
9537
- var _this17 = this;
9288
+ var _this12 = this;
9538
9289
  this.service.on(WALLET_EVENT.PAYMENT_SUCCESS, function (eventData) {
9539
- return _this17.eventEmitter.emit(EVENT$1.PAYMENT_SUCCESSFUL, {
9290
+ return _this12.eventEmitter.emit(EVENT$1.PAYMENT_SUCCESSFUL, {
9540
9291
  event: EVENT$1.PAYMENT_SUCCESSFUL,
9541
9292
  data: eventData
9542
9293
  });
@@ -9545,9 +9296,9 @@
9545
9296
  }, {
9546
9297
  key: "setupPaymentInReviewCallback",
9547
9298
  value: function setupPaymentInReviewCallback() {
9548
- var _this18 = this;
9299
+ var _this13 = this;
9549
9300
  this.service.on(WALLET_EVENT.PAYMENT_IN_REVIEW, function (eventData) {
9550
- return _this18.eventEmitter.emit(EVENT$1.PAYMENT_IN_REVIEW, {
9301
+ return _this13.eventEmitter.emit(EVENT$1.PAYMENT_IN_REVIEW, {
9551
9302
  event: EVENT$1.PAYMENT_IN_REVIEW,
9552
9303
  data: eventData
9553
9304
  });
@@ -9556,9 +9307,9 @@
9556
9307
  }, {
9557
9308
  key: "setupPaymentErrorCallback",
9558
9309
  value: function setupPaymentErrorCallback() {
9559
- var _this19 = this;
9310
+ var _this14 = this;
9560
9311
  this.service.on(WALLET_EVENT.PAYMENT_ERROR, function (eventData) {
9561
- return _this19.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9312
+ return _this14.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9562
9313
  event: EVENT$1.PAYMENT_ERROR,
9563
9314
  data: eventData
9564
9315
  });
@@ -9567,9 +9318,9 @@
9567
9318
  }, {
9568
9319
  key: "setupAuthTokensChangedCallback",
9569
9320
  value: function setupAuthTokensChangedCallback() {
9570
- var _this20 = this;
9321
+ var _this15 = this;
9571
9322
  this.service.on(WALLET_EVENT.AUTH_TOKENS_CHANGED, function (eventData) {
9572
- return _this20.eventEmitter.emit(EVENT$1.AUTH_TOKENS_CHANGED, {
9323
+ return _this15.eventEmitter.emit(EVENT$1.AUTH_TOKENS_CHANGED, {
9573
9324
  event: EVENT$1.AUTH_TOKENS_CHANGED,
9574
9325
  data: eventData
9575
9326
  });
@@ -10612,87 +10363,58 @@
10612
10363
  return VaultDisplayWidget;
10613
10364
  }();
10614
10365
 
10615
- var VisaSRCStyles = /*#__PURE__*/_createClass(function VisaSRCStyles() {
10616
- _classCallCheck(this, VisaSRCStyles);
10617
- });
10618
- VisaSRCStyles.buttonContainerStyles = "display: flex; flex-direction: column; justify-content: center; align-items: center;";
10619
- VisaSRCStyles.buttonStyles = "color: #ffff; background-color: #ffbe24; border: none; width: 100%; min-height: 40px; font-size: 16px; font-weight: bold; line-height: 19px; letter-spacing: 0.7px; text-transform: uppercase; border-radius: 4px; margin-bottom: 15px; cursor: pointer;";
10620
- VisaSRCStyles.footerContainerStyles = "display: flex; flex: 1; flex-wrap: wrap; justify-content: center;";
10621
- VisaSRCStyles.footerTextStyles = "text-align: center; color: #666666; margin: 2px 0;";
10622
- VisaSRCStyles.verticalLineStyle = "display: inline-block; padding: 0.5px; background-color: #E5E5E5; height: 15px;";
10623
- VisaSRCStyles.clickToPayAllCardsStyle = "height: 17px; margin-left: 8px; vertical-align: middle; padding-top: 3px;";
10624
- // TODO: Remind to add in docs that if merchant's div is smaller than 240px the button styles will broke
10625
-
10626
10366
  /**
10627
10367
  * List of available event's name in the SRC checkout lifecycle
10628
10368
  * @enum EVENT
10629
10369
  *
10630
10370
  * @type {object}
10631
- * @param {string} CHECKOUT_BUTTON_LOADED=checkoutButtonLoaded
10632
- * @param {string} CHECKOUT_BUTTON_CLICKED=checkoutButtonClicked
10633
- * @param {string} IFRAME_LOADED=iframeLoaded
10634
- * @param {string} CHECKOUT_READY=checkoutReady
10635
- * @param {string} CHECKOUT_COMPLETED=checkoutCompleted
10636
- * @param {string} CHECKOUT_ERROR=checkoutError
10371
+ * @param {string} IFRAME_LOADED=iframeLoaded Initial event sent when IFrame is initially loaded.
10372
+ * @param {string} CHECKOUT_READY=checkoutReady Event sent when checkout is loaded and ready to be used by customer. Leverage alongside [showCheckout](#SRC+showCheckout) and [hideCheckout](#SRC+hideCheckout).
10373
+ * @param {string} CHECKOUT_POPUP_OPEN=checkoutPopupOpen Event sent when SRC Checkout flow is started, regardless of embedded or windowed mode.
10374
+ * @param {string} CHECKOUT_POPUP_CLOSE=checkoutPopupClose Event sent when SRC Checkout flow is closed, regardless of embedded or windowed mode.
10375
+ * @param {string} CHECKOUT_COMPLETED=checkoutCompleted Event sent on successful checkout by customer. Check [data](#EventDataCheckoutCompletedData) for more information.
10376
+ * @param {string} CHECKOUT_ERROR=checkoutError Event sent on error checkout by customer. Check [data](#EventData) for more information.
10637
10377
  */
10638
10378
  var EVENT$2;
10639
10379
  (function (EVENT) {
10640
- EVENT["CHECKOUT_BUTTON_LOADED"] = "checkoutButtonLoaded";
10641
- EVENT["CHECKOUT_BUTTON_CLICKED"] = "checkoutButtonClicked";
10642
10380
  EVENT["IFRAME_LOADED"] = "iframeLoaded";
10643
10381
  EVENT["CHECKOUT_READY"] = "checkoutReady";
10644
10382
  EVENT["CHECKOUT_COMPLETED"] = "checkoutCompleted";
10645
10383
  EVENT["CHECKOUT_ERROR"] = "checkoutError";
10384
+ EVENT["CHECKOUT_POPUP_OPEN"] = "checkoutPopupOpen";
10385
+ EVENT["CHECKOUT_POPUP_CLOSE"] = "checkoutPopupClose";
10646
10386
  })(EVENT$2 || (EVENT$2 = {}));
10387
+ /**
10388
+ * List of available event data types
10389
+ * @enum EVENT_DATA_TYPE
10390
+ *
10391
+ * @type {object}
10392
+ * @param {string} CRITICAL_ERROR=CriticalError in this error scenario the checkout is understood to be in a non-recoverable state and should be closed by the merchant and give alternate payment options to the user
10393
+ * @param {string} USER_ERROR=UserError in this error scenario the error in likely a user input error and the checkout is in a recoverable state, so the user will be kept within the checkout and can retry the flow
10394
+ * @param {string} SUCCESS=Success
10395
+ */
10396
+ var EVENT_DATA_TYPE;
10397
+ (function (EVENT_DATA_TYPE) {
10398
+ EVENT_DATA_TYPE["CRITICAL_ERROR"] = "CriticalError";
10399
+ EVENT_DATA_TYPE["USER_ERROR"] = "UserError";
10400
+ EVENT_DATA_TYPE["SUCCESS"] = "Success";
10401
+ })(EVENT_DATA_TYPE || (EVENT_DATA_TYPE = {}));
10647
10402
  var STYLE$2 = {
10648
- BUTTON_TEXT_COLOR: 'button_text_color',
10649
- PRIMARY_COLOR: 'primary_color',
10403
+ PRIMARY_BUTTON_COLOR: 'primary_button_color',
10404
+ SECONDARY_BUTTON_COLOR: 'secondary_button_color',
10405
+ PRIMARY_BUTTON_TEXT_COLOR: 'primary_button_text_color',
10406
+ SECONDARY_BUTTON_TEXT_COLOR: 'secondary_button_text_color',
10650
10407
  FONT_FAMILY: 'font_family',
10651
- CARD_SCHEMES: 'card_schemes'
10652
- };
10653
-
10654
- var CARD_SCHEME = {
10655
- VISA: 'visa',
10656
- MASTERCARD: 'mastercard',
10657
- AMEX: 'amex',
10658
- DISCOVER: 'discover'
10659
- };
10660
- var CHEVRON_VMAD_IMG_PATH = '/images/visa-src/Chevron_Large_VMAD.png';
10661
- var CHEVRON_VMA_IMG_PATH = '/images/visa-src/Chevron_Large_VMA.png';
10662
- var CHEVRON_VM_IMG_PATH = '/images/visa-src/Chevron_Large_VM.png';
10663
- var CHEVRON_M_IMG_PATH = '/images/visa-src/Chevron_Large_M.png';
10664
- var CHEVRON_D_IMG_PATH = '/images/visa-src/Chevron_Large_D.png';
10665
- var CHEVRON_V_IMG_PATH = '/images/visa-src/Chevron_Large_V.png';
10666
- var VMAD_IMG_PATH = '/images/visa-src/vmad.svg';
10667
- var VMA_IMG_PATH = '/images/visa-src/logos/Networks_Large_VMA.png';
10668
- var VM_IMG_PATH = '/images/visa-src/logos/Networks_Large_VM.png';
10669
- var M_IMG_PATH = '/images/visa-src/logos/master-logo.png';
10670
- var D_IMG_PATH = '/images/visa-src/logos/Networks_Large_D.png';
10671
- var V_IMG_PATH = '/images/visa-src/logos/visa-logo.png';
10672
- var GenerateCardSchemesLogo = function GenerateCardSchemesLogo(card_scheme) {
10673
- var chevron = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
10674
- if (!card_scheme || !Array.isArray(card_scheme)) return chevron ? CHEVRON_VMAD_IMG_PATH : VMAD_IMG_PATH;
10675
- var card_scheme_sort = card_scheme.sort();
10676
- if (includeArray([CARD_SCHEME.AMEX, CARD_SCHEME.MASTERCARD, CARD_SCHEME.VISA], card_scheme_sort)) return chevron ? CHEVRON_VMA_IMG_PATH : VMA_IMG_PATH;
10677
- if (includeArray([CARD_SCHEME.MASTERCARD, CARD_SCHEME.VISA], card_scheme_sort)) return chevron ? CHEVRON_VM_IMG_PATH : VM_IMG_PATH;
10678
- if (includeArray([CARD_SCHEME.MASTERCARD], card_scheme_sort)) return chevron ? CHEVRON_M_IMG_PATH : M_IMG_PATH;
10679
- if (includeArray([CARD_SCHEME.DISCOVER], card_scheme_sort)) return chevron ? CHEVRON_D_IMG_PATH : D_IMG_PATH;
10680
- if (includeArray([CARD_SCHEME.VISA], card_scheme_sort)) return chevron ? CHEVRON_V_IMG_PATH : V_IMG_PATH;
10681
- return chevron ? CHEVRON_V_IMG_PATH : VMAD_IMG_PATH;
10682
- };
10683
- var includeArray = function includeArray(condition, card_scheme) {
10684
- return condition.every(function (card, index) {
10685
- return card === card_scheme[index];
10686
- });
10408
+ ENABLE_SRC_POPUP: 'enable_src_popup'
10687
10409
  };
10688
10410
 
10689
- var VisaSRC = /*#__PURE__*/function () {
10690
- function VisaSRC(button_selector, iframe_selector, service_id, public_key, meta, eventEmitter, autoResize, env, alias) {
10691
- _classCallCheck(this, VisaSRC);
10411
+ var MastercardSRC = /*#__PURE__*/function () {
10412
+ function MastercardSRC(iframe_selector, service_id, public_key, meta, eventEmitter, autoResize, env, alias) {
10413
+ _classCallCheck(this, MastercardSRC);
10692
10414
  this.meta = meta;
10693
10415
  this.eventEmitter = eventEmitter;
10694
10416
  this.autoResize = autoResize;
10695
- this.link = new Link(VISA_SRC);
10417
+ this.link = new Link(MASTERCARD_SRC);
10696
10418
  this.link.setParams(_extends({
10697
10419
  service_id: service_id,
10698
10420
  public_key: public_key
@@ -10708,15 +10430,15 @@
10708
10430
  if (env) this.link.setEnv(env, alias);
10709
10431
  this.iFrameContainer = new Container(iframe_selector);
10710
10432
  this.iFrame = new IFrame(this.iFrameContainer);
10711
- this.buttonContainer = new Container(button_selector);
10712
10433
  this.iFrameEvent = new IFrameEvent(window);
10713
10434
  this.setupIFrameEvents();
10714
10435
  }
10715
- _createClass(VisaSRC, [{
10436
+ _createClass(MastercardSRC, [{
10716
10437
  key: "setupIFrameEvents",
10717
10438
  value: function setupIFrameEvents() {
10718
10439
  var _this = this;
10719
10440
  var widgetId = this.link.getParams().widget_id;
10441
+ if (!widgetId) return;
10720
10442
  this.iFrameEvent.on(EVENT$2.CHECKOUT_READY, widgetId, function (_ref) {
10721
10443
  var data = _ref.data;
10722
10444
  _this.eventEmitter.emit(EVENT$2.CHECKOUT_READY, data);
@@ -10725,8 +10447,16 @@
10725
10447
  var data = _ref2.data;
10726
10448
  _this.eventEmitter.emit(EVENT$2.CHECKOUT_COMPLETED, data);
10727
10449
  });
10728
- this.iFrameEvent.on(EVENT$2.CHECKOUT_ERROR, widgetId, function (_ref3) {
10450
+ this.iFrameEvent.on(EVENT$2.CHECKOUT_POPUP_OPEN, widgetId, function (_ref3) {
10729
10451
  var data = _ref3.data;
10452
+ _this.eventEmitter.emit(EVENT$2.CHECKOUT_POPUP_OPEN, data);
10453
+ });
10454
+ this.iFrameEvent.on(EVENT$2.CHECKOUT_POPUP_CLOSE, widgetId, function (_ref4) {
10455
+ var data = _ref4.data;
10456
+ _this.eventEmitter.emit(EVENT$2.CHECKOUT_POPUP_CLOSE, data);
10457
+ });
10458
+ this.iFrameEvent.on(EVENT$2.CHECKOUT_ERROR, widgetId, function (_ref5) {
10459
+ var data = _ref5.data;
10730
10460
  _this.eventEmitter.emit(EVENT$2.CHECKOUT_ERROR, data);
10731
10461
  });
10732
10462
  if (this.autoResize) this.useAutoResize(true);
@@ -10735,55 +10465,19 @@
10735
10465
  key: "load",
10736
10466
  value: function load() {
10737
10467
  var _this2 = this;
10738
- var _a;
10739
- var container = document.createElement('div');
10740
- container.setAttribute('style', VisaSRCStyles.buttonContainerStyles);
10741
- var checkoutButton = document.createElement('button');
10742
- checkoutButton.setAttribute('style', VisaSRCStyles.buttonStyles);
10743
- if (this.meta.customizations.primary_color) checkoutButton.style.backgroundColor = this.meta.customizations.primary_color;
10744
- if (this.meta.customizations.button_text_color) checkoutButton.style.color = this.meta.customizations.button_text_color;
10745
- checkoutButton.innerHTML = 'Checkout';
10746
- var footerContainer = document.createElement('div');
10747
- footerContainer.setAttribute('style', VisaSRCStyles.footerContainerStyles);
10748
- var verticalLine = document.createElement('div');
10749
- verticalLine.setAttribute('style', VisaSRCStyles.verticalLineStyle);
10750
- var footerText = document.createElement('p');
10751
- footerText.setAttribute('style', VisaSRCStyles.footerTextStyles);
10752
- footerText.innerHTML = 'WE ACCEPT';
10753
- var clickToPayAllCards = document.createElement('img');
10754
- clickToPayAllCards.setAttribute('style', VisaSRCStyles.clickToPayAllCardsStyle);
10755
- clickToPayAllCards.src = this.link.getBaseUrl() + "".concat(GenerateCardSchemesLogo((_a = this.meta.customizations) === null || _a === void 0 ? void 0 : _a.card_schemes, true));
10756
- checkoutButton.onclick = function () {
10757
- _this2.eventEmitter.emit(EVENT$2.CHECKOUT_BUTTON_CLICKED, {});
10758
- _this2.iFrame.load(_this2.link.getUrl(), {
10759
- title: 'Visa SRC checkout'
10760
- });
10761
- _this2.iFrame.getElement().onload = function () {
10762
- return _this2.eventEmitter.emit(EVENT$2.IFRAME_LOADED, {});
10763
- };
10468
+ this.iFrame.load(this.link.getUrl(), {
10469
+ title: 'Mastercard SRC checkout'
10470
+ });
10471
+ var iframeElement = this.iFrame.getElement();
10472
+ if (iframeElement) iframeElement.onload = function () {
10473
+ return _this2.eventEmitter.emit(EVENT$2.IFRAME_LOADED, {});
10764
10474
  };
10765
- container.appendChild(checkoutButton);
10766
- container.appendChild(footerContainer);
10767
- footerContainer.appendChild(footerText);
10768
- footerContainer.appendChild(clickToPayAllCards);
10769
- this.buttonContainer.getElement().appendChild(container);
10770
- this.eventEmitter.emit(EVENT$2.CHECKOUT_BUTTON_LOADED, {});
10771
10475
  }
10772
10476
  }, {
10773
10477
  key: "getEnv",
10774
10478
  value: function getEnv() {
10775
10479
  return this.link.getEnv();
10776
10480
  }
10777
- }, {
10778
- key: "hideButton",
10779
- value: function hideButton(_saveSize) {
10780
- if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'none';
10781
- }
10782
- }, {
10783
- key: "showButton",
10784
- value: function showButton() {
10785
- if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'block';
10786
- }
10787
10481
  }, {
10788
10482
  key: "hideCheckout",
10789
10483
  value: function hideCheckout(saveSize) {
@@ -10806,82 +10500,25 @@
10806
10500
  var _this3 = this;
10807
10501
  if (this.autoResize && !force) return;
10808
10502
  this.autoResize = true;
10809
- this.iFrameEvent.on('resize', this.link.getParams().widget_id, function (_ref4) {
10810
- var data = _ref4.data;
10811
- if (_this3.iFrame.getElement()) {
10812
- _this3.iFrame.getElement().scrolling = 'no';
10813
- if (data.height) _this3.iFrame.setStyle('height', data.height + 'px');
10503
+ var params = this.link.getParams();
10504
+ if (!(params === null || params === void 0 ? void 0 : params.widget_id)) return;
10505
+ this.iFrameEvent.on('resize', params.widget_id, function (_ref6) {
10506
+ var data = _ref6.data;
10507
+ var _a, _b;
10508
+ var iframeElement = _this3.iFrame.getElement();
10509
+ if (iframeElement) {
10510
+ iframeElement.scrolling = 'no';
10511
+ if ((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.height) _this3.iFrame.setStyle('height', ((_b = data === null || data === void 0 ? void 0 : data.data) === null || _b === void 0 ? void 0 : _b.height) + 'px');
10814
10512
  }
10815
10513
  });
10816
10514
  }
10817
10515
  }]);
10818
- return VisaSRC;
10516
+ return MastercardSRC;
10819
10517
  }();
10820
10518
 
10821
- /**
10822
- * Interface of data used for the Visa Checkout.
10823
- * @interface IVisaSRCMeta
10824
- *
10825
- * @type {object}
10826
- * @param {string} [srci_transaction_id] Used to identify the SRC Id.
10827
- * @param {object} [dpa_data] Object where the DPA creation data is stored.
10828
- * @param {string} [dpa_data.dpa_presentation_name] Name in which the DPA is presented in.
10829
- * @param {string} [dpa_data.dpa_uri] Used for indicating the DPA URI.
10830
- * @param {object} [dpa_transaction_options] Object that stores options for creating a trasaction with DPA.
10831
- * @param {string} [dpa_transaction_options.dpa_locale] DPA’s preferred locale, example en_US.
10832
- * @param {Array} [dpa_transaction_options.dpa_accepted_billing_countries] Used to indicate list of accepted billing countries for DPA.
10833
- * @param {Array} [dpa_transaction_options.dpa_accepted_shipping_countries] Used to indicate list of accepted shipping countries for DPA.
10834
- * @param {string} [dpa_transaction_options.dpa_billing_preference] Used for listing the enumeration for billing preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
10835
- * @param {string} [dpa_transaction_options.dpa_shipping_preference] Used for listing the enumeration for shipping preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
10836
- * @param {boolean} [dpa_transaction_options.consumer_name_requested] Used to check if the name of the consumer is needed.
10837
- * @param {boolean} [dpa_transaction_options.consumer_email_address_requested] Used to check if the email of the consumer is needed.
10838
- * @param {boolean} [dpa_transaction_options.consumer_phone_number_requested] Used to check if the phone number of the consumer is needed.
10839
- * @param {object} [dpa_transaction_options.payment_options] Object used to check the payment options that are included.
10840
- * @param {number} [dpa_transaction_options.payment_options.dpa_dynamic_data_ttl_minutes] The minimum requested validity period for the transaction credentials.
10841
- * @param {string} [dpa_transaction_options.payment_options.dynamic_data_type] Used for listing the enumeration for dynamic data types. Options are 'TAVV' and 'DTVV'.
10842
- * @param {boolean} [dpa_transaction_options.payment_options.dpa_pan_requested] Used to check if PAN number was requested.
10843
- * @param {string} [dpa_transaction_options.review_action] Used for listing the enumeration of review actions. Options are 'pay' and 'continue'.
10844
- * @param {string} [dpa_transaction_options.checkout_description] Used for indicating the description of the checkout.
10845
- * @param {string} [dpa_transaction_options.transaction_type] Used for listing the enumeration of the type of the transaction. 'PURCHASE', 'BILL_PAYMENT' and 'MONEY_TRANSFER'
10846
- * @param {string} [dpa_transaction_options.order_type] Used for listing the enumeration of the type of the order. Options are 'REAUTHORIZATION', 'RECURRING' and 'INSTALLMENT'.
10847
- * @param {object} [dpa_transaction_options.transaction_amount] Object used to describe the details of the transaction.
10848
- * @param {number} [dpa_transaction_options.transaction_amount.transaction_amount] Used to indicate the amount of the transaction.
10849
- * @param {string} [dpa_transaction_options.transaction_amount.transaction_currency_code] Used to indicate the currency code of the transaction. 3 letter ISO code format.
10850
- * @param {string} [dpa_transaction_options.merchant_order_id] Used to indicate the merchants order Id.
10851
- * @param {string} [dpa_transaction_options.merchant_category_code] Used to indicate the merchants category code.
10852
- * @param {string} [dpa_transaction_options.merchant_country_code] Used to indicate the merchants country code. 2 letter ISO code format.
10853
- * @param {object} [customer] Object where the customer data is stored to prefill in the checkout.
10854
- * @param {string} [customer.email] Customer email.
10855
- * @param {string} [customer.first_name] Customer first name.
10856
- * @param {string} [customer.last_name] Customer last name.
10857
- * @param {object} [customer.phone] Object where the customer phone is stored.
10858
- * @param {string} [customer.phone.country_code] Customer phone country code (example "1" for US).
10859
- * @param {string} [customer.phone.phone] Customer phone number.
10860
- * @param {object} [customer.payment_source] Object where the customer billing address data is stored.
10861
- * @param {string} [customer.payment_source.address_line1] Customer billing address line 1.
10862
- * @param {string} [customer.payment_source.address_line2] Customer billing address line 2.
10863
- * @param {string} [customer.payment_source.address_city] Customer billing address city.
10864
- * @param {string} [customer.payment_source.address_postcode] Customer billing address postcode.
10865
- * @param {string} [customer.payment_source.address_state] Customer billing address state code (if applicable for the country, example "FL" for Florida).
10866
- * @param {string} [customer.payment_source.address_country] Customer billing address country code (example "US").
10867
- */
10868
- /**
10869
- * Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC
10870
- * @constructor
10871
- *
10872
- * @param {string} button_selector - Selector of html element. Container for SRC checkout button.
10873
- * @param {string} iframe_selector - Selector of html element. Container for SRC checkout iFrame.
10874
- * @param {string} service_id - Card Scheme Service ID
10875
- * @param {string} public_key_or_access_token - Paydock public key or Access Token
10876
- * @param {IVisaSRCMeta} meta - Data that configures the SRC checkout
10877
- * @example
10878
- * var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
10879
- *
10880
- */
10881
10519
  var SRC = /*#__PURE__*/function () {
10882
- function SRC(button_selector, iframe_selector, service_id, public_key_or_access_token, meta) {
10520
+ function SRC(iframe_selector, service_id, public_key_or_access_token, meta) {
10883
10521
  _classCallCheck(this, SRC);
10884
- this.button_selector = button_selector;
10885
10522
  this.iframe_selector = iframe_selector;
10886
10523
  this.service_id = service_id;
10887
10524
  this.public_key_or_access_token = public_key_or_access_token;
@@ -10896,11 +10533,13 @@
10896
10533
  *
10897
10534
  * @example
10898
10535
  * widget.setStyles({
10899
- * button_text_color: '#32a852',
10900
- * primary_color: '#32a852',
10901
- * font_family: 'sans-serif',
10902
- * card_schemes: ['visa']
10903
- * });
10536
+ * enable_src_popup: true
10537
+ * primary_button_color: 'red',
10538
+ * secondary_button_color: 'blue',
10539
+ * primary_button_text_color: 'white',
10540
+ * secondary_button_text_color: 'white',
10541
+ * font_family: 'Arial',
10542
+ * });
10904
10543
  * @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
10905
10544
  */
10906
10545
  _createClass(SRC, [{
@@ -10915,10 +10554,6 @@
10915
10554
  value: function setStyle(param, value) {
10916
10555
  if (ObjectHelper.values(STYLE$2).indexOf(param) !== -1) this.style[param] = value;else console.warn("Widget::setStyle[s: unsupported style param ".concat(param));
10917
10556
  }
10918
- /**
10919
- * The final method after configuring the SRC to start the load process of SRC checkout
10920
- *
10921
- */
10922
10557
  }, {
10923
10558
  key: "load",
10924
10559
  value: function load() {
@@ -10928,8 +10563,8 @@
10928
10563
  var type = _ref.type;
10929
10564
  _this.meta.customizations = _this.style; // assign the style on the start of the widget
10930
10565
  switch (type) {
10931
- case CARD_SCHEME_SERVICE.VISA_SRC:
10932
- _this.provider = new VisaSRC(_this.button_selector, _this.iframe_selector, _this.service_id, _this.public_key_or_access_token, _this.meta, _this.eventEmitter, _this.autoResize, _this.env, _this.alias);
10566
+ case CARD_SCHEME_SERVICE.MASTERCARD_SRC:
10567
+ _this.provider = new MastercardSRC(_this.iframe_selector, _this.service_id, _this.public_key_or_access_token, _this.meta, _this.eventEmitter, _this.autoResize, _this.env, _this.alias);
10933
10568
  break;
10934
10569
  }
10935
10570
  if (_this.provider) _this.provider.load();
@@ -10975,8 +10610,9 @@
10975
10610
  * SRC.on('checkoutCompleted').then(function (token) {
10976
10611
  * console.log(token);
10977
10612
  * });
10613
+ *
10978
10614
  * @param {string} eventName - Available event names [EVENT]{@link EVENT}
10979
- * @param {listener} [cb]
10615
+ * @param {listener} [cb] - The callback to handle the event. When available, it will send back data of type [EventData]{@link EventData}
10980
10616
  * @return {Promise<any> | void}
10981
10617
  */
10982
10618
  }, {
@@ -10990,29 +10626,6 @@
10990
10626
  });
10991
10627
  });
10992
10628
  }
10993
- /**
10994
- * Using this method you can hide button
10995
- * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
10996
- *
10997
- * @example
10998
- * SRC.hideButton();
10999
- */
11000
- }, {
11001
- key: "hideButton",
11002
- value: function hideButton(saveSize) {
11003
- if (this.provider && typeof this.provider.hideButton === 'function') this.provider.hideButton(saveSize);
11004
- }
11005
- /**
11006
- * Using this method you can show the SRC button after using hideButton method
11007
- *
11008
- * @example
11009
- * SRC.showButton();
11010
- */
11011
- }, {
11012
- key: "showButton",
11013
- value: function showButton() {
11014
- if (this.provider && typeof this.provider.showButton === 'function') this.provider.showButton();
11015
- }
11016
10629
  /**
11017
10630
  * Using this method you can hide checkout after load and button click
11018
10631
  * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
@@ -11064,6 +10677,50 @@
11064
10677
  return SRC;
11065
10678
  }();
11066
10679
 
10680
+ /**
10681
+ * Class MastercardSRCClickToPay include methods for interacting with the MastercardSRC checkout and Manual Card option
10682
+ *
10683
+ * @extends SRC
10684
+ *
10685
+ * @constructor
10686
+ *
10687
+ * @param {string} iframe_selector - Selector of html element. Container for SRC checkout iFrame.
10688
+ * @param {string} service_id - Card Scheme Service ID
10689
+ * @param {string} public_key_or_access_token - Paydock public key or Access Token
10690
+ * @param {IMastercardSRCMeta} meta - Data that configures the SRC checkout
10691
+ * @example
10692
+ * var mastercardSRC = new MastercardSRCClickToPay('#checkoutIframe', 'service_id', 'public_key', {});
10693
+ *
10694
+ */
10695
+ var MastercardSRCClickToPay = /*#__PURE__*/function (_SRC) {
10696
+ _inherits(MastercardSRCClickToPay, _SRC);
10697
+ var _super = _createSuper(MastercardSRCClickToPay);
10698
+ function MastercardSRCClickToPay(iframe_selector, service_id, public_key_or_access_token, meta) {
10699
+ var _this;
10700
+ _classCallCheck(this, MastercardSRCClickToPay);
10701
+ _this = _super.call(this, iframe_selector, service_id, public_key_or_access_token, meta);
10702
+ _this.iframe_selector = iframe_selector;
10703
+ _this.service_id = service_id;
10704
+ _this.public_key_or_access_token = public_key_or_access_token;
10705
+ _this.meta = meta;
10706
+ return _this;
10707
+ }
10708
+ /**
10709
+ * The final method after configuring the SRC to start the load process of SRC checkout
10710
+ *
10711
+ */
10712
+ _createClass(MastercardSRCClickToPay, [{
10713
+ key: "load",
10714
+ value: function load() {
10715
+ if (this.provider) return;
10716
+ this.meta.customizations = this.style;
10717
+ this.provider = new MastercardSRC(this.iframe_selector, this.service_id, this.public_key_or_access_token, this.meta, this.eventEmitter, this.autoResize, this.env, this.alias);
10718
+ this.provider.load();
10719
+ }
10720
+ }]);
10721
+ return MastercardSRCClickToPay;
10722
+ }(SRC);
10723
+
11067
10724
  exports.AfterpayCheckoutButton = AfterpayCheckoutButton;
11068
10725
  exports.Api = Api;
11069
10726
  exports.CHECKOUT_BUTTON_EVENT = CHECKOUT_BUTTON_EVENT;
@@ -11077,13 +10734,13 @@
11077
10734
  exports.HtmlMultiWidget = HtmlMultiWidget;
11078
10735
  exports.HtmlPaymentSourceWidget = HtmlPaymentSourceWidget;
11079
10736
  exports.HtmlWidget = HtmlWidget;
10737
+ exports.MastercardSRCClickToPay = MastercardSRCClickToPay;
11080
10738
  exports.MultiWidget = MultiWidget;
11081
10739
  exports.PAYMENT_TYPE = PAYMENT_TYPE;
11082
10740
  exports.PURPOSE = PURPOSE;
11083
10741
  exports.PaymentSourceBuilder = Builder$1;
11084
10742
  exports.PaymentSourceWidget = PaymentSourceWidget;
11085
10743
  exports.PaypalCheckoutButton = PaypalCheckoutButton;
11086
- exports.SRC = SRC;
11087
10744
  exports.STYLABLE_ELEMENT = STYLABLE_ELEMENT;
11088
10745
  exports.STYLABLE_ELEMENT_STATE = STYLABLE_ELEMENT_STATE;
11089
10746
  exports.STYLE = STYLE;