@paystack/inline-js 2.27.0-dev.1 → 2.27.0-dev.2

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
@@ -386,6 +386,8 @@ This method mounts wallet payment buttons e.g Apple Pay, Google Pay on a provid
386
386
 
387
387
  All General and Custom configuration options that are accepted by [PaystackPop.newTransaction](https://www.notion.so/Documentation-for-Paystack-Inline-d6e595c0277d413db73b9a0d81a9c16c)
388
388
 
389
+ `paymentRequest` automatically adds `card` to `channels` when `channels` includes `google_pay`, so you do not need to pass both. This overrides the `channels` note in `newTransaction`'s options. `newTransaction` and `checkout` do not do this, so with those methods `google_pay` must still be passed alongside `card`.
390
+
389
391
  ### Configuration Options
390
392
 
391
393
  | Option | Required | Type | Description |
@@ -394,8 +396,6 @@ All General and Custom configuration options that are accepted by [PaystackPop.n
394
396
  | loadPaystackCheckoutButton | False | `String` | ID of button to open checkout form |
395
397
  | styles | False | `Object` | Layout and button styling. See [Styling Options](#styling-options) |
396
398
 
397
- If `channels` includes `google_pay` but not `card`, `card` is added automatically. Passing `card` yourself is harmless. `apple_pay` does not trigger this, so include `card` alongside `apple_pay` if you want card payment available as a fallback.
398
-
399
399
  ### Styling Options
400
400
 
401
401
  | Option | Type | Default | Description |
@@ -440,6 +440,14 @@ number.
440
440
  | ---------------------------- | -------------------------------------------------------- | -----------------------------------|
441
441
  | onElementsMount | Called once mounting has finished for both wallets | `{ applePay: Boolean, googlePay: Boolean }`, or `null` if mounting failed |
442
442
 
443
+ ### Apple Pay availability
444
+
445
+ On a domain that is registered for Apple Pay with Paystack, the Apple Pay button also shows in browsers that do not have built-in Apple Pay. The customer pays by scanning a code with their iPhone.
446
+
447
+ On any other domain, the Apple Pay button shows only in Safari and in iOS in-app browsers.
448
+
449
+ When no Apple Pay button can be shown, `onElementsMount` reports `applePay` as `false`, or receives `null` if no wallet button mounted.
450
+
443
451
  ## Method Response
444
452
 
445
453
  This method returns a Promise which resolves to a [PopupTransaction Instance](#the-popuptransaction-object)
@@ -469,8 +477,7 @@ async function loadPaymentRequestButtons() {
469
477
  email: 'testuser@paystack.com',
470
478
  amount: 10000,
471
479
  currency: "NGN",
472
- // pass card alongside apple_pay as a fallback; card is added automatically when google_pay is present
473
- channels: ["card", "apple_pay", "google_pay"],
480
+ channels: ["apple_pay", "google_pay"],
474
481
  container: 'payment-request-buttons',
475
482
  loadPaystackCheckoutButton: 'pay-button',
476
483
  styles: {
package/dist/inline.js CHANGED
@@ -227,8 +227,9 @@ var PaystackPop = (function () {
227
227
  return equalKeys && equalValues;
228
228
  }
229
229
 
230
- var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js';
231
- var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav';
230
+ var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.3.8/apple-pay-sdk.js';
231
+ var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-u/9mOkmShCO0v+dqCAZFhiutJuORfzvuyM5i+676iy7mLSWS6rlllHrIt15f/mqH';
232
+ var APPLE_PAY_TIMEOUT_MS = 10000;
232
233
  var GOOGLE_PAY_SDK_SOURCE = 'https://pay.google.com/gp/p/js/pay.js';
233
234
  var PAYMENT_REQUEST_BUTTON_HEIGHT = '50px';
234
235
  var GOOGLE_PAY_BUTTON_RADIUS = 3;
@@ -469,6 +470,78 @@ var PaystackPop = (function () {
469
470
  });
470
471
  };
471
472
 
473
+ var withTimeoutDelay = function withTimeoutDelay(work, delayInMilliseconds) {
474
+ var onTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
475
+ return null;
476
+ };
477
+ var timeout;
478
+ var delay = new Promise(function (resolve) {
479
+ timeout = setTimeout(function () {
480
+ try {
481
+ resolve(onTimeout());
482
+ } catch (error) {
483
+ resolve(null);
484
+ }
485
+ }, delayInMilliseconds);
486
+ });
487
+ return Promise.race([work, delay]).finally(function () {
488
+ return clearTimeout(timeout);
489
+ });
490
+ };
491
+
492
+ /* eslint-env browser */
493
+
494
+ var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
495
+
496
+ /**
497
+ * navigator.platform is deprecated and will eventually be removed
498
+ * but the recommended alternative `navigator.userAgentData` has limited browser support
499
+ * so it is used as a fallback here.
500
+ */
501
+ var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
502
+ var getDeviceInfo = function getDeviceInfo() {
503
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
504
+ platform = _ref.platform,
505
+ _ref$userAgent = _ref.userAgent,
506
+ userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
507
+ return {
508
+ devicePlatform: platform || DEVICE_PLATFORM,
509
+ deviceUserAgent: userAgent
510
+ };
511
+ };
512
+ var isIOS = function isIOS() {
513
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
514
+ var _getDeviceInfo = getDeviceInfo(options),
515
+ devicePlatform = _getDeviceInfo.devicePlatform,
516
+ deviceUserAgent = _getDeviceInfo.deviceUserAgent;
517
+ return iOSDevices.includes(devicePlatform) ||
518
+ // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
519
+ deviceUserAgent.includes('Mac') && 'ontouchend' in document;
520
+ };
521
+ var isSafari = function isSafari() {
522
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
523
+ var _getDeviceInfo2 = getDeviceInfo(options),
524
+ deviceUserAgent = _getDeviceInfo2.deviceUserAgent;
525
+ return Boolean(deviceUserAgent && !/Android/.test(deviceUserAgent) && /Version\/[\d.]+.*Safari/.test(deviceUserAgent));
526
+ };
527
+
528
+ // Safari and third-party iOS browsers both send a `Safari/` token; an embedded WKWebView sends none.
529
+ var isIOSWebView = function isIOSWebView() {
530
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
531
+ var _getDeviceInfo3 = getDeviceInfo(options),
532
+ deviceUserAgent = _getDeviceInfo3.deviceUserAgent;
533
+ return Boolean(deviceUserAgent) && isIOS(options) && !/Safari\//.test(deviceUserAgent);
534
+ };
535
+ var isAppleOS = function isAppleOS() {
536
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
537
+ var _getDeviceInfo4 = getDeviceInfo(options),
538
+ devicePlatform = _getDeviceInfo4.devicePlatform;
539
+ return isIOS(options) || Boolean(devicePlatform && /Mac/i.test(devicePlatform));
540
+ };
541
+
542
+ var APPLE_PAY_UNSUPPORTED = 'applePayUnsupported';
543
+ var hasNativeSupportCache = null;
544
+ var sdkLoad = null;
472
545
  var requestConfig = {
473
546
  headers: {
474
547
  accept: 'application/json, text/plain, */*',
@@ -506,7 +579,7 @@ var PaystackPop = (function () {
506
579
  merchantName = _ref.merchantName,
507
580
  interval = _ref.interval;
508
581
  return _objectSpread2({
509
- countryCode: 'NG',
582
+ countryCode: CURRENCY_COUNTRYCODE_MAPPING[currency] || COUNTRYCODE.NIGERIA,
510
583
  currencyCode: currency,
511
584
  merchantCapabilities: ['supports3DS', 'supportsCredit', 'supportsDebit'],
512
585
  supportedNetworks: ['visa', 'masterCard'],
@@ -546,12 +619,18 @@ var PaystackPop = (function () {
546
619
  };
547
620
  var chargeApplePay = function chargeApplePay(_ref3) {
548
621
  var transactionId = _ref3.transactionId,
622
+ accessCode = _ref3.accessCode,
549
623
  payment = _ref3.payment;
550
624
  var chargeApplePayUrl = "".concat(config.paymentBaseUrl).concat(config.applePayChargePath);
551
- var params = {
552
- transaction: transactionId,
625
+
626
+ // createFormBody would send a missing access code as the text "undefined"
627
+ var params = _objectSpread2(_objectSpread2({
628
+ transaction: transactionId
629
+ }, accessCode && {
630
+ accessCode: accessCode
631
+ }), {}, {
553
632
  paymentObject: JSON.stringify(payment)
554
- };
633
+ });
555
634
  var formBody = createFormBody(params);
556
635
  var charge = fetch(chargeApplePayUrl, _objectSpread2(_objectSpread2({}, requestConfig), {}, {
557
636
  body: formBody
@@ -562,29 +641,134 @@ var PaystackPop = (function () {
562
641
  };
563
642
  var deviceSupportsApplePay = function deviceSupportsApplePay() {
564
643
  try {
565
- return window.isSecureContext && window.ApplePaySession && window.ApplePaySession.supportsVersion(config.applePayVersion);
644
+ return Boolean(isAppleOS() && (isSafari() || isIOSWebView()) && window.isSecureContext && window.ApplePaySession && !window.ApplePaySession.isNotWebkit && window.ApplePaySession.supportsVersion(config.applePayVersion));
566
645
  } catch (error) {
567
646
  return false;
568
647
  }
569
648
  };
570
- var canUseApplePay = function canUseApplePay() {
571
- var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
572
- return deviceSupportsApplePay() && channels.includes(CHANNELS.APPLE_PAY);
649
+
650
+ /**
651
+ * Off WebKit the SDK installs its own `window.ApplePaySession` whose
652
+ * `supportsVersion()` always returns true, so native support is only
653
+ * trustworthy when read before the SDK loads.
654
+ */
655
+ var getNativeSupport = function getNativeSupport() {
656
+ if (hasNativeSupportCache === null) {
657
+ hasNativeSupportCache = deviceSupportsApplePay();
658
+ }
659
+ return hasNativeSupportCache;
660
+ };
661
+
662
+ /**
663
+ * Off WebKit the SDK assigns `window.onbeforeunload` to close its QR-code
664
+ * window, replacing any handler the merchant page set, such as an
665
+ * unsaved-changes guard. Run both, and return the merchant's result because
666
+ * that is what triggers the browser's "Leave site?" prompt.
667
+ */
668
+ var combineSdkAndMerchantBeforeUnload = function combineSdkAndMerchantBeforeUnload(merchantHandler) {
669
+ var sdkHandler = window.onbeforeunload;
670
+ if (sdkHandler === merchantHandler || typeof merchantHandler !== 'function' || typeof sdkHandler !== 'function') {
671
+ return;
672
+ }
673
+ window.onbeforeunload = function combinedBeforeUnload(event) {
674
+ var sdkResult = sdkHandler.call(window, event);
675
+ var merchantResult = merchantHandler.call(window, event);
676
+ return merchantResult !== undefined ? merchantResult : sdkResult;
677
+ };
678
+ };
679
+ var loadApplePaySDK = function loadApplePaySDK() {
680
+ if (!sdkLoad) {
681
+ var merchantBeforeUnload = window.onbeforeunload;
682
+ sdkLoad = loadScript(APPLE_PAY_SDK_SOURCE, {
683
+ integrity: APPLE_PAY_SDK_INTEGRITY_HASH
684
+ }).then(function () {
685
+ combineSdkAndMerchantBeforeUnload(merchantBeforeUnload);
686
+ return true;
687
+ }).catch(function () {
688
+ sdkLoad = null;
689
+ return false;
690
+ });
691
+ }
692
+ return sdkLoad;
573
693
  };
574
- var loadApplePay = function loadApplePay() {
575
- return loadScript(APPLE_PAY_SDK_SOURCE, {
576
- integrity: APPLE_PAY_SDK_INTEGRITY_HASH
577
- }).then(function () {
578
- /**
579
- * The Apple Pay SDK expects `window.webpackJsonp` to be array-like
580
- * but we have seen instances where that is not the case, causing the SDK to throw errors
581
- * so in this scenario, we opt out of using the SDK
582
- */
583
- if (window && !Array.isArray(window.webpackJsonp)) {
584
- throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
694
+ var probeApplePayCapabilities = function probeApplePayCapabilities(merchantId) {
695
+ return Promise.resolve().then(function () {
696
+ if (typeof window.ApplePaySession.applePayCapabilities !== 'function') {
697
+ return null;
585
698
  }
699
+ return window.ApplePaySession.applePayCapabilities(merchantId);
700
+ }).then(function (capabilities) {
701
+ return (capabilities || {}).paymentCredentialStatus || null;
702
+ }).catch(function () {
703
+ return null;
704
+ });
705
+ };
706
+ var loadThenProbe = function loadThenProbe(merchantId) {
707
+ return loadApplePaySDK().then(function (sdkLoaded) {
708
+ return (sdkLoaded ? probeApplePayCapabilities(merchantId) : Promise.resolve(null)).then(function (status) {
709
+ return {
710
+ status: status,
711
+ sdkLoaded: sdkLoaded
712
+ };
713
+ });
586
714
  });
587
715
  };
716
+ var normaliseRegisteredDomain = function normaliseRegisteredDomain(domain) {
717
+ return String(domain).toLowerCase().replace(/\/+$/, '');
718
+ };
719
+ var isPageDomainRegisteredWithApple = function isPageDomainRegisteredWithApple(registeredDomains) {
720
+ var hostname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.hostname;
721
+ return Array.isArray(registeredDomains) && registeredDomains.some(function (domain) {
722
+ return normaliseRegisteredDomain(domain) === hostname.toLowerCase();
723
+ });
724
+ };
725
+ var shouldProbe = function shouldProbe(response, merchantId, hasNativeSupport) {
726
+ var channels = response.channels || [];
727
+ var applePaySettings = response.channel_settings && response.channel_settings.apple_pay || {};
728
+ return channels.includes(CHANNELS.APPLE_PAY) && Boolean(merchantId) && (isPageDomainRegisteredWithApple(applePaySettings.domains) || hasNativeSupport);
729
+ };
730
+ var resolveApplePayStatus = function resolveApplePayStatus(response) {
731
+ try {
732
+ var safeResponse = response || {};
733
+ var hasNativeSupport = getNativeSupport();
734
+ var merchantId = safeResponse.channel_settings && safeResponse.channel_settings.apple_pay && safeResponse.channel_settings.apple_pay.merchant_identifier;
735
+ if (!shouldProbe(safeResponse, merchantId, hasNativeSupport)) {
736
+ return Promise.resolve({
737
+ status: null,
738
+ hasNativeSupport: hasNativeSupport,
739
+ sdkLoaded: false
740
+ });
741
+ }
742
+ return withTimeoutDelay(loadThenProbe(merchantId), APPLE_PAY_TIMEOUT_MS).catch(function () {
743
+ return null;
744
+ }).then(function (result) {
745
+ return {
746
+ status: result && result.status || null,
747
+ hasNativeSupport: hasNativeSupport,
748
+ sdkLoaded: Boolean(result && result.sdkLoaded)
749
+ };
750
+ });
751
+ } catch (error) {
752
+ return Promise.resolve({
753
+ status: null,
754
+ hasNativeSupport: false,
755
+ sdkLoaded: false
756
+ });
757
+ }
758
+ };
759
+ var canUseApplePay = function canUseApplePay() {
760
+ var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
761
+ var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
762
+ status = _ref4.status,
763
+ hasNativeSupport = _ref4.hasNativeSupport;
764
+ if (!channels.includes(CHANNELS.APPLE_PAY)) {
765
+ return false;
766
+ }
767
+ if (status && status !== APPLE_PAY_UNSUPPORTED) {
768
+ return true;
769
+ }
770
+ return hasNativeSupport === true;
771
+ };
588
772
 
589
773
  var getChannelAmount = function getChannelAmount(response, channel) {
590
774
  var channelFees = (response && response.channel_fees_and_amount || {})[channel];
@@ -598,25 +782,6 @@ var PaystackPop = (function () {
598
782
  logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
599
783
  }
600
784
 
601
- var withTimeoutDelay = function withTimeoutDelay(work, delayInMilliseconds) {
602
- var onTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
603
- return null;
604
- };
605
- var timeout;
606
- var delay = new Promise(function (resolve) {
607
- timeout = setTimeout(function () {
608
- try {
609
- resolve(onTimeout());
610
- } catch (error) {
611
- resolve(null);
612
- }
613
- }, delayInMilliseconds);
614
- });
615
- return Promise.race([work, delay]).finally(function () {
616
- return clearTimeout(timeout);
617
- });
618
- };
619
-
620
785
  /**
621
786
  * Never advertised here: a `PAN_ONLY` charge comes back needing a 3DS step-up,
622
787
  * and inline-js can't handle it
@@ -1017,12 +1182,24 @@ var PaystackPop = (function () {
1017
1182
  }
1018
1183
  return [getApplePayButton(container), getGooglePayButton(container)].filter(Boolean);
1019
1184
  }
1020
- function mountPaymentRequestButtons(container, _ref5) {
1021
- var transaction = _ref5.transaction,
1022
- _ref5$styles = _ref5.styles,
1023
- styles = _ref5$styles === void 0 ? {} : _ref5$styles,
1024
- onClickApplePayButton = _ref5.onClickApplePayButton,
1025
- onClickGooglePayButton = _ref5.onClickGooglePayButton;
1185
+ function mountUsableApplePayButton(container, _ref5, options) {
1186
+ var sdkLoaded = _ref5.sdkLoaded,
1187
+ hasNativeSupport = _ref5.hasNativeSupport;
1188
+ if (sdkLoaded) {
1189
+ return mountApplePayButton(container, options);
1190
+ }
1191
+ if (hasNativeSupport) {
1192
+ return mountApplePayFallbackButton(container, options);
1193
+ }
1194
+ logWarning('Apple Pay: the Apple Pay SDK did not load, so no Apple Pay button is shown.');
1195
+ return null;
1196
+ }
1197
+ function mountPaymentRequestButtons(container, _ref6) {
1198
+ var transaction = _ref6.transaction,
1199
+ _ref6$styles = _ref6.styles,
1200
+ styles = _ref6$styles === void 0 ? {} : _ref6$styles,
1201
+ onClickApplePayButton = _ref6.onClickApplePayButton,
1202
+ onClickGooglePayButton = _ref6.onClickGooglePayButton;
1026
1203
  if (!container) {
1027
1204
  return Promise.reject('Container to mount elements was not provided');
1028
1205
  }
@@ -1038,18 +1215,17 @@ var PaystackPop = (function () {
1038
1215
  onClick: onClickApplePayButton
1039
1216
  };
1040
1217
  var channels = transaction.response && transaction.response.channels || [];
1041
- var applePayButton = Promise.resolve(null);
1042
- if (canUseApplePay(channels)) {
1043
- applePayButton = loadApplePay().then(function () {
1044
- return mountApplePayButton(innerWrapper, applePayOptions);
1045
- }).catch(function () {
1046
- return mountApplePayFallbackButton(innerWrapper, applePayOptions);
1047
- }).catch(function () {
1048
- return null;
1049
- });
1050
- } else if (channels.includes(CHANNELS.APPLE_PAY)) {
1051
- logWarning('Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.');
1052
- }
1218
+ var applePayButton = resolveApplePayStatus(transaction.response).then(function (applePay) {
1219
+ if (canUseApplePay(channels, applePay)) {
1220
+ return mountUsableApplePayButton(innerWrapper, applePay, applePayOptions);
1221
+ }
1222
+ if (channels.includes(CHANNELS.APPLE_PAY)) {
1223
+ logWarning('Apple Pay: this device, browser or page cannot pay with Apple Pay here.');
1224
+ }
1225
+ return null;
1226
+ }).catch(function () {
1227
+ return null;
1228
+ });
1053
1229
  var googlePayButton = loadGooglePay(transaction).then(function (isReadyToPay) {
1054
1230
  if (!isReadyToPay) {
1055
1231
  return null;
@@ -1062,10 +1238,10 @@ var PaystackPop = (function () {
1062
1238
  }).catch(function () {
1063
1239
  return null;
1064
1240
  });
1065
- return Promise.all([applePayButton, googlePayButton]).then(function (_ref6) {
1066
- var _ref7 = _slicedToArray(_ref6, 2),
1067
- applePay = _ref7[0],
1068
- googlePay = _ref7[1];
1241
+ return Promise.all([applePayButton, googlePayButton]).then(function (_ref7) {
1242
+ var _ref8 = _slicedToArray(_ref7, 2),
1243
+ applePay = _ref8[0],
1244
+ googlePay = _ref8[1];
1069
1245
  if (!applePay && !googlePay) {
1070
1246
  return null;
1071
1247
  }
@@ -1471,27 +1647,6 @@ var PaystackPop = (function () {
1471
1647
  return formattedParameters;
1472
1648
  }
1473
1649
 
1474
- /* eslint-env browser */
1475
-
1476
- var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
1477
-
1478
- /**
1479
- * navigator.platform is deprecated and will eventually be removed
1480
- * but the recommended alternative `navigator.userAgentData` has limited browser support
1481
- * so it is used as a fallback here.
1482
- */
1483
- var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
1484
- var isIOS = function isIOS() {
1485
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1486
- platform = _ref.platform,
1487
- _ref$userAgent = _ref.userAgent,
1488
- userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
1489
- var devicePlatform = platform || DEVICE_PLATFORM;
1490
- return iOSDevices.includes(devicePlatform) ||
1491
- // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1492
- userAgent.includes('Mac') && 'ontouchend' in document;
1493
- };
1494
-
1495
1650
  /* eslint-env browser */
1496
1651
  var AnalyticsAPI = {
1497
1652
  saveLog: function saveLog(transactionId, merchantPublicKey, log) {
@@ -2201,19 +2356,20 @@ var PaystackPop = (function () {
2201
2356
  var payment = _ref3.payment;
2202
2357
  var charge = chargeApplePay({
2203
2358
  transactionId: transaction.id,
2359
+ accessCode: transaction.accessCode,
2204
2360
  payment: payment
2205
2361
  });
2206
2362
  charge.then(function (response) {
2207
2363
  transaction.logAPIResponse(response, paymentMethod);
2208
2364
  _this5.isCharging = false;
2209
2365
  if (response.status === TRANSACTION_STATUS.SUCCESS) {
2210
- applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
2366
+ applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
2211
2367
  transaction.onSuccess(response);
2212
2368
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
2213
2369
  timeSpent: transaction.getTimeSpent()
2214
2370
  }));
2215
2371
  } else {
2216
- applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2372
+ applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
2217
2373
  transaction.onSetupError(response);
2218
2374
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2219
2375
  channel: CHANNELS.APPLE_PAY,
@@ -2222,7 +2378,7 @@ var PaystackPop = (function () {
2222
2378
  }
2223
2379
  }).catch(function (error) {
2224
2380
  _this5.isCharging = false;
2225
- applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2381
+ applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
2226
2382
  transaction.onSetupError(error);
2227
2383
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2228
2384
  channel: CHANNELS.APPLE_PAY,
package/es/inline.js CHANGED
@@ -224,8 +224,9 @@ function similarObjects(o1, o2) {
224
224
  return equalKeys && equalValues;
225
225
  }
226
226
 
227
- var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js';
228
- var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav';
227
+ var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.3.8/apple-pay-sdk.js';
228
+ var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-u/9mOkmShCO0v+dqCAZFhiutJuORfzvuyM5i+676iy7mLSWS6rlllHrIt15f/mqH';
229
+ var APPLE_PAY_TIMEOUT_MS = 10000;
229
230
  var GOOGLE_PAY_SDK_SOURCE = 'https://pay.google.com/gp/p/js/pay.js';
230
231
  var PAYMENT_REQUEST_BUTTON_HEIGHT = '50px';
231
232
  var GOOGLE_PAY_BUTTON_RADIUS = 3;
@@ -466,6 +467,78 @@ var loadScript = function loadScript(url) {
466
467
  });
467
468
  };
468
469
 
470
+ var withTimeoutDelay = function withTimeoutDelay(work, delayInMilliseconds) {
471
+ var onTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
472
+ return null;
473
+ };
474
+ var timeout;
475
+ var delay = new Promise(function (resolve) {
476
+ timeout = setTimeout(function () {
477
+ try {
478
+ resolve(onTimeout());
479
+ } catch (error) {
480
+ resolve(null);
481
+ }
482
+ }, delayInMilliseconds);
483
+ });
484
+ return Promise.race([work, delay]).finally(function () {
485
+ return clearTimeout(timeout);
486
+ });
487
+ };
488
+
489
+ /* eslint-env browser */
490
+
491
+ var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
492
+
493
+ /**
494
+ * navigator.platform is deprecated and will eventually be removed
495
+ * but the recommended alternative `navigator.userAgentData` has limited browser support
496
+ * so it is used as a fallback here.
497
+ */
498
+ var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
499
+ var getDeviceInfo = function getDeviceInfo() {
500
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
501
+ platform = _ref.platform,
502
+ _ref$userAgent = _ref.userAgent,
503
+ userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
504
+ return {
505
+ devicePlatform: platform || DEVICE_PLATFORM,
506
+ deviceUserAgent: userAgent
507
+ };
508
+ };
509
+ var isIOS = function isIOS() {
510
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
511
+ var _getDeviceInfo = getDeviceInfo(options),
512
+ devicePlatform = _getDeviceInfo.devicePlatform,
513
+ deviceUserAgent = _getDeviceInfo.deviceUserAgent;
514
+ return iOSDevices.includes(devicePlatform) ||
515
+ // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
516
+ deviceUserAgent.includes('Mac') && 'ontouchend' in document;
517
+ };
518
+ var isSafari = function isSafari() {
519
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
520
+ var _getDeviceInfo2 = getDeviceInfo(options),
521
+ deviceUserAgent = _getDeviceInfo2.deviceUserAgent;
522
+ return Boolean(deviceUserAgent && !/Android/.test(deviceUserAgent) && /Version\/[\d.]+.*Safari/.test(deviceUserAgent));
523
+ };
524
+
525
+ // Safari and third-party iOS browsers both send a `Safari/` token; an embedded WKWebView sends none.
526
+ var isIOSWebView = function isIOSWebView() {
527
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
528
+ var _getDeviceInfo3 = getDeviceInfo(options),
529
+ deviceUserAgent = _getDeviceInfo3.deviceUserAgent;
530
+ return Boolean(deviceUserAgent) && isIOS(options) && !/Safari\//.test(deviceUserAgent);
531
+ };
532
+ var isAppleOS = function isAppleOS() {
533
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
534
+ var _getDeviceInfo4 = getDeviceInfo(options),
535
+ devicePlatform = _getDeviceInfo4.devicePlatform;
536
+ return isIOS(options) || Boolean(devicePlatform && /Mac/i.test(devicePlatform));
537
+ };
538
+
539
+ var APPLE_PAY_UNSUPPORTED = 'applePayUnsupported';
540
+ var hasNativeSupportCache = null;
541
+ var sdkLoad = null;
469
542
  var requestConfig = {
470
543
  headers: {
471
544
  accept: 'application/json, text/plain, */*',
@@ -503,7 +576,7 @@ var generateApplePaymentRequestObject = function generateApplePaymentRequestObje
503
576
  merchantName = _ref.merchantName,
504
577
  interval = _ref.interval;
505
578
  return _objectSpread2({
506
- countryCode: 'NG',
579
+ countryCode: CURRENCY_COUNTRYCODE_MAPPING[currency] || COUNTRYCODE.NIGERIA,
507
580
  currencyCode: currency,
508
581
  merchantCapabilities: ['supports3DS', 'supportsCredit', 'supportsDebit'],
509
582
  supportedNetworks: ['visa', 'masterCard'],
@@ -543,12 +616,18 @@ var validateApplePaySession = function validateApplePaySession(_ref2) {
543
616
  };
544
617
  var chargeApplePay = function chargeApplePay(_ref3) {
545
618
  var transactionId = _ref3.transactionId,
619
+ accessCode = _ref3.accessCode,
546
620
  payment = _ref3.payment;
547
621
  var chargeApplePayUrl = "".concat(config.paymentBaseUrl).concat(config.applePayChargePath);
548
- var params = {
549
- transaction: transactionId,
622
+
623
+ // createFormBody would send a missing access code as the text "undefined"
624
+ var params = _objectSpread2(_objectSpread2({
625
+ transaction: transactionId
626
+ }, accessCode && {
627
+ accessCode: accessCode
628
+ }), {}, {
550
629
  paymentObject: JSON.stringify(payment)
551
- };
630
+ });
552
631
  var formBody = createFormBody(params);
553
632
  var charge = fetch(chargeApplePayUrl, _objectSpread2(_objectSpread2({}, requestConfig), {}, {
554
633
  body: formBody
@@ -559,29 +638,134 @@ var chargeApplePay = function chargeApplePay(_ref3) {
559
638
  };
560
639
  var deviceSupportsApplePay = function deviceSupportsApplePay() {
561
640
  try {
562
- return window.isSecureContext && window.ApplePaySession && window.ApplePaySession.supportsVersion(config.applePayVersion);
641
+ return Boolean(isAppleOS() && (isSafari() || isIOSWebView()) && window.isSecureContext && window.ApplePaySession && !window.ApplePaySession.isNotWebkit && window.ApplePaySession.supportsVersion(config.applePayVersion));
563
642
  } catch (error) {
564
643
  return false;
565
644
  }
566
645
  };
567
- var canUseApplePay = function canUseApplePay() {
568
- var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
569
- return deviceSupportsApplePay() && channels.includes(CHANNELS.APPLE_PAY);
646
+
647
+ /**
648
+ * Off WebKit the SDK installs its own `window.ApplePaySession` whose
649
+ * `supportsVersion()` always returns true, so native support is only
650
+ * trustworthy when read before the SDK loads.
651
+ */
652
+ var getNativeSupport = function getNativeSupport() {
653
+ if (hasNativeSupportCache === null) {
654
+ hasNativeSupportCache = deviceSupportsApplePay();
655
+ }
656
+ return hasNativeSupportCache;
657
+ };
658
+
659
+ /**
660
+ * Off WebKit the SDK assigns `window.onbeforeunload` to close its QR-code
661
+ * window, replacing any handler the merchant page set, such as an
662
+ * unsaved-changes guard. Run both, and return the merchant's result because
663
+ * that is what triggers the browser's "Leave site?" prompt.
664
+ */
665
+ var combineSdkAndMerchantBeforeUnload = function combineSdkAndMerchantBeforeUnload(merchantHandler) {
666
+ var sdkHandler = window.onbeforeunload;
667
+ if (sdkHandler === merchantHandler || typeof merchantHandler !== 'function' || typeof sdkHandler !== 'function') {
668
+ return;
669
+ }
670
+ window.onbeforeunload = function combinedBeforeUnload(event) {
671
+ var sdkResult = sdkHandler.call(window, event);
672
+ var merchantResult = merchantHandler.call(window, event);
673
+ return merchantResult !== undefined ? merchantResult : sdkResult;
674
+ };
675
+ };
676
+ var loadApplePaySDK = function loadApplePaySDK() {
677
+ if (!sdkLoad) {
678
+ var merchantBeforeUnload = window.onbeforeunload;
679
+ sdkLoad = loadScript(APPLE_PAY_SDK_SOURCE, {
680
+ integrity: APPLE_PAY_SDK_INTEGRITY_HASH
681
+ }).then(function () {
682
+ combineSdkAndMerchantBeforeUnload(merchantBeforeUnload);
683
+ return true;
684
+ }).catch(function () {
685
+ sdkLoad = null;
686
+ return false;
687
+ });
688
+ }
689
+ return sdkLoad;
570
690
  };
571
- var loadApplePay = function loadApplePay() {
572
- return loadScript(APPLE_PAY_SDK_SOURCE, {
573
- integrity: APPLE_PAY_SDK_INTEGRITY_HASH
574
- }).then(function () {
575
- /**
576
- * The Apple Pay SDK expects `window.webpackJsonp` to be array-like
577
- * but we have seen instances where that is not the case, causing the SDK to throw errors
578
- * so in this scenario, we opt out of using the SDK
579
- */
580
- if (window && !Array.isArray(window.webpackJsonp)) {
581
- throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
691
+ var probeApplePayCapabilities = function probeApplePayCapabilities(merchantId) {
692
+ return Promise.resolve().then(function () {
693
+ if (typeof window.ApplePaySession.applePayCapabilities !== 'function') {
694
+ return null;
582
695
  }
696
+ return window.ApplePaySession.applePayCapabilities(merchantId);
697
+ }).then(function (capabilities) {
698
+ return (capabilities || {}).paymentCredentialStatus || null;
699
+ }).catch(function () {
700
+ return null;
701
+ });
702
+ };
703
+ var loadThenProbe = function loadThenProbe(merchantId) {
704
+ return loadApplePaySDK().then(function (sdkLoaded) {
705
+ return (sdkLoaded ? probeApplePayCapabilities(merchantId) : Promise.resolve(null)).then(function (status) {
706
+ return {
707
+ status: status,
708
+ sdkLoaded: sdkLoaded
709
+ };
710
+ });
583
711
  });
584
712
  };
713
+ var normaliseRegisteredDomain = function normaliseRegisteredDomain(domain) {
714
+ return String(domain).toLowerCase().replace(/\/+$/, '');
715
+ };
716
+ var isPageDomainRegisteredWithApple = function isPageDomainRegisteredWithApple(registeredDomains) {
717
+ var hostname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.hostname;
718
+ return Array.isArray(registeredDomains) && registeredDomains.some(function (domain) {
719
+ return normaliseRegisteredDomain(domain) === hostname.toLowerCase();
720
+ });
721
+ };
722
+ var shouldProbe = function shouldProbe(response, merchantId, hasNativeSupport) {
723
+ var channels = response.channels || [];
724
+ var applePaySettings = response.channel_settings && response.channel_settings.apple_pay || {};
725
+ return channels.includes(CHANNELS.APPLE_PAY) && Boolean(merchantId) && (isPageDomainRegisteredWithApple(applePaySettings.domains) || hasNativeSupport);
726
+ };
727
+ var resolveApplePayStatus = function resolveApplePayStatus(response) {
728
+ try {
729
+ var safeResponse = response || {};
730
+ var hasNativeSupport = getNativeSupport();
731
+ var merchantId = safeResponse.channel_settings && safeResponse.channel_settings.apple_pay && safeResponse.channel_settings.apple_pay.merchant_identifier;
732
+ if (!shouldProbe(safeResponse, merchantId, hasNativeSupport)) {
733
+ return Promise.resolve({
734
+ status: null,
735
+ hasNativeSupport: hasNativeSupport,
736
+ sdkLoaded: false
737
+ });
738
+ }
739
+ return withTimeoutDelay(loadThenProbe(merchantId), APPLE_PAY_TIMEOUT_MS).catch(function () {
740
+ return null;
741
+ }).then(function (result) {
742
+ return {
743
+ status: result && result.status || null,
744
+ hasNativeSupport: hasNativeSupport,
745
+ sdkLoaded: Boolean(result && result.sdkLoaded)
746
+ };
747
+ });
748
+ } catch (error) {
749
+ return Promise.resolve({
750
+ status: null,
751
+ hasNativeSupport: false,
752
+ sdkLoaded: false
753
+ });
754
+ }
755
+ };
756
+ var canUseApplePay = function canUseApplePay() {
757
+ var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
758
+ var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
759
+ status = _ref4.status,
760
+ hasNativeSupport = _ref4.hasNativeSupport;
761
+ if (!channels.includes(CHANNELS.APPLE_PAY)) {
762
+ return false;
763
+ }
764
+ if (status && status !== APPLE_PAY_UNSUPPORTED) {
765
+ return true;
766
+ }
767
+ return hasNativeSupport === true;
768
+ };
585
769
 
586
770
  var getChannelAmount = function getChannelAmount(response, channel) {
587
771
  var channelFees = (response && response.channel_fees_and_amount || {})[channel];
@@ -595,25 +779,6 @@ function printDeprecationNotice(oldName, newName, extraMessage) {
595
779
  logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
596
780
  }
597
781
 
598
- var withTimeoutDelay = function withTimeoutDelay(work, delayInMilliseconds) {
599
- var onTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
600
- return null;
601
- };
602
- var timeout;
603
- var delay = new Promise(function (resolve) {
604
- timeout = setTimeout(function () {
605
- try {
606
- resolve(onTimeout());
607
- } catch (error) {
608
- resolve(null);
609
- }
610
- }, delayInMilliseconds);
611
- });
612
- return Promise.race([work, delay]).finally(function () {
613
- return clearTimeout(timeout);
614
- });
615
- };
616
-
617
782
  /**
618
783
  * Never advertised here: a `PAN_ONLY` charge comes back needing a 3DS step-up,
619
784
  * and inline-js can't handle it
@@ -1014,12 +1179,24 @@ function getMountedPaymentRequestButtons(container) {
1014
1179
  }
1015
1180
  return [getApplePayButton(container), getGooglePayButton(container)].filter(Boolean);
1016
1181
  }
1017
- function mountPaymentRequestButtons(container, _ref5) {
1018
- var transaction = _ref5.transaction,
1019
- _ref5$styles = _ref5.styles,
1020
- styles = _ref5$styles === void 0 ? {} : _ref5$styles,
1021
- onClickApplePayButton = _ref5.onClickApplePayButton,
1022
- onClickGooglePayButton = _ref5.onClickGooglePayButton;
1182
+ function mountUsableApplePayButton(container, _ref5, options) {
1183
+ var sdkLoaded = _ref5.sdkLoaded,
1184
+ hasNativeSupport = _ref5.hasNativeSupport;
1185
+ if (sdkLoaded) {
1186
+ return mountApplePayButton(container, options);
1187
+ }
1188
+ if (hasNativeSupport) {
1189
+ return mountApplePayFallbackButton(container, options);
1190
+ }
1191
+ logWarning('Apple Pay: the Apple Pay SDK did not load, so no Apple Pay button is shown.');
1192
+ return null;
1193
+ }
1194
+ function mountPaymentRequestButtons(container, _ref6) {
1195
+ var transaction = _ref6.transaction,
1196
+ _ref6$styles = _ref6.styles,
1197
+ styles = _ref6$styles === void 0 ? {} : _ref6$styles,
1198
+ onClickApplePayButton = _ref6.onClickApplePayButton,
1199
+ onClickGooglePayButton = _ref6.onClickGooglePayButton;
1023
1200
  if (!container) {
1024
1201
  return Promise.reject('Container to mount elements was not provided');
1025
1202
  }
@@ -1035,18 +1212,17 @@ function mountPaymentRequestButtons(container, _ref5) {
1035
1212
  onClick: onClickApplePayButton
1036
1213
  };
1037
1214
  var channels = transaction.response && transaction.response.channels || [];
1038
- var applePayButton = Promise.resolve(null);
1039
- if (canUseApplePay(channels)) {
1040
- applePayButton = loadApplePay().then(function () {
1041
- return mountApplePayButton(innerWrapper, applePayOptions);
1042
- }).catch(function () {
1043
- return mountApplePayFallbackButton(innerWrapper, applePayOptions);
1044
- }).catch(function () {
1045
- return null;
1046
- });
1047
- } else if (channels.includes(CHANNELS.APPLE_PAY)) {
1048
- logWarning('Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.');
1049
- }
1215
+ var applePayButton = resolveApplePayStatus(transaction.response).then(function (applePay) {
1216
+ if (canUseApplePay(channels, applePay)) {
1217
+ return mountUsableApplePayButton(innerWrapper, applePay, applePayOptions);
1218
+ }
1219
+ if (channels.includes(CHANNELS.APPLE_PAY)) {
1220
+ logWarning('Apple Pay: this device, browser or page cannot pay with Apple Pay here.');
1221
+ }
1222
+ return null;
1223
+ }).catch(function () {
1224
+ return null;
1225
+ });
1050
1226
  var googlePayButton = loadGooglePay(transaction).then(function (isReadyToPay) {
1051
1227
  if (!isReadyToPay) {
1052
1228
  return null;
@@ -1059,10 +1235,10 @@ function mountPaymentRequestButtons(container, _ref5) {
1059
1235
  }).catch(function () {
1060
1236
  return null;
1061
1237
  });
1062
- return Promise.all([applePayButton, googlePayButton]).then(function (_ref6) {
1063
- var _ref7 = _slicedToArray(_ref6, 2),
1064
- applePay = _ref7[0],
1065
- googlePay = _ref7[1];
1238
+ return Promise.all([applePayButton, googlePayButton]).then(function (_ref7) {
1239
+ var _ref8 = _slicedToArray(_ref7, 2),
1240
+ applePay = _ref8[0],
1241
+ googlePay = _ref8[1];
1066
1242
  if (!applePay && !googlePay) {
1067
1243
  return null;
1068
1244
  }
@@ -1468,27 +1644,6 @@ function buildQuery(parameters) {
1468
1644
  return formattedParameters;
1469
1645
  }
1470
1646
 
1471
- /* eslint-env browser */
1472
-
1473
- var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
1474
-
1475
- /**
1476
- * navigator.platform is deprecated and will eventually be removed
1477
- * but the recommended alternative `navigator.userAgentData` has limited browser support
1478
- * so it is used as a fallback here.
1479
- */
1480
- var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
1481
- var isIOS = function isIOS() {
1482
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1483
- platform = _ref.platform,
1484
- _ref$userAgent = _ref.userAgent,
1485
- userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
1486
- var devicePlatform = platform || DEVICE_PLATFORM;
1487
- return iOSDevices.includes(devicePlatform) ||
1488
- // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1489
- userAgent.includes('Mac') && 'ontouchend' in document;
1490
- };
1491
-
1492
1647
  /* eslint-env browser */
1493
1648
  var AnalyticsAPI = {
1494
1649
  saveLog: function saveLog(transactionId, merchantPublicKey, log) {
@@ -2198,19 +2353,20 @@ var Inline = /*#__PURE__*/function () {
2198
2353
  var payment = _ref3.payment;
2199
2354
  var charge = chargeApplePay({
2200
2355
  transactionId: transaction.id,
2356
+ accessCode: transaction.accessCode,
2201
2357
  payment: payment
2202
2358
  });
2203
2359
  charge.then(function (response) {
2204
2360
  transaction.logAPIResponse(response, paymentMethod);
2205
2361
  _this5.isCharging = false;
2206
2362
  if (response.status === TRANSACTION_STATUS.SUCCESS) {
2207
- applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
2363
+ applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
2208
2364
  transaction.onSuccess(response);
2209
2365
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
2210
2366
  timeSpent: transaction.getTimeSpent()
2211
2367
  }));
2212
2368
  } else {
2213
- applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2369
+ applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
2214
2370
  transaction.onSetupError(response);
2215
2371
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2216
2372
  channel: CHANNELS.APPLE_PAY,
@@ -2219,7 +2375,7 @@ var Inline = /*#__PURE__*/function () {
2219
2375
  }
2220
2376
  }).catch(function (error) {
2221
2377
  _this5.isCharging = false;
2222
- applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2378
+ applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
2223
2379
  transaction.onSetupError(error);
2224
2380
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2225
2381
  channel: CHANNELS.APPLE_PAY,
package/lib/inline.js CHANGED
@@ -226,8 +226,9 @@ function similarObjects(o1, o2) {
226
226
  return equalKeys && equalValues;
227
227
  }
228
228
 
229
- var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js';
230
- var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav';
229
+ var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.3.8/apple-pay-sdk.js';
230
+ var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-u/9mOkmShCO0v+dqCAZFhiutJuORfzvuyM5i+676iy7mLSWS6rlllHrIt15f/mqH';
231
+ var APPLE_PAY_TIMEOUT_MS = 10000;
231
232
  var GOOGLE_PAY_SDK_SOURCE = 'https://pay.google.com/gp/p/js/pay.js';
232
233
  var PAYMENT_REQUEST_BUTTON_HEIGHT = '50px';
233
234
  var GOOGLE_PAY_BUTTON_RADIUS = 3;
@@ -468,6 +469,78 @@ var loadScript = function loadScript(url) {
468
469
  });
469
470
  };
470
471
 
472
+ var withTimeoutDelay = function withTimeoutDelay(work, delayInMilliseconds) {
473
+ var onTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
474
+ return null;
475
+ };
476
+ var timeout;
477
+ var delay = new Promise(function (resolve) {
478
+ timeout = setTimeout(function () {
479
+ try {
480
+ resolve(onTimeout());
481
+ } catch (error) {
482
+ resolve(null);
483
+ }
484
+ }, delayInMilliseconds);
485
+ });
486
+ return Promise.race([work, delay]).finally(function () {
487
+ return clearTimeout(timeout);
488
+ });
489
+ };
490
+
491
+ /* eslint-env browser */
492
+
493
+ var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
494
+
495
+ /**
496
+ * navigator.platform is deprecated and will eventually be removed
497
+ * but the recommended alternative `navigator.userAgentData` has limited browser support
498
+ * so it is used as a fallback here.
499
+ */
500
+ var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
501
+ var getDeviceInfo = function getDeviceInfo() {
502
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
503
+ platform = _ref.platform,
504
+ _ref$userAgent = _ref.userAgent,
505
+ userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
506
+ return {
507
+ devicePlatform: platform || DEVICE_PLATFORM,
508
+ deviceUserAgent: userAgent
509
+ };
510
+ };
511
+ var isIOS = function isIOS() {
512
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
513
+ var _getDeviceInfo = getDeviceInfo(options),
514
+ devicePlatform = _getDeviceInfo.devicePlatform,
515
+ deviceUserAgent = _getDeviceInfo.deviceUserAgent;
516
+ return iOSDevices.includes(devicePlatform) ||
517
+ // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
518
+ deviceUserAgent.includes('Mac') && 'ontouchend' in document;
519
+ };
520
+ var isSafari = function isSafari() {
521
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
522
+ var _getDeviceInfo2 = getDeviceInfo(options),
523
+ deviceUserAgent = _getDeviceInfo2.deviceUserAgent;
524
+ return Boolean(deviceUserAgent && !/Android/.test(deviceUserAgent) && /Version\/[\d.]+.*Safari/.test(deviceUserAgent));
525
+ };
526
+
527
+ // Safari and third-party iOS browsers both send a `Safari/` token; an embedded WKWebView sends none.
528
+ var isIOSWebView = function isIOSWebView() {
529
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
530
+ var _getDeviceInfo3 = getDeviceInfo(options),
531
+ deviceUserAgent = _getDeviceInfo3.deviceUserAgent;
532
+ return Boolean(deviceUserAgent) && isIOS(options) && !/Safari\//.test(deviceUserAgent);
533
+ };
534
+ var isAppleOS = function isAppleOS() {
535
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
536
+ var _getDeviceInfo4 = getDeviceInfo(options),
537
+ devicePlatform = _getDeviceInfo4.devicePlatform;
538
+ return isIOS(options) || Boolean(devicePlatform && /Mac/i.test(devicePlatform));
539
+ };
540
+
541
+ var APPLE_PAY_UNSUPPORTED = 'applePayUnsupported';
542
+ var hasNativeSupportCache = null;
543
+ var sdkLoad = null;
471
544
  var requestConfig = {
472
545
  headers: {
473
546
  accept: 'application/json, text/plain, */*',
@@ -505,7 +578,7 @@ var generateApplePaymentRequestObject = function generateApplePaymentRequestObje
505
578
  merchantName = _ref.merchantName,
506
579
  interval = _ref.interval;
507
580
  return _objectSpread2({
508
- countryCode: 'NG',
581
+ countryCode: CURRENCY_COUNTRYCODE_MAPPING[currency] || COUNTRYCODE.NIGERIA,
509
582
  currencyCode: currency,
510
583
  merchantCapabilities: ['supports3DS', 'supportsCredit', 'supportsDebit'],
511
584
  supportedNetworks: ['visa', 'masterCard'],
@@ -545,12 +618,18 @@ var validateApplePaySession = function validateApplePaySession(_ref2) {
545
618
  };
546
619
  var chargeApplePay = function chargeApplePay(_ref3) {
547
620
  var transactionId = _ref3.transactionId,
621
+ accessCode = _ref3.accessCode,
548
622
  payment = _ref3.payment;
549
623
  var chargeApplePayUrl = "".concat(config.paymentBaseUrl).concat(config.applePayChargePath);
550
- var params = {
551
- transaction: transactionId,
624
+
625
+ // createFormBody would send a missing access code as the text "undefined"
626
+ var params = _objectSpread2(_objectSpread2({
627
+ transaction: transactionId
628
+ }, accessCode && {
629
+ accessCode: accessCode
630
+ }), {}, {
552
631
  paymentObject: JSON.stringify(payment)
553
- };
632
+ });
554
633
  var formBody = createFormBody(params);
555
634
  var charge = fetch(chargeApplePayUrl, _objectSpread2(_objectSpread2({}, requestConfig), {}, {
556
635
  body: formBody
@@ -561,29 +640,134 @@ var chargeApplePay = function chargeApplePay(_ref3) {
561
640
  };
562
641
  var deviceSupportsApplePay = function deviceSupportsApplePay() {
563
642
  try {
564
- return window.isSecureContext && window.ApplePaySession && window.ApplePaySession.supportsVersion(config.applePayVersion);
643
+ return Boolean(isAppleOS() && (isSafari() || isIOSWebView()) && window.isSecureContext && window.ApplePaySession && !window.ApplePaySession.isNotWebkit && window.ApplePaySession.supportsVersion(config.applePayVersion));
565
644
  } catch (error) {
566
645
  return false;
567
646
  }
568
647
  };
569
- var canUseApplePay = function canUseApplePay() {
570
- var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
571
- return deviceSupportsApplePay() && channels.includes(CHANNELS.APPLE_PAY);
648
+
649
+ /**
650
+ * Off WebKit the SDK installs its own `window.ApplePaySession` whose
651
+ * `supportsVersion()` always returns true, so native support is only
652
+ * trustworthy when read before the SDK loads.
653
+ */
654
+ var getNativeSupport = function getNativeSupport() {
655
+ if (hasNativeSupportCache === null) {
656
+ hasNativeSupportCache = deviceSupportsApplePay();
657
+ }
658
+ return hasNativeSupportCache;
659
+ };
660
+
661
+ /**
662
+ * Off WebKit the SDK assigns `window.onbeforeunload` to close its QR-code
663
+ * window, replacing any handler the merchant page set, such as an
664
+ * unsaved-changes guard. Run both, and return the merchant's result because
665
+ * that is what triggers the browser's "Leave site?" prompt.
666
+ */
667
+ var combineSdkAndMerchantBeforeUnload = function combineSdkAndMerchantBeforeUnload(merchantHandler) {
668
+ var sdkHandler = window.onbeforeunload;
669
+ if (sdkHandler === merchantHandler || typeof merchantHandler !== 'function' || typeof sdkHandler !== 'function') {
670
+ return;
671
+ }
672
+ window.onbeforeunload = function combinedBeforeUnload(event) {
673
+ var sdkResult = sdkHandler.call(window, event);
674
+ var merchantResult = merchantHandler.call(window, event);
675
+ return merchantResult !== undefined ? merchantResult : sdkResult;
676
+ };
677
+ };
678
+ var loadApplePaySDK = function loadApplePaySDK() {
679
+ if (!sdkLoad) {
680
+ var merchantBeforeUnload = window.onbeforeunload;
681
+ sdkLoad = loadScript(APPLE_PAY_SDK_SOURCE, {
682
+ integrity: APPLE_PAY_SDK_INTEGRITY_HASH
683
+ }).then(function () {
684
+ combineSdkAndMerchantBeforeUnload(merchantBeforeUnload);
685
+ return true;
686
+ }).catch(function () {
687
+ sdkLoad = null;
688
+ return false;
689
+ });
690
+ }
691
+ return sdkLoad;
572
692
  };
573
- var loadApplePay = function loadApplePay() {
574
- return loadScript(APPLE_PAY_SDK_SOURCE, {
575
- integrity: APPLE_PAY_SDK_INTEGRITY_HASH
576
- }).then(function () {
577
- /**
578
- * The Apple Pay SDK expects `window.webpackJsonp` to be array-like
579
- * but we have seen instances where that is not the case, causing the SDK to throw errors
580
- * so in this scenario, we opt out of using the SDK
581
- */
582
- if (window && !Array.isArray(window.webpackJsonp)) {
583
- throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
693
+ var probeApplePayCapabilities = function probeApplePayCapabilities(merchantId) {
694
+ return Promise.resolve().then(function () {
695
+ if (typeof window.ApplePaySession.applePayCapabilities !== 'function') {
696
+ return null;
584
697
  }
698
+ return window.ApplePaySession.applePayCapabilities(merchantId);
699
+ }).then(function (capabilities) {
700
+ return (capabilities || {}).paymentCredentialStatus || null;
701
+ }).catch(function () {
702
+ return null;
703
+ });
704
+ };
705
+ var loadThenProbe = function loadThenProbe(merchantId) {
706
+ return loadApplePaySDK().then(function (sdkLoaded) {
707
+ return (sdkLoaded ? probeApplePayCapabilities(merchantId) : Promise.resolve(null)).then(function (status) {
708
+ return {
709
+ status: status,
710
+ sdkLoaded: sdkLoaded
711
+ };
712
+ });
585
713
  });
586
714
  };
715
+ var normaliseRegisteredDomain = function normaliseRegisteredDomain(domain) {
716
+ return String(domain).toLowerCase().replace(/\/+$/, '');
717
+ };
718
+ var isPageDomainRegisteredWithApple = function isPageDomainRegisteredWithApple(registeredDomains) {
719
+ var hostname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.hostname;
720
+ return Array.isArray(registeredDomains) && registeredDomains.some(function (domain) {
721
+ return normaliseRegisteredDomain(domain) === hostname.toLowerCase();
722
+ });
723
+ };
724
+ var shouldProbe = function shouldProbe(response, merchantId, hasNativeSupport) {
725
+ var channels = response.channels || [];
726
+ var applePaySettings = response.channel_settings && response.channel_settings.apple_pay || {};
727
+ return channels.includes(CHANNELS.APPLE_PAY) && Boolean(merchantId) && (isPageDomainRegisteredWithApple(applePaySettings.domains) || hasNativeSupport);
728
+ };
729
+ var resolveApplePayStatus = function resolveApplePayStatus(response) {
730
+ try {
731
+ var safeResponse = response || {};
732
+ var hasNativeSupport = getNativeSupport();
733
+ var merchantId = safeResponse.channel_settings && safeResponse.channel_settings.apple_pay && safeResponse.channel_settings.apple_pay.merchant_identifier;
734
+ if (!shouldProbe(safeResponse, merchantId, hasNativeSupport)) {
735
+ return Promise.resolve({
736
+ status: null,
737
+ hasNativeSupport: hasNativeSupport,
738
+ sdkLoaded: false
739
+ });
740
+ }
741
+ return withTimeoutDelay(loadThenProbe(merchantId), APPLE_PAY_TIMEOUT_MS).catch(function () {
742
+ return null;
743
+ }).then(function (result) {
744
+ return {
745
+ status: result && result.status || null,
746
+ hasNativeSupport: hasNativeSupport,
747
+ sdkLoaded: Boolean(result && result.sdkLoaded)
748
+ };
749
+ });
750
+ } catch (error) {
751
+ return Promise.resolve({
752
+ status: null,
753
+ hasNativeSupport: false,
754
+ sdkLoaded: false
755
+ });
756
+ }
757
+ };
758
+ var canUseApplePay = function canUseApplePay() {
759
+ var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
760
+ var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
761
+ status = _ref4.status,
762
+ hasNativeSupport = _ref4.hasNativeSupport;
763
+ if (!channels.includes(CHANNELS.APPLE_PAY)) {
764
+ return false;
765
+ }
766
+ if (status && status !== APPLE_PAY_UNSUPPORTED) {
767
+ return true;
768
+ }
769
+ return hasNativeSupport === true;
770
+ };
587
771
 
588
772
  var getChannelAmount = function getChannelAmount(response, channel) {
589
773
  var channelFees = (response && response.channel_fees_and_amount || {})[channel];
@@ -597,25 +781,6 @@ function printDeprecationNotice(oldName, newName, extraMessage) {
597
781
  logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
598
782
  }
599
783
 
600
- var withTimeoutDelay = function withTimeoutDelay(work, delayInMilliseconds) {
601
- var onTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
602
- return null;
603
- };
604
- var timeout;
605
- var delay = new Promise(function (resolve) {
606
- timeout = setTimeout(function () {
607
- try {
608
- resolve(onTimeout());
609
- } catch (error) {
610
- resolve(null);
611
- }
612
- }, delayInMilliseconds);
613
- });
614
- return Promise.race([work, delay]).finally(function () {
615
- return clearTimeout(timeout);
616
- });
617
- };
618
-
619
784
  /**
620
785
  * Never advertised here: a `PAN_ONLY` charge comes back needing a 3DS step-up,
621
786
  * and inline-js can't handle it
@@ -1016,12 +1181,24 @@ function getMountedPaymentRequestButtons(container) {
1016
1181
  }
1017
1182
  return [getApplePayButton(container), getGooglePayButton(container)].filter(Boolean);
1018
1183
  }
1019
- function mountPaymentRequestButtons(container, _ref5) {
1020
- var transaction = _ref5.transaction,
1021
- _ref5$styles = _ref5.styles,
1022
- styles = _ref5$styles === void 0 ? {} : _ref5$styles,
1023
- onClickApplePayButton = _ref5.onClickApplePayButton,
1024
- onClickGooglePayButton = _ref5.onClickGooglePayButton;
1184
+ function mountUsableApplePayButton(container, _ref5, options) {
1185
+ var sdkLoaded = _ref5.sdkLoaded,
1186
+ hasNativeSupport = _ref5.hasNativeSupport;
1187
+ if (sdkLoaded) {
1188
+ return mountApplePayButton(container, options);
1189
+ }
1190
+ if (hasNativeSupport) {
1191
+ return mountApplePayFallbackButton(container, options);
1192
+ }
1193
+ logWarning('Apple Pay: the Apple Pay SDK did not load, so no Apple Pay button is shown.');
1194
+ return null;
1195
+ }
1196
+ function mountPaymentRequestButtons(container, _ref6) {
1197
+ var transaction = _ref6.transaction,
1198
+ _ref6$styles = _ref6.styles,
1199
+ styles = _ref6$styles === void 0 ? {} : _ref6$styles,
1200
+ onClickApplePayButton = _ref6.onClickApplePayButton,
1201
+ onClickGooglePayButton = _ref6.onClickGooglePayButton;
1025
1202
  if (!container) {
1026
1203
  return Promise.reject('Container to mount elements was not provided');
1027
1204
  }
@@ -1037,18 +1214,17 @@ function mountPaymentRequestButtons(container, _ref5) {
1037
1214
  onClick: onClickApplePayButton
1038
1215
  };
1039
1216
  var channels = transaction.response && transaction.response.channels || [];
1040
- var applePayButton = Promise.resolve(null);
1041
- if (canUseApplePay(channels)) {
1042
- applePayButton = loadApplePay().then(function () {
1043
- return mountApplePayButton(innerWrapper, applePayOptions);
1044
- }).catch(function () {
1045
- return mountApplePayFallbackButton(innerWrapper, applePayOptions);
1046
- }).catch(function () {
1047
- return null;
1048
- });
1049
- } else if (channels.includes(CHANNELS.APPLE_PAY)) {
1050
- logWarning('Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.');
1051
- }
1217
+ var applePayButton = resolveApplePayStatus(transaction.response).then(function (applePay) {
1218
+ if (canUseApplePay(channels, applePay)) {
1219
+ return mountUsableApplePayButton(innerWrapper, applePay, applePayOptions);
1220
+ }
1221
+ if (channels.includes(CHANNELS.APPLE_PAY)) {
1222
+ logWarning('Apple Pay: this device, browser or page cannot pay with Apple Pay here.');
1223
+ }
1224
+ return null;
1225
+ }).catch(function () {
1226
+ return null;
1227
+ });
1052
1228
  var googlePayButton = loadGooglePay(transaction).then(function (isReadyToPay) {
1053
1229
  if (!isReadyToPay) {
1054
1230
  return null;
@@ -1061,10 +1237,10 @@ function mountPaymentRequestButtons(container, _ref5) {
1061
1237
  }).catch(function () {
1062
1238
  return null;
1063
1239
  });
1064
- return Promise.all([applePayButton, googlePayButton]).then(function (_ref6) {
1065
- var _ref7 = _slicedToArray(_ref6, 2),
1066
- applePay = _ref7[0],
1067
- googlePay = _ref7[1];
1240
+ return Promise.all([applePayButton, googlePayButton]).then(function (_ref7) {
1241
+ var _ref8 = _slicedToArray(_ref7, 2),
1242
+ applePay = _ref8[0],
1243
+ googlePay = _ref8[1];
1068
1244
  if (!applePay && !googlePay) {
1069
1245
  return null;
1070
1246
  }
@@ -1470,27 +1646,6 @@ function buildQuery(parameters) {
1470
1646
  return formattedParameters;
1471
1647
  }
1472
1648
 
1473
- /* eslint-env browser */
1474
-
1475
- var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
1476
-
1477
- /**
1478
- * navigator.platform is deprecated and will eventually be removed
1479
- * but the recommended alternative `navigator.userAgentData` has limited browser support
1480
- * so it is used as a fallback here.
1481
- */
1482
- var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
1483
- var isIOS = function isIOS() {
1484
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1485
- platform = _ref.platform,
1486
- _ref$userAgent = _ref.userAgent,
1487
- userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
1488
- var devicePlatform = platform || DEVICE_PLATFORM;
1489
- return iOSDevices.includes(devicePlatform) ||
1490
- // iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
1491
- userAgent.includes('Mac') && 'ontouchend' in document;
1492
- };
1493
-
1494
1649
  /* eslint-env browser */
1495
1650
  var AnalyticsAPI = {
1496
1651
  saveLog: function saveLog(transactionId, merchantPublicKey, log) {
@@ -2200,19 +2355,20 @@ var Inline = /*#__PURE__*/function () {
2200
2355
  var payment = _ref3.payment;
2201
2356
  var charge = chargeApplePay({
2202
2357
  transactionId: transaction.id,
2358
+ accessCode: transaction.accessCode,
2203
2359
  payment: payment
2204
2360
  });
2205
2361
  charge.then(function (response) {
2206
2362
  transaction.logAPIResponse(response, paymentMethod);
2207
2363
  _this5.isCharging = false;
2208
2364
  if (response.status === TRANSACTION_STATUS.SUCCESS) {
2209
- applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
2365
+ applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
2210
2366
  transaction.onSuccess(response);
2211
2367
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
2212
2368
  timeSpent: transaction.getTimeSpent()
2213
2369
  }));
2214
2370
  } else {
2215
- applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2371
+ applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
2216
2372
  transaction.onSetupError(response);
2217
2373
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2218
2374
  channel: CHANNELS.APPLE_PAY,
@@ -2221,7 +2377,7 @@ var Inline = /*#__PURE__*/function () {
2221
2377
  }
2222
2378
  }).catch(function (error) {
2223
2379
  _this5.isCharging = false;
2224
- applePaySession.completePayment(applePaySession.STATUS_FAILURE);
2380
+ applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
2225
2381
  transaction.onSetupError(error);
2226
2382
  _this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
2227
2383
  channel: CHANNELS.APPLE_PAY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.27.0-dev.1",
3
+ "version": "2.27.0-dev.2",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
6
6
  "main": "lib/inline.js",