@reevit/react 0.2.2 → 0.2.3

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/index.d.mts CHANGED
@@ -41,6 +41,8 @@ interface ReevitCheckoutProps extends ReevitCheckoutConfig, ReevitCheckoutCallba
41
41
  autoOpen?: boolean;
42
42
  /** Custom theme */
43
43
  theme?: ReevitTheme;
44
+ /** Custom API base URL (for testing or self-hosted deployments) */
45
+ apiBaseUrl?: string;
44
46
  }
45
47
  type CheckoutState = 'idle' | 'loading' | 'ready' | 'method_selected' | 'processing' | 'success' | 'failed' | 'closed';
46
48
  interface PaymentResult {
@@ -130,7 +132,7 @@ interface ReevitContextValue {
130
132
  currency: string;
131
133
  }
132
134
  declare function useReevitContext(): ReevitContextValue;
133
- declare function ReevitCheckout({ publicKey, amount, currency, email, phone, reference, metadata, paymentMethods, onSuccess, onError, onClose, onStateChange, children, autoOpen, theme, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
135
+ declare function ReevitCheckout({ publicKey, amount, currency, email, phone, reference, metadata, paymentMethods, onSuccess, onError, onClose, onStateChange, children, autoOpen, theme, apiBaseUrl, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
134
136
 
135
137
  interface PaymentMethodSelectorProps {
136
138
  methods: PaymentMethod[];
package/dist/index.d.ts CHANGED
@@ -41,6 +41,8 @@ interface ReevitCheckoutProps extends ReevitCheckoutConfig, ReevitCheckoutCallba
41
41
  autoOpen?: boolean;
42
42
  /** Custom theme */
43
43
  theme?: ReevitTheme;
44
+ /** Custom API base URL (for testing or self-hosted deployments) */
45
+ apiBaseUrl?: string;
44
46
  }
45
47
  type CheckoutState = 'idle' | 'loading' | 'ready' | 'method_selected' | 'processing' | 'success' | 'failed' | 'closed';
46
48
  interface PaymentResult {
@@ -130,7 +132,7 @@ interface ReevitContextValue {
130
132
  currency: string;
131
133
  }
132
134
  declare function useReevitContext(): ReevitContextValue;
133
- declare function ReevitCheckout({ publicKey, amount, currency, email, phone, reference, metadata, paymentMethods, onSuccess, onError, onClose, onStateChange, children, autoOpen, theme, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
135
+ declare function ReevitCheckout({ publicKey, amount, currency, email, phone, reference, metadata, paymentMethods, onSuccess, onError, onClose, onStateChange, children, autoOpen, theme, apiBaseUrl, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
134
136
 
135
137
  interface PaymentMethodSelectorProps {
136
138
  methods: PaymentMethod[];
package/dist/index.js CHANGED
@@ -85,7 +85,7 @@ var API_BASE_URL_PRODUCTION = "https://api.reevit.io";
85
85
  var API_BASE_URL_SANDBOX = "https://sandbox-api.reevit.io";
86
86
  var DEFAULT_TIMEOUT = 3e4;
87
87
  function isSandboxKey(publicKey) {
88
- return publicKey.startsWith("pk_test_") || publicKey.startsWith("pk_sandbox_");
88
+ return publicKey.startsWith("pk_test_") || publicKey.startsWith("pk_sandbox_") || publicKey.startsWith("pfk_test_") || publicKey.startsWith("pfk_sandbox_");
89
89
  }
90
90
  function createPaymentError(response, errorData) {
91
91
  return {
@@ -739,7 +739,8 @@ function ReevitCheckout({
739
739
  // UI
740
740
  children,
741
741
  autoOpen = false,
742
- theme
742
+ theme,
743
+ apiBaseUrl
743
744
  }) {
744
745
  const [isOpen, setIsOpen] = react.useState(autoOpen);
745
746
  const [showPSPBridge, setShowPSPBridge] = react.useState(false);
@@ -759,6 +760,7 @@ function ReevitCheckout({
759
760
  isComplete
760
761
  } = useReevit({
761
762
  config: { publicKey, amount, currency, email, phone, reference, metadata, paymentMethods },
763
+ apiBaseUrl,
762
764
  onSuccess: (result2) => {
763
765
  onSuccess?.(result2);
764
766
  setTimeout(() => {