@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.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ApoloPayClient: () => ApoloPayClient,
|
|
24
|
+
ClientCode: () => ClientCode,
|
|
24
25
|
ClientError: () => ClientError,
|
|
25
26
|
ClientResponse: () => ClientResponse,
|
|
26
27
|
ClientResponseBase: () => ClientResponseBase,
|
|
@@ -40,7 +41,201 @@ var ApoloPayClient = class {
|
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
|
|
44
|
+
// src/i18n/es.ts
|
|
45
|
+
var es = {
|
|
46
|
+
trigger: {
|
|
47
|
+
loading: "Cargando..."
|
|
48
|
+
},
|
|
49
|
+
modal: {
|
|
50
|
+
titles: {
|
|
51
|
+
selectAsset: 'Selecciona el <span class="highlight">stablecoin</span>',
|
|
52
|
+
selectNetwork: 'Selecciona la <span class="highlight">red</span>',
|
|
53
|
+
scanQr: 'Dep\xF3sito <span class="highlight">{symbol}</span>',
|
|
54
|
+
success: '\xA1Gracias por <span class="highlight">tu compra!</span>',
|
|
55
|
+
error: "Error en el Pago",
|
|
56
|
+
idle: "Estado inesperado",
|
|
57
|
+
processing: '\xA1Procesando <span class="highlight">tu pago!</span>'
|
|
58
|
+
},
|
|
59
|
+
subtitles: {
|
|
60
|
+
selectAsset: "Selecciona la stablecoin con la que deseas pagar",
|
|
61
|
+
selectNetwork: "Selecciona la red de tu preferencia",
|
|
62
|
+
idle: "Ocurrio un error inesperado"
|
|
63
|
+
},
|
|
64
|
+
actions: {
|
|
65
|
+
back: "Volver",
|
|
66
|
+
close: "Cerrar",
|
|
67
|
+
support: "Soporte",
|
|
68
|
+
scanApp: 'Escanea con tu celular y continua desde la app de <span style="color: var(--apolo-accent)">Apolo Pay</span>',
|
|
69
|
+
copy: "Copiar",
|
|
70
|
+
copied: "\xA1Copiado!",
|
|
71
|
+
payFromDevice: "Pagar desde este dispositivo"
|
|
72
|
+
},
|
|
73
|
+
labels: {
|
|
74
|
+
network: "Red",
|
|
75
|
+
address: "Direcci\xF3n de dep\xF3sito",
|
|
76
|
+
amount: "Monto",
|
|
77
|
+
product: "Producto o Servicio",
|
|
78
|
+
minutes: "min",
|
|
79
|
+
seconds: "seg",
|
|
80
|
+
amountSent: "Monto Enviado",
|
|
81
|
+
paid: "Pagado",
|
|
82
|
+
remainingToPay: "Restante por pagar"
|
|
83
|
+
},
|
|
84
|
+
info: {
|
|
85
|
+
noReloadPageTitle: '\xA1Por favor no <span style="color: var(--apolo-accent)">recargues la p\xE1gina!</span>',
|
|
86
|
+
noReloadPageSubTitle: "La pantalla se actualizara cuando confirmes tu pago",
|
|
87
|
+
selectNetworkLater: "Luego podr\xE1s seleccionar la red de tu preferencia"
|
|
88
|
+
},
|
|
89
|
+
warnings: {
|
|
90
|
+
networkMatch: "Aseg\xFArate de que la <strong>red de tu wallet coincida</strong> con la red de destino.",
|
|
91
|
+
noNFT: "No env\xEDes NFTs a esta wallet.",
|
|
92
|
+
onlyToken: "Solo se aceptan <strong>dep\xF3sitos en {symbol}</strong>. El env\xEDo de otro tipo de token podr\xEDa resultar en su p\xE9rdida.",
|
|
93
|
+
timer: "Realiza el pago dentro del tiempo indicado. <strong>{time}</strong> De lo contrario, el c\xF3digo QR se vencer\xE1."
|
|
94
|
+
},
|
|
95
|
+
success: {
|
|
96
|
+
message: "Tu pago fue exitoso y en breve recibir\xE1s un correo",
|
|
97
|
+
message2: "con los detalles.",
|
|
98
|
+
details: "Detalles de la compra",
|
|
99
|
+
support: "Cualquier duda o inquietud puedes comunicarte con soporte"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
successes: {
|
|
103
|
+
success: "\xC9xito"
|
|
104
|
+
},
|
|
105
|
+
errors: {
|
|
106
|
+
generic: "Ocurri\xF3 un error inesperado.",
|
|
107
|
+
publicKeyMissing: "Falta la Public Key",
|
|
108
|
+
config: "Error de Configuraci\xF3n",
|
|
109
|
+
timeout: "El tiempo para realizar el pago ha expirado. Por favor genera una nueva orden.",
|
|
110
|
+
paymentFailed: "El pago ha fallado. Por favor genera una nueva orden.",
|
|
111
|
+
connectError: "Error de conexi\xF3n.",
|
|
112
|
+
socketConnectionError: "Error de conexi\xF3n en el socket.",
|
|
113
|
+
dataLoadError: "No se pudo cargar los datos de pago.",
|
|
114
|
+
qrFetchError: "Fallo al obtener los detalles del c\xF3digo QR.",
|
|
115
|
+
paymentProcessNotAvailable: "El proceso de pago no est\xE1 disponible.",
|
|
116
|
+
getAssetsError: "Error al obtener los activos.",
|
|
117
|
+
unknownError: "Ocurri\xF3 un error inesperado."
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// src/i18n/en.ts
|
|
122
|
+
var en = {
|
|
123
|
+
trigger: {
|
|
124
|
+
loading: "Loading..."
|
|
125
|
+
},
|
|
126
|
+
modal: {
|
|
127
|
+
titles: {
|
|
128
|
+
selectAsset: 'Select <span class="highlight">stablecoin</span>',
|
|
129
|
+
selectNetwork: 'Select <span class="highlight">network</span>',
|
|
130
|
+
scanQr: 'Deposit <span class="highlight">{symbol}</span>',
|
|
131
|
+
success: 'Thanks for <span class="highlight">your purchase!</span>',
|
|
132
|
+
error: "Payment Error",
|
|
133
|
+
idle: "Unexpected state",
|
|
134
|
+
processing: 'Processing <span class="highlight">your payment!</span>'
|
|
135
|
+
},
|
|
136
|
+
subtitles: {
|
|
137
|
+
selectAsset: "Select the stablecoin you want to pay with",
|
|
138
|
+
selectNetwork: "Select your preferred network",
|
|
139
|
+
idle: "An Unexpected error occurred"
|
|
140
|
+
},
|
|
141
|
+
actions: {
|
|
142
|
+
back: "Back",
|
|
143
|
+
close: "Close",
|
|
144
|
+
support: "Support",
|
|
145
|
+
scanApp: 'Scan with your phone and continue from <br><span style="color: var(--apolo-accent)">Apolo Pay</span> app',
|
|
146
|
+
copy: "Copy",
|
|
147
|
+
copied: "Copied!",
|
|
148
|
+
payFromDevice: "Pay from this device"
|
|
149
|
+
},
|
|
150
|
+
labels: {
|
|
151
|
+
network: "Network",
|
|
152
|
+
address: "Deposit Address",
|
|
153
|
+
amount: "Amount",
|
|
154
|
+
product: "Product or Service",
|
|
155
|
+
minutes: "min",
|
|
156
|
+
seconds: "sec",
|
|
157
|
+
amountSent: "Amount sent",
|
|
158
|
+
paid: "Paid",
|
|
159
|
+
remainingToPay: "Remaining balance to pay"
|
|
160
|
+
},
|
|
161
|
+
info: {
|
|
162
|
+
noReloadPageTitle: 'Please do not <span style="color: var(--apolo-accent)">reload the page!</span>',
|
|
163
|
+
noReloadPageSubTitle: "The screen will update when you confirm your payment",
|
|
164
|
+
selectNetworkLater: "You will be able to select your preferred network later"
|
|
165
|
+
},
|
|
166
|
+
warnings: {
|
|
167
|
+
networkMatch: "Ensure your <strong>wallet network matches</strong> the destination network.",
|
|
168
|
+
noNFT: "Do not send NFTs to this wallet.",
|
|
169
|
+
onlyToken: "Only <strong>{symbol} deposits</strong> are accepted. Sending other tokens may result in loss.",
|
|
170
|
+
timer: "Complete payment within <strong>{time}</strong>. Otherwise, the QR code will expire."
|
|
171
|
+
},
|
|
172
|
+
success: {
|
|
173
|
+
message: "Your payment was successful. You will receive an email",
|
|
174
|
+
message2: "shortly.",
|
|
175
|
+
details: "Purchase Details",
|
|
176
|
+
support: "Any doubt or inquiry you can contact support"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
successes: {
|
|
180
|
+
success: "Success"
|
|
181
|
+
},
|
|
182
|
+
errors: {
|
|
183
|
+
generic: "An unexpected error occurred.",
|
|
184
|
+
publicKeyMissing: "Public Key is missing",
|
|
185
|
+
config: "Config Error",
|
|
186
|
+
timeout: "The payment time has expired. Please generate a new order.",
|
|
187
|
+
paymentFailed: "The payment has failed. Please generate a new order.",
|
|
188
|
+
connectError: "Connection error in real time.",
|
|
189
|
+
socketConnectionError: "Connection error in socket.",
|
|
190
|
+
dataLoadError: "Could not load payment options.",
|
|
191
|
+
qrFetchError: "Failed to get payment details.",
|
|
192
|
+
paymentProcessNotAvailable: "The payment process is not available.",
|
|
193
|
+
getAssetsError: "Failed to get assets.",
|
|
194
|
+
unknownError: "An unexpected error occurred."
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/i18n/index.ts
|
|
199
|
+
var I18nService = class {
|
|
200
|
+
// Cambiar idioma
|
|
201
|
+
static setLocale(locale) {
|
|
202
|
+
this._currentLocale = locale;
|
|
203
|
+
this._dictionary = locale === "en" ? en : es;
|
|
204
|
+
}
|
|
205
|
+
static get current() {
|
|
206
|
+
return this._currentLocale;
|
|
207
|
+
}
|
|
208
|
+
// Función para obtener texto (Tipado seguro para claves anidadas sería complejo,
|
|
209
|
+
// así que usaremos acceso directo o un getter helper si lo prefieres)
|
|
210
|
+
static get t() {
|
|
211
|
+
return this._dictionary;
|
|
212
|
+
}
|
|
213
|
+
// Helper para interpolar variables: "Hola {name}" -> "Hola Mundo"
|
|
214
|
+
static interpolate(text, params) {
|
|
215
|
+
return text.replace(/{(\w+)}/g, (match, key) => {
|
|
216
|
+
return typeof params[key] !== "undefined" ? String(params[key]) : match;
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
I18nService._currentLocale = "es";
|
|
221
|
+
I18nService._dictionary = es;
|
|
222
|
+
|
|
43
223
|
// src/types/client-response.ts
|
|
224
|
+
var ClientCode = /* @__PURE__ */ ((ClientCode2) => {
|
|
225
|
+
ClientCode2["success"] = "success";
|
|
226
|
+
ClientCode2["payment_success"] = "payment_success";
|
|
227
|
+
ClientCode2["payment_failed"] = "payment_failed";
|
|
228
|
+
ClientCode2["payment_partial"] = "payment_partial";
|
|
229
|
+
ClientCode2["payment_timeout"] = "payment_timeout";
|
|
230
|
+
ClientCode2["connect_error"] = "connect_error";
|
|
231
|
+
ClientCode2["socket_connection_error"] = "socket_connection_error";
|
|
232
|
+
ClientCode2["data_load_error"] = "data_load_error";
|
|
233
|
+
ClientCode2["qr_fetch_error"] = "qr_fetch_error";
|
|
234
|
+
ClientCode2["paymentProcessNotAvailable"] = "payment_process_not_available";
|
|
235
|
+
ClientCode2["get_assets_error"] = "get_assets_error";
|
|
236
|
+
ClientCode2["unknown_error"] = "unknown_error";
|
|
237
|
+
return ClientCode2;
|
|
238
|
+
})(ClientCode || {});
|
|
44
239
|
var ClientResponseBase = class {
|
|
45
240
|
constructor({ code, message }) {
|
|
46
241
|
this.code = code;
|
|
@@ -53,8 +248,8 @@ var ClientResponse = class _ClientResponse extends ClientResponseBase {
|
|
|
53
248
|
this.result = result;
|
|
54
249
|
}
|
|
55
250
|
static fromJson(json, { code, message, result } = {}) {
|
|
56
|
-
const successCode = json.status || code || "success"
|
|
57
|
-
const successMessage = json.message || message ||
|
|
251
|
+
const successCode = json.status || code || "success" /* success */;
|
|
252
|
+
const successMessage = json.message || message || I18nService.t.successes.success;
|
|
58
253
|
const successResult = result?.(json.result) || json.result || json;
|
|
59
254
|
return new _ClientResponse({ code: successCode, message: successMessage, result: successResult });
|
|
60
255
|
}
|
|
@@ -65,18 +260,24 @@ var ClientError = class _ClientError extends ClientResponseBase {
|
|
|
65
260
|
this.error = error;
|
|
66
261
|
}
|
|
67
262
|
static fromError(error, { code, message } = {}) {
|
|
68
|
-
|
|
69
|
-
const
|
|
263
|
+
if (error instanceof _ClientError) return error;
|
|
264
|
+
const errCode = code || error.statusCode || "unknown_error" /* unknown_error */;
|
|
265
|
+
const errMessage = message || error.message || I18nService.t.errors.unknownError;
|
|
70
266
|
const err = error.error || error;
|
|
71
267
|
return new _ClientError({ code: errCode, message: errMessage, error: err });
|
|
72
268
|
}
|
|
73
269
|
};
|
|
74
270
|
|
|
271
|
+
// src/utils/variables.ts
|
|
272
|
+
var appURL = "https://p2p.apolopay.app";
|
|
273
|
+
var apiURL = "https://pb-api.apolopay.app";
|
|
274
|
+
var socketURL = "https://pb-ws.apolopay.app";
|
|
275
|
+
|
|
75
276
|
// src/services/repository.ts
|
|
76
277
|
var Repository = class {
|
|
77
278
|
static async getAssets() {
|
|
78
279
|
try {
|
|
79
|
-
const response = await fetch(`${
|
|
280
|
+
const response = await fetch(`${apiURL}/payment-button/assets`, {
|
|
80
281
|
method: "GET",
|
|
81
282
|
headers: this.headers()
|
|
82
283
|
});
|
|
@@ -84,8 +285,8 @@ var Repository = class {
|
|
|
84
285
|
return ClientResponse.fromJson(data);
|
|
85
286
|
} catch (error) {
|
|
86
287
|
throw ClientError.fromError(error, {
|
|
87
|
-
code: "get_assets_error"
|
|
88
|
-
message:
|
|
288
|
+
code: "get_assets_error" /* get_assets_error */,
|
|
289
|
+
message: I18nService.t.errors.getAssetsError
|
|
89
290
|
});
|
|
90
291
|
}
|
|
91
292
|
}
|
|
@@ -96,7 +297,7 @@ var Repository = class {
|
|
|
96
297
|
publicKey
|
|
97
298
|
}) {
|
|
98
299
|
try {
|
|
99
|
-
const response = await fetch(`${
|
|
300
|
+
const response = await fetch(`${apiURL}/payment-button/process/confirm`, {
|
|
100
301
|
method: "POST",
|
|
101
302
|
headers: this.headers(publicKey),
|
|
102
303
|
body: JSON.stringify({
|
|
@@ -107,42 +308,55 @@ var Repository = class {
|
|
|
107
308
|
}), data = await response.json();
|
|
108
309
|
if (!data.result) {
|
|
109
310
|
throw new ClientError({
|
|
110
|
-
code:
|
|
111
|
-
message:
|
|
311
|
+
code: "payment_process_not_available" /* paymentProcessNotAvailable */,
|
|
312
|
+
message: I18nService.t.errors.paymentProcessNotAvailable
|
|
112
313
|
});
|
|
113
314
|
}
|
|
114
315
|
const wallet = data.result.wallet;
|
|
115
316
|
const network = data.result.network;
|
|
116
|
-
const address = network === "apolopay" ?
|
|
317
|
+
const address = network === "apolopay" ? `${appURL}/payment-process/${processId}` : wallet;
|
|
117
318
|
return ClientResponse.fromJson(data, {
|
|
118
319
|
result: (json) => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
320
|
+
const now = Date.now();
|
|
321
|
+
const defaultMilliseconds = now + 10 * 60 * 1e3;
|
|
322
|
+
let rawVal = json.expiresAtMs ?? json.expiresAt;
|
|
323
|
+
const calculateExpiration = (val) => {
|
|
324
|
+
if (!val) return defaultMilliseconds;
|
|
325
|
+
let ms = 0;
|
|
326
|
+
if (!isNaN(Number(val))) {
|
|
327
|
+
ms = Number(val);
|
|
328
|
+
} else if (typeof val === "string") {
|
|
329
|
+
const parsed = new Date(val).getTime();
|
|
330
|
+
if (!isNaN(parsed)) ms = parsed;
|
|
331
|
+
}
|
|
332
|
+
if (ms === 0) return defaultMilliseconds;
|
|
333
|
+
if (ms < 1e10) {
|
|
334
|
+
ms *= 1e3;
|
|
335
|
+
} else if (ms > 1e13) {
|
|
336
|
+
while (ms > 2e13) {
|
|
337
|
+
ms = Math.floor(ms / 1e3);
|
|
338
|
+
}
|
|
126
339
|
}
|
|
127
|
-
|
|
340
|
+
return ms;
|
|
341
|
+
};
|
|
342
|
+
const expiresAtMs = calculateExpiration(rawVal);
|
|
128
343
|
return {
|
|
129
344
|
...json,
|
|
130
345
|
address,
|
|
131
346
|
qrCodeUrl: `https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${address}&ecc=H`,
|
|
132
347
|
paymentUrl: address.startsWith("http") ? address : void 0,
|
|
133
|
-
expiresAtMs
|
|
348
|
+
expiresAtMs
|
|
134
349
|
};
|
|
135
350
|
}
|
|
136
351
|
});
|
|
137
352
|
} catch (error) {
|
|
138
353
|
throw ClientError.fromError(error, {
|
|
139
|
-
code: "
|
|
140
|
-
message:
|
|
354
|
+
code: "qr_fetch_error" /* qr_fetch_error */,
|
|
355
|
+
message: I18nService.t.errors.qrFetchError
|
|
141
356
|
});
|
|
142
357
|
}
|
|
143
358
|
}
|
|
144
359
|
};
|
|
145
|
-
Repository.apiUrl = "https://pb-test-api.apolopay.app";
|
|
146
360
|
Repository.headers = (publicKey) => {
|
|
147
361
|
const options = {
|
|
148
362
|
"Content-Type": "application/json"
|
|
@@ -153,7 +367,7 @@ Repository.headers = (publicKey) => {
|
|
|
153
367
|
|
|
154
368
|
// src/services/socket-service.ts
|
|
155
369
|
var import_socket = require("socket.io-client");
|
|
156
|
-
var
|
|
370
|
+
var SocketService = class {
|
|
157
371
|
constructor(client) {
|
|
158
372
|
this.sessionOptions = null;
|
|
159
373
|
this.socket = null;
|
|
@@ -163,11 +377,11 @@ var _SocketService = class _SocketService {
|
|
|
163
377
|
if (typeof window === "undefined") return;
|
|
164
378
|
this.sessionOptions = session;
|
|
165
379
|
if (this.socket && this.socket.connected) return this.disconnect();
|
|
166
|
-
this.socket = (0, import_socket.io)(
|
|
380
|
+
this.socket = (0, import_socket.io)(socketURL, {
|
|
167
381
|
extraHeaders: {
|
|
168
382
|
"x-public-key": this.client.getPublicKey()
|
|
169
383
|
},
|
|
170
|
-
transports: ["polling"]
|
|
384
|
+
transports: ["websocket", "polling"]
|
|
171
385
|
});
|
|
172
386
|
const { processId } = session;
|
|
173
387
|
this.socket.on("connect", () => this.socket?.emit("process:connect", { processId }));
|
|
@@ -175,7 +389,7 @@ var _SocketService = class _SocketService {
|
|
|
175
389
|
this.socket.on("process:message", (response) => this.handleWebSocketMessage(response));
|
|
176
390
|
this.socket.on("connect_error", (error) => {
|
|
177
391
|
console.error("Error en conexi\xF3n Socket.io:", error);
|
|
178
|
-
this.sessionOptions?.onError({ code: "connect_error"
|
|
392
|
+
this.sessionOptions?.onError?.({ code: "connect_error" /* connect_error */, message: I18nService.t.errors.connectError, error });
|
|
179
393
|
this.disconnect();
|
|
180
394
|
});
|
|
181
395
|
this.socket.on("disconnect", (reason) => {
|
|
@@ -184,17 +398,23 @@ var _SocketService = class _SocketService {
|
|
|
184
398
|
});
|
|
185
399
|
}
|
|
186
400
|
handleWebSocketMessage(response) {
|
|
187
|
-
console.log(response);
|
|
188
401
|
if (!response.success) {
|
|
189
|
-
return this.sessionOptions?.onError({
|
|
190
|
-
code: "payment_failed"
|
|
402
|
+
return this.sessionOptions?.onError?.({
|
|
403
|
+
code: "payment_failed" /* payment_failed */,
|
|
191
404
|
message: response.message,
|
|
192
405
|
error: response.result
|
|
193
406
|
});
|
|
194
407
|
}
|
|
195
|
-
if (response.
|
|
196
|
-
return this.sessionOptions?.
|
|
197
|
-
code: "
|
|
408
|
+
if (response.event === "partial_payment") {
|
|
409
|
+
return this.sessionOptions?.onPartialPayment?.({
|
|
410
|
+
code: "payment_partial" /* payment_partial */,
|
|
411
|
+
message: response.message,
|
|
412
|
+
result: response.result
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (response.event === "funds_received") {
|
|
416
|
+
return this.sessionOptions?.onSuccess?.({
|
|
417
|
+
code: "payment_success" /* payment_success */,
|
|
198
418
|
message: response.message,
|
|
199
419
|
result: response.result
|
|
200
420
|
});
|
|
@@ -207,8 +427,6 @@ var _SocketService = class _SocketService {
|
|
|
207
427
|
}
|
|
208
428
|
}
|
|
209
429
|
};
|
|
210
|
-
_SocketService.wsUrl = "https://pb-test-ws.apolopay.app";
|
|
211
|
-
var SocketService = _SocketService;
|
|
212
430
|
|
|
213
431
|
// src/services/payment-service.ts
|
|
214
432
|
var PaymentService = class {
|
|
@@ -231,7 +449,6 @@ var PaymentService = class {
|
|
|
231
449
|
processId: session.processId,
|
|
232
450
|
publicKey: this.client.getPublicKey()
|
|
233
451
|
});
|
|
234
|
-
console.log("qrData", qrData);
|
|
235
452
|
this.socket.connect(session);
|
|
236
453
|
return qrData.result;
|
|
237
454
|
}
|
|
@@ -248,150 +465,10 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
|
|
|
248
465
|
ModalStep2[ModalStep2["RESULT"] = 3] = "RESULT";
|
|
249
466
|
return ModalStep2;
|
|
250
467
|
})(ModalStep || {});
|
|
251
|
-
|
|
252
|
-
// src/i18n/es.ts
|
|
253
|
-
var es = {
|
|
254
|
-
trigger: {
|
|
255
|
-
loading: "Cargando..."
|
|
256
|
-
},
|
|
257
|
-
modal: {
|
|
258
|
-
titles: {
|
|
259
|
-
selectAsset: 'Selecciona el <span class="highlight">stablecoin</span>',
|
|
260
|
-
selectNetwork: 'Selecciona la <span class="highlight">red</span>',
|
|
261
|
-
scanQr: 'Dep\xF3sito <span class="highlight">{symbol}</span>',
|
|
262
|
-
success: '\xA1Gracias por <span class="highlight">tu compra!</span>',
|
|
263
|
-
error: "Error en el Pago",
|
|
264
|
-
idle: "Estado inesperado"
|
|
265
|
-
},
|
|
266
|
-
subtitles: {
|
|
267
|
-
selectAsset: "Selecciona la stablecoin con la que deseas pagar",
|
|
268
|
-
selectNetwork: "Selecciona la red de tu preferencia",
|
|
269
|
-
idle: "Ocurrio un error inesperado"
|
|
270
|
-
},
|
|
271
|
-
actions: {
|
|
272
|
-
back: "Volver",
|
|
273
|
-
close: "Cerrar",
|
|
274
|
-
support: "Soporte",
|
|
275
|
-
scanApp: 'Escanea con tu celular y continua desde la app de <span style="color: var(--apolo-accent)">Apolo Pay</span>',
|
|
276
|
-
copy: "Copiar",
|
|
277
|
-
copied: "\xA1Copiado!",
|
|
278
|
-
payFromDevice: "Pagar desde este dispositivo"
|
|
279
|
-
},
|
|
280
|
-
labels: {
|
|
281
|
-
network: "Red",
|
|
282
|
-
address: "Direcci\xF3n de dep\xF3sito",
|
|
283
|
-
amount: "Monto",
|
|
284
|
-
product: "Producto o Servicio",
|
|
285
|
-
minutes: "min",
|
|
286
|
-
seconds: "seg"
|
|
287
|
-
},
|
|
288
|
-
warnings: {
|
|
289
|
-
networkMatch: "Aseg\xFArate de que la <strong>red de tu wallet coincida</strong> con la red de destino.",
|
|
290
|
-
noNFT: "No env\xEDes NFTs a esta wallet.",
|
|
291
|
-
onlyToken: "Solo se aceptan <strong>dep\xF3sitos en {symbol}</strong>. El env\xEDo de otro tipo de token podr\xEDa resultar en su p\xE9rdida.",
|
|
292
|
-
timer: "Realiza el pago dentro del tiempo indicado. <strong>{time}</strong> De lo contrario, el c\xF3digo QR se vencer\xE1.",
|
|
293
|
-
selectNetworkLater: "Luego podr\xE1s seleccionar la red de tu preferencia"
|
|
294
|
-
},
|
|
295
|
-
success: {
|
|
296
|
-
message: "Tu pago fue exitoso y en breve recibir\xE1s un correo",
|
|
297
|
-
message2: "con los detalles.",
|
|
298
|
-
details: "Detalles de la compra",
|
|
299
|
-
support: "Cualquier duda o inquietud puedes comunicarte con soporte"
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
errors: {
|
|
303
|
-
generic: "Ocurri\xF3 un error inesperado.",
|
|
304
|
-
publicKeyMissing: "Falta la Public Key",
|
|
305
|
-
config: "Error de Configuraci\xF3n",
|
|
306
|
-
timeout: "El tiempo para realizar el pago ha expirado. Por favor genera una nueva orden."
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
// src/i18n/en.ts
|
|
311
|
-
var en = {
|
|
312
|
-
trigger: {
|
|
313
|
-
loading: "Loading..."
|
|
314
|
-
},
|
|
315
|
-
modal: {
|
|
316
|
-
titles: {
|
|
317
|
-
selectAsset: 'Select <span class="highlight">stablecoin</span>',
|
|
318
|
-
selectNetwork: 'Select <span class="highlight">network</span>',
|
|
319
|
-
scanQr: 'Deposit <span class="highlight">{symbol}</span>',
|
|
320
|
-
success: 'Thanks for <span class="highlight">your purchase!</span>',
|
|
321
|
-
error: "Payment Error",
|
|
322
|
-
idle: "Unexpected state"
|
|
323
|
-
},
|
|
324
|
-
subtitles: {
|
|
325
|
-
selectAsset: "Select the stablecoin you want to pay with",
|
|
326
|
-
selectNetwork: "Select your preferred network",
|
|
327
|
-
idle: "An Unexpected error occurred"
|
|
328
|
-
},
|
|
329
|
-
actions: {
|
|
330
|
-
back: "Back",
|
|
331
|
-
close: "Close",
|
|
332
|
-
support: "Support",
|
|
333
|
-
scanApp: 'Scan with your phone and continue from <br><span style="color: var(--apolo-accent)">Apolo Pay</span> app',
|
|
334
|
-
copy: "Copy",
|
|
335
|
-
copied: "Copied!",
|
|
336
|
-
payFromDevice: "Pay from this device"
|
|
337
|
-
},
|
|
338
|
-
labels: {
|
|
339
|
-
network: "Network",
|
|
340
|
-
address: "Deposit Address",
|
|
341
|
-
amount: "Amount",
|
|
342
|
-
product: "Product or Service",
|
|
343
|
-
minutes: "min",
|
|
344
|
-
seconds: "sec"
|
|
345
|
-
},
|
|
346
|
-
warnings: {
|
|
347
|
-
networkMatch: "Ensure your <strong>wallet network matches</strong> the destination network.",
|
|
348
|
-
noNFT: "Do not send NFTs to this wallet.",
|
|
349
|
-
onlyToken: "Only <strong>{symbol} deposits</strong> are accepted. Sending other tokens may result in loss.",
|
|
350
|
-
timer: "Complete payment within <strong>{time}</strong>. Otherwise, the QR code will expire.",
|
|
351
|
-
selectNetworkLater: "You will be able to select your preferred network later"
|
|
352
|
-
},
|
|
353
|
-
success: {
|
|
354
|
-
message: "Your payment was successful. You will receive an email",
|
|
355
|
-
message2: "shortly.",
|
|
356
|
-
details: "Purchase Details",
|
|
357
|
-
support: "Any doubt or inquiry you can contact support"
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
errors: {
|
|
361
|
-
generic: "An unexpected error occurred.",
|
|
362
|
-
publicKeyMissing: "Public Key is missing",
|
|
363
|
-
config: "Config Error",
|
|
364
|
-
timeout: "The payment time has expired. Please generate a new order."
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
// src/i18n/index.ts
|
|
369
|
-
var I18nService = class {
|
|
370
|
-
// Cambiar idioma
|
|
371
|
-
static setLocale(locale) {
|
|
372
|
-
this._currentLocale = locale;
|
|
373
|
-
this._dictionary = locale === "en" ? en : es;
|
|
374
|
-
}
|
|
375
|
-
static get current() {
|
|
376
|
-
return this._currentLocale;
|
|
377
|
-
}
|
|
378
|
-
// Función para obtener texto (Tipado seguro para claves anidadas sería complejo,
|
|
379
|
-
// así que usaremos acceso directo o un getter helper si lo prefieres)
|
|
380
|
-
static get t() {
|
|
381
|
-
return this._dictionary;
|
|
382
|
-
}
|
|
383
|
-
// Helper para interpolar variables: "Hola {name}" -> "Hola Mundo"
|
|
384
|
-
static interpolate(text, params) {
|
|
385
|
-
return text.replace(/{(\w+)}/g, (match, key) => {
|
|
386
|
-
return typeof params[key] !== "undefined" ? String(params[key]) : match;
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
I18nService._currentLocale = "es";
|
|
391
|
-
I18nService._dictionary = es;
|
|
392
468
|
// Annotate the CommonJS export names for ESM import in node:
|
|
393
469
|
0 && (module.exports = {
|
|
394
470
|
ApoloPayClient,
|
|
471
|
+
ClientCode,
|
|
395
472
|
ClientError,
|
|
396
473
|
ClientResponse,
|
|
397
474
|
ClientResponseBase,
|