Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@paypal/checkout-components

Package Overview
Dependencies
Maintainers
23
Versions
507
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paypal/checkout-components - npm Package Compare versions

Comparing version 5.0.292-alpha.0 to 5.0.292-alpha.11

src/api/api.js

7

__sdk__.js

@@ -61,2 +61,5 @@ /* @flow */

},
"shopper-insights": {
entry: "./src/api/shopper-insights/interface",
},
wallet: {

@@ -87,2 +90,6 @@ entry: "./src/interface/wallet",

},
"hosted-buttons": {
entry: "./src/interface/hosted-buttons",
globals,
},
};

4

package.json
{
"name": "@paypal/checkout-components",
"version": "5.0.292-alpha.0",
"version": "5.0.292-alpha.11",
"description": "PayPal Checkout components, for integrating checkout products.",

@@ -114,3 +114,3 @@ "main": "index.js",

"@paypal/connect-loader-component": "1.1.1",
"@paypal/sdk-client": "^4.0.176",
"@paypal/sdk-client": "^4.0.179",
"@paypal/sdk-constants": "^1.0.133",

@@ -117,0 +117,0 @@ "@paypal/sdk-logos": "^2.2.6"

/* @flow */
import { loadAxo } from "@paypal/connect-loader-component";
import { stringifyError } from "@krakenjs/belter/src";
import { stringifyError, getCurrentScriptUID } from "@krakenjs/belter/src";
import {

@@ -12,3 +12,5 @@ getClientID,

getCSPNonce,
getDebug,
} from "@paypal/sdk-client/src";
import { FPTI_KEY } from "@paypal/sdk-constants";

@@ -27,3 +29,3 @@ import { sendCountMetric } from "./sendCountMetric";

env,
clientMetadataID: cmid,
clientMetadataID: cmid || getCurrentScriptUID(),
cspNonce,

@@ -39,2 +41,3 @@ appName: "ppcp-sdk-connect",

const debugEnabled = getDebug() || false;
const { metadata } = merchantProps;

@@ -47,3 +50,3 @@

btSdkVersion: "3.97.3-connect-alpha.6.1",
minified: true,
minified: !debugEnabled,
metadata,

@@ -60,3 +63,10 @@ });

getLogger().error("load_axo_error", { err: stringifyError(error) });
getLogger()
.track({
[FPTI_KEY.CONTEXT_TYPE]: "CMID",
[FPTI_KEY.CONTEXT_ID]: cmid,
[FPTI_KEY.EVENT_NAME]: `ppcp_axo_failure`,
})
.error("load_connect_error", { err: stringifyError(error) })
.flush();

@@ -74,7 +84,13 @@ throw new Error(error);

clientID,
clientMetadataID: cmid,
fraudnet: collect,
clientMetadataId: cmid,
},
});
getLogger()
.track({
[FPTI_KEY.CONTEXT_TYPE]: "CMID",
[FPTI_KEY.CONTEXT_ID]: cmid,
[FPTI_KEY.EVENT_NAME]: `ppcp_connect_success`,
})
.flush();
sendCountMetric({

@@ -96,3 +112,10 @@ name: "pp.app.paypal_sdk.connect.init.success.count",

getLogger().error("init_axo_error", { err: stringifyError(error) });
getLogger()
.track({
[FPTI_KEY.CONTEXT_TYPE]: "CMID",
[FPTI_KEY.CONTEXT_ID]: cmid,
[FPTI_KEY.EVENT_NAME]: `ppcp_connect_failure`,
})
.error("init_connect_error", { err: stringifyError(error) })
.flush();

@@ -99,0 +122,0 @@ throw new Error(error);

@@ -19,3 +19,12 @@ /* @flow */

getUserIDToken: vi.fn(() => "mock-uid"),
getLogger: vi.fn(() => ({ metric: vi.fn(), error: vi.fn() })),
getDebug: vi.fn(() => false),
getLogger: vi.fn(() => ({
metric: vi.fn().mockReturnThis(),
error: vi.fn().mockReturnThis(),
track: vi.fn().mockReturnThis(),
flush: vi.fn().mockReturnThis(),
})),
getEnv: vi.fn(),
getCSPNonce: vi.fn(),
loadFraudnet: vi.fn(() => ({ collect: vi.fn() })),
};

@@ -64,4 +73,5 @@ });

clientID: "mock-client-id",
clientMetadataID: "mock-cmid",
clientMetadataId: "mock-cmid",
userIdToken: "mock-uid",
fraudnet: expect.any(Function),
},

@@ -91,2 +101,12 @@ });

});
test("minified is set according to debug value", async () => {
await getConnectComponent(mockProps);
expect(loadAxo).toHaveBeenCalledWith({
minified: true,
btSdkVersion: "3.97.3-connect-alpha.6.1",
metadata: undefined,
platform: "PPCP",
});
});
});

@@ -10,3 +10,3 @@ /* eslint-disable flowtype/no-weak-types */

// $FlowFixMe
export const Connect: () => ConnectComponent = memoize(
export const Connect: (merchantProps: any) => ConnectComponent = memoize(
async (merchantProps: any): ConnectComponent => {

@@ -13,0 +13,0 @@ // $FlowFixMe

/* @flow */
import { describe, expect, vi } from "vitest";
import { describe, expect, vi, beforeEach } from "vitest";
import { memoize } from "@krakenjs/belter/src";

@@ -9,12 +10,16 @@ import { getConnectComponent } from "./component";

describe("interface.js", () => {
beforeEach(() => {
memoize.clear();
});
vi.mock("./component", () => {
return {
getConnectComponent: vi.fn(),
getConnectComponent: vi.fn(() => ({})),
};
});
it("should call getConnectComponent with merchant props", async () => {
const merchantProps = { props: "someProps" };
await Connect()(merchantProps);
const merchantProps = { env: "test" };
await Connect(merchantProps);
expect(getConnectComponent).toBeCalledWith(merchantProps);
});
});

@@ -722,2 +722,12 @@ /* @flow */

referrerDomain: {
type: "string",
required: false,
value: () => {
if (window.document.referrer) {
return new URL(window.document.referrer).host || undefined;
}
},
},
userIDToken: {

@@ -838,2 +848,7 @@ type: "string",

hostedButtonId: {
type: "string",
required: false,
},
displayOnly: {

@@ -840,0 +855,0 @@ type: "array",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc