@paydock/client-sdk 1.80.13 → 1.83.31-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.
package/README.md CHANGED
@@ -2503,6 +2503,7 @@ Current constant include available type of fields which can be included to widge
2503
2503
  | EXPIRE_MONTH | <code>string</code> | <code>&quot;expire_month&quot;</code> |
2504
2504
  | EXPIRE_YEAR | <code>string</code> | <code>&quot;expire_year&quot;</code> |
2505
2505
  | CARD_CCV | <code>string</code> | <code>&quot;card_ccv&quot;</code> |
2506
+ | CARD_PIN | <code>string</code> | <code>&quot;card_pin&quot;</code> |
2506
2507
  | ACCOUNT_NAME | <code>string</code> | <code>&quot;account_name&quot;</code> |
2507
2508
  | ACCOUNT_BSB | <code>string</code> | <code>&quot;account_bsb&quot;</code> |
2508
2509
  | ACCOUNT_NUMBER | <code>string</code> | <code>&quot;account_number&quot;</code> |
@@ -456,6 +456,7 @@
456
456
  EXPIRE_MONTH: 'expire_month',
457
457
  EXPIRE_YEAR: 'expire_year',
458
458
  CARD_CCV: 'card_ccv',
459
+ CARD_PIN: 'card_pin',
459
460
  ACCOUNT_NAME: 'account_name',
460
461
  ACCOUNT_BSB: 'account_bsb',
461
462
  ACCOUNT_NUMBER: 'account_number',
@@ -553,6 +554,7 @@
553
554
  */
554
555
  var PAYMENT_TYPE = {
555
556
  CARD: 'card',
557
+ GIFT_CARD: 'gift_card',
556
558
  BANK_ACCOUNT: 'bank_account',
557
559
  CHECKOUT: 'checkout'
558
560
  };
@@ -600,7 +602,9 @@
600
602
  dynamic_fields_position: true,
601
603
  predefined_fields: {
602
604
  gateway_id: gatewayID,
603
- type: paymentType
605
+ type: paymentType,
606
+ gift_card_scheme: null,
607
+ processing_network: null
604
608
  }
605
609
  };
606
610
  }
@@ -776,6 +780,14 @@
776
780
  value: function getUrl() {
777
781
  return this.env.getConf().url + CONFIGURATION_LINK;
778
782
  }
783
+ }, {
784
+ key: 'setGiftCardSchemeData',
785
+ value: function setGiftCardSchemeData(giftCardScheme, processingNetwork) {
786
+ if (this.configs.predefined_fields.type !== PAYMENT_TYPE.GIFT_CARD) throw new Error('unsupported payment type');
787
+ if (!giftCardScheme || !processingNetwork) throw new Error('');
788
+ this.configs.predefined_fields.gift_card_scheme = giftCardScheme;
789
+ this.configs.predefined_fields.processing_network = processingNetwork;
790
+ }
779
791
  }], [{
780
792
  key: 'createEachToken',
781
793
  value: function createEachToken(accessToken, configs, cb) {
@@ -2388,6 +2400,11 @@
2388
2400
  value: function setMeta(meta) {
2389
2401
  this.configs[0].setMeta(meta);
2390
2402
  }
2403
+ }, {
2404
+ key: "setGiftCardScheme",
2405
+ value: function setGiftCardScheme(giftCardScheme, processingNetwork) {
2406
+ this.configs[0].setGiftCardSchemeData(giftCardScheme, processingNetwork);
2407
+ }
2391
2408
  }]);
2392
2409
  return HtmlWidget;
2393
2410
  }(HtmlMultiWidget);
@@ -4473,12 +4490,16 @@
4473
4490
  createClass(StorageDispatcher, [{
4474
4491
  key: 'create',
4475
4492
  value: function create() {
4493
+ var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4494
+
4495
+ if (this.dispatcherFrame && !reset) return this.dispatcherFrame;
4476
4496
  if (this.dispatcherFrame) this.destroy();
4477
4497
  var iFrame = document.createElement('iframe');
4478
4498
  iFrame.setAttribute('src', this.env.getConf().url + STORAGE_DISPATCHER_URI);
4479
4499
  iFrame.setAttribute('id', STORAGE_DISPATCHER_ID);
4480
4500
  iFrame.style.display = 'none';
4481
4501
  document.body.appendChild(iFrame);
4502
+ this.dispatcherFrame = iFrame;
4482
4503
  console.info(LOG_PREFIX$1 + ' initialized.');
4483
4504
  return iFrame;
4484
4505
  }
@@ -4505,7 +4526,7 @@
4505
4526
  key: 'setEnv',
4506
4527
  value: function setEnv(env, alias) {
4507
4528
  this.env.setEnv(env, alias);
4508
- this.dispatcherFrame = this.create();
4529
+ this.create(true);
4509
4530
  }
4510
4531
  }]);
4511
4532
  return StorageDispatcher;
@@ -4531,6 +4552,7 @@
4531
4552
  }, {
4532
4553
  key: 'next',
4533
4554
  value: function next(checkout, params) {
4555
+ this.storageDispatcher.create();
4534
4556
  var widgetSessionData = {
4535
4557
  merchant_redirect_url: this.getRedirectUrl(),
4536
4558
  checkout_token: checkout.token,
@@ -6831,14 +6853,27 @@
6831
6853
 
6832
6854
  function AfterPayWalletService(token, meta) {
6833
6855
  classCallCheck(this, AfterPayWalletService);
6834
- return possibleConstructorReturn(this, (AfterPayWalletService.__proto__ || Object.getPrototypeOf(AfterPayWalletService)).call(this, token, meta));
6856
+
6857
+ var _this = possibleConstructorReturn(this, (AfterPayWalletService.__proto__ || Object.getPrototypeOf(AfterPayWalletService)).call(this, token, meta));
6858
+
6859
+ _this.token = token;
6860
+ _this.storageDispatcher = new StorageDispatcher('afterpay.wallet.paydock');
6861
+ return _this;
6835
6862
  }
6836
6863
 
6837
6864
  createClass(AfterPayWalletService, [{
6838
6865
  key: 'load',
6839
6866
  value: function load(container) {
6867
+ this.storageDispatcher.create();
6840
6868
  this.mount(container);
6841
6869
  }
6870
+ }, {
6871
+ key: 'setEnv',
6872
+ value: function setEnv(env) {
6873
+ get(AfterPayWalletService.prototype.__proto__ || Object.getPrototypeOf(AfterPayWalletService.prototype), 'setEnv', this).call(this, env);
6874
+ this.storageDispatcher.setEnv(env);
6875
+ return this;
6876
+ }
6842
6877
  }, {
6843
6878
  key: 'mount',
6844
6879
  value: function mount(container) {
@@ -6860,6 +6895,7 @@
6860
6895
  value: function onAfterPayButtonClicked() {
6861
6896
  var _this3 = this;
6862
6897
 
6898
+ this.storageDispatcher.push({ intent: StorageDataIntent.WIDGET_SESSION, data: { token: this.token } });
6863
6899
  return new Promise(function () {
6864
6900
  var _a, _b;
6865
6901
  var afterpayJS = document.createElement('script');