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
|
@@ -2872,7 +2872,8 @@
|
|
|
2872
2872
|
this.installments = 0;
|
|
2873
2873
|
this.currentInstallments = [
|
|
2874
2874
|
{ value: 2, label: '2 Cuotas' },
|
|
2875
|
-
{ value: 3, label: '3 Cuotas' }
|
|
2875
|
+
{ value: 3, label: '3 Cuotas' },
|
|
2876
|
+
{ value: 4, label: '4 Cuotas' }
|
|
2876
2877
|
]; // Opciones para "Cantidad de cuotas"
|
|
2877
2878
|
this.totalAmount = Number(this.paymentAmount);
|
|
2878
2879
|
};
|
|
@@ -3510,10 +3511,12 @@
|
|
|
3510
3511
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3511
3512
|
*/
|
|
3512
3513
|
var ModoComponent = /** @class */ (function () {
|
|
3513
|
-
function ModoComponent(modoApi) {
|
|
3514
|
+
function ModoComponent(modoApi, route) {
|
|
3514
3515
|
this.modoApi = modoApi;
|
|
3516
|
+
this.route = route;
|
|
3515
3517
|
this.statusPay = new core.EventEmitter();
|
|
3516
3518
|
this.isLoading = false;
|
|
3519
|
+
this.executionEnv = 'desktop';
|
|
3517
3520
|
}
|
|
3518
3521
|
/**
|
|
3519
3522
|
* @return {?}
|
|
@@ -3522,7 +3525,47 @@
|
|
|
3522
3525
|
* @return {?}
|
|
3523
3526
|
*/
|
|
3524
3527
|
function () {
|
|
3525
|
-
this.
|
|
3528
|
+
this.detectEnvironment();
|
|
3529
|
+
if (this.executionEnv === 'desktop') {
|
|
3530
|
+
this.loadModoScript();
|
|
3531
|
+
}
|
|
3532
|
+
};
|
|
3533
|
+
/**
|
|
3534
|
+
* @private
|
|
3535
|
+
* @return {?}
|
|
3536
|
+
*/
|
|
3537
|
+
ModoComponent.prototype.detectEnvironment = /**
|
|
3538
|
+
* @private
|
|
3539
|
+
* @return {?}
|
|
3540
|
+
*/
|
|
3541
|
+
function () {
|
|
3542
|
+
try {
|
|
3543
|
+
/** @type {?} */
|
|
3544
|
+
var params = this.route.snapshot.params;
|
|
3545
|
+
/** @type {?} */
|
|
3546
|
+
var guid = params['guid'];
|
|
3547
|
+
/** @type {?} */
|
|
3548
|
+
var platform = (/** @type {?} */ (params['platform']));
|
|
3549
|
+
if (platform === 'iOS' || platform === 'Android' || guid === 'app') {
|
|
3550
|
+
this.executionEnv = 'native-app';
|
|
3551
|
+
this.devicePlatform = platform;
|
|
3552
|
+
console.log("MODO Payment: Entorno detectado -> Nativo (" + (this.devicePlatform || 'app') + ")");
|
|
3553
|
+
return;
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
catch (error) {
|
|
3557
|
+
console.warn('MODO Payment: No se pudo leer los parámetros de la ruta. Se continuará con la detección por User Agent.');
|
|
3558
|
+
}
|
|
3559
|
+
/** @type {?} */
|
|
3560
|
+
var userAgent = navigator.userAgent || navigator.vendor || ((/** @type {?} */ (window))).opera;
|
|
3561
|
+
if (/android/i.test(userAgent) || /iPad|iPhone|iPod/.test(userAgent)) {
|
|
3562
|
+
this.executionEnv = 'mobile-browser';
|
|
3563
|
+
console.log('MODO Payment: Entorno detectado -> Navegador Móvil');
|
|
3564
|
+
}
|
|
3565
|
+
else {
|
|
3566
|
+
this.executionEnv = 'desktop';
|
|
3567
|
+
console.log('MODO Payment: Entorno detectado -> Desktop');
|
|
3568
|
+
}
|
|
3526
3569
|
};
|
|
3527
3570
|
/**
|
|
3528
3571
|
* @return {?}
|
|
@@ -3532,8 +3575,7 @@
|
|
|
3532
3575
|
*/
|
|
3533
3576
|
function () {
|
|
3534
3577
|
return __awaiter(this, void 0, void 0, function () {
|
|
3535
|
-
var
|
|
3536
|
-
var _this = this;
|
|
3578
|
+
var initialData, error_1;
|
|
3537
3579
|
return __generator(this, function (_a) {
|
|
3538
3580
|
switch (_a.label) {
|
|
3539
3581
|
case 0:
|
|
@@ -3543,49 +3585,23 @@
|
|
|
3543
3585
|
_a.trys.push([1, 3, , 4]);
|
|
3544
3586
|
return [4 /*yield*/, this.createModoPayment()];
|
|
3545
3587
|
case 2:
|
|
3546
|
-
|
|
3588
|
+
initialData = _a.sent();
|
|
3547
3589
|
this.isLoading = false;
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
* @return {?}
|
|
3564
|
-
*/
|
|
3565
|
-
function () {
|
|
3566
|
-
_this.statusPay.emit({ success: true, paymentId: initialData_1.checkoutId });
|
|
3567
|
-
}),
|
|
3568
|
-
onFailure: (/**
|
|
3569
|
-
* @return {?}
|
|
3570
|
-
*/
|
|
3571
|
-
function () {
|
|
3572
|
-
_this.statusPay.emit({ success: false, paymentId: initialData_1.checkoutId });
|
|
3573
|
-
}),
|
|
3574
|
-
onCancel: (/**
|
|
3575
|
-
* @return {?}
|
|
3576
|
-
*/
|
|
3577
|
-
function () {
|
|
3578
|
-
console.log('Pago cancelado por el usuario en el celular.');
|
|
3579
|
-
}),
|
|
3580
|
-
onClose: (/**
|
|
3581
|
-
* @return {?}
|
|
3582
|
-
*/
|
|
3583
|
-
function () {
|
|
3584
|
-
console.log('Modal de MODO cerrado.');
|
|
3585
|
-
}),
|
|
3586
|
-
};
|
|
3587
|
-
// 3. Inicia el SDK de MODO
|
|
3588
|
-
ModoSDK.modoInitPayment(modalObject);
|
|
3590
|
+
switch (this.executionEnv) {
|
|
3591
|
+
case 'native-app':
|
|
3592
|
+
// Llama a la función nativa para abrir en un navegador externo
|
|
3593
|
+
this.openOnNativeNavigator(initialData.deeplink);
|
|
3594
|
+
break;
|
|
3595
|
+
case 'mobile-browser':
|
|
3596
|
+
// Abre el deeplink en una nueva pestaña
|
|
3597
|
+
window.open(initialData.deeplink, '_blank');
|
|
3598
|
+
break;
|
|
3599
|
+
case 'desktop':
|
|
3600
|
+
default:
|
|
3601
|
+
// Abrir el modal del SDK
|
|
3602
|
+
this.initModoSdkModal(initialData);
|
|
3603
|
+
break;
|
|
3604
|
+
}
|
|
3589
3605
|
return [3 /*break*/, 4];
|
|
3590
3606
|
case 3:
|
|
3591
3607
|
error_1 = _a.sent();
|
|
@@ -3599,18 +3615,92 @@
|
|
|
3599
3615
|
});
|
|
3600
3616
|
};
|
|
3601
3617
|
/**
|
|
3602
|
-
*
|
|
3603
|
-
*
|
|
3618
|
+
* @private
|
|
3619
|
+
* @param {?} url
|
|
3620
|
+
* @return {?}
|
|
3604
3621
|
*/
|
|
3622
|
+
ModoComponent.prototype.openOnNativeNavigator = /**
|
|
3623
|
+
* @private
|
|
3624
|
+
* @param {?} url
|
|
3625
|
+
* @return {?}
|
|
3626
|
+
*/
|
|
3627
|
+
function (url) {
|
|
3628
|
+
try {
|
|
3629
|
+
if (this.devicePlatform === 'iOS') {
|
|
3630
|
+
((/** @type {?} */ (window))).webkit.messageHandlers.externalURL.postMessage(url);
|
|
3631
|
+
}
|
|
3632
|
+
else if (this.devicePlatform === 'Android') {
|
|
3633
|
+
((/** @type {?} */ (window))).externalURL.postMessage(url);
|
|
3634
|
+
}
|
|
3635
|
+
else {
|
|
3636
|
+
// Fallback si por alguna razón no se detectó la plataforma pero sí el entorno nativo
|
|
3637
|
+
window.open(url, '_blank');
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
catch (e) {
|
|
3641
|
+
console.error('Error al intentar invocar el message handler nativo:', e);
|
|
3642
|
+
}
|
|
3643
|
+
};
|
|
3644
|
+
/**
|
|
3645
|
+
* @private
|
|
3646
|
+
* @param {?} initialData
|
|
3647
|
+
* @return {?}
|
|
3648
|
+
*/
|
|
3649
|
+
ModoComponent.prototype.initModoSdkModal = /**
|
|
3650
|
+
* @private
|
|
3651
|
+
* @param {?} initialData
|
|
3652
|
+
* @return {?}
|
|
3653
|
+
*/
|
|
3654
|
+
function (initialData) {
|
|
3655
|
+
var _this = this;
|
|
3656
|
+
/** @type {?} */
|
|
3657
|
+
var modalObject = {
|
|
3658
|
+
version: '2',
|
|
3659
|
+
qrString: initialData.qrString,
|
|
3660
|
+
checkoutId: initialData.checkoutId,
|
|
3661
|
+
deeplink: {
|
|
3662
|
+
url: initialData.deeplink,
|
|
3663
|
+
callbackURL: this.callbackUrl,
|
|
3664
|
+
callbackURLSuccess: this.callbackUrlSuccess
|
|
3665
|
+
},
|
|
3666
|
+
callbackURL: this.callbackUrl,
|
|
3667
|
+
refreshData: (/**
|
|
3668
|
+
* @return {?}
|
|
3669
|
+
*/
|
|
3670
|
+
function () { return _this.createModoPayment(); }),
|
|
3671
|
+
onSuccess: (/**
|
|
3672
|
+
* @return {?}
|
|
3673
|
+
*/
|
|
3674
|
+
function () {
|
|
3675
|
+
_this.statusPay.emit({ success: true, paymentId: initialData.checkoutId });
|
|
3676
|
+
}),
|
|
3677
|
+
onFailure: (/**
|
|
3678
|
+
* @return {?}
|
|
3679
|
+
*/
|
|
3680
|
+
function () {
|
|
3681
|
+
_this.statusPay.emit({ success: false, paymentId: initialData.checkoutId });
|
|
3682
|
+
}),
|
|
3683
|
+
onCancel: (/**
|
|
3684
|
+
* @return {?}
|
|
3685
|
+
*/
|
|
3686
|
+
function () {
|
|
3687
|
+
console.log('Pago cancelado por el usuario en el celular.');
|
|
3688
|
+
}),
|
|
3689
|
+
onClose: (/**
|
|
3690
|
+
* @return {?}
|
|
3691
|
+
*/
|
|
3692
|
+
function () {
|
|
3693
|
+
console.log('Modal de MODO cerrado.');
|
|
3694
|
+
}),
|
|
3695
|
+
};
|
|
3696
|
+
// 3. Inicia el SDK de MODO
|
|
3697
|
+
ModoSDK.modoInitPayment(modalObject);
|
|
3698
|
+
};
|
|
3605
3699
|
/**
|
|
3606
|
-
* Esta función se encarga de llamar a tu backend.
|
|
3607
|
-
* Se usa tanto para la carga inicial como para el refresco del SDK.
|
|
3608
3700
|
* @private
|
|
3609
3701
|
* @return {?}
|
|
3610
3702
|
*/
|
|
3611
3703
|
ModoComponent.prototype.createModoPayment = /**
|
|
3612
|
-
* Esta función se encarga de llamar a tu backend.
|
|
3613
|
-
* Se usa tanto para la carga inicial como para el refresco del SDK.
|
|
3614
3704
|
* @private
|
|
3615
3705
|
* @return {?}
|
|
3616
3706
|
*/
|
|
@@ -3672,7 +3762,8 @@
|
|
|
3672
3762
|
];
|
|
3673
3763
|
/** @nocollapse */
|
|
3674
3764
|
ModoComponent.ctorParameters = function () { return [
|
|
3675
|
-
{ type: ModoApiService }
|
|
3765
|
+
{ type: ModoApiService },
|
|
3766
|
+
{ type: router.ActivatedRoute }
|
|
3676
3767
|
]; };
|
|
3677
3768
|
ModoComponent.propDecorators = {
|
|
3678
3769
|
accessToken: [{ type: core.Input }],
|
|
@@ -3711,11 +3802,26 @@
|
|
|
3711
3802
|
ModoComponent.prototype.statusPay;
|
|
3712
3803
|
/** @type {?} */
|
|
3713
3804
|
ModoComponent.prototype.isLoading;
|
|
3805
|
+
/**
|
|
3806
|
+
* @type {?}
|
|
3807
|
+
* @private
|
|
3808
|
+
*/
|
|
3809
|
+
ModoComponent.prototype.executionEnv;
|
|
3810
|
+
/**
|
|
3811
|
+
* @type {?}
|
|
3812
|
+
* @private
|
|
3813
|
+
*/
|
|
3814
|
+
ModoComponent.prototype.devicePlatform;
|
|
3714
3815
|
/**
|
|
3715
3816
|
* @type {?}
|
|
3716
3817
|
* @private
|
|
3717
3818
|
*/
|
|
3718
3819
|
ModoComponent.prototype.modoApi;
|
|
3820
|
+
/**
|
|
3821
|
+
* @type {?}
|
|
3822
|
+
* @private
|
|
3823
|
+
*/
|
|
3824
|
+
ModoComponent.prototype.route;
|
|
3719
3825
|
}
|
|
3720
3826
|
|
|
3721
3827
|
/**
|