@apolopay-sdk/core 1.0.0 → 1.2.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/index.d.mts +60 -10
- package/dist/index.d.ts +60 -10
- package/dist/index.js +254 -177
- package/dist/index.mjs +253 -177
- package/package.json +8 -2
package/dist/index.d.mts
CHANGED
|
@@ -23,23 +23,37 @@ interface Asset {
|
|
|
23
23
|
networks: Network[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
declare enum ClientCode {
|
|
27
|
+
success = "success",
|
|
28
|
+
payment_success = "payment_success",
|
|
29
|
+
payment_failed = "payment_failed",
|
|
30
|
+
payment_partial = "payment_partial",
|
|
31
|
+
payment_timeout = "payment_timeout",
|
|
32
|
+
connect_error = "connect_error",
|
|
33
|
+
socket_connection_error = "socket_connection_error",
|
|
34
|
+
data_load_error = "data_load_error",
|
|
35
|
+
qr_fetch_error = "qr_fetch_error",
|
|
36
|
+
paymentProcessNotAvailable = "payment_process_not_available",
|
|
37
|
+
get_assets_error = "get_assets_error",
|
|
38
|
+
unknown_error = "unknown_error"
|
|
39
|
+
}
|
|
26
40
|
declare abstract class ClientResponseBase {
|
|
27
|
-
readonly code:
|
|
41
|
+
readonly code: ClientCode;
|
|
28
42
|
readonly message: string;
|
|
29
43
|
constructor({ code, message }: {
|
|
30
|
-
code:
|
|
44
|
+
code: ClientCode;
|
|
31
45
|
message: string;
|
|
32
46
|
});
|
|
33
47
|
}
|
|
34
48
|
declare class ClientResponse<T = any> extends ClientResponseBase {
|
|
35
49
|
readonly result?: T;
|
|
36
50
|
constructor({ code, message, result }: {
|
|
37
|
-
code:
|
|
51
|
+
code: ClientCode;
|
|
38
52
|
message: string;
|
|
39
53
|
result?: T;
|
|
40
54
|
});
|
|
41
55
|
static fromJson<T = any>(json: any, { code, message, result }?: {
|
|
42
|
-
code?:
|
|
56
|
+
code?: ClientCode;
|
|
43
57
|
message?: string;
|
|
44
58
|
result?: (json: any) => T;
|
|
45
59
|
}): ClientResponse<T>;
|
|
@@ -47,12 +61,12 @@ declare class ClientResponse<T = any> extends ClientResponseBase {
|
|
|
47
61
|
declare class ClientError extends ClientResponseBase {
|
|
48
62
|
readonly error?: any;
|
|
49
63
|
constructor({ code, message, error }: {
|
|
50
|
-
code:
|
|
64
|
+
code: ClientCode;
|
|
51
65
|
message: string;
|
|
52
66
|
error?: any;
|
|
53
67
|
});
|
|
54
68
|
static fromError(error: any, { code, message }?: {
|
|
55
|
-
code?:
|
|
69
|
+
code?: ClientCode;
|
|
56
70
|
message?: string;
|
|
57
71
|
}): ClientError;
|
|
58
72
|
}
|
|
@@ -66,18 +80,35 @@ interface QrResponseData {
|
|
|
66
80
|
network: string;
|
|
67
81
|
asset: string;
|
|
68
82
|
amount: number | string;
|
|
83
|
+
amountPaid?: number | string | null;
|
|
69
84
|
address: string;
|
|
70
85
|
qrCodeUrl: string;
|
|
71
86
|
expiresAtMs: number;
|
|
72
87
|
paymentUrl?: string;
|
|
73
88
|
}
|
|
89
|
+
interface PaymentResponseData {
|
|
90
|
+
id: string;
|
|
91
|
+
network: string;
|
|
92
|
+
asset: string;
|
|
93
|
+
amount: number | string;
|
|
94
|
+
status: string;
|
|
95
|
+
}
|
|
96
|
+
interface PartialPaymentResponseData {
|
|
97
|
+
id: string;
|
|
98
|
+
network: string;
|
|
99
|
+
asset: string;
|
|
100
|
+
amount: number | string;
|
|
101
|
+
amountPaid: number | string;
|
|
102
|
+
status: string;
|
|
103
|
+
}
|
|
74
104
|
interface ClientOptions {
|
|
75
105
|
publicKey: string;
|
|
76
106
|
}
|
|
77
107
|
interface PaymentSessionOptions {
|
|
78
108
|
processId: string;
|
|
79
|
-
onSuccess
|
|
80
|
-
|
|
109
|
+
onSuccess?: (response: ClientResponse<PaymentResponseData>) => void;
|
|
110
|
+
onPartialPayment?: (response: ClientResponse<PartialPaymentResponseData>) => void;
|
|
111
|
+
onError?: (error: ClientError) => void;
|
|
81
112
|
}
|
|
82
113
|
interface PaymentOptions extends ClientOptions, PaymentSessionOptions {
|
|
83
114
|
}
|
|
@@ -111,6 +142,7 @@ interface Dictionary {
|
|
|
111
142
|
success: string;
|
|
112
143
|
error: string;
|
|
113
144
|
idle: string;
|
|
145
|
+
processing: string;
|
|
114
146
|
};
|
|
115
147
|
subtitles: {
|
|
116
148
|
selectAsset: string;
|
|
@@ -133,13 +165,20 @@ interface Dictionary {
|
|
|
133
165
|
product: string;
|
|
134
166
|
minutes: string;
|
|
135
167
|
seconds: string;
|
|
168
|
+
amountSent: string;
|
|
169
|
+
paid: string;
|
|
170
|
+
remainingToPay: string;
|
|
171
|
+
};
|
|
172
|
+
info: {
|
|
173
|
+
noReloadPageTitle: string;
|
|
174
|
+
noReloadPageSubTitle: string;
|
|
175
|
+
selectNetworkLater: string;
|
|
136
176
|
};
|
|
137
177
|
warnings: {
|
|
138
178
|
networkMatch: string;
|
|
139
179
|
noNFT: string;
|
|
140
180
|
onlyToken: string;
|
|
141
181
|
timer: string;
|
|
142
|
-
selectNetworkLater: string;
|
|
143
182
|
};
|
|
144
183
|
success: {
|
|
145
184
|
message: string;
|
|
@@ -148,11 +187,22 @@ interface Dictionary {
|
|
|
148
187
|
support: string;
|
|
149
188
|
};
|
|
150
189
|
};
|
|
190
|
+
successes: {
|
|
191
|
+
success: string;
|
|
192
|
+
};
|
|
151
193
|
errors: {
|
|
152
194
|
generic: string;
|
|
153
195
|
publicKeyMissing: string;
|
|
154
196
|
config: string;
|
|
155
197
|
timeout: string;
|
|
198
|
+
paymentFailed: string;
|
|
199
|
+
connectError: string;
|
|
200
|
+
socketConnectionError: string;
|
|
201
|
+
dataLoadError: string;
|
|
202
|
+
qrFetchError: string;
|
|
203
|
+
paymentProcessNotAvailable: string;
|
|
204
|
+
getAssetsError: string;
|
|
205
|
+
unknownError: string;
|
|
156
206
|
};
|
|
157
207
|
}
|
|
158
208
|
|
|
@@ -166,4 +216,4 @@ declare class I18nService {
|
|
|
166
216
|
static interpolate(text: string, params: Record<string, string | number>): string;
|
|
167
217
|
}
|
|
168
218
|
|
|
169
|
-
export { ApoloPayClient, type ApoloPayClientOptions, type Asset, ClientError, type ClientOptions, ClientResponse, ClientResponseBase, type Dictionary, I18nService as I18n, type Locale, ModalStep, type Network, type PaymentOptions, PaymentService, type PaymentSessionOptions, type QrRequestDetails, type QrResponseData };
|
|
219
|
+
export { ApoloPayClient, type ApoloPayClientOptions, type Asset, ClientCode, ClientError, type ClientOptions, ClientResponse, ClientResponseBase, type Dictionary, I18nService as I18n, type Locale, ModalStep, type Network, type PartialPaymentResponseData, type PaymentOptions, type PaymentResponseData, PaymentService, type PaymentSessionOptions, type QrRequestDetails, type QrResponseData };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,23 +23,37 @@ interface Asset {
|
|
|
23
23
|
networks: Network[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
declare enum ClientCode {
|
|
27
|
+
success = "success",
|
|
28
|
+
payment_success = "payment_success",
|
|
29
|
+
payment_failed = "payment_failed",
|
|
30
|
+
payment_partial = "payment_partial",
|
|
31
|
+
payment_timeout = "payment_timeout",
|
|
32
|
+
connect_error = "connect_error",
|
|
33
|
+
socket_connection_error = "socket_connection_error",
|
|
34
|
+
data_load_error = "data_load_error",
|
|
35
|
+
qr_fetch_error = "qr_fetch_error",
|
|
36
|
+
paymentProcessNotAvailable = "payment_process_not_available",
|
|
37
|
+
get_assets_error = "get_assets_error",
|
|
38
|
+
unknown_error = "unknown_error"
|
|
39
|
+
}
|
|
26
40
|
declare abstract class ClientResponseBase {
|
|
27
|
-
readonly code:
|
|
41
|
+
readonly code: ClientCode;
|
|
28
42
|
readonly message: string;
|
|
29
43
|
constructor({ code, message }: {
|
|
30
|
-
code:
|
|
44
|
+
code: ClientCode;
|
|
31
45
|
message: string;
|
|
32
46
|
});
|
|
33
47
|
}
|
|
34
48
|
declare class ClientResponse<T = any> extends ClientResponseBase {
|
|
35
49
|
readonly result?: T;
|
|
36
50
|
constructor({ code, message, result }: {
|
|
37
|
-
code:
|
|
51
|
+
code: ClientCode;
|
|
38
52
|
message: string;
|
|
39
53
|
result?: T;
|
|
40
54
|
});
|
|
41
55
|
static fromJson<T = any>(json: any, { code, message, result }?: {
|
|
42
|
-
code?:
|
|
56
|
+
code?: ClientCode;
|
|
43
57
|
message?: string;
|
|
44
58
|
result?: (json: any) => T;
|
|
45
59
|
}): ClientResponse<T>;
|
|
@@ -47,12 +61,12 @@ declare class ClientResponse<T = any> extends ClientResponseBase {
|
|
|
47
61
|
declare class ClientError extends ClientResponseBase {
|
|
48
62
|
readonly error?: any;
|
|
49
63
|
constructor({ code, message, error }: {
|
|
50
|
-
code:
|
|
64
|
+
code: ClientCode;
|
|
51
65
|
message: string;
|
|
52
66
|
error?: any;
|
|
53
67
|
});
|
|
54
68
|
static fromError(error: any, { code, message }?: {
|
|
55
|
-
code?:
|
|
69
|
+
code?: ClientCode;
|
|
56
70
|
message?: string;
|
|
57
71
|
}): ClientError;
|
|
58
72
|
}
|
|
@@ -66,18 +80,35 @@ interface QrResponseData {
|
|
|
66
80
|
network: string;
|
|
67
81
|
asset: string;
|
|
68
82
|
amount: number | string;
|
|
83
|
+
amountPaid?: number | string | null;
|
|
69
84
|
address: string;
|
|
70
85
|
qrCodeUrl: string;
|
|
71
86
|
expiresAtMs: number;
|
|
72
87
|
paymentUrl?: string;
|
|
73
88
|
}
|
|
89
|
+
interface PaymentResponseData {
|
|
90
|
+
id: string;
|
|
91
|
+
network: string;
|
|
92
|
+
asset: string;
|
|
93
|
+
amount: number | string;
|
|
94
|
+
status: string;
|
|
95
|
+
}
|
|
96
|
+
interface PartialPaymentResponseData {
|
|
97
|
+
id: string;
|
|
98
|
+
network: string;
|
|
99
|
+
asset: string;
|
|
100
|
+
amount: number | string;
|
|
101
|
+
amountPaid: number | string;
|
|
102
|
+
status: string;
|
|
103
|
+
}
|
|
74
104
|
interface ClientOptions {
|
|
75
105
|
publicKey: string;
|
|
76
106
|
}
|
|
77
107
|
interface PaymentSessionOptions {
|
|
78
108
|
processId: string;
|
|
79
|
-
onSuccess
|
|
80
|
-
|
|
109
|
+
onSuccess?: (response: ClientResponse<PaymentResponseData>) => void;
|
|
110
|
+
onPartialPayment?: (response: ClientResponse<PartialPaymentResponseData>) => void;
|
|
111
|
+
onError?: (error: ClientError) => void;
|
|
81
112
|
}
|
|
82
113
|
interface PaymentOptions extends ClientOptions, PaymentSessionOptions {
|
|
83
114
|
}
|
|
@@ -111,6 +142,7 @@ interface Dictionary {
|
|
|
111
142
|
success: string;
|
|
112
143
|
error: string;
|
|
113
144
|
idle: string;
|
|
145
|
+
processing: string;
|
|
114
146
|
};
|
|
115
147
|
subtitles: {
|
|
116
148
|
selectAsset: string;
|
|
@@ -133,13 +165,20 @@ interface Dictionary {
|
|
|
133
165
|
product: string;
|
|
134
166
|
minutes: string;
|
|
135
167
|
seconds: string;
|
|
168
|
+
amountSent: string;
|
|
169
|
+
paid: string;
|
|
170
|
+
remainingToPay: string;
|
|
171
|
+
};
|
|
172
|
+
info: {
|
|
173
|
+
noReloadPageTitle: string;
|
|
174
|
+
noReloadPageSubTitle: string;
|
|
175
|
+
selectNetworkLater: string;
|
|
136
176
|
};
|
|
137
177
|
warnings: {
|
|
138
178
|
networkMatch: string;
|
|
139
179
|
noNFT: string;
|
|
140
180
|
onlyToken: string;
|
|
141
181
|
timer: string;
|
|
142
|
-
selectNetworkLater: string;
|
|
143
182
|
};
|
|
144
183
|
success: {
|
|
145
184
|
message: string;
|
|
@@ -148,11 +187,22 @@ interface Dictionary {
|
|
|
148
187
|
support: string;
|
|
149
188
|
};
|
|
150
189
|
};
|
|
190
|
+
successes: {
|
|
191
|
+
success: string;
|
|
192
|
+
};
|
|
151
193
|
errors: {
|
|
152
194
|
generic: string;
|
|
153
195
|
publicKeyMissing: string;
|
|
154
196
|
config: string;
|
|
155
197
|
timeout: string;
|
|
198
|
+
paymentFailed: string;
|
|
199
|
+
connectError: string;
|
|
200
|
+
socketConnectionError: string;
|
|
201
|
+
dataLoadError: string;
|
|
202
|
+
qrFetchError: string;
|
|
203
|
+
paymentProcessNotAvailable: string;
|
|
204
|
+
getAssetsError: string;
|
|
205
|
+
unknownError: string;
|
|
156
206
|
};
|
|
157
207
|
}
|
|
158
208
|
|
|
@@ -166,4 +216,4 @@ declare class I18nService {
|
|
|
166
216
|
static interpolate(text: string, params: Record<string, string | number>): string;
|
|
167
217
|
}
|
|
168
218
|
|
|
169
|
-
export { ApoloPayClient, type ApoloPayClientOptions, type Asset, ClientError, type ClientOptions, ClientResponse, ClientResponseBase, type Dictionary, I18nService as I18n, type Locale, ModalStep, type Network, type PaymentOptions, PaymentService, type PaymentSessionOptions, type QrRequestDetails, type QrResponseData };
|
|
219
|
+
export { ApoloPayClient, type ApoloPayClientOptions, type Asset, ClientCode, ClientError, type ClientOptions, ClientResponse, ClientResponseBase, type Dictionary, I18nService as I18n, type Locale, ModalStep, type Network, type PartialPaymentResponseData, type PaymentOptions, type PaymentResponseData, PaymentService, type PaymentSessionOptions, type QrRequestDetails, type QrResponseData };
|