@tap-payments/apple-pay-button 0.0.49-development → 0.0.51-development

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.
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
- import { useCallback, useEffect, useState } from 'react';
48
+ import { useEffect, useState } from 'react';
49
49
  import appService from '../api/app.service';
50
50
  import { ApplePayVersion, Scope } from '../constants';
51
51
  import { getAxiosGlobalHeaders, setAxiosGlobalHeaders } from '../api/httpClient';
@@ -61,6 +61,8 @@ export var useApplePay = function (_a) {
61
61
  var prepareApplePayRequest = function (_a) {
62
62
  var payment_options = _a.payment_options, merchant = _a.merchant;
63
63
  var paymentMethod = getApplePayPaymentMethod(payment_options.payment_methods || []);
64
+ if (debug)
65
+ console.log('payment method: ', paymentMethod);
64
66
  var supportedNetworks = validateSupportedNetworks(paymentMethod.supported_card_brands, acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedSchemes);
65
67
  var request = getApplePayRequest({
66
68
  countryCode: merchant.country_code,
@@ -70,9 +72,11 @@ export var useApplePay = function (_a) {
70
72
  merchantCapabilities: getMerchantCapabilities(acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedFundSource),
71
73
  name: merchant.name
72
74
  });
75
+ if (debug)
76
+ console.log('apple pay request data: ', request);
73
77
  setApplePayRequestData(request);
74
78
  };
75
- var initialize = useCallback(function (metaData) { return __awaiter(void 0, void 0, void 0, function () {
79
+ var initialize = function (metaData) { return __awaiter(void 0, void 0, void 0, function () {
76
80
  var merchantProfile, payment_options, headers_1, data, err_1;
77
81
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
78
82
  return __generator(this, function (_m) {
@@ -149,6 +153,7 @@ export var useApplePay = function (_a) {
149
153
  case 7:
150
154
  err_1 = _m.sent();
151
155
  onError === null || onError === void 0 ? void 0 : onError(err_1.errors || err_1);
156
+ console.log('error in initialize', err_1);
152
157
  return [3, 9];
153
158
  case 8:
154
159
  setLoading(false);
@@ -157,10 +162,10 @@ export var useApplePay = function (_a) {
157
162
  case 9: return [2];
158
163
  }
159
164
  });
160
- }); }, [environment, interfaceObj === null || interfaceObj === void 0 ? void 0 : interfaceObj.locale, order, customer, merchant, scope, debug, onError, onReady, onOrderCreated]);
165
+ }); };
161
166
  useEffect(function () {
162
167
  initialize(metaData);
163
- }, [initialize, metaData]);
168
+ }, []);
164
169
  var onApplePayButtonClicked = function () { return __awaiter(void 0, void 0, void 0, function () {
165
170
  var ApplePaySession, session_1;
166
171
  var _a;
@@ -1,5 +1,6 @@
1
1
  import { JSEncrypt } from 'jsencrypt';
2
2
  export var validateSupportedNetworks = function (supportedNetworksOptions, merchantSupportedNetworks) {
3
+ console.log('supportedNetworksOptions', supportedNetworksOptions, 'merchantSupportedNetworks', merchantSupportedNetworks);
3
4
  var toLowerCase = function (item) { return item.toLowerCase(); };
4
5
  if (!supportedNetworksOptions)
5
6
  throw new Error("There is no supported networks available in your acceptance object");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/apple-pay-button",
3
- "version": "0.0.49-development",
3
+ "version": "0.0.51-development",
4
4
  "description": "Apple Pay Button React Component",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",