@zendfi/sdk 1.0.2 → 1.0.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/{chunk-3ACJUM6V.mjs → chunk-6CFQXFNR.mjs} +0 -1
- package/dist/{chunk-DAJL2Q36.mjs → chunk-B5LO34Q6.mjs} +20 -24
- package/dist/express.d.mts +1 -2
- package/dist/express.d.ts +1 -2
- package/dist/express.js +0 -1
- package/dist/express.mjs +1 -1
- package/dist/helpers/index.d.mts +0 -1
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.js +20 -24
- package/dist/helpers/index.mjs +1 -1
- package/dist/index.d.mts +14 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +230 -85
- package/dist/index.mjs +212 -62
- package/dist/nextjs.d.mts +1 -2
- package/dist/nextjs.d.ts +1 -2
- package/dist/nextjs.js +0 -1
- package/dist/nextjs.mjs +1 -1
- package/dist/{webhook-handler-61UWBtDI.d.mts → webhook-handler-hUfWh-_Y.d.mts} +102 -8
- package/dist/{webhook-handler-61UWBtDI.d.ts → webhook-handler-hUfWh-_Y.d.ts} +102 -8
- package/package.json +1 -1
|
@@ -123,7 +123,6 @@ async function processWebhook(a, b, c) {
|
|
|
123
123
|
isProcessed: cfg.isProcessed,
|
|
124
124
|
onProcessed: cfg.onProcessed,
|
|
125
125
|
onError: cfg.onError,
|
|
126
|
-
// Forward compatibility for alternate names and flags
|
|
127
126
|
enableDeduplication: cfg.enableDeduplication,
|
|
128
127
|
checkDuplicate: cfg.checkDuplicate,
|
|
129
128
|
markProcessed: cfg.markProcessed
|
|
@@ -393,7 +393,6 @@ var TransactionPoller = class {
|
|
|
393
393
|
switch (commitment) {
|
|
394
394
|
case "processed":
|
|
395
395
|
return true;
|
|
396
|
-
// Any status means processed
|
|
397
396
|
case "confirmed":
|
|
398
397
|
return status.confirmationStatus === "confirmed" || status.confirmationStatus === "finalized";
|
|
399
398
|
case "finalized":
|
|
@@ -514,7 +513,6 @@ var TransactionMonitor = class {
|
|
|
514
513
|
const status = await TransactionPoller.waitForConfirmation(signature, {
|
|
515
514
|
...options,
|
|
516
515
|
maxAttempts: 1
|
|
517
|
-
// Single check per interval
|
|
518
516
|
});
|
|
519
517
|
if (status.confirmed) {
|
|
520
518
|
this.stopMonitoring(signature);
|
|
@@ -642,7 +640,6 @@ var DevTools = class {
|
|
|
642
640
|
sessionWallet: keypair.publicKey.toString(),
|
|
643
641
|
privateKey: keypair.secretKey,
|
|
644
642
|
budget: 10
|
|
645
|
-
// $10 test budget
|
|
646
643
|
};
|
|
647
644
|
}
|
|
648
645
|
/**
|
|
@@ -654,14 +651,13 @@ var DevTools = class {
|
|
|
654
651
|
address: mockAddress,
|
|
655
652
|
publicKey: { toString: () => mockAddress },
|
|
656
653
|
signTransaction: async (tx) => {
|
|
657
|
-
console.log("
|
|
654
|
+
console.log("Mock wallet: Signing transaction");
|
|
658
655
|
return tx;
|
|
659
656
|
},
|
|
660
657
|
signMessage: async (_msg) => {
|
|
661
|
-
console.log("
|
|
658
|
+
console.log("Mock wallet: Signing message");
|
|
662
659
|
return {
|
|
663
660
|
signature: new Uint8Array(64)
|
|
664
|
-
// Mock signature
|
|
665
661
|
};
|
|
666
662
|
},
|
|
667
663
|
isConnected: () => true,
|
|
@@ -676,26 +672,26 @@ var DevTools = class {
|
|
|
676
672
|
static logTransactionFlow(paymentId) {
|
|
677
673
|
console.log(`
|
|
678
674
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
679
|
-
\u2551 TRANSACTION FLOW
|
|
675
|
+
\u2551 TRANSACTION FLOW \u2551
|
|
680
676
|
\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563
|
|
681
|
-
\u2551
|
|
682
|
-
\u2551 Payment ID: ${paymentId}
|
|
683
|
-
\u2551
|
|
684
|
-
\u2551 1.
|
|
677
|
+
\u2551 \u2551
|
|
678
|
+
\u2551 Payment ID: ${paymentId} \u2551
|
|
679
|
+
\u2551 \u2551
|
|
680
|
+
\u2551 1. Create Payment Intent \u2551
|
|
685
681
|
\u2551 \u2514\u2500> POST /api/v1/ai/smart-payment \u2551
|
|
686
|
-
\u2551
|
|
687
|
-
\u2551 2.
|
|
688
|
-
\u2551 \u2514\u2500> Client-side signing with cached keypair
|
|
689
|
-
\u2551
|
|
690
|
-
\u2551 3.
|
|
691
|
-
\u2551 \u2514\u2500> POST /api/v1/ai/payments/{id}/submit-signed
|
|
692
|
-
\u2551
|
|
693
|
-
\u2551 4.
|
|
694
|
-
\u2551 \u2514\u2500> Poll Solana RPC (~30-60 seconds)
|
|
695
|
-
\u2551
|
|
696
|
-
\u2551 5.
|
|
697
|
-
\u2551 \u2514\u2500> Webhook fired: payment.confirmed
|
|
698
|
-
\u2551
|
|
682
|
+
\u2551 \u2551
|
|
683
|
+
\u2551 2. Sign Transaction (Device-Bound) \u2551
|
|
684
|
+
\u2551 \u2514\u2500> Client-side signing with cached keypair \u2551
|
|
685
|
+
\u2551 \u2551
|
|
686
|
+
\u2551 3. Submit Signed Transaction \u2551
|
|
687
|
+
\u2551 \u2514\u2500> POST /api/v1/ai/payments/{id}/submit-signed \u2551
|
|
688
|
+
\u2551 \u2551
|
|
689
|
+
\u2551 4. Wait for Blockchain Confirmation \u2551
|
|
690
|
+
\u2551 \u2514\u2500> Poll Solana RPC (~30-60 seconds) \u2551
|
|
691
|
+
\u2551 \u2551
|
|
692
|
+
\u2551 5. Payment Confirmed \u2551
|
|
693
|
+
\u2551 \u2514\u2500> Webhook fired: payment.confirmed \u2551
|
|
694
|
+
\u2551 \u2551
|
|
699
695
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
700
696
|
`);
|
|
701
697
|
}
|
package/dist/express.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { W as WebhookHandlerConfig, a as WebhookHandlers } from './webhook-handler-
|
|
1
|
+
import { W as WebhookHandlerConfig, a as WebhookHandlers } from './webhook-handler-hUfWh-_Y.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Express Webhook Handler
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```typescript
|
|
8
|
-
* // src/routes/webhooks.ts
|
|
9
8
|
* import express from 'express';
|
|
10
9
|
* import { createExpressWebhookHandler } from '@zendfi/sdk/express';
|
|
11
10
|
*
|
package/dist/express.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { W as WebhookHandlerConfig, a as WebhookHandlers } from './webhook-handler-
|
|
1
|
+
import { W as WebhookHandlerConfig, a as WebhookHandlers } from './webhook-handler-hUfWh-_Y.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Express Webhook Handler
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```typescript
|
|
8
|
-
* // src/routes/webhooks.ts
|
|
9
8
|
* import express from 'express';
|
|
10
9
|
* import { createExpressWebhookHandler } from '@zendfi/sdk/express';
|
|
11
10
|
*
|
package/dist/express.js
CHANGED
|
@@ -150,7 +150,6 @@ async function processWebhook(a, b, c) {
|
|
|
150
150
|
isProcessed: cfg.isProcessed,
|
|
151
151
|
onProcessed: cfg.onProcessed,
|
|
152
152
|
onError: cfg.onError,
|
|
153
|
-
// Forward compatibility for alternate names and flags
|
|
154
153
|
enableDeduplication: cfg.enableDeduplication,
|
|
155
154
|
checkDuplicate: cfg.checkDuplicate,
|
|
156
155
|
markProcessed: cfg.markProcessed
|
package/dist/express.mjs
CHANGED
package/dist/helpers/index.d.mts
CHANGED
|
@@ -115,7 +115,6 @@ declare function createWalletHook(): () => {
|
|
|
115
115
|
* ```typescript
|
|
116
116
|
* import { TransactionPoller } from '@zendfi/sdk/helpers';
|
|
117
117
|
*
|
|
118
|
-
* // Wait for confirmation
|
|
119
118
|
* const status = await TransactionPoller.waitForConfirmation(
|
|
120
119
|
* signature,
|
|
121
120
|
* { timeout: 60000, interval: 2000 }
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -115,7 +115,6 @@ declare function createWalletHook(): () => {
|
|
|
115
115
|
* ```typescript
|
|
116
116
|
* import { TransactionPoller } from '@zendfi/sdk/helpers';
|
|
117
117
|
*
|
|
118
|
-
* // Wait for confirmation
|
|
119
118
|
* const status = await TransactionPoller.waitForConfirmation(
|
|
120
119
|
* signature,
|
|
121
120
|
* { timeout: 60000, interval: 2000 }
|
package/dist/helpers/index.js
CHANGED
|
@@ -430,7 +430,6 @@ var TransactionPoller = class {
|
|
|
430
430
|
switch (commitment) {
|
|
431
431
|
case "processed":
|
|
432
432
|
return true;
|
|
433
|
-
// Any status means processed
|
|
434
433
|
case "confirmed":
|
|
435
434
|
return status.confirmationStatus === "confirmed" || status.confirmationStatus === "finalized";
|
|
436
435
|
case "finalized":
|
|
@@ -551,7 +550,6 @@ var TransactionMonitor = class {
|
|
|
551
550
|
const status = await TransactionPoller.waitForConfirmation(signature, {
|
|
552
551
|
...options,
|
|
553
552
|
maxAttempts: 1
|
|
554
|
-
// Single check per interval
|
|
555
553
|
});
|
|
556
554
|
if (status.confirmed) {
|
|
557
555
|
this.stopMonitoring(signature);
|
|
@@ -679,7 +677,6 @@ var DevTools = class {
|
|
|
679
677
|
sessionWallet: keypair.publicKey.toString(),
|
|
680
678
|
privateKey: keypair.secretKey,
|
|
681
679
|
budget: 10
|
|
682
|
-
// $10 test budget
|
|
683
680
|
};
|
|
684
681
|
}
|
|
685
682
|
/**
|
|
@@ -691,14 +688,13 @@ var DevTools = class {
|
|
|
691
688
|
address: mockAddress,
|
|
692
689
|
publicKey: { toString: () => mockAddress },
|
|
693
690
|
signTransaction: async (tx) => {
|
|
694
|
-
console.log("
|
|
691
|
+
console.log("Mock wallet: Signing transaction");
|
|
695
692
|
return tx;
|
|
696
693
|
},
|
|
697
694
|
signMessage: async (_msg) => {
|
|
698
|
-
console.log("
|
|
695
|
+
console.log("Mock wallet: Signing message");
|
|
699
696
|
return {
|
|
700
697
|
signature: new Uint8Array(64)
|
|
701
|
-
// Mock signature
|
|
702
698
|
};
|
|
703
699
|
},
|
|
704
700
|
isConnected: () => true,
|
|
@@ -713,26 +709,26 @@ var DevTools = class {
|
|
|
713
709
|
static logTransactionFlow(paymentId) {
|
|
714
710
|
console.log(`
|
|
715
711
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
716
|
-
\u2551 TRANSACTION FLOW
|
|
712
|
+
\u2551 TRANSACTION FLOW \u2551
|
|
717
713
|
\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563
|
|
718
|
-
\u2551
|
|
719
|
-
\u2551 Payment ID: ${paymentId}
|
|
720
|
-
\u2551
|
|
721
|
-
\u2551 1.
|
|
714
|
+
\u2551 \u2551
|
|
715
|
+
\u2551 Payment ID: ${paymentId} \u2551
|
|
716
|
+
\u2551 \u2551
|
|
717
|
+
\u2551 1. Create Payment Intent \u2551
|
|
722
718
|
\u2551 \u2514\u2500> POST /api/v1/ai/smart-payment \u2551
|
|
723
|
-
\u2551
|
|
724
|
-
\u2551 2.
|
|
725
|
-
\u2551 \u2514\u2500> Client-side signing with cached keypair
|
|
726
|
-
\u2551
|
|
727
|
-
\u2551 3.
|
|
728
|
-
\u2551 \u2514\u2500> POST /api/v1/ai/payments/{id}/submit-signed
|
|
729
|
-
\u2551
|
|
730
|
-
\u2551 4.
|
|
731
|
-
\u2551 \u2514\u2500> Poll Solana RPC (~30-60 seconds)
|
|
732
|
-
\u2551
|
|
733
|
-
\u2551 5.
|
|
734
|
-
\u2551 \u2514\u2500> Webhook fired: payment.confirmed
|
|
735
|
-
\u2551
|
|
719
|
+
\u2551 \u2551
|
|
720
|
+
\u2551 2. Sign Transaction (Device-Bound) \u2551
|
|
721
|
+
\u2551 \u2514\u2500> Client-side signing with cached keypair \u2551
|
|
722
|
+
\u2551 \u2551
|
|
723
|
+
\u2551 3. Submit Signed Transaction \u2551
|
|
724
|
+
\u2551 \u2514\u2500> POST /api/v1/ai/payments/{id}/submit-signed \u2551
|
|
725
|
+
\u2551 \u2551
|
|
726
|
+
\u2551 4. Wait for Blockchain Confirmation \u2551
|
|
727
|
+
\u2551 \u2514\u2500> Poll Solana RPC (~30-60 seconds) \u2551
|
|
728
|
+
\u2551 \u2551
|
|
729
|
+
\u2551 5. Payment Confirmed \u2551
|
|
730
|
+
\u2551 \u2514\u2500> Webhook fired: payment.confirmed \u2551
|
|
731
|
+
\u2551 \u2551
|
|
736
732
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
737
733
|
`);
|
|
738
734
|
}
|
package/dist/helpers/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as ZendFiConfig, C as CreatePaymentRequest, P as Payment, b as CreateSubscriptionPlanRequest, S as SubscriptionPlan, c as CreateSubscriptionRequest, d as Subscription, e as CreatePaymentLinkRequest, f as PaymentLink, g as CreateInstallmentPlanRequest, I as InstallmentPlan, h as CreateInvoiceRequest, i as Invoice, V as VerifyWebhookRequest, j as WebhookPayload, A as ApiKeyMode } from './webhook-handler-
|
|
2
|
-
export { B as Brand,
|
|
1
|
+
import { Z as ZendFiConfig, C as CreatePaymentRequest, P as Payment, b as CreateSubscriptionPlanRequest, S as SubscriptionPlan, c as CreateSubscriptionRequest, d as Subscription, e as CreatePaymentLinkRequest, f as PaymentLink, g as CreateInstallmentPlanRequest, I as InstallmentPlan, h as CreateInvoiceRequest, i as Invoice, V as VerifyWebhookRequest, j as WebhookPayload, A as ApiKeyMode } from './webhook-handler-hUfWh-_Y.mjs';
|
|
2
|
+
export { O as BankAccountSplitRecipient, B as Brand, _ as CreateInstallmentPlanResponse, y as Currency, E as Environment, q as InstallmentPlanId, G as InstallmentPlanStatus, Y as InstallmentScheduleItem, n as InvoiceId, $ as InvoiceLineItem, H as InvoiceStatus, U as ListPaymentsRequest, M as MerchantId, X as PaginatedResponse, m as PaymentId, r as PaymentLinkCode, T as PaymentLinkCustomerObject, D as PaymentStatus, z as PaymentToken, R as RecipientType, Q as SplitRecipient, L as SplitRecipientBase, J as SplitStatus, o as SubscriptionId, F as SubscriptionStatus, N as WalletSplitRecipient, K as WebhookEvent, l as WebhookEventHandler, W as WebhookHandlerConfig, a as WebhookHandlers, k as WebhookResult, w as asInstallmentPlanId, u as asInvoiceId, t as asMerchantId, s as asPaymentId, x as asPaymentLinkCode, v as asSubscriptionId, p as processWebhook } from './webhook-handler-hUfWh-_Y.mjs';
|
|
3
3
|
export { ConnectedWallet, DevTools, MockWallet, PerformanceMonitor, PollingOptions, TestSessionKey, TransactionMonitor, TransactionPoller, TransactionStatus, WalletConnector, createWalletHook } from './helpers/index.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -250,7 +250,7 @@ declare function sleep(ms: number): Promise<void>;
|
|
|
250
250
|
* ```typescript
|
|
251
251
|
* const limiter = new RateLimiter({
|
|
252
252
|
* maxRequests: 100,
|
|
253
|
-
* windowMs: 60000,
|
|
253
|
+
* windowMs: 60000,
|
|
254
254
|
* });
|
|
255
255
|
*
|
|
256
256
|
* if (limiter.canMakeRequest()) {
|
|
@@ -312,8 +312,7 @@ declare class RateLimiter {
|
|
|
312
312
|
*
|
|
313
313
|
* @example
|
|
314
314
|
* ```typescript
|
|
315
|
-
*
|
|
316
|
-
* import { verifyNextWebhook } from '@zendfi/sdk/webhooks';
|
|
315
|
+
* import { verifyNextWebhook } from '@zendfi/sdk';
|
|
317
316
|
*
|
|
318
317
|
* export async function POST(request: Request) {
|
|
319
318
|
* const webhook = await verifyNextWebhook(request);
|
|
@@ -322,10 +321,8 @@ declare class RateLimiter {
|
|
|
322
321
|
* return new Response('Invalid signature', { status: 401 });
|
|
323
322
|
* }
|
|
324
323
|
*
|
|
325
|
-
* // Process webhook
|
|
326
324
|
* switch (webhook.event) {
|
|
327
325
|
* case 'payment.confirmed':
|
|
328
|
-
* // Handle payment
|
|
329
326
|
* break;
|
|
330
327
|
* }
|
|
331
328
|
*
|
|
@@ -339,7 +336,7 @@ declare function verifyNextWebhook(request: Request, secret?: string): Promise<W
|
|
|
339
336
|
*
|
|
340
337
|
* @example
|
|
341
338
|
* ```typescript
|
|
342
|
-
* import { verifyExpressWebhook } from '@zendfi/sdk
|
|
339
|
+
* import { verifyExpressWebhook } from '@zendfi/sdk';
|
|
343
340
|
*
|
|
344
341
|
* app.post('/webhooks/zendfi', async (req, res) => {
|
|
345
342
|
* const webhook = await verifyExpressWebhook(req);
|
|
@@ -362,7 +359,7 @@ declare function verifyExpressWebhook(request: any, secret?: string): Promise<We
|
|
|
362
359
|
*
|
|
363
360
|
* @example
|
|
364
361
|
* ```typescript
|
|
365
|
-
* import { verifyWebhookSignature } from '@zendfi/sdk
|
|
362
|
+
* import { verifyWebhookSignature } from '@zendfi/sdk';
|
|
366
363
|
*
|
|
367
364
|
* const isValid = verifyWebhookSignature(
|
|
368
365
|
* payloadString,
|
|
@@ -547,6 +544,14 @@ declare class ZendFiEmbeddedCheckout {
|
|
|
547
544
|
* Render success state
|
|
548
545
|
*/
|
|
549
546
|
private renderSuccess;
|
|
547
|
+
/**
|
|
548
|
+
* Render payment under review state
|
|
549
|
+
*/
|
|
550
|
+
private renderUnderReview;
|
|
551
|
+
/**
|
|
552
|
+
* Handle payment timeout (15 minutes)
|
|
553
|
+
*/
|
|
554
|
+
private handlePaymentTimeout;
|
|
550
555
|
/**
|
|
551
556
|
* Render error state
|
|
552
557
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as ZendFiConfig, C as CreatePaymentRequest, P as Payment, b as CreateSubscriptionPlanRequest, S as SubscriptionPlan, c as CreateSubscriptionRequest, d as Subscription, e as CreatePaymentLinkRequest, f as PaymentLink, g as CreateInstallmentPlanRequest, I as InstallmentPlan, h as CreateInvoiceRequest, i as Invoice, V as VerifyWebhookRequest, j as WebhookPayload, A as ApiKeyMode } from './webhook-handler-
|
|
2
|
-
export { B as Brand,
|
|
1
|
+
import { Z as ZendFiConfig, C as CreatePaymentRequest, P as Payment, b as CreateSubscriptionPlanRequest, S as SubscriptionPlan, c as CreateSubscriptionRequest, d as Subscription, e as CreatePaymentLinkRequest, f as PaymentLink, g as CreateInstallmentPlanRequest, I as InstallmentPlan, h as CreateInvoiceRequest, i as Invoice, V as VerifyWebhookRequest, j as WebhookPayload, A as ApiKeyMode } from './webhook-handler-hUfWh-_Y.js';
|
|
2
|
+
export { O as BankAccountSplitRecipient, B as Brand, _ as CreateInstallmentPlanResponse, y as Currency, E as Environment, q as InstallmentPlanId, G as InstallmentPlanStatus, Y as InstallmentScheduleItem, n as InvoiceId, $ as InvoiceLineItem, H as InvoiceStatus, U as ListPaymentsRequest, M as MerchantId, X as PaginatedResponse, m as PaymentId, r as PaymentLinkCode, T as PaymentLinkCustomerObject, D as PaymentStatus, z as PaymentToken, R as RecipientType, Q as SplitRecipient, L as SplitRecipientBase, J as SplitStatus, o as SubscriptionId, F as SubscriptionStatus, N as WalletSplitRecipient, K as WebhookEvent, l as WebhookEventHandler, W as WebhookHandlerConfig, a as WebhookHandlers, k as WebhookResult, w as asInstallmentPlanId, u as asInvoiceId, t as asMerchantId, s as asPaymentId, x as asPaymentLinkCode, v as asSubscriptionId, p as processWebhook } from './webhook-handler-hUfWh-_Y.js';
|
|
3
3
|
export { ConnectedWallet, DevTools, MockWallet, PerformanceMonitor, PollingOptions, TestSessionKey, TransactionMonitor, TransactionPoller, TransactionStatus, WalletConnector, createWalletHook } from './helpers/index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -250,7 +250,7 @@ declare function sleep(ms: number): Promise<void>;
|
|
|
250
250
|
* ```typescript
|
|
251
251
|
* const limiter = new RateLimiter({
|
|
252
252
|
* maxRequests: 100,
|
|
253
|
-
* windowMs: 60000,
|
|
253
|
+
* windowMs: 60000,
|
|
254
254
|
* });
|
|
255
255
|
*
|
|
256
256
|
* if (limiter.canMakeRequest()) {
|
|
@@ -312,8 +312,7 @@ declare class RateLimiter {
|
|
|
312
312
|
*
|
|
313
313
|
* @example
|
|
314
314
|
* ```typescript
|
|
315
|
-
*
|
|
316
|
-
* import { verifyNextWebhook } from '@zendfi/sdk/webhooks';
|
|
315
|
+
* import { verifyNextWebhook } from '@zendfi/sdk';
|
|
317
316
|
*
|
|
318
317
|
* export async function POST(request: Request) {
|
|
319
318
|
* const webhook = await verifyNextWebhook(request);
|
|
@@ -322,10 +321,8 @@ declare class RateLimiter {
|
|
|
322
321
|
* return new Response('Invalid signature', { status: 401 });
|
|
323
322
|
* }
|
|
324
323
|
*
|
|
325
|
-
* // Process webhook
|
|
326
324
|
* switch (webhook.event) {
|
|
327
325
|
* case 'payment.confirmed':
|
|
328
|
-
* // Handle payment
|
|
329
326
|
* break;
|
|
330
327
|
* }
|
|
331
328
|
*
|
|
@@ -339,7 +336,7 @@ declare function verifyNextWebhook(request: Request, secret?: string): Promise<W
|
|
|
339
336
|
*
|
|
340
337
|
* @example
|
|
341
338
|
* ```typescript
|
|
342
|
-
* import { verifyExpressWebhook } from '@zendfi/sdk
|
|
339
|
+
* import { verifyExpressWebhook } from '@zendfi/sdk';
|
|
343
340
|
*
|
|
344
341
|
* app.post('/webhooks/zendfi', async (req, res) => {
|
|
345
342
|
* const webhook = await verifyExpressWebhook(req);
|
|
@@ -362,7 +359,7 @@ declare function verifyExpressWebhook(request: any, secret?: string): Promise<We
|
|
|
362
359
|
*
|
|
363
360
|
* @example
|
|
364
361
|
* ```typescript
|
|
365
|
-
* import { verifyWebhookSignature } from '@zendfi/sdk
|
|
362
|
+
* import { verifyWebhookSignature } from '@zendfi/sdk';
|
|
366
363
|
*
|
|
367
364
|
* const isValid = verifyWebhookSignature(
|
|
368
365
|
* payloadString,
|
|
@@ -547,6 +544,14 @@ declare class ZendFiEmbeddedCheckout {
|
|
|
547
544
|
* Render success state
|
|
548
545
|
*/
|
|
549
546
|
private renderSuccess;
|
|
547
|
+
/**
|
|
548
|
+
* Render payment under review state
|
|
549
|
+
*/
|
|
550
|
+
private renderUnderReview;
|
|
551
|
+
/**
|
|
552
|
+
* Handle payment timeout (15 minutes)
|
|
553
|
+
*/
|
|
554
|
+
private handlePaymentTimeout;
|
|
550
555
|
/**
|
|
551
556
|
* Render error state
|
|
552
557
|
*/
|