@tap-payments/apple-pay-button 0.0.38-development → 0.0.38-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 (46) 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 -222
  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} +79 -100
  17. package/build/constants/index.d.ts +2 -71
  18. package/build/constants/index.js +2 -71
  19. package/build/features/ApplePayButton/ApplePayButton.d.ts +3 -5
  20. package/build/features/ApplePayButton/ApplePayButton.js +8 -19
  21. package/build/features/ApplePayButton/index.d.ts +2 -2
  22. package/build/hooks/index.d.ts +0 -1
  23. package/build/hooks/index.js +0 -1
  24. package/build/hooks/useApplePay.d.ts +89 -6
  25. package/build/hooks/useApplePay.js +229 -87
  26. package/build/hooks/useMerchantApplePay.d.ts +20 -0
  27. package/build/hooks/useMerchantApplePay.js +176 -0
  28. package/build/index.d.ts +4 -4
  29. package/build/index.js +2 -3
  30. package/build/utils/config.d.ts +7 -4
  31. package/build/utils/config.js +27 -26
  32. package/build/utils/defaultValues.d.ts +2 -69
  33. package/build/utils/defaultValues.js +1 -23
  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 -24
  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/useScript.d.ts +0 -1
  46. 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,86 +56,28 @@ 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
- }
121
- });
122
- Object.defineProperty(APPService.prototype, "getHeaderPublicKey", {
123
- enumerable: false,
124
- configurable: true,
125
- 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
- }
141
- }
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;
142
73
  });
