@voyage_ai/v402-web-ts 0.3.0 → 1.0.0

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.
@@ -222,6 +222,43 @@ interface UsePaymentInfoReturn {
222
222
  */
223
223
  declare function usePaymentInfo(merchantId: string, endpoint?: string, additionalParams?: Record<string, any>): UsePaymentInfoReturn;
224
224
 
225
+ type ToastType = 'success' | 'error' | 'info';
226
+ interface ToastProps {
227
+ message: string;
228
+ type: ToastType;
229
+ onClose: () => void;
230
+ }
231
+ /**
232
+ * Toast 通知组件
233
+ * 使用 Portal 渲染到 document.body
234
+ */
235
+ declare const Toast: React.FC<ToastProps>;
236
+
237
+ /**
238
+ * Toast 管理 Hook
239
+ * 提供显示 toast 通知的能力
240
+ *
241
+ * @example
242
+ * ```tsx
243
+ * function MyComponent() {
244
+ * const { showToast, ToastContainer } = useToast();
245
+ *
246
+ * return (
247
+ * <div>
248
+ * <button onClick={() => showToast('Success!', 'success')}>
249
+ * Show Toast
250
+ * </button>
251
+ * <ToastContainer />
252
+ * </div>
253
+ * );
254
+ * }
255
+ * ```
256
+ */
257
+ declare const useToast: () => {
258
+ showToast: (message: string, type: ToastType) => void;
259
+ ToastContainer: () => React.JSX.Element;
260
+ };
261
+
225
262
  /**
226
263
  * WalletConnect Component
227
264
  *
@@ -270,11 +307,37 @@ interface WalletSelectModalProps {
270
307
  }
271
308
  declare function WalletSelectModal({ isOpen, networkType, onSelect, onClose, }: WalletSelectModalProps): React.JSX.Element | null;
272
309
 
273
- interface HeaderInfo {
310
+ interface HeaderInfo$1 {
274
311
  title?: string;
275
312
  subtitle?: string;
276
313
  tooltipText?: string;
277
314
  }
315
+ interface V402CheckoutProps$1 {
316
+ checkoutId: string;
317
+ headerInfo?: HeaderInfo$1;
318
+ isModal?: boolean;
319
+ onPaymentComplete?: (response: any) => void;
320
+ additionalParams?: Record<string, any>;
321
+ expectedNetwork?: NetworkType;
322
+ }
323
+ declare function V402Checkout({ checkoutId, headerInfo, isModal, onPaymentComplete, additionalParams, expectedNetwork, }: V402CheckoutProps$1): React.JSX.Element;
324
+
325
+ /**
326
+ * Checkout 组件通用类型定义
327
+ */
328
+ interface HeaderInfo {
329
+ /** 商品/服务标题,显示在屏幕顶部 */
330
+ title?: string;
331
+ /** 品牌名称,传空字符串则不显示品牌区域 */
332
+ brandName?: string;
333
+ /** 发票标题,默认为 "V402 PAYMENT" */
334
+ receiptTitle?: string;
335
+ /** 悬浮在三个小点上显示的提示文本 */
336
+ tooltipText?: string;
337
+ }
338
+ /**
339
+ * V402Checkout 组件 Props (V1)
340
+ */
278
341
  interface V402CheckoutProps {
279
342
  checkoutId: string;
280
343
  headerInfo?: HeaderInfo;
@@ -283,6 +346,42 @@ interface V402CheckoutProps {
283
346
  additionalParams?: Record<string, any>;
284
347
  expectedNetwork?: NetworkType;
285
348
  }
286
- declare function V402Checkout({ checkoutId, headerInfo, isModal, onPaymentComplete, additionalParams, expectedNetwork, }: V402CheckoutProps): React.JSX.Element;
349
+ /**
350
+ * V402CheckoutV2 组件 Props
351
+ * 简化版本,更直观的配置
352
+ */
353
+ interface V402CheckoutV2Props {
354
+ /** Checkout ID */
355
+ checkoutId: string;
356
+ /** 头部信息配置 */
357
+ headerInfo?: HeaderInfo;
358
+ /** 主题颜色,默认为绿色 #84cc16 */
359
+ primaryColor?: string;
360
+ /** 是否作为 Modal 使用 */
361
+ isModal?: boolean;
362
+ /** 支付完成回调 */
363
+ onPaymentComplete?: (response: any) => void;
364
+ /** 额外参数,会透传给 checkout 配置的回调 */
365
+ additionalParams?: Record<string, any>;
366
+ /** 期望的网络类型 */
367
+ expectedNetwork?: NetworkType;
368
+ }
369
+
370
+ /**
371
+ * V402 Checkout V2 组件
372
+ * 全新设计的支付终端风格界面
373
+ */
374
+ declare function V402CheckoutV2({ checkoutId, headerInfo, primaryColor, isModal, onPaymentComplete, additionalParams, expectedNetwork, }: V402CheckoutV2Props): React.JSX.Element;
375
+
376
+ /**
377
+ * CSS 动画定义
378
+ * 用于 checkout 组件的各种动画效果
379
+ */
380
+ declare const checkoutAnimations = "\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n \n @keyframes receiptShake {\n 0%, 100% { transform: rotate(-0.3deg); }\n 50% { transform: rotate(0.3deg); }\n }\n \n @keyframes slideInRight {\n from {\n opacity: 0;\n transform: translateX(100px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n \n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n }\n";
381
+ /**
382
+ * 动画样式组件
383
+ * 用于注入 CSS 动画到页面
384
+ */
385
+ declare const AnimationStyles: () => React.JSX.Element;
287
386
 
288
- export { type UsePageNetworkOptions, type UsePaymentInfoReturn, type UsePaymentReturn, type UseWalletReturn, V402Checkout, type V402CheckoutProps, WalletConnect, type WalletConnectProps, WalletSelectModal, type WalletSelectModalProps, usePageNetwork, usePayment, usePaymentInfo, useWallet };
387
+ export { AnimationStyles, Toast, type ToastProps, type ToastType, type UsePageNetworkOptions, type UsePaymentInfoReturn, type UsePaymentReturn, type UseWalletReturn, V402Checkout, type V402CheckoutProps, V402CheckoutV2, type V402CheckoutV2Props, WalletConnect, type WalletConnectProps, WalletSelectModal, type WalletSelectModalProps, checkoutAnimations, usePageNetwork, usePayment, usePaymentInfo, useToast, useWallet };
@@ -222,6 +222,43 @@ interface UsePaymentInfoReturn {
222
222
  */
223
223
  declare function usePaymentInfo(merchantId: string, endpoint?: string, additionalParams?: Record<string, any>): UsePaymentInfoReturn;
224
224
 
225
+ type ToastType = 'success' | 'error' | 'info';
226
+ interface ToastProps {
227
+ message: string;
228
+ type: ToastType;
229
+ onClose: () => void;
230
+ }
231
+ /**
232
+ * Toast 通知组件
233
+ * 使用 Portal 渲染到 document.body
234
+ */
235
+ declare const Toast: React.FC<ToastProps>;
236
+
237
+ /**
238
+ * Toast 管理 Hook
239
+ * 提供显示 toast 通知的能力
240
+ *
241
+ * @example
242
+ * ```tsx
243
+ * function MyComponent() {
244
+ * const { showToast, ToastContainer } = useToast();
245
+ *
246
+ * return (
247
+ * <div>
248
+ * <button onClick={() => showToast('Success!', 'success')}>
249
+ * Show Toast
250
+ * </button>
251
+ * <ToastContainer />
252
+ * </div>
253
+ * );
254
+ * }
255
+ * ```
256
+ */
257
+ declare const useToast: () => {
258
+ showToast: (message: string, type: ToastType) => void;
259
+ ToastContainer: () => React.JSX.Element;
260
+ };
261
+
225
262
  /**
226
263
  * WalletConnect Component
227
264
  *
@@ -270,11 +307,37 @@ interface WalletSelectModalProps {
270
307
  }
271
308
  declare function WalletSelectModal({ isOpen, networkType, onSelect, onClose, }: WalletSelectModalProps): React.JSX.Element | null;
272
309
 
273
- interface HeaderInfo {
310
+ interface HeaderInfo$1 {
274
311
  title?: string;
275
312
  subtitle?: string;
276
313
  tooltipText?: string;
277
314
  }
315
+ interface V402CheckoutProps$1 {
316
+ checkoutId: string;
317
+ headerInfo?: HeaderInfo$1;
318
+ isModal?: boolean;
319
+ onPaymentComplete?: (response: any) => void;
320
+ additionalParams?: Record<string, any>;
321
+ expectedNetwork?: NetworkType;
322
+ }
323
+ declare function V402Checkout({ checkoutId, headerInfo, isModal, onPaymentComplete, additionalParams, expectedNetwork, }: V402CheckoutProps$1): React.JSX.Element;
324
+
325
+ /**
326
+ * Checkout 组件通用类型定义
327
+ */
328
+ interface HeaderInfo {
329
+ /** 商品/服务标题,显示在屏幕顶部 */
330
+ title?: string;
331
+ /** 品牌名称,传空字符串则不显示品牌区域 */
332
+ brandName?: string;
333
+ /** 发票标题,默认为 "V402 PAYMENT" */
334
+ receiptTitle?: string;
335
+ /** 悬浮在三个小点上显示的提示文本 */
336
+ tooltipText?: string;
337
+ }
338
+ /**
339
+ * V402Checkout 组件 Props (V1)
340
+ */
278
341
  interface V402CheckoutProps {
279
342
  checkoutId: string;
280
343
  headerInfo?: HeaderInfo;
@@ -283,6 +346,42 @@ interface V402CheckoutProps {
283
346
  additionalParams?: Record<string, any>;
284
347
  expectedNetwork?: NetworkType;
285
348
  }
286
- declare function V402Checkout({ checkoutId, headerInfo, isModal, onPaymentComplete, additionalParams, expectedNetwork, }: V402CheckoutProps): React.JSX.Element;
349
+ /**
350
+ * V402CheckoutV2 组件 Props
351
+ * 简化版本,更直观的配置
352
+ */
353
+ interface V402CheckoutV2Props {
354
+ /** Checkout ID */
355
+ checkoutId: string;
356
+ /** 头部信息配置 */
357
+ headerInfo?: HeaderInfo;
358
+ /** 主题颜色,默认为绿色 #84cc16 */
359
+ primaryColor?: string;
360
+ /** 是否作为 Modal 使用 */
361
+ isModal?: boolean;
362
+ /** 支付完成回调 */
363
+ onPaymentComplete?: (response: any) => void;
364
+ /** 额外参数,会透传给 checkout 配置的回调 */
365
+ additionalParams?: Record<string, any>;
366
+ /** 期望的网络类型 */
367
+ expectedNetwork?: NetworkType;
368
+ }
369
+
370
+ /**
371
+ * V402 Checkout V2 组件
372
+ * 全新设计的支付终端风格界面
373
+ */
374
+ declare function V402CheckoutV2({ checkoutId, headerInfo, primaryColor, isModal, onPaymentComplete, additionalParams, expectedNetwork, }: V402CheckoutV2Props): React.JSX.Element;
375
+
376
+ /**
377
+ * CSS 动画定义
378
+ * 用于 checkout 组件的各种动画效果
379
+ */
380
+ declare const checkoutAnimations = "\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n \n @keyframes receiptShake {\n 0%, 100% { transform: rotate(-0.3deg); }\n 50% { transform: rotate(0.3deg); }\n }\n \n @keyframes slideInRight {\n from {\n opacity: 0;\n transform: translateX(100px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n \n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n }\n";
381
+ /**
382
+ * 动画样式组件
383
+ * 用于注入 CSS 动画到页面
384
+ */
385
+ declare const AnimationStyles: () => React.JSX.Element;
287
386
 
288
- export { type UsePageNetworkOptions, type UsePaymentInfoReturn, type UsePaymentReturn, type UseWalletReturn, V402Checkout, type V402CheckoutProps, WalletConnect, type WalletConnectProps, WalletSelectModal, type WalletSelectModalProps, usePageNetwork, usePayment, usePaymentInfo, useWallet };
387
+ export { AnimationStyles, Toast, type ToastProps, type ToastType, type UsePageNetworkOptions, type UsePaymentInfoReturn, type UsePaymentReturn, type UseWalletReturn, V402Checkout, type V402CheckoutProps, V402CheckoutV2, type V402CheckoutV2Props, WalletConnect, type WalletConnectProps, WalletSelectModal, type WalletSelectModalProps, checkoutAnimations, usePageNetwork, usePayment, usePaymentInfo, useToast, useWallet };