@paydock/client-sdk 1.101.1 → 1.102.1-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 (59) hide show
  1. package/README.md +8 -2
  2. package/bundles/widget.umd.js +137 -71
  3. package/bundles/widget.umd.min.js +1 -1
  4. package/lib/canvas-3ds/canvas-3ds.d.ts +1 -1
  5. package/lib/canvas-3ds/canvas-3ds.js +1 -1
  6. package/lib/canvas-3ds/canvas-3ds.js.map +1 -1
  7. package/lib/checkout-button/afterpay/afterpay-checkout-button.d.ts +1 -1
  8. package/lib/checkout-button/afterpay/afterpay-checkout-button.js +1 -1
  9. package/lib/checkout-button/afterpay/afterpay-checkout-button.js.map +1 -1
  10. package/lib/checkout-button/checkout-button.d.ts +1 -1
  11. package/lib/checkout-button/checkout-button.js +1 -1
  12. package/lib/checkout-button/checkout-button.js.map +1 -1
  13. package/lib/checkout-button/paypal/paypal-checkout-button.d.ts +1 -1
  14. package/lib/checkout-button/paypal/paypal-checkout-button.js +1 -1
  15. package/lib/checkout-button/paypal/paypal-checkout-button.js.map +1 -1
  16. package/lib/checkout-button/zipmoney/zipmoney-checkout-button.d.ts +1 -1
  17. package/lib/checkout-button/zipmoney/zipmoney-checkout-button.js +1 -1
  18. package/lib/checkout-button/zipmoney/zipmoney-checkout-button.js.map +1 -1
  19. package/lib/components/background.d.ts +1 -1
  20. package/lib/components/background.js +4 -4
  21. package/lib/components/background.js.map +1 -1
  22. package/lib/components/param.d.ts +0 -4
  23. package/lib/components/param.js.map +1 -1
  24. package/lib/configs/sdk.js +1 -1
  25. package/lib/payment-source-widget/html-payment-source-widget.d.ts +1 -1
  26. package/lib/payment-source-widget/html-payment-source-widget.js +1 -1
  27. package/lib/payment-source-widget/html-payment-source-widget.js.map +1 -1
  28. package/lib/payment-source-widget/payment-source-widget.d.ts +1 -1
  29. package/lib/payment-source-widget/payment-source-widget.js +1 -1
  30. package/lib/payment-source-widget/payment-source-widget.js.map +1 -1
  31. package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +1 -1
  32. package/lib/secure-remote-commerce/secure-remote-commerce.js +1 -1
  33. package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -1
  34. package/lib/vault-display-widget/vault-display-widget.d.ts +1 -1
  35. package/lib/vault-display-widget/vault-display-widget.js +1 -1
  36. package/lib/vault-display-widget/vault-display-widget.js.map +1 -1
  37. package/lib/wallet-buttons/flypay-v2.wallet-service.js +92 -85
  38. package/lib/wallet-buttons/flypay-v2.wallet-service.js.map +1 -1
  39. package/lib/wallet-buttons/wallet-buttons.d.ts +23 -2
  40. package/lib/wallet-buttons/wallet-buttons.js +30 -2
  41. package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
  42. package/lib/wallet-buttons/wallet-service.d.ts +1 -0
  43. package/lib/wallet-buttons/wallet-service.js +1 -0
  44. package/lib/wallet-buttons/wallet-service.js.map +1 -1
  45. package/lib/widget/configuration.d.ts +3 -3
  46. package/lib/widget/configuration.js +5 -5
  47. package/lib/widget/configuration.js.map +1 -1
  48. package/lib/widget/html-multi-widget.d.ts +1 -1
  49. package/lib/widget/html-multi-widget.js +1 -1
  50. package/lib/widget/html-multi-widget.js.map +1 -1
  51. package/lib/widget/html-widget.d.ts +1 -1
  52. package/lib/widget/html-widget.js +1 -1
  53. package/lib/widget/html-widget.js.map +1 -1
  54. package/lib/widget/multi-widget.d.ts +1 -1
  55. package/lib/widget/multi-widget.js +1 -1
  56. package/lib/widget/multi-widget.js.map +1 -1
  57. package/package.json +2 -2
  58. package/slate.md +6 -2
  59. package/typings/globals/@auspayplus/open-payments-checkout/index.d.ts +2 -0
package/README.md CHANGED
@@ -2398,7 +2398,7 @@ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_l
2398
2398
 
2399
2399
  This example shows how to use these functions for **Flypay v2 Wallet**.
2400
2400
  _(Required `meta` fields: - . Optional `meta` fields: -)_
