@dj-test/payment-sdk 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +8 -11
- package/dist/index.mjs +8 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,6 @@ import { Config as Config$2 } from '@wagmi/core';
|
|
|
9
9
|
|
|
10
10
|
interface SDKConfig {
|
|
11
11
|
environment?: 'production' | 'sandbox';
|
|
12
|
-
baseUrl?: string;
|
|
13
12
|
paymentDomain?: string;
|
|
14
13
|
redirectUrl?: string;
|
|
15
14
|
webhookUrl?: string;
|
|
@@ -73,6 +72,7 @@ declare class Config {
|
|
|
73
72
|
static getInstance(): Config;
|
|
74
73
|
initialize(config: SDKConfig): void;
|
|
75
74
|
getConfig(): SDKConfig;
|
|
75
|
+
getBaseUrl(): string;
|
|
76
76
|
isInitialized(): boolean;
|
|
77
77
|
reset(): void;
|
|
78
78
|
}
|
|
@@ -84,11 +84,11 @@ declare const API_ENDPOINTS: {
|
|
|
84
84
|
readonly PRODUCTS: "/products";
|
|
85
85
|
};
|
|
86
86
|
declare const ENVIRONMENT_URLS: {
|
|
87
|
-
readonly production: "
|
|
87
|
+
readonly production: "http://112.148.141.72:12346";
|
|
88
88
|
readonly sandbox: "http://localhost:8080";
|
|
89
89
|
};
|
|
90
90
|
declare const PAYMENT_DOMAINS: {
|
|
91
|
-
readonly production: "
|
|
91
|
+
readonly production: "http://112.148.141.72:12346";
|
|
92
92
|
readonly sandbox: "http://localhost:3000";
|
|
93
93
|
};
|
|
94
94
|
declare const DEFAULT_TIMEOUT = 30000;
|
|
@@ -3559,7 +3559,6 @@ interface PayWithAddressParams {
|
|
|
3559
3559
|
}
|
|
3560
3560
|
|
|
3561
3561
|
interface PaymentProviderProps {
|
|
3562
|
-
baseUrl?: string;
|
|
3563
3562
|
paymentDomain?: string;
|
|
3564
3563
|
redirectUrl?: string;
|
|
3565
3564
|
webhookUrl?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { Config as Config$2 } from '@wagmi/core';
|
|
|
9
9
|
|
|
10
10
|
interface SDKConfig {
|
|
11
11
|
environment?: 'production' | 'sandbox';
|
|
12
|
-
baseUrl?: string;
|
|
13
12
|
paymentDomain?: string;
|
|
14
13
|
redirectUrl?: string;
|
|
15
14
|
webhookUrl?: string;
|
|
@@ -73,6 +72,7 @@ declare class Config {
|
|
|
73
72
|
static getInstance(): Config;
|
|
74
73
|
initialize(config: SDKConfig): void;
|
|
75
74
|
getConfig(): SDKConfig;
|
|
75
|
+
getBaseUrl(): string;
|
|
76
76
|
isInitialized(): boolean;
|
|
77
77
|
reset(): void;
|
|
78
78
|
}
|
|
@@ -84,11 +84,11 @@ declare const API_ENDPOINTS: {
|
|
|
84
84
|
readonly PRODUCTS: "/products";
|
|
85
85
|
};
|
|
86
86
|
declare const ENVIRONMENT_URLS: {
|
|
87
|
-
readonly production: "
|
|
87
|
+
readonly production: "http://112.148.141.72:12346";
|
|
88
88
|
readonly sandbox: "http://localhost:8080";
|
|
89
89
|
};
|
|
90
90
|
declare const PAYMENT_DOMAINS: {
|
|
91
|
-
readonly production: "
|
|
91
|
+
readonly production: "http://112.148.141.72:12346";
|
|
92
92
|
readonly sandbox: "http://localhost:3000";
|
|
93
93
|
};
|
|
94
94
|
declare const DEFAULT_TIMEOUT = 30000;
|
|
@@ -3559,7 +3559,6 @@ interface PayWithAddressParams {
|
|
|
3559
3559
|
}
|
|
3560
3560
|
|
|
3561
3561
|
interface PaymentProviderProps {
|
|
3562
|
-
baseUrl?: string;
|
|
3563
3562
|
paymentDomain?: string;
|
|
3564
3563
|
redirectUrl?: string;
|
|
3565
3564
|
webhookUrl?: string;
|
package/dist/index.js
CHANGED
|
@@ -88,11 +88,11 @@ var API_ENDPOINTS = {
|
|
|
88
88
|
PRODUCTS: "/products"
|
|
89
89
|
};
|
|
90
90
|
var ENVIRONMENT_URLS = {
|
|
91
|
-
production: "
|
|
91
|
+
production: "http://112.148.141.72:12346",
|
|
92
92
|
sandbox: "http://localhost:8080"
|
|
93
93
|
};
|
|
94
94
|
var PAYMENT_DOMAINS = {
|
|
95
|
-
production: "
|
|
95
|
+
production: "http://112.148.141.72:12346",
|
|
96
96
|
sandbox: "http://localhost:3000"
|
|
97
97
|
};
|
|
98
98
|
var DEFAULT_TIMEOUT = 3e4;
|
|
@@ -126,9 +126,6 @@ var Config = class _Config {
|
|
|
126
126
|
return _Config.instance;
|
|
127
127
|
}
|
|
128
128
|
initialize(config2) {
|
|
129
|
-
if (!config2.baseUrl && config2.environment) {
|
|
130
|
-
config2.baseUrl = ENVIRONMENT_URLS[config2.environment];
|
|
131
|
-
}
|
|
132
129
|
if (!config2.timeout) {
|
|
133
130
|
config2.timeout = DEFAULT_TIMEOUT;
|
|
134
131
|
}
|
|
@@ -138,12 +135,15 @@ var Config = class _Config {
|
|
|
138
135
|
if (!this.config) {
|
|
139
136
|
return {
|
|
140
137
|
environment: "sandbox",
|
|
141
|
-
baseUrl: ENVIRONMENT_URLS.sandbox,
|
|
142
138
|
timeout: DEFAULT_TIMEOUT
|
|
143
139
|
};
|
|
144
140
|
}
|
|
145
141
|
return this.config;
|
|
146
142
|
}
|
|
143
|
+
getBaseUrl() {
|
|
144
|
+
const environment = this.config?.environment || "sandbox";
|
|
145
|
+
return ENVIRONMENT_URLS[environment];
|
|
146
|
+
}
|
|
147
147
|
isInitialized() {
|
|
148
148
|
return this.config !== null;
|
|
149
149
|
}
|
|
@@ -232,7 +232,6 @@ var isValidUrl = (url) => {
|
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
var PaymentProvider = ({
|
|
235
|
-
baseUrl,
|
|
236
235
|
paymentDomain,
|
|
237
236
|
redirectUrl,
|
|
238
237
|
webhookUrl,
|
|
@@ -252,18 +251,16 @@ var PaymentProvider = ({
|
|
|
252
251
|
}
|
|
253
252
|
const sdkConfig = {
|
|
254
253
|
environment,
|
|
255
|
-
baseUrl,
|
|
256
254
|
paymentDomain,
|
|
257
255
|
redirectUrl,
|
|
258
256
|
webhookUrl,
|
|
259
257
|
timeout
|
|
260
258
|
};
|
|
261
259
|
config.initialize(sdkConfig);
|
|
262
|
-
}, [environment,
|
|
260
|
+
}, [environment, paymentDomain, redirectUrl, webhookUrl, timeout]);
|
|
263
261
|
const contextValue = {
|
|
264
262
|
config: {
|
|
265
263
|
environment,
|
|
266
|
-
baseUrl,
|
|
267
264
|
paymentDomain,
|
|
268
265
|
redirectUrl,
|
|
269
266
|
webhookUrl,
|
|
@@ -317,7 +314,7 @@ var APIClient = class {
|
|
|
317
314
|
if (!this.instance) {
|
|
318
315
|
const sdkConfig = config.getConfig();
|
|
319
316
|
this.instance = import_axios.default.create({
|
|
320
|
-
baseURL:
|
|
317
|
+
baseURL: config.getBaseUrl(),
|
|
321
318
|
timeout: sdkConfig.timeout,
|
|
322
319
|
headers: {
|
|
323
320
|
"Content-Type": "application/json"
|
package/dist/index.mjs
CHANGED
|
@@ -11,11 +11,11 @@ var API_ENDPOINTS = {
|
|
|
11
11
|
PRODUCTS: "/products"
|
|
12
12
|
};
|
|
13
13
|
var ENVIRONMENT_URLS = {
|
|
14
|
-
production: "
|
|
14
|
+
production: "http://112.148.141.72:12346",
|
|
15
15
|
sandbox: "http://localhost:8080"
|
|
16
16
|
};
|
|
17
17
|
var PAYMENT_DOMAINS = {
|
|
18
|
-
production: "
|
|
18
|
+
production: "http://112.148.141.72:12346",
|
|
19
19
|
sandbox: "http://localhost:3000"
|
|
20
20
|
};
|
|
21
21
|
var DEFAULT_TIMEOUT = 3e4;
|
|
@@ -49,9 +49,6 @@ var Config = class _Config {
|
|
|
49
49
|
return _Config.instance;
|
|
50
50
|
}
|
|
51
51
|
initialize(config2) {
|
|
52
|
-
if (!config2.baseUrl && config2.environment) {
|
|
53
|
-
config2.baseUrl = ENVIRONMENT_URLS[config2.environment];
|
|
54
|
-
}
|
|
55
52
|
if (!config2.timeout) {
|
|
56
53
|
config2.timeout = DEFAULT_TIMEOUT;
|
|
57
54
|
}
|
|
@@ -61,12 +58,15 @@ var Config = class _Config {
|
|
|
61
58
|
if (!this.config) {
|
|
62
59
|
return {
|
|
63
60
|
environment: "sandbox",
|
|
64
|
-
baseUrl: ENVIRONMENT_URLS.sandbox,
|
|
65
61
|
timeout: DEFAULT_TIMEOUT
|
|
66
62
|
};
|
|
67
63
|
}
|
|
68
64
|
return this.config;
|
|
69
65
|
}
|
|
66
|
+
getBaseUrl() {
|
|
67
|
+
const environment = this.config?.environment || "sandbox";
|
|
68
|
+
return ENVIRONMENT_URLS[environment];
|
|
69
|
+
}
|
|
70
70
|
isInitialized() {
|
|
71
71
|
return this.config !== null;
|
|
72
72
|
}
|
|
@@ -162,7 +162,6 @@ var isValidUrl = (url) => {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
var PaymentProvider = ({
|
|
165
|
-
baseUrl,
|
|
166
165
|
paymentDomain,
|
|
167
166
|
redirectUrl,
|
|
168
167
|
webhookUrl,
|
|
@@ -182,18 +181,16 @@ var PaymentProvider = ({
|
|
|
182
181
|
}
|
|
183
182
|
const sdkConfig = {
|
|
184
183
|
environment,
|
|
185
|
-
baseUrl,
|
|
186
184
|
paymentDomain,
|
|
187
185
|
redirectUrl,
|
|
188
186
|
webhookUrl,
|
|
189
187
|
timeout
|
|
190
188
|
};
|
|
191
189
|
config.initialize(sdkConfig);
|
|
192
|
-
}, [environment,
|
|
190
|
+
}, [environment, paymentDomain, redirectUrl, webhookUrl, timeout]);
|
|
193
191
|
const contextValue = {
|
|
194
192
|
config: {
|
|
195
193
|
environment,
|
|
196
|
-
baseUrl,
|
|
197
194
|
paymentDomain,
|
|
198
195
|
redirectUrl,
|
|
199
196
|
webhookUrl,
|
|
@@ -247,7 +244,7 @@ var APIClient = class {
|
|
|
247
244
|
if (!this.instance) {
|
|
248
245
|
const sdkConfig = config.getConfig();
|
|
249
246
|
this.instance = axios.create({
|
|
250
|
-
baseURL:
|
|
247
|
+
baseURL: config.getBaseUrl(),
|
|
251
248
|
timeout: sdkConfig.timeout,
|
|
252
249
|
headers: {
|
|
253
250
|
"Content-Type": "application/json"
|