@paydock/client-sdk 1.11.1-beta → 1.11.2-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 (53) hide show
  1. package/README.md +2 -478
  2. package/bundles/widget.umd.js +20 -432
  3. package/bundles/widget.umd.min.js +1 -1
  4. package/lib/api/api-internal.d.ts +0 -2
  5. package/lib/api/api-internal.js +0 -4
  6. package/lib/api/api-internal.js.map +1 -1
  7. package/lib/checkout-button/zipmoney.runner.d.ts +1 -0
  8. package/lib/checkout-button/zipmoney.runner.js +8 -0
  9. package/lib/checkout-button/zipmoney.runner.js.map +1 -1
  10. package/lib/components/iframe-event.d.ts +0 -3
  11. package/lib/components/iframe-event.js +0 -2
  12. package/lib/components/iframe-event.js.map +1 -1
  13. package/lib/components/link.d.ts +2 -4
  14. package/lib/components/link.js +0 -4
  15. package/lib/components/link.js.map +1 -1
  16. package/lib/components/param.d.ts +0 -6
  17. package/lib/components/param.js.map +1 -1
  18. package/lib/index.d.ts +0 -1
  19. package/lib/index.js +0 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib/wallet-buttons/google.wallet-service.js +2 -3
  22. package/lib/wallet-buttons/google.wallet-service.js.map +1 -1
  23. package/lib/wallet-buttons/mastercard.wallet-service.d.ts +1 -0
  24. package/lib/wallet-buttons/mastercard.wallet-service.js +4 -0
  25. package/lib/wallet-buttons/mastercard.wallet-service.js.map +1 -1
  26. package/lib/wallet-buttons/wallet-buttons.js +1 -1
  27. package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
  28. package/package.json +1 -1
  29. package/slate.md +3 -233
  30. package/lib/api/api-service-internal.d.ts +0 -17
  31. package/lib/api/api-service-internal.js +0 -18
  32. package/lib/api/api-service-internal.js.map +0 -1
  33. package/lib/secure-remote-commerce/index.d.ts +0 -1
  34. package/lib/secure-remote-commerce/index.js +0 -2
  35. package/lib/secure-remote-commerce/index.js.map +0 -1
  36. package/lib/secure-remote-commerce/interfaces.d.ts +0 -58
  37. package/lib/secure-remote-commerce/interfaces.js +0 -22
  38. package/lib/secure-remote-commerce/interfaces.js.map +0 -1
  39. package/lib/secure-remote-commerce/providers/src-provider.d.ts +0 -10
  40. package/lib/secure-remote-commerce/providers/src-provider.js +0 -1
  41. package/lib/secure-remote-commerce/providers/src-provider.js.map +0 -1
  42. package/lib/secure-remote-commerce/providers/visa-src/index.d.ts +0 -1
  43. package/lib/secure-remote-commerce/providers/visa-src/index.js +0 -2
  44. package/lib/secure-remote-commerce/providers/visa-src/index.js.map +0 -1
  45. package/lib/secure-remote-commerce/providers/visa-src/visa-src.d.ts +0 -27
  46. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +0 -100
  47. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +0 -1
  48. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +0 -8
  49. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +0 -10
  50. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map +0 -1
  51. package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +0 -148
  52. package/lib/secure-remote-commerce/secure-remote-commerce.js +0 -210
  53. package/lib/secure-remote-commerce/secure-remote-commerce.js.map +0 -1
@@ -343,7 +343,6 @@
343
343
  var SECURE_3D = '/3ds/webhook';
344
344
  var FLYPAY_LINK = '/wallet/flypay';
345
345
  var FLYPAY_LOGO_LINK = '/images/logo.png';
346
- var VISA_SRC = '/secure-remote-commerce/visa';
347
346
  var Link = function () {
348
347
  function Link(linkResource) {
349
348
  classCallCheck(this, Link);
@@ -399,11 +398,6 @@
399
398
  value: function getEnv() {
400
399
  return this.env.getEnv();
401
400
  }
402
- }, {
403
- key: "getBaseUrl",
404
- value: function getBaseUrl() {
405
- return this.env.getConf().url;
406
- }
407
401
  }]);
408
402
  return Link;
409
403
  }();
@@ -1591,9 +1585,7 @@
1591
1585
  VALIDATION_ERROR: 'validationError',
