vk-payments 0.2.13 → 0.2.15
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/bundles/vk-payments.umd.js +160 -54
- package/bundles/vk-payments.umd.js.map +1 -1
- package/bundles/vk-payments.umd.min.js +1 -1
- package/bundles/vk-payments.umd.min.js.map +1 -1
- package/esm2015/lib/go-cuotas/components/go-cuotas.component.js +3 -2
- package/esm2015/lib/modo/components/modo/modo.component.js +146 -48
- package/esm5/lib/go-cuotas/components/go-cuotas.component.js +3 -2
- package/esm5/lib/modo/components/modo/modo.component.js +160 -54
- package/fesm2015/vk-payments.js +147 -49
- package/fesm2015/vk-payments.js.map +1 -1
- package/fesm5/vk-payments.js +161 -55
- package/fesm5/vk-payments.js.map +1 -1
- package/lib/modo/components/modo/modo.component.d.ts +8 -5
- package/package.json +1 -1
- package/vk-payments.metadata.json +1 -1
package/fesm5/vk-payments.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable, ɵɵdefineInjectable, ɵɵinject, EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { Router, RouterModule } from '@angular/router';
|
|
4
|
+
import { Router, RouterModule, ActivatedRoute } from '@angular/router';
|
|
5
5
|
import { __values, __awaiter, __generator } from 'tslib';
|
|
6
6
|
import { HttpHeaders, HttpClient, HttpClientModule } from '@angular/common/http';
|
|
7
7
|
import sha256 from 'sha256';
|
|
@@ -2675,7 +2675,8 @@ var GoCuotasComponent = /** @class */ (function () {
|
|
|
2675
2675
|
this.installments = 0;
|
|
2676
2676
|
this.currentInstallments = [
|
|
2677
2677
|
{ value: 2, label: '2 Cuotas' },
|
|
2678
|
-
{ value: 3, label: '3 Cuotas' }
|
|
2678
|
+
{ value: 3, label: '3 Cuotas' },
|
|
2679
|
+
{ value: 4, label: '4 Cuotas' }
|
|
2679
2680
|
]; // Opciones para "Cantidad de cuotas"
|
|
2680
2681
|
this.totalAmount = Number(this.paymentAmount);
|
|
2681
2682
|
};
|
|
@@ -3313,10 +3314,12 @@ if (false) {
|
|
|
3313
3314
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3314
3315
|
*/
|
|
3315
3316
|
var ModoComponent = /** @class */ (function () {
|
|
3316
|
-
function ModoComponent(modoApi) {
|
|
3317
|
+
function ModoComponent(modoApi, route) {
|
|
3317
3318
|
this.modoApi = modoApi;
|
|
3319
|
+
this.route = route;
|
|
3318
3320
|
this.statusPay = new EventEmitter();
|
|
3319
3321
|
this.isLoading = false;
|
|
3322
|
+
this.executionEnv = 'desktop';
|
|
3320
3323
|
}
|
|
3321
3324
|
/**
|
|
3322
3325
|
* @return {?}
|
|
@@ -3325,7 +3328,47 @@ var ModoComponent = /** @class */ (function () {
|
|
|
3325
3328
|
* @return {?}
|
|
3326
3329
|
*/
|
|
3327
3330
|
function () {
|
|
3328
|
-
this.
|
|
3331
|
+
this.detectEnvironment();
|
|
3332
|
+
if (this.executionEnv === 'desktop') {
|
|
3333
|
+
this.loadModoScript();
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
/**
|
|
3337
|
+
* @private
|
|
3338
|
+
* @return {?}
|
|
3339
|
+
*/
|
|
3340
|
+
ModoComponent.prototype.detectEnvironment = /**
|
|
3341
|
+
* @private
|
|
3342
|
+
* @return {?}
|
|
3343
|
+
*/
|
|
3344
|
+
function () {
|
|
3345
|
+
try {
|
|
3346
|
+
/** @type {?} */
|
|
3347
|
+
var params = this.route.snapshot.params;
|
|
3348
|
+
/** @type {?} */
|
|
3349
|
+
var guid = params['guid'];
|
|
3350
|
+
/** @type {?} */
|
|
3351
|
+
var platform = (/** @type {?} */ (params['platform']));
|
|
3352
|
+
if (platform === 'iOS' || platform === 'Android' || guid === 'app') {
|
|
3353
|
+
this.executionEnv = 'native-app';
|
|
3354
|
+
this.devicePlatform = platform;
|
|
3355
|
+
console.log("MODO Payment: Entorno detectado -> Nativo (" + (this.devicePlatform || 'app') + ")");
|
|
3356
|
+
return;
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
catch (error) {
|
|
3360
|
+
console.warn('MODO Payment: No se pudo leer los parámetros de la ruta. Se continuará con la detección por User Agent.');
|
|
3361
|
+
}
|
|
3362
|
+
/** @type {?} */
|
|
3363
|
+
var userAgent = navigator.userAgent || navigator.vendor || ((/** @type {?} */ (window))).opera;
|
|
3364
|
+
if (/android/i.test(userAgent) || /iPad|iPhone|iPod/.test(userAgent)) {
|
|
3365
|
+
this.executionEnv = 'mobile-browser';
|
|
3366
|
+
console.log('MODO Payment: Entorno detectado -> Navegador Móvil');
|
|
3367
|
+
}
|
|
3368
|
+
else {
|
|
3369
|
+
this.executionEnv = 'desktop';
|
|
3370
|
+
console.log('MODO Payment: Entorno detectado -> Desktop');
|
|
3371
|
+
}
|
|
3329
3372
|
};
|
|
3330
3373
|
/**
|
|
3331
3374
|
* @return {?}
|
|
@@ -3335,8 +3378,7 @@ var ModoComponent = /** @class */ (function () {
|
|
|
3335
3378
|
*/
|
|
3336
3379
|
function () {
|
|
3337
3380
|
return __awaiter(this, void 0, void 0, function () {
|
|
3338
|
-
var
|
|
3339
|
-
var _this = this;
|
|
3381
|
+
var initialData, error_1;
|
|
3340
3382
|
return __generator(this, function (_a) {
|
|
3341
3383
|
switch (_a.label) {
|
|
3342
3384
|
case 0:
|
|
@@ -3346,49 +3388,23 @@ var ModoComponent = /** @class */ (function () {
|
|
|
3346
3388
|
_a.trys.push([1, 3, , 4]);
|
|
3347
3389
|
return [4 /*yield*/, this.createModoPayment()];
|
|
3348
3390
|
case 2:
|
|
3349
|
-
|
|
3391
|
+
initialData = _a.sent();
|
|
3350
3392
|
this.isLoading = false;
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
* @return {?}
|
|
3367
|
-
*/
|
|
3368
|
-
function () {
|
|
3369
|
-
_this.statusPay.emit({ success: true, paymentId: initialData_1.checkoutId });
|
|
3370
|
-
}),
|
|
3371
|
-
onFailure: (/**
|
|
3372
|
-
* @return {?}
|
|
3373
|
-
*/
|
|
3374
|
-
function () {
|
|
3375
|
-
_this.statusPay.emit({ success: false, paymentId: initialData_1.checkoutId });
|
|
3376
|
-
}),
|
|
3377
|
-
onCancel: (/**
|
|
3378
|
-
* @return {?}
|
|
3379
|
-
*/
|
|
3380
|
-
function () {
|
|
3381
|
-
console.log('Pago cancelado por el usuario en el celular.');
|
|
3382
|
-
}),
|
|
3383
|
-
onClose: (/**
|
|
3384
|
-
* @return {?}
|
|
3385
|
-
*/
|
|
3386
|
-
function () {
|
|
3387
|
-
console.log('Modal de MODO cerrado.');
|
|
3388
|
-
}),
|
|
3389
|
-
};
|
|
3390
|
-
// 3. Inicia el SDK de MODO
|
|
3391
|
-
ModoSDK.modoInitPayment(modalObject);
|
|
3393
|
+
switch (this.executionEnv) {
|
|
3394
|
+
case 'native-app':
|
|
3395
|
+
// Llama a la función nativa para abrir en un navegador externo
|
|
3396
|
+
this.openOnNativeNavigator(initialData.deeplink);
|
|
3397
|
+
break;
|
|
3398
|
+
case 'mobile-browser':
|
|
3399
|
+
// Abre el deeplink en una nueva pestaña
|
|
3400
|
+
window.open(initialData.deeplink, '_blank');
|
|
3401
|
+
break;
|
|
3402
|
+
case 'desktop':
|
|
3403
|
+
default:
|
|
3404
|
+
// Abrir el modal del SDK
|
|
3405
|
+
this.initModoSdkModal(initialData);
|
|
3406
|
+
break;
|
|
3407
|
+
}
|
|
3392
3408
|
return [3 /*break*/, 4];
|
|
3393
3409
|
case 3:
|
|
3394
3410
|
error_1 = _a.sent();
|
|
@@ -3402,18 +3418,92 @@ var ModoComponent = /** @class */ (function () {
|
|
|
3402
3418
|
});
|
|
3403
3419
|
};
|
|
3404
3420
|
/**
|
|
3405
|
-
*
|
|
3406
|
-
*
|
|
3421
|
+
* @private
|
|
3422
|
+
* @param {?} url
|
|
3423
|
+
* @return {?}
|
|
3407
3424
|
*/
|
|
3425
|
+
ModoComponent.prototype.openOnNativeNavigator = /**
|
|
3426
|
+
* @private
|
|
3427
|
+
* @param {?} url
|
|
3428
|
+
* @return {?}
|
|
3429
|
+
*/
|
|
3430
|
+
function (url) {
|
|
3431
|
+
try {
|
|
3432
|
+
if (this.devicePlatform === 'iOS') {
|
|
3433
|
+
((/** @type {?} */ (window))).webkit.messageHandlers.externalURL.postMessage(url);
|
|
3434
|
+
}
|
|
3435
|
+
else if (this.devicePlatform === 'Android') {
|
|
3436
|
+
((/** @type {?} */ (window))).externalURL.postMessage(url);
|
|
3437
|
+
}
|
|
3438
|
+
else {
|
|
3439
|
+
// Fallback si por alguna razón no se detectó la plataforma pero sí el entorno nativo
|
|
3440
|
+
window.open(url, '_blank');
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
catch (e) {
|
|
3444
|
+
console.error('Error al intentar invocar el message handler nativo:', e);
|
|
3445
|
+
}
|
|
3446
|
+
};
|
|
3447
|
+
/**
|
|
3448
|
+
* @private
|
|
3449
|
+
* @param {?} initialData
|
|
3450
|
+
* @return {?}
|
|
3451
|
+
*/
|
|
3452
|
+
ModoComponent.prototype.initModoSdkModal = /**
|
|
3453
|
+
* @private
|
|
3454
|
+
* @param {?} initialData
|
|
3455
|
+
* @return {?}
|
|
3456
|
+
*/
|
|
3457
|
+
function (initialData) {
|
|
3458
|
+
var _this = this;
|
|
3459
|
+
/** @type {?} */
|
|
3460
|
+
var modalObject = {
|
|
3461
|
+
version: '2',
|
|
3462
|
+
qrString: initialData.qrString,
|
|
3463
|
+
checkoutId: initialData.checkoutId,
|
|
3464
|
+
deeplink: {
|
|
3465
|
+
url: initialData.deeplink,
|
|
3466
|
+
callbackURL: this.callbackUrl,
|
|
3467
|
+
callbackURLSuccess: this.callbackUrlSuccess
|
|
3468
|
+
},
|
|
3469
|
+
callbackURL: this.callbackUrl,
|
|
3470
|
+
refreshData: (/**
|
|
3471
|
+
* @return {?}
|
|
3472
|
+
*/
|
|
3473
|
+
function () { return _this.createModoPayment(); }),
|
|
3474
|
+
onSuccess: (/**
|
|
3475
|
+
* @return {?}
|
|
3476
|
+
*/
|
|
3477
|
+
function () {
|
|
3478
|
+
_this.statusPay.emit({ success: true, paymentId: initialData.checkoutId });
|
|
3479
|
+
}),
|
|
3480
|
+
onFailure: (/**
|
|
3481
|
+
* @return {?}
|
|
3482
|
+
*/
|
|
3483
|
+
function () {
|
|
3484
|
+
_this.statusPay.emit({ success: false, paymentId: initialData.checkoutId });
|
|
3485
|
+
}),
|
|
3486
|
+
onCancel: (/**
|
|
3487
|
+
* @return {?}
|
|
3488
|
+
*/
|
|
3489
|
+
function () {
|
|
3490
|
+
console.log('Pago cancelado por el usuario en el celular.');
|
|
3491
|
+
}),
|
|
3492
|
+
onClose: (/**
|
|
3493
|
+
* @return {?}
|
|
3494
|
+
*/
|
|
3495
|
+
function () {
|
|
3496
|
+
console.log('Modal de MODO cerrado.');
|
|
3497
|
+
}),
|
|
3498
|
+
};
|
|
3499
|
+
// 3. Inicia el SDK de MODO
|
|
3500
|
+
ModoSDK.modoInitPayment(modalObject);
|
|
3501
|
+
};
|
|
3408
3502
|
/**
|
|
3409
|
-
* Esta función se encarga de llamar a tu backend.
|
|
3410
|
-
* Se usa tanto para la carga inicial como para el refresco del SDK.
|
|
3411
3503
|
* @private
|
|
3412
3504
|
* @return {?}
|
|
3413
3505
|
*/
|
|
3414
3506
|
ModoComponent.prototype.createModoPayment = /**
|
|
3415
|
-
* Esta función se encarga de llamar a tu backend.
|
|
3416
|
-
* Se usa tanto para la carga inicial como para el refresco del SDK.
|
|
3417
3507
|
* @private
|
|
3418
3508
|
* @return {?}
|
|
3419
3509
|
*/
|
|
@@ -3475,7 +3565,8 @@ var ModoComponent = /** @class */ (function () {
|
|
|
3475
3565
|
];
|
|
3476
3566
|
/** @nocollapse */
|
|
3477
3567
|
ModoComponent.ctorParameters = function () { return [
|
|
3478
|
-
{ type: ModoApiService }
|
|
3568
|
+
{ type: ModoApiService },
|
|
3569
|
+
{ type: ActivatedRoute }
|
|
3479
3570
|
]; };
|
|
3480
3571
|
ModoComponent.propDecorators = {
|
|
3481
3572
|
accessToken: [{ type: Input }],
|
|
@@ -3514,11 +3605,26 @@ if (false) {
|
|
|
3514
3605
|
ModoComponent.prototype.statusPay;
|
|
3515
3606
|
/** @type {?} */
|
|
3516
3607
|
ModoComponent.prototype.isLoading;
|
|
3608
|
+
/**
|
|
3609
|
+
* @type {?}
|
|
3610
|
+
* @private
|
|
3611
|
+
*/
|
|
3612
|
+
ModoComponent.prototype.executionEnv;
|
|
3613
|
+
/**
|
|
3614
|
+
* @type {?}
|
|
3615
|
+
* @private
|
|
3616
|
+
*/
|
|
3617
|
+
ModoComponent.prototype.devicePlatform;
|
|
3517
3618
|
/**
|
|
3518
3619
|
* @type {?}
|
|
3519
3620
|
* @private
|
|
3520
3621
|
*/
|
|
3521
3622
|
ModoComponent.prototype.modoApi;
|
|
3623
|
+
/**
|
|
3624
|
+
* @type {?}
|
|
3625
|
+
* @private
|
|
3626
|
+
*/
|
|
3627
|
+
ModoComponent.prototype.route;
|
|
3522
3628
|
}
|
|
3523
3629
|
|
|
3524
3630
|
/**
|