@paypal/checkout-components 5.0.302-alpha.0 → 5.0.302
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paypal/checkout-components",
|
|
3
|
-
"version": "5.0.302
|
|
3
|
+
"version": "5.0.302",
|
|
4
4
|
"description": "PayPal Checkout components, for integrating checkout products.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"@krakenjs/post-robot": "^11.0.0",
|
|
111
111
|
"@krakenjs/zalgo-promise": "^2.0.0",
|
|
112
112
|
"@krakenjs/zoid": "^10.3.1",
|
|
113
|
-
"@paypal/accelerated-checkout-loader": "^1.0.0",
|
|
114
113
|
"@paypal/common-components": "^1.0.35",
|
|
114
|
+
"@paypal/connect-loader-component": "1.1.1",
|
|
115
115
|
"@paypal/funding-components": "^1.0.31",
|
|
116
116
|
"@paypal/sdk-client": "^4.0.181",
|
|
117
117
|
"@paypal/sdk-constants": "^1.0.141",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
|
|
3
3
|
import { getUserIDToken, getSDKToken } from "@paypal/sdk-client/src";
|
|
4
|
-
|
|
5
|
-
import * as axo from "@paypal/accelerated-checkout-loader/dist/loader.esm";
|
|
4
|
+
import { loadAxo } from "@paypal/connect-loader-component";
|
|
6
5
|
import { describe, expect, test, vi } from "vitest";
|
|
7
6
|
|
|
8
7
|
import {
|
|
@@ -31,6 +30,12 @@ vi.mock("@paypal/sdk-client/src", () => {
|
|
|
31
30
|
};
|
|
32
31
|
});
|
|
33
32
|
|
|
33
|
+
vi.mock("@paypal/connect-loader-component", () => {
|
|
34
|
+
return {
|
|
35
|
+
loadAxo: vi.fn(),
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
34
39
|
describe("getConnectComponent: returns ConnectComponent", () => {
|
|
35
40
|
const mockAxoMetadata = { someData: "data" };
|
|
36
41
|
const mockProps = { someProp: "value" };
|
|
@@ -43,7 +48,7 @@ describe("getConnectComponent: returns ConnectComponent", () => {
|
|
|
43
48
|
},
|
|
44
49
|
};
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
loadAxo.mockResolvedValue({ metadata: mockAxoMetadata });
|
|
47
52
|
});
|
|
48
53
|
|
|
49
54
|
test("uses user id token if no sdk token is present", async () => {
|
|
@@ -92,7 +97,7 @@ describe("getConnectComponent: returns ConnectComponent", () => {
|
|
|
92
97
|
|
|
93
98
|
test("loadAxo failure is handled", async () => {
|
|
94
99
|
const errorMessage = "Something went wrong";
|
|
95
|
-
|
|
100
|
+
loadAxo.mockRejectedValue(errorMessage);
|
|
96
101
|
|
|
97
102
|
await expect(() => getConnectComponent(mockProps)).rejects.toThrow(
|
|
98
103
|
errorMessage
|
|
@@ -110,7 +115,7 @@ describe("getConnectComponent: returns ConnectComponent", () => {
|
|
|
110
115
|
|
|
111
116
|
test("minified is set according to debug value", async () => {
|
|
112
117
|
await getConnectComponent(mockProps);
|
|
113
|
-
expect(
|
|
118
|
+
expect(loadAxo).toHaveBeenCalledWith({
|
|
114
119
|
minified: true,
|
|
115
120
|
btSdkVersion: "3.97.3-connect-alpha.6.1",
|
|
116
121
|
metadata: undefined,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getCardFormComponent,
|
|
8
8
|
type CardFormComponent,
|
|
9
9
|
} from "../zoid/card-form";
|
|
10
|
+
import { getQRCodeComponent, type QRCodeComponent } from "../zoid/qr-code";
|
|
10
11
|
import { getCheckoutComponent, type CheckoutComponent } from "../zoid/checkout";
|
|
11
12
|
import type { LazyExport, LazyProtectedExport } from "../types";
|
|
12
13
|
import { protectedExport } from "../lib";
|
|
@@ -23,6 +24,10 @@ export const CardForm: LazyProtectedExport<CardFormComponent> = {
|
|
|
23
24
|
__get__: () => protectedExport(getCardFormComponent()),
|
|
24
25
|
};
|
|
25
26
|
|
|
27
|
+
export const QRCode: LazyProtectedExport<QRCodeComponent> = {
|
|
28
|
+
__get__: () => protectedExport(getQRCodeComponent()),
|
|
29
|
+
};
|
|
30
|
+
|
|
26
31
|
export function setup() {
|
|
27
32
|
getButtonsComponent();
|
|
28
33
|
getCheckoutComponent();
|