@tap-payments/apple-pay-button 0.0.37-development → 0.0.37-test

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 (48) hide show
  1. package/build/@types/ApplePayButtonProps.d.ts +129 -0
  2. package/build/@types/ApplePayButtonProps.js +1 -0
  3. package/build/@types/charge.d.ts +57 -0
  4. package/build/@types/charge.js +1 -0
  5. package/build/@types/checkoutProfile.d.ts +195 -0
  6. package/build/@types/checkoutProfile.js +1 -0
  7. package/build/@types/enums.d.ts +65 -0
  8. package/build/@types/enums.js +76 -0
  9. package/build/@types/index.d.ts +6 -122
  10. package/build/@types/index.js +6 -1
  11. package/build/@types/tapLocalisation.d.ts +193 -0
  12. package/build/@types/tapLocalisation.js +1 -0
  13. package/build/@types/tapTheme.d.ts +842 -0
  14. package/build/@types/tapTheme.js +1 -0
  15. package/build/api.d.ts +29 -0
  16. package/build/{api/app.service.js → api.js} +87 -95
  17. package/build/constants/index.d.ts +2 -58
  18. package/build/constants/index.js +2 -58
  19. package/build/features/ApplePayButton/ApplePayButton.d.ts +3 -5
  20. package/build/features/ApplePayButton/ApplePayButton.js +8 -14
  21. package/build/features/ApplePayButton/index.d.ts +2 -2
  22. package/build/hooks/index.d.ts +0 -2
  23. package/build/hooks/index.js +0 -2
  24. package/build/hooks/useApplePay.d.ts +89 -5
  25. package/build/hooks/useApplePay.js +289 -117
  26. package/build/hooks/useMerchantApplePay.d.ts +20 -0
  27. package/build/hooks/useMerchantApplePay.js +176 -0
  28. package/build/index.d.ts +4 -6
  29. package/build/index.js +3 -9
  30. package/build/utils/config.d.ts +10 -9
  31. package/build/utils/config.js +40 -47
  32. package/build/utils/defaultValues.d.ts +2 -30
  33. package/build/utils/defaultValues.js +10 -31
  34. package/build/utils/index.d.ts +3 -0
  35. package/build/utils/index.js +3 -0
  36. package/build/utils/theme.d.ts +12 -0
  37. package/build/utils/theme.js +61 -0
  38. package/package.json +16 -11
  39. package/build/api/app.service.d.ts +0 -23
  40. package/build/api/base.d.ts +0 -9
  41. package/build/api/base.js +0 -45
  42. package/build/api/httpClient.d.ts +0 -8
  43. package/build/api/httpClient.js +0 -33
  44. package/build/features/ApplePayButton/ApplePayButton.css +0 -21
  45. package/build/hooks/useApplePayFromMerchantSide.d.ts +0 -11
  46. package/build/hooks/useApplePayFromMerchantSide.js +0 -177
  47. package/build/hooks/useScript.d.ts +0 -1
  48. 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, identifier: 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;
@@ -1,18 +1,14 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
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;
14
9
  };
15
- })();
10
+ return __assign.apply(this, arguments);
11
+ };
16
12
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
13
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
14
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -28,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
28
24
  function verb(n) { return function (v) { return step([n, v]); }; }
