@tap-payments/apple-pay-button 0.0.3-test → 0.0.4-staging

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 (50) hide show
  1. package/README.md +204 -84
  2. package/build/@types/ApplePayButtonProps.d.ts +129 -0
  3. package/build/@types/ApplePayButtonProps.js +1 -0
  4. package/build/@types/charge.d.ts +57 -0
  5. package/build/@types/charge.js +1 -0
  6. package/build/@types/checkoutProfile.d.ts +216 -0
  7. package/build/@types/checkoutProfile.js +1 -0
  8. package/build/@types/enums.d.ts +65 -0
  9. package/build/@types/enums.js +76 -0
  10. package/build/@types/index.d.ts +6 -74
  11. package/build/@types/index.js +6 -1
  12. package/build/@types/tapLocalisation.d.ts +193 -0
  13. package/build/@types/tapLocalisation.js +1 -0
  14. package/build/@types/tapTheme.d.ts +842 -0
  15. package/build/@types/tapTheme.js +1 -0
  16. package/build/api.d.ts +29 -0
  17. package/build/api.js +244 -0
  18. package/build/constants/index.d.ts +2 -20
  19. package/build/constants/index.js +2 -20
  20. package/build/features/ApplePayButton/ApplePayButton.d.ts +4 -8
  21. package/build/features/ApplePayButton/ApplePayButton.js +30 -24
  22. package/build/features/ApplePayButton/index.d.ts +2 -2
  23. package/build/hooks/index.d.ts +1 -1
  24. package/build/hooks/index.js +1 -1
  25. package/build/hooks/useApplePay.d.ts +89 -5
  26. package/build/hooks/useApplePay.js +329 -79
  27. package/build/hooks/useMerchantApplePay.d.ts +20 -0
  28. package/build/hooks/useMerchantApplePay.js +188 -0
  29. package/build/index.d.ts +4 -4
  30. package/build/index.js +8 -5
  31. package/build/utils/config.d.ts +12 -6
  32. package/build/utils/config.js +49 -38
  33. package/build/utils/defaultValues.d.ts +2 -0
  34. package/build/utils/defaultValues.js +27 -0
  35. package/build/utils/html.d.ts +1 -3
  36. package/build/utils/html.js +4 -15
  37. package/build/utils/index.d.ts +3 -0
  38. package/build/utils/index.js +3 -0
  39. package/build/utils/theme.d.ts +12 -0
  40. package/build/utils/theme.js +61 -0
  41. package/package.json +109 -102
  42. package/build/api/app.service.d.ts +0 -11
  43. package/build/api/app.service.js +0 -217
  44. package/build/api/base.d.ts +0 -9
  45. package/build/api/base.js +0 -45
  46. package/build/api/httpClient.d.ts +0 -2
  47. package/build/api/httpClient.js +0 -16
  48. package/build/features/ApplePayButton/ApplePayButton.css +0 -51
  49. package/build/hooks/useScript.d.ts +0 -1
  50. package/build/hooks/useScript.js +0 -39
