@tap-payments/apple-pay-button 0.0.4-test → 0.0.6-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/README.md +1 -4
- package/build/package.json +102 -0
- package/build/{@types → src/@types}/index.d.ts +0 -1
- package/build/{@types → src/@types}/index.js +0 -0
- package/build/{api → src/api}/app.service.d.ts +0 -0
- package/build/{api → src/api}/app.service.js +0 -0
- package/build/{api → src/api}/base.d.ts +0 -0
- package/build/{api → src/api}/base.js +0 -0
- package/build/{api → src/api}/httpClient.d.ts +0 -0
- package/build/{api → src/api}/httpClient.js +0 -0
- package/build/{constants → src/constants}/index.d.ts +5 -0
- package/build/{constants → src/constants}/index.js +6 -1
- package/build/{features → src/features}/ApplePayButton/ApplePayButton.d.ts +0 -0
- package/build/{features → src/features}/ApplePayButton/ApplePayButton.js +0 -0
- package/build/{features → src/features}/ApplePayButton/index.d.ts +0 -0
- package/build/{features → src/features}/ApplePayButton/index.js +0 -0
- package/build/{hooks → src/hooks}/index.d.ts +0 -0
- package/build/{hooks → src/hooks}/index.js +0 -0
- package/build/{hooks → src/hooks}/useApplePay.d.ts +0 -0
- package/build/{hooks → src/hooks}/useApplePay.js +3 -2
- package/build/{hooks → src/hooks}/useScript.d.ts +0 -0
- package/build/{hooks → src/hooks}/useScript.js +0 -0
- package/build/{index.d.ts → src/index.d.ts} +0 -0
- package/build/{index.js → src/index.js} +2 -1
- package/build/{utils → src/utils}/config.d.ts +3 -2
- package/build/{utils → src/utils}/config.js +2 -2
- package/build/{utils → src/utils}/html.d.ts +0 -0
- package/build/{utils → src/utils}/html.js +0 -0
- package/build/{utils → src/utils}/index.d.ts +0 -0
- package/build/{utils → src/utils}/index.js +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,9 +43,7 @@ const App = () => {
|
|
|
43
43
|
// required (The amount to be charged)
|
|
44
44
|
amount: '12',
|
|
45
45
|
// required (The currency of the amount)
|
|
46
|
-
currency: 'KWD'
|
|
47
|
-
// required (The description/label of the transaction)
|
|
48
|
-
label: 'to Merchant'
|
|
46
|
+
currency: 'KWD'
|
|
49
47
|
}}
|
|
50
48
|
// optional (The scope of the SDK and it can be one of these scopes:
|
|
51
49
|
// [TapToken,AppleToken], by default it is TapToken)
|
|
@@ -110,7 +108,6 @@ const App = () => {
|
|
|
110
108
|
| merchant.domain | `string` | `required` | The merchant domain name |
|
|
111
109
|
| transaction.amount | `string` | `required` | The amount to be charged |
|
|
112
110
|
| transaction.currency | `string` | `required` | The currency of the amount |
|
|
113
|
-
| transaction.label | `string` | `required` | The description/label of the transaction |
|
|
114
111
|
| scope | `Scope` | `optional` | The scope of the SDK |
|
|
115
112
|
| supportedNetworks | `SupportedNetworks[]` | `optional` | The supported networks for the Apple Pay button |
|
|
116
113
|
| buttonStyle | `ButtonStyle` | `optional` | The style of the Apple Pay button |
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tap-payments/apple-pay-button",
|
|
3
|
+
"version": "0.0.5-test",
|
|
4
|
+
"description": "Apple Pay Button React Component",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"module": "build/index.js",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"build",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"prepare": "npx husky install",
|
|
14
|
+
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
|
|
15
|
+
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
|
|
16
|
+
"lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
|
|
17
|
+
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
|
|
18
|
+
"start": "cross-env NODE_ENV=development webpack serve",
|
|
19
|
+
"build": "cross-env NODE_ENV=production webpack",
|
|
20
|
+
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
21
|
+
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
22
|
+
"ts:build": "rm -rf build && tsc && yarn tsc:alias && yarn copy:files",
|
|
23
|
+
"push": "npm publish --access public"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [],
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "Ahmed Elsharkawy",
|
|
28
|
+
"email": "a.elsharkawy@tap.company"
|
|
29
|
+
},
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@babel/core": "^7.18.6",
|
|
33
|
+
"@babel/preset-env": "^7.18.6",
|
|
34
|
+
"@babel/preset-react": "^7.18.6",
|
|
35
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
36
|
+
"@types/crypto-js": "^4.1.1",
|
|
37
|
+
"@types/react": "^18.0.15",
|
|
38
|
+
"@types/react-dom": "^18.0.6",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
40
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
41
|
+
"babel-loader": "^8.2.5",
|
|
42
|
+
"copyfiles": "^2.4.1",
|
|
43
|
+
"cross-env": "^7.0.3",
|
|
44
|
+
"css-loader": "^6.7.1",
|
|
45
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
46
|
+
"eslint": "^8.19.0",
|
|
47
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
48
|
+
"eslint-config-prettier": "^8.5.0",
|
|
49
|
+
"eslint-plugin-import": "^2.26.0",
|
|
50
|
+
"eslint-plugin-jsx-a11y": "^6.6.0",
|
|
51
|
+
"eslint-plugin-node": "^11.1.0",
|
|
52
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
53
|
+
"eslint-plugin-react": "^7.30.1",
|
|
54
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
55
|
+
"file-loader": "^6.2.0",
|
|
56
|
+
"fork-ts-checker-webpack-plugin": "^7.2.12",
|
|
57
|
+
"html-loader": "^3.1.2",
|
|
58
|
+
"html-webpack-plugin": "^5.5.0",
|
|
59
|
+
"husky": "^8.0.1",
|
|
60
|
+
"lint-staged": "^13.0.3",
|
|
61
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
62
|
+
"prettier": "^2.7.1",
|
|
63
|
+
"sass": "^1.53.0",
|
|
64
|
+
"sass-loader": "^13.0.2",
|
|
65
|
+
"style-loader": "^3.3.1",
|
|
66
|
+
"terser-webpack-plugin": "^5.3.3",
|
|
67
|
+
"tsc-alias": "^1.6.11",
|
|
68
|
+
"typescript": "^4.7.4",
|
|
69
|
+
"webpack": "^5.73.0",
|
|
70
|
+
"webpack-cli": "^4.10.0",
|
|
71
|
+
"webpack-dev-server": "^4.9.3",
|
|
72
|
+
"webpack-merge": "^5.8.0"
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"axios": "^1.2.2",
|
|
76
|
+
"react": ">=17.0.2",
|
|
77
|
+
"react-dom": ">=17.0.2"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"react": ">=17.0.2",
|
|
81
|
+
"react-dom": ">=17.0.2"
|
|
82
|
+
},
|
|
83
|
+
"lint-staged": {
|
|
84
|
+
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
85
|
+
"yarn run prettier:fix",
|
|
86
|
+
"yarn run lint",
|
|
87
|
+
"git add ."
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"browserslist": {
|
|
91
|
+
"production": [
|
|
92
|
+
">0.2%",
|
|
93
|
+
"not dead",
|
|
94
|
+
"not op_mini all"
|
|
95
|
+
],
|
|
96
|
+
"development": [
|
|
97
|
+
"last 1 chrome version",
|
|
98
|
+
"last 1 firefox version",
|
|
99
|
+
"last 1 safari version"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -17,5 +17,10 @@ export declare const SupportedNetworks: {
|
|
|
17
17
|
readonly Mada: "mada";
|
|
18
18
|
readonly MasterCard: "masterCard";
|
|
19
19
|
readonly Visa: "visa";
|
|
20
|
+
readonly ChinaUnionPay: "chinaUnionPay";
|
|
21
|
+
readonly Discover: "discover";
|
|
22
|
+
readonly Electron: "electron";
|
|
23
|
+
readonly Jcb: "jcb";
|
|
24
|
+
readonly Maestro: "maestro";
|
|
20
25
|
};
|
|
21
26
|
export declare const ApplePayVersion = 5;
|
|
@@ -16,6 +16,11 @@ export var SupportedNetworks = {
|
|
|
16
16
|
Amex: 'amex',
|
|
17
17
|
Mada: 'mada',
|
|
18
18
|
MasterCard: 'masterCard',
|
|
19
|
-
Visa: 'visa'
|
|
19
|
+
Visa: 'visa',
|
|
20
|
+
ChinaUnionPay: 'chinaUnionPay',
|
|
21
|
+
Discover: 'discover',
|
|
22
|
+
Electron: 'electron',
|
|
23
|
+
Jcb: 'jcb',
|
|
24
|
+
Maestro: 'maestro'
|
|
20
25
|
};
|
|
21
26
|
export var ApplePayVersion = 5;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -87,14 +87,15 @@ export var useApplePay = function (_a) {
|
|
|
87
87
|
return [2];
|
|
88
88
|
}
|
|
89
89
|
try {
|
|
90
|
-
paymentMethod = getApplePayPaymentMethod(
|
|
90
|
+
paymentMethod = getApplePayPaymentMethod(profileData.payment_options.payment_methods || []);
|
|
91
91
|
currency = validateCurrency(transaction.currency, paymentMethod.supported_currencies);
|
|
92
92
|
cardBrands = validateSupportedNetworks(paymentMethod.supported_card_brands, supportedNetworks);
|
|
93
93
|
request = getApplePayRequest({
|
|
94
94
|
countryCode: profileData.merchant.country_code,
|
|
95
95
|
transaction: __assign(__assign({}, transaction), { currency: currency }),
|
|
96
96
|
billingContact: billingContact,
|
|
97
|
-
supportedNetworks: cardBrands
|
|
97
|
+
supportedNetworks: cardBrands,
|
|
98
|
+
name: profileData.merchant.name
|
|
98
99
|
});
|
|
99
100
|
console.info("Creating ApplePaySession with version: ".concat(ApplePayVersion, " and request: ").concat(JSON.stringify(request)));
|
|
100
101
|
session_1 = new ApplePaySession(ApplePayVersion, request);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApplePayButton, renderApplePayButton } from './features/ApplePayButton';
|
|
2
2
|
import { ButtonStyle, Scope, SupportedNetworks } from './constants';
|
|
3
|
+
import * as PackageJson from '../package.json';
|
|
3
4
|
export { ApplePayButton, ButtonStyle, Scope, SupportedNetworks };
|
|
4
5
|
window['TapSDKs'] = {
|
|
5
6
|
renderApplePayButton: renderApplePayButton,
|
|
@@ -7,4 +8,4 @@ window['TapSDKs'] = {
|
|
|
7
8
|
Scope: Scope,
|
|
8
9
|
SupportedNetworks: SupportedNetworks
|
|
9
10
|
};
|
|
10
|
-
console.log("apple-pay-button version: ".concat(
|
|
11
|
+
console.log("apple-pay-button version: ".concat(PackageJson.version));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ApplePayButtonProps, ApplePayRequestData, PaymentMethod } from '../@types';
|
|
2
2
|
import { SupportedNetworks } from '../constants';
|
|
3
|
-
export declare const validateSupportedNetworks: (supportedNetworksConfig: Array<(typeof SupportedNetworks)[keyof typeof SupportedNetworks]>, supportedNetworks: ApplePayButtonProps['supportedNetworks']) => ("amex" | "mada" | "masterCard" | "visa")[];
|
|
3
|
+
export declare const validateSupportedNetworks: (supportedNetworksConfig: Array<(typeof SupportedNetworks)[keyof typeof SupportedNetworks]>, supportedNetworks: ApplePayButtonProps['supportedNetworks']) => ("amex" | "mada" | "masterCard" | "visa" | "chinaUnionPay" | "discover" | "electron" | "jcb" | "maestro")[];
|
|
4
4
|
export declare const validateCurrency: (currency: string, currencies: string[]) => string;
|
|
5
|
-
export declare const getApplePayRequest: ({ transaction, billingContact, supportedNetworks, countryCode }: Pick<ApplePayButtonProps, "supportedNetworks" | "transaction" | "billingContact"> & {
|
|
5
|
+
export declare const getApplePayRequest: ({ transaction, billingContact, supportedNetworks, countryCode, name }: Pick<ApplePayButtonProps, "supportedNetworks" | "transaction" | "billingContact"> & {
|
|
6
6
|
countryCode: string;
|
|
7
|
+
name: string;
|
|
7
8
|
}) => ApplePayRequestData;
|
|
8
9
|
export declare const getApplePayPaymentMethod: (paymentMethods: Array<PaymentMethod>) => PaymentMethod;
|
|
@@ -24,7 +24,7 @@ export var validateCurrency = function (currency, currencies) {
|
|
|
24
24
|
return currency;
|
|
25
25
|
};
|
|
26
26
|
export var getApplePayRequest = function (_a) {
|
|
27
|
-
var transaction = _a.transaction, billingContact = _a.billingContact, supportedNetworks = _a.supportedNetworks, countryCode = _a.countryCode;
|
|
27
|
+
var transaction = _a.transaction, billingContact = _a.billingContact, supportedNetworks = _a.supportedNetworks, countryCode = _a.countryCode, name = _a.name;
|
|
28
28
|
return {
|
|
29
29
|
countryCode: countryCode,
|
|
30
30
|
currencyCode: transaction.currency,
|
|
@@ -38,7 +38,7 @@ export var getApplePayRequest = function (_a) {
|
|
|
38
38
|
},
|
|
39
39
|
total: {
|
|
40
40
|
amount: Number(transaction.amount),
|
|
41
|
-
label:
|
|
41
|
+
label: name
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|