Skip to content

Commit 6f9b7fc

Browse files
committed
make devOnly export
1 parent 2bc51dd commit 6f9b7fc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/interface.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* @flow */
22

3-
import { isPayPalDomain } from "@paypal/sdk-client/src";
3+
import { isPayPalDomain, getEnv } from "@paypal/sdk-client/src";
44
// eslint-disable-next-line import/no-namespace
55
import * as postRobotModule from "@krakenjs/post-robot/src";
6+
import { ENV } from "@paypal/sdk-constants/src";
67

78
import {
89
getThreeDomainSecureComponent,
@@ -23,8 +24,18 @@ function protectedExport<T>(xport: T): ?T {
2324
}
2425
}
2526

27+
// $FlowIssue
28+
export const devEnvOnlyExport = (unprotectedExport) => {
29+
const env = getEnv();
30+
if (env === ENV.LOCAL || env === ENV.STAGE) {
31+
return unprotectedExport;
32+
} else {
33+
return undefined;
34+
}
35+
};
36+
2637
export const ThreeDomainSecure: LazyProtectedExport<TDSComponent> = {
27-
__get__: () => protectedExport(getThreeDomainSecureComponent()),
38+
__get__: () => devEnvOnlyExport(getThreeDomainSecureComponent()),
2839
};
2940

3041
export const postRobot: LazyProtectedExport<typeof postRobotModule> = {

0 commit comments

Comments
 (0)