@tap-payments/apple-pay-button 1.0.1 → 1.0.2-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.
- package/LICENSE +21 -21
- package/README.md +240 -194
- package/build/@types/ApplePaySession.d.ts +67 -0
- package/build/@types/ApplePaySession.js +1 -0
- package/build/@types/index.d.ts +118 -73
- package/build/@types/index.js +1 -1
- package/build/api/app.service.d.ts +23 -11
- package/build/api/app.service.js +253 -217
- package/build/api/base.d.ts +9 -9
- package/build/api/base.js +45 -45
- package/build/api/httpClient.d.ts +8 -2
- package/build/api/httpClient.js +33 -16
- package/build/constants/index.d.ts +59 -26
- package/build/constants/index.js +59 -26
- package/build/features/ApplePayButton/ApplePayButton.css +10 -40
- package/build/features/ApplePayButton/ApplePayButton.d.ts +7 -6
- package/build/features/ApplePayButton/ApplePayButton.js +65 -51
- package/build/features/ApplePayButton/index.d.ts +3 -3
- package/build/features/ApplePayButton/index.js +2 -2
- package/build/hooks/index.d.ts +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/useApplePay.d.ts +10 -9
- package/build/hooks/useApplePay.js +342 -197
- package/build/hooks/useGetEvents.d.ts +4 -0
- package/build/hooks/useGetEvents.js +15 -0
- package/build/hooks/useScript.d.ts +1 -1
- package/build/hooks/useScript.js +39 -39
- package/build/index.d.ts +4 -4
- package/build/index.js +15 -9
- package/build/utils/config.d.ts +13 -9
- package/build/utils/config.js +76 -54
- package/build/utils/defaultValues.d.ts +32 -0
- package/build/utils/defaultValues.js +48 -0
- package/build/utils/html.d.ts +1 -1
- package/build/utils/html.js +9 -9
- package/build/utils/index.d.ts +1 -1
- package/build/utils/index.js +1 -1
- package/package.json +4 -2
package/build/@types/index.d.ts
CHANGED
|
@@ -1,73 +1,118 @@
|
|
|
1
|
-
import { Scope,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
export interface
|
|
65
|
-
id: string;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import { Scope, SupportedNetworks, ButtonType, Locale, Environment, ThemeMode, Edges } from '../constants';
|
|
2
|
+
import { ApplePayPaymentContact, ApplePayPaymentMethod, ApplePayShippingMethod, ApplePayUpdateData, RequiredShippingContactField } from './ApplePaySession';
|
|
3
|
+
export * from './ApplePaySession';
|
|
4
|
+
export interface Interface {
|
|
5
|
+
locale?: typeof Locale[keyof typeof Locale];
|
|
6
|
+
theme?: typeof ThemeMode[keyof typeof ThemeMode];
|
|
7
|
+
edges?: typeof Edges[keyof typeof Edges];
|
|
8
|
+
type?: typeof ButtonType[keyof typeof ButtonType];
|
|
9
|
+
}
|
|
10
|
+
export interface Customer {
|
|
11
|
+
id?: string;
|
|
12
|
+
name?: {
|
|
13
|
+
lang: typeof Locale[keyof typeof Locale];
|
|
14
|
+
first: string;
|
|
15
|
+
last: string;
|
|
16
|
+
middle?: string;
|
|
17
|
+
}[];
|
|
18
|
+
contact?: {
|
|
19
|
+
email?: string;
|
|
20
|
+
phone?: {
|
|
21
|
+
countryCode: string;
|
|
22
|
+
number: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
shippingContactFields?: Array<RequiredShippingContactField>;
|
|
26
|
+
}
|
|
27
|
+
export interface Acceptance {
|
|
28
|
+
supportedBrands?: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
29
|
+
supportedCards?: Array<string>;
|
|
30
|
+
supportedCardsWithAuthentications?: Array<string>;
|
|
31
|
+
supportsCouponCode?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface Transaction {
|
|
34
|
+
amount: string;
|
|
35
|
+
currency: string;
|
|
36
|
+
couponCode?: string;
|
|
37
|
+
shipping?: ApplePayShippingMethod[];
|
|
38
|
+
}
|
|
39
|
+
export interface ApplePayButtonProps {
|
|
40
|
+
scope?: typeof Scope[keyof typeof Scope];
|
|
41
|
+
publicKey: string;
|
|
42
|
+
environment: typeof Environment[keyof typeof Environment];
|
|
43
|
+
merchant: {
|
|
44
|
+
id: string;
|
|
45
|
+
domain: string;
|
|
46
|
+
identifier?: string;
|
|
47
|
+
};
|
|
48
|
+
interface?: Interface;
|
|
49
|
+
customer?: Customer;
|
|
50
|
+
acceptance: Acceptance;
|
|
51
|
+
transaction: Transaction;
|
|
52
|
+
onCancel?: () => void;
|
|
53
|
+
onError?: (error: any) => void;
|
|
54
|
+
onSuccess?: (data: Record<string, any>) => Promise<void>;
|
|
55
|
+
onClick?: () => void;
|
|
56
|
+
onReady?: () => void;
|
|
57
|
+
onMerchantValidation?: (status: 'initiated' | 'completed' | 'error') => void;
|
|
58
|
+
onShippingContactSelected?: (shippingContact: ApplePayPaymentContact) => Promise<ApplePayUpdateData | void>;
|
|
59
|
+
onPaymentMethodSelected?: (paymentMethod: ApplePayPaymentMethod) => Promise<ApplePayUpdateData | void>;
|
|
60
|
+
onCouponChanged?: (couponCode: string) => Promise<ApplePayUpdateData | void>;
|
|
61
|
+
metaData?: MetaData;
|
|
62
|
+
debug?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface MerchantResponse {
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
country_code: string;
|
|
68
|
+
session_token: string;
|
|
69
|
+
[other: string]: string;
|
|
70
|
+
}
|
|
71
|
+
export interface PaymentMethod {
|
|
72
|
+
id: string;
|
|
73
|
+
image: string;
|
|
74
|
+
name: string;
|
|
75
|
+
payment_type: string;
|
|
76
|
+
supported_card_brands: Array<typeof SupportedNetworks[keyof typeof SupportedNetworks]>;
|
|
77
|
+
supported_currencies: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface PaymentOptionsResponse {
|
|
80
|
+
id: string;
|
|
81
|
+
country: string;
|
|
82
|
+
currency: string;
|
|
83
|
+
payment_methods: PaymentMethod[];
|
|
84
|
+
}
|
|
85
|
+
export interface MetaData {
|
|
86
|
+
merchant: MerchantResponse;
|
|
87
|
+
payment_options: PaymentOptionsResponse;
|
|
88
|
+
headers: Record<string, string>;
|
|
89
|
+
}
|
|
90
|
+
export interface CheckoutProfileRequest {
|
|
91
|
+
currency: string;
|
|
92
|
+
merchant_id: string;
|
|
93
|
+
total_amount: number;
|
|
94
|
+
order: {
|
|
95
|
+
amount: number;
|
|
96
|
+
currency: string;
|
|
97
|
+
customer?: {
|
|
98
|
+
id?: string;
|
|
99
|
+
email?: string;
|
|
100
|
+
first_name?: string;
|
|
101
|
+
last_name?: string;
|
|
102
|
+
phone?: {
|
|
103
|
+
country_code: string;
|
|
104
|
+
number: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
items: {
|
|
108
|
+
quantity: number;
|
|
109
|
+
amount: number;
|
|
110
|
+
currency: string;
|
|
111
|
+
name: string;
|
|
112
|
+
requiresShipping: string;
|
|
113
|
+
}[];
|
|
114
|
+
merchant: {
|
|
115
|
+
id: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}
|
package/build/@types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './ApplePaySession';
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import { MerchantResponse,
|
|
2
|
-
import BaseService from './base';
|
|
3
|
-
declare class APPService extends BaseService {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { MerchantResponse, ApplePayButtonProps, CheckoutProfileRequest } from '../@types';
|
|
2
|
+
import BaseService from './base';
|
|
3
|
+
declare class APPService extends BaseService {
|
|
4
|
+
private baseUrl;
|
|
5
|
+
private env;
|
|
6
|
+
constructor();
|
|
7
|
+
setEnv(env: ApplePayButtonProps['environment']): void;
|
|
8
|
+
setBaseUrl(): void;
|
|
9
|
+
getHeaderPublicKey(): "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----" | "" | "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----" | "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
|
|
10
|
+
setBrowserHeaders({ locale, pk, domain }: {
|
|
11
|
+
locale: string;
|
|
12
|
+
pk: string;
|
|
13
|
+
domain: string;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
checkoutProfile(request: CheckoutProfileRequest): Promise<{
|
|
16
|
+
merchant: any;
|
|
17
|
+
payment_options: any;
|
|
18
|
+
}>;
|
|
19
|
+
appleSession(merchant: MerchantResponse, validationURL: string, merchantRegisteredDomain: string, merchantIdentifier: string): Promise<any>;
|
|
20
|
+
tapTokenization(applePaymentData: Record<string, string>): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
declare const appService: APPService;
|
|
23
|
+
export default appService;
|