29
25
  function step(op) {
30
26
  if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
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;
33
29
  if (y = 0, t) op = [op[0] & 2, t.value];
34
30
  switch (op[0]) {
@@ -60,84 +56,39 @@ var __rest = (this && this.__rest) || function (s, e) {
60
56
  }
61
57
  return t;
62
58
  };
63
- import BaseService from './base';
64
- import httpClient, { setAxiosGlobalHeaders, MW_BASE_BETA_URL, MW_BASE_DEV_URL, MW_BASE_LIVE_URL, MW_BASE_STAGING_URL, MW_BASE_SANDBOX_URL } from './httpClient';
65
59
  import BrowserInfo from '@tap-payments/browser-info';
66
- import { generateApplicationHeader, rsaSetup } from '../utils/config';
67
- import { RSA_BETA_MW_PUBLIC_KEY, RSA_DEV_MW_PUBLIC_KEY, RSA_PRODUCTION_MW_PUBLIC_KEY, RSA_SANDBOX_MW_PUBLIC_KEY, RSA_STAGING_MW_PUBLIC_KEY } from '../constants';
68
- var APPService = (function (_super) {
69
- __extends(APPService, _super);
70
- function APPService() {
71
- var _this = _super.call(this, httpClient) || this;
72
- Object.defineProperty(_this, "baseUrl", {
73
- enumerable: true,
74
- configurable: true,
75
- writable: true,
76
- value: void 0
77
- });
78
- Object.defineProperty(_this, "env", {
79
- enumerable: true,
80
- configurable: true,
81
- writable: true,
82
- value: void 0
83
- });
84
- _this.baseUrl = MW_BASE_LIVE_URL;
85
- _this.env = 'production';
86
- return _this;
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'
87
67
  }
88
- Object.defineProperty(APPService.prototype, "setEnv", {
89
- enumerable: false,
90
- configurable: true,
91
- writable: true,
92
- value: function (env) {
93
- this.env = env;
94
- }
95
- });
96
- Object.defineProperty(APPService.prototype, "setBaseUrl", {
97
- enumerable: false,
98
- configurable: true,
99
- writable: true,
100
- value: function () {
101
- if (!this.env)
102
- throw new Error('Environment is not set');
103
- switch (this.env) {
104
- case 'staging':
105
- this.baseUrl = MW_BASE_STAGING_URL;
106
- break;
107
- case 'beta':
108
- this.baseUrl = MW_BASE_BETA_URL;
109
- break;
110
- case 'development':
111
- this.baseUrl = MW_BASE_DEV_URL;
112
- break;
113
- case 'sandbox':
114
- this.baseUrl = MW_BASE_SANDBOX_URL;
115
- break;
116
- default:
117
- this.baseUrl = MW_BASE_LIVE_URL;
118
- break;
119
- }
120
- }
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;
121
73
  });
122
- Object.defineProperty(APPService.prototype, "getHeaderPublicKey", {
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", {
123
82
  enumerable: false,
124
83
  configurable: true,
125
84
  writable: true,
126
- value: function () {
127
- if (!this.env)
128
- throw new Error('Environment is not set');
129
- switch (this.env) {
130
- case 'staging':
131
- return RSA_STAGING_MW_PUBLIC_KEY;
132
- case 'beta':
133
- return RSA_BETA_MW_PUBLIC_KEY;
134
- case 'development':
135
- return RSA_DEV_MW_PUBLIC_KEY;
136
- case 'sandbox':
137
- return RSA_SANDBOX_MW_PUBLIC_KEY;
138
- default:
139
- return RSA_PRODUCTION_MW_PUBLIC_KEY;
140
- }
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
+ });
141
92
  }
142
93
  });
143
94
  Object.defineProperty(APPService.prototype, "setBrowserHeaders", {
@@ -151,7 +102,7 @@ var APPService = (function (_super) {
151
102
  return __generator(this, function (_b) {
152
103
  switch (_b.label) {
153
104
  case 0:
154
- encryptString = rsaSetup(this.getHeaderPublicKey());
105
+ encryptString = rsaSetup(RSA_MW_PUBLIC_KEY);
155
106
  return [4, new BrowserInfo.BrowserInfo({
156
107
  app: { name: '@tap-payments/apple-pay-button', language: locale },
157
108
  credentials: { mdn: domain, pk: pk },
@@ -181,7 +132,7 @@ var APPService = (function (_super) {
181
132
  var data, merchant, payment_options, session;
182
133
  return __generator(this, function (_a) {
183
134
  switch (_a.label) {
184
- case 0: return [4, this.post(this.baseUrl + '/checkoutprofile', request)];
135
+ case 0: return [4, axiosInstance.post('/checkoutprofile', request)];
185
136
  case 1:
186
137
  data = (_a.sent()).data;
187
138
  if (data.errors)
@@ -198,7 +149,7 @@ var APPService = (function (_super) {
198
149
  enumerable: false,
199
150
  configurable: true,
200
151
  writable: true,
201
- value: function (merchant, validationURL, merchantRegisteredDomain) {
152
+ value: function (merchant, validationURL, merchantRegisteredDomain, merchantIdentifier, identifier) {
202
153
  return __awaiter(this, void 0, void 0, function () {
203
154
  var body, data;
204
155
  return __generator(this, function (_a) {
@@ -207,11 +158,12 @@ var APPService = (function (_super) {
207
158
  body = {
208
159
  validationUrl: validationURL,
209
160
  origin: merchantRegisteredDomain,
210
- merchantIdentifier: merchantRegisteredDomain,
161
+ merchantIdentifier: merchantIdentifier,
211
162
  merchantId: merchant.id,
212
- merchantName: merchant.name
163
+ merchantName: merchant.name,
164
+ identifier: identifier
213
165
  };
214
- return [4, this.post(this.baseUrl + '/validatemerchant', body)];
166
+ return [4, axiosInstance.post('/validatemerchant', body)];
215
167
  case 1:
216
168
  data = (_a.sent()).data;
217
169
  if (data.errors)
@@ -236,7 +188,47 @@ var APPService = (function (_super) {
236
188
  type: 'applepay',
237
189
  token_data: applePaymentData
238
190
  };
239
- return [4, this.post(this.baseUrl + '/token', body)];
191
+ return [4, axiosInstance.post('/token', body)];
192
+ case 1:
193
+ data = (_a.sent()).data;
194
+ if (data.errors)
195
+ throw data;
196
+ return [2, data];
197
+ }
198
+ });
199
+ });
200
+ }
201
+ });
202
+ Object.defineProperty(APPService.prototype, "createCharge", {
203
+ enumerable: false,
204
+ configurable: true,
205
+ writable: true,
206
+ value: function (request) {
207
+ return __awaiter(this, void 0, void 0, function () {
208
+ var data;
209
+ return __generator(this, function (_a) {
210
+ switch (_a.label) {
211
+ case 0: return [4, axiosInstance.post('/charge', request)];
212
+ case 1:
213
+ data = (_a.sent()).data;
214
+ if (data.errors)
215
+ throw data;
216
+ return [2, data];
217
+ }
218
+ });
219
+ });
220
+ }
221
+ });
222
+ Object.defineProperty(APPService.prototype, "createAuthorize", {
223
+ enumerable: false,
224
+ configurable: true,
225
+ writable: true,
226
+ value: function (request) {
227
+ return __awaiter(this, void 0, void 0, function () {
228
+ var data;
229
+ return __generator(this, function (_a) {
230
+ switch (_a.label) {
231
+ case 0: return [4, axiosInstance.post('/authorize', request)];
240
232
  case 1:
241
233
  data = (_a.sent()).data;
242
234
  if (data.errors)
@@ -248,6 +240,6 @@ var APPService = (function (_super) {
248
240
  }
249
241
  });
250
242
  return APPService;
251
- }(BaseService));
243
+ }());
252
244
  var appService = new APPService();
253
245
  export default appService;
@@ -1,59 +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: "white-outline";
9
- };
10
- export declare const Locale: {
11
- readonly EN: "en";
12
- readonly AR: "ar";
13
- readonly FR: "fr";
14
- };
15
- export declare const ButtonType: {
16
- readonly BOOK: "book";
17
- readonly BUY: "buy";
18
- readonly CHECK_OUT: "check-out";
19
- readonly PAY: "pay";
20
- readonly PLAIN: "plain";
21
- readonly SUBSCRIBE: "subscribe";
22
- };
23
- export declare const ThemeMode: {
24
- readonly DARK: "dark";
25
- readonly LIGHT: "light";
26
- };
27
- export declare const Edges: {
28
- readonly STRAIGHT: "straight";
29
- readonly CURVED: "curved";
30
- };
31
- export declare const MerchantCapabilities: {
32
- readonly Supports3DS: "supports3DS";
33
- readonly SupportsCredit: "supportsCredit";
34
- readonly SupportsDebit: "supportsDebit";
35
- };
36
- export declare const SupportedNetworks: {
37
- readonly Amex: "amex";
38
- readonly Mada: "mada";
39
- readonly MasterCard: "masterCard";
40
- readonly Visa: "visa";
41
- readonly ChinaUnionPay: "chinaUnionPay";
42
- readonly Discover: "discover";
43
- readonly Electron: "electron";
44
- readonly Jcb: "jcb";
45
- readonly Maestro: "maestro";
46
- };
47
1
  export declare const ApplePayVersion = 5;
48
- export declare const Environment: {
49
- readonly Production: "production";
50
- readonly Sandbox: "sandbox";
51
- readonly Beta: "beta";
52
- readonly Development: "development";
53
- readonly Staging: "staging";
54
- };
55
- export declare const RSA_DEV_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
56
- export declare const RSA_SANDBOX_MW_PUBLIC_KEY = "";
57
- export declare const RSA_PRODUCTION_MW_PUBLIC_KEY = "";
58
- export declare const RSA_BETA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
59
- export declare const RSA_STAGING_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
2
+ export declare const RSA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
3
+ export declare const MW_BASE_URL = "https://mw-sdk.dev.tap.company/v2/checkout";
@@ -1,59 +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: 'white-outline'
9
- };
10
- export var Locale = {
11
- EN: 'en',
12
- AR: 'ar',
13
- FR: 'fr'
14
- };
15
- export var ButtonType = {
16
- BOOK: 'book',
17
- BUY: 'buy',
18
- CHECK_OUT: 'check-out',
19
- PAY: 'pay',
20
- PLAIN: 'plain',
21
- SUBSCRIBE: 'subscribe'
22
- };
23
- export var ThemeMode = {
24
- DARK: 'dark',
25
- LIGHT: 'light'
26
- };
27
- export var Edges = {
28
- STRAIGHT: 'straight',
29
- CURVED: 'curved'
30
- };
31
- export var MerchantCapabilities = {
32
- Supports3DS: 'supports3DS',
33
- SupportsCredit: 'supportsCredit',
34
- SupportsDebit: 'supportsDebit'
35
- };
36
- export var SupportedNetworks = {
37
- Amex: 'amex',
38
- Mada: 'mada',
39
- MasterCard: 'masterCard',
40
- Visa: 'visa',
41
- ChinaUnionPay: 'chinaUnionPay',
42
- Discover: 'discover',
43
- Electron: 'electron',
44
- Jcb: 'jcb',
45
- Maestro: 'maestro'
46
- };
47
1
  export var ApplePayVersion = 5;
48
- export var Environment = {
49
- Production: 'production',
50
- Sandbox: 'sandbox',
51
- Beta: 'beta',
52
- Development: 'development',
53
- Staging: 'staging'
54
- };
55
- export var RSA_DEV_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
56
- export var RSA_SANDBOX_MW_PUBLIC_KEY = "";
57
- export var RSA_PRODUCTION_MW_PUBLIC_KEY = "";
58
- export var RSA_BETA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
59
- export var RSA_STAGING_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
2
+ export var RSA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
3
+ export var MW_BASE_URL = 'https://mw-sdk.dev.tap.company/v2/checkout';
@@ -1,6 +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;
1
+ import { ApplePayButtonProps, ApplePayRequestData } from '../../@types';
2
+ export type { ApplePayButtonProps, ApplePayRequestData };
3
+ export declare function ApplePayButton(props: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
6
4
  export declare const renderApplePayButton: (props: ApplePayButtonProps, elementId: string) => any;
@@ -14,26 +14,20 @@ import * as React from 'react';
14
14
  import { createRoot } from 'react-dom/client';
15
15
  import { findOrCreateElementAndInject } from '../../utils';
16
16
  import { useApplePay } from '../../hooks/useApplePay';
17
- import './ApplePayButton.css';
18
- import { getDefaultValues } from '../../utils/defaultValues';
19
- import { ButtonStyle, Edges, ThemeMode } from '../../constants';
17
+ import { Locale, PayButton } from '@tap-payments/acceptance-sdk';
20
18
  var ApplePay = React.memo(function (props) {
21
- var mappedProps = getDefaultValues(props);
22
- var _a = useApplePay(mappedProps), loading = _a.loading, onApplePayButtonClicked = _a.onApplePayButtonClicked, disabled = _a.disabled;
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;
23
21
  React.useEffect(function () {
24
22
  if (props.debug) {
25
23
  console.log('ApplePayButtonProps', props);
26
24
  }
27
25
  }, []);
28
- return (_jsx("button", { className: 'button-applepay-tap', style: {
29
- ApplePayButtonType: mappedProps.interface.type,
30
- ApplePayButtonStyle: mappedProps.interface.theme === ThemeMode.DARK ? ButtonStyle.Black : ButtonStyle.White,
31
- borderRadius: mappedProps.interface.edges === Edges.STRAIGHT ? '0' : '10px'
32
- }, onClick: function () {
33
- var _a;
34
- onApplePayButtonClicked();
35
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
36
- }, lang: mappedProps.interface.locale, disabled: loading || disabled }));
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 }) })));
37
31
  });
38
32
  export function ApplePayButton(props) {
39
33
  return _jsx(ApplePay, __assign({}, props));
@@ -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,3 +1 @@
1
- export * from './useScript';
2
1
  export * from './useApplePay';
3
- export * from './useApplePayFromMerchantSide';
@@ -1,3 +1 @@
1
- export * from './useScript';
2
1
  export * from './useApplePay';
3
- export * from './useApplePayFromMerchantSide';
@@ -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, interface: interfaceObj, customer, onCancel, onError, onSuccess, scope, acceptance, metaData, debug, environment, onReady }: 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>) => 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" | 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 {};