1592
1586
  SYSTEM_ERROR: 'systemError',
1593
1587
  CHECKOUT_SUCCESS: 'checkoutSuccess',
1594
- CHECKOUT_READY: 'checkoutReady',
1595
1588
  CHECKOUT_ERROR: 'checkoutError',
1596
- CHECKOUT_COMPLETED: 'checkoutCompleted',
1597
1589
  VALIDATION: 'validation',
1598
1590
  SELECT: 'select',
1599
1591
  UNSELECT: 'unselect',
@@ -4006,6 +3998,15 @@
4006
3998
  }
4007
3999
  });
4008
4000
  }
4001
+ }, {
4002
+ key: "stop",
4003
+ value: function stop() {
4004
+ get(ZipmoneyRunner.prototype.__proto__ || Object.getPrototypeOf(ZipmoneyRunner.prototype), "stop", this).call(this);
4005
+ this.runs = false;
4006
+ var element = document.querySelector('.zipmoney-overlay');
4007
+ if (element) element.remove();
4008
+ this.eventEmitter.emit(EVENT$1.CLOSE, {});
4009
+ }
4009
4010
  }, {
4010
4011
  key: "onStop",
4011
4012
  value: function onStop(cb) {
@@ -5999,7 +6000,7 @@
5999
6000
  googlePayJs.src = "https://pay.google.com/gp/p/js/pay.js";
6000
6001
  googlePayJs.async = true;
6001
6002
  googlePayJs.onload = function () {
6002
- var _a, _b, _c;
6003
+ var _a, _b, _c, _d;
6003
6004
  if (!window.google) {
6004
6005
  _this2.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, { wallet: WALLET_TYPE.GOOGLE });
6005
6006
  reject();
@@ -6015,7 +6016,7 @@
6015
6016
  onPaymentDataChanged: function onPaymentDataChanged(intermediatePaymentData) {
6016
6017
  return _this2.onPaymentDataChanged(intermediatePaymentData);
6017
6018
  }
6018
- }) }, _this2.env !== ENV.PROD ? { environment: "TEST" } : { environment: "PRODUCTION" }));
6019
+ }) }, ((_d = _this2.meta) === null || _d === void 0 ? void 0 : _d.gateway_mode) === 'live' ? { environment: "PRODUCTION" } : { environment: "TEST" }));
6019
6020
  _this2.checkAvailability().then(function (available) {
6020
6021
  if (!available) {
6021
6022
  _this2.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, { wallet: WALLET_TYPE.GOOGLE });
@@ -6225,6 +6226,14 @@
6225
6226
  value: function getGatewayName() {
6226
6227
  return WALLET_GATEWAY.MASTERCARD;
6227
6228
  }
6229
+ }, {
6230
+ key: "setEnv",
6231
+ value: function setEnv(env) {
6232
+ this.childWallets.forEach(function (child) {
6233
+ return child.setEnv(env);
6234
+ });
6235
+ return this;
6236
+ }
6228
6237
  }, {
6229
6238
  key: "update",
6230
6239
  value: function update(data) {
@@ -6392,28 +6401,6 @@
6392
6401
  return ApiChargeInternal;
6393
6402
  }();
6394
6403
 
6395
- var GET_CONFIG = '/v1/services/:service_id/config';
6396
- var ApiServiceInternal = function () {
6397
- function ApiServiceInternal(api) {
6398
- classCallCheck(this, ApiServiceInternal);
6399
-
6400
- this.api = api;
6401
- }
6402
-
6403
- createClass(ApiServiceInternal, [{
6404
- key: 'getConfig',
6405
- value: function getConfig(service_id) {
6406
- var url = GET_CONFIG.replace(':service_id', service_id);
6407
- return this.api.getClientPromise('GET', url).send(undefined);
6408
- }
6409
- }]);
6410
- return ApiServiceInternal;
6411
- }();
6412
- var CARD_SCHEME_SERVICE;
6413
- (function (CARD_SCHEME_SERVICE) {
6414
- CARD_SCHEME_SERVICE["VISA_SRC"] = "VisaSRC";
6415
- })(CARD_SCHEME_SERVICE || (CARD_SCHEME_SERVICE = {}));
6416
-
6417
6404
  var ApiInternal = function (_ApiBase) {
6418
6405
  inherits(ApiInternal, _ApiBase);
6419
6406
 
@@ -6427,11 +6414,6 @@
6427
6414
  value: function charge() {
6428
6415
  return new ApiChargeInternal(this);
6429
6416
  }
6430
- }, {
6431
- key: 'service',
6432
- value: function service() {
6433
- return new ApiServiceInternal(this);
6434
- }
6435
6417
  }]);
