@tap-payments/apple-pay-button 0.0.48-development → 0.0.50-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,15 +72,16 @@ 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) {
79
83
  switch (_m.label) {
80
84
  case 0:
81
- console.log('environment, interfaceObj?.locale, order, customer, merchant, scope', environment, interfaceObj === null || interfaceObj === void 0 ? void 0 : interfaceObj.locale, order, customer, merchant, scope);
82
85
  setLoading(true);
83
86
  appService.setEnv(environment);
84
87
  appService.setBaseUrl();
@@ -158,10 +161,10 @@ export var useApplePay = function (_a) {
158
161
  case 9: return [2];
159
162
  }
160
163
  });
161
- }); }, [environment, interfaceObj === null || interfaceObj === void 0 ? void 0 : interfaceObj.locale, order, customer, merchant, scope, debug, onError, onReady, onOrderCreated]);
164
+ }); };
162
165
  useEffect(function () {
163
166
  initialize(metaData);
164
- }, [initialize, metaData]);
167
+ }, []);
165
168
  var onApplePayButtonClicked = function () { return __awaiter(void 0, void 0, void 0, function () {
166
169
  var ApplePaySession, session_1;
167
170
  var _a;
@@ -304,6 +307,8 @@ export var useApplePay = function (_a) {
304
307
  return [2];
305
308
  });
306
309
  }); };
310
+ if (debug)
311
+ console.log('useApplePay return hooks', { loading: loading, disabled: disabled, applePayRequestData: applePayRequestData, applePayRequestConfiguration: applePayRequestConfiguration });
307
312
  return {
308
313
  loading: loading,
309
314
  onApplePayButtonClicked: onApplePayButtonClicked,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/apple-pay-button",
3
- "version": "0.0.48-development",
3
+ "version": "0.0.50-development",
4
4
  "description": "Apple Pay Button React Component",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",