@tap-payments/apple-pay-button 0.0.47-development → 0.0.49-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.
@@ -14,20 +14,6 @@ declare class APPService extends BaseService {
14
14
  pk: string;
15
15
  domain: string;
16
16
  }): Promise<void>;
17
- getHttpHeaders(): Promise<{
18
- [x: string]: (string | number | boolean | string[] | import("axios").AxiosHeaders | null) | undefined;
19
- head?: import("axios").AxiosHeaders | undefined;
20
- link?: import("axios").AxiosHeaders | undefined;
21
- get?: import("axios").AxiosHeaders | undefined;
22
- delete?: import("axios").AxiosHeaders | undefined;
23
- options?: import("axios").AxiosHeaders | undefined;
24
- post?: import("axios").AxiosHeaders | undefined;
25
- put?: import("axios").AxiosHeaders | undefined;
26
- patch?: import("axios").AxiosHeaders | undefined;
27
- purge?: import("axios").AxiosHeaders | undefined;
28
- unlink?: import("axios").AxiosHeaders | undefined;
29
- common?: import("axios").AxiosHeaders | undefined;
30
- }>;
31
17
  checkoutProfile(request: CheckoutProfileRequest): Promise<{
32
18
  merchant: any;
33
19
  payment_options: any;
@@ -13,17 +13,6 @@ var __extends = (this && this.__extends) || (function () {
13
13
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
14
  };
15
15
  })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
16
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
28
17
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29
18
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -204,18 +193,6 @@ var APPService = (function (_super) {
204
193
  });
205
194
  }
206
195
  });
207
- Object.defineProperty(APPService.prototype, "getHttpHeaders", {
208
- enumerable: false,
209
- configurable: true,
210
- writable: true,
211
- value: function () {
212
- return __awaiter(this, void 0, void 0, function () {
213
- return __generator(this, function (_a) {
214
- return [2, __assign({}, httpClient.defaults.headers.common)];
215
- });
216
- });
217
- }
218
- });
219
196
  Object.defineProperty(APPService.prototype, "checkoutProfile", {
220
197
  enumerable: false,
221
198
  configurable: true,
@@ -5,4 +5,18 @@ export declare const MW_BASE_BETA_URL = "https://mw-sdk.beta.tap.company/v2/chec
5
5
  export declare const MW_BASE_SANDBOX_URL = "https://mw-sdk.sandbox.tap.company/v2/checkout";
6
6
  declare const httpClient: import("axios").AxiosInstance;
7
7
  export declare const setAxiosGlobalHeaders: (headers: Record<string, string>) => void;
8
+ export declare const getAxiosGlobalHeaders: () => {
9
+ [x: string]: (string | number | boolean | string[] | import("axios").AxiosHeaders | null) | undefined;
10
+ head?: import("axios").AxiosHeaders | undefined;
11
+ link?: import("axios").AxiosHeaders | undefined;
12
+ get?: import("axios").AxiosHeaders | undefined;
13
+ delete?: import("axios").AxiosHeaders | undefined;
14
+ options?: import("axios").AxiosHeaders | undefined;
15
+ post?: import("axios").AxiosHeaders | undefined;
16
+ put?: import("axios").AxiosHeaders | undefined;
17
+ patch?: import("axios").AxiosHeaders | undefined;
18
+ purge?: import("axios").AxiosHeaders | undefined;
19
+ unlink?: import("axios").AxiosHeaders | undefined;
20
+ common?: import("axios").AxiosHeaders | undefined;
21
+ };
8
22
  export default httpClient;
@@ -30,4 +30,7 @@ httpClient.interceptors.response.use(function (response) {
30
30
  export var setAxiosGlobalHeaders = function (headers) {
31
31
  httpClient.defaults.headers.common = __assign(__assign({}, httpClient.defaults.headers.common), headers);
32
32
  };
33
+ export var getAxiosGlobalHeaders = function () {
34
+ return __assign({}, httpClient.defaults.headers.common);
35
+ };
33
36
  export default httpClient;
@@ -48,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  import { useCallback, useEffect, useState } from 'react';
49
49
  import appService from '../api/app.service';
50
50
  import { ApplePayVersion, Scope } from '../constants';
51
- import { setAxiosGlobalHeaders } from '../api/httpClient';
51
+ import { getAxiosGlobalHeaders, setAxiosGlobalHeaders } from '../api/httpClient';
52
52
  import { getApplePayPaymentMethod, getApplePayRequest, validateSupportedNetworks } from '../utils/config';
53
53
  import { getMerchantCapabilities } from '../utils/defaultValues';
54
54
  export var useApplePay = function (_a) {
@@ -78,7 +78,6 @@ export var useApplePay = function (_a) {
78
78
  return __generator(this, function (_m) {
79
79
  switch (_m.label) {
80
80
  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
81
  setLoading(true);
83
82
  appService.setEnv(environment);
84
83
  appService.setBaseUrl();
@@ -143,7 +142,7 @@ export var useApplePay = function (_a) {
143
142
  onOrderCreated === null || onOrderCreated === void 0 ? void 0 : onOrderCreated((_l = (_k = data.payment_options) === null || _k === void 0 ? void 0 : _k.order) === null || _l === void 0 ? void 0 : _l.id);
144
143
  setApplePayRequestConfiguration({
145
144
  BASE_URL: appService.getBaseUrl(),
146
- headers: __assign({}, appService.getHttpHeaders()),
145
+ headers: getAxiosGlobalHeaders(),
147
146
  merchant: data.merchant
148
147
  });
149
148
  return [3, 9];
@@ -304,6 +303,8 @@ export var useApplePay = function (_a) {
304
303
  return [2];
305
304
  });
306
305
  }); };
306
+ if (debug)
307
+ console.log('useApplePay return hooks', { loading: loading, disabled: disabled, applePayRequestData: applePayRequestData, applePayRequestConfiguration: applePayRequestConfiguration });
307
308
  return {
308
309
  loading: loading,
309
310
  onApplePayButtonClicked: onApplePayButtonClicked,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/apple-pay-button",
3
- "version": "0.0.47-development",
3
+ "version": "0.0.49-development",
4
4
  "description": "Apple Pay Button React Component",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",