@paydock/client-sdk 1.103.1 → 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 (51) hide show
  1. package/README.md +245 -199
  2. package/bundles/widget.umd.js +144 -214
  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/iframe-event.d.ts +2 -0
  8. package/lib/components/iframe-event.js +2 -0
  9. package/lib/components/iframe-event.js.map +1 -1
  10. package/lib/components/link.d.ts +3 -2
  11. package/lib/components/link.js +1 -0
  12. package/lib/components/link.js.map +1 -1
  13. package/lib/components/param.d.ts +2 -2
  14. package/lib/components/param.js.map +1 -1
  15. package/lib/configs/env/env.d.ts +3 -0
  16. package/lib/configs/env/env.js +9 -0
  17. package/lib/configs/env/env.js.map +1 -1
  18. package/lib/configs/sdk.js +1 -1
  19. package/lib/secure-remote-commerce/index.d.ts +102 -1
  20. package/lib/secure-remote-commerce/index.js +102 -1
  21. package/lib/secure-remote-commerce/index.js.map +1 -1
  22. package/lib/secure-remote-commerce/interfaces.d.ts +109 -32
  23. package/lib/secure-remote-commerce/interfaces.js +31 -11
  24. package/lib/secure-remote-commerce/interfaces.js.map +1 -1
  25. package/lib/secure-remote-commerce/mastercard-secure-remote-commerce.d.ts +30 -0
  26. package/lib/secure-remote-commerce/mastercard-secure-remote-commerce.js +39 -0
  27. package/lib/secure-remote-commerce/mastercard-secure-remote-commerce.js.map +1 -0
  28. package/lib/secure-remote-commerce/providers/mastercard-src/index.d.ts +1 -0
  29. package/lib/secure-remote-commerce/providers/mastercard-src/index.js +2 -0
  30. package/lib/secure-remote-commerce/providers/mastercard-src/index.js.map +1 -0
  31. package/lib/secure-remote-commerce/providers/{visa-src/visa-src.d.ts → mastercard-src/mastercard-src.d.ts} +4 -7
  32. package/lib/secure-remote-commerce/providers/mastercard-src/mastercard-src.js +88 -0
  33. package/lib/secure-remote-commerce/providers/mastercard-src/mastercard-src.js.map +1 -0
  34. package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +13 -91
  35. package/lib/secure-remote-commerce/secure-remote-commerce.js +15 -98
  36. package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -1
  37. package/lib/wallet-buttons/flypay-v2.wallet-service.js +1 -1
  38. package/lib/wallet-buttons/flypay-v2.wallet-service.js.map +1 -1
  39. package/package.json +1 -1
  40. package/slate.md +59 -84
  41. package/lib/secure-remote-commerce/providers/visa-src/helper.d.ts +0 -7
  42. package/lib/secure-remote-commerce/providers/visa-src/helper.js +0 -36
  43. package/lib/secure-remote-commerce/providers/visa-src/helper.js.map +0 -1
  44. package/lib/secure-remote-commerce/providers/visa-src/index.d.ts +0 -1
  45. package/lib/secure-remote-commerce/providers/visa-src/index.js +0 -2
  46. package/lib/secure-remote-commerce/providers/visa-src/index.js.map +0 -1
  47. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +0 -113
  48. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +0 -1
  49. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +0 -8
  50. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +0 -10
  51. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.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.1';
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);
@@ -2220,6 +2241,8 @@
2220
2241
  CHECKOUT_READY: 'checkoutReady',
2221
2242
  CHECKOUT_ERROR: 'checkoutError',
2222
2243
  CHECKOUT_COMPLETED: 'checkoutCompleted',
2244
+ CHECKOUT_POPUP_OPEN: 'checkoutPopupOpen',
2245
+ CHECKOUT_POPUP_CLOSE: 'checkoutPopupClose',
2223
2246
  VALIDATION: 'validation',
2224
2247
  SELECT: 'select',