@@ -0,0 +1 @@
1
+ export {};
package/build/api.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { MerchantResponse, CheckoutProfileRequest, ChargeRequestBody, AuthorizeRequestBody } from './@types';
2
+ export declare const setAxiosGlobalHeaders: (headers: Record<string, string>) => void;
3
+ export declare const getAxiosGlobalHeaders: () => {
4
+ [x: string]: import("axios").AxiosHeaderValue | undefined;
5
+ Accept?: import("axios").AxiosHeaderValue | undefined;
6
+ "Content-Length"?: import("axios").AxiosHeaderValue | undefined;
7
+ "User-Agent"?: import("axios").AxiosHeaderValue | undefined;
8
+ "Content-Encoding"?: import("axios").AxiosHeaderValue | undefined;
9
+ Authorization?: import("axios").AxiosHeaderValue | undefined;
10
+ 'Content-Type'?: import("axios").AxiosHeaderValue | undefined;
11
+ };
12
+ declare class APPService {
13
+ setHttpHeaders(headers: Record<string, string>): Promise<void>;
14
+ setBrowserHeaders({ locale, pk, domain }: {
15
+ locale: string;
16
+ pk: string;
17
+ domain: string;
18
+ }): Promise<void>;
19
+ checkoutProfile(request: CheckoutProfileRequest): Promise<{
20
+ merchant: any;
21
+ payment_options: any;
22
+ }>;
23
+ appleSession(merchant: Pick<MerchantResponse, 'name' | 'id'>, validationURL: string, merchantRegisteredDomain: string, merchantIdentifier: string): Promise<any>;
24
+ tapTokenization(applePaymentData: Record<string, string>): Promise<any>;
25
+ createCharge(request: ChargeRequestBody): Promise<any>;
26
+ createAuthorize(request: AuthorizeRequestBody): Promise<any>;
27
+ }
28
+ declare const appService: APPService;
29
+ export default appService;
package/build/api.js ADDED
@@ -0,0 +1,244 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __rest = (this && this.__rest) || function (s, e) {
49
+ var t = {};
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
+ t[p] = s[p];
52
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
+ t[p[i]] = s[p[i]];
56
+ }
57
+ return t;
58
+ };
59
+ import BrowserInfo from '@tap-payments/browser-info';
60
+ import { MW_BASE_URL, RSA_MW_PUBLIC_KEY } from './constants';
61
+ import axios from 'axios';
62
+ import { generateApplicationHeader, rsaSetup } from '@tap-payments/acceptance-sdk';
63
+ var axiosInstance = axios.create({
64
+ baseURL: MW_BASE_URL,
65
+ headers: {
66
+ 'Content-Type': 'application/json'
67
+ }
68
+ });
69
+ export var setAxiosGlobalHeaders = function (headers) {
70
+ Object.entries(headers).forEach(function (_a) {
71
+ var key = _a[0], value = _a[1];
72
+ axiosInstance.defaults.headers.common[key] = value;
73
+ });
74
+ };
75
+ export var getAxiosGlobalHeaders = function () {
76
+ return __assign({}, axiosInstance.defaults.headers.common);
77
+ };
78
+ var APPService = (function () {
79
+ function APPService() {
80
+ }
81
+ Object.defineProperty(APPService.prototype, "setHttpHeaders", {
82
+ enumerable: false,
83
+ configurable: true,
84
+ writable: true,
85
+ value: function (headers) {
86
+ return __awaiter(this, void 0, void 0, function () {
87
+ return __generator(this, function (_a) {
88
+ setAxiosGlobalHeaders(headers);
89
+ return [2];
90
+ });
91
+ });
92
+ }
93
+ });
94
+ Object.defineProperty(APPService.prototype, "setBrowserHeaders", {
95
+ enumerable: false,
96
+ configurable: true,
97
+ writable: true,
98
+ value: function (_a) {
99
+ var locale = _a.locale, pk = _a.pk, domain = _a.domain;
100
+ return __awaiter(this, void 0, void 0, function () {
101
+ var encryptString, encryptedHeaders, mdn, authorization, rest, application;
102
+ return __generator(this, function (_b) {
103
+ switch (_b.label) {
104
+ case 0:
105
+ encryptString = rsaSetup(RSA_MW_PUBLIC_KEY);
106
+ return [4, new BrowserInfo.BrowserInfo({
107
+ app: { name: '@tap-payments/apple-pay-button', language: locale },
108
+ credentials: { mdn: domain, pk: pk },
109
+ encrypt: function (_key, value) { return encryptString(value.substring(0, 115)); }
110
+ }).get()];
111
+ case 1:
112
+ encryptedHeaders = _b.sent();
113
+ mdn = encryptedHeaders.mdn, authorization = encryptedHeaders.authorization, rest = __rest(encryptedHeaders, ["mdn", "authorization"]);
114
+ application = generateApplicationHeader(rest);
115
+ setAxiosGlobalHeaders({
116
+ authorization: pk,
117
+ mdn: mdn,
118
+ application: application
119
+ });
120
+ return [2];
121
+ }
122
+ });
123
+ });
124
+ }
125
+ });
126
+ Object.defineProperty(APPService.prototype, "checkoutProfile", {
127
+ enumerable: false,
128
+ configurable: true,
129
+ writable: true,
130
+ value: function (request) {
131
+ return __awaiter(this, void 0, void 0, function () {
132
+ var data, merchant, payment_options, session;
133
+ return __generator(this, function (_a) {
134
+ switch (_a.label) {
135
+ case 0: return [4, axiosInstance.post('/checkoutprofile', request)];
136
+ case 1:
137
+ data = (_a.sent()).data;
138
+ if (data.errors)
139
+ throw data;
140
+ merchant = data.merchant, payment_options = data.payment_options, session = data.session;
141
+ setAxiosGlobalHeaders({ session: session });
142
+ return [2, { merchant: merchant, payment_options: payment_options }];
143
+ }
144
+ });
145
+ });
146
+ }
147
+ });
148
+ Object.defineProperty(APPService.prototype, "appleSession", {
149
+ enumerable: false,
150
+ configurable: true,
151
+ writable: true,
152
+ value: function (merchant, validationURL, merchantRegisteredDomain, merchantIdentifier) {
153
+ return __awaiter(this, void 0, void 0, function () {
154
+ var body, data;
155
+ return __generator(this, function (_a) {
156
+ switch (_a.label) {
157
+ case 0:
158
+ body = {
159
+ validationUrl: validationURL,
160
+ origin: merchantRegisteredDomain,
161
+ merchantIdentifier: merchantIdentifier,
162
+ merchantId: merchant.id,
163
+ merchantName: merchant.name
164
+ };
165
+ return [4, axiosInstance.post('/validatemerchant', body)];
166
+ case 1:
167
+ data = (_a.sent()).data;
168
+ if (data.errors)
169
+ throw data;
170
+ return [2, data];
171
+ }
172
+ });
173
+ });
174
+ }
175
+ });
176
+ Object.defineProperty(APPService.prototype, "tapTokenization", {
177
+ enumerable: false,
178
+ configurable: true,
179
+ writable: true,
180
+ value: function (applePaymentData) {
181
+ return __awaiter(this, void 0, void 0, function () {
182
+ var body, data;
183
+ return __generator(this, function (_a) {
184
+ switch (_a.label) {
185
+ case 0:
186
+ body = {
187
+ type: 'applepay',
188
+ token_data: applePaymentData
189
+ };
190
+ return [4, axiosInstance.post('/token', body)];
191
+ case 1:
192
+ data = (_a.sent()).data;
193
+ if (data.errors)
194
+ throw data;
195
+ return [2, data];
196
+ }
197
+ });
198
+ });
199
+ }
200
+ });
201
+ Object.defineProperty(APPService.prototype, "createCharge", {
202
+ enumerable: false,
203
+ configurable: true,
204
+ writable: true,
205
+ value: function (request) {
206
+ return __awaiter(this, void 0, void 0, function () {
207
+ var data;
208
+ return __generator(this, function (_a) {
209
+ switch (_a.label) {
210
+ case 0: return [4, axiosInstance.post('/charge', request)];
211
+ case 1:
212
+ data = (_a.sent()).data;
213
+ if (data.errors)
214
+ throw data;
215
+ return [2, data];
216
+ }
217
+ });
218
+ });
219
+ }
220
+ });
221
+ Object.defineProperty(APPService.prototype, "createAuthorize", {
222
+ enumerable: false,
223
+ configurable: true,
224
+ writable: true,
225
+ value: function (request) {
226
+ return __awaiter(this, void 0, void 0, function () {
227
+ var data;
228
+ return __generator(this, function (_a) {
229
+ switch (_a.label) {
230
+ case 0: return [4, axiosInstance.post('/authorize', request)];
231
+ case 1:
232
+ data = (_a.sent()).data;
233
+ if (data.errors)
234
+ throw data;
235
+ return [2, data];
236
+ }
237
+ });
238
+ });
239
+ }
240
+ });
241
+ return APPService;
242
+ }());
243
+ var appService = new APPService();
244
+ export default appService;
@@ -1,21 +1,3 @@
1
- export declare const Scope: {
2
- readonly AppleToken: "AppleToken";
3
- readonly TapToken: "TapToken";
4
- };
5
- export declare const ButtonStyle: {
6
- readonly Black: "black";
7
- readonly White: "white";
8
- readonly WhiteOutline: "whiteOutline";
9
- };
10
- export declare const MerchantCapabilities: {
11
- readonly Supports3DS: "supports3DS";
12
- readonly SupportsCredit: "supportsCredit";
13
- readonly SupportsDebit: "supportsDebit";
14
- };
15
- export declare const SupportedNetworks: {
16
- readonly Amex: "amex";
17
- readonly Mada: "mada";
18
- readonly MasterCard: "masterCard";
19
- readonly Visa: "visa";
20
- };
21
1
  export declare const ApplePayVersion = 5;
