@fat-zebra/sdk 1.5.5-beta.0 → 1.5.5
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/dist/applepay/applepay.d.ts +7 -22
- package/dist/applepay/applepay.js +21 -89
- package/dist/applepay/clients/apple-pay-client.d.ts +5 -9
- package/dist/applepay/clients/apple-pay-client.js +3 -9
- package/dist/applepay/clients/paynow-client.d.ts +2 -4
- package/dist/applepay/clients/paynow-client.js +7 -2
- package/dist/click_to_pay/index.js +0 -12
- package/dist/click_to_pay/types.d.ts +2 -11
- package/dist/local/fatzebra.js.map +1 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.js +2 -24
- package/dist/paypal/paypal-button.d.ts +31 -0
- package/dist/paypal/paypal-button.js +199 -0
- package/dist/paypal/paypal-checkout.d.ts +21 -0
- package/dist/paypal/paypal-checkout.js +100 -0
- package/dist/paypal/types.d.ts +188 -0
- package/dist/paypal/types.js +5 -0
- package/dist/paypal/validation.d.ts +4 -0
- package/dist/paypal/validation.js +65 -0
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.js +1 -2
- package/dist/react/{applePayUrl.d.ts → url.d.ts} +2 -2
- package/dist/react/url.js +33 -0
- package/dist/react/useFatZebra.js +57 -8
- package/dist/shared/env.development.d.ts +3 -3
- package/dist/shared/env.development.js +3 -3
- package/dist/shared/envs/local.d.ts +3 -3
- package/dist/shared/envs/local.js +3 -3
- package/dist/shared/post-message-client.d.ts +0 -2
- package/dist/shared/post-message-client.js +1 -1
- package/dist/shared/types.d.ts +2 -14
- package/dist/shared/types.js +0 -2
- package/dist/src/paypal/paypal-button.js +311 -0
- package/dist/src/paypal/paypal-button.js.map +1 -0
- package/dist/src/paypal/paypal-button.test.js +41 -0
- package/dist/src/paypal/paypal-button.test.js.map +1 -0
- package/dist/src/paypal/paypal-checkout.js +111 -0
- package/dist/src/paypal/paypal-checkout.js.map +1 -0
- package/dist/src/paypal/paypal-checkout.test.js +167 -0
- package/dist/src/paypal/paypal-checkout.test.js.map +1 -0
- package/dist/src/paypal/types.js +9 -0
- package/dist/src/paypal/types.js.map +1 -0
- package/dist/src/paypal/validation.js +73 -0
- package/dist/src/paypal/validation.js.map +1 -0
- package/dist/src/react/{applePayUrl.js → url.js} +21 -7
- package/dist/src/react/url.js.map +1 -0
- package/dist/src/react/url.test.js +88 -0
- package/dist/src/react/url.test.js.map +1 -0
- package/dist/src/react/useFatZebra.js +56 -7
- package/dist/src/react/useFatZebra.js.map +1 -1
- package/dist/validation/schemas/click-to-pay/options.json +3 -30
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/.idea/fatzebra-js.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/dist/applepay/applepaymanager.d.ts +0 -28
- package/dist/applepay/applepaymanager.js +0 -115
- package/dist/applepay/types.d.ts +0 -15
- package/dist/applepay/types.js +0 -1
- package/dist/fatzebra.css +0 -91
- package/dist/local/fatzebra.js +0 -19565
- package/dist/production/fatzebra.css +0 -91
- package/dist/production/fatzebra.js +0 -2
- package/dist/react/ApplePay.d.ts +0 -9
- package/dist/react/ApplePay.js +0 -11
- package/dist/react/ApplePayButton.d.ts +0 -8
- package/dist/react/ApplePayButton.js +0 -18
- package/dist/react/applePayUrl.js +0 -19
- package/dist/react/useMessage.d.ts +0 -10
- package/dist/react/useMessage.js +0 -70
- package/dist/sandbox/fatzebra.css +0 -91
- package/dist/sandbox/fatzebra.js +0 -2
- package/dist/sandbox/fatzebra.js.LICENSE.txt +0 -1
- package/dist/src/applepay/applepaymanager.js +0 -279
- package/dist/src/applepay/applepaymanager.js.map +0 -1
- package/dist/src/react/ApplePayButton.js +0 -56
- package/dist/src/react/ApplePayButton.js.map +0 -1
- package/dist/src/react/applePayUrl.js.map +0 -1
- package/dist/src/react/applePayUrl.test.js +0 -57
- package/dist/src/react/applePayUrl.test.js.map +0 -1
- package/dist/src/react/useMessage.js +0 -140
- package/dist/src/react/useMessage.js.map +0 -1
- package/dist/src/react/useMessage.test.js +0 -222
- package/dist/src/react/useMessage.test.js.map +0 -1
- package/dist/src/validation/validators/apple-pay-load-params-button-validator.js +0 -19
- package/dist/src/validation/validators/apple-pay-load-params-button-validator.js.map +0 -1
- package/dist/staging/fatzebra.css +0 -91
- package/dist/staging/fatzebra.js +0 -19565
- package/dist/staging/fatzebra.js.map +0 -1
- package/dist/staging/index.html +0 -247
- package/dist/validation/schemas/applepay/load-params.json +0 -31
- package/dist/validation/schemas/applepay/options.json +0 -42
- package/dist/validation/schemas/applepay/payment-intent.json +0 -42
- package/dist/validation/validators/apple-pay-load-params-button-validator.d.ts +0 -3
- package/dist/validation/validators/apple-pay-load-params-button-validator.js +0 -12
|
@@ -5,44 +5,17 @@
|
|
|
5
5
|
"Options": {
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"auth": {
|
|
9
|
-
"type": "boolean"
|
|
10
|
-
},
|
|
11
|
-
"cardListButtonText": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
|
-
"css": {
|
|
15
|
-
"type": "string"
|
|
16
|
-
},
|
|
17
|
-
"cssSignature": {
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"displayName": {
|
|
21
|
-
"type": "string"
|
|
22
|
-
},
|
|
23
8
|
"hideConfirmButton": {
|
|
24
9
|
"type": "boolean"
|
|
25
10
|
},
|
|
26
|
-
"
|
|
27
|
-
"type": "boolean"
|
|
28
|
-
},
|
|
29
|
-
"returnPath": {
|
|
30
|
-
"type": "string"
|
|
31
|
-
},
|
|
32
|
-
"returnTarget": {
|
|
33
|
-
"type": "string"
|
|
34
|
-
},
|
|
35
|
-
"saveCard": {
|
|
11
|
+
"tokenizeOnly": {
|
|
36
12
|
"type": "boolean"
|
|
37
13
|
},
|
|
38
|
-
"
|
|
14
|
+
"css": {
|
|
39
15
|
"type": "string"
|
|
40
16
|
},
|
|
41
|
-
"
|
|
17
|
+
"cssSignature": {
|
|
42
18
|
"type": "string"
|
|
43
|
-
},
|
|
44
|
-
"tokenizeOnly": {
|
|
45
|
-
"type": "boolean"
|
|
46
19
|
}
|
|
47
20
|
}
|
|
48
21
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.5.
|
|
1
|
+
export declare const version = "1.5.4";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.5.
|
|
1
|
+
export const version = '1.5.4';
|
package/package.json
CHANGED
package/.idea/fatzebra-js.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/fatzebra-js.iml" filepath="$PROJECT_DIR$/.idea/fatzebra-js.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/vcs.xml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { PaymentRequest } from './clients/apple-pay-client';
|
|
2
|
-
import * as payNow from './clients/paynow-client';
|
|
3
|
-
import { PostMessage } from '../shared/post-message-client';
|
|
4
|
-
declare class ApplePayManager {
|
|
5
|
-
private merchantId;
|
|
6
|
-
private canMakePayments;
|
|
7
|
-
private iframe;
|
|
8
|
-
private applePaySession;
|
|
9
|
-
private postMessageClient;
|
|
10
|
-
private fzPayNowDomain;
|
|
11
|
-
private username?;
|
|
12
|
-
private token?;
|
|
13
|
-
constructor(config: {
|
|
14
|
-
iframe: HTMLIFrameElement;
|
|
15
|
-
fzPayNowDomain: string;
|
|
16
|
-
username?: string;
|
|
17
|
-
token?: string;
|
|
18
|
-
});
|
|
19
|
-
initialize(): Promise<void>;
|
|
20
|
-
checkApplePayEligibility(): void;
|
|
21
|
-
notifyApplePayEligibility(): void;
|
|
22
|
-
registerEventListener(): Promise<void>;
|
|
23
|
-
purchase(request: PaymentRequest): Promise<void>;
|
|
24
|
-
extractApplePaymentRequestParams(payload: any): PaymentRequest;
|
|
25
|
-
extractPayNowPaymentAttributes(payload: any): payNow.PaymentAttributes;
|
|
26
|
-
sendMessage(payload: PostMessage): void;
|
|
27
|
-
}
|
|
28
|
-
export default ApplePayManager;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { createSession, getEligibilty, } from './clients/apple-pay-client';
|
|
11
|
-
import * as payNow from './clients/paynow-client';
|
|
12
|
-
import { PostMessageClient } from '../shared/post-message-client';
|
|
13
|
-
// import * as process from "process";
|
|
14
|
-
const channel = 'applepay';
|
|
15
|
-
// const fzPayNowDomain = process.env.PAYNOW_BASE_URL
|
|
16
|
-
// do the domain handling stuff better
|
|
17
|
-
const paynowDomain = 'https://paynow.test';
|
|
18
|
-
const merchantSessionPath = '/v2/apple_pay/payment_session';
|
|
19
|
-
const purchaseTokenPath = '/v2/apple_pay/token';
|
|
20
|
-
class ApplePayManager {
|
|
21
|
-
constructor(config) {
|
|
22
|
-
// if (!config.fzPayNowDomain) {
|
|
23
|
-
// console.log('hitting i here')
|
|
24
|
-
// this.fzPayNowDomain = process?.env?.PAYNOW_BASE_URL;
|
|
25
|
-
// } else {
|
|
26
|
-
this.fzPayNowDomain = config.fzPayNowDomain;
|
|
27
|
-
this.username = config.username;
|
|
28
|
-
this.token = config.token;
|
|
29
|
-
// }
|
|
30
|
-
this.iframe = config.iframe;
|
|
31
|
-
this.postMessageClient = new PostMessageClient({
|
|
32
|
-
channel: 'applepay',
|
|
33
|
-
target: this.iframe
|
|
34
|
-
});
|
|
35
|
-
this.initialize();
|
|
36
|
-
}
|
|
37
|
-
initialize() {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
yield this.registerEventListener();
|
|
40
|
-
this.checkApplePayEligibility();
|
|
41
|
-
this.notifyApplePayEligibility();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
checkApplePayEligibility() {
|
|
45
|
-
if (getEligibilty()) {
|
|
46
|
-
this.canMakePayments = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
notifyApplePayEligibility() {
|
|
50
|
-
const message = {
|
|
51
|
-
channel,
|
|
52
|
-
subject: 'eligibility',
|
|
53
|
-
data: {
|
|
54
|
-
canMakePayments: this.canMakePayments
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
this.postMessageClient.send(message);
|
|
58
|
-
}
|
|
59
|
-
registerEventListener() {
|
|
60
|
-
return new Promise((resolve, reject) => {
|
|
61
|
-
this.postMessageClient.setEventListeners({
|
|
62
|
-
'paymentrequest': (data) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
yield this.purchase(data);
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
resolve();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
purchase(request) {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const applePayPaymentRequest = this.extractApplePaymentRequestParams(request);
|
|
72
|
-
const payNowPaymentAttributes = this.extractPayNowPaymentAttributes(request);
|
|
73
|
-
this.applePaySession = yield createSession(applePayPaymentRequest);
|
|
74
|
-
this.applePaySession.onvalidatemerchant = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
let merchantSession;
|
|
76
|
-
try {
|
|
77
|
-
merchantSession = yield payNow.getMerchantSession(event.validationURL, Object.assign(Object.assign({}, payNowPaymentAttributes), { merchant: this.username, domain_name: window.location.hostname, display_name: this.username }), `${paynowDomain}${merchantSessionPath}`, this.username, this.token);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
console.log('Unable to establish new merchant session');
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
this.applePaySession.completeMerchantValidation(merchantSession);
|
|
84
|
-
});
|
|
85
|
-
this.applePaySession.onpaymentauthorized = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
try {
|
|
87
|
-
yield payNow.authorizePayment(Object.assign(Object.assign({}, payNowPaymentAttributes), { merchant: this.username, token: event.payment.token }), `${paynowDomain}${purchaseTokenPath}`);
|
|
88
|
-
this.applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
this.applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
this.applePaySession.begin();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
extractApplePaymentRequestParams(payload) {
|
|
98
|
-
const { countryCode, currencyCode, merchantCapabilities, supportedNetworks, total, } = payload;
|
|
99
|
-
return {
|
|
100
|
-
countryCode,
|
|
101
|
-
currencyCode,
|
|
102
|
-
merchantCapabilities,
|
|
103
|
-
supportedNetworks,
|
|
104
|
-
total,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
extractPayNowPaymentAttributes(payload) {
|
|
108
|
-
const { paymentAttributes } = payload;
|
|
109
|
-
return paymentAttributes;
|
|
110
|
-
}
|
|
111
|
-
sendMessage(payload) {
|
|
112
|
-
this.iframe.contentWindow.postMessage(payload, this.fzPayNowDomain);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
export default ApplePayManager;
|
package/dist/applepay/types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Environment } from "../shared/env";
|
|
2
|
-
import { PaymentIntent } from "../shared/types";
|
|
3
|
-
import { MerchantCapability, SupportedNetwork } from "./clients/apple-pay-client";
|
|
4
|
-
interface ApplePayOptions {
|
|
5
|
-
allowed_card_networks?: Array<SupportedNetwork>;
|
|
6
|
-
allowed_card_types?: Array<MerchantCapability>;
|
|
7
|
-
domain_name?: string;
|
|
8
|
-
}
|
|
9
|
-
interface ApplePayParams {
|
|
10
|
-
containerId: string;
|
|
11
|
-
environment: Environment;
|
|
12
|
-
paymentIntent: PaymentIntent;
|
|
13
|
-
options?: ApplePayOptions;
|
|
14
|
-
}
|
|
15
|
-
export { type ApplePayParams, type ApplePayOptions };
|
package/dist/applepay/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/fatzebra.css
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
.checkout-button-wrapper {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
height: 200px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.iframe-checkout {
|
|
9
|
-
flex: 1;
|
|
10
|
-
border: none;
|
|
11
|
-
width: 100%;
|
|
12
|
-
height: 100%;
|
|
13
|
-
min-height: 0;
|
|
14
|
-
overflow: auto;
|
|
15
|
-
-webkit-overflow-scrolling: touch;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.iframe-foreground,
|
|
19
|
-
.iframe-background {
|
|
20
|
-
top: 0;
|
|
21
|
-
left: 0;
|
|
22
|
-
right: 0;
|
|
23
|
-
bottom: 0;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.iframe-foreground,
|
|
28
|
-
.iframe-background {
|
|
29
|
-
position: fixed;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.iframe-foreground {
|
|
33
|
-
z-index: -1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.iframe-background {
|
|
37
|
-
background: rgba(0, 0, 0, 0.5);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.iframe-foreground {
|
|
41
|
-
flex-grow: 1;
|
|
42
|
-
top: auto;
|
|
43
|
-
width: 100%;
|
|
44
|
-
max-width: 480px;
|
|
45
|
-
height: 80vh;
|
|
46
|
-
background-color: #ffffff;
|
|
47
|
-
border-radius: 25px 25px 0 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.slide-in .iframe-foreground {
|
|
51
|
-
transform: translateY(100vh);
|
|
52
|
-
transition: transform 0.4s ease, z-index 0.3s ease 0.4s;
|
|
53
|
-
z-index: -1;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.slide-in .iframe-background {
|
|
57
|
-
opacity: 0;
|
|
58
|
-
z-index: -1;
|
|
59
|
-
transition: opacity 0.3s ease, z-index 0.3s ease 0.3s;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.slide-in.show .iframe-foreground {
|
|
63
|
-
transform: none;
|
|
64
|
-
transition: transform 0.4s ease;
|
|
65
|
-
z-index: 100;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.slide-in.show .iframe-background {
|
|
69
|
-
opacity: 1;
|
|
70
|
-
z-index: 0;
|
|
71
|
-
transition: opacity 0.3s ease;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@media only screen and (min-width: 480px) {
|
|
75
|
-
.iframe-foreground {
|
|
76
|
-
margin: 0 auto;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@media only screen and (min-width: 768px) {
|
|
81
|
-
.iframe-foreground {
|
|
82
|
-
margin: 0;
|
|
83
|
-
width: 400px;
|
|
84
|
-
height: 100vh;
|
|
85
|
-
left: 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.slide-in .iframe-foreground {
|
|
89
|
-
transform: translateX(-400px);
|
|
90
|
-
}
|
|
91
|
-
}
|