6436
6418
  return ApiInternal;
6437
6419
  }(ApiBase);
@@ -6538,7 +6520,7 @@
6538
6520
  this.service = new PaypalWalletService(tokenMeta.credentials.client_auth, _extends(_extends({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, capture: tokenMeta.charge.capture }));
6539
6521
  break;
6540
6522
  case WALLET_GATEWAY.MASTERCARD:
6541
- this.service = new MastercardWalletService('', _extends(_extends({}, meta), { credentials: tokenMeta.gateway.credentials, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency }));
6523
+ this.service = new MastercardWalletService('', _extends(_extends({}, meta), { credentials: tokenMeta.gateway.credentials, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, gateway_mode: tokenMeta.gateway.mode }));
6542
6524
  break;
6543
6525
  }
6544
6526
  }
@@ -7969,399 +7951,6 @@
7969
7951
  return VaultDisplayWidget;
7970
7952
  }();
7971
7953
 
7972
- var VisaSRCStyles = function VisaSRCStyles() {
7973
- classCallCheck(this, VisaSRCStyles);
7974
- };
7975
- VisaSRCStyles.buttonContainerStyles = "display: flex; flex-direction: column; justify-content: center; align-items: center;";
7976
- 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: 30px; cursor: pointer;";
7977
- VisaSRCStyles.footerContainerStyles = "display: flex; flex: 1; flex-wrap: wrap; justify-content: center;";
7978
- VisaSRCStyles.footerTextStyles = "text-align: center; color: #666666; margin: 0;";
7979
- VisaSRCStyles.verticalLineStyle = "display: inline-block; padding: 0.5px; background-color: #E5E5E5; height: 15px;";
7980
- VisaSRCStyles.clickToPayAllCardsStyle = "height: 21px; margin-left: 8px; vertical-align: middle;";
7981
-
7982
- /**
7983
- * List of available event's name in the SRC checkout lifecycle
7984
- * @enum EVENT
7985
- *
7986
- * @type {object}
7987
- * @param {string} CHECKOUT_BUTTON_LOADED=checkoutButtonLoaded
7988
- * @param {string} CHECKOUT_BUTTON_CLICKED=checkoutButtonClicked
7989
- * @param {string} IFRAME_LOADED=iframeLoaded
7990
- * @param {string} CHECKOUT_READY=checkoutReady
7991
- * @param {string} CHECKOUT_COMPLETED=checkoutCompleted
7992
- * @param {string} CHECKOUT_ERROR=checkoutError
7993
- */
7994
- var EVENT$3;
7995
- (function (EVENT) {
7996
- EVENT["CHECKOUT_BUTTON_LOADED"] = "checkoutButtonLoaded";
7997
- EVENT["CHECKOUT_BUTTON_CLICKED"] = "checkoutButtonClicked";
7998
- EVENT["IFRAME_LOADED"] = "iframeLoaded";
7999
- EVENT["CHECKOUT_READY"] = "checkoutReady";
8000
- EVENT["CHECKOUT_COMPLETED"] = "checkoutCompleted";
8001
- EVENT["CHECKOUT_ERROR"] = "checkoutError";
8002
- })(EVENT$3 || (EVENT$3 = {}));
8003
-
8004
- var VisaSRC = function () {
8005
- function VisaSRC(button_selector, iframe_selector, service_id, public_key, meta, eventEmitter, autoResize, env, alias) {
8006
- classCallCheck(this, VisaSRC);
8007
-
8008
- this.meta = meta;
8009
- this.eventEmitter = eventEmitter;
8010
- this.autoResize = autoResize;
8011
- this.link = new Link(VISA_SRC);
8012
- this.link.setParams(_extends({ service_id: service_id, public_key: public_key }, meta && { meta: JSON.stringify(meta) }));
8013
- if (env) this.link.setEnv(env, alias);
8014
- this.iFrameContainer = new Container(iframe_selector);
8015
- this.iFrame = new IFrame(this.iFrameContainer);
8016
- this.buttonContainer = new Container(button_selector);
8017
- this.iFrameEvent = new IFrameEvent(window);
8018
- this.setupIFrameEvents();
8019
- }
8020
-
8021
- createClass(VisaSRC, [{
8022
- key: 'setupIFrameEvents',
8023
- value: function setupIFrameEvents() {
8024
- var _this = this;
8025
-
8026
- var widgetId = this.link.getParams().widget_id;
8027
- this.iFrameEvent.on(EVENT$3.CHECKOUT_READY, widgetId, function (_ref) {
8028
- var data = _ref.data;
8029
-
8030
- _this.eventEmitter.emit(EVENT$3.CHECKOUT_READY, data);
8031
- });
8032
- this.iFrameEvent.on(EVENT$3.CHECKOUT_COMPLETED, widgetId, function (_ref2) {
8033
- var data = _ref2.data;
8034
-
8035
- _this.eventEmitter.emit(EVENT$3.CHECKOUT_COMPLETED, data);
8036
- });
8037
- this.iFrameEvent.on(EVENT$3.CHECKOUT_ERROR, widgetId, function (_ref3) {
8038
- var data = _ref3.data;
8039
-
8040
- _this.eventEmitter.emit(EVENT$3.CHECKOUT_ERROR, data);
8041
- });
8042
- if (this.autoResize) this.useAutoResize(true);
8043
- }
8044
- }, {
8045
- key: 'load',
8046
- value: function load() {
8047
- var _this2 = this;
8048
-
8049
- var container = document.createElement('div');
8050
- container.setAttribute('style', VisaSRCStyles.buttonContainerStyles);
8051
- var checkoutButton = document.createElement('button');
8052
- checkoutButton.setAttribute('style', VisaSRCStyles.buttonStyles);
8053
- checkoutButton.innerHTML = 'Checkout';
8054
- var footerContainer = document.createElement('div');
8055
- footerContainer.setAttribute('style', VisaSRCStyles.footerContainerStyles);
8056
- var verticalLine = document.createElement('div');
8057
- verticalLine.setAttribute('style', VisaSRCStyles.verticalLineStyle);
8058
- var footerText = document.createElement('p');
8059
- footerText.setAttribute('style', VisaSRCStyles.footerTextStyles);
8060
- footerText.innerHTML = 'WE ACCEPT';
8061
- var clickToPayAllCards = document.createElement('img');
8062
- clickToPayAllCards.setAttribute('style', VisaSRCStyles.clickToPayAllCardsStyle);
8063
- clickToPayAllCards.src = this.link.getBaseUrl() + '/images/visa-src/src-vmad.svg';
8064
- checkoutButton.onclick = function () {
8065
- _this2.eventEmitter.emit(EVENT$3.CHECKOUT_BUTTON_CLICKED, {});
8066
- _this2.iFrame.load(_this2.link.getUrl(), { title: 'Visa SRC checkout' });
8067
- _this2.iFrame.getElement().onload = function () {
8068
- return _this2.eventEmitter.emit(EVENT$3.IFRAME_LOADED, {});
8069
- };
8070
- };
8071
- container.appendChild(checkoutButton);
8072
- container.appendChild(footerContainer);
8073
- footerContainer.appendChild(footerText);
8074
- footerContainer.appendChild(clickToPayAllCards);
8075
- this.buttonContainer.getElement().appendChild(container);
8076
- this.eventEmitter.emit(EVENT$3.CHECKOUT_BUTTON_LOADED, {});
8077
- }
8078
- }, {
8079
- key: 'getEnv',
8080
- value: function getEnv() {
8081
- return this.link.getEnv();
8082
- }
8083
- }, {
8084
- key: 'hideButton',
8085
- value: function hideButton(_saveSize) {
8086
- if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'none';
8087
- }
8088
- }, {
8089
- key: 'showButton',
8090
- value: function showButton() {
8091
- if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'block';
8092
- }
8093
- }, {
8094
- key: 'hideCheckout',
8095
- value: function hideCheckout(saveSize) {
8096
- if (this.iFrame) this.iFrame.hide();
8097
- }
8098
- }, {
8099
- key: 'showCheckout',
8100
- value: function showCheckout() {
8101
- if (this.iFrame) this.iFrame.show();
8102
- }
8103
- }, {
8104
- key: 'reload',
8105
- value: function reload() {
8106
- this.iFrame.remove();
8107
- this.load();
8108
- }
8109
- }, {
8110
- key: 'useAutoResize',
8111
- value: function useAutoResize(force) {
8112
- var _this3 = this;
8113
-
8114
- if (this.autoResize && !force) return;
8115
- this.autoResize = true;
8116
- this.iFrameEvent.on('resize', this.link.getParams().widget_id, function (_ref4) {
8117
- var data = _ref4.data;
8118
-
8119
- if (_this3.iFrame.getElement()) {
8120
- _this3.iFrame.getElement().scrolling = 'no';
8121
- if (data.height) _this3.iFrame.setStyle('height', data.height + 'px');
8122
- }
8123
- });
8124
- }
8125
- }]);
8126
- return VisaSRC;
8127
- }();
8128
-
8129
- /**
8130
- * Interface of data used for the Visa Checkout.
8131
- * @interface IVisaSRCMeta
8132
- *
8133
- * @type {object}
8134
- * @param {string} [srci_transaction_id] Used to identify the SRC Id.
8135
- * @param {object} [dpa_data] Object where the DPA creation data is stored.
8136
- * @param {string} [dpa_data.dpa_presentation_name] Name in which the DPA is presented in.
8137
- * @param {string} [dpa_data.dpa_uri] Used for indicating the DPA URI.
8138
- * @param {object} [dpa_transaction_options] Object that stores options for creating a trasaction with DPA.
8139
- * @param {string} [dpa_transaction_options.dpa_locale] DPA’s preferred locale, example en_US.
8140
- * @param {Array} [dpa_transaction_options.dpa_accepted_billing_countries] Used to indicate list of accepted billing countries for DPA.
8141
- * @param {Array} [dpa_transaction_options.dpa_accepted_shipping_countries] Used to indicate list of accepted shipping countries for DPA.
8142
- * @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'.
8143
- * @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'.
8144
- * @param {boolean} [dpa_transaction_options.consumer_name_requested] Used to check if the name of the consumer is needed.
8145
- * @param {boolean} [dpa_transaction_options.consumer_email_address_requested] Used to check if the email of the consumer is needed.
8146
- * @param {boolean} [dpa_transaction_options.consumer_phone_number_requested] Used to check if the phone number of the consumer is needed.
8147
- * @param {object} [dpa_transaction_options.payment_options] Object used to check the payment options that are included.
8148
- * @param {number} [dpa_transaction_options.payment_options.dpa_dynamic_data_ttl_minutes] The minimum requested validity period for the transaction credentials.
8149
- * @param {string} [dpa_transaction_options.payment_options.dynamic_data_type] Used for listing the enumeration for dynamic data types. Options are 'TAVV' and 'DTVV'.
8150
- * @param {boolean} [dpa_transaction_options.payment_options.dpa_pan_requested] Used to check if PAN number was requested.
8151
- * @param {string} [dpa_transaction_options.review_action] Used for listing the enumeration of review actions. Options are 'pay' and 'continue'.
8152
- * @param {string} [dpa_transaction_options.checkout_description] Used for indicating the description of the checkout.
8153
- * @param {string} [dpa_transaction_options.transaction_type] Used for listing the enumeration of the type of the transaction. 'PURCHASE', 'BILL_PAYMENT' and 'MONEY_TRANSFER'
8154
- * @param {string} [dpa_transaction_options.order_type] Used for listing the enumeration of the type of the order. Options are 'REAUTHORIZATION', 'RECURRING' and 'INSTALLMENT'.
8155
- * @param {object} [dpa_transaction_options.transaction_amount] Object used to describe the details of the transaction.
8156
- * @param {number} [dpa_transaction_options.transaction_amount.transaction_amount] Used to indicate the amount of the transaction.
8157
- * @param {string} [dpa_transaction_options.transaction_amount.transaction_currency_code] Used to indicate the currency code of the transaction. 3 letter ISO code format.
8158
- * @param {string} [dpa_transaction_options.merchant_order_id] Used to indicate the merchants order Id.
8159
- * @param {string} [dpa_transaction_options.merchant_category_code] Used to indicate the merchants category code.
8160
- * @param {string} [dpa_transaction_options.merchant_country_code] Used to indicate the merchants country code. 2 letter ISO code format.
8161
- * @param {object} [customer] Object where the customer data is stored to prefill in the checkout.
8162
- * @param {string} [customer.email] Customer email.
8163
- * @param {string} [customer.first_name] Customer first name.
8164
- * @param {string} [customer.last_name] Customer last name.
8165
- * @param {object} [customer.phone] Object where the customer phone is stored.
8166
- * @param {string} [customer.phone.country_code] Customer phone country code (example "1" for US).
8167
- * @param {string} [customer.phone.phone] Customer phone number.
8168
- * @param {object} [customer.payment_source] Object where the customer billing address data is stored.
8169
- * @param {string} [customer.payment_source.address_line1] Customer billing address line 1.
8170
- * @param {string} [customer.payment_source.address_line2] Customer billing address line 2.
8171
- * @param {string} [customer.payment_source.address_city] Customer billing address city.
8172
- * @param {string} [customer.payment_source.address_postcode] Customer billing address postcode.
8173
- * @param {string} [customer.payment_source.address_state] Customer billing address state code (if applicable for the country, example "FL" for Florida).
8174
- * @param {string} [customer.payment_source.address_country] Customer billing address country code (example "US").
8175
- *
8176
- */
8177
- /**
8178
- * Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC
8179
- * @constructor
8180
- *
8181
- * @param {string} button_selector - Selector of html element. Container for SRC checkout button.
8182
- * @param {string} iframe_selector - Selector of html element. Container for SRC checkout iFrame.
8183
- * @param {string} service_id - Card Scheme Service ID
8184
- * @param {string} public_key - Paydock public key
8185
- * @param {IVisaSRCMeta} meta - Data that configures the SRC checkout
8186
- * @example
8187
- * var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
8188
- *
8189
- **/
8190
- var SRC = function () {
8191
- function SRC(button_selector, iframe_selector, service_id, public_key, meta) {
8192
- classCallCheck(this, SRC);
8193
-
8194
- this.button_selector = button_selector;
8195
- this.iframe_selector = iframe_selector;
8196
- this.service_id = service_id;
8197
- this.public_key = public_key;
8198
- this.meta = meta;
8199
- this.autoResize = false;
8200
- this.api = new ApiInternal(public_key, API_AUTH_TYPE.PUBLIC_KEY);
8201
- this.eventEmitter = new EventEmitter();
8202
- }
8203
- /**
8204
- * The final method after configuring the SRC to start the load process of SRC checkout
8205
- *
8206
- */
8207
-
8208
-
8209
- createClass(SRC, [{
8210
- key: 'load',
8211
- value: function load() {
8212
- var _this = this;
8213
-
8214
- if (this.provider) return;
8215
- this.api.service().getConfig(this.service_id).then(function (_ref) {
8216
- var type = _ref.type;
8217
-
8218
- switch (type) {
8219
- case CARD_SCHEME_SERVICE.VISA_SRC:
8220
- _this.provider = new VisaSRC(_this.button_selector, _this.iframe_selector, _this.service_id, _this.public_key, _this.meta, _this.eventEmitter, _this.autoResize, _this.env, _this.alias);
8221
- break;
8222
- }
8223
- if (_this.provider) _this.provider.load();
8224
- });
8225
- }
8226
- /**
8227
- * Current method can change environment. By default environment = sandbox.
8228
- * Also we can change domain alias for this environment. By default domain_alias = paydock.com
8229
- *
8230
- * @example
8231
- * SRC.setEnv('production');
8232
- * @param {string} env - sandbox, production
8233
- * @param {string} [alias] - Own domain alias
8234
- */
8235
-
8236
- }, {
8237
- key: 'setEnv',
8238
- value: function setEnv(env, alias) {
8239
- if (this.provider) return;
8240
- this.env = env;
8241
- this.alias = alias;
8242
- this.api.setEnv(env, alias);
8243
- }
8244
- /**
8245
- * Method to read the current environment
8246
- *
8247
- * @example
8248
- * SRC.getEnv();
8249
- */
8250
-
8251
- }, {
8252
- key: 'getEnv',
8253
- value: function getEnv() {
8254
- if (this.provider) return this.provider.getEnv();else return this.env;
8255
- }
8256
- /**
8257
- * Listen to events of SRC
8258
- *
8259
- * @example
8260
- *
8261
- * SRC.on('checkoutCompleted', function (token) {
8262
- * console.log(token);
8263
- * });
8264
- * // or
8265
- * SRC.on('checkoutCompleted').then(function (token) {
8266
- * console.log(token);
8267
- * });
8268
- * @param {string} eventName - Available event names [EVENT]{@link EVENT}
8269
- * @param {listener} [cb]
8270
- * @return {Promise<any> | void}
8271
- */
8272
-
8273
- }, {
8274
- key: 'on',
8275
- value: function on(eventName, cb) {
8276
- var _this2 = this;
8277
-
8278
- if (typeof cb === "function") return this.eventEmitter.subscribe(eventName, cb);
8279
- return new Promise(function (resolve) {
8280
- return _this2.eventEmitter.subscribe(eventName, function (res) {
8281
- return resolve(res);
8282
- });
8283
- });
8284
- }
8285
- /**
8286
- * Using this method you can hide button
8287
- * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
8288
- *
8289
- * @example
8290
- * SRC.hideButton();
8291
- */
8292
-
8293
- }, {
8294
- key: 'hideButton',
8295
- value: function hideButton(saveSize) {
8296
- if (this.provider && typeof this.provider.hideButton === 'function') this.provider.hideButton(saveSize);
8297
- }
8298
- /**
8299
- * Using this method you can show the SRC button after using hideButton method
8300
- *
8301
- * @example
8302
- * SRC.showButton();
8303
- */
8304
-
8305
- }, {
8306
- key: 'showButton',
8307
- value: function showButton() {
8308
- if (this.provider && typeof this.provider.showButton === 'function') this.provider.showButton();
8309
- }
8310
- /**
8311
- * Using this method you can hide checkout after load and button click
8312
- * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
8313
- *
8314
- * @example
8315
- * SRC.hideCheckout();
8316
- */
8317
-
8318
- }, {
8319
- key: 'hideCheckout',
8320
- value: function hideCheckout(saveSize) {
8321
- if (this.provider && typeof this.provider.hideCheckout === 'function') this.provider.hideCheckout(saveSize);
8322
- }
8323
- /**
8324
- * Using this method you can show checkout after using hideCheckout method
8325
- *
8326
- * @example
8327
- * SRC.showCheckout()
8328
- */
8329
-
8330
- }, {
8331
- key: 'showCheckout',
8332
- value: function showCheckout() {
8333
- if (this.provider && typeof this.provider.showCheckout === 'function') this.provider.showCheckout();
8334
- }
8335
- /**
8336
- * Using this method you can reload the whole checkout
8337
- *
8338
- * @example
8339
- * SRC.reload()
8340
- */
8341
-
8342
- }, {
8343
- key: 'reload',
8344
- value: function reload() {
8345
- if (this.provider) this.provider.reload();
8346
- }
8347
- /**
8348
- * Use this method for resize checkout iFrame according to content height, if applicable
8349
- *
8350
- * @example
8351
- * SRC.useAutoResize();
8352
- *
8353
- */
8354
-
8355
- }, {
8356
- key: 'useAutoResize',
8357
- value: function useAutoResize() {
8358
- this.autoResize = true;
8359
- if (this.provider && typeof this.provider.useAutoResize === 'function') this.provider.useAutoResize();
8360
- }
8361
- }]);
8362
- return SRC;
8363
- }();
8364
-
8365
7954
  exports.AfterpayCheckoutButton = AfterpayCheckoutButton;
8366
7955
  exports.Api = Api;
8367
7956
  exports.CHECKOUT_BUTTON_EVENT = CHECKOUT_BUTTON_EVENT;
@@ -8382,7 +7971,6 @@
8382
7971
  exports.PaymentSourceBuilder = Builder$1;
8383
7972
  exports.PaymentSourceWidget = PaymentSourceWidget;
8384
7973
  exports.PaypalCheckoutButton = PaypalCheckoutButton;
8385
- exports.SRC = SRC;
8386
7974
  exports.STYLABLE_ELEMENT = STYLABLE_ELEMENT;
8387
7975
  exports.STYLABLE_ELEMENT_STATE = STYLABLE_ELEMENT_STATE;
8388
7976
  exports.STYLE = STYLE;