@miden-npm/angular 0.0.17 → 0.0.18
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/buzapay-checkout/index.d.ts +111 -10
- package/fesm2022/miden-npm-angular-buzapay-checkout.mjs +666 -26
- package/fesm2022/miden-npm-angular-buzapay-checkout.mjs.map +1 -1
- package/fesm2022/miden-npm-angular.mjs +277 -7
- package/fesm2022/miden-npm-angular.mjs.map +1 -1
- package/index.d.ts +178 -3
- package/package.json +32 -22
|
@@ -4,7 +4,11 @@ import * as i1$1 from '@angular/common/http';
|
|
|
4
4
|
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
5
5
|
import * as i1 from '@angular/common';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
|
-
import
|
|
7
|
+
import * as i3 from '@angular/forms';
|
|
8
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
|
+
import * as i2 from 'angular-imask';
|
|
10
|
+
import { IMaskModule } from 'angular-imask';
|
|
11
|
+
import * as CryptoJS from 'crypto-js';
|
|
8
12
|
|
|
9
13
|
class MidenPGAngular {
|
|
10
14
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: MidenPGAngular, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -422,6 +426,150 @@ const truncateString = (str, num) => {
|
|
|
422
426
|
return str.slice(0, num) + '...';
|
|
423
427
|
};
|
|
424
428
|
|
|
429
|
+
function getValidationErrorMessage(control, fieldLabel = 'This field') {
|
|
430
|
+
if (!control || !control.errors || !control.touched)
|
|
431
|
+
return null;
|
|
432
|
+
if (control.errors['required']) {
|
|
433
|
+
return `${fieldLabel} is required`;
|
|
434
|
+
}
|
|
435
|
+
if (control.errors['minlength']) {
|
|
436
|
+
const requiredLength = control.errors['minlength'].requiredLength;
|
|
437
|
+
return `${fieldLabel} must be at least ${requiredLength} characters`;
|
|
438
|
+
}
|
|
439
|
+
if (control.errors['maxlength']) {
|
|
440
|
+
const requiredLength = control.errors['maxlength'].requiredLength;
|
|
441
|
+
return `${fieldLabel} must be at most ${requiredLength} characters`;
|
|
442
|
+
}
|
|
443
|
+
if (control.errors['pattern']) {
|
|
444
|
+
return `${fieldLabel} format is invalid`;
|
|
445
|
+
}
|
|
446
|
+
return `${fieldLabel} is invalid`;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const urlValidator = () => {
|
|
450
|
+
return (control) => {
|
|
451
|
+
if (!control.value)
|
|
452
|
+
return null;
|
|
453
|
+
// More permissive URL pattern that accepts localhost and various URL formats
|
|
454
|
+
const urlPattern = /^(https?:\/\/)?([\w\-]+(\.[\w\-]+)*|localhost)(:\d+)?([\w\-\._~:/?#[\]@!$&'()*+,;=.]+)?$/i;
|
|
455
|
+
return urlPattern.test(control.value) ? null : { invalidUrl: true };
|
|
456
|
+
};
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
var CardSchemes;
|
|
460
|
+
(function (CardSchemes) {
|
|
461
|
+
CardSchemes[CardSchemes["Visa"] = 1] = "Visa";
|
|
462
|
+
CardSchemes[CardSchemes["MasterCard"] = 2] = "MasterCard";
|
|
463
|
+
CardSchemes[CardSchemes["Verve"] = 3] = "Verve";
|
|
464
|
+
CardSchemes[CardSchemes["MastercardAndVisa"] = 4] = "MastercardAndVisa";
|
|
465
|
+
CardSchemes[CardSchemes["AmericanExpress"] = 5] = "AmericanExpress";
|
|
466
|
+
CardSchemes[CardSchemes["Discover"] = 6] = "Discover";
|
|
467
|
+
CardSchemes[CardSchemes["JCB"] = 7] = "JCB";
|
|
468
|
+
CardSchemes[CardSchemes["DinersClub"] = 8] = "DinersClub";
|
|
469
|
+
CardSchemes[CardSchemes["Maestro"] = 9] = "Maestro";
|
|
470
|
+
CardSchemes[CardSchemes["UnionPay"] = 10] = "UnionPay";
|
|
471
|
+
CardSchemes[CardSchemes["UnionPay3DS"] = 11] = "UnionPay3DS";
|
|
472
|
+
CardSchemes[CardSchemes["UnionPayNon3DS"] = 12] = "UnionPayNon3DS";
|
|
473
|
+
CardSchemes[CardSchemes["UATP"] = 13] = "UATP";
|
|
474
|
+
CardSchemes[CardSchemes["PayPak"] = 14] = "PayPak";
|
|
475
|
+
CardSchemes[CardSchemes["Jaywan"] = 15] = "Jaywan";
|
|
476
|
+
CardSchemes[CardSchemes["Mada"] = 16] = "Mada";
|
|
477
|
+
CardSchemes[CardSchemes["MadaVisa"] = 17] = "MadaVisa";
|
|
478
|
+
CardSchemes[CardSchemes["MadaMastercard"] = 18] = "MadaMastercard";
|
|
479
|
+
CardSchemes[CardSchemes["Unknown"] = 19] = "Unknown";
|
|
480
|
+
})(CardSchemes || (CardSchemes = {}));
|
|
481
|
+
// ---------- Generic scheme regexes ----------
|
|
482
|
+
const VISA_RE = /^4\d{12}(\d{3}){0,2}$/; // 13, 16, 19 digits
|
|
483
|
+
const MC_RE = /^(?:5[1-5]\d{14}|2(?:2(?:2[1-9]|[3-9]\d)|[3-6]\d{2}|7(?:[01]\d|20))\d{12})(?:\d{0,3})?$/; // 16-19
|
|
484
|
+
const AMEX_RE = /^(34|37)\d{13}$/; // 15
|
|
485
|
+
const DISCOVER_RE = /^(?:6011|65|64[4-9]|622(?:12[6-9]|1[3-9]\d|[2-8]\d{2}|9(?:0\d|1\d|2[0-5])))\d{12,15}$/; // 16-19
|
|
486
|
+
const JCB_RE = /^(?:35(?:2[8-9]|[3-8]\d))\d{12,15}$/; // 16-19
|
|
487
|
+
const DINERS_RE = /^(?:3(?:0[0-5]\d|095|6\d|[89]\d))\d{11,13}$/; // 14-16
|
|
488
|
+
const MAESTRO_RE = /^(?:50|5[6-9]|6[0-9])\d{10,17}$/; // 12-19
|
|
489
|
+
const UNIONPAY_RE = /^62\d{14,17}$/; // 16-19
|
|
490
|
+
const UATP_RE = /^1\d{14}$/; // 15
|
|
491
|
+
// ---------- Known local/test BINs ----------
|
|
492
|
+
const VERVE_BIN6_RANGES = [
|
|
493
|
+
[506099, 506198],
|
|
494
|
+
[650002, 650027],
|
|
495
|
+
];
|
|
496
|
+
const VERVE_BIN6_SINGLES = new Set([507865, 507866]);
|
|
497
|
+
const PAYPAK_BIN6 = new Set([220545, 220543]);
|
|
498
|
+
const JAYWAN_BIN7 = new Set([6690109]);
|
|
499
|
+
const MADA_ONLY_BIN6 = new Set([968209, 873646]);
|
|
500
|
+
const MADA_VISA_BIN6 = new Set([422818, 486094]);
|
|
501
|
+
const MADA_MC_BIN6 = new Set([529741, 543357]);
|
|
502
|
+
const UNIONPAY_3DS_BIN6 = new Set([620108]);
|
|
503
|
+
const UNIONPAY_NON3DS_BIN6 = new Set([621423]);
|
|
504
|
+
function cardType(cardNumber) {
|
|
505
|
+
const scheme = detect(cardNumber);
|
|
506
|
+
return CardSchemes[scheme]; // numeric enum reverse mapping -> name
|
|
507
|
+
}
|
|
508
|
+
function detect(cardNumber) {
|
|
509
|
+
if (!cardNumber || !cardNumber.trim())
|
|
510
|
+
return CardSchemes.Unknown;
|
|
511
|
+
// Normalize: digits only
|
|
512
|
+
const digits = cardNumber.replace(/\D/g, '');
|
|
513
|
+
if (digits.length < 12 || digits.length > 19)
|
|
514
|
+
return CardSchemes.Unknown;
|
|
515
|
+
// ---------- 1) Exact local/test BIN routing FIRST ----------
|
|
516
|
+
if (digits.length >= 6) {
|
|
517
|
+
const bin6 = parseInt(digits.slice(0, 6), 10);
|
|
518
|
+
// mada-only
|
|
519
|
+
if (MADA_ONLY_BIN6.has(bin6) && digits.length >= 16 && digits.length <= 19)
|
|
520
|
+
return CardSchemes.Mada;
|
|
521
|
+
// mada Visa
|
|
522
|
+
if (MADA_VISA_BIN6.has(bin6) && VISA_RE.test(digits))
|
|
523
|
+
return CardSchemes.MadaVisa;
|
|
524
|
+
// mada Mastercard
|
|
525
|
+
if (MADA_MC_BIN6.has(bin6) && MC_RE.test(digits))
|
|
526
|
+
return CardSchemes.MadaMastercard;
|
|
527
|
+
// PayPak
|
|
528
|
+
if (PAYPAK_BIN6.has(bin6) && digits.length === 16)
|
|
529
|
+
return CardSchemes.PayPak;
|
|
530
|
+
// UnionPay test BINs with 3DS status
|
|
531
|
+
if (UNIONPAY_3DS_BIN6.has(bin6) && UNIONPAY_RE.test(digits))
|
|
532
|
+
return CardSchemes.UnionPay3DS;
|
|
533
|
+
if (UNIONPAY_NON3DS_BIN6.has(bin6) && UNIONPAY_RE.test(digits))
|
|
534
|
+
return CardSchemes.UnionPayNon3DS;
|
|
535
|
+
// Verve
|
|
536
|
+
if (isVerve(bin6, digits.length))
|
|
537
|
+
return CardSchemes.Verve;
|
|
538
|
+
}
|
|
539
|
+
if (digits.length >= 7) {
|
|
540
|
+
const bin7 = parseInt(digits.slice(0, 7), 10);
|
|
541
|
+
// Jaywan
|
|
542
|
+
if (JAYWAN_BIN7.has(bin7) && digits.length === 16)
|
|
543
|
+
return CardSchemes.Jaywan;
|
|
544
|
+
}
|
|
545
|
+
// ---------- 2) Generic schemes ----------
|
|
546
|
+
if (UATP_RE.test(digits))
|
|
547
|
+
return CardSchemes.UATP;
|
|
548
|
+
if (AMEX_RE.test(digits))
|
|
549
|
+
return CardSchemes.AmericanExpress;
|
|
550
|
+
if (DISCOVER_RE.test(digits))
|
|
551
|
+
return CardSchemes.Discover;
|
|
552
|
+
if (JCB_RE.test(digits))
|
|
553
|
+
return CardSchemes.JCB;
|
|
554
|
+
if (DINERS_RE.test(digits))
|
|
555
|
+
return CardSchemes.DinersClub;
|
|
556
|
+
if (MC_RE.test(digits))
|
|
557
|
+
return CardSchemes.MasterCard;
|
|
558
|
+
if (VISA_RE.test(digits))
|
|
559
|
+
return CardSchemes.Visa;
|
|
560
|
+
if (UNIONPAY_RE.test(digits))
|
|
561
|
+
return CardSchemes.UnionPay;
|
|
562
|
+
if (MAESTRO_RE.test(digits))
|
|
563
|
+
return CardSchemes.Maestro;
|
|
564
|
+
return CardSchemes.Unknown;
|
|
565
|
+
}
|
|
566
|
+
function isVerve(bin6, length) {
|
|
567
|
+
if (length < 16 || length > 19)
|
|
568
|
+
return false;
|
|
569
|
+
const inRange = VERVE_BIN6_RANGES.some(([start, end]) => bin6 >= start && bin6 <= end);
|
|
570
|
+
return inRange || VERVE_BIN6_SINGLES.has(bin6);
|
|
571
|
+
}
|
|
572
|
+
|
|
425
573
|
class InputComponent {
|
|
426
574
|
value = '';
|
|
427
575
|
formattedValue = '';
|
|
@@ -493,17 +641,25 @@ class InputComponent {
|
|
|
493
641
|
useExisting: forwardRef(() => InputComponent),
|
|
494
642
|
multi: true,
|
|
495
643
|
},
|
|
496
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <div\n class=\"border-c px-3 py-2 flex items-center justify-between rounded-md h-12\"\n [ngClass]=\"[\n disabled ? 'bg-grey-50 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300 bg-red-50' : 'border-grey-100',\n ]\"\n >\n <ng-content select=\"[slot=prefix]\"></ng-content>\n <input\n [type]=\"type\"\n [
|
|
644
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <div\n class=\"border-c px-3 py-2 flex items-center justify-between rounded-md h-12\"\n [ngClass]=\"[\n disabled ? 'bg-grey-50 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300 bg-red-50' : 'border-grey-100',\n ]\"\n >\n <ng-content select=\"[slot=prefix]\"></ng-content>\n <input\n [type]=\"type\"\n [imask]=\"mask ? { mask, lazy: true } : undefined\"\n [unmask]=\"mask ? 'typed' : false\"\n [(ngModel)]=\"formattedValue\"\n [disabled]=\"disabled\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\"\n [placeholder]=\"placeholder ? placeholder : 'Enter ' + label.toLowerCase()\"\n inputmode=\"decimal\"\n class=\"search-input bg-transparent outline-none border-none focus:outline-none focus:ring-0 text-body-2xs text-light-copy font-normal w-full\"\n />\n\n @if (!loading) {\n <ng-container>\n <ng-content select=\"[slot=suffix]\"></ng-content>\n <!-- Copy icon -->\n @if (showCopyIcon && value && value.trim() !== '') {\n <div class=\"ml-2 flex items-center\">\n <base-image\n src=\"assets/images/copyIcon.svg\"\n alt=\"copy\"\n [width]=\"16\"\n [height]=\"16\"\n class=\"cursor-pointer hover:opacity-70 transition-opacity\"\n (onClick)=\"copyHandler()\"\n ></base-image>\n </div>\n }\n </ng-container>\n } @else {\n <ng-template>\n <icon-loader></icon-loader>\n </ng-template>\n }\n </div>\n @if (hint) {\n <base-hint [hint]=\"hint\"></base-hint>\n }\n @if (validationError) {\n <base-input-error [errorMessage]=\"validationError\"></base-input-error>\n }\n</div>\n", styles: [":host{--select-placeholder-color: #9dbfde}:host .search-input::placeholder{color:var(--select-placeholder-color);opacity:1}:host .search-input::-webkit-input-placeholder{color:var(--select-placeholder-color)}:host .search-input::-moz-placeholder{color:var(--select-placeholder-color)}:host .search-input:-ms-input-placeholder{color:var(--select-placeholder-color)}:host .search-input::-ms-input-placeholder{color:var(--select-placeholder-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconLoaderComponent, selector: "icon-loader", inputs: ["color", "size"] }, { kind: "component", type: HintComponent, selector: "base-hint", inputs: ["hint"] }, { kind: "component", type: InputErrorComponent, selector: "base-input-error", inputs: ["errorMessage"] }, { kind: "component", type: ImageComponent, selector: "base-image", inputs: ["src", "alt", "isFullWidth", "width", "height", "customClass"], outputs: ["onClick"] }, { kind: "ngmodule", type: IMaskModule }, { kind: "directive", type: i2.IMaskDirective, selector: "[imask]", inputs: ["imask", "unmask", "imaskElement"], outputs: ["accept", "complete"], exportAs: ["imask"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
497
645
|
}
|
|
498
646
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: InputComponent, decorators: [{
|
|
499
647
|
type: Component,
|
|
500
|
-
args: [{ selector: 'base-input', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
648
|
+
args: [{ selector: 'base-input', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
649
|
+
CommonModule,
|
|
650
|
+
IconLoaderComponent,
|
|
651
|
+
HintComponent,
|
|
652
|
+
InputErrorComponent,
|
|
653
|
+
ImageComponent,
|
|
654
|
+
IMaskModule,
|
|
655
|
+
FormsModule,
|
|
656
|
+
], providers: [
|
|
501
657
|
{
|
|
502
658
|
provide: NG_VALUE_ACCESSOR,
|
|
503
659
|
useExisting: forwardRef(() => InputComponent),
|
|
504
660
|
multi: true,
|
|
505
661
|
},
|
|
506
|
-
], template: "<div class=\"flex flex-col gap-2\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <div\n class=\"border-c px-3 py-2 flex items-center justify-between rounded-md h-12\"\n [ngClass]=\"[\n disabled ? 'bg-grey-50 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300 bg-red-50' : 'border-grey-100',\n ]\"\n >\n <ng-content select=\"[slot=prefix]\"></ng-content>\n <input\n [type]=\"type\"\n [
|
|
662
|
+
], template: "<div class=\"flex flex-col gap-2\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <div\n class=\"border-c px-3 py-2 flex items-center justify-between rounded-md h-12\"\n [ngClass]=\"[\n disabled ? 'bg-grey-50 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300 bg-red-50' : 'border-grey-100',\n ]\"\n >\n <ng-content select=\"[slot=prefix]\"></ng-content>\n <input\n [type]=\"type\"\n [imask]=\"mask ? { mask, lazy: true } : undefined\"\n [unmask]=\"mask ? 'typed' : false\"\n [(ngModel)]=\"formattedValue\"\n [disabled]=\"disabled\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\"\n [placeholder]=\"placeholder ? placeholder : 'Enter ' + label.toLowerCase()\"\n inputmode=\"decimal\"\n class=\"search-input bg-transparent outline-none border-none focus:outline-none focus:ring-0 text-body-2xs text-light-copy font-normal w-full\"\n />\n\n @if (!loading) {\n <ng-container>\n <ng-content select=\"[slot=suffix]\"></ng-content>\n <!-- Copy icon -->\n @if (showCopyIcon && value && value.trim() !== '') {\n <div class=\"ml-2 flex items-center\">\n <base-image\n src=\"assets/images/copyIcon.svg\"\n alt=\"copy\"\n [width]=\"16\"\n [height]=\"16\"\n class=\"cursor-pointer hover:opacity-70 transition-opacity\"\n (onClick)=\"copyHandler()\"\n ></base-image>\n </div>\n }\n </ng-container>\n } @else {\n <ng-template>\n <icon-loader></icon-loader>\n </ng-template>\n }\n </div>\n @if (hint) {\n <base-hint [hint]=\"hint\"></base-hint>\n }\n @if (validationError) {\n <base-input-error [errorMessage]=\"validationError\"></base-input-error>\n }\n</div>\n", styles: [":host{--select-placeholder-color: #9dbfde}:host .search-input::placeholder{color:var(--select-placeholder-color);opacity:1}:host .search-input::-webkit-input-placeholder{color:var(--select-placeholder-color)}:host .search-input::-moz-placeholder{color:var(--select-placeholder-color)}:host .search-input:-ms-input-placeholder{color:var(--select-placeholder-color)}:host .search-input::-ms-input-placeholder{color:var(--select-placeholder-color)}\n"] }]
|
|
507
663
|
}], ctorParameters: () => [], propDecorators: { label: [{
|
|
508
664
|
type: Input
|
|
509
665
|
}], type: [{
|
|
@@ -744,7 +900,7 @@ class SelectComponent {
|
|
|
744
900
|
useExisting: forwardRef(() => SelectComponent),
|
|
745
901
|
multi: true,
|
|
746
902
|
},
|
|
747
|
-
], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerRef"], descendants: true }, { propertyName: "menuRef", first: true, predicate: ["menuRef"], descendants: true }, { propertyName: "searchRef", first: true, predicate: ["searchRef"], descendants: true }], ngImport: i0, template: "<div class=\"flex flex-col gap-2 relative\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <!-- Trigger -->\n <div\n #triggerRef\n class=\"border-c rounded-md flex items-center justify-between h-12 cursor-pointer px-3 py-2\"\n [ngClass]=\"[\n disabled ? 'bg-grey-100 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300
|
|
903
|
+
], viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerRef"], descendants: true }, { propertyName: "menuRef", first: true, predicate: ["menuRef"], descendants: true }, { propertyName: "searchRef", first: true, predicate: ["searchRef"], descendants: true }], ngImport: i0, template: "<div class=\"flex flex-col gap-2 relative\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <!-- Trigger -->\n <div\n #triggerRef\n class=\"border-c rounded-md flex items-center justify-between h-12 cursor-pointer px-3 py-2\"\n [ngClass]=\"[\n disabled ? 'bg-grey-100 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300' : 'border-grey-100 bg-white',\n ]\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? 'select-menu' : null\"\n [attr.aria-disabled]=\"disabled || null\"\n [attr.aria-activedescendant]=\"isOpen && activeIndex >= 0 ? 'option-' + activeIndex : null\"\n tabindex=\"0\"\n (click)=\"toggle()\"\n (keydown)=\"onTriggerKeydown($event)\"\n >\n <div class=\"flex items-center gap-2\">\n <ng-content select=\"[slot=prefix]\"></ng-content>\n <div class=\"flex items-center gap-2\">\n @if (selectedOption && itemImageType === 'country') {\n <base-image\n [src]=\"'https://flagcdn.com/w40/' + selectedOption.countryCode?.toLowerCase() + '.png'\"\n [alt]=\"selectedOption.countryCode\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image>\n }\n\n @if (selectedOption && itemImageType === 'bank') {\n <!-- <base-image\n [src]=\"bankLogoHandler(selectedOption?.['bankCode'] || selectedOption?.value)\"\n [alt]=\"selectedOption?.value\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image> -->\n }\n\n <p\n class=\"text-body-2xs font-normal mb-0\"\n [ngClass]=\"[selectedOption?.label ? 'text-sub-copy' : 'text-grey-500']\"\n >\n {{ displayText }}\n </p>\n </div>\n </div>\n\n @if (loading) {\n <icon-loader></icon-loader>\n } @else {\n @if (isOpen) {\n <icon-chevron-up width=\"20\" height=\"20\" color=\"#8FAECA\"></icon-chevron-up>\n } @else {\n <icon-chevron-down width=\"20\" height=\"20\" color=\"#8FAECA\"></icon-chevron-down>\n }\n }\n </div>\n\n <!-- Dropdown -->\n @if (isOpen) {\n <div\n #menuRef\n id=\"select-menu\"\n class=\"absolute top-20 h-44 border-c bg-white rounded-md border-grey-border text-body-xs font-normal text-input-grey w-full mt-2 overflow-y-auto\"\n role=\"listbox\"\n [attr.aria-label]=\"label || 'Options'\"\n style=\"position: absolute; top: 100%; z-index: 10;\"\n (keydown)=\"onMenuKeydown($event)\"\n >\n @if (hasSearch) {\n <div class=\"px-4 pt-2 pb-1\">\n <input\n #searchRef\n type=\"text\"\n (input)=\"onInput($event)\"\n [placeholder]=\"'Search ' + label\"\n class=\"bg-transparent outline-none border-b pb-2 w-full focus:outline-none focus:ring-0 text-body-2xs text-light-copy font-normal\"\n />\n </div>\n }\n\n <div\n class=\"px-4 py-3 first:pt-0 hover:bg-gray-100 flex items-center gap-2 cursor-pointer\"\n *ngFor=\"let option of filteredOptions; let i = index\"\n (click)=\"onSelect(option.value)\"\n [attr.id]=\"'option-' + i\"\n data-option\n role=\"option\"\n [attr.aria-selected]=\"selectedOption?.value === option.value\"\n [ngClass]=\"{ 'bg-gray-100': i === activeIndex }\"\n >\n @if (itemImageType === 'country') {\n <base-image\n [src]=\"'https://flagcdn.com/w40/' + (option.countryCode || '').toLowerCase() + '.png'\"\n [alt]=\"option.countryCode\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image>\n }\n\n @if (itemImageType === 'bank') {\n <!-- <base-image\n [src]=\"bankLogoHandler(option['bankCode'] || option.value)\"\n [alt]=\"option.value\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image> -->\n }\n\n <p class=\"mb-0 text-body-2xs font-medium\">\n {{ option.label }}\n </p>\n </div>\n </div>\n }\n\n @if (hint) {\n <base-hint [hint]=\"hint\"></base-hint>\n }\n @if (validationError) {\n <base-input-error [errorMessage]=\"validationError\"></base-input-error>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: IconLoaderComponent, selector: "icon-loader", inputs: ["color", "size"] }, { kind: "component", type: IconChevronUpComponent, selector: "icon-chevron-up", inputs: ["color", "width", "height"] }, { kind: "component", type: IconChevronDownComponent, selector: "icon-chevron-down", inputs: ["color", "width", "height"] }, { kind: "component", type: HintComponent, selector: "base-hint", inputs: ["hint"] }, { kind: "component", type: InputErrorComponent, selector: "base-input-error", inputs: ["errorMessage"] }, { kind: "component", type: ImageComponent, selector: "base-image", inputs: ["src", "alt", "isFullWidth", "width", "height", "customClass"], outputs: ["onClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
748
904
|
}
|
|
749
905
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SelectComponent, decorators: [{
|
|
750
906
|
type: Component,
|
|
@@ -762,7 +918,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
|
|
|
762
918
|
HintComponent,
|
|
763
919
|
InputErrorComponent,
|
|
764
920
|
ImageComponent,
|
|
765
|
-
], template: "<div class=\"flex flex-col gap-2 relative\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <!-- Trigger -->\n <div\n #triggerRef\n class=\"border-c rounded-md flex items-center justify-between h-12 cursor-pointer px-3 py-2\"\n [ngClass]=\"[\n disabled ? 'bg-grey-100 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300
|
|
921
|
+
], template: "<div class=\"flex flex-col gap-2 relative\">\n @if (label) {\n <p class=\"mb-0 text-body-2xs font-normal text-heading-text\">\n {{ label }}\n @if (required) {\n <span class=\"text-orange-required\">*</span>\n }\n </p>\n }\n\n <!-- Trigger -->\n <div\n #triggerRef\n class=\"border-c rounded-md flex items-center justify-between h-12 cursor-pointer px-3 py-2\"\n [ngClass]=\"[\n disabled ? 'bg-grey-100 cursor-not-allowed' : 'bg-white',\n validationError ? 'border-red-300' : 'border-grey-100 bg-white',\n ]\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"isOpen ? 'select-menu' : null\"\n [attr.aria-disabled]=\"disabled || null\"\n [attr.aria-activedescendant]=\"isOpen && activeIndex >= 0 ? 'option-' + activeIndex : null\"\n tabindex=\"0\"\n (click)=\"toggle()\"\n (keydown)=\"onTriggerKeydown($event)\"\n >\n <div class=\"flex items-center gap-2\">\n <ng-content select=\"[slot=prefix]\"></ng-content>\n <div class=\"flex items-center gap-2\">\n @if (selectedOption && itemImageType === 'country') {\n <base-image\n [src]=\"'https://flagcdn.com/w40/' + selectedOption.countryCode?.toLowerCase() + '.png'\"\n [alt]=\"selectedOption.countryCode\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image>\n }\n\n @if (selectedOption && itemImageType === 'bank') {\n <!-- <base-image\n [src]=\"bankLogoHandler(selectedOption?.['bankCode'] || selectedOption?.value)\"\n [alt]=\"selectedOption?.value\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image> -->\n }\n\n <p\n class=\"text-body-2xs font-normal mb-0\"\n [ngClass]=\"[selectedOption?.label ? 'text-sub-copy' : 'text-grey-500']\"\n >\n {{ displayText }}\n </p>\n </div>\n </div>\n\n @if (loading) {\n <icon-loader></icon-loader>\n } @else {\n @if (isOpen) {\n <icon-chevron-up width=\"20\" height=\"20\" color=\"#8FAECA\"></icon-chevron-up>\n } @else {\n <icon-chevron-down width=\"20\" height=\"20\" color=\"#8FAECA\"></icon-chevron-down>\n }\n }\n </div>\n\n <!-- Dropdown -->\n @if (isOpen) {\n <div\n #menuRef\n id=\"select-menu\"\n class=\"absolute top-20 h-44 border-c bg-white rounded-md border-grey-border text-body-xs font-normal text-input-grey w-full mt-2 overflow-y-auto\"\n role=\"listbox\"\n [attr.aria-label]=\"label || 'Options'\"\n style=\"position: absolute; top: 100%; z-index: 10;\"\n (keydown)=\"onMenuKeydown($event)\"\n >\n @if (hasSearch) {\n <div class=\"px-4 pt-2 pb-1\">\n <input\n #searchRef\n type=\"text\"\n (input)=\"onInput($event)\"\n [placeholder]=\"'Search ' + label\"\n class=\"bg-transparent outline-none border-b pb-2 w-full focus:outline-none focus:ring-0 text-body-2xs text-light-copy font-normal\"\n />\n </div>\n }\n\n <div\n class=\"px-4 py-3 first:pt-0 hover:bg-gray-100 flex items-center gap-2 cursor-pointer\"\n *ngFor=\"let option of filteredOptions; let i = index\"\n (click)=\"onSelect(option.value)\"\n [attr.id]=\"'option-' + i\"\n data-option\n role=\"option\"\n [attr.aria-selected]=\"selectedOption?.value === option.value\"\n [ngClass]=\"{ 'bg-gray-100': i === activeIndex }\"\n >\n @if (itemImageType === 'country') {\n <base-image\n [src]=\"'https://flagcdn.com/w40/' + (option.countryCode || '').toLowerCase() + '.png'\"\n [alt]=\"option.countryCode\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image>\n }\n\n @if (itemImageType === 'bank') {\n <!-- <base-image\n [src]=\"bankLogoHandler(option['bankCode'] || option.value)\"\n [alt]=\"option.value\"\n [width]=\"28\"\n customClass=\"rounded-lg\"\n ></base-image> -->\n }\n\n <p class=\"mb-0 text-body-2xs font-medium\">\n {{ option.label }}\n </p>\n </div>\n </div>\n }\n\n @if (hint) {\n <base-hint [hint]=\"hint\"></base-hint>\n }\n @if (validationError) {\n <base-input-error [errorMessage]=\"validationError\"></base-input-error>\n }\n</div>\n" }]
|
|
766
922
|
}], propDecorators: { options: [{
|
|
767
923
|
type: Input
|
|
768
924
|
}], placeholder: [{
|
|
@@ -968,6 +1124,10 @@ class CheckoutService {
|
|
|
968
1124
|
constructor(http) {
|
|
969
1125
|
this.http = http;
|
|
970
1126
|
}
|
|
1127
|
+
billingInformation = {};
|
|
1128
|
+
setBillingInfo(info) {
|
|
1129
|
+
this.billingInformation = { ...info };
|
|
1130
|
+
}
|
|
971
1131
|
createPaymentLink(payload, environment, secretKey) {
|
|
972
1132
|
const baseUrl = getBaseUrl(environment);
|
|
973
1133
|
return this.http.post(`${baseUrl}/api/v1/checkout/generate-payment-link2`, { ...payload, linkName: `${Date.now()}-link` }, {
|
|
@@ -976,6 +1136,34 @@ class CheckoutService {
|
|
|
976
1136
|
},
|
|
977
1137
|
});
|
|
978
1138
|
}
|
|
1139
|
+
generatePaymentAccount(environment, { merchantId, ...rest }) {
|
|
1140
|
+
const baseUrl = getBaseUrl(environment);
|
|
1141
|
+
return this.http.post(`${baseUrl}/checkout/generate-payment-account`, rest, {
|
|
1142
|
+
headers: {
|
|
1143
|
+
merchantId,
|
|
1144
|
+
},
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
authorizeCardPayment(environment, { merchantId, ...rest }) {
|
|
1148
|
+
const baseUrl = getBaseUrl(environment);
|
|
1149
|
+
return this.http.post(`${baseUrl}/checkout/authorize-card-3ds-payment`, rest, {
|
|
1150
|
+
headers: {
|
|
1151
|
+
merchantId,
|
|
1152
|
+
},
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
getPaymentReferenceDetails(environment, paymentReference) {
|
|
1156
|
+
const baseUrl = getBaseUrl(environment);
|
|
1157
|
+
return this.http.get(`${baseUrl}/checkout/details/${paymentReference}`);
|
|
1158
|
+
}
|
|
1159
|
+
generateStableCoinAddress(environment, { merchantId, ...rest }) {
|
|
1160
|
+
const baseUrl = getBaseUrl(environment);
|
|
1161
|
+
return this.http.post(`${baseUrl}/checkout/generate-payment-walletaddress`, rest, {
|
|
1162
|
+
headers: {
|
|
1163
|
+
merchantId,
|
|
1164
|
+
},
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
979
1167
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: CheckoutService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
980
1168
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: CheckoutService, providedIn: 'root' });
|
|
981
1169
|
}
|
|
@@ -986,6 +1174,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
|
|
|
986
1174
|
}]
|
|
987
1175
|
}], ctorParameters: () => [{ type: i1$1.HttpClient }] });
|
|
988
1176
|
|
|
1177
|
+
class ResourceService {
|
|
1178
|
+
http;
|
|
1179
|
+
constructor(http) {
|
|
1180
|
+
this.http = http;
|
|
1181
|
+
}
|
|
1182
|
+
getCountries(environment, secretKey) {
|
|
1183
|
+
const baseUrl = getBaseUrl(environment);
|
|
1184
|
+
return this.http.get(`${baseUrl}/api/v1/countries-iso`, {
|
|
1185
|
+
headers: {
|
|
1186
|
+
merchantId: secretKey,
|
|
1187
|
+
},
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
getCountryStates(countryIso3, environment, secretKey) {
|
|
1191
|
+
const baseUrl = getBaseUrl(environment);
|
|
1192
|
+
return this.http.get(`${baseUrl}/api/v1/state-by-country/${countryIso3}`, {
|
|
1193
|
+
headers: {
|
|
1194
|
+
merchantId: secretKey,
|
|
1195
|
+
},
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
getStableCoins(environment) {
|
|
1199
|
+
const baseUrl = getBaseUrl(environment);
|
|
1200
|
+
return this.http.get(`${baseUrl}/checkout/stable-coin`);
|
|
1201
|
+
}
|
|
1202
|
+
getStableCoinNetworks(environment, stableCoin) {
|
|
1203
|
+
const baseUrl = getBaseUrl(environment);
|
|
1204
|
+
return this.http.get(`${baseUrl}/checkout/networks/${stableCoin}`);
|
|
1205
|
+
}
|
|
1206
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ResourceService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1207
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ResourceService, providedIn: 'root' });
|
|
1208
|
+
}
|
|
1209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ResourceService, decorators: [{
|
|
1210
|
+
type: Injectable,
|
|
1211
|
+
args: [{
|
|
1212
|
+
providedIn: 'root',
|
|
1213
|
+
}]
|
|
1214
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }] });
|
|
1215
|
+
|
|
1216
|
+
class EncryptService {
|
|
1217
|
+
constructor() { }
|
|
1218
|
+
encryptPayload(environment, formData = {}) {
|
|
1219
|
+
const baseUrl = getBaseUrl(environment);
|
|
1220
|
+
const key = CryptoJS.enc.Utf8.parse(baseUrl);
|
|
1221
|
+
const iv = CryptoJS.enc.Utf8.parse(baseUrl);
|
|
1222
|
+
const postDataObj = JSON.stringify(formData);
|
|
1223
|
+
const encryptedData = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(postDataObj), key, {
|
|
1224
|
+
keySize: 128 / 8,
|
|
1225
|
+
iv: iv,
|
|
1226
|
+
mode: CryptoJS.mode.CBC,
|
|
1227
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
1228
|
+
});
|
|
1229
|
+
const payload = encryptedData.toString();
|
|
1230
|
+
const formSending = {
|
|
1231
|
+
requestParam: payload,
|
|
1232
|
+
};
|
|
1233
|
+
return formSending;
|
|
1234
|
+
}
|
|
1235
|
+
decryptPayload(environment, payload) {
|
|
1236
|
+
const baseUrl = getBaseUrl(environment);
|
|
1237
|
+
const key = CryptoJS.enc.Utf8.parse(baseUrl);
|
|
1238
|
+
const iv = CryptoJS.enc.Utf8.parse(baseUrl);
|
|
1239
|
+
const decryptedData = CryptoJS.AES.decrypt(payload, key, {
|
|
1240
|
+
keySize: 128 / 8,
|
|
1241
|
+
iv: iv,
|
|
1242
|
+
mode: CryptoJS.mode.CBC,
|
|
1243
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
1244
|
+
});
|
|
1245
|
+
const decryptedText = decryptedData.toString(CryptoJS.enc.Utf8);
|
|
1246
|
+
const decryptedObj = JSON.parse(decryptedText);
|
|
1247
|
+
return decryptedObj;
|
|
1248
|
+
}
|
|
1249
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: EncryptService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1250
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: EncryptService, providedIn: 'root' });
|
|
1251
|
+
}
|
|
1252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: EncryptService, decorators: [{
|
|
1253
|
+
type: Injectable,
|
|
1254
|
+
args: [{
|
|
1255
|
+
providedIn: 'root',
|
|
1256
|
+
}]
|
|
1257
|
+
}], ctorParameters: () => [] });
|
|
1258
|
+
|
|
989
1259
|
/*
|
|
990
1260
|
* Public API Surface of miden-pg-angular
|
|
991
1261
|
*/
|
|
@@ -994,5 +1264,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
|
|
|
994
1264
|
* Generated bundle index. Do not edit.
|
|
995
1265
|
*/
|
|
996
1266
|
|
|
997
|
-
export { BZP_CONFIG, BZP_CORRELATION_ID, BackComponent, ButtonComponent, CardComponent, CheckoutService, CopyComponent, CurrencyAmountComponent, HintComponent, IconArrowSwapComponent, IconBuzapayIconComponent, IconCheckCircleComponent, IconChevronDownComponent, IconChevronLeftComponent, IconChevronUpComponent, IconCopySuccessComponent, IconLoaderComponent, IconUsdcComponent, IconUsdtComponent, ImageComponent, InputComponent, InputErrorComponent, LabelInfoComponent, MidenPGAngular, RadioGroupComponent, SelectComponent, SuccessComponent, apiBaseUrl, checkObjectTruthy, currencySign, formatAmount, getBaseUrl, provideMidenPG, restrictToNumericKeys, truncateString };
|
|
1267
|
+
export { BZP_CONFIG, BZP_CORRELATION_ID, BackComponent, ButtonComponent, CardComponent, CardSchemes, CheckoutService, CopyComponent, CurrencyAmountComponent, EncryptService, HintComponent, IconArrowSwapComponent, IconBuzapayIconComponent, IconCheckCircleComponent, IconChevronDownComponent, IconChevronLeftComponent, IconChevronUpComponent, IconCopySuccessComponent, IconLoaderComponent, IconUsdcComponent, IconUsdtComponent, ImageComponent, InputComponent, InputErrorComponent, LabelInfoComponent, MidenPGAngular, RadioGroupComponent, ResourceService, SelectComponent, SuccessComponent, apiBaseUrl, cardType, checkObjectTruthy, currencySign, detect, formatAmount, getBaseUrl, getValidationErrorMessage, provideMidenPG, restrictToNumericKeys, truncateString, urlValidator };
|
|
998
1268
|
//# sourceMappingURL=miden-npm-angular.mjs.map
|