2225
2248
  UNSELECT: 'unselect',
@@ -8155,6 +8178,7 @@
8155
8178
  var CARD_SCHEME_SERVICE;
8156
8179
  (function (CARD_SCHEME_SERVICE) {
8157
8180
  CARD_SCHEME_SERVICE["VISA_SRC"] = "VisaSRC";
8181
+ CARD_SCHEME_SERVICE["MASTERCARD_SRC"] = "MastercardSRCClickToPay";
8158
8182
  })(CARD_SCHEME_SERVICE || (CARD_SCHEME_SERVICE = {}));
8159
8183
 
8160
8184
  var ApiInternal = /*#__PURE__*/function (_ApiBase) {
@@ -8688,7 +8712,7 @@
8688
8712
  mode: "express"
8689
8713
  }), {
8690
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',
8691
- 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',
8692
8716
  onCheckoutClosed: function onCheckoutClosed() {
8693
8717
  var button = document.getElementById('flypay-v2-button');
8694
8718
  if (button) button.disabled = false;
@@ -10339,87 +10363,58 @@
10339
10363
  return VaultDisplayWidget;
10340
10364
  }();
10341
10365
 
10342
- var VisaSRCStyles = /*#__PURE__*/_createClass(function VisaSRCStyles() {
10343
- _classCallCheck(this, VisaSRCStyles);
10344
- });
10345
- VisaSRCStyles.buttonContainerStyles = "display: flex; flex-direction: column; justify-content: center; align-items: center;";
10346
- 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;";
10347
- VisaSRCStyles.footerContainerStyles = "display: flex; flex: 1; flex-wrap: wrap; justify-content: center;";
10348
- VisaSRCStyles.footerTextStyles = "text-align: center; color: #666666; margin: 2px 0;";
10349
- VisaSRCStyles.verticalLineStyle = "display: inline-block; padding: 0.5px; background-color: #E5E5E5; height: 15px;";
10350
- VisaSRCStyles.clickToPayAllCardsStyle = "height: 17px; margin-left: 8px; vertical-align: middle; padding-top: 3px;";
10351
- // TODO: Remind to add in docs that if merchant's div is smaller than 240px the button styles will broke
10352
-
10353
10366
  /**
10354
10367
  * List of available event's name in the SRC checkout lifecycle
10355
10368
  * @enum EVENT
10356
10369
  *
10357
10370
  * @type {object}
10358
- * @param {string} CHECKOUT_BUTTON_LOADED=checkoutButtonLoaded
10359
- * @param {string} CHECKOUT_BUTTON_CLICKED=checkoutButtonClicked
10360
- * @param {string} IFRAME_LOADED=iframeLoaded
10361
- * @param {string} CHECKOUT_READY=checkoutReady
10362
- * @param {string} CHECKOUT_COMPLETED=checkoutCompleted
10363
- * @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.
10364
10377
  */
10365
10378
  var EVENT$2;
10366
10379
  (function (EVENT) {
10367
- EVENT["CHECKOUT_BUTTON_LOADED"] = "checkoutButtonLoaded";
10368
- EVENT["CHECKOUT_BUTTON_CLICKED"] = "checkoutButtonClicked";
10369
10380
  EVENT["IFRAME_LOADED"] = "iframeLoaded";
10370
10381
  EVENT["CHECKOUT_READY"] = "checkoutReady";
10371
10382
  EVENT["CHECKOUT_COMPLETED"] = "checkoutCompleted";
10372
10383
  EVENT["CHECKOUT_ERROR"] = "checkoutError";
10384
+ EVENT["CHECKOUT_POPUP_OPEN"] = "checkoutPopupOpen";
10385
+ EVENT["CHECKOUT_POPUP_CLOSE"] = "checkoutPopupClose";
10373
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 = {}));
10374
10402
  var STYLE$2 = {
10375
- BUTTON_TEXT_COLOR: 'button_text_color',
10376
- 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',
10377
10407
  FONT_FAMILY: 'font_family',
10378
- CARD_SCHEMES: 'card_schemes'
10408
+ ENABLE_SRC_POPUP: 'enable_src_popup'
10379
10409
  };
10380
10410
 
10381
- var CARD_SCHEME = {
10382
- VISA: 'visa',
10383
- MASTERCARD: 'mastercard',
10384
- AMEX: 'amex',
10385
- DISCOVER: 'discover'
10386
- };
10387
- var CHEVRON_VMAD_IMG_PATH = '/images/visa-src/Chevron_Large_VMAD.png';
10388
- var CHEVRON_VMA_IMG_PATH = '/images/visa-src/Chevron_Large_VMA.png';
10389
- var CHEVRON_VM_IMG_PATH = '/images/visa-src/Chevron_Large_VM.png';
10390
- var CHEVRON_M_IMG_PATH = '/images/visa-src/Chevron_Large_M.png';
10391
- var CHEVRON_D_IMG_PATH = '/images/visa-src/Chevron_Large_D.png';
10392
- var CHEVRON_V_IMG_PATH = '/images/visa-src/Chevron_Large_V.png';
10393
- var VMAD_IMG_PATH = '/images/visa-src/vmad.svg';
10394
- var VMA_IMG_PATH = '/images/visa-src/logos/Networks_Large_VMA.png';
10395
- var VM_IMG_PATH = '/images/visa-src/logos/Networks_Large_VM.png';
10396
- var M_IMG_PATH = '/images/visa-src/logos/master-logo.png';
10397
- var D_IMG_PATH = '/images/visa-src/logos/Networks_Large_D.png';
10398
- var V_IMG_PATH = '/images/visa-src/logos/visa-logo.png';
10399
- var GenerateCardSchemesLogo = function GenerateCardSchemesLogo(card_scheme) {
10400
- var chevron = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
10401
- if (!card_scheme || !Array.isArray(card_scheme)) return chevron ? CHEVRON_VMAD_IMG_PATH : VMAD_IMG_PATH;
10402
- var card_scheme_sort = card_scheme.sort();
10403
- if (includeArray([CARD_SCHEME.AMEX, CARD_SCHEME.MASTERCARD, CARD_SCHEME.VISA], card_scheme_sort)) return chevron ? CHEVRON_VMA_IMG_PATH : VMA_IMG_PATH;
10404
- if (includeArray([CARD_SCHEME.MASTERCARD, CARD_SCHEME.VISA], card_scheme_sort)) return chevron ? CHEVRON_VM_IMG_PATH : VM_IMG_PATH;
10405
- if (includeArray([CARD_SCHEME.MASTERCARD], card_scheme_sort)) return chevron ? CHEVRON_M_IMG_PATH : M_IMG_PATH;
10406
- if (includeArray([CARD_SCHEME.DISCOVER], card_scheme_sort)) return chevron ? CHEVRON_D_IMG_PATH : D_IMG_PATH;
10407
- if (includeArray([CARD_SCHEME.VISA], card_scheme_sort)) return chevron ? CHEVRON_V_IMG_PATH : V_IMG_PATH;
10408
- return chevron ? CHEVRON_V_IMG_PATH : VMAD_IMG_PATH;
10409
- };
10410
- var includeArray = function includeArray(condition, card_scheme) {
10411
- return condition.every(function (card, index) {
10412
- return card === card_scheme[index];
10413
- });
10414
- };
10415
-
10416
- var VisaSRC = /*#__PURE__*/function () {
10417
- function VisaSRC(button_selector, iframe_selector, service_id, public_key, meta, eventEmitter, autoResize, env, alias) {
10418
- _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);
10419
10414
  this.meta = meta;
10420
10415
  this.eventEmitter = eventEmitter;
10421
10416
  this.autoResize = autoResize;
10422
- this.link = new Link(VISA_SRC);
10417
+ this.link = new Link(MASTERCARD_SRC);
10423
10418
  this.link.setParams(_extends({
10424
10419
  service_id: service_id,
10425
10420
  public_key: public_key
@@ -10435,15 +10430,15 @@
10435
10430
  if (env) this.link.setEnv(env, alias);
10436
10431
  this.iFrameContainer = new Container(iframe_selector);
10437
10432
  this.iFrame = new IFrame(this.iFrameContainer);
10438
- this.buttonContainer = new Container(button_selector);
10439
10433
  this.iFrameEvent = new IFrameEvent(window);
10440
10434
  this.setupIFrameEvents();
10441
10435
  }
10442
- _createClass(VisaSRC, [{
10436
+ _createClass(MastercardSRC, [{
10443
10437
  key: "setupIFrameEvents",
10444
10438
  value: function setupIFrameEvents() {
10445
10439
  var _this = this;
10446
10440
  var widgetId = this.link.getParams().widget_id;
10441
+ if (!widgetId) return;
10447
10442
  this.iFrameEvent.on(EVENT$2.CHECKOUT_READY, widgetId, function (_ref) {
10448
10443
  var data = _ref.data;
10449
10444
  _this.eventEmitter.emit(EVENT$2.CHECKOUT_READY, data);
@@ -10452,8 +10447,16 @@
10452
10447
  var data = _ref2.data;
10453
10448
  _this.eventEmitter.emit(EVENT$2.CHECKOUT_COMPLETED, data);
10454
10449
  });
10455
- this.iFrameEvent.on(EVENT$2.CHECKOUT_ERROR, widgetId, function (_ref3) {
10450
+ this.iFrameEvent.on(EVENT$2.CHECKOUT_POPUP_OPEN, widgetId, function (_ref3) {
10456
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;
10457
10460
  _this.eventEmitter.emit(EVENT$2.CHECKOUT_ERROR, data);
10458
10461
  });
10459
10462
  if (this.autoResize) this.useAutoResize(true);
@@ -10462,55 +10465,19 @@
10462
10465
  key: "load",
10463
10466
  value: function load() {
10464
10467
  var _this2 = this;
10465
- var _a;
10466
- var container = document.createElement('div');
10467
- container.setAttribute('style', VisaSRCStyles.buttonContainerStyles);
10468
- var checkoutButton = document.createElement('button');
10469
- checkoutButton.setAttribute('style', VisaSRCStyles.buttonStyles);
10470
- if (this.meta.customizations.primary_color) checkoutButton.style.backgroundColor = this.meta.customizations.primary_color;
10471
- if (this.meta.customizations.button_text_color) checkoutButton.style.color = this.meta.customizations.button_text_color;
10472
- checkoutButton.innerHTML = 'Checkout';
10473
- var footerContainer = document.createElement('div');
10474
- footerContainer.setAttribute('style', VisaSRCStyles.footerContainerStyles);
10475
- var verticalLine = document.createElement('div');
10476
- verticalLine.setAttribute('style', VisaSRCStyles.verticalLineStyle);
10477
- var footerText = document.createElement('p');
10478
- footerText.setAttribute('style', VisaSRCStyles.footerTextStyles);
10479
- footerText.innerHTML = 'WE ACCEPT';
10480
- var clickToPayAllCards = document.createElement('img');
10481
- clickToPayAllCards.setAttribute('style', VisaSRCStyles.clickToPayAllCardsStyle);
10482
- clickToPayAllCards.src = this.link.getBaseUrl() + "".concat(GenerateCardSchemesLogo((_a = this.meta.customizations) === null || _a === void 0 ? void 0 : _a.card_schemes, true));
10483
- checkoutButton.onclick = function () {
10484
- _this2.eventEmitter.emit(EVENT$2.CHECKOUT_BUTTON_CLICKED, {});
10485
- _this2.iFrame.load(_this2.link.getUrl(), {
10486
- title: 'Visa SRC checkout'
10487
- });
10488
- _this2.iFrame.getElement().onload = function () {
10489
- return _this2.eventEmitter.emit(EVENT$2.IFRAME_LOADED, {});
10490
- };
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, {});
10491
10474
  };
10492
- container.appendChild(checkoutButton);
10493
- container.appendChild(footerContainer);
10494
- footerContainer.appendChild(footerText);
10495
- footerContainer.appendChild(clickToPayAllCards);
10496
- this.buttonContainer.getElement().appendChild(container);
10497
- this.eventEmitter.emit(EVENT$2.CHECKOUT_BUTTON_LOADED, {});
10498
10475
  }
10499
10476
  }, {
10500
10477
  key: "getEnv",
10501
10478
  value: function getEnv() {
10502
10479
  return this.link.getEnv();
10503
10480
  }
10504
- }, {
10505
- key: "hideButton",
10506
- value: function hideButton(_saveSize) {
10507
- if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'none';
10508
- }
10509
- }, {
10510
- key: "showButton",
10511
- value: function showButton() {
10512
- if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'block';
10513
- }
10514
10481
  }, {
10515
10482
  key: "hideCheckout",
10516
10483
  value: function hideCheckout(saveSize) {
@@ -10533,82 +10500,25 @@
10533
10500
  var _this3 = this;
10534
10501
  if (this.autoResize && !force) return;
10535
10502
  this.autoResize = true;
10536
- this.iFrameEvent.on('resize', this.link.getParams().widget_id, function (_ref4) {
10537
- var data = _ref4.data;
10538
- if (_this3.iFrame.getElement()) {
10539
- _this3.iFrame.getElement().scrolling = 'no';
10540
- 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');
10541
10512
  }
10542
10513
  });
10543
10514
  }
10544
10515
  }]);
10545
- return VisaSRC;
10516
+ return MastercardSRC;
10546
10517
  }();
10547
10518
 
10548
- /**
10549
- * Interface of data used for the Visa Checkout.
10550
- * @interface IVisaSRCMeta
10551
- *
10552
- * @type {object}
10553
- * @param {string} [srci_transaction_id] Used to identify the SRC Id.
10554
- * @param {object} [dpa_data] Object where the DPA creation data is stored.
10555
- * @param {string} [dpa_data.dpa_presentation_name] Name in which the DPA is presented in.
10556
- * @param {string} [dpa_data.dpa_uri] Used for indicating the DPA URI.
10557
- * @param {object} [dpa_transaction_options] Object that stores options for creating a trasaction with DPA.
10558
- * @param {string} [dpa_transaction_options.dpa_locale] DPA’s preferred locale, example en_US.
10559
- * @param {Array} [dpa_transaction_options.dpa_accepted_billing_countries] Used to indicate list of accepted billing countries for DPA.
10560
- * @param {Array} [dpa_transaction_options.dpa_accepted_shipping_countries] Used to indicate list of accepted shipping countries for DPA.
10561
- * @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'.
10562
- * @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'.
10563
- * @param {boolean} [dpa_transaction_options.consumer_name_requested] Used to check if the name of the consumer is needed.
10564
- * @param {boolean} [dpa_transaction_options.consumer_email_address_requested] Used to check if the email of the consumer is needed.
10565
- * @param {boolean} [dpa_transaction_options.consumer_phone_number_requested] Used to check if the phone number of the consumer is needed.
10566
- * @param {object} [dpa_transaction_options.payment_options] Object used to check the payment options that are included.
10567
- * @param {number} [dpa_transaction_options.payment_options.dpa_dynamic_data_ttl_minutes] The minimum requested validity period for the transaction credentials.
10568
- * @param {string} [dpa_transaction_options.payment_options.dynamic_data_type] Used for listing the enumeration for dynamic data types. Options are 'TAVV' and 'DTVV'.
10569
- * @param {boolean} [dpa_transaction_options.payment_options.dpa_pan_requested] Used to check if PAN number was requested.
10570
- * @param {string} [dpa_transaction_options.review_action] Used for listing the enumeration of review actions. Options are 'pay' and 'continue'.
10571
- * @param {string} [dpa_transaction_options.checkout_description] Used for indicating the description of the checkout.
10572
- * @param {string} [dpa_transaction_options.transaction_type] Used for listing the enumeration of the type of the transaction. 'PURCHASE', 'BILL_PAYMENT' and 'MONEY_TRANSFER'
10573
- * @param {string} [dpa_transaction_options.order_type] Used for listing the enumeration of the type of the order. Options are 'REAUTHORIZATION', 'RECURRING' and 'INSTALLMENT'.
10574
- * @param {object} [dpa_transaction_options.transaction_amount] Object used to describe the details of the transaction.
10575
- * @param {number} [dpa_transaction_options.transaction_amount.transaction_amount] Used to indicate the amount of the transaction.
10576
- * @param {string} [dpa_transaction_options.transaction_amount.transaction_currency_code] Used to indicate the currency code of the transaction. 3 letter ISO code format.
10577
- * @param {string} [dpa_transaction_options.merchant_order_id] Used to indicate the merchants order Id.
10578
- * @param {string} [dpa_transaction_options.merchant_category_code] Used to indicate the merchants category code.
10579
- * @param {string} [dpa_transaction_options.merchant_country_code] Used to indicate the merchants country code. 2 letter ISO code format.
10580
- * @param {object} [customer] Object where the customer data is stored to prefill in the checkout.
10581
- * @param {string} [customer.email] Customer email.
10582
- * @param {string} [customer.first_name] Customer first name.
10583
- * @param {string} [customer.last_name] Customer last name.
10584
- * @param {object} [customer.phone] Object where the customer phone is stored.
10585
- * @param {string} [customer.phone.country_code] Customer phone country code (example "1" for US).
10586
- * @param {string} [customer.phone.phone] Customer phone number.
10587
- * @param {object} [customer.payment_source] Object where the customer billing address data is stored.
10588
- * @param {string} [customer.payment_source.address_line1] Customer billing address line 1.
10589
- * @param {string} [customer.payment_source.address_line2] Customer billing address line 2.
10590
- * @param {string} [customer.payment_source.address_city] Customer billing address city.
10591
- * @param {string} [customer.payment_source.address_postcode] Customer billing address postcode.
10592
- * @param {string} [customer.payment_source.address_state] Customer billing address state code (if applicable for the country, example "FL" for Florida).
10593
- * @param {string} [customer.payment_source.address_country] Customer billing address country code (example "US").
10594
- */
10595
- /**
10596
- * Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC
10597
- * @constructor
10598
- *
10599
- * @param {string} button_selector - Selector of html element. Container for SRC checkout button.
10600
- * @param {string} iframe_selector - Selector of html element. Container for SRC checkout iFrame.
10601
- * @param {string} service_id - Card Scheme Service ID
10602
- * @param {string} public_key_or_access_token - Paydock public key or Access Token
10603
- * @param {IVisaSRCMeta} meta - Data that configures the SRC checkout
10604
- * @example
10605
- * var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
10606
- *
10607
- */
10608
10519
  var SRC = /*#__PURE__*/function () {
10609
- 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) {
10610
10521
  _classCallCheck(this, SRC);
10611
- this.button_selector = button_selector;
10612
10522
  this.iframe_selector = iframe_selector;
10613
10523
  this.service_id = service_id;
10614
10524
  this.public_key_or_access_token = public_key_or_access_token;
@@ -10623,11 +10533,13 @@
10623
10533
  *
10624
10534
  * @example
10625
10535
  * widget.setStyles({
10626
- * button_text_color: '#32a852',
10627
- * primary_color: '#32a852',
10628
- * font_family: 'sans-serif',
10629
- * card_schemes: ['visa']
10630
- * });
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
+ * });
10631
10543
  * @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
10632
10544
  */
10633
10545
  _createClass(SRC, [{
@@ -10642,10 +10554,6 @@
10642
10554
  value: function setStyle(param, value) {
10643
10555
  if (ObjectHelper.values(STYLE$2).indexOf(param) !== -1) this.style[param] = value;else console.warn("Widget::setStyle[s: unsupported style param ".concat(param));
10644
10556
  }
10645
- /**
10646
- * The final method after configuring the SRC to start the load process of SRC checkout
10647
- *
10648
- */
10649
10557
  }, {
10650
10558
  key: "load",
10651
10559
  value: function load() {
@@ -10655,8 +10563,8 @@
10655
10563
  var type = _ref.type;
10656
10564
  _this.meta.customizations = _this.style; // assign the style on the start of the widget
10657
10565
  switch (type) {
10658
- case CARD_SCHEME_SERVICE.VISA_SRC:
10659
- _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);
10660
10568
  break;
10661
10569
  }
10662
10570
  if (_this.provider) _this.provider.load();
@@ -10702,8 +10610,9 @@
10702
10610
  * SRC.on('checkoutCompleted').then(function (token) {
10703
10611
  * console.log(token);
10704
10612
  * });
10613
+ *
10705
10614
  * @param {string} eventName - Available event names [EVENT]{@link EVENT}
10706
- * @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}
10707
10616
  * @return {Promise<any> | void}
10708
10617
  */
10709
10618
  }, {
@@ -10717,29 +10626,6 @@
10717
10626
  });
10718
10627
  });
10719
10628
  }
10720
- /**
10721
- * Using this method you can hide button
10722
- * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
10723
- *
10724
- * @example
10725
- * SRC.hideButton();
10726
- */
10727
- }, {
10728
- key: "hideButton",
10729
- value: function hideButton(saveSize) {
10730
- if (this.provider && typeof this.provider.hideButton === 'function') this.provider.hideButton(saveSize);
10731
- }
10732
- /**
10733
- * Using this method you can show the SRC button after using hideButton method
10734
- *
10735
- * @example
10736
- * SRC.showButton();
10737
- */
10738
- }, {
10739
- key: "showButton",
10740
- value: function showButton() {
10741
- if (this.provider && typeof this.provider.showButton === 'function') this.provider.showButton();
10742
- }
10743
10629
  /**
10744
10630
  * Using this method you can hide checkout after load and button click
10745
10631
  * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
@@ -10791,6 +10677,50 @@
10791
10677
  return SRC;
10792
10678
  }();
10793
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
+
10794
10724
  exports.AfterpayCheckoutButton = AfterpayCheckoutButton;
10795
10725
  exports.Api = Api;
10796
10726
  exports.CHECKOUT_BUTTON_EVENT = CHECKOUT_BUTTON_EVENT;
@@ -10804,13 +10734,13 @@
10804
10734
  exports.HtmlMultiWidget = HtmlMultiWidget;
10805
10735
  exports.HtmlPaymentSourceWidget = HtmlPaymentSourceWidget;
10806
10736
  exports.HtmlWidget = HtmlWidget;
10737
+ exports.MastercardSRCClickToPay = MastercardSRCClickToPay;
10807
10738
  exports.MultiWidget = MultiWidget;
10808
10739
  exports.PAYMENT_TYPE = PAYMENT_TYPE;
10809
10740
  exports.PURPOSE = PURPOSE;
10810
10741
  exports.PaymentSourceBuilder = Builder$1;
10811
10742
  exports.PaymentSourceWidget = PaymentSourceWidget;
10812
10743
  exports.PaypalCheckoutButton = PaypalCheckoutButton;
10813
- exports.SRC = SRC;
10814
10744
  exports.STYLABLE_ELEMENT = STYLABLE_ELEMENT;
10815
10745
  exports.STYLABLE_ELEMENT_STATE = STYLABLE_ELEMENT_STATE;
10816
10746
  exports.STYLE = STYLE;