74
+ };
75
+ export var getAxiosGlobalHeaders = function () {
76
+ return __assign({}, axiosInstance.defaults.headers.common);
77
+ };
78
+ var APPService = (function () {
79
+ function APPService() {
80
+ }
143
81
  Object.defineProperty(APPService.prototype, "setHttpHeaders", {
144
82
  enumerable: false,
145
83
  configurable: true,
@@ -164,7 +102,7 @@ var APPService = (function (_super) {
164
102
  return __generator(this, function (_b) {
165
103
  switch (_b.label) {
166
104
  case 0:
167
- encryptString = rsaSetup(this.getHeaderPublicKey());
105
+ encryptString = rsaSetup(RSA_MW_PUBLIC_KEY);
168
106
  return [4, new BrowserInfo.BrowserInfo({
169
107
  app: { name: '@tap-payments/apple-pay-button', language: locale },
170
108
  credentials: { mdn: domain, pk: pk },
@@ -194,7 +132,7 @@ var APPService = (function (_super) {
194
132
  var data, merchant, payment_options, session;
195
133
  return __generator(this, function (_a) {
196
134
  switch (_a.label) {
197
- case 0: return [4, this.post(this.baseUrl + '/checkoutprofile', request)];
135
+ case 0: return [4, axiosInstance.post('/checkoutprofile', request)];
198
136
  case 1:
199
137
  data = (_a.sent()).data;
200
138
  if (data.errors)
@@ -211,7 +149,7 @@ var APPService = (function (_super) {
211
149
  enumerable: false,
212
150
  configurable: true,
213
151
  writable: true,
214
- value: function (merchant, validationURL, merchantRegisteredDomain) {
152
+ value: function (merchant, validationURL, merchantRegisteredDomain, merchantIdentifier, identifier) {
215
153
  return __awaiter(this, void 0, void 0, function () {
216
154
  var body, data;
217
155
  return __generator(this, function (_a) {
@@ -220,11 +158,12 @@ var APPService = (function (_super) {
220
158
  body = {
221
159
  validationUrl: validationURL,
222
160
  origin: merchantRegisteredDomain,
223
- merchantIdentifier: merchantRegisteredDomain,
161
+ merchantIdentifier: merchantIdentifier,
224
162
  merchantId: merchant.id,
225
- merchantName: merchant.name
163
+ merchantName: merchant.name,
164
+ identifier: identifier
226
165
  };
227
- return [4, this.post(this.baseUrl + '/validatemerchant', body)];
166
+ return [4, axiosInstance.post('/validatemerchant2', body)];
228
167
  case 1:
229
168
  data = (_a.sent()).data;
230
169
  if (data.errors)
@@ -249,7 +188,47 @@ var APPService = (function (_super) {
249
188
  type: 'applepay',
250
189
  token_data: applePaymentData
251
190
  };
252
- 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)];
253
232
  case 1:
254
233
  data = (_a.sent()).data;
255
234
  if (data.errors)
@@ -261,6 +240,6 @@ var APPService = (function (_super) {
261
240
  }
262
241
  });
263
242
  return APPService;
264
- }(BaseService));
243
+ }());
265
244
  var appService = new APPService();
266
245
  export default appService;
@@ -1,72 +1,3 @@
1
- export declare const Scope: {
2
- readonly CHARGE: "charge";
3
- readonly AUTHORIZE: "authorize";
4
- readonly TAP_TOKEN: "taptoken";
5
- readonly APPLE_PAY_TOKEN: "applepaytoken";
6
- };
7
- export declare const ButtonStyle: {
8
- readonly Black: "black";
9
- readonly White: "white";
10
- readonly WhiteOutline: "white-outline";
11
- };
12
- export declare const Locale: {
13
- readonly EN: "en";
14
- readonly AR: "ar";
15
- readonly DYNAMIC: "dynamic";
16
- };
17
- export declare const ColorStyle: {
18
- readonly COLORED: "colored";
19
- readonly MONOCHROME: "monochrome";
20
- };
21
- export declare const FullThemeMode: {
22
- readonly DARK: "dark";
23
- readonly LIGHT: "light";
24
- readonly LIGHT_MONO: "light_mono";
25
- readonly DARK_COLORED: "dark_colored";
26
- };
27
- export declare const ButtonType: {
28
- readonly BOOK: "book";
29
- readonly BUY: "buy";
30
- readonly CHECK_OUT: "check-out";
31
- readonly PAY: "pay";
32
- readonly PLAIN: "plain";
33
- readonly SUBSCRIBE: "subscribe";
34
- };
35
- export declare const ThemeMode: {
36
- readonly DARK: "dark";
37
- readonly LIGHT: "light";
38
- readonly DYNAMIC: "dynamic";
39
- };
40
- export declare const Edges: {
41
- readonly STRAIGHT: "straight";
42
- readonly CURVED: "curved";
43
- };
44
- export declare const MerchantCapabilities: {
45
- readonly Supports3DS: "supports3DS";
46
- readonly SupportsCredit: "supportsCredit";
47
- readonly SupportsDebit: "supportsDebit";
48
- };
49
- export declare const SupportedNetworks: {
50
- readonly Amex: "amex";
51
- readonly Mada: "mada";
52
- readonly MasterCard: "masterCard";
53
- readonly Visa: "visa";
54
- readonly ChinaUnionPay: "chinaUnionPay";
55
- readonly Discover: "discover";
56
- readonly Electron: "electron";
57
- readonly Jcb: "jcb";
58
- readonly Maestro: "maestro";
59
- };
60
1
  export declare const ApplePayVersion = 5;
61
- export declare const Environment: {
62
- readonly Production: "production";
63
- readonly Sandbox: "sandbox";
64
- readonly Beta: "beta";
65
- readonly Development: "development";
66
- readonly Staging: "staging";
67
- };
68
- export declare const RSA_DEV_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
69
- export declare const RSA_SANDBOX_MW_PUBLIC_KEY = "";
70
- export declare const RSA_PRODUCTION_MW_PUBLIC_KEY = "";
71
- export declare const RSA_BETA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
72
- 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,72 +1,3 @@
1
- export var Scope = {
2
- CHARGE: 'charge',
3
- AUTHORIZE: 'authorize',
4
- TAP_TOKEN: 'taptoken',
5
- APPLE_PAY_TOKEN: 'applepaytoken'
6
- };
7
- export var ButtonStyle = {
8
- Black: 'black',
9
- White: 'white',
10
- WhiteOutline: 'white-outline'
11
- };
12
- export var Locale = {
13
- EN: 'en',
14
- AR: 'ar',
15
- DYNAMIC: 'dynamic'
16
- };
17
- export var ColorStyle = {
18
- COLORED: 'colored',
19
- MONOCHROME: 'monochrome'
20
- };
21
- export var FullThemeMode = {
22
- DARK: 'dark',
23
- LIGHT: 'light',
24
- LIGHT_MONO: 'light_mono',
25
- DARK_COLORED: 'dark_colored'
26
- };
27
- export var ButtonType = {
28
- BOOK: 'book',
29
- BUY: 'buy',
30
- CHECK_OUT: 'check-out',
31
- PAY: 'pay',
32
- PLAIN: 'plain',
33
- SUBSCRIBE: 'subscribe'
34
- };
35
- export var ThemeMode = {
36
- DARK: 'dark',
37
- LIGHT: 'light',
38
- DYNAMIC: 'dynamic'
39
- };
40
- export var Edges = {
41
- STRAIGHT: 'straight',
42
- CURVED: 'curved'
43
- };
44
- export var MerchantCapabilities = {
45
- Supports3DS: 'supports3DS',
46
- SupportsCredit: 'supportsCredit',
47
- SupportsDebit: 'supportsDebit'
48
- };
49
- export var SupportedNetworks = {
50
- Amex: 'amex',
51
- Mada: 'mada',
52
- MasterCard: 'masterCard',
53
- Visa: 'visa',
54
- ChinaUnionPay: 'chinaUnionPay',
55
- Discover: 'discover',
56
- Electron: 'electron',
57
- Jcb: 'jcb',
58
- Maestro: 'maestro'
59
- };
60
1
  export var ApplePayVersion = 5;
61
- export var Environment = {
62
- Production: 'production',
63
- Sandbox: 'sandbox',
64
- Beta: 'beta',
65
- Development: 'development',
66
- Staging: 'staging'
67
- };
68
- export var RSA_DEV_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
69
- export var RSA_SANDBOX_MW_PUBLIC_KEY = "";
70
- export var RSA_PRODUCTION_MW_PUBLIC_KEY = "";
71
- export var RSA_BETA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
72
- 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,31 +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 { getDefaultValues } from '../../utils/defaultValues';
18
- import { ButtonStyle, Edges, ThemeMode } from '../../constants';
19
- import './ApplePayButton.css';
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, applePayRequestData = _a.applePayRequestData;
23
- var isMerchantIntegration = props.integration === 'merchant';
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;
24
21
  React.useEffect(function () {
25
22
  if (props.debug) {
26
23
  console.log('ApplePayButtonProps', props);
27
24
  }
28
25
  }, []);
29
- return (_jsx("button", { className: 'button-applepay-tap', style: {
30
- ApplePayButtonType: mappedProps.interface.type,
31
- ApplePayButtonStyle: mappedProps.interface.theme === ThemeMode.DARK ? ButtonStyle.Black : ButtonStyle.White,
32
- borderRadius: mappedProps.interface.edges === Edges.STRAIGHT ? '0' : '10px'
33
- }, onClick: function () {
34
- var _a, _b;
35
- if (isMerchantIntegration) {
36
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, applePayRequestData);
37
- return;
38
- }
39
- onApplePayButtonClicked();
40
- (_b = props.onClick) === null || _b === void 0 ? void 0 : _b.call(props);
41
- }, 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 }) })));
42
31
  });
43
32
  export function ApplePayButton(props) {
44
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,2 +1 @@
1
- export * from './useScript';
2
1
  export * from './useApplePay';
@@ -1,2 +1 @@
1
- export * from './useScript';
2
1
  export * from './useApplePay';
@@ -1,10 +1,93 @@
1
- import { ApplePayButtonProps, ApplePayRequestData } 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
- applePayRequestData?: ApplePayRequestData;
8
- }
9
- export declare const useApplePay: ({ environment, interface: interfaceObj, merchant, customer, acceptance, scope, debug, onError, onSuccess, onCancel, onReady, metaData, headers, operator, order, onOrderCreated }: 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
+ };
10
93
  export {};