@miden-npm/angular 0.0.28 → 0.0.30

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.
@@ -24,10 +24,18 @@ const BZP_CORRELATION_ID = new InjectionToken('BZP_CORRELATION_ID');
24
24
 
25
25
  const authInterceptor = (req, next) => {
26
26
  const cfg = inject(BZP_CONFIG);
27
+ const headers = {
28
+ 'X-Publishable-Key': cfg.publishableKey,
29
+ };
30
+ // Extract merchantId from URL for merchant-by-id endpoints if header not already set
31
+ if (!req.headers.has('merchantId')) {
32
+ const merchantByIdMatch = req.url.match(/\/api\/v1\/merchant-by-id\/([^/?]+)/);
33
+ if (merchantByIdMatch && merchantByIdMatch[1]) {
34
+ headers['merchantId'] = merchantByIdMatch[1];
35
+ }
36
+ }
27
37
  const cloned = req.clone({
28
- setHeaders: {
29
- 'X-Publishable-Key': cfg.publishableKey,
30
- },
38
+ setHeaders: headers,
31
39
  });
32
40
  return next(cloned);
33
41
  };
@@ -593,6 +601,7 @@ class InputComponent {
593
601
  disabled = false;
594
602
  loading = false;
595
603
  showCopyIcon = false;
604
+ preventPaste = false; // NEW
596
605
  onInputChange = new EventEmitter();
597
606
  onInputBlur = new EventEmitter();
598
607
  constructor() { }
@@ -604,9 +613,12 @@ class InputComponent {
604
613
  copyHandler() {
605
614
  this.copyToClipboard(this.value)
606
615
  .then(() => {
616
+ // Clear any previous error and show hint
617
+ this.validationError = '';
607
618
  this.hint = 'Text copied to clipboard';
608
619
  })
609
620
  .catch(() => {
621
+ this.hint = '';
610
622
  this.validationError = 'Failed to copy text to clipboard';
611
623
  });
612
624
  }
@@ -636,6 +648,14 @@ class InputComponent {
636
648
  restrictToNumericKeys(event);
637
649
  }
638
650
  }
651
+ onPaste(event) {
652
+ if (this.preventPaste) {
653
+ event.preventDefault();
654
+ // Clear any previous hint and set error
655
+ this.hint = '';
656
+ this.validationError = 'Pasting is disabled for this input';
657
+ }
658
+ }
639
659
  registerOnChange(fn) {
640
660
  this.onChange = fn;
641
661
  }
@@ -643,13 +663,13 @@ class InputComponent {
643
663
  this.onTouched = fn;
644
664
  }
645
665
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
646
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: InputComponent, isStandalone: true, selector: "base-input", inputs: { label: "label", type: "type", placeholder: "placeholder", validationError: "validationError", hint: "hint", mask: "mask", rules: "rules", isAmountInput: "isAmountInput", required: "required", disabled: "disabled", loading: "loading", showCopyIcon: "showCopyIcon" }, outputs: { onInputChange: "onInputChange", onInputBlur: "onInputBlur" }, providers: [
666
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: InputComponent, isStandalone: true, selector: "base-input", inputs: { label: "label", type: "type", placeholder: "placeholder", validationError: "validationError", hint: "hint", mask: "mask", rules: "rules", isAmountInput: "isAmountInput", required: "required", disabled: "disabled", loading: "loading", showCopyIcon: "showCopyIcon", preventPaste: "preventPaste" }, outputs: { onInputChange: "onInputChange", onInputBlur: "onInputBlur" }, providers: [
647
667
  {
648
668
  provide: NG_VALUE_ACCESSOR,
649
669
  useExisting: forwardRef(() => InputComponent),
650
670
  multi: true,
651
671
  },
652
- ], 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 });
672
+ ], 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\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 (paste)=\"onPaste($event)\"\n [placeholder]=\"placeholder ? placeholder : 'Enter ' + label.toLowerCase()\"\n [attr.inputmode]=\"isAmountInput ? 'decimal' : null\"\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\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 });
653
673
  }
654
674
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: InputComponent, decorators: [{
655
675
  type: Component,
@@ -667,7 +687,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
667
687
  useExisting: forwardRef(() => InputComponent),
668
688
  multi: true,
669
689
  },
670
- ], 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"] }]
690
+ ], 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\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 (paste)=\"onPaste($event)\"\n [placeholder]=\"placeholder ? placeholder : 'Enter ' + label.toLowerCase()\"\n [attr.inputmode]=\"isAmountInput ? 'decimal' : null\"\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\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"] }]
671
691
  }], ctorParameters: () => [], propDecorators: { label: [{
672
692
  type: Input
673
693
  }], type: [{
@@ -692,6 +712,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
692
712
  type: Input
693
713
  }], showCopyIcon: [{
694
714
  type: Input
715
+ }], preventPaste: [{
716
+ type: Input
695
717
  }], onInputChange: [{
696
718
  type: Output
697
719
  }], onInputBlur: [{
@@ -1235,6 +1257,14 @@ class ResourceService {
1235
1257
  const baseUrl = getBaseUrl(environment);
1236
1258
  return this.http.get(`${baseUrl}/api/v1/checkout/networks/${stableCoin}`);
1237
1259
  }
1260
+ getMerchantById(merchantId, environment, secretKey) {
1261
+ const baseUrl = getBaseUrl(environment);
1262
+ return this.http.get(`${baseUrl}/api/v1/merchant-by-id/${merchantId}`, {
1263
+ headers: {
1264
+ merchantId: secretKey,
1265
+ },
1266
+ });
1267
+ }
1238
1268
  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 });
1239
1269
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ResourceService, providedIn: 'root' });
1240
1270
  }