@b3dotfun/sdk 0.1.68-alpha.3 → 0.1.68-alpha.5
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 +3 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +128 -11
- package/dist/cjs/anyspend/react/components/checkout/FiatCheckoutPanel.js +13 -12
- package/dist/cjs/anyspend/react/components/checkout/KycGate.d.ts +11 -0
- package/dist/cjs/anyspend/react/components/checkout/KycGate.js +181 -0
- 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.js +9 -0
- package/dist/cjs/anyspend/react/hooks/useKycStatus.d.ts +42 -0
- package/dist/cjs/anyspend/react/hooks/useKycStatus.js +113 -0
- package/dist/cjs/anyspend/services/anyspend.d.ts +3 -1
- package/dist/cjs/anyspend/services/anyspend.js +2 -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/hooks/useAuth.js +1 -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 +3 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +129 -12
- package/dist/esm/anyspend/react/components/checkout/FiatCheckoutPanel.js +13 -12
- package/dist/esm/anyspend/react/components/checkout/KycGate.d.ts +11 -0
- package/dist/esm/anyspend/react/components/checkout/KycGate.js +145 -0
- 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.js +9 -0
- package/dist/esm/anyspend/react/hooks/useKycStatus.d.ts +42 -0
- package/dist/esm/anyspend/react/hooks/useKycStatus.js +107 -0
- package/dist/esm/anyspend/services/anyspend.d.ts +3 -1
- package/dist/esm/anyspend/services/anyspend.js +2 -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/hooks/useAuth.js +2 -2
- 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 +3 -1
- package/dist/types/anyspend/react/components/checkout/KycGate.d.ts +11 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useKycStatus.d.ts +42 -0
- package/dist/types/anyspend/services/anyspend.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/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 +150 -13
- package/src/anyspend/react/components/checkout/FiatCheckoutPanel.tsx +16 -13
- package/src/anyspend/react/components/checkout/KycGate.tsx +351 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +10 -0
- package/src/anyspend/react/hooks/useKycStatus.ts +140 -0
- package/src/anyspend/services/anyspend.ts +4 -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/hooks/useAuth.ts +2 -2
- package/src/global-account/react/stores/useModalStore.ts +6 -0
- package/src/global-account/react/utils/createWagmiConfig.tsx +18 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript types for the AnySpend Platform API.
|
|
3
|
+
*/
|
|
4
|
+
export interface ListResponse<T> {
|
|
5
|
+
object: "list";
|
|
6
|
+
data: T[];
|
|
7
|
+
has_more: boolean;
|
|
8
|
+
total_count: number;
|
|
9
|
+
url: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DeletedResponse {
|
|
12
|
+
object: string;
|
|
13
|
+
id: string;
|
|
14
|
+
deleted: true;
|
|
15
|
+
}
|
|
16
|
+
export interface ActionResponse {
|
|
17
|
+
object: "action";
|
|
18
|
+
action: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface PaginationParams {
|
|
22
|
+
page?: number;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface PaymentLink {
|
|
26
|
+
object: "payment_link";
|
|
27
|
+
id: string;
|
|
28
|
+
short_code: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string | null;
|
|
32
|
+
amount: string | null;
|
|
33
|
+
min_amount: string | null;
|
|
34
|
+
max_amount: string | null;
|
|
35
|
+
suggested_amount: string | null;
|
|
36
|
+
token_address: string;
|
|
37
|
+
chain_id: number;
|
|
38
|
+
recipient_address: string;
|
|
39
|
+
product_id: string | null;
|
|
40
|
+
image_url: string | null;
|
|
41
|
+
theme_color: string | null;
|
|
42
|
+
button_text: string;
|
|
43
|
+
max_uses: number | null;
|
|
44
|
+
current_uses: number;
|
|
45
|
+
expires_at: number | null;
|
|
46
|
+
is_active: boolean;
|
|
47
|
+
form_schema: string | null;
|
|
48
|
+
shipping_options: string | null;
|
|
49
|
+
collect_shipping_address: boolean;
|
|
50
|
+
return_url: string | null;
|
|
51
|
+
return_label: string | null;
|
|
52
|
+
branding: string | null;
|
|
53
|
+
fee_on_top: boolean;
|
|
54
|
+
items?: PaymentLinkItem[];
|
|
55
|
+
created_at: number;
|
|
56
|
+
updated_at: number;
|
|
57
|
+
}
|
|
58
|
+
export interface PaymentLinkItem {
|
|
59
|
+
object: "payment_link_item";
|
|
60
|
+
id: string;
|
|
61
|
+
payment_link_id: string;
|
|
62
|
+
product_id: string | null;
|
|
63
|
+
name: string;
|
|
64
|
+
description: string | null;
|
|
65
|
+
image_url: string | null;
|
|
66
|
+
amount: string;
|
|
67
|
+
quantity: number;
|
|
68
|
+
sort_order: number;
|
|
69
|
+
created_at: number;
|
|
70
|
+
updated_at: number;
|
|
71
|
+
}
|
|
72
|
+
export interface CreatePaymentLinkParams {
|
|
73
|
+
name: string;
|
|
74
|
+
token_address: string;
|
|
75
|
+
chain_id: number;
|
|
76
|
+
recipient_address: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
amount?: string;
|
|
79
|
+
min_amount?: string;
|
|
80
|
+
max_amount?: string;
|
|
81
|
+
suggested_amount?: string;
|
|
82
|
+
product_id?: string;
|
|
83
|
+
image_url?: string;
|
|
84
|
+
theme_color?: string;
|
|
85
|
+
button_text?: string;
|
|
86
|
+
max_uses?: number;
|
|
87
|
+
expires_at?: number;
|
|
88
|
+
form_schema?: Record<string, unknown>;
|
|
89
|
+
shipping_options?: Record<string, unknown>[];
|
|
90
|
+
collect_shipping_address?: boolean;
|
|
91
|
+
return_url?: string;
|
|
92
|
+
return_label?: string;
|
|
93
|
+
branding?: Record<string, unknown>;
|
|
94
|
+
fee_on_top?: boolean;
|
|
95
|
+
items?: CreatePaymentLinkItemParams[];
|
|
96
|
+
}
|
|
97
|
+
export interface CreatePaymentLinkItemParams {
|
|
98
|
+
name: string;
|
|
99
|
+
amount: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
image_url?: string;
|
|
102
|
+
quantity?: number;
|
|
103
|
+
sort_order?: number;
|
|
104
|
+
product_id?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface UpdatePaymentLinkParams extends Partial<Omit<CreatePaymentLinkParams, "items">> {
|
|
107
|
+
is_active?: boolean;
|
|
108
|
+
items?: CreatePaymentLinkItemParams[];
|
|
109
|
+
}
|
|
110
|
+
export interface ListPaymentLinksParams extends PaginationParams {
|
|
111
|
+
search?: string;
|
|
112
|
+
active?: "true" | "false";
|
|
113
|
+
sort?: "created_at" | "updated_at" | "name" | "current_uses";
|
|
114
|
+
order?: "asc" | "desc";
|
|
115
|
+
}
|
|
116
|
+
export interface PaymentLinkStats {
|
|
117
|
+
object: "payment_link_stats";
|
|
118
|
+
payment_link_id: string;
|
|
119
|
+
summary: {
|
|
120
|
+
total_views: number;
|
|
121
|
+
total_sessions: number;
|
|
122
|
+
total_completions: number;
|
|
123
|
+
lifetime_completions: number;
|
|
124
|
+
view_to_session_rate: string;
|
|
125
|
+
session_to_completion_rate: string;
|
|
126
|
+
overall_conversion_rate: string;
|
|
127
|
+
};
|
|
128
|
+
daily: {
|
|
129
|
+
views: {
|
|
130
|
+
date: string;
|
|
131
|
+
view_count: number;
|
|
132
|
+
unique_visitors: number;
|
|
133
|
+
}[];
|
|
134
|
+
sessions: {
|
|
135
|
+
date: string;
|
|
136
|
+
sessions: number;
|
|
137
|
+
completions: number;
|
|
138
|
+
}[];
|
|
139
|
+
};
|
|
140
|
+
utm_breakdown: Record<string, unknown>[];
|
|
141
|
+
}
|
|
142
|
+
export interface Product {
|
|
143
|
+
object: "product";
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
description: string | null;
|
|
147
|
+
image_url: string | null;
|
|
148
|
+
amount: string;
|
|
149
|
+
token_address: string;
|
|
150
|
+
chain_id: number;
|
|
151
|
+
recipient_address: string | null;
|
|
152
|
+
product_type: "one_time" | "subscription" | "variable";
|
|
153
|
+
is_active: boolean;
|
|
154
|
+
metadata: Record<string, unknown> | null;
|
|
155
|
+
form_schema: string | null;
|
|
156
|
+
shipping_options: string | null;
|
|
157
|
+
created_at: number;
|
|
158
|
+
updated_at: number;
|
|
159
|
+
}
|
|
160
|
+
export interface CreateProductParams {
|
|
161
|
+
name: string;
|
|
162
|
+
amount: string;
|
|
163
|
+
token_address: string;
|
|
164
|
+
chain_id: number;
|
|
165
|
+
description?: string;
|
|
166
|
+
image_url?: string;
|
|
167
|
+
recipient_address?: string;
|
|
168
|
+
product_type?: "one_time" | "subscription" | "variable";
|
|
169
|
+
metadata?: Record<string, unknown>;
|
|
170
|
+
form_schema?: Record<string, unknown>;
|
|
171
|
+
shipping_options?: Record<string, unknown>[];
|
|
172
|
+
}
|
|
173
|
+
export interface UpdateProductParams extends Partial<CreateProductParams> {
|
|
174
|
+
is_active?: boolean;
|
|
175
|
+
}
|
|
176
|
+
export interface Customer {
|
|
177
|
+
object: "customer";
|
|
178
|
+
id: string;
|
|
179
|
+
wallet_address: string;
|
|
180
|
+
name: string | null;
|
|
181
|
+
email: string | null;
|
|
182
|
+
metadata: Record<string, unknown> | null;
|
|
183
|
+
total_paid: string | null;
|
|
184
|
+
transaction_count: number;
|
|
185
|
+
first_payment_at: number | null;
|
|
186
|
+
last_payment_at: number | null;
|
|
187
|
+
created_at: number;
|
|
188
|
+
updated_at: number;
|
|
189
|
+
}
|
|
190
|
+
export interface CreateCustomerParams {
|
|
191
|
+
wallet_address: string;
|
|
192
|
+
name?: string;
|
|
193
|
+
email?: string;
|
|
194
|
+
metadata?: Record<string, unknown>;
|
|
195
|
+
}
|
|
196
|
+
export interface UpdateCustomerParams {
|
|
197
|
+
name?: string;
|
|
198
|
+
email?: string;
|
|
199
|
+
metadata?: Record<string, unknown>;
|
|
200
|
+
}
|
|
201
|
+
export interface Transaction {
|
|
202
|
+
object: "transaction";
|
|
203
|
+
id: string;
|
|
204
|
+
tx_hash: string;
|
|
205
|
+
chain_id: number;
|
|
206
|
+
from_address: string;
|
|
207
|
+
to_address: string;
|
|
208
|
+
token_address: string;
|
|
209
|
+
amount: string;
|
|
210
|
+
amount_usd: string | null;
|
|
211
|
+
status: "pending" | "confirming" | "completed" | "failed";
|
|
212
|
+
payment_link_id: string | null;
|
|
213
|
+
customer_id: string | null;
|
|
214
|
+
created_at: number;
|
|
215
|
+
updated_at: number;
|
|
216
|
+
}
|
|
217
|
+
export interface TransactionStats {
|
|
218
|
+
object: "transaction_stats";
|
|
219
|
+
totalTransactions: number;
|
|
220
|
+
completedTransactions: number;
|
|
221
|
+
totalVolumeUsd: string;
|
|
222
|
+
last24h: {
|
|
223
|
+
transactions: number;
|
|
224
|
+
volumeUsd: string;
|
|
225
|
+
};
|
|
226
|
+
statusBreakdown: Record<string, number>;
|
|
227
|
+
}
|
|
228
|
+
export interface ListTransactionsParams extends PaginationParams {
|
|
229
|
+
status?: string;
|
|
230
|
+
customer_id?: string;
|
|
231
|
+
payment_link_id?: string;
|
|
232
|
+
from?: number;
|
|
233
|
+
to?: number;
|
|
234
|
+
}
|
|
235
|
+
export interface CheckoutSession {
|
|
236
|
+
object: "checkout_session";
|
|
237
|
+
id: string;
|
|
238
|
+
url: string | null;
|
|
239
|
+
status: "open" | "processing" | "completed" | "expired" | "failed";
|
|
240
|
+
payment_link_id: string | null;
|
|
241
|
+
product_id: string | null;
|
|
242
|
+
amount: string | null;
|
|
243
|
+
token_address: string;
|
|
244
|
+
chain_id: number;
|
|
245
|
+
recipient_address: string;
|
|
246
|
+
success_url: string | null;
|
|
247
|
+
cancel_url: string | null;
|
|
248
|
+
client_reference_id: string | null;
|
|
249
|
+
/** The API returns metadata as a serialized JSON string. Use JSON.parse() to recover the original object. */
|
|
250
|
+
metadata: string | null;
|
|
251
|
+
customer_email: string | null;
|
|
252
|
+
customer_name: string | null;
|
|
253
|
+
tx_hash: string | null;
|
|
254
|
+
completed_at: number | null;
|
|
255
|
+
expires_at: number;
|
|
256
|
+
created_at: number;
|
|
257
|
+
updated_at: number;
|
|
258
|
+
}
|
|
259
|
+
export interface CreateCheckoutSessionParams {
|
|
260
|
+
payment_link_id?: string;
|
|
261
|
+
token_address?: string;
|
|
262
|
+
chain_id?: number;
|
|
263
|
+
recipient_address?: string;
|
|
264
|
+
amount?: string;
|
|
265
|
+
product_id?: string;
|
|
266
|
+
success_url?: string;
|
|
267
|
+
cancel_url?: string;
|
|
268
|
+
client_reference_id?: string;
|
|
269
|
+
metadata?: Record<string, unknown>;
|
|
270
|
+
customer_email?: string;
|
|
271
|
+
customer_name?: string;
|
|
272
|
+
expires_in?: number;
|
|
273
|
+
utm_source?: string;
|
|
274
|
+
utm_medium?: string;
|
|
275
|
+
utm_campaign?: string;
|
|
276
|
+
}
|
|
277
|
+
export interface Webhook {
|
|
278
|
+
object: "webhook";
|
|
279
|
+
id: string;
|
|
280
|
+
url: string;
|
|
281
|
+
events: string[];
|
|
282
|
+
secret?: string;
|
|
283
|
+
is_active: boolean;
|
|
284
|
+
success_count: number;
|
|
285
|
+
failure_count: number;
|
|
286
|
+
last_triggered_at: number | null;
|
|
287
|
+
created_at: number;
|
|
288
|
+
updated_at: number;
|
|
289
|
+
}
|
|
290
|
+
export interface CreateWebhookParams {
|
|
291
|
+
url: string;
|
|
292
|
+
events: string[];
|
|
293
|
+
description?: string;
|
|
294
|
+
}
|
|
295
|
+
export interface UpdateWebhookParams {
|
|
296
|
+
url?: string;
|
|
297
|
+
events?: string[];
|
|
298
|
+
is_active?: boolean;
|
|
299
|
+
}
|
|
300
|
+
export interface DiscountCode {
|
|
301
|
+
object: "discount_code";
|
|
302
|
+
id: string;
|
|
303
|
+
code: string;
|
|
304
|
+
type: "percentage" | "fixed";
|
|
305
|
+
value: string;
|
|
306
|
+
payment_link_id: string | null;
|
|
307
|
+
max_uses: number | null;
|
|
308
|
+
current_uses: number;
|
|
309
|
+
min_order_amount: string | null;
|
|
310
|
+
expires_at: number | null;
|
|
311
|
+
is_active: boolean;
|
|
312
|
+
created_at: number;
|
|
313
|
+
updated_at: number;
|
|
314
|
+
}
|
|
315
|
+
export interface CreateDiscountCodeParams {
|
|
316
|
+
code: string;
|
|
317
|
+
type: "percentage" | "fixed";
|
|
318
|
+
value: string;
|
|
319
|
+
payment_link_id?: string;
|
|
320
|
+
max_uses?: number;
|
|
321
|
+
min_order_amount?: string;
|
|
322
|
+
expires_at?: number;
|
|
323
|
+
}
|
|
324
|
+
export interface BatchCreateDiscountCodesParams {
|
|
325
|
+
codes: string[];
|
|
326
|
+
type: "percentage" | "fixed";
|
|
327
|
+
value: string;
|
|
328
|
+
payment_link_id?: string;
|
|
329
|
+
max_uses?: number;
|
|
330
|
+
min_order_amount?: string;
|
|
331
|
+
expires_at?: number;
|
|
332
|
+
}
|
|
333
|
+
export interface NotificationSettings {
|
|
334
|
+
object: "notification_settings";
|
|
335
|
+
id: string;
|
|
336
|
+
email_enabled: boolean;
|
|
337
|
+
email_address: string | null;
|
|
338
|
+
telegram_enabled: boolean;
|
|
339
|
+
telegram_chat_id: string | null;
|
|
340
|
+
enabled_events: string[];
|
|
341
|
+
}
|
|
342
|
+
export interface UpdateNotificationSettingsParams {
|
|
343
|
+
email_enabled?: boolean;
|
|
344
|
+
email_address?: string;
|
|
345
|
+
telegram_enabled?: boolean;
|
|
346
|
+
enabled_events?: string[];
|
|
347
|
+
}
|
|
348
|
+
export interface WidgetConfig {
|
|
349
|
+
object: "widget_config";
|
|
350
|
+
id: string;
|
|
351
|
+
short_code: string;
|
|
352
|
+
name: string;
|
|
353
|
+
description: string | null;
|
|
354
|
+
widget_type: string;
|
|
355
|
+
config: string;
|
|
356
|
+
theme: string;
|
|
357
|
+
is_active: boolean;
|
|
358
|
+
current_views: number;
|
|
359
|
+
created_at: number;
|
|
360
|
+
updated_at: number;
|
|
361
|
+
}
|
|
362
|
+
export interface CreateWidgetParams {
|
|
363
|
+
name: string;
|
|
364
|
+
widget_type: "swap" | "checkout" | "nft" | "deposit";
|
|
365
|
+
config: Record<string, unknown>;
|
|
366
|
+
description?: string;
|
|
367
|
+
theme?: Record<string, unknown>;
|
|
368
|
+
}
|
|
369
|
+
export interface Organization {
|
|
370
|
+
object: "organization";
|
|
371
|
+
id: string;
|
|
372
|
+
name: string;
|
|
373
|
+
slug: string;
|
|
374
|
+
description: string | null;
|
|
375
|
+
logo_url: string | null;
|
|
376
|
+
website_url: string | null;
|
|
377
|
+
default_recipient_address: string | null;
|
|
378
|
+
default_chain_id: number | null;
|
|
379
|
+
default_token_address: string | null;
|
|
380
|
+
}
|
|
381
|
+
export interface AnalyticsOverview {
|
|
382
|
+
object: "analytics_overview";
|
|
383
|
+
period: string;
|
|
384
|
+
revenue: {
|
|
385
|
+
period_usd: string;
|
|
386
|
+
period_transactions: number;
|
|
387
|
+
all_time_usd: string;
|
|
388
|
+
all_time_transactions: number;
|
|
389
|
+
};
|
|
390
|
+
customers: {
|
|
391
|
+
total: number;
|
|
392
|
+
new_in_period: number;
|
|
393
|
+
};
|
|
394
|
+
payment_links: {
|
|
395
|
+
total: number;
|
|
396
|
+
active: number;
|
|
397
|
+
};
|
|
398
|
+
conversion_rate: string;
|
|
399
|
+
daily: {
|
|
400
|
+
date: string;
|
|
401
|
+
transactions: number;
|
|
402
|
+
revenue_usd: number;
|
|
403
|
+
}[];
|
|
404
|
+
top_payment_links: Record<string, unknown>[];
|
|
405
|
+
top_tokens: Record<string, unknown>[];
|
|
406
|
+
top_chains: Record<string, unknown>[];
|
|
407
|
+
}
|
|
408
|
+
export interface ApiEvent {
|
|
409
|
+
object: "event";
|
|
410
|
+
id: string;
|
|
411
|
+
event_type: string;
|
|
412
|
+
resource_type: string;
|
|
413
|
+
resource_id: string | null;
|
|
414
|
+
ip_address: string | null;
|
|
415
|
+
request_method: string;
|
|
416
|
+
request_path: string;
|
|
417
|
+
status_code: number;
|
|
418
|
+
created_at: number;
|
|
419
|
+
}
|
|
420
|
+
export interface QuickPayParams {
|
|
421
|
+
recipient_address: string;
|
|
422
|
+
amount?: string;
|
|
423
|
+
token_address?: string;
|
|
424
|
+
chain_id?: number;
|
|
425
|
+
name?: string;
|
|
426
|
+
description?: string;
|
|
427
|
+
expires_in?: number;
|
|
428
|
+
}
|
|
429
|
+
export interface ApiKey {
|
|
430
|
+
object: "api_key";
|
|
431
|
+
id: string;
|
|
432
|
+
name: string;
|
|
433
|
+
prefix: string;
|
|
434
|
+
permissions: string[];
|
|
435
|
+
last_used_at: number | null;
|
|
436
|
+
created_at: number;
|
|
437
|
+
updated_at: number;
|
|
438
|
+
}
|
|
439
|
+
export interface WebhookDelivery {
|
|
440
|
+
object: "webhook_delivery";
|
|
441
|
+
id: string;
|
|
442
|
+
webhook_id: string;
|
|
443
|
+
event_type: string;
|
|
444
|
+
url: string;
|
|
445
|
+
status: "pending" | "success" | "failed";
|
|
446
|
+
status_code: number | null;
|
|
447
|
+
response_body: string | null;
|
|
448
|
+
error_message: string | null;
|
|
449
|
+
attempted_at: number;
|
|
450
|
+
created_at: number;
|
|
451
|
+
}
|
|
452
|
+
export interface ValidateDiscountResult {
|
|
453
|
+
object: "discount_validation";
|
|
454
|
+
valid: boolean;
|
|
455
|
+
discount_code?: DiscountCode;
|
|
456
|
+
discount_amount?: string;
|
|
457
|
+
final_amount?: string;
|
|
458
|
+
reason?: string;
|
|
459
|
+
}
|
|
460
|
+
export interface BatchCreateResult {
|
|
461
|
+
object: "batch_result";
|
|
462
|
+
created: DiscountCode[];
|
|
463
|
+
errors: {
|
|
464
|
+
code: string;
|
|
465
|
+
error: string;
|
|
466
|
+
}[];
|
|
467
|
+
}
|
|
468
|
+
export interface ExportTransactionsParams {
|
|
469
|
+
format?: "csv" | "json";
|
|
470
|
+
status?: string;
|
|
471
|
+
from?: number;
|
|
472
|
+
to?: number;
|
|
473
|
+
}
|
|
474
|
+
export interface ExportCustomersParams {
|
|
475
|
+
format?: "csv" | "json";
|
|
476
|
+
from?: number;
|
|
477
|
+
to?: number;
|
|
478
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-pagination async iterator for list endpoints.
|
|
3
|
+
*/
|
|
4
|
+
import type { ListResponse } from "../types";
|
|
5
|
+
export interface AutoPaginateOptions {
|
|
6
|
+
startPage?: number;
|
|
7
|
+
limit?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates an async iterator that automatically paginates through all results.
|
|
11
|
+
*/
|
|
12
|
+
export declare function autoPaginate<T>(fetchPage: (page: number, limit: number) => Promise<ListResponse<T>>, options?: AutoPaginateOptions): AsyncGenerator<T, void, undefined>;
|
|
@@ -18,7 +18,9 @@ export declare enum PanelView {
|
|
|
18
18
|
FIAT_PAYMENT_METHOD = 7,
|
|
19
19
|
POINTS_DETAIL = 8,
|
|
20
20
|
FEE_DETAIL = 9,
|
|
21
|
-
DIRECT_TRANSFER_SUCCESS = 10
|
|
21
|
+
DIRECT_TRANSFER_SUCCESS = 10,
|
|
22
|
+
FIAT_KYC = 11,
|
|
23
|
+
FIAT_AUTH = 12
|
|
22
24
|
}
|
|
23
25
|
export declare function AnySpend(props: {
|
|
24
26
|
mode?: "page" | "modal";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnySpendCheckoutClasses } from "./AnySpendCheckout";
|
|
2
|
+
interface KycGateProps {
|
|
3
|
+
themeColor?: string;
|
|
4
|
+
classes?: AnySpendCheckoutClasses;
|
|
5
|
+
/** Only fetch KYC status (and prompt wallet signature) when true. */
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** Called when KYC status is resolved (approved or not required) */
|
|
8
|
+
onStatusResolved: (approved: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function KycGate({ themeColor, classes, enabled, onStatusResolved }: KycGateProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface KycStatusResponse {
|
|
2
|
+
kycRequired: boolean;
|
|
3
|
+
status: "not_verified" | "pending" | "completed" | "approved" | "declined" | "needs_review" | "expired";
|
|
4
|
+
inquiry?: {
|
|
5
|
+
inquiryId: string;
|
|
6
|
+
sessionToken: string;
|
|
7
|
+
};
|
|
8
|
+
config?: {
|
|
9
|
+
templateId: string;
|
|
10
|
+
environment: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface KycInquiryResponse {
|
|
14
|
+
inquiryId: string;
|
|
15
|
+
sessionToken: string;
|
|
16
|
+
}
|
|
17
|
+
interface KycVerifyResponse {
|
|
18
|
+
status: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns a function that builds the wallet-signature auth headers.
|
|
22
|
+
* Caches signatures for 4 minutes (server allows 5-minute window).
|
|
23
|
+
*/
|
|
24
|
+
export declare function useWalletAuthHeaders(): {
|
|
25
|
+
address: `0x${string}` | undefined;
|
|
26
|
+
getHeaders: () => Promise<Record<string, string>>;
|
|
27
|
+
};
|
|
28
|
+
export declare function useKycStatus(enabled?: boolean): {
|
|
29
|
+
kycStatus: KycStatusResponse | null;
|
|
30
|
+
isLoadingKycStatus: boolean;
|
|
31
|
+
kycStatusError: Error | null;
|
|
32
|
+
refetchKycStatus: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<KycStatusResponse, Error>>;
|
|
33
|
+
};
|
|
34
|
+
export declare function useCreateKycInquiry(): {
|
|
35
|
+
createInquiry: import("@tanstack/react-query").UseMutateAsyncFunction<KycInquiryResponse, Error, void, unknown>;
|
|
36
|
+
isCreatingInquiry: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare function useVerifyKyc(): {
|
|
39
|
+
verifyKyc: import("@tanstack/react-query").UseMutateAsyncFunction<KycVerifyResponse, Error, string, unknown>;
|
|
40
|
+
isVerifying: boolean;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -6,7 +6,7 @@ export declare const anyspendService: {
|
|
|
6
6
|
getTokenList: (chainId: number, query: string) => Promise<components["schemas"]["Token"][]>;
|
|
7
7
|
getToken: (chainId: number, tokenAddress: string) => Promise<components["schemas"]["Token"]>;
|
|
8
8
|
getQuote: (req: GetQuoteRequest, partnerId?: string) => Promise<GetQuoteResponse>;
|
|
9
|
-
createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, callbackMetadata, feeOnTop, }: {
|
|
9
|
+
createOrder: ({ recipientAddress, type, srcChain, dstChain, srcTokenAddress, dstTokenAddress, srcAmount, payload, onramp, metadata, creatorAddress, partnerId, clientReferenceId, visitorData, callbackMetadata, feeOnTop, kycWalletHeaders, }: {
|
|
10
10
|
recipientAddress: string;
|
|
11
11
|
type: string;
|
|
12
12
|
srcChain: number;
|
|
@@ -23,6 +23,8 @@ export declare const anyspendService: {
|
|
|
23
23
|
visitorData?: VisitorData;
|
|
24
24
|
callbackMetadata?: Record<string, unknown>;
|
|
25
25
|
feeOnTop?: boolean;
|
|
26
|
+
/** Wallet signature auth headers for KYC lookup (stripe-web2 orders only). */
|
|
27
|
+
kycWalletHeaders?: Record<string, string>;
|
|
26
28
|
}) => Promise<{
|
|
27
29
|
success: boolean;
|
|
28
30
|
message: string;
|
|
@@ -657,6 +657,10 @@ interface ModalState {
|
|
|
657
657
|
setLinkingState: (isLinking: boolean, method?: string | null) => void;
|
|
658
658
|
/** Function to update closable property of current content without adding to history */
|
|
659
659
|
setClosable: (closable: boolean) => void;
|
|
660
|
+
/** Whether a third-party iframe (e.g. Persona KYC) is currently active over the modal */
|
|
661
|
+
personaActive: boolean;
|
|
662
|
+
/** Function to mark a third-party iframe as active/inactive */
|
|
663
|
+
setPersonaActive: (active: boolean) => void;
|
|
660
664
|
}
|
|
661
665
|
/**
|
|
662
666
|
* Zustand store for managing modal state
|
|
@@ -25,3 +25,21 @@ export declare function createWagmiConfig(options: CreateWagmiConfigOptions): im
|
|
|
25
25
|
}, {
|
|
26
26
|
"thirdweb:lastChainId": number;
|
|
27
27
|
}>)[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a cached wagmi config for the given partnerId.
|
|
30
|
+
* Use this instead of calling createWagmiConfig() directly inside React components or hooks
|
|
31
|
+
* to avoid registering duplicate EventEmitter listeners on every render.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCachedWagmiConfig(options: CreateWagmiConfigOptions): import("wagmi").Config<readonly [import("viem").Chain, ...import("viem").Chain[]], {
|
|
34
|
+
[k: string]: import("viem").HttpTransport<undefined, false>;
|
|
35
|
+
}, (CreateConnectorFn | CreateConnectorFn<import("thirdweb/dist/types/adapters/eip1193").EIP1193Provider | undefined, {
|
|
36
|
+
connect<withCapabilities extends boolean = false>(parameters?: import("@thirdweb-dev/wagmi-adapter").ConnectionOptions<withCapabilities> | undefined): Promise<{
|
|
37
|
+
accounts: withCapabilities extends true ? readonly {
|
|
38
|
+
address: `0x${string}`;
|
|
39
|
+
capabilities: Record<string, unknown>;
|
|
40
|
+
}[] : readonly `0x${string}`[];
|
|
41
|
+
chainId: number;
|
|
42
|
+
}>;
|
|
43
|
+
}, {
|
|
44
|
+
"thirdweb:lastChainId": number;
|
|
45
|
+
}>)[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.1.68-alpha.
|
|
3
|
+
"version": "0.1.68-alpha.5",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -55,6 +55,11 @@
|
|
|
55
55
|
"import": "./dist/esm/anyspend/constants.js",
|
|
56
56
|
"require": "./dist/cjs/anyspend/constants.js"
|
|
57
57
|
},
|
|
58
|
+
"./anyspend/platform": {
|
|
59
|
+
"types": "./dist/types/anyspend/platform/index.d.ts",
|
|
60
|
+
"import": "./dist/esm/anyspend/platform/index.js",
|
|
61
|
+
"require": "./dist/cjs/anyspend/platform/index.js"
|
|
62
|
+
},
|
|
58
63
|
"./anyspend/services/*": {
|
|
59
64
|
"types": "./dist/types/anyspend/services/*.d.ts",
|
|
60
65
|
"import": "./dist/esm/anyspend/services/*.js",
|
|
@@ -324,6 +329,7 @@
|
|
|
324
329
|
"js-cookie": "3.0.5",
|
|
325
330
|
"lucide-react": "0.424.0",
|
|
326
331
|
"motion": "^12.23.11",
|
|
332
|
+
"persona": "^5.7.0",
|
|
327
333
|
"qrcode.react": "4.2.0",
|
|
328
334
|
"react-easy-crop": "^5.5.3",
|
|
329
335
|
"react-intersection-observer": "9.16.0",
|