@fat-zebra/sdk 1.5.2 → 1.5.3-beta.1
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.dev.md +5 -0
- package/build-styles.js +8 -1
- package/dist/index.js +3 -2
- package/package.json +2 -2
- package/tsconfig.package.json +2 -1
- package/dist/local/fatzebra.css +0 -91
- package/dist/local/fatzebra.js +0 -18990
- package/dist/local/fatzebra.js.map +0 -1
- package/dist/local/index.html +0 -247
- package/dist/paypal/paypal-button.d.ts +0 -31
- package/dist/paypal/paypal-button.js +0 -199
- package/dist/paypal/paypal-checkout.d.ts +0 -21
- package/dist/paypal/paypal-checkout.js +0 -100
- package/dist/paypal/types.d.ts +0 -188
- package/dist/paypal/types.js +0 -5
- package/dist/paypal/validation.d.ts +0 -4
- package/dist/paypal/validation.js +0 -65
- package/dist/production/fatzebra.css +0 -91
- package/dist/production/fatzebra.js +0 -2
- package/dist/production/fatzebra.js.LICENSE.txt +0 -1
- package/dist/staging/fatzebra.css +0 -91
- package/dist/staging/fatzebra.js +0 -17717
- package/dist/staging/fatzebra.js.map +0 -1
- package/dist/staging/index.html +0 -247
package/dist/paypal/types.d.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { PaymentMethod, PaymentIntent } from '../shared/types';
|
|
2
|
-
export interface PayPalConfig {
|
|
3
|
-
currency: string;
|
|
4
|
-
payment: PayPalOrderParams;
|
|
5
|
-
containerId: string;
|
|
6
|
-
style?: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export interface PayPalOrderParams {
|
|
11
|
-
paymentIntent?: PaymentIntent;
|
|
12
|
-
paymentMethod: PaymentMethod;
|
|
13
|
-
}
|
|
14
|
-
export declare enum PayPalIntent {
|
|
15
|
-
CAPTURE = "CAPTURE",
|
|
16
|
-
AUTHORIZE = "AUTHORIZE"
|
|
17
|
-
}
|
|
18
|
-
export type PayPalPaymentMethod = PayPalOrderRequest | PayPalBillingAgreementRequest;
|
|
19
|
-
/***************** PayPal Order Object ******************/
|
|
20
|
-
export interface PayPalOrderRequest {
|
|
21
|
-
intent: 'capture' | 'authorize';
|
|
22
|
-
options?: {
|
|
23
|
-
brandName?: string;
|
|
24
|
-
landingPage?: string;
|
|
25
|
-
payeePreferredPayment?: string;
|
|
26
|
-
shippingPreference?: string;
|
|
27
|
-
};
|
|
28
|
-
purchases: Purchases[];
|
|
29
|
-
}
|
|
30
|
-
interface Purchases {
|
|
31
|
-
description?: string;
|
|
32
|
-
softDescriptor?: string;
|
|
33
|
-
amount: Amount;
|
|
34
|
-
items?: Item[];
|
|
35
|
-
shippingAddress: {
|
|
36
|
-
name?: string;
|
|
37
|
-
method?: string;
|
|
38
|
-
address: Address;
|
|
39
|
-
};
|
|
40
|
-
payee?: {
|
|
41
|
-
emailAddress: string;
|
|
42
|
-
merchantId: string;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
interface Amount {
|
|
46
|
-
itemTotal?: number;
|
|
47
|
-
shipping?: number;
|
|
48
|
-
handling?: number;
|
|
49
|
-
taxTotal?: number;
|
|
50
|
-
shippingDiscount?: number;
|
|
51
|
-
insurance?: number;
|
|
52
|
-
discount?: number;
|
|
53
|
-
}
|
|
54
|
-
interface Address {
|
|
55
|
-
firstName?: string;
|
|
56
|
-
lastName?: string;
|
|
57
|
-
address_1?: string;
|
|
58
|
-
address_2?: string;
|
|
59
|
-
city?: string;
|
|
60
|
-
state?: string;
|
|
61
|
-
postcode?: string;
|
|
62
|
-
country: string;
|
|
63
|
-
}
|
|
64
|
-
interface Item {
|
|
65
|
-
name: string;
|
|
66
|
-
description?: string;
|
|
67
|
-
sku?: string;
|
|
68
|
-
unitAmount: number;
|
|
69
|
-
tax?: number;
|
|
70
|
-
qty: string;
|
|
71
|
-
category?: string;
|
|
72
|
-
}
|
|
73
|
-
export interface CreatePayPalOrderRequest {
|
|
74
|
-
order: PayPalOrderRequest;
|
|
75
|
-
}
|
|
76
|
-
export interface PayPalOrderResponse {
|
|
77
|
-
id: string;
|
|
78
|
-
intent: PayPalIntent;
|
|
79
|
-
}
|
|
80
|
-
/***************** PayPal Capture Object ******************/
|
|
81
|
-
export interface CapturePayPalOrderRequest {
|
|
82
|
-
id: string;
|
|
83
|
-
}
|
|
84
|
-
export interface CapturePayPalOrderResponse {
|
|
85
|
-
id: string;
|
|
86
|
-
intent: string;
|
|
87
|
-
reference: string;
|
|
88
|
-
paypal_reference: string;
|
|
89
|
-
invoice_id: string;
|
|
90
|
-
amount: number;
|
|
91
|
-
decimal_amount: number;
|
|
92
|
-
captured_amount: number;
|
|
93
|
-
captured: boolean;
|
|
94
|
-
successful: boolean;
|
|
95
|
-
status: string;
|
|
96
|
-
message: string;
|
|
97
|
-
currency: string;
|
|
98
|
-
transaction_id: string;
|
|
99
|
-
transaction_date: Date;
|
|
100
|
-
response_code: string;
|
|
101
|
-
paypal_fee: number;
|
|
102
|
-
seller_receivable_net_amount: number;
|
|
103
|
-
note_to_payer: string;
|
|
104
|
-
is_final_capture: boolean;
|
|
105
|
-
refunded_amount: number;
|
|
106
|
-
balance_available_for_refund: number;
|
|
107
|
-
balance_available_for_capture: number;
|
|
108
|
-
authorization: string;
|
|
109
|
-
order: string;
|
|
110
|
-
}
|
|
111
|
-
/***************** PayPal Authorize Object ******************/
|
|
112
|
-
export interface AuthorizePayPalOrderRequest {
|
|
113
|
-
id: string;
|
|
114
|
-
}
|
|
115
|
-
export interface AuthorizePayPalOrderResponse {
|
|
116
|
-
id: string;
|
|
117
|
-
intent: string;
|
|
118
|
-
reference: string;
|
|
119
|
-
paypal_reference: string;
|
|
120
|
-
invoice_id: string;
|
|
121
|
-
amount: number;
|
|
122
|
-
decimal_amount: number;
|
|
123
|
-
captured_amount: number;
|
|
124
|
-
captured: boolean;
|
|
125
|
-
successful: boolean;
|
|
126
|
-
status: string;
|
|
127
|
-
message: string;
|
|
128
|
-
currency: string;
|
|
129
|
-
transaction_id: string;
|
|
130
|
-
transaction_date: Date;
|
|
131
|
-
response_code: string;
|
|
132
|
-
refunded_amount: number;
|
|
133
|
-
balance_available_for_capture: number;
|
|
134
|
-
order: string;
|
|
135
|
-
}
|
|
136
|
-
/***************** PayPal Billing Agreement Object ******************/
|
|
137
|
-
export interface PayPalBillingAgreementRequest {
|
|
138
|
-
name?: string;
|
|
139
|
-
description?: string;
|
|
140
|
-
shippingAddress: BillingAddress;
|
|
141
|
-
merchantCustomData?: string;
|
|
142
|
-
}
|
|
143
|
-
export interface CreatePayPalBillingAgreementRequest {
|
|
144
|
-
billing: PayPalBillingAgreementRequest;
|
|
145
|
-
}
|
|
146
|
-
interface BillingAddress {
|
|
147
|
-
firstName?: string;
|
|
148
|
-
lastName?: string;
|
|
149
|
-
address_1: string;
|
|
150
|
-
address_2?: string;
|
|
151
|
-
city: string;
|
|
152
|
-
state: string;
|
|
153
|
-
postcode: string;
|
|
154
|
-
country: string;
|
|
155
|
-
}
|
|
156
|
-
export interface PayPalBillingAgreementResponse {
|
|
157
|
-
token_id: string;
|
|
158
|
-
}
|
|
159
|
-
export interface ApprovePayPalBillingAgreementRequest {
|
|
160
|
-
id: string;
|
|
161
|
-
}
|
|
162
|
-
export interface ApprovePayPalBillingAgreementResponse {
|
|
163
|
-
token: string;
|
|
164
|
-
name?: string;
|
|
165
|
-
description?: string;
|
|
166
|
-
state: string;
|
|
167
|
-
payer?: {
|
|
168
|
-
payer_info: {
|
|
169
|
-
email: string;
|
|
170
|
-
first_name: string;
|
|
171
|
-
last_name: string;
|
|
172
|
-
payer_id: string;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
shipping_address?: {
|
|
176
|
-
first_name?: string;
|
|
177
|
-
last_name?: string;
|
|
178
|
-
address_1: string;
|
|
179
|
-
address_2?: string;
|
|
180
|
-
city: string;
|
|
181
|
-
state: string;
|
|
182
|
-
postcode: string;
|
|
183
|
-
country: string;
|
|
184
|
-
};
|
|
185
|
-
merchant_custom_data?: string;
|
|
186
|
-
created_at: Date;
|
|
187
|
-
}
|
|
188
|
-
export {};
|
package/dist/paypal/types.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PayPalConfig, PayPalOrderParams } from './types';
|
|
2
|
-
import { ValidationResult } from '../shared/types';
|
|
3
|
-
export declare const validatePayPalSetup: (props: PayPalConfig) => ValidationResult;
|
|
4
|
-
export declare const validatePayPalRequest: (props: PayPalOrderParams, billing?: boolean) => ValidationResult;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { PayPalIntent } from './types';
|
|
2
|
-
const PaypalConfigRequiredProps = ['currency', 'containerId', 'payment'];
|
|
3
|
-
const PaypalOrderRequiredProps = ['intent', 'purchases'];
|
|
4
|
-
const PaypalBillingRequiredProps = ['shippingAddress'];
|
|
5
|
-
export const validatePayPalSetup = (props) => {
|
|
6
|
-
let errors = [];
|
|
7
|
-
const keys = Object.keys(props);
|
|
8
|
-
for (let requiredProp of PaypalConfigRequiredProps) {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
if (!keys.includes(requiredProp) || props[requiredProp] === undefined) {
|
|
11
|
-
errors.push(`${requiredProp} is missing.`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
valid: errors.length == 0,
|
|
16
|
-
errors
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export const validatePayPalRequest = (props, billing) => {
|
|
20
|
-
let errors = [];
|
|
21
|
-
const keys = Object.keys(props);
|
|
22
|
-
if (!keys.includes('paymentMethod')) {
|
|
23
|
-
errors.push(`paymentMethod is missing.`);
|
|
24
|
-
}
|
|
25
|
-
if (!keys.includes('paymentIntent') && !billing) {
|
|
26
|
-
errors.push(`paymentIntent is missing.`);
|
|
27
|
-
}
|
|
28
|
-
if (props.paymentMethod) {
|
|
29
|
-
const orderKeys = Object.keys(props.paymentMethod.data);
|
|
30
|
-
if (orderKeys.includes('intent')) {
|
|
31
|
-
const intent = props.paymentMethod.data.intent.toLowerCase();
|
|
32
|
-
const intents = Object.values(PayPalIntent).map(v => v.toLowerCase());
|
|
33
|
-
if (!intents.includes(intent)) {
|
|
34
|
-
errors.push(`intent is invalid, must be one of [${intents.join(', ')}].`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (!props.paymentMethod.type) {
|
|
38
|
-
errors.push(`paymentMethod.type is missing.`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (errors.length > 0) {
|
|
42
|
-
return {
|
|
43
|
-
valid: errors.length == 0,
|
|
44
|
-
errors
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const paymentMethod = props.paymentMethod.data;
|
|
48
|
-
const providedKeys = Object.keys(paymentMethod);
|
|
49
|
-
let requiredProps;
|
|
50
|
-
if (billing === true) {
|
|
51
|
-
requiredProps = PaypalBillingRequiredProps;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
requiredProps = PaypalOrderRequiredProps;
|
|
55
|
-
}
|
|
56
|
-
for (let requiredProp of requiredProps) {
|
|
57
|
-
if (!providedKeys.includes(requiredProp)) {
|
|
58
|
-
errors.push(`${requiredProp} is missing.`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
valid: errors.length == 0,
|
|
63
|
-
errors
|
|
64
|
-
};
|
|
65
|
-
};
|
|
@@ -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
|
-
}
|