2401
- ### Full example
2401
+ ### Flypay V2 Full example
2402
2402
  ```html
2403
2403
  <!DOCTYPE html>
2404
2404
  <html lang="en">
@@ -2415,12 +2415,16 @@ _(Required `meta` fields: - . Optional `meta` fields: -)_
2415
2415
  let button = new paydock.WalletButtons(
2416
2416
  "#widget",
2417
2417
  charge_token,
2418
- {},
2418
+ {
2419
+ access_token: 'TOKEN',
2420
+ refresh_token: 'TOKEN',
2421
+ },
2419
2422
  );
2420
2423
  button.setEnv('sandbox');
2421
2424
  button.onUnavailable(() => console.log("No wallet buttons available"));
2422
2425
  button.onPaymentSuccessful((data) => console.log("The payment was successful"));
2423
2426
  button.onPaymentError((data) => console.log("The payment was not successful"));
2427
+ button.onAuthTokensChanged((data) => console.log('Authentication tokens changed'));
2424
2428
  button.load();
2425
2429
  </script>
2426
2430
  </html>
@@ -2677,6 +2681,8 @@ Interface of data used by the wallet checkout and payment proccess.
2677
2681
  | [request_payer_name] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
2678
2682
  | [request_payer_email] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
2679
2683
  | [request_payer_phone] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
2684
+ | [access_token] | <code>string</code> | Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets. |
2685
+ | [refresh_token] | <code>string</code> | Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets. |
2680
2686
  | [request_shipping] | <code>boolean</code> | 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]. |
2681
2687
  | [shipping_options] | [<code>Array.&lt;IApplePayShippingOption&gt;</code>](#IApplePayShippingOption) \| [<code>Array.&lt;IPayPalShippingOption&gt;</code>](#IPayPalShippingOption) | 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. |
2682
2688
  | [merchant_name] | <code>string</code> | Merchant Name used for GooglePay integration via MPGS. Required for [GooglePay]. N/A for other wallets. |
@@ -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.101.1';
687
+ SDK._version = 'v1.102.1-beta';
688
688
 
689
689
  var ENV = {
690
690
  SANDBOX: 'sandbox',
@@ -1182,7 +1182,7 @@
1182
1182
  * @param {string} [gatewayID=default] - gateway ID. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
1183
1183
  * @param {string} paymentType - Type of payment source which shows in widget form. Available parameters [PAYMENT_TYPE]{@link PAYMENT_TYPE}
1184
1184
  * @param {string} purpose - Param which describes payment purpose. By default uses Available parameters [PURPOSE]{@link PURPOSE}
1185
- **/
1185
+ */
1186
1186
  var Configuration = /*#__PURE__*/function () {
1187
1187
  function Configuration() {
1188
1188
  var gatewayID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
@@ -1199,8 +1199,8 @@
1199
1199
  predefined_fields: {
1200
1200
  gateway_id: gatewayID,
1201
1201
  type: paymentType,
1202
- gift_card_scheme: null,
1203
- processing_network: null
1202
+ card_scheme: null,
1203
+ card_processing_network: null
1204
1204
  }
1205
1205
  };
1206
1206
  }
@@ -1376,8 +1376,8 @@
1376
1376
  value: function setGiftCardSchemeData(giftCardScheme, processingNetwork) {
1377
1377
  if (this.configs.predefined_fields.type !== PAYMENT_TYPE.GIFT_CARD) throw new Error('unsupported payment type');
1378
1378
  if (!giftCardScheme || !processingNetwork) throw new Error('');
1379
- this.configs.predefined_fields.gift_card_scheme = giftCardScheme;
1380
- this.configs.predefined_fields.processing_network = processingNetwork;
1379
+ this.configs.predefined_fields.card_scheme = giftCardScheme;
1380
+ this.configs.predefined_fields.card_processing_network = processingNetwork;
1381
1381
  }
1382
1382
  }], [{
1383
1383
  key: "createEachToken",
@@ -1616,7 +1616,7 @@
1616
1616
  * Configuration('gatewayId'),
1617
1617
  * Configuration('gatewayId', 'bank_account')
1618
1618
  * ]);
1619
- **/
1619
+ */
1620
1620
  var MultiWidget = /*#__PURE__*/function () {
1621
1621
  function MultiWidget(accessToken, conf) {
1622
1622
  _classCallCheck(this, MultiWidget);
@@ -2513,7 +2513,7 @@
2513
2513
  * Configuration('gatewayId'),
2514
2514
  * Configuration('gatewayId', 'bank_account')
2515
2515
  * ]);
2516
- **/
2516
+ */
2517
2517
  var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
2518
2518
  _inherits(HtmlMultiWidget, _MultiWidget);
2519
2519
  var _super = _createSuper(HtmlMultiWidget);
@@ -2854,7 +2854,7 @@
2854
2854
  * @param {string} [gatewayID=default] - ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
2855
2855
  * @param {string} [paymentType=card] - Type of payment source which shows in widget form. Available parameters : “card”, “bank_account”.
2856
2856
  * @param {string} [purpose=payment_source] - Purpose of widget form. Available parameters: ‘payment_source’, ‘card_payment_source_with_cvv’, ‘card_payment_source_without_cvv’
2857
- **/
2857
+ */
2858
2858
  var HtmlWidget = /*#__PURE__*/function (_HtmlMultiWidget) {
2859
2859
  _inherits(HtmlWidget, _HtmlMultiWidget);
2860
2860
  var _super = _createSuper(HtmlWidget);
@@ -3337,13 +3337,13 @@
3337
3337
  FOCUS: 'focus'
3338
3338
  };
3339
3339
  var TEMPLATE$1 = "\n <div class=\"checkout-container\">\n <strong class=\"checkout-title\" data-title>{{title}}</strong>\n <p data-description>{{description}}</p>\n <a href=\"#\" data-continue>Continue</a>\n <a href=\"#\" data-close>Close</a>\n </div>\n";
3340
- var STYLES = "\n .hide-continue-button [data-continue] {\n display: none;\n }\n \n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay { \n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display { \n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n";
3340
+ var STYLES = "\n .hide-continue-button [data-continue] {\n display: none;\n }\n\n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display {\n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n";
3341
3341
  /**
3342
3342
  * Class Background create overlay for checkout
3343
3343
  *
3344
3344
  * @example
3345
3345
  * var overlay = new Background();
3346
- **/
3346
+ */
3347
3347
  var Background = /*#__PURE__*/function () {
3348
3348
  function Background() {
3349
3349
  _classCallCheck(this, Background);
@@ -6016,7 +6016,7 @@
6016
6016
  * @param {string} [type=PaypalClassic] - Type of gateway (PaypalClassic, Zipmoney)
6017
6017
  * @example
6018
6018
  * var widget = new CheckoutButton('#button', 'accessToken','gatewayId');
6019
- **/
6019
+ */
6020
6020
  var CheckoutButton = /*#__PURE__*/function () {
6021
6021
  function CheckoutButton(selector, accessToken) {
6022
6022
  var gatewayId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'default';
@@ -6294,7 +6294,7 @@
6294
6294
  * @param {string} [gatewayId=default] - Checkout mode, it could be set to 'contextual' or 'redirect'. By default it 'contextual'
6295
6295
  * @example
6296
6296
  * var widget = new ZipmoneyCheckoutButton('#button', 'publicKey','gatewayId');
6297
- **/
6297
+ */
6298
6298
  var ZipmoneyCheckoutButton = /*#__PURE__*/function (_CheckoutButton) {
6299
6299
  _inherits(ZipmoneyCheckoutButton, _CheckoutButton);
6300
6300
  var _super = _createSuper(ZipmoneyCheckoutButton);
@@ -6369,7 +6369,7 @@
6369
6369
  * @param {string} [gatewayId=default] - PayDock's gatewayId. By default or if put 'default', it will use the selected default gateway
6370
6370
  * @example
6371
6371
  * var widget = new AfterpayCheckoutButton('#button', 'access-token','gatewayId');
6372
- **/
6372
+ */
6373
6373
  var AfterpayCheckoutButton = /*#__PURE__*/function (_CheckoutButton) {
6374
6374
  _inherits(AfterpayCheckoutButton, _CheckoutButton);
6375
6375
  var _super = _createSuper(AfterpayCheckoutButton);
@@ -6426,7 +6426,7 @@
6426
6426
  * @param {string} [gatewayId=default] - PayDock's gatewayId. By default or if put 'default', it will use the selected default gateway
6427
6427
  * @example
6428
6428
  * var widget = new PaypalCheckoutButton('#button', 'publicKey','gatewayId');
6429
- **/
6429
+ */
6430
6430
  var PaypalCheckoutButton = /*#__PURE__*/function (_CheckoutButton) {
6431
6431
  _inherits(PaypalCheckoutButton, _CheckoutButton);
6432
6432
  var _super = _createSuper(PaypalCheckoutButton);
@@ -6575,7 +6575,8 @@
6575
6575
  PAYMENT_SUCCESS: 'payment_success',
6576
6576
  PAYMENT_IN_REVIEW: 'payment_in_review',
6577
6577
  PAYMENT_ERROR: 'payment_error',
6578
- CALLBACK: 'callback'
6578
+ CALLBACK: 'callback',
6579
+ AUTH_TOKENS_CHANGED: 'auth_tokens_changed'
6579
6580
  };
6580
6581
  var WalletService = /*#__PURE__*/function () {
6581
6582
  function WalletService(publicKey, meta) {
@@ -8364,14 +8365,16 @@
8364
8365
  return [].concat(_toConsumableArray(str), ["".concat(key).concat(separator).concat(value)]);
8365
8366
  }, []).join(",") : "";
8366
8367
  }
8368
+
8369
+ // src/checkout.ts
8367
8370
  var Checkout = /*#__PURE__*/function () {
8368
8371
  function Checkout(_ref3) {
8369
8372
  var _this = this,
8370
8373
  _this$callback;
8371
- var url = _ref3.url,
8372
- accessToken = _ref3.accessToken,
8373
- refreshToken = _ref3.refreshToken,
8374
+ var auth = _ref3.auth,
8375
+ url = _ref3.url,
8374
8376
  clientId = _ref3.clientId,
8377
+ mode = _ref3.mode,
8375
8378
  orderId = _ref3.orderId,
8376
8379
  onCheckoutClosed = _ref3.onCheckoutClosed,
8377
8380
  onError = _ref3.onError,
@@ -8386,6 +8389,7 @@
8386
8389
  _defineProperty(this, "DEFAULT_FEATURES", {
8387
8390
  resizable: "no"
8388
8391
  });
8392
+ _defineProperty(this, "auth", void 0);
8389
8393
  _defineProperty(this, "callback", void 0);
8390
8394
  _defineProperty(this, "error", void 0);
8391
8395
  _defineProperty(this, "frame", void 0);
@@ -8397,7 +8401,8 @@
8397
8401
  _defineProperty(this, "refreshToken", void 0);
8398
8402
  _defineProperty(this, "clientId", void 0);
8399
8403
  _defineProperty(this, "onCheckoutClosed", void 0);
8400
- _defineProperty(this, "onTokensChanged", void 0);
8404
+ _defineProperty(this, "rootUrl", void 0);
8405
+ _defineProperty(this, "targetOrigin", void 0);
8401
8406
  _defineProperty(this, "title", void 0);
8402
8407
  _defineProperty(this, "windowFeatures", void 0);
8403
8408
  _defineProperty(this, "windowObserver", void 0);
@@ -8421,7 +8426,13 @@
8421
8426
  window.addEventListener("message", _this.onMessage, false);
8422
8427
  }
8423
8428
  });
8424
- var merchantURL = encodeURIComponent(window.location.href.replace(/\/$/, ""));
8429
+ _defineProperty(this, "postMessage", function () {
8430
+ if (!!_this.frame && !!_this.rootUrl) {
8431
+ _this.frame.postMessage({
8432
+ auth: _objectSpread2({}, _this.auth)
8433
+ }, _this.rootUrl);
8434
+ }
8435
+ });
8425
8436
  this.callback = (_this$callback = {}, _defineProperty(_this$callback, "ERROR" /* ERROR */, function ERROR(_ref4) {
8426
8437
  var error = _ref4.error,
8427
8438
  orderId2 = _ref4.orderId;
@@ -8442,13 +8453,14 @@
8442
8453
  orderId: orderId2
8443
8454
  });
8444
8455
  }), _defineProperty(_this$callback, "TOKENS_CHANGED" /* TOKENS_CHANGED */, function TOKENS_CHANGED(_ref7) {
8445
- var accessToken2 = _ref7.accessToken,
8446
- refreshToken2 = _ref7.refreshToken;
8456
+ var accessToken = _ref7.accessToken,
8457
+ refreshToken = _ref7.refreshToken;
8447
8458
  onTokensChanged === null || onTokensChanged === void 0 || onTokensChanged({
8448
- accessToken: accessToken2,
8449
- refreshToken: refreshToken2
8459
+ accessToken: accessToken,
8460
+ refreshToken: refreshToken
8450
8461
  });
8451
8462
  }), _this$callback);
8463
+ this.auth = auth;
8452
8464
  this.isCheckoutOpen = false;
8453
8465
  this.error = void 0;
8454
8466
  this.frame = void 0;
@@ -8456,6 +8468,9 @@
8456
8468
  var data = e.data,
8457
8469
  origin = e.origin;
8458
8470
  if (origin === url) {
8471
+ if ((data === null || data === void 0 ? void 0 : data.isDomReady) === true) {
8472
+ _this.postMessage();
8473
+ }
8459
8474
  if (data !== null && data !== void 0 && data.isPaymentSuccessful) {
8460
8475
  _this.callback["PAYMENT_SUCCESS" /* PAYMENT_SUCCESS */]({
8461
8476
  orderId: data.orderId
@@ -8481,13 +8496,13 @@
8481
8496
  }
8482
8497
  }
8483
8498
  };
8484
- this.url = "".concat(url, "?orderId=").concat(orderId, "&merchant=").concat(merchantURL);
8499
+ var checkoutMode = mode || "default" /* DEFAULT */;
8500
+ this.rootUrl = url;
8501
+ this.targetOrigin = window.location.href.replace(/\/$/, "");
8502
+ this.url = "".concat(url, "?orderId=").concat(orderId, "&merchantUrl=").concat(encodeURIComponent(this.targetOrigin), "&mode=").concat(checkoutMode);
8485
8503
  this.orderId = orderId;
8486
- this.accessToken = accessToken;
8487
- this.refreshToken = refreshToken;
8488
8504
  this.clientId = clientId;
8489
8505
  this.onCheckoutClosed = onCheckoutClosed;
8490
- this.onTokensChanged = onTokensChanged;
8491
8506
  this.title = title;
8492
8507
  this.windowFeatures = windowFeatures;
8493
8508
  this.windowObserver = void 0;
@@ -8587,36 +8602,37 @@
8587
8602
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8588
8603
  while (1) switch (_context.prev = _context.next) {
8589
8604
  case 0:
8590
- loadingOverlay = document.getElementById("loading-overlay");
8591
- button = document.getElementById("flypay-v2-button");
8605
+ loadingOverlay = document.getElementById('loading-overlay');
8606
+ button = document.getElementById('flypay-v2-button');
8592
8607
  if (button) button.disabled = true;
8593
8608
  _context.prev = 3;
8594
8609
  if (this.orderId) {
8595
8610
  _context.next = 9;
8596
8611
  break;
8597
8612
  }
8598
- if (loadingOverlay) loadingOverlay.style.display = "flex";
8613
+ if (loadingOverlay) loadingOverlay.style.display = 'flex';
8599
8614
  _context.next = 8;
8600
8615
  return this.getOrderId();
8601
8616
  case 8:
8602
8617
  this.orderId = _context.sent;
8603
8618
  case 9:
8604
- if (loadingOverlay) loadingOverlay.style.display = "none";
8619
+ if (loadingOverlay) loadingOverlay.style.display = 'none';
8605
8620
  if (this.orderId) {
8606
8621
  this.flypayV2Checkout(this.orderId);
8607
8622
  } else {
8608
8623
  this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE);
8609
8624
  }
8610
- _context.next = 17;
8625
+ _context.next = 18;
8611
8626
  break;
8612
8627
  case 13:
8613
8628
  _context.prev = 13;
8614
8629
  _context.t0 = _context["catch"](3);
8615
- if (loadingOverlay) loadingOverlay.style.display = "none";
8630
+ if (loadingOverlay) loadingOverlay.style.display = 'none';
8631
+ if (button) button.disabled = false;
8616
8632
  this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, {
8617
8633
  err: _context.t0
8618
8634
  });
8619
- case 17:
8635
+ case 18:
8620
8636
  case "end":
8621
8637
  return _context.stop();
8622
8638
  }
@@ -8662,7 +8678,7 @@
8662
8678
  }, {
8663
8679
  key: "createButtonStyle",
8664
8680
  value: function createButtonStyle() {
8665
- return "\n #widget {\n position: relative;\n }\n\n #loading-overlay {\n position: absolute;\n width: 268px;\n height: 74px;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n }\n\n #loading-overlay::after {\n content: \"\";\n display: inline-block;\n width: 40px;\n height: 40px;\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 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-image {\n display: block; /* Display the image as block to remove any gaps */\n border: none; /* Ensure the image doesn't have a border */\n width: 100%; /* Make the image take full width of the container */\n }\n ";
8681
+ 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";
8666
8682
  }
8667
8683
  }, {
8668
8684
  key: "getOrderId",
@@ -8671,7 +8687,7 @@
8671
8687
  return new Promise(function (resolve, reject) {
8672
8688
  return _this2.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
8673
8689
  data: {
8674
- request_type: "CREATE_SESSION"
8690
+ request_type: 'CREATE_SESSION'
8675
8691
  },
8676
8692
  onSuccess: function onSuccess(res) {
8677
8693
  return resolve(res.id);
@@ -8686,17 +8702,21 @@
8686
8702
  key: "flypayV2Checkout",
8687
8703
  value: function flypayV2Checkout(orderId) {
8688
8704
  var _this3 = this;
8689
- this.checkout = new Checkout(_extends(_extends(_extends({
8705
+ var _a, _b;
8706
+ this.checkout = new Checkout(_extends(_extends({
8690
8707
  orderId: orderId
8691
- }, this.accessToken && {
8692
- accessToken: this.accessToken
8693
- }), this.refreshToken && {
8694
- refreshToken: this.refreshToken
8708
+ }, (this.accessToken || this.refreshToken) && {
8709
+ auth: _extends(_extends({}, this.accessToken && {
8710
+ access_token: this.accessToken
8711
+ }), this.refreshToken && {
8712
+ refresh_token: this.refreshToken
8713
+ }),
8714
+ mode: "express"
8695
8715
  }), {
8696
- clientId: '633727af-5bd2-4733-8e08-04074a98300d',
8697
- url: 'https://checkout.release.cxbflypay.com.au',
8716
+ clientId: ((_a = this.meta) === null || _a === void 0 ? void 0 : _a.gateway_mode) === 'live' ? 'dbbd114e-3583-4db5-915e-59f1b3dcd08b' : '924ac1ce-00f4-44e4-8277-06cae751ef1a',
8717
+ 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',
8698
8718
  onCheckoutClosed: function onCheckoutClosed() {
8699
- var button = document.getElementById("flypay-v2-button");
8719
+ var button = document.getElementById('flypay-v2-button');
8700
8720
  if (button) button.disabled = false;
8701
8721
  },
8702
8722
  onError: function onError(err) {
@@ -8717,6 +8737,10 @@
8717
8737
  refreshToken = _ref.refreshToken;
8718
8738
  _this3.accessToken = accessToken;
8719
8739
  _this3.refreshToken = refreshToken;
8740
+ _this3.eventEmitter.emit(WALLET_EVENT.AUTH_TOKENS_CHANGED, {
8741
+ accessToken: accessToken,
8742
+ refreshToken: refreshToken
8743
+ });
8720
8744
  }
8721
8745
  }));
8722
8746
  this.checkout.open();
@@ -8741,7 +8765,8 @@
8741
8765
  UPDATE: "update",
8742
8766
  PAYMENT_SUCCESSFUL: "paymentSuccessful",
8743
8767
  PAYMENT_ERROR: "paymentError",
8744
- PAYMENT_IN_REVIEW: "paymentInReview"
8768
+ PAYMENT_IN_REVIEW: "paymentInReview",
8769
+ AUTH_TOKENS_CHANGED: "authTokensChanged"
8745
8770
  };
8746
8771
  /**
8747
8772
  * Interface of data used by the wallet checkout and payment proccess.
@@ -8756,6 +8781,8 @@
8756
8781
  * @param {boolean} [request_payer_name] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
8757
8782
  * @param {boolean} [request_payer_email] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
8758
8783
  * @param {boolean} [request_payer_phone] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
8784
+ * @param {string} [access_token] Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets.
8785
+ * @param {string} [refresh_token] Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets.
8759
8786
  * @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].
8760
8787
  * @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.
8761
8788
  * @param {string} [merchant_name] Merchant Name used for GooglePay integration via MPGS. Required for [GooglePay]. N/A for other wallets.
@@ -8810,8 +8837,8 @@
8810
8837
  *
8811
8838
  * @param {string} selector - Selector of html element. Container for the WalletButtons.
8812
8839
  * @param {string} chargeToken - token for the wallet transaction, created with a secure call to `POST charges/wallet`.
8813
- * @param {IWalletMeta} object - data that configures the E-Wallet, which can be shown on checkout page and configures required customer information.
8814
- **/
8840
+ * @param {IWalletMeta} meta - data that configures the E-Wallet, which can be shown on checkout page and configures required customer information.
8841
+ */
8815
8842
  var WalletButtons = /*#__PURE__*/function () {
8816
8843
  function WalletButtons(selector, chargeToken, meta) {
8817
8844
  _classCallCheck(this, WalletButtons);
@@ -9151,6 +9178,33 @@
9151
9178
  });
9152
9179
  });
9153
9180
  }
9181
+ /**
9182
+ * Registers a callback function to be invoked when authentication tokens are changed.
9183
+ * This function allows you to respond to changes in authentication tokens, such as when a user logs in.
9184
+ *
9185
+ * @example
9186
+ * button.onAuthTokensChanged((eventData) => {
9187
+ * console.log('Authentication tokens changed:', eventData);
9188
+ * });
9189
+ *
9190
+ * @example
9191
+ * button.onAuthTokensChanged().then((eventData) => {
9192
+ * console.log('Authentication tokens changed:', eventData);
9193
+ * });
9194
+ *
9195
+ * @param {listener} [handler] - Function to be called when authentication tokens are changed.
9196
+ */
9197
+ }, {
9198
+ key: "onAuthTokensChanged",
9199
+ value: function onAuthTokensChanged(handler) {
9200
+ var _this7 = this;
9201
+ if (typeof handler === 'function') return this.eventEmitter.subscribe(EVENT$1.AUTH_TOKENS_CHANGED, handler);
9202
+ return new Promise(function (resolve) {
9203
+ return _this7.eventEmitter.subscribe(EVENT$1.AUTH_TOKENS_CHANGED, function (err) {
9204
+ return resolve(err);
9205
+ });
9206
+ });
9207
+ }
9154
9208
  }, {
9155
9209
  key: "setupServiceCallbacks",
9156
9210
  value: function setupServiceCallbacks() {
@@ -9161,13 +9215,14 @@
9161
9215
  this.setupPaymentSuccessCallback();
9162
9216
  this.setupPaymentInReviewCallback();
9163
9217
  this.setupPaymentErrorCallback();
9218
+ this.setupAuthTokensChangedCallback();
9164
9219
  }
9165
9220
  }, {
9166
9221
  key: "setupUnavailableCallback",
9167
9222
  value: function setupUnavailableCallback() {
9168
- var _this7 = this;
9223
+ var _this8 = this;
9169
9224
  this.service.on(WALLET_EVENT.UNAVAILABLE, function (eventData) {
9170
- return _this7.eventEmitter.emit(EVENT$1.UNAVAILABLE, {
9225
+ return _this8.eventEmitter.emit(EVENT$1.UNAVAILABLE, {
9171
9226
  event: EVENT$1.UNAVAILABLE,
9172
9227
  data: eventData
9173
9228
  });
@@ -9176,12 +9231,12 @@
9176
9231
  }, {
9177
9232
  key: "setupUpdateCallback",
9178
9233
  value: function setupUpdateCallback() {
9179
- var _this8 = this;
9234
+ var _this9 = this;
9180
9235
  this.service.on(WALLET_EVENT.UPDATE, function (eventData) {
9181
- return _this8.hasUpdateHandler ? _this8.eventEmitter.emit(EVENT$1.UPDATE, {
9236
+ return _this9.hasUpdateHandler ? _this9.eventEmitter.emit(EVENT$1.UPDATE, {
9182
9237
  event: EVENT$1.UPDATE,
9183
9238
  data: eventData
9184
- }) : _this8.update({
9239
+ }) : _this9.update({
9185
9240
  success: true
9186
9241
  });
9187
9242
  });
@@ -9189,12 +9244,12 @@
9189
9244
  }, {
9190
9245
  key: "setupWalletCallback",
9191
9246
  value: function setupWalletCallback() {
9192
- var _this9 = this;
9247
+ var _this10 = this;
9193
9248
  this.service.on(WALLET_EVENT.CALLBACK, function (eventData) {
9194
9249
  var data = eventData.data,
9195
9250
  onSuccess = eventData.onSuccess,
9196
9251
  onError = eventData.onError;
9197
- _this9.api.charge().walletCallback(data).then(function (res) {
9252
+ _this10.api.charge().walletCallback(data).then(function (res) {
9198
9253
  return onSuccess(res);
9199
9254
  }, function (err) {
9200
9255
  return onError(err.message);
@@ -9204,15 +9259,15 @@
9204
9259
  }, {
9205
9260
  key: "setupPaymentCallback",
9206
9261
  value: function setupPaymentCallback() {
9207
- var _this10 = this;
9262
+ var _this11 = this;
9208
9263
  this.service.on(WALLET_EVENT.PAYMENT_METHOD_SELECTED, function (eventData) {
9209
9264
  var data = eventData.data,
9210
9265
  onSuccess = eventData.onSuccess,
9211
9266
  onError = eventData.onError;
9212
- _this10.api.charge().walletCapture(data).then(function (captureResult) {
9267
+ _this11.api.charge().walletCapture(data).then(function (captureResult) {
9213
9268
  if (typeof onSuccess === 'function') onSuccess();
9214
9269
  var event = captureResult.status === 'inreview' ? EVENT$1.PAYMENT_IN_REVIEW : EVENT$1.PAYMENT_SUCCESSFUL;
9215
- _this10.eventEmitter.emit(event, {
9270
+ _this11.eventEmitter.emit(event, {
9216
9271
  event: event,
9217
9272
  data: _extends(_extends({}, captureResult), data.customer && {
9218
9273
  payer_name: data.customer.payer_name,
@@ -9222,7 +9277,7 @@
9222
9277
  });
9223
9278
  }, function (err) {
9224
9279
  if (typeof onError === 'function') onError(err);
9225
- _this10.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9280
+ _this11.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9226
9281
  event: EVENT$1.PAYMENT_ERROR,
9227
9282
  data: err
9228
9283
  });
@@ -9232,9 +9287,9 @@
9232
9287
  }, {
9233
9288
  key: "setupPaymentSuccessCallback",
9234
9289
  value: function setupPaymentSuccessCallback() {
9235
- var _this11 = this;
9290
+ var _this12 = this;
9236
9291
  this.service.on(WALLET_EVENT.PAYMENT_SUCCESS, function (eventData) {
9237
- return _this11.eventEmitter.emit(EVENT$1.PAYMENT_SUCCESSFUL, {
9292
+ return _this12.eventEmitter.emit(EVENT$1.PAYMENT_SUCCESSFUL, {
9238
9293
  event: EVENT$1.PAYMENT_SUCCESSFUL,
9239
9294
  data: eventData
9240
9295
  });
@@ -9243,9 +9298,9 @@
9243
9298
  }, {
9244
9299
  key: "setupPaymentInReviewCallback",
9245
9300
  value: function setupPaymentInReviewCallback() {
9246
- var _this12 = this;
9301
+ var _this13 = this;
9247
9302
  this.service.on(WALLET_EVENT.PAYMENT_IN_REVIEW, function (eventData) {
9248
- return _this12.eventEmitter.emit(EVENT$1.PAYMENT_IN_REVIEW, {
9303
+ return _this13.eventEmitter.emit(EVENT$1.PAYMENT_IN_REVIEW, {
9249
9304
  event: EVENT$1.PAYMENT_IN_REVIEW,
9250
9305
  data: eventData
9251
9306
  });
@@ -9254,14 +9309,25 @@
9254
9309
  }, {
9255
9310
  key: "setupPaymentErrorCallback",
9256
9311
  value: function setupPaymentErrorCallback() {
9257
- var _this13 = this;
9312
+ var _this14 = this;
9258
9313
  this.service.on(WALLET_EVENT.PAYMENT_ERROR, function (eventData) {
9259
- return _this13.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9314
+ return _this14.eventEmitter.emit(EVENT$1.PAYMENT_ERROR, {
9260
9315
  event: EVENT$1.PAYMENT_ERROR,
9261
9316
  data: eventData
9262
9317
  });
9263
9318
  });
9264
9319
  }
9320
+ }, {
9321
+ key: "setupAuthTokensChangedCallback",
9322
+ value: function setupAuthTokensChangedCallback() {
9323
+ var _this15 = this;
9324
+ this.service.on(WALLET_EVENT.AUTH_TOKENS_CHANGED, function (eventData) {
9325
+ return _this15.eventEmitter.emit(EVENT$1.AUTH_TOKENS_CHANGED, {
9326
+ event: EVENT$1.AUTH_TOKENS_CHANGED,
9327
+ data: eventData
9328
+ });
9329
+ });
9330
+ }
9265
9331
  }]);
9266
9332
  return WalletButtons;
9267
9333
  }();
@@ -9279,7 +9345,7 @@
9279
9345
  * var widget = new PaymentSourceWidget('publicKey','customerId');
9280
9346
  * // or
9281
9347
  * var widget = new PaymentSourceWidget('publicKey', customerReference, true);
9282
- **/
9348
+ */
9283
9349
  var PaymentSourceWidget = /*#__PURE__*/function () {
9284
9350
  function PaymentSourceWidget(accessToken, queryToken) {
9285
9351
  _classCallCheck(this, PaymentSourceWidget);
@@ -9530,7 +9596,7 @@
9530
9596
  * @example
9531
9597
  * * var widget = new HtmlPaymentSourceWidget('#widget', 'publicKey','queryToken');
9532
9598
 
9533
- **/
9599
+ */
9534
9600
  var HtmlPaymentSourceWidget = /*#__PURE__*/function (_PaymentSourceWidget) {
9535
9601
  _inherits(HtmlPaymentSourceWidget, _PaymentSourceWidget);
9536
9602
  var _super = _createSuper(HtmlPaymentSourceWidget);
@@ -9905,7 +9971,7 @@
9905
9971
  * var widget = new Canvas3ds('#widget', 'token');
9906
9972
  *
9907
9973
  *
9908
- **/
9974
+ */
9909
9975
  var Canvas3ds = /*#__PURE__*/function () {
9910
9976
  function Canvas3ds(selector, token) {
9911
9977
  _classCallCheck(this, Canvas3ds);
@@ -10201,7 +10267,7 @@
10201
10267
  *
10202
10268
  * @param {string} selector - Selector of html element. Container for widget
10203
10269
  * @param {string} token - One time token
10204
- **/
10270
+ */
10205
10271
  var VaultDisplayWidget = /*#__PURE__*/function () {
10206
10272
  function VaultDisplayWidget(selector, token) {
10207
10273
  _classCallCheck(this, VaultDisplayWidget);
@@ -10564,7 +10630,7 @@
10564
10630
  * @example
10565
10631
  * var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
10566
10632
  *
10567
- **/
10633
+ */
10568
10634
  var SRC = /*#__PURE__*/function () {
10569
10635
  function SRC(button_selector, iframe_selector, service_id, public_key_or_access_token, meta) {
10570
10636
  _classCallCheck(this, SRC);