@school24/paymentjs-rn 1.4.0 → 1.4.1

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/dist/PaymentJS.js CHANGED
@@ -37,7 +37,7 @@ const react_1 = __importStar(require("react"));
37
37
  const react_native_1 = require("react-native");
38
38
  const react_native_webview_1 = require("react-native-webview");
39
39
  const PaymentJS = (props) => {
40
- const { uri: customUri, onSuccess, onFailure, style, environment = "test", shopperReference = "USER123", amount = 100, currency = "AUD", storePaymentMethod = true, baseUrl = "https://www.school24.net.au/valpay-gateway", } = props;
40
+ const { uri: customUri, onSuccess, onFailure, onDebug, debug, style, environment = "test", shopperReference = "USER123", amount = 100, currency = "AUD", storePaymentMethod = true, baseUrl = "https://www.school24.net.au/valpay-gateway", } = props;
41
41
  // Auto-build URI with query params if customUri not provided
42
42
  const finalUri = (0, react_1.useMemo)(() => {
43
43
  if (customUri)
@@ -68,6 +68,11 @@ const PaymentJS = (props) => {
68
68
  case "CONFIG_ERROR":
69
69
  onFailure === null || onFailure === void 0 ? void 0 : onFailure(message.payload);
70
70
  break;
71
+ case "DEBUG":
72
+ if (debug)
73
+ console.log("💳 PaymentJS DEBUG:", message.payload);
74
+ onDebug === null || onDebug === void 0 ? void 0 : onDebug(message.payload);
75
+ return;
71
76
  default:
72
77
  console.warn("Unknown PaymentJS event:", message.event);
73
78
  }
@@ -79,7 +84,7 @@ const PaymentJS = (props) => {
79
84
  error: err,
80
85
  });
81
86
  }
82
- }, [onSuccess, onFailure]);
87
+ }, [onSuccess, onFailure, onDebug, debug]);
83
88
  return (react_1.default.createElement(react_native_1.View, { style: [{ flex: 1, backgroundColor: "#fff" }, style] },
84
89
  react_1.default.createElement(react_native_webview_1.WebView, { source: { uri: finalUri }, javaScriptEnabled: true, domStorageEnabled: true, originWhitelist: ["*"], startInLoadingState: true, renderLoading: () => (react_1.default.createElement(react_native_1.View, { style: { flex: 1, justifyContent: "center", alignItems: "center" } },
85
90
  react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: "#2563eb" }))), onMessage: handleMessage, allowsBackForwardNavigationGestures: true, setSupportMultipleWindows: false })));
package/dist/types.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { StyleProp, ViewStyle } from "react-native";
2
- export type PaymentJSEvent = "PAYMENT_SUCCESS" | "PAYMENT_ERROR" | "CONFIG_ERROR";
2
+ export type PaymentJSEvent = "PAYMENT_SUCCESS" | "PAYMENT_ERROR" | "CONFIG_ERROR" | "DEBUG";
3
3
  export interface PaymentJSMessage {
4
4
  source: "PaymentJS";
5
5
  event: PaymentJSEvent;
6
6
  payload: any;
7
+ timestamp?: string;
7
8
  }
8
9
  export interface PaymentJSProps {
9
10
  uri?: string;
@@ -15,6 +16,7 @@ export interface PaymentJSProps {
15
16
  * Called when payment fails or config error occurs
16
17
  */
17
18
  onFailure?: (payload: any) => void;
19
+ onDebug?: (payload: any) => void;
18
20
  /**
19
21
  * Optional container styling
20
22
  */
@@ -25,4 +27,5 @@ export interface PaymentJSProps {
25
27
  currency?: string;
26
28
  storePaymentMethod?: boolean;
27
29
  baseUrl?: string;
30
+ debug?: boolean;
28
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@school24/paymentjs-rn",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "React Native WebView wrapper for PaymentJS (Adyen)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",