@paypal/checkout-components
Advanced tools
Comparing version 5.0.340 to 5.0.341
{ | ||
"name": "@paypal/checkout-components", | ||
"version": "5.0.340", | ||
"version": "5.0.341", | ||
"description": "PayPal Checkout components, for integrating checkout products.", | ||
@@ -110,3 +110,3 @@ "main": "index.js", | ||
"@krakenjs/cross-domain-utils": "^3.0.0", | ||
"@krakenjs/jsx-pragmatic": "3.0.0", | ||
"@krakenjs/jsx-pragmatic": "^3", | ||
"@krakenjs/post-robot": "^11.0.0", | ||
@@ -113,0 +113,0 @@ "@krakenjs/zalgo-promise": "^2.0.0", |
@@ -20,15 +20,31 @@ /* @flow */ | ||
const MIN_MINOR_VERSION = 97; | ||
export const MIN_BT_VERSION = `${MIN_MAJOR_VERSION}.${MIN_MINOR_VERSION}.3-connect-alpha.6.1`; // Minimum for supporting AXO | ||
const MIN_PATCH_VERSION = 3; | ||
export const MIN_BT_VERSION = `${MIN_MAJOR_VERSION}.${MIN_MINOR_VERSION}.${MIN_PATCH_VERSION}-connect-alpha.6.1`; // Minimum for supporting AXO | ||
export const DEFAULT_BT_VERSION = `3.107.1`; | ||
export function getSdkVersion(version: string | null): string { | ||
if (!version) { | ||
return MIN_BT_VERSION; | ||
return DEFAULT_BT_VERSION; | ||
} | ||
const versionSplit = version.split("."); | ||
// patch could have an alpha tag | ||
const patchSplit = versionSplit[2].split("-"); | ||
const majorVersion = Number(versionSplit[0]); | ||
const minorVersion = Number(versionSplit[1]); | ||
const patchVersion = Number(patchSplit[0]); | ||
const isMajorVersionSmaller = majorVersion < MIN_MAJOR_VERSION; | ||
const isMajorVersionEqual = majorVersion === MIN_MAJOR_VERSION; | ||
const isMinorVersionSmaller = minorVersion < MIN_MINOR_VERSION; | ||
const isMinorVersionEqual = minorVersion === MIN_MINOR_VERSION; | ||
const isPatchVersionSmaller = patchVersion < MIN_PATCH_VERSION; | ||
if ( | ||
majorVersion < MIN_MAJOR_VERSION || | ||
(majorVersion === MIN_MAJOR_VERSION && minorVersion < MIN_MINOR_VERSION) | ||
isMajorVersionSmaller || | ||
(isMajorVersionEqual && isMinorVersionSmaller) || | ||
(isMajorVersionEqual && isMinorVersionEqual && isPatchVersionSmaller) | ||
) { | ||
@@ -35,0 +51,0 @@ getLogger().metricCounter({ |
@@ -10,3 +10,3 @@ /* @flow */ | ||
getSdkVersion, | ||
MIN_BT_VERSION, | ||
DEFAULT_BT_VERSION, | ||
} from "./component"; | ||
@@ -117,7 +117,7 @@ | ||
test("minified is set according to debug value", async () => { | ||
test("loadAxo is call with default values", async () => { | ||
await getConnectComponent(mockProps); | ||
expect(loadAxo).toHaveBeenCalledWith({ | ||
minified: true, | ||
btSdkVersion: "3.97.3-connect-alpha.6.1", | ||
btSdkVersion: "3.107.1", | ||
metadata: undefined, | ||
@@ -133,14 +133,16 @@ platform: "PPCP", | ||
expect(version).toEqual(MIN_BT_VERSION); | ||
expect(version).toEqual(DEFAULT_BT_VERSION); | ||
}); | ||
test("returns the version passed if it is supported for AXO", () => { | ||
const result1 = getSdkVersion("3.97.00"); | ||
const result2 = getSdkVersion("3.97.alpha-test"); | ||
const result3 = getSdkVersion("4.34.beta-test"); | ||
const result2 = getSdkVersion("3.97.3-alpha-test"); | ||
const result3 = getSdkVersion("4.34.3-beta-test"); | ||
const result4 = getSdkVersion("4.34.47"); | ||
const result5 = getSdkVersion("3.98.3"); | ||
const result6 = getSdkVersion("3.97.6"); | ||
expect(result1).toEqual("3.97.00"); | ||
expect(result2).toEqual("3.97.alpha-test"); | ||
expect(result3).toEqual("4.34.beta-test"); | ||
expect(result2).toEqual("3.97.3-alpha-test"); | ||
expect(result3).toEqual("4.34.3-beta-test"); | ||
expect(result4).toEqual("4.34.47"); | ||
expect(result5).toEqual("3.98.3"); | ||
expect(result6).toEqual("3.97.6"); | ||
}); | ||
@@ -150,5 +152,6 @@ | ||
expect(() => getSdkVersion("3.96.00")).toThrowError(); | ||
expect(() => getSdkVersion("2.87.alpha-test")).toThrowError(); | ||
expect(() => getSdkVersion("3.34.beta-test")).toThrowError(); | ||
expect(() => getSdkVersion("3.97.00")).toThrowError(); | ||
expect(() => getSdkVersion("2.87.1-alpha-test")).toThrowError(); | ||
expect(() => getSdkVersion("3.34.2-beta-test")).toThrowError(); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1216941
16897
+ Added@krakenjs/jsx-pragmatic@3.1.1(transitive)
- Removed@krakenjs/jsx-pragmatic@3.0.0(transitive)
Updated@krakenjs/jsx-pragmatic@^3