@diviswap/sdk 1.7.11 → 1.7.12
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/cli/index.js +1 -1
- package/dist/cli/templates/nextjs-app/api-hooks.ts.hbs +4 -4
- package/dist/cli/templates/nextjs-app/api-route.ts.hbs +2 -2
- package/dist/cli/templates/nextjs-app/client.ts.hbs +6 -6
- package/dist/cli/templates/nextjs-app/dashboard-hooks.ts.hbs +3 -3
- package/dist/cli/templates/nextjs-app/example-page.tsx.hbs +4 -4
- package/dist/cli/templates/nextjs-app/kyc-hooks.ts.hbs +1 -1
- package/dist/cli/templates/nextjs-app/kyc-wizard.tsx.hbs +4 -4
- package/dist/cli/templates/nextjs-app/provider.tsx.hbs +6 -6
- package/dist/cli/templates/react/api-client-wrapper.ts.hbs +3 -3
- package/package.json +1 -1
- package/src/cli/templates/nextjs-app/api-hooks.ts.hbs +4 -4
- package/src/cli/templates/nextjs-app/api-route.ts.hbs +2 -2
- package/src/cli/templates/nextjs-app/client.ts.hbs +6 -6
- package/src/cli/templates/nextjs-app/dashboard-hooks.ts.hbs +3 -3
- package/src/cli/templates/nextjs-app/example-page.tsx.hbs +4 -4
- package/src/cli/templates/nextjs-app/kyc-hooks.ts.hbs +1 -1
- package/src/cli/templates/nextjs-app/kyc-wizard.tsx.hbs +4 -4
- package/src/cli/templates/nextjs-app/provider.tsx.hbs +6 -6
- package/src/cli/templates/react/api-client-wrapper.ts.hbs +3 -3
package/dist/cli/index.js
CHANGED
|
@@ -106,7 +106,7 @@ export function useTransactions() {
|
|
|
106
106
|
...filters
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
const response = await fetch(`/api/diviswap
|
|
109
|
+
const response = await fetch(`/api/diviswap?\${queryParams}`);
|
|
110
110
|
if (!response.ok) throw new Error('Failed to fetch transactions');
|
|
111
111
|
|
|
112
112
|
const data = await response.json();
|
|
@@ -180,7 +180,7 @@ export function usePayees() {
|
|
|
180
180
|
setError(null);
|
|
181
181
|
|
|
182
182
|
try {
|
|
183
|
-
const response = await fetch(`/api/diviswap?resource=payees&customerId
|
|
183
|
+
const response = await fetch(`/api/diviswap?resource=payees&customerId=\${customerId}&customerEmail=\${customerEmail}`);
|
|
184
184
|
if (!response.ok) throw new Error('Failed to fetch payees');
|
|
185
185
|
|
|
186
186
|
const data = await response.json();
|
|
@@ -237,7 +237,7 @@ export function usePayees() {
|
|
|
237
237
|
setError(null);
|
|
238
238
|
|
|
239
239
|
try {
|
|
240
|
-
const response = await fetch(`/api/diviswap?resource=payee&id
|
|
240
|
+
const response = await fetch(`/api/diviswap?resource=payee&id=\${id}&customerId=\${customerId}&customerEmail=\${customerEmail}`, {
|
|
241
241
|
method: 'DELETE'
|
|
242
242
|
});
|
|
243
243
|
|
|
@@ -286,7 +286,7 @@ export function useKYC() {
|
|
|
286
286
|
setError(null);
|
|
287
287
|
|
|
288
288
|
try {
|
|
289
|
-
const response = await fetch(`/api/diviswap?resource=kycStatus&customerId
|
|
289
|
+
const response = await fetch(`/api/diviswap?resource=kycStatus&customerId=\${customerId}&customerEmail=\${customerEmail}`);
|
|
290
290
|
if (!response.ok) throw new Error('Failed to fetch KYC status');
|
|
291
291
|
|
|
292
292
|
const data = await response.json();
|
|
@@ -157,7 +157,7 @@ const postHandlers: Record<string, ActionHandler> = {
|
|
|
157
157
|
if (params.routingNumber && params.routingNumber.includes('/')) {
|
|
158
158
|
const expiryParts = params.routingNumber.split('/');
|
|
159
159
|
expirationMonth = expiryParts[0];
|
|
160
|
-
expirationYear = expiryParts[1] ? `20
|
|
160
|
+
expirationYear = expiryParts[1] ? `20\${expiryParts[1]}` : '2025';
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
const debitCardPayload = {
|
|
@@ -230,7 +230,7 @@ const postHandlers: Record<string, ActionHandler> = {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
// Clean up the payload - remove undefined/null values and empty strings for optional fields
|
|
233
|
-
const street = address.addressLine1 + (address.addressLine2 && address.addressLine2.trim() ? `
|
|
233
|
+
const street = address.addressLine1 + (address.addressLine2 && address.addressLine2.trim() ? ` \${address.addressLine2.trim()}` : '');
|
|
234
234
|
|
|
235
235
|
const kycPayload = {
|
|
236
236
|
firstName: personalInfo.firstName,
|
|
@@ -8,7 +8,7 @@ export class DiviswapClient {
|
|
|
8
8
|
endpoint: string,
|
|
9
9
|
options: RequestInit = {}
|
|
10
10
|
): Promise<T> {
|
|
11
|
-
const response = await fetch(
|
|
11
|
+
const response = await fetch(`\${this.baseUrl}\${endpoint}`, {
|
|
12
12
|
...options,
|
|
13
13
|
headers: {
|
|
14
14
|
'Content-Type': 'application/json',
|
|
@@ -41,7 +41,7 @@ export class DiviswapClient {
|
|
|
41
41
|
|
|
42
42
|
async getCustomerStatus(customerId: string, customerEmail: string) {
|
|
43
43
|
try {
|
|
44
|
-
return await this.request(`?resource=customerStatus&customerId
|
|
44
|
+
return await this.request(`?resource=customerStatus&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
45
45
|
} catch {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
@@ -72,16 +72,16 @@ export class DiviswapClient {
|
|
|
72
72
|
...(params.type && { type: params.type }),
|
|
73
73
|
}),
|
|
74
74
|
});
|
|
75
|
-
return this.request(
|
|
75
|
+
return this.request(`?\${searchParams}`);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
async getTransaction(id: string) {
|
|
79
|
-
return this.request(`?resource=transaction&id
|
|
79
|
+
return this.request(`?resource=transaction&id=\${id}`);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Payee methods
|
|
83
83
|
async getPayees(customerId: string, customerEmail: string) {
|
|
84
|
-
return this.request(`?resource=payees&customerId
|
|
84
|
+
return this.request(`?resource=payees&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
async createPayee(data: any) {
|
|
@@ -92,7 +92,7 @@ export class DiviswapClient {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
async deletePayee(id: string, customerId: string, customerEmail: string) {
|
|
95
|
-
return this.request(`?resource=payee&id
|
|
95
|
+
return this.request(`?resource=payee&id=\${id}&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`, {
|
|
96
96
|
method: 'DELETE',
|
|
97
97
|
});
|
|
98
98
|
}
|
|
@@ -15,14 +15,14 @@ export function use{{prefix}}Dashboard() {
|
|
|
15
15
|
customerEmail,
|
|
16
16
|
...params
|
|
17
17
|
});
|
|
18
|
-
const response = await fetch(`/api/diviswap
|
|
18
|
+
const response = await fetch(`/api/diviswap?\${queryParams}`);
|
|
19
19
|
if (!response.ok) throw new Error('Failed to fetch transactions');
|
|
20
20
|
return response.json();
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const getPayees = async () => {
|
|
24
24
|
if (!isAuthenticated || !customerId) return [];
|
|
25
|
-
const response = await fetch(`/api/diviswap?resource=payees&customerId
|
|
25
|
+
const response = await fetch(`/api/diviswap?resource=payees&customerId=\${customerId}&customerEmail=\${customerEmail}`);
|
|
26
26
|
if (!response.ok) throw new Error('Failed to fetch payees');
|
|
27
27
|
return response.json();
|
|
28
28
|
};
|
|
@@ -36,7 +36,7 @@ export function use{{prefix}}Dashboard() {
|
|
|
36
36
|
...(params?.chain_id && { chain_id: params.chain_id.toString() }),
|
|
37
37
|
...(params?.is_default !== undefined && { is_default: params.is_default.toString() })
|
|
38
38
|
});
|
|
39
|
-
const response = await fetch(`/api/diviswap
|
|
39
|
+
const response = await fetch(`/api/diviswap?\${queryParams}`);
|
|
40
40
|
if (!response.ok) throw new Error('Failed to fetch addresses');
|
|
41
41
|
return response.json();
|
|
42
42
|
};
|
|
@@ -20,7 +20,7 @@ export default function DiviswapDemo() {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const handleKYCError = (error: Error) => {
|
|
23
|
-
alert(`KYC Error:
|
|
23
|
+
alert(`KYC Error: \${error.message}`);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
return (
|
|
@@ -60,7 +60,7 @@ export default function DiviswapDemo() {
|
|
|
60
60
|
<div className="flex space-x-1 mb-8">
|
|
61
61
|
<button
|
|
62
62
|
onClick={() => setCurrentDemo('kyc-inline')}
|
|
63
|
-
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors
|
|
63
|
+
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors \${
|
|
64
64
|
currentDemo === 'kyc-inline'
|
|
65
65
|
? 'bg-indigo-100 text-indigo-700 border-2 border-indigo-200'
|
|
66
66
|
: 'text-gray-500 hover:text-gray-700 border-2 border-transparent'
|
|
@@ -70,7 +70,7 @@ export default function DiviswapDemo() {
|
|
|
70
70
|
</button>
|
|
71
71
|
<button
|
|
72
72
|
onClick={() => setCurrentDemo('kyc-modal')}
|
|
73
|
-
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors
|
|
73
|
+
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors \${
|
|
74
74
|
currentDemo === 'kyc-modal'
|
|
75
75
|
? 'bg-indigo-100 text-indigo-700 border-2 border-indigo-200'
|
|
76
76
|
: 'text-gray-500 hover:text-gray-700 border-2 border-transparent'
|
|
@@ -80,7 +80,7 @@ export default function DiviswapDemo() {
|
|
|
80
80
|
</button>
|
|
81
81
|
<button
|
|
82
82
|
onClick={() => setCurrentDemo('features')}
|
|
83
|
-
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors
|
|
83
|
+
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors \${
|
|
84
84
|
currentDemo === 'features'
|
|
85
85
|
? 'bg-indigo-100 text-indigo-700 border-2 border-indigo-200'
|
|
86
86
|
: 'text-gray-500 hover:text-gray-700 border-2 border-transparent'
|
|
@@ -29,7 +29,7 @@ export function use{{prefix}}KYC() {
|
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
// Format date of birth
|
|
32
|
-
const dateOfBirth =
|
|
32
|
+
const dateOfBirth = `\${formData.dobYear}-\${formData.dobMonth.padStart(2, '0')}-\${formData.dobDay.padStart(2, '0')}`;
|
|
33
33
|
|
|
34
34
|
// Prepare KYC data
|
|
35
35
|
const kycData = {
|
|
@@ -82,7 +82,7 @@ export function LiberexKYC({
|
|
|
82
82
|
setIsSubmitting(true);
|
|
83
83
|
try {
|
|
84
84
|
// Format date of birth
|
|
85
|
-
const dateOfBirth =
|
|
85
|
+
const dateOfBirth = `\${formData.dobYear}-\${formData.dobMonth.padStart(2, '0')}-\${formData.dobDay.padStart(2, '0')}`;
|
|
86
86
|
|
|
87
87
|
// Prepare KYC data
|
|
88
88
|
const kycData = {
|
|
@@ -170,7 +170,7 @@ export function LiberexKYC({
|
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
return (
|
|
173
|
-
<div className={`diviswap-kyc-container
|
|
173
|
+
<div className={`diviswap-kyc-container \${className}`} style={containerStyle}>
|
|
174
174
|
{/* Progress Bar */}
|
|
175
175
|
{currentStep !== 'intro' && currentStep !== 'success' && (
|
|
176
176
|
<div className="progress-container">
|
|
@@ -178,7 +178,7 @@ export function LiberexKYC({
|
|
|
178
178
|
<div
|
|
179
179
|
className="progress-fill"
|
|
180
180
|
style={{
|
|
181
|
-
width:
|
|
181
|
+
width: `\${progressPercentage}%`,
|
|
182
182
|
backgroundColor: themeConfig.primaryColor
|
|
183
183
|
}}
|
|
184
184
|
/>
|
|
@@ -620,7 +620,7 @@ function ReviewStep({ formData, onSubmit, onPrev, isSubmitting, theme }: any) {
|
|
|
620
620
|
<span>Address:</span>
|
|
621
621
|
<span>
|
|
622
622
|
{formData.addressLine1}
|
|
623
|
-
{formData.addressLine2 && `,
|
|
623
|
+
{formData.addressLine2 && `, \${formData.addressLine2}`}
|
|
624
624
|
</span>
|
|
625
625
|
</div>
|
|
626
626
|
<div className="review-item">
|
|
@@ -73,7 +73,7 @@ class DiviswapClient {
|
|
|
73
73
|
endpoint: string,
|
|
74
74
|
options: RequestInit = {}
|
|
75
75
|
): Promise<T> {
|
|
76
|
-
const response = await fetch(
|
|
76
|
+
const response = await fetch(`\${this.baseUrl}\${endpoint}`, {
|
|
77
77
|
...options,
|
|
78
78
|
headers: {
|
|
79
79
|
'Content-Type': 'application/json',
|
|
@@ -106,7 +106,7 @@ class DiviswapClient {
|
|
|
106
106
|
|
|
107
107
|
async getCustomerStatus(customerId: string, customerEmail: string) {
|
|
108
108
|
try {
|
|
109
|
-
return await this.request(`?resource=customerStatus&customerId
|
|
109
|
+
return await this.request(`?resource=customerStatus&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
110
110
|
} catch {
|
|
111
111
|
return null;
|
|
112
112
|
}
|
|
@@ -132,16 +132,16 @@ class DiviswapClient {
|
|
|
132
132
|
...(params.type && { type: params.type }),
|
|
133
133
|
}),
|
|
134
134
|
});
|
|
135
|
-
return this.request(
|
|
135
|
+
return this.request(`?\${searchParams}`);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
async getTransaction(id: string) {
|
|
139
|
-
return this.request(`?resource=transaction&id
|
|
139
|
+
return this.request(`?resource=transaction&id=\${id}`);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
// Payee methods
|
|
143
143
|
async getPayees(customerId: string, customerEmail: string) {
|
|
144
|
-
return this.request(`?resource=payees&customerId
|
|
144
|
+
return this.request(`?resource=payees&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
async createPayee(data: any) {
|
|
@@ -152,7 +152,7 @@ class DiviswapClient {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
async deletePayee(id: string, customerId: string, customerEmail: string) {
|
|
155
|
-
return this.request(`?resource=payee&id
|
|
155
|
+
return this.request(`?resource=payee&id=\${id}&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`, {
|
|
156
156
|
method: 'DELETE',
|
|
157
157
|
});
|
|
158
158
|
}
|
|
@@ -18,10 +18,10 @@ class ApiClient {
|
|
|
18
18
|
private async request<T = any>(endpoint: string, options: ApiOptions = {}): Promise<T> {
|
|
19
19
|
const { params, ...fetchOptions } = options;
|
|
20
20
|
|
|
21
|
-
let url =
|
|
21
|
+
let url = `\${this.baseUrl}\${endpoint}`;
|
|
22
22
|
if (params) {
|
|
23
23
|
const searchParams = new URLSearchParams(params);
|
|
24
|
-
url +=
|
|
24
|
+
url += `?\${searchParams.toString()}`;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const response = await fetch(url, {
|
|
@@ -34,7 +34,7 @@ class ApiClient {
|
|
|
34
34
|
|
|
35
35
|
if (!response.ok) {
|
|
36
36
|
const error = await response.json().catch(() => ({ message: 'Request failed' }));
|
|
37
|
-
throw new Error(error.message || `HTTP
|
|
37
|
+
throw new Error(error.message || `HTTP \${response.status}`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return response.json();
|
package/package.json
CHANGED
|
@@ -106,7 +106,7 @@ export function useTransactions() {
|
|
|
106
106
|
...filters
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
const response = await fetch(`/api/diviswap
|
|
109
|
+
const response = await fetch(`/api/diviswap?\${queryParams}`);
|
|
110
110
|
if (!response.ok) throw new Error('Failed to fetch transactions');
|
|
111
111
|
|
|
112
112
|
const data = await response.json();
|
|
@@ -180,7 +180,7 @@ export function usePayees() {
|
|
|
180
180
|
setError(null);
|
|
181
181
|
|
|
182
182
|
try {
|
|
183
|
-
const response = await fetch(`/api/diviswap?resource=payees&customerId
|
|
183
|
+
const response = await fetch(`/api/diviswap?resource=payees&customerId=\${customerId}&customerEmail=\${customerEmail}`);
|
|
184
184
|
if (!response.ok) throw new Error('Failed to fetch payees');
|
|
185
185
|
|
|
186
186
|
const data = await response.json();
|
|
@@ -237,7 +237,7 @@ export function usePayees() {
|
|
|
237
237
|
setError(null);
|
|
238
238
|
|
|
239
239
|
try {
|
|
240
|
-
const response = await fetch(`/api/diviswap?resource=payee&id
|
|
240
|
+
const response = await fetch(`/api/diviswap?resource=payee&id=\${id}&customerId=\${customerId}&customerEmail=\${customerEmail}`, {
|
|
241
241
|
method: 'DELETE'
|
|
242
242
|
});
|
|
243
243
|
|
|
@@ -286,7 +286,7 @@ export function useKYC() {
|
|
|
286
286
|
setError(null);
|
|
287
287
|
|
|
288
288
|
try {
|
|
289
|
-
const response = await fetch(`/api/diviswap?resource=kycStatus&customerId
|
|
289
|
+
const response = await fetch(`/api/diviswap?resource=kycStatus&customerId=\${customerId}&customerEmail=\${customerEmail}`);
|
|
290
290
|
if (!response.ok) throw new Error('Failed to fetch KYC status');
|
|
291
291
|
|
|
292
292
|
const data = await response.json();
|
|
@@ -157,7 +157,7 @@ const postHandlers: Record<string, ActionHandler> = {
|
|
|
157
157
|
if (params.routingNumber && params.routingNumber.includes('/')) {
|
|
158
158
|
const expiryParts = params.routingNumber.split('/');
|
|
159
159
|
expirationMonth = expiryParts[0];
|
|
160
|
-
expirationYear = expiryParts[1] ? `20
|
|
160
|
+
expirationYear = expiryParts[1] ? `20\${expiryParts[1]}` : '2025';
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
const debitCardPayload = {
|
|
@@ -230,7 +230,7 @@ const postHandlers: Record<string, ActionHandler> = {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
// Clean up the payload - remove undefined/null values and empty strings for optional fields
|
|
233
|
-
const street = address.addressLine1 + (address.addressLine2 && address.addressLine2.trim() ? `
|
|
233
|
+
const street = address.addressLine1 + (address.addressLine2 && address.addressLine2.trim() ? ` \${address.addressLine2.trim()}` : '');
|
|
234
234
|
|
|
235
235
|
const kycPayload = {
|
|
236
236
|
firstName: personalInfo.firstName,
|
|
@@ -8,7 +8,7 @@ export class DiviswapClient {
|
|
|
8
8
|
endpoint: string,
|
|
9
9
|
options: RequestInit = {}
|
|
10
10
|
): Promise<T> {
|
|
11
|
-
const response = await fetch(
|
|
11
|
+
const response = await fetch(`\${this.baseUrl}\${endpoint}`, {
|
|
12
12
|
...options,
|
|
13
13
|
headers: {
|
|
14
14
|
'Content-Type': 'application/json',
|
|
@@ -41,7 +41,7 @@ export class DiviswapClient {
|
|
|
41
41
|
|
|
42
42
|
async getCustomerStatus(customerId: string, customerEmail: string) {
|
|
43
43
|
try {
|
|
44
|
-
return await this.request(`?resource=customerStatus&customerId
|
|
44
|
+
return await this.request(`?resource=customerStatus&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
45
45
|
} catch {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
@@ -72,16 +72,16 @@ export class DiviswapClient {
|
|
|
72
72
|
...(params.type && { type: params.type }),
|
|
73
73
|
}),
|
|
74
74
|
});
|
|
75
|
-
return this.request(
|
|
75
|
+
return this.request(`?\${searchParams}`);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
async getTransaction(id: string) {
|
|
79
|
-
return this.request(`?resource=transaction&id
|
|
79
|
+
return this.request(`?resource=transaction&id=\${id}`);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Payee methods
|
|
83
83
|
async getPayees(customerId: string, customerEmail: string) {
|
|
84
|
-
return this.request(`?resource=payees&customerId
|
|
84
|
+
return this.request(`?resource=payees&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
async createPayee(data: any) {
|
|
@@ -92,7 +92,7 @@ export class DiviswapClient {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
async deletePayee(id: string, customerId: string, customerEmail: string) {
|
|
95
|
-
return this.request(`?resource=payee&id
|
|
95
|
+
return this.request(`?resource=payee&id=\${id}&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`, {
|
|
96
96
|
method: 'DELETE',
|
|
97
97
|
});
|
|
98
98
|
}
|
|
@@ -15,14 +15,14 @@ export function use{{prefix}}Dashboard() {
|
|
|
15
15
|
customerEmail,
|
|
16
16
|
...params
|
|
17
17
|
});
|
|
18
|
-
const response = await fetch(`/api/diviswap
|
|
18
|
+
const response = await fetch(`/api/diviswap?\${queryParams}`);
|
|
19
19
|
if (!response.ok) throw new Error('Failed to fetch transactions');
|
|
20
20
|
return response.json();
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const getPayees = async () => {
|
|
24
24
|
if (!isAuthenticated || !customerId) return [];
|
|
25
|
-
const response = await fetch(`/api/diviswap?resource=payees&customerId
|
|
25
|
+
const response = await fetch(`/api/diviswap?resource=payees&customerId=\${customerId}&customerEmail=\${customerEmail}`);
|
|
26
26
|
if (!response.ok) throw new Error('Failed to fetch payees');
|
|
27
27
|
return response.json();
|
|
28
28
|
};
|
|
@@ -36,7 +36,7 @@ export function use{{prefix}}Dashboard() {
|
|
|
36
36
|
...(params?.chain_id && { chain_id: params.chain_id.toString() }),
|
|
37
37
|
...(params?.is_default !== undefined && { is_default: params.is_default.toString() })
|
|
38
38
|
});
|
|
39
|
-
const response = await fetch(`/api/diviswap
|
|
39
|
+
const response = await fetch(`/api/diviswap?\${queryParams}`);
|
|
40
40
|
if (!response.ok) throw new Error('Failed to fetch addresses');
|
|
41
41
|
return response.json();
|
|
42
42
|
};
|
|
@@ -20,7 +20,7 @@ export default function DiviswapDemo() {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const handleKYCError = (error: Error) => {
|
|
23
|
-
alert(`KYC Error:
|
|
23
|
+
alert(`KYC Error: \${error.message}`);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
return (
|
|
@@ -60,7 +60,7 @@ export default function DiviswapDemo() {
|
|
|
60
60
|
<div className="flex space-x-1 mb-8">
|
|
61
61
|
<button
|
|
62
62
|
onClick={() => setCurrentDemo('kyc-inline')}
|
|
63
|
-
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors
|
|
63
|
+
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors \${
|
|
64
64
|
currentDemo === 'kyc-inline'
|
|
65
65
|
? 'bg-indigo-100 text-indigo-700 border-2 border-indigo-200'
|
|
66
66
|
: 'text-gray-500 hover:text-gray-700 border-2 border-transparent'
|
|
@@ -70,7 +70,7 @@ export default function DiviswapDemo() {
|
|
|
70
70
|
</button>
|
|
71
71
|
<button
|
|
72
72
|
onClick={() => setCurrentDemo('kyc-modal')}
|
|
73
|
-
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors
|
|
73
|
+
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors \${
|
|
74
74
|
currentDemo === 'kyc-modal'
|
|
75
75
|
? 'bg-indigo-100 text-indigo-700 border-2 border-indigo-200'
|
|
76
76
|
: 'text-gray-500 hover:text-gray-700 border-2 border-transparent'
|
|
@@ -80,7 +80,7 @@ export default function DiviswapDemo() {
|
|
|
80
80
|
</button>
|
|
81
81
|
<button
|
|
82
82
|
onClick={() => setCurrentDemo('features')}
|
|
83
|
-
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors
|
|
83
|
+
className={`flex-1 py-3 px-6 text-sm font-medium rounded-lg transition-colors \${
|
|
84
84
|
currentDemo === 'features'
|
|
85
85
|
? 'bg-indigo-100 text-indigo-700 border-2 border-indigo-200'
|
|
86
86
|
: 'text-gray-500 hover:text-gray-700 border-2 border-transparent'
|
|
@@ -29,7 +29,7 @@ export function use{{prefix}}KYC() {
|
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
// Format date of birth
|
|
32
|
-
const dateOfBirth =
|
|
32
|
+
const dateOfBirth = `\${formData.dobYear}-\${formData.dobMonth.padStart(2, '0')}-\${formData.dobDay.padStart(2, '0')}`;
|
|
33
33
|
|
|
34
34
|
// Prepare KYC data
|
|
35
35
|
const kycData = {
|
|
@@ -82,7 +82,7 @@ export function LiberexKYC({
|
|
|
82
82
|
setIsSubmitting(true);
|
|
83
83
|
try {
|
|
84
84
|
// Format date of birth
|
|
85
|
-
const dateOfBirth =
|
|
85
|
+
const dateOfBirth = `\${formData.dobYear}-\${formData.dobMonth.padStart(2, '0')}-\${formData.dobDay.padStart(2, '0')}`;
|
|
86
86
|
|
|
87
87
|
// Prepare KYC data
|
|
88
88
|
const kycData = {
|
|
@@ -170,7 +170,7 @@ export function LiberexKYC({
|
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
return (
|
|
173
|
-
<div className={`diviswap-kyc-container
|
|
173
|
+
<div className={`diviswap-kyc-container \${className}`} style={containerStyle}>
|
|
174
174
|
{/* Progress Bar */}
|
|
175
175
|
{currentStep !== 'intro' && currentStep !== 'success' && (
|
|
176
176
|
<div className="progress-container">
|
|
@@ -178,7 +178,7 @@ export function LiberexKYC({
|
|
|
178
178
|
<div
|
|
179
179
|
className="progress-fill"
|
|
180
180
|
style={{
|
|
181
|
-
width:
|
|
181
|
+
width: `\${progressPercentage}%`,
|
|
182
182
|
backgroundColor: themeConfig.primaryColor
|
|
183
183
|
}}
|
|
184
184
|
/>
|
|
@@ -620,7 +620,7 @@ function ReviewStep({ formData, onSubmit, onPrev, isSubmitting, theme }: any) {
|
|
|
620
620
|
<span>Address:</span>
|
|
621
621
|
<span>
|
|
622
622
|
{formData.addressLine1}
|
|
623
|
-
{formData.addressLine2 && `,
|
|
623
|
+
{formData.addressLine2 && `, \${formData.addressLine2}`}
|
|
624
624
|
</span>
|
|
625
625
|
</div>
|
|
626
626
|
<div className="review-item">
|
|
@@ -73,7 +73,7 @@ class DiviswapClient {
|
|
|
73
73
|
endpoint: string,
|
|
74
74
|
options: RequestInit = {}
|
|
75
75
|
): Promise<T> {
|
|
76
|
-
const response = await fetch(
|
|
76
|
+
const response = await fetch(`\${this.baseUrl}\${endpoint}`, {
|
|
77
77
|
...options,
|
|
78
78
|
headers: {
|
|
79
79
|
'Content-Type': 'application/json',
|
|
@@ -106,7 +106,7 @@ class DiviswapClient {
|
|
|
106
106
|
|
|
107
107
|
async getCustomerStatus(customerId: string, customerEmail: string) {
|
|
108
108
|
try {
|
|
109
|
-
return await this.request(`?resource=customerStatus&customerId
|
|
109
|
+
return await this.request(`?resource=customerStatus&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
110
110
|
} catch {
|
|
111
111
|
return null;
|
|
112
112
|
}
|
|
@@ -132,16 +132,16 @@ class DiviswapClient {
|
|
|
132
132
|
...(params.type && { type: params.type }),
|
|
133
133
|
}),
|
|
134
134
|
});
|
|
135
|
-
return this.request(
|
|
135
|
+
return this.request(`?\${searchParams}`);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
async getTransaction(id: string) {
|
|
139
|
-
return this.request(`?resource=transaction&id
|
|
139
|
+
return this.request(`?resource=transaction&id=\${id}`);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
// Payee methods
|
|
143
143
|
async getPayees(customerId: string, customerEmail: string) {
|
|
144
|
-
return this.request(`?resource=payees&customerId
|
|
144
|
+
return this.request(`?resource=payees&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
async createPayee(data: any) {
|
|
@@ -152,7 +152,7 @@ class DiviswapClient {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
async deletePayee(id: string, customerId: string, customerEmail: string) {
|
|
155
|
-
return this.request(`?resource=payee&id
|
|
155
|
+
return this.request(`?resource=payee&id=\${id}&customerId=\${encodeURIComponent(customerId)}&customerEmail=\${encodeURIComponent(customerEmail)}`, {
|
|
156
156
|
method: 'DELETE',
|
|
157
157
|
});
|
|
158
158
|
}
|
|
@@ -18,10 +18,10 @@ class ApiClient {
|
|
|
18
18
|
private async request<T = any>(endpoint: string, options: ApiOptions = {}): Promise<T> {
|
|
19
19
|
const { params, ...fetchOptions } = options;
|
|
20
20
|
|
|
21
|
-
let url =
|
|
21
|
+
let url = `\${this.baseUrl}\${endpoint}`;
|
|
22
22
|
if (params) {
|
|
23
23
|
const searchParams = new URLSearchParams(params);
|
|
24
|
-
url +=
|
|
24
|
+
url += `?\${searchParams.toString()}`;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const response = await fetch(url, {
|
|
@@ -34,7 +34,7 @@ class ApiClient {
|
|
|
34
34
|
|
|
35
35
|
if (!response.ok) {
|
|
36
36
|
const error = await response.json().catch(() => ({ message: 'Request failed' }));
|
|
37
|
-
throw new Error(error.message || `HTTP
|
|
37
|
+
throw new Error(error.message || `HTTP \${response.status}`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return response.json();
|