@tap-payments/apple-pay-button 0.0.10-test → 0.0.12-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 +194 -194
- package/build/@types/index.d.ts +77 -79
- package/build/@types/index.js +1 -1
- package/build/api/app.service.d.ts +11 -12
- package/build/api/app.service.js +217 -240
- package/build/api/base.d.ts +9 -9
- package/build/api/base.js +45 -45
- package/build/api/httpClient.d.ts +2 -2
- package/build/api/httpClient.js +16 -16
- package/build/constants/index.d.ts +40 -26
- package/build/constants/index.js +40 -26
- package/build/features/ApplePayButton/ApplePayButton.css +6 -50
- package/build/features/ApplePayButton/ApplePayButton.d.ts +13 -6
- package/build/features/ApplePayButton/ApplePayButton.js +57 -53
- 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 +9 -9
- package/build/hooks/useApplePay.js +211 -214
- 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 +9 -9
- package/build/utils/config.d.ts +9 -9
- package/build/utils/config.js +54 -54
- 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 +102 -102
|
@@ -1,26 +1,40 @@
|
|
|
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
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
};
|
|
15
|
-
export declare const
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
readonly
|
|
25
|
-
|
|
26
|
-
|
|
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 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 MerchantCapabilities: {
|
|
24
|
+
readonly Supports3DS: "supports3DS";
|
|
25
|
+
readonly SupportsCredit: "supportsCredit";
|
|
26
|
+
readonly SupportsDebit: "supportsDebit";
|
|
27
|
+
};
|
|
28
|
+
export declare const SupportedNetworks: {
|
|
29
|
+
readonly Amex: "amex";
|
|
30
|
+
readonly Mada: "mada";
|
|
31
|
+
readonly MasterCard: "masterCard";
|
|
32
|
+
readonly Visa: "visa";
|
|
33
|
+
readonly ChinaUnionPay: "chinaUnionPay";
|
|
34
|
+
readonly Discover: "discover";
|
|
35
|
+
readonly Electron: "electron";
|
|
36
|
+
readonly Jcb: "jcb";
|
|
37
|
+
readonly Maestro: "maestro";
|
|
38
|
+
};
|
|
39
|
+
export declare const ApplePayVersion = 5;
|
|
40
|
+
export declare const ApplePaySDK = "https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js";
|
package/build/constants/index.js
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
export var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 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 MerchantCapabilities = {
|
|
24
|
+
Supports3DS: 'supports3DS',
|
|
25
|
+
SupportsCredit: 'supportsCredit',
|
|
26
|
+
SupportsDebit: 'supportsDebit'
|
|
27
|
+
};
|
|
28
|
+
export var SupportedNetworks = {
|
|
29
|
+
Amex: 'amex',
|
|
30
|
+
Mada: 'mada',
|
|
31
|
+
MasterCard: 'masterCard',
|
|
32
|
+
Visa: 'visa',
|
|
33
|
+
ChinaUnionPay: 'chinaUnionPay',
|
|
34
|
+
Discover: 'discover',
|
|
35
|
+
Electron: 'electron',
|
|
36
|
+
Jcb: 'jcb',
|
|
37
|
+
Maestro: 'maestro'
|
|
38
|
+
};
|
|
39
|
+
export var ApplePayVersion = 5;
|
|
40
|
+
export var ApplePaySDK = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
|
|
@@ -1,51 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
display: flex;
|
|
8
|
-
position: relative;
|
|
9
|
-
-webkit-box-pack: center;
|
|
10
|
-
-ms-flex-pack: center;
|
|
11
|
-
-webkit-justify-content: center;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
-webkit-align-items: center;
|
|
14
|
-
-webkit-box-align: center;
|
|
15
|
-
-ms-flex-align: center;
|
|
16
|
-
align-items: center;
|
|
17
|
-
-webkit-margin-end: 8px;
|
|
18
|
-
margin-inline-end: 8px;
|
|
19
|
-
min-width: 96px;
|
|
20
|
-
max-width: 300px;
|
|
21
|
-
min-height: 40px;
|
|
22
|
-
border-radius: 9px;
|
|
23
|
-
background-color: white;
|
|
24
|
-
width: 100%;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.button-applepay-tap:disabled {
|
|
28
|
-
cursor: default;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.img-container {
|
|
32
|
-
height: 24px;
|
|
33
|
-
max-width: 80px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.img-container img {
|
|
37
|
-
height: 100%;
|
|
38
|
-
width: 100%;
|
|
39
|
-
transform: scale(1.5);
|
|
40
|
-
filter: invert(0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.whiteOutline {
|
|
44
|
-
border: solid 1px gray;
|
|
45
|
-
}
|
|
46
|
-
.dark {
|
|
47
|
-
background-color: black;
|
|
48
|
-
}
|
|
49
|
-
.dark .img-container img {
|
|
50
|
-
filter: invert(1);
|
|
1
|
+
apple-pay-button {
|
|
2
|
+
display: block;
|
|
3
|
+
--apple-pay-button-width: 100%;
|
|
4
|
+
--apple-pay-button-height: 48px;
|
|
5
|
+
--apple-pay-button-border-radius: 5px;
|
|
6
|
+
--apple-pay-button-padding: 0px 0px;
|
|
51
7
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ApplePayButtonProps } from '../../@types';
|
|
3
|
-
import './ApplePayButton.css';
|
|
4
|
-
export type { ApplePayButtonProps };
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ApplePayButtonProps } from '../../@types';
|
|
3
|
+
import './ApplePayButton.css';
|
|
4
|
+
export type { ApplePayButtonProps };
|
|
5
|
+
declare global {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'apple-pay-button': unknown;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare function ApplePayButton(props: ApplePayButtonProps): JSX.Element;
|
|
13
|
+
export declare const renderApplePayButton: (props: ApplePayButtonProps, elementId: string) => any;
|
|
@@ -1,53 +1,57 @@
|
|
|
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
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import { createRoot } from 'react-dom/client';
|
|
15
|
-
import { findOrCreateElementAndInject } from '../../utils';
|
|
16
|
-
import { useApplePay } from '../../hooks/useApplePay';
|
|
17
|
-
import { ButtonStyle, Scope } from '../../constants';
|
|
18
|
-
import './ApplePayButton.css';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _d =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { createRoot } from 'react-dom/client';
|
|
15
|
+
import { findOrCreateElementAndInject } from '../../utils';
|
|
16
|
+
import { useApplePay } from '../../hooks/useApplePay';
|
|
17
|
+
import { ApplePaySDK, ButtonStyle, ButtonType, Locale, Scope } from '../../constants';
|
|
18
|
+
import './ApplePayButton.css';
|
|
19
|
+
import { useScript } from '../../hooks';
|
|
20
|
+
var ApplePay = React.memo(function (_a) {
|
|
21
|
+
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, onClick = _a.onClick, metaData = _a.metaData, _b = _a.scope, scope = _b === void 0 ? Scope.TapToken : _b, _c = _a.buttonStyle, buttonStyle = _c === void 0 ? ButtonStyle.WhiteOutline : _c, _d = _a.type, type = _d === void 0 ? ButtonType.PLAIN : _d, _e = _a.locale, locale = _e === void 0 ? Locale.EN : _e;
|
|
22
|
+
useScript(ApplePaySDK);
|
|
23
|
+
var _f = useApplePay({
|
|
24
|
+
publicKey: publicKey,
|
|
25
|
+
merchant: merchant,
|
|
26
|
+
transaction: transaction,
|
|
27
|
+
billingContact: billingContact,
|
|
28
|
+
supportedNetworks: supportedNetworks,
|
|
29
|
+
onError: onError,
|
|
30
|
+
onSuccess: onSuccess,
|
|
31
|
+
onCancel: onCancel,
|
|
32
|
+
scope: scope,
|
|
33
|
+
metaData: metaData
|
|
34
|
+
}), loading = _f.loading, onApplePayButtonClicked = _f.onApplePayButtonClicked, disabled = _f.disabled;
|
|
35
|
+
return (_jsx("apple-pay-button", { onClick: function () {
|
|
36
|
+
onApplePayButtonClicked();
|
|
37
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
38
|
+
}, disabled: loading || disabled, buttonstyle: buttonStyle, type: type, locale: locale }));
|
|
39
|
+
});
|
|
40
|
+
export function ApplePayButton(props) {
|
|
41
|
+
return _jsx(ApplePay, __assign({}, props));
|
|
42
|
+
}
|
|
43
|
+
var tapConnectInstance = null;
|
|
44
|
+
export var renderApplePayButton = function (props, elementId) {
|
|
45
|
+
if (tapConnectInstance) {
|
|
46
|
+
return tapConnectInstance;
|
|
47
|
+
}
|
|
48
|
+
var el = findOrCreateElementAndInject(elementId);
|
|
49
|
+
var root = createRoot(el);
|
|
50
|
+
root.render(_jsx(ApplePayButton, __assign({}, props)));
|
|
51
|
+
var unmount = function () {
|
|
52
|
+
root.unmount();
|
|
53
|
+
tapConnectInstance = null;
|
|
54
|
+
};
|
|
55
|
+
tapConnectInstance = { unmount: unmount };
|
|
56
|
+
return tapConnectInstance;
|
|
57
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ApplePayButtonProps, ApplePayButton, renderApplePayButton } from './ApplePayButton';
|
|
2
|
-
export { ApplePayButton, renderApplePayButton };
|
|
3
|
-
export type { ApplePayButtonProps };
|
|
1
|
+
import { ApplePayButtonProps, ApplePayButton, renderApplePayButton } from './ApplePayButton';
|
|
2
|
+
export { ApplePayButton, renderApplePayButton };
|
|
3
|
+
export type { ApplePayButtonProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ApplePayButton, renderApplePayButton } from './ApplePayButton';
|
|
2
|
-
export { ApplePayButton, renderApplePayButton };
|
|
1
|
+
import { ApplePayButton, renderApplePayButton } from './ApplePayButton';
|
|
2
|
+
export { ApplePayButton, renderApplePayButton };
|
package/build/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './useScript';
|
|
1
|
+
export * from './useScript';
|
package/build/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './useScript';
|
|
1
|
+
export * from './useScript';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ApplePayButtonProps } from '../@types';
|
|
2
|
-
declare type UseApplePayProps = Omit<ApplePayButtonProps, 'buttonStyle'>;
|
|
3
|
-
interface UseApplePayReturnProps {
|
|
4
|
-
loading: boolean;
|
|
5
|
-
onApplePayButtonClicked: () => Promise<void>;
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const useApplePay: ({ publicKey, merchant, transaction, billingContact, onCancel, onError, onSuccess, scope, supportedNetworks,
|
|
9
|
-
export {};
|
|
1
|
+
import { ApplePayButtonProps } from '../@types';
|
|
2
|
+
declare type UseApplePayProps = Omit<ApplePayButtonProps, 'buttonStyle'>;
|
|
3
|
+
interface UseApplePayReturnProps {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
onApplePayButtonClicked: () => Promise<void>;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const useApplePay: ({ publicKey, merchant, transaction, billingContact, onCancel, onError, onSuccess, scope, supportedNetworks, metaData }: UseApplePayProps) => UseApplePayReturnProps;
|
|
9
|
+
export {};
|