@paypal/checkout-components 5.0.286-alpha.0 → 5.0.286
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/__sdk__.js +0 -4
- package/dist/button.js +1 -1
- package/dist/test/button.js +1 -1
- package/package.json +1 -2
- package/src/ui/buttons/styles/color.js +8 -0
- package/src/connect/component.jsx +0 -46
- package/src/connect/component.test.js +0 -74
- package/src/connect/interface.js +0 -16
- package/src/connect/interface.test.js +0 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paypal/checkout-components",
|
|
3
|
-
"version": "5.0.286
|
|
3
|
+
"version": "5.0.286",
|
|
4
4
|
"description": "PayPal Checkout components, for integrating checkout products.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -109,7 +109,6 @@
|
|
|
109
109
|
"@krakenjs/zoid": "^10.3.1",
|
|
110
110
|
"@paypal/common-components": "^1.0.35",
|
|
111
111
|
"@paypal/funding-components": "^1.0.31",
|
|
112
|
-
"@paypal/connect-loader-component": "^1.1.0",
|
|
113
112
|
"@paypal/sdk-client": "^4.0.176",
|
|
114
113
|
"@paypal/sdk-constants": "^1.0.133",
|
|
115
114
|
"@paypal/sdk-logos": "^2.2.6"
|
|
@@ -33,6 +33,7 @@ export const buttonColorStyle = `
|
|
|
33
33
|
@media (hover:hover) {
|
|
34
34
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.GOLD}:hover {
|
|
35
35
|
filter: brightness(0.95);
|
|
36
|
+
overflow: inherit;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -156,6 +157,7 @@ export const buttonColorStyle = `
|
|
|
156
157
|
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.PAIDY}].${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT}:hover,
|
|
157
158
|
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.WECHATPAY}].${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT}:hover {
|
|
158
159
|
filter: brightness(1.2);
|
|
160
|
+
overflow: inherit;
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
/* APM button on focus actions */
|
|
@@ -214,6 +216,7 @@ export const buttonColorStyle = `
|
|
|
214
216
|
@media (hover:hover) {
|
|
215
217
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.BLUE}:hover {
|
|
216
218
|
filter: brightness(0.95);
|
|
219
|
+
overflow: inherit;
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
|
|
@@ -241,6 +244,7 @@ export const buttonColorStyle = `
|
|
|
241
244
|
@media (hover:hover) {
|
|
242
245
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.SILVER}:hover {
|
|
243
246
|
filter: brightness(0.95);
|
|
247
|
+
overflow: inherit;
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
250
|
|
|
@@ -267,6 +271,7 @@ export const buttonColorStyle = `
|
|
|
267
271
|
|
|
268
272
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DARKBLUE}:hover {
|
|
269
273
|
filter: brightness(1.2);
|
|
274
|
+
overflow: inherit;
|
|
270
275
|
}
|
|
271
276
|
|
|
272
277
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DARKBLUE}:focus {
|
|
@@ -294,6 +299,7 @@ export const buttonColorStyle = `
|
|
|
294
299
|
|
|
295
300
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.BLACK}:hover {
|
|
296
301
|
filter: brightness(1.2);
|
|
302
|
+
overflow: inherit;
|
|
297
303
|
}
|
|
298
304
|
|
|
299
305
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.BLACK}:focus {
|
|
@@ -321,6 +327,7 @@ export const buttonColorStyle = `
|
|
|
321
327
|
@media (hover:hover) {
|
|
322
328
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.WHITE}:hover {
|
|
323
329
|
filter: brightness(0.95);
|
|
330
|
+
overflow: inherit;
|
|
324
331
|
}
|
|
325
332
|
}
|
|
326
333
|
|
|
@@ -357,6 +364,7 @@ export const buttonColorStyle = `
|
|
|
357
364
|
|
|
358
365
|
.${CLASS.BUTTON} .${CLASS.CARD}:hover {
|
|
359
366
|
filter: brightness(1.2);
|
|
367
|
+
overflow: inherit;
|
|
360
368
|
}
|
|
361
369
|
|
|
362
370
|
.${CLASS.BUTTON} .${CLASS.CARD}:focus {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import { loadAxo } from "@paypal/connect-loader-component";
|
|
3
|
-
import {
|
|
4
|
-
getClientID,
|
|
5
|
-
getClientMetadataID,
|
|
6
|
-
getUserIDToken,
|
|
7
|
-
} from "@paypal/sdk-client/src";
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line flowtype/no-weak-types
|
|
10
|
-
export type ConnectComponent = any;
|
|
11
|
-
// TODO: What's the expected structure/approach for this interface. It's not a zoid
|
|
12
|
-
// scenario, so what do we return?
|
|
13
|
-
// -> Looks like it returns a function that accepts the props
|
|
14
|
-
// How do we define the input of merchant params here?
|
|
15
|
-
// $FlowFixMe
|
|
16
|
-
export const getConnectComponent = async (merchantProps) => {
|
|
17
|
-
const cmid = getClientMetadataID();
|
|
18
|
-
const clientID = getClientID();
|
|
19
|
-
const userIdToken = getUserIDToken();
|
|
20
|
-
// TODO: Sort out integration specifics for inputs
|
|
21
|
-
try {
|
|
22
|
-
const loadResult = await loadAxo({
|
|
23
|
-
platform: "PPCP",
|
|
24
|
-
btSdkVersion: "3.97.3-connect-alpha.6.1",
|
|
25
|
-
minified: false,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// FPTI: sdkversion, fraudnet info
|
|
29
|
-
return await window.braintree.connect.create({
|
|
30
|
-
...loadResult.metadata, // returns a localeURL for assets
|
|
31
|
-
...merchantProps, // AXO specific props
|
|
32
|
-
platformOptions: {
|
|
33
|
-
platform: "PPCP",
|
|
34
|
-
userIdToken, // <merchant-specified-via-data-user-id-token>
|
|
35
|
-
clientID, // <merchant-specified-to-SDK-on-query-param>
|
|
36
|
-
clientMetadataID: cmid, // <merchant-specified-via-data-client-metadata-id>
|
|
37
|
-
fraudnet: () => {
|
|
38
|
-
return "";
|
|
39
|
-
}, // Pattern TBD
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
} catch (error) {
|
|
43
|
-
// FPTI Log here
|
|
44
|
-
return new Error(error);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getClientID,
|
|
5
|
-
getClientMetadataID,
|
|
6
|
-
getUserIDToken,
|
|
7
|
-
} from "@paypal/sdk-client/src";
|
|
8
|
-
import { loadAxo } from "@paypal/connect-loader-component";
|
|
9
|
-
import { describe, expect, test, vi } from "vitest";
|
|
10
|
-
|
|
11
|
-
import { getConnectComponent } from "./component";
|
|
12
|
-
|
|
13
|
-
describe("getConnectComponent: returns ConnectComponent", () => {
|
|
14
|
-
const mockAxoMetadata = { someData: "data" };
|
|
15
|
-
const mockProps = { someProp: "value" };
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
window.braintree = {
|
|
18
|
-
connect: {
|
|
19
|
-
create: vi.fn(),
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
vi.mock("@paypal/sdk-client/src", () => {
|
|
24
|
-
return {
|
|
25
|
-
getClientID: vi.fn(() => "mock-client-id"),
|
|
26
|
-
getClientMetadataID: vi.fn(() => "mock-cmid"),
|
|
27
|
-
getUserIDToken: vi.fn(() => "mock-uid"),
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
vi.mock("@paypal/connect-loader-component", () => {
|
|
32
|
-
return {
|
|
33
|
-
loadAxo: vi.fn(),
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
loadAxo.mockResolvedValue({ metadata: mockAxoMetadata });
|
|
38
|
-
|
|
39
|
-
// getClientID.mockReturnValue("mock-client-id");
|
|
40
|
-
// getClientMetadataID.mockReturnValue("mock-cmid");
|
|
41
|
-
// getUserIDToken.mockReturnValue("mock-uid");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("loadAxo and window.braintree.connect.create are called with proper data", async () => {
|
|
45
|
-
await getConnectComponent(mockProps);
|
|
46
|
-
|
|
47
|
-
expect(getClientID).toHaveBeenCalled();
|
|
48
|
-
expect(getClientMetadataID).toHaveBeenCalled();
|
|
49
|
-
expect(getUserIDToken).toHaveBeenCalled();
|
|
50
|
-
expect(loadAxo).toHaveBeenCalled();
|
|
51
|
-
|
|
52
|
-
expect(window.braintree.connect.create).toHaveBeenCalledWith({
|
|
53
|
-
...mockAxoMetadata,
|
|
54
|
-
...mockProps,
|
|
55
|
-
platformOptions: {
|
|
56
|
-
platform: "PPCP",
|
|
57
|
-
clientID: "mock-client-id",
|
|
58
|
-
clientMetadataID: "mock-cmid",
|
|
59
|
-
userIdToken: "mock-uid",
|
|
60
|
-
fraudnet: expect.any(Function),
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("loadAxo failure is handled", async () => {
|
|
66
|
-
const errorMessage = "Something went wrong";
|
|
67
|
-
loadAxo.mockRejectedValue(errorMessage);
|
|
68
|
-
|
|
69
|
-
const error = await getConnectComponent(mockProps);
|
|
70
|
-
|
|
71
|
-
expect(error).toBeInstanceOf(Error);
|
|
72
|
-
expect(error.message).toEqual(errorMessage);
|
|
73
|
-
});
|
|
74
|
-
});
|
package/src/connect/interface.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable flowtype/no-weak-types */
|
|
2
|
-
/* @flow */
|
|
3
|
-
// flow-disable
|
|
4
|
-
|
|
5
|
-
import { getConnectComponent, type ConnectComponent } from "./component";
|
|
6
|
-
|
|
7
|
-
type ConnectThing = (merchantProps: any) => ConnectComponent;
|
|
8
|
-
// $FlowFixMe
|
|
9
|
-
export const Connect: ConnectThing = async (
|
|
10
|
-
merchantProps: any
|
|
11
|
-
): ConnectComponent => {
|
|
12
|
-
// $FlowFixMe
|
|
13
|
-
return await getConnectComponent(merchantProps);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/* eslint-enable flowtype/no-weak-types */
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
import { describe, expect, vi } from "vitest";
|
|
4
|
-
|
|
5
|
-
import { getConnectComponent } from "./component";
|
|
6
|
-
import { Connect } from "./interface";
|
|
7
|
-
|
|
8
|
-
describe("interface.js", () => {
|
|
9
|
-
vi.mock("./component", () => {
|
|
10
|
-
return {
|
|
11
|
-
getConnectComponent: vi.fn(),
|
|
12
|
-
};
|
|
13
|
-
});
|
|
14
|
-
it("should call getConnectComponent with merchant props", async () => {
|
|
15
|
-
const merchantProps = { props: "someProps" };
|
|
16
|
-
await Connect(merchantProps);
|
|
17
|
-
expect(getConnectComponent).toBeCalledWith(merchantProps);
|
|
18
|
-
});
|
|
19
|
-
});
|