2
+ export declare const RSA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
3
+ export declare const MW_BASE_URL = "https://mw-sdk.staging.tap.company/v2/checkout";
@@ -1,21 +1,3 @@
1
- export var Scope = {
2
- AppleToken: 'AppleToken',
3
- TapToken: 'TapToken'
4
- };
5
- export var ButtonStyle = {
6
- Black: 'black',
7
- White: 'white',
8
- WhiteOutline: 'whiteOutline'
9
- };
10
- export var MerchantCapabilities = {
11
- Supports3DS: 'supports3DS',
12
- SupportsCredit: 'supportsCredit',
13
- SupportsDebit: 'supportsDebit'
14
- };
15
- export var SupportedNetworks = {
16
- Amex: 'amex',
17
- Mada: 'mada',
18
- MasterCard: 'masterCard',
19
- Visa: 'visa'
20
- };
21
1
  export var ApplePayVersion = 5;
2
+ export var RSA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
3
+ export var MW_BASE_URL = 'https://mw-sdk.staging.tap.company/v2/checkout';
@@ -1,8 +1,4 @@
1
- /// <reference types="react" />
2
- import { ApplePayButtonProps } from '../../@types';
3
- import './ApplePayButton.css';
4
- export type { ApplePayButtonProps };
5
- export declare function ApplePayButton(props: ApplePayButtonProps): JSX.Element;
6
- export declare function renderApplePayButton(config: ApplePayButtonProps, elementId: string): {
7
- unmount: () => void;
8
- };
1
+ import { ApplePayButtonProps, ApplePayRequestData } from '../../@types';
2
+ export type { ApplePayButtonProps, ApplePayRequestData };
3
+ export declare function ApplePayButton(props: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare const renderApplePayButton: (props: ApplePayButtonProps, elementId: string) => any;
@@ -10,34 +10,40 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import React from 'react';
13
+ import * as React from 'react';
14
14
  import { createRoot } from 'react-dom/client';
15
- import { createElementAndInject } from '../../utils';
15
+ import { findOrCreateElementAndInject } from '../../utils';
16
16
  import { useApplePay } from '../../hooks/useApplePay';
17
- import { ButtonStyle, Scope } from '../../constants';
18
- import './ApplePayButton.css';
19
- var ApplePay = React.memo(function (_a) {
20
- var publicKey = _a.publicKey, merchant = _a.merchant, transaction = _a.transaction, billingContact = _a.billingContact, supportedNetworks = _a.supportedNetworks, onCancel = _a.onCancel, onError = _a.onError, onSuccess = _a.onSuccess, _b = _a.scope, scope = _b === void 0 ? Scope.TapToken : _b, _c = _a.buttonStyle, buttonStyle = _c === void 0 ? ButtonStyle.WhiteOutline : _c;
21
- var _d = useApplePay({
22
- publicKey: publicKey,
23
- merchant: merchant,
24
- transaction: transaction,
25
- billingContact: billingContact,
26
- supportedNetworks: supportedNetworks,
27
- onCancel: onCancel,
28
- onError: onError,
29
- onSuccess: onSuccess,
30
- scope: scope
31
- }), loading = _d.loading, onApplePayButtonClicked = _d.onApplePayButtonClicked, disabled = _d.disabled;
32
- return (_jsx("button", __assign({ className: "button-applepay-tap ".concat(buttonStyle), onClick: onApplePayButtonClicked, disabled: loading || disabled }, { children: _jsx("div", __assign({ className: 'img-container' }, { children: _jsx("img", { loading: 'eager', src: 'https://back-end.b-cdn.net/payment_methods/apple_pay.svg' }) })) })));
17
+ import { Locale, PayButton } from '@tap-payments/acceptance-sdk';
18
+ var ApplePay = React.memo(function (props) {
19
+ var _a, _b, _c;
20
+ var _d = useApplePay({ buttonProps: props }), onClick = _d.onClick, initialLoading = _d.initialLoading, mappedProps = _d.mappedProps, theme = _d.theme, isRounded = _d.isRounded, success = _d.success, error = _d.error, applePayPaymentMethodOptions = _d.applePayPaymentMethodOptions, profileData = _d.profileData;
21
+ React.useEffect(function () {
22
+ if (props.debug) {
23
+ console.log('ApplePayButtonProps', props);
24
+ }
25
+ }, []);
26
+ return (_jsx("div", __assign({ style: {
27
+ width: '100%',
28
+ display: 'flex',
29
+ justifyContent: 'center'
30
+ } }, { children: _jsx(PayButton, { shimmerLoader: !profileData || initialLoading || !applePayPaymentMethodOptions, locale: ((_a = mappedProps.interface) === null || _a === void 0 ? void 0 : _a.locale) || Locale.EN, theme: theme, edges: (_b = mappedProps.interface) === null || _b === void 0 ? void 0 : _b.edges, colorStyle: (_c = mappedProps.interface) === null || _c === void 0 ? void 0 : _c.colorStyle, isFailed: error, isRounded: isRounded, isSuccess: success, onClick: onClick, buttonStyle: applePayPaymentMethodOptions === null || applePayPaymentMethodOptions === void 0 ? void 0 : applePayPaymentMethodOptions.button_style }) })));
33
31
  });
34
32
  export function ApplePayButton(props) {
35
33
  return _jsx(ApplePay, __assign({}, props));
36
34
  }
37
- export function renderApplePayButton(config, elementId) {
38
- var el = createElementAndInject(elementId);
35
+ var tapConnectInstance = null;
36
+ export var renderApplePayButton = function (props, elementId) {
37
+ if (tapConnectInstance) {
38
+ return tapConnectInstance;
39
+ }
40
+ var el = findOrCreateElementAndInject(elementId);
39
41
  var root = createRoot(el);
40
- root.render(_jsx(ApplePay, __assign({}, config)));
41
- var unmount = function () { return root.unmount(); };
42
- return { unmount: unmount };
43
- }
42
+ root.render(_jsx(ApplePayButton, __assign({}, props)));
43
+ var unmount = function () {
44
+ root.unmount();
45
+ tapConnectInstance = null;
46
+ };
47
+ tapConnectInstance = { unmount: unmount };
48
+ return tapConnectInstance;
49
+ };
@@ -1,3 +1,3 @@
1
- import { ApplePayButtonProps, ApplePayButton, renderApplePayButton } from './ApplePayButton';
1
+ import { ApplePayButtonProps, ApplePayButton, renderApplePayButton, ApplePayRequestData } from './ApplePayButton';
2
2
  export { ApplePayButton, renderApplePayButton };
3
- export type { ApplePayButtonProps };
3
+ export type { ApplePayButtonProps, ApplePayRequestData };
@@ -1 +1 @@
1
- export * from './useScript';
1
+ export * from './useApplePay';
@@ -1 +1 @@
1
- export * from './useScript';
1
+ export * from './useApplePay';
@@ -1,9 +1,93 @@
1
- import { ApplePayButtonProps } from '../@types';
2
- declare type UseApplePayProps = Omit<ApplePayButtonProps, 'buttonStyle'>;
3
- interface UseApplePayReturnProps {
1
+ import { ApplePayButtonProps, ApplePayDataToLunchSDKFromMerchantSide, ApplePayRequestData, MetaData, Scope } from '../@types';
2
+ interface UsaApplePayProps {
3
+ buttonProps: ApplePayButtonProps;
4
+ }
5
+ export declare const useApplePay: ({ buttonProps }: UsaApplePayProps) => {
6
+ onClick: () => void;
4
7
  loading: boolean;
8
+ isIframeIntegration: boolean;
5
9
  onApplePayButtonClicked: () => Promise<void>;
6
10
  disabled: boolean;
7
- }
8
- export declare const useApplePay: ({ publicKey, merchant, transaction, billingContact, onCancel, onError, onSuccess, scope, supportedNetworks }: UseApplePayProps) => UseApplePayReturnProps;
11
+ applePayRequestData: ApplePayRequestData | undefined;
12
+ applePayRequestConfiguration: Omit<ApplePayDataToLunchSDKFromMerchantSide, "applePayRequestData"> | undefined;
13
+ mappedProps: {
14
+ interface: {
15
+ locale?: import("@tap-payments/acceptance-sdk").Locale | undefined;
16
+ theme?: import("@tap-payments/acceptance-sdk").ThemeMode | undefined;
17
+ edges?: import("@tap-payments/acceptance-sdk").Edges | undefined;
18
+ colorStyle?: import("@tap-payments/acceptance-sdk").ColorStyle | undefined;
19
+ loader?: boolean | undefined;
20
+ userExperience?: "popup" | "page" | undefined;
21
+ powered?: boolean | undefined;
22
+ direction?: import("@tap-payments/acceptance-sdk").Direction | undefined;
23
+ cardDirection?: import("@tap-payments/acceptance-sdk").Direction | undefined;
24
+ } | undefined;
25
+ operator: {
26
+ publicKey: string;
27
+ hashstring?: string | undefined;
28
+ };
29
+ merchant: {
30
+ id: string;
31
+ identifier?: string | undefined;
32
+ };
33
+ scope: Scope;
34
+ customer?: import("../@types").Customer | undefined;
35
+ acceptance?: import("../@types").Acceptance | undefined;
36
+ transaction?: {
37
+ authentication?: boolean | undefined;
38
+ authorize?: {
39
+ auto: {
40
+ type: string;
41
+ time: number;
42
+ };
43
+ } | undefined;
44
+ metadata?: Record<string, string> | undefined;
45
+ reference?: string | undefined;
46
+ paymentAgreement?: {
47
+ id: string;
48
+ contract?: {
49
+ id: string;
50
+ } | undefined;
51
+ } | undefined;
52
+ destinations?: Record<string, any> | undefined;
53
+ } | undefined;
54
+ invoice?: {
55
+ id: string;
56
+ } | undefined;
57
+ order: {
58
+ amount: number;
59
+ currency: string;
60
+ id?: string | undefined;
61
+ description?: string | undefined;
62
+ metadata?: Record<string, string> | undefined;
63
+ reference?: string | undefined;
64
+ };
65
+ post?: {
66
+ url: string;
67
+ } | undefined;
68
+ redirect?: {
69
+ url: string;
70
+ } | undefined;
71
+ onOrderCreated?: ((orderId: string) => void) | undefined;
72
+ onCancel?: (() => void) | undefined;
73
+ onError?: ((error: any) => void) | undefined;
74
+ onSuccess?: ((data: Record<string, any>) => Promise<void>) | undefined;
75
+ onClick?: ((data?: ApplePayDataToLunchSDKFromMerchantSide | undefined) => void) | undefined;
76
+ onReady?: (() => void) | undefined;
77
+ metaData?: MetaData | undefined;
78
+ debug?: boolean | undefined;
79
+ integration?: "iframe" | "sdk" | "webview" | undefined;
80
+ headers?: {
81
+ mdn: string;
82
+ application: string;
83
+ } | undefined;
84
+ };
85
+ theme: import("../@types").ThemeMode;
86
+ initialLoading: boolean;
87
+ isRounded: boolean;
88
+ success: boolean;
89
+ error: boolean;
90
+ applePayPaymentMethodOptions: import("../@types").PaymentMethod | null;
91
+ profileData: Pick<MetaData, "merchant" | "payment_options"> | undefined;
92
+ };
9
93
  export {};