@b3dotfun/sdk 0.1.68 → 0.1.69-alpha.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.
- package/dist/cjs/anyspend/platform/client.d.ts +35 -0
- package/dist/cjs/anyspend/platform/client.js +158 -0
- package/dist/cjs/anyspend/platform/errors.d.ts +38 -0
- package/dist/cjs/anyspend/platform/errors.js +77 -0
- package/dist/cjs/anyspend/platform/index.d.ts +87 -0
- package/dist/cjs/anyspend/platform/index.js +85 -0
- package/dist/cjs/anyspend/platform/resources/analytics.d.ts +7 -0
- package/dist/cjs/anyspend/platform/resources/analytics.js +12 -0
- package/dist/cjs/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
- package/dist/cjs/anyspend/platform/resources/checkout-sessions.js +27 -0
- package/dist/cjs/anyspend/platform/resources/customers.d.ts +19 -0
- package/dist/cjs/anyspend/platform/resources/customers.js +34 -0
- package/dist/cjs/anyspend/platform/resources/discount-codes.d.ts +29 -0
- package/dist/cjs/anyspend/platform/resources/discount-codes.js +31 -0
- package/dist/cjs/anyspend/platform/resources/events.d.ts +14 -0
- package/dist/cjs/anyspend/platform/resources/events.js +16 -0
- package/dist/cjs/anyspend/platform/resources/notifications.d.ts +18 -0
- package/dist/cjs/anyspend/platform/resources/notifications.js +27 -0
- package/dist/cjs/anyspend/platform/resources/organization.d.ts +17 -0
- package/dist/cjs/anyspend/platform/resources/organization.js +15 -0
- package/dist/cjs/anyspend/platform/resources/payment-links.d.ts +21 -0
- package/dist/cjs/anyspend/platform/resources/payment-links.js +49 -0
- package/dist/cjs/anyspend/platform/resources/products.d.ts +27 -0
- package/dist/cjs/anyspend/platform/resources/products.js +31 -0
- package/dist/cjs/anyspend/platform/resources/transactions.d.ts +11 -0
- package/dist/cjs/anyspend/platform/resources/transactions.js +25 -0
- package/dist/cjs/anyspend/platform/resources/webhooks.d.ts +14 -0
- package/dist/cjs/anyspend/platform/resources/webhooks.js +33 -0
- package/dist/cjs/anyspend/platform/resources/widgets.d.ts +38 -0
- package/dist/cjs/anyspend/platform/resources/widgets.js +31 -0
- package/dist/cjs/anyspend/platform/types.d.ts +478 -0
- package/dist/cjs/anyspend/platform/types.js +5 -0
- package/dist/cjs/anyspend/platform/utils/idempotency.d.ts +4 -0
- package/dist/cjs/anyspend/platform/utils/idempotency.js +17 -0
- package/dist/cjs/anyspend/platform/utils/pagination.d.ts +12 -0
- package/dist/cjs/anyspend/platform/utils/pagination.js +22 -0
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +127 -16
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -4
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.d.ts +14 -6
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckout.js +55 -8
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -2
- package/dist/cjs/anyspend/react/components/checkout/CryptoPayPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +5 -1
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +48 -16
- package/dist/cjs/anyspend/react/components/checkout/KycGate.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/checkout/KycGate.js +203 -0
- package/dist/cjs/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
- package/dist/cjs/anyspend/react/components/checkout/VariablePricingInput.js +145 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -0
- package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +47 -0
- package/dist/cjs/anyspend/react/hooks/useKycStatus.js +124 -0
- package/dist/cjs/anyspend/services/anyspend.d.ts +4 -1
- package/dist/cjs/anyspend/services/anyspend.js +3 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +1 -1
- package/dist/cjs/global-account/react/components/ManageAccount/channels/TelegramChannel.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -5
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +21 -24
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/cjs/global-account/react/hooks/useAuth.js +1 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +3 -1
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +94 -24
- package/dist/cjs/global-account/react/hooks/useGetAllTWSigners.js +2 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/cjs/global-account/react/stores/useModalStore.js +2 -0
- package/dist/cjs/global-account/react/utils/createWagmiConfig.d.ts +18 -0
- package/dist/cjs/global-account/react/utils/createWagmiConfig.js +17 -0
- package/dist/esm/anyspend/platform/client.d.ts +35 -0
- package/dist/esm/anyspend/platform/client.js +153 -0
- package/dist/esm/anyspend/platform/errors.d.ts +38 -0
- package/dist/esm/anyspend/platform/errors.js +67 -0
- package/dist/esm/anyspend/platform/index.d.ts +87 -0
- package/dist/esm/anyspend/platform/index.js +75 -0
- package/dist/esm/anyspend/platform/resources/analytics.d.ts +7 -0
- package/dist/esm/anyspend/platform/resources/analytics.js +8 -0
- package/dist/esm/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
- package/dist/esm/anyspend/platform/resources/checkout-sessions.js +23 -0
- package/dist/esm/anyspend/platform/resources/customers.d.ts +19 -0
- package/dist/esm/anyspend/platform/resources/customers.js +30 -0
- package/dist/esm/anyspend/platform/resources/discount-codes.d.ts +29 -0
- package/dist/esm/anyspend/platform/resources/discount-codes.js +27 -0
- package/dist/esm/anyspend/platform/resources/events.d.ts +14 -0
- package/dist/esm/anyspend/platform/resources/events.js +12 -0
- package/dist/esm/anyspend/platform/resources/notifications.d.ts +18 -0
- package/dist/esm/anyspend/platform/resources/notifications.js +23 -0
- package/dist/esm/anyspend/platform/resources/organization.d.ts +17 -0
- package/dist/esm/anyspend/platform/resources/organization.js +11 -0
- package/dist/esm/anyspend/platform/resources/payment-links.d.ts +21 -0
- package/dist/esm/anyspend/platform/resources/payment-links.js +45 -0
- package/dist/esm/anyspend/platform/resources/products.d.ts +27 -0
- package/dist/esm/anyspend/platform/resources/products.js +27 -0
- package/dist/esm/anyspend/platform/resources/transactions.d.ts +11 -0
- package/dist/esm/anyspend/platform/resources/transactions.js +21 -0
- package/dist/esm/anyspend/platform/resources/webhooks.d.ts +14 -0
- package/dist/esm/anyspend/platform/resources/webhooks.js +29 -0
- package/dist/esm/anyspend/platform/resources/widgets.d.ts +38 -0
- package/dist/esm/anyspend/platform/resources/widgets.js +27 -0
- package/dist/esm/anyspend/platform/types.d.ts +478 -0
- package/dist/esm/anyspend/platform/types.js +4 -0
- package/dist/esm/anyspend/platform/utils/idempotency.d.ts +4 -0
- package/dist/esm/anyspend/platform/utils/idempotency.js +14 -0
- package/dist/esm/anyspend/platform/utils/pagination.d.ts +12 -0
- package/dist/esm/anyspend/platform/utils/pagination.js +19 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +128 -17
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +4 -4
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.d.ts +14 -6
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckout.js +55 -8
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/esm/anyspend/react/components/checkout/AnySpendCheckoutTrigger.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +5 -1
- package/dist/esm/anyspend/react/components/checkout/CheckoutPaymentPanel.js +2 -2
- package/dist/esm/anyspend/react/components/checkout/CryptoPayPanel.js +1 -1
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +5 -1
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +50 -18
- package/dist/esm/anyspend/react/components/checkout/KycGate.d.ts +11 -0
- package/dist/esm/anyspend/react/components/checkout/KycGate.js +167 -0
- package/dist/esm/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
- package/dist/esm/anyspend/react/components/checkout/VariablePricingInput.js +142 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +1 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/esm/anyspend/react/components/index.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +14 -0
- package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +47 -0
- package/dist/esm/anyspend/react/hooks/useKycStatus.js +117 -0
- package/dist/esm/anyspend/services/anyspend.d.ts +4 -1
- package/dist/esm/anyspend/services/anyspend.js +3 -1
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -1
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +3 -3
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +1 -1
- package/dist/esm/global-account/react/components/ManageAccount/channels/TelegramChannel.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +13 -5
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Privy.js +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +21 -24
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepCustom.js +1 -1
- package/dist/esm/global-account/react/hooks/useAuth.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +3 -1
- package/dist/esm/global-account/react/hooks/useAuthentication.js +94 -24
- package/dist/esm/global-account/react/hooks/useGetAllTWSigners.js +2 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/global-account/react/stores/useModalStore.js +2 -0
- package/dist/esm/global-account/react/utils/createWagmiConfig.d.ts +18 -0
- package/dist/esm/global-account/react/utils/createWagmiConfig.js +16 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/platform/client.d.ts +35 -0
- package/dist/types/anyspend/platform/errors.d.ts +38 -0
- package/dist/types/anyspend/platform/index.d.ts +87 -0
- package/dist/types/anyspend/platform/resources/analytics.d.ts +7 -0
- package/dist/types/anyspend/platform/resources/checkout-sessions.d.ts +17 -0
- package/dist/types/anyspend/platform/resources/customers.d.ts +19 -0
- package/dist/types/anyspend/platform/resources/discount-codes.d.ts +29 -0
- package/dist/types/anyspend/platform/resources/events.d.ts +14 -0
- package/dist/types/anyspend/platform/resources/notifications.d.ts +18 -0
- package/dist/types/anyspend/platform/resources/organization.d.ts +17 -0
- package/dist/types/anyspend/platform/resources/payment-links.d.ts +21 -0
- package/dist/types/anyspend/platform/resources/products.d.ts +27 -0
- package/dist/types/anyspend/platform/resources/transactions.d.ts +11 -0
- package/dist/types/anyspend/platform/resources/webhooks.d.ts +14 -0
- package/dist/types/anyspend/platform/resources/widgets.d.ts +38 -0
- package/dist/types/anyspend/platform/types.d.ts +478 -0
- package/dist/types/anyspend/platform/utils/idempotency.d.ts +4 -0
- package/dist/types/anyspend/platform/utils/pagination.d.ts +12 -0
- package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -1
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckout.d.ts +14 -6
- package/dist/types/anyspend/react/components/checkout/AnySpendCheckoutTrigger.d.ts +3 -1
- package/dist/types/anyspend/react/components/checkout/CheckoutPaymentPanel.d.ts +5 -1
- package/dist/types/anyspend/react/components/checkout/FiatCheckoutPanel.d.ts +5 -1
- package/dist/types/anyspend/react/components/checkout/KycGate.d.ts +11 -0
- package/dist/types/anyspend/react/components/checkout/VariablePricingInput.d.ts +17 -0
- package/dist/types/anyspend/react/components/index.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +47 -0
- package/dist/types/anyspend/services/anyspend.d.ts +4 -1
- package/dist/types/global-account/react/components/SignInWithB3/steps/LoginStep.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +3 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/types/global-account/react/utils/createWagmiConfig.d.ts +18 -0
- package/package.json +7 -1
- package/src/anyspend/docs/checkout-sessions.md +20 -3
- package/src/anyspend/platform/client.ts +198 -0
- package/src/anyspend/platform/errors.ts +92 -0
- package/src/anyspend/platform/index.ts +129 -0
- package/src/anyspend/platform/resources/analytics.ts +10 -0
- package/src/anyspend/platform/resources/checkout-sessions.ts +36 -0
- package/src/anyspend/platform/resources/customers.ts +54 -0
- package/src/anyspend/platform/resources/discount-codes.ts +63 -0
- package/src/anyspend/platform/resources/events.ts +22 -0
- package/src/anyspend/platform/resources/notifications.ts +37 -0
- package/src/anyspend/platform/resources/organization.ts +24 -0
- package/src/anyspend/platform/resources/payment-links.ts +74 -0
- package/src/anyspend/platform/resources/products.ts +59 -0
- package/src/anyspend/platform/resources/transactions.ts +33 -0
- package/src/anyspend/platform/resources/webhooks.ts +47 -0
- package/src/anyspend/platform/resources/widgets.ts +63 -0
- package/src/anyspend/platform/types.ts +532 -0
- package/src/anyspend/platform/utils/idempotency.ts +15 -0
- package/src/anyspend/platform/utils/pagination.ts +32 -0
- package/src/anyspend/react/components/AnySpend.tsx +152 -18
- package/src/anyspend/react/components/AnySpendCustom.tsx +4 -4
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -2
- package/src/anyspend/react/components/checkout/AnySpendCheckout.tsx +81 -18
- package/src/anyspend/react/components/checkout/AnySpendCheckoutTrigger.tsx +4 -0
- package/src/anyspend/react/components/checkout/CheckoutPaymentPanel.tsx +8 -0
- package/src/anyspend/react/components/checkout/CryptoPayPanel.tsx +4 -13
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +86 -17
- package/src/anyspend/react/components/checkout/KycGate.tsx +387 -0
- package/src/anyspend/react/components/checkout/VariablePricingInput.tsx +247 -0
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -1
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +1 -1
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +17 -0
- package/src/anyspend/react/hooks/useKycStatus.ts +150 -0
- package/src/anyspend/services/anyspend.ts +7 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -2
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +7 -7
- package/src/global-account/react/components/ManageAccount/HomeActions.tsx +2 -2
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +7 -7
- package/src/global-account/react/components/ManageAccount/channels/TelegramChannel.tsx +1 -1
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +1 -1
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +13 -5
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Privy.tsx +1 -1
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +35 -25
- package/src/global-account/react/components/SignInWithB3/steps/LoginStepCustom.tsx +1 -1
- package/src/global-account/react/hooks/useAuth.ts +2 -2
- package/src/global-account/react/hooks/useAuthentication.ts +92 -27
- package/src/global-account/react/hooks/useGetAllTWSigners.tsx +2 -1
- package/src/global-account/react/stores/useModalStore.ts +6 -0
- package/src/global-account/react/utils/createWagmiConfig.tsx +18 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import { autoPaginate } from "../utils/pagination";
|
|
3
|
+
import type {
|
|
4
|
+
Customer,
|
|
5
|
+
Transaction,
|
|
6
|
+
ListResponse,
|
|
7
|
+
DeletedResponse,
|
|
8
|
+
CreateCustomerParams,
|
|
9
|
+
UpdateCustomerParams,
|
|
10
|
+
ExportCustomersParams,
|
|
11
|
+
PaginationParams,
|
|
12
|
+
} from "../types";
|
|
13
|
+
|
|
14
|
+
export interface ListCustomersParams extends PaginationParams {
|
|
15
|
+
search?: string;
|
|
16
|
+
sort?: "created_at" | "updated_at" | "total_paid" | "transaction_count";
|
|
17
|
+
order?: "asc" | "desc";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class CustomersResource {
|
|
21
|
+
constructor(private client: HttpClient) {}
|
|
22
|
+
|
|
23
|
+
async list(params?: ListCustomersParams): Promise<ListResponse<Customer>> {
|
|
24
|
+
return this.client.get<ListResponse<Customer>>("/customers", params);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async *listAutoPaginate(params?: Omit<ListCustomersParams, "page">): AsyncGenerator<Customer> {
|
|
28
|
+
yield* autoPaginate<Customer>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async create(params: CreateCustomerParams): Promise<Customer> {
|
|
32
|
+
return this.client.post<Customer>("/customers", params);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async get(id: string): Promise<Customer> {
|
|
36
|
+
return this.client.get<Customer>(`/customers/${id}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async update(id: string, params: UpdateCustomerParams): Promise<Customer> {
|
|
40
|
+
return this.client.patch<Customer>(`/customers/${id}`, params);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async delete(id: string): Promise<DeletedResponse> {
|
|
44
|
+
return this.client.delete<DeletedResponse>(`/customers/${id}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async transactions(id: string, params?: PaginationParams): Promise<ListResponse<Transaction>> {
|
|
48
|
+
return this.client.get<ListResponse<Transaction>>(`/customers/${id}/transactions`, params);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async export(params?: ExportCustomersParams): Promise<string> {
|
|
52
|
+
return this.client.get<string>("/customers/export", params);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import { autoPaginate } from "../utils/pagination";
|
|
3
|
+
import type {
|
|
4
|
+
DiscountCode,
|
|
5
|
+
ListResponse,
|
|
6
|
+
DeletedResponse,
|
|
7
|
+
CreateDiscountCodeParams,
|
|
8
|
+
BatchCreateDiscountCodesParams,
|
|
9
|
+
ValidateDiscountResult,
|
|
10
|
+
BatchCreateResult,
|
|
11
|
+
PaginationParams,
|
|
12
|
+
} from "../types";
|
|
13
|
+
|
|
14
|
+
export interface ListDiscountCodesParams extends PaginationParams {
|
|
15
|
+
payment_link_id?: string;
|
|
16
|
+
active?: "true" | "false";
|
|
17
|
+
search?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UpdateDiscountCodeParams {
|
|
21
|
+
is_active?: boolean;
|
|
22
|
+
max_uses?: number;
|
|
23
|
+
min_order_amount?: string;
|
|
24
|
+
expires_at?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ValidateDiscountParams {
|
|
28
|
+
code: string;
|
|
29
|
+
payment_link_id?: string;
|
|
30
|
+
amount?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class DiscountCodesResource {
|
|
34
|
+
constructor(private client: HttpClient) {}
|
|
35
|
+
|
|
36
|
+
async list(params?: ListDiscountCodesParams): Promise<ListResponse<DiscountCode>> {
|
|
37
|
+
return this.client.get<ListResponse<DiscountCode>>("/discount-codes", params);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async *listAutoPaginate(params?: Omit<ListDiscountCodesParams, "page">): AsyncGenerator<DiscountCode> {
|
|
41
|
+
yield* autoPaginate<DiscountCode>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async create(params: CreateDiscountCodeParams): Promise<DiscountCode> {
|
|
45
|
+
return this.client.post<DiscountCode>("/discount-codes", params);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async update(id: string, params: UpdateDiscountCodeParams): Promise<DiscountCode> {
|
|
49
|
+
return this.client.patch<DiscountCode>(`/discount-codes/${id}`, params);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async delete(id: string): Promise<DeletedResponse> {
|
|
53
|
+
return this.client.delete<DeletedResponse>(`/discount-codes/${id}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async validate(params: ValidateDiscountParams): Promise<ValidateDiscountResult> {
|
|
57
|
+
return this.client.post<ValidateDiscountResult>("/discount-codes/validate", params);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async batchCreate(params: BatchCreateDiscountCodesParams): Promise<BatchCreateResult> {
|
|
61
|
+
return this.client.post<BatchCreateResult>("/discount-codes/batch", params);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import { autoPaginate } from "../utils/pagination";
|
|
3
|
+
import type { ApiEvent, ListResponse, PaginationParams } from "../types";
|
|
4
|
+
|
|
5
|
+
export interface ListEventsParams extends PaginationParams {
|
|
6
|
+
event_type?: string;
|
|
7
|
+
resource_type?: string;
|
|
8
|
+
from?: number;
|
|
9
|
+
to?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class EventsResource {
|
|
13
|
+
constructor(private client: HttpClient) {}
|
|
14
|
+
|
|
15
|
+
async list(params?: ListEventsParams): Promise<ListResponse<ApiEvent>> {
|
|
16
|
+
return this.client.get<ListResponse<ApiEvent>>("/events", params);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async *listAutoPaginate(params?: Omit<ListEventsParams, "page">): AsyncGenerator<ApiEvent> {
|
|
20
|
+
yield* autoPaginate<ApiEvent>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import type { NotificationSettings, UpdateNotificationSettingsParams, ActionResponse } from "../types";
|
|
3
|
+
|
|
4
|
+
export interface TelegramLinkResult {
|
|
5
|
+
object: "telegram_link";
|
|
6
|
+
link_url: string;
|
|
7
|
+
link_code: string;
|
|
8
|
+
expires_at: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class NotificationsResource {
|
|
12
|
+
constructor(private client: HttpClient) {}
|
|
13
|
+
|
|
14
|
+
async get(): Promise<NotificationSettings> {
|
|
15
|
+
return this.client.get<NotificationSettings>("/notifications");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async update(params: UpdateNotificationSettingsParams): Promise<NotificationSettings> {
|
|
19
|
+
return this.client.patch<NotificationSettings>("/notifications", params);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async linkTelegram(): Promise<TelegramLinkResult> {
|
|
23
|
+
return this.client.post<TelegramLinkResult>("/notifications/telegram/link");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async unlinkTelegram(): Promise<ActionResponse> {
|
|
27
|
+
return this.client.post<ActionResponse>("/notifications/telegram/unlink");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async testEmail(): Promise<ActionResponse> {
|
|
31
|
+
return this.client.post<ActionResponse>("/notifications/test/email");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async testTelegram(): Promise<ActionResponse> {
|
|
35
|
+
return this.client.post<ActionResponse>("/notifications/test/telegram");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import type { Organization } from "../types";
|
|
3
|
+
|
|
4
|
+
export interface UpdateOrganizationParams {
|
|
5
|
+
name?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
logo_url?: string;
|
|
8
|
+
website_url?: string;
|
|
9
|
+
default_recipient_address?: string;
|
|
10
|
+
default_chain_id?: number;
|
|
11
|
+
default_token_address?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class OrganizationResource {
|
|
15
|
+
constructor(private client: HttpClient) {}
|
|
16
|
+
|
|
17
|
+
async get(): Promise<Organization> {
|
|
18
|
+
return this.client.get<Organization>("/organization");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async update(params: UpdateOrganizationParams): Promise<Organization> {
|
|
22
|
+
return this.client.patch<Organization>("/organization", params);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import { autoPaginate } from "../utils/pagination";
|
|
3
|
+
import type {
|
|
4
|
+
PaymentLink,
|
|
5
|
+
PaymentLinkItem,
|
|
6
|
+
PaymentLinkStats,
|
|
7
|
+
CheckoutSession,
|
|
8
|
+
ListResponse,
|
|
9
|
+
DeletedResponse,
|
|
10
|
+
CreatePaymentLinkParams,
|
|
11
|
+
CreatePaymentLinkItemParams,
|
|
12
|
+
UpdatePaymentLinkParams,
|
|
13
|
+
ListPaymentLinksParams,
|
|
14
|
+
PaginationParams,
|
|
15
|
+
} from "../types";
|
|
16
|
+
|
|
17
|
+
export class PaymentLinksResource {
|
|
18
|
+
constructor(private client: HttpClient) {}
|
|
19
|
+
|
|
20
|
+
async list(params?: ListPaymentLinksParams): Promise<ListResponse<PaymentLink>> {
|
|
21
|
+
return this.client.get<ListResponse<PaymentLink>>("/payment-links", params);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async *listAutoPaginate(params?: Omit<ListPaymentLinksParams, "page">): AsyncGenerator<PaymentLink> {
|
|
25
|
+
yield* autoPaginate<PaymentLink>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async create(params: CreatePaymentLinkParams): Promise<PaymentLink> {
|
|
29
|
+
return this.client.post<PaymentLink>("/payment-links", params);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async get(id: string): Promise<PaymentLink> {
|
|
33
|
+
return this.client.get<PaymentLink>(`/payment-links/${id}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async update(id: string, params: UpdatePaymentLinkParams): Promise<PaymentLink> {
|
|
37
|
+
return this.client.patch<PaymentLink>(`/payment-links/${id}`, params);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async delete(id: string): Promise<DeletedResponse> {
|
|
41
|
+
return this.client.delete<DeletedResponse>(`/payment-links/${id}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async duplicate(id: string, overrides?: Partial<CreatePaymentLinkParams>): Promise<PaymentLink> {
|
|
45
|
+
return this.client.post<PaymentLink>(`/payment-links/${id}/duplicate`, overrides ?? {});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async stats(id: string, days?: number): Promise<PaymentLinkStats> {
|
|
49
|
+
return this.client.get<PaymentLinkStats>(`/payment-links/${id}/stats`, days !== undefined ? { days } : undefined);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async sessions(id: string, params?: PaginationParams): Promise<ListResponse<CheckoutSession>> {
|
|
53
|
+
return this.client.get<ListResponse<CheckoutSession>>(`/payment-links/${id}/sessions`, params);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async visitors(
|
|
57
|
+
id: string,
|
|
58
|
+
params?: PaginationParams & { days?: number },
|
|
59
|
+
): Promise<ListResponse<Record<string, unknown>>> {
|
|
60
|
+
return this.client.get<ListResponse<Record<string, unknown>>>(`/payment-links/${id}/visitors`, params);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async items(id: string): Promise<PaymentLinkItem[]> {
|
|
64
|
+
return this.client.get<PaymentLinkItem[]>(`/payment-links/${id}/items`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async addItem(id: string, item: CreatePaymentLinkItemParams): Promise<PaymentLinkItem> {
|
|
68
|
+
return this.client.post<PaymentLinkItem>(`/payment-links/${id}/items`, item);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async removeItem(id: string, itemId: string): Promise<DeletedResponse> {
|
|
72
|
+
return this.client.delete<DeletedResponse>(`/payment-links/${id}/items/${itemId}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import { autoPaginate } from "../utils/pagination";
|
|
3
|
+
import type {
|
|
4
|
+
Product,
|
|
5
|
+
PaymentLink,
|
|
6
|
+
ListResponse,
|
|
7
|
+
DeletedResponse,
|
|
8
|
+
CreateProductParams,
|
|
9
|
+
UpdateProductParams,
|
|
10
|
+
PaginationParams,
|
|
11
|
+
} from "../types";
|
|
12
|
+
|
|
13
|
+
export interface ListProductsParams extends PaginationParams {
|
|
14
|
+
search?: string;
|
|
15
|
+
active?: "true" | "false";
|
|
16
|
+
product_type?: "one_time" | "subscription" | "variable";
|
|
17
|
+
sort?: "created_at" | "updated_at" | "name";
|
|
18
|
+
order?: "asc" | "desc";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GenerateLinkParams {
|
|
22
|
+
recipient_address?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
theme_color?: string;
|
|
26
|
+
button_text?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class ProductsResource {
|
|
30
|
+
constructor(private client: HttpClient) {}
|
|
31
|
+
|
|
32
|
+
async list(params?: ListProductsParams): Promise<ListResponse<Product>> {
|
|
33
|
+
return this.client.get<ListResponse<Product>>("/products", params);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async *listAutoPaginate(params?: Omit<ListProductsParams, "page">): AsyncGenerator<Product> {
|
|
37
|
+
yield* autoPaginate<Product>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async create(params: CreateProductParams): Promise<Product> {
|
|
41
|
+
return this.client.post<Product>("/products", params);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async get(id: string): Promise<Product> {
|
|
45
|
+
return this.client.get<Product>(`/products/${id}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async update(id: string, params: UpdateProductParams): Promise<Product> {
|
|
49
|
+
return this.client.patch<Product>(`/products/${id}`, params);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async delete(id: string): Promise<DeletedResponse> {
|
|
53
|
+
return this.client.delete<DeletedResponse>(`/products/${id}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async generateLink(id: string, params?: GenerateLinkParams): Promise<PaymentLink> {
|
|
57
|
+
return this.client.post<PaymentLink>(`/products/${id}/generate-link`, params ?? {});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import { autoPaginate } from "../utils/pagination";
|
|
3
|
+
import type {
|
|
4
|
+
Transaction,
|
|
5
|
+
TransactionStats,
|
|
6
|
+
ListResponse,
|
|
7
|
+
ListTransactionsParams,
|
|
8
|
+
ExportTransactionsParams,
|
|
9
|
+
} from "../types";
|
|
10
|
+
|
|
11
|
+
export class TransactionsResource {
|
|
12
|
+
constructor(private client: HttpClient) {}
|
|
13
|
+
|
|
14
|
+
async list(params?: ListTransactionsParams): Promise<ListResponse<Transaction>> {
|
|
15
|
+
return this.client.get<ListResponse<Transaction>>("/transactions", params);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async *listAutoPaginate(params?: Omit<ListTransactionsParams, "page">): AsyncGenerator<Transaction> {
|
|
19
|
+
yield* autoPaginate<Transaction>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async get(id: string): Promise<Transaction> {
|
|
23
|
+
return this.client.get<Transaction>(`/transactions/${id}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async stats(): Promise<TransactionStats> {
|
|
27
|
+
return this.client.get<TransactionStats>("/transactions/stats");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async export(params?: ExportTransactionsParams): Promise<string> {
|
|
31
|
+
return this.client.get<string>("/transactions/export", params);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import type {
|
|
3
|
+
Webhook,
|
|
4
|
+
WebhookDelivery,
|
|
5
|
+
ListResponse,
|
|
6
|
+
DeletedResponse,
|
|
7
|
+
ActionResponse,
|
|
8
|
+
CreateWebhookParams,
|
|
9
|
+
UpdateWebhookParams,
|
|
10
|
+
PaginationParams,
|
|
11
|
+
} from "../types";
|
|
12
|
+
|
|
13
|
+
export class WebhooksResource {
|
|
14
|
+
constructor(private client: HttpClient) {}
|
|
15
|
+
|
|
16
|
+
async list(): Promise<ListResponse<Webhook>> {
|
|
17
|
+
return this.client.get<ListResponse<Webhook>>("/webhooks");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async create(params: CreateWebhookParams): Promise<Webhook> {
|
|
21
|
+
return this.client.post<Webhook>("/webhooks", params);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async get(id: string): Promise<Webhook> {
|
|
25
|
+
return this.client.get<Webhook>(`/webhooks/${id}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async update(id: string, params: UpdateWebhookParams): Promise<Webhook> {
|
|
29
|
+
return this.client.patch<Webhook>(`/webhooks/${id}`, params);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async delete(id: string): Promise<DeletedResponse> {
|
|
33
|
+
return this.client.delete<DeletedResponse>(`/webhooks/${id}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async test(id: string): Promise<ActionResponse> {
|
|
37
|
+
return this.client.post<ActionResponse>(`/webhooks/${id}/test`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async deliveries(id: string, params?: PaginationParams): Promise<ListResponse<WebhookDelivery>> {
|
|
41
|
+
return this.client.get<ListResponse<WebhookDelivery>>(`/webhooks/${id}/deliveries`, params);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async retry(id: string, deliveryId: string): Promise<ActionResponse> {
|
|
45
|
+
return this.client.post<ActionResponse>(`/webhooks/${id}/deliveries/${deliveryId}/retry`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { HttpClient } from "../client";
|
|
2
|
+
import { autoPaginate } from "../utils/pagination";
|
|
3
|
+
import type { WidgetConfig, ListResponse, DeletedResponse, CreateWidgetParams, PaginationParams } from "../types";
|
|
4
|
+
|
|
5
|
+
export interface ListWidgetsParams extends PaginationParams {
|
|
6
|
+
search?: string;
|
|
7
|
+
widget_type?: "swap" | "checkout" | "nft" | "deposit";
|
|
8
|
+
active?: "true" | "false";
|
|
9
|
+
sort?: "created_at" | "updated_at" | "name" | "current_views";
|
|
10
|
+
order?: "asc" | "desc";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface UpdateWidgetParams extends Partial<CreateWidgetParams> {
|
|
14
|
+
is_active?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface WidgetStats {
|
|
18
|
+
object: "widget_stats";
|
|
19
|
+
widget_id: string;
|
|
20
|
+
summary: {
|
|
21
|
+
total_views: number;
|
|
22
|
+
total_interactions: number;
|
|
23
|
+
total_completions: number;
|
|
24
|
+
};
|
|
25
|
+
daily: {
|
|
26
|
+
date: string;
|
|
27
|
+
views: number;
|
|
28
|
+
interactions: number;
|
|
29
|
+
completions: number;
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class WidgetsResource {
|
|
34
|
+
constructor(private client: HttpClient) {}
|
|
35
|
+
|
|
36
|
+
async list(params?: ListWidgetsParams): Promise<ListResponse<WidgetConfig>> {
|
|
37
|
+
return this.client.get<ListResponse<WidgetConfig>>("/widgets", params);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async *listAutoPaginate(params?: Omit<ListWidgetsParams, "page">): AsyncGenerator<WidgetConfig> {
|
|
41
|
+
yield* autoPaginate<WidgetConfig>((page, limit) => this.list({ ...params, page, limit }), { limit: params?.limit });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async create(params: CreateWidgetParams): Promise<WidgetConfig> {
|
|
45
|
+
return this.client.post<WidgetConfig>("/widgets", params);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async get(id: string): Promise<WidgetConfig> {
|
|
49
|
+
return this.client.get<WidgetConfig>(`/widgets/${id}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async update(id: string, params: UpdateWidgetParams): Promise<WidgetConfig> {
|
|
53
|
+
return this.client.patch<WidgetConfig>(`/widgets/${id}`, params);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async delete(id: string): Promise<DeletedResponse> {
|
|
57
|
+
return this.client.delete<DeletedResponse>(`/widgets/${id}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async stats(id: string, days?: number): Promise<WidgetStats> {
|
|
61
|
+
return this.client.get<WidgetStats>(`/widgets/${id}/stats`, days !== undefined ? { days } : undefined);
|
|
62
|
+
}
|
|
63
|
+
}
|