digipay-utility-payment 0.0.13 → 0.0.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.
Binary file
@@ -290,11 +290,12 @@ const TOPUP_BILL_PAYMENT_FIELD_ACTIONS = {
290
290
  GET_ESIM_PRODUCT: 'GET_ESIM_PRODUCT',
291
291
  };
292
292
  const PRODUCT_PRICE_TYPE = {
293
- FIXED: 'FIXED',
294
- RANGE: 'RANGE',
293
+ FIXED: 1,
294
+ RANGE: 2,
295
295
  };
296
296
  const PROVIDER_CATEGORY_TYPE = {
297
- RECHARGE: 'RECHARGE',
297
+ RECHARGE: 1,
298
+ BILL_PAYMENT: 2,
298
299
  };
299
300
  const PROVIDER_CATEGORY_TYPE_NAME = {
300
301
  RECHARGE: 'Recharge',
@@ -736,7 +737,9 @@ class TranslationService {
736
737
  COMMON_LABEL_CLOSE: 'Close',
737
738
  COMMON_LABEL_AMOUNT_MUST_NOT_EXCEED_BILL_AMOUNT: 'Amount must not be greater than the bill amount',
738
739
  LABEL_NO_PROVIDERS_AVAILABLE: 'No providers available',
739
- LABEL_ENTER_4_DIGIT_TRANSACTION_PIN: 'Enter your 4-digit transaction PIN'
740
+ LABEL_ENTER_4_DIGIT_TRANSACTION_PIN: 'Enter your 4-digit transaction PIN',
741
+ AUTH_INVALID_TRANSACTION_PIN: "Invalid transaction PIN",
742
+ LABEL_INSUFFICIENT_BALANCE: 'Insufficient balance'
740
743
  };
741
744
  translate(key) {
742
745
  return TranslationService.LABELS[key] ?? key;
@@ -1104,7 +1107,6 @@ function utilityPaymentsSdkDebug(event, detail) {
1104
1107
  if (!always && !utilityPaymentsSdkIsVerboseDebug()) {
1105
1108
  return;
1106
1109
  }
1107
- console.info(LOG_PREFIX, event, { tag: UTILITY_PAYMENTS_SDK_BUILD_TAG, ...detail });
1108
1110
  }
1109
1111
 
1110
1112
  class VendorProvidersComponent {
@@ -2418,7 +2420,7 @@ class BillWorkflowComponent {
2418
2420
  const validations = field?.field_validation || [];
2419
2421
  const normalizedFieldType = this.normalizeFieldType(field?.field_type);
2420
2422
  const normalizedValidations = this.normalizeValidations(validations);
2421
- const isRequired = normalizedValidations.isRequired;
2423
+ const isRequired = normalizedValidations.isRequired || true;
2422
2424
  const minLength = normalizedValidations.minLength;
2423
2425
  const maxLength = normalizedValidations.maxLength;
2424
2426
  let minValue = normalizedValidations.minValue;
@@ -3057,6 +3059,21 @@ class WorkFlowComponent {
3057
3059
  return TOPUP_BILL_PAYMENT_FIELD_TYPE.BUTTON;
3058
3060
  return fieldTypeValue;
3059
3061
  }
3062
+ isFormIncomplete() {
3063
+ if (!this.detailsForm)
3064
+ return true;
3065
+ let hasEmptyFields = false;
3066
+ this.fieldsArray.forEach((field) => {
3067
+ const isRequired = field?.templateOptions?.required;
3068
+ const fieldKey = field.key != null ? String(field.key) : '';
3069
+ const formControl = this.detailsForm.get(fieldKey);
3070
+ const fieldValue = formControl?.value;
3071
+ if ((!fieldValue || fieldValue === '' || fieldValue === null || fieldValue === undefined)) {
3072
+ hasEmptyFields = true;
3073
+ }
3074
+ });
3075
+ return hasEmptyFields || !this.detailsForm.valid;
3076
+ }
3060
3077
  normalizeFieldAction(action) {
3061
3078
  const actionValue = String(action ?? "").trim().toUpperCase();
3062
3079
  if (actionValue === "GET_BILL_SCREEN")
@@ -3108,7 +3125,7 @@ class WorkFlowComponent {
3108
3125
  },
3109
3126
  ],
3110
3127
  }),
3111
- ], ngImport: i0, template: "\n\n@if (showWorkflowComponent) {\n \n <sdk-bill-workflow \n [selectedBill]=\"selectedBillForWorkflow\"\n (workflowCompleted)=\"onWorkflowCompleted($event)\">\n </sdk-bill-workflow>\n \n \n}@else { \n <div class=\"content\">\n <header class=\"page-header\">\n <div class=\"d-flex align-items-center flex-wrap\">\n <div class=\"mr-auto\">\n <h1>{{ 'LABEL_UTILITIES' | translate }}</h1>\n </div>\n </div>\n </header>\n \n <section class=\"page-content container-fluid\">\n \n <div class=\"card m-0 border-0\">\n <div class=\"card-header p-t-25 p-b-20\">\n <h4 class=\"card-title font-weight-600 font-size-18 m-0 text-dark\">{{ vendorProvider?.provider_name }}\n </h4>\n </div>\n <div class=\"tab-content\">\n <div class=\"tab-pane fadeIn active show\">\n <form role=\"form\" class=\"form-horizontal\" [formGroup]=\"detailsForm\" (ngSubmit)=\"submitForm()\">\n <div class=\"card-body\">\n <div class=\"mt-3\">\n @if (fieldsArray.length > 0) {\n <div class=\"row\">\n <div class=\"col-xl-5 offset-xl-3\">\n <!-- <div class=\"form-group form-row\">\n <label\n class=\"control-label text-md-right col-md-4 col-lg-3\">Provider</label>\n <div class=\"col-md-5\">\n <ng-select placeholder=\"Select Provider\" bindLabel=\"provider_name\"\n bindValue=\"id\" [items]=\"vendorProviders\"\n (change)=\"changeVendorProvider($event)\">\n </ng-select>\n </div>\n </div> -->\n <!-- <pre>{{fieldsArray|json}}</pre> -->\n <formly-form [fields]=\"fieldsArray\" [model]=\"fieldsModel\" [form]=\"detailsForm\">\n </formly-form>\n </div>\n </div>\n }\n \n @if (fieldsArray.length === 0) {\n <sdk-no-data title=\"LABEL_FIELDS_NOT_AVAILABLE\"></sdk-no-data>\n }\n </div>\n </div>\n <div class=\"card-footer bg-light text-right\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"back()\">\n {{'COMMON_LABEL_CANCEL' | translate}}\n </button>\n @if (buttonData) {\n <button type=\"submit\" class=\"btn btn-primary\"\n [ngClass]=\"{'qt-loader qt-loader-mini qt-loader-left': showLoader}\"\n [disabled]=\"showLoader\">\n {{ buttonData?.field_title }}\n </button>\n }\n </div>\n </form>\n </div>\n </div>\n </div>\n </section>\n </div>\n}", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: SharedModule }, { kind: "ngmodule", type: NgSelectModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyBootstrapModule }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i1$2.LegacyFormlyForm, selector: "formly-form" }, { kind: "component", type: NoDataComponent, selector: "sdk-no-data", inputs: ["title", "icon"] }, { kind: "component", type: BillWorkflowComponent, selector: "sdk-bill-workflow", inputs: ["billData", "selectedBill"], outputs: ["workflowCompleted"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
3128
+ ], ngImport: i0, template: "\n\n@if (showWorkflowComponent) {\n \n <sdk-bill-workflow \n [selectedBill]=\"selectedBillForWorkflow\"\n (workflowCompleted)=\"onWorkflowCompleted($event)\">\n </sdk-bill-workflow>\n \n \n}@else { \n <div class=\"content\">\n <header class=\"page-header\">\n <div class=\"d-flex align-items-center flex-wrap\">\n <div class=\"mr-auto\">\n <h1>{{ 'LABEL_UTILITIES' | translate }}</h1>\n </div>\n </div>\n </header>\n \n <section class=\"page-content container-fluid\">\n \n <div class=\"card m-0 border-0\">\n <div class=\"card-header p-t-25 p-b-20\">\n <h4 class=\"card-title font-weight-600 font-size-18 m-0 text-dark\">{{ vendorProvider?.provider_name }}\n </h4>\n </div>\n <div class=\"tab-content\">\n <div class=\"tab-pane fadeIn active show\">\n <form role=\"form\" class=\"form-horizontal\" [formGroup]=\"detailsForm\" (ngSubmit)=\"submitForm()\">\n <div class=\"card-body\">\n <div class=\"mt-3\">\n @if (fieldsArray.length > 0) {\n <div class=\"row\">\n <div class=\"col-xl-5 offset-xl-3\">\n <!-- <div class=\"form-group form-row\">\n <label\n class=\"control-label text-md-right col-md-4 col-lg-3\">Provider</label>\n <div class=\"col-md-5\">\n <ng-select placeholder=\"Select Provider\" bindLabel=\"provider_name\"\n bindValue=\"id\" [items]=\"vendorProviders\"\n (change)=\"changeVendorProvider($event)\">\n </ng-select>\n </div>\n </div> -->\n <!-- <pre>{{fieldsArray|json}}</pre> -->\n <formly-form [fields]=\"fieldsArray\" [model]=\"fieldsModel\" [form]=\"detailsForm\">\n </formly-form>\n </div>\n </div>\n }\n \n @if (fieldsArray.length === 0) {\n <sdk-no-data title=\"LABEL_FIELDS_NOT_AVAILABLE\"></sdk-no-data>\n }\n </div>\n </div>\n <div class=\"card-footer bg-light text-right\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"back()\">\n {{'COMMON_LABEL_CANCEL' | translate}}\n </button>\n @if (buttonData) {\n <button type=\"submit\" class=\"btn btn-primary\"\n [ngClass]=\"{'qt-loader qt-loader-mini qt-loader-left': showLoader}\"\n [disabled]=\"showLoader || isFormIncomplete()\">\n {{ buttonData?.field_title }}\n </button>\n }\n </div>\n </form>\n </div>\n </div>\n </div>\n </section>\n </div>\n}", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: SharedModule }, { kind: "ngmodule", type: NgSelectModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyBootstrapModule }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i1$2.LegacyFormlyForm, selector: "formly-form" }, { kind: "component", type: NoDataComponent, selector: "sdk-no-data", inputs: ["title", "icon"] }, { kind: "component", type: BillWorkflowComponent, selector: "sdk-bill-workflow", inputs: ["billData", "selectedBill"], outputs: ["workflowCompleted"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
3112
3129
  }
3113
3130
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: WorkFlowComponent, decorators: [{
3114
3131
  type: Component,
@@ -3158,7 +3175,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
3158
3175
  },
3159
3176
  ],
3160
3177
  }),
3161
- ], template: "\n\n@if (showWorkflowComponent) {\n \n <sdk-bill-workflow \n [selectedBill]=\"selectedBillForWorkflow\"\n (workflowCompleted)=\"onWorkflowCompleted($event)\">\n </sdk-bill-workflow>\n \n \n}@else { \n <div class=\"content\">\n <header class=\"page-header\">\n <div class=\"d-flex align-items-center flex-wrap\">\n <div class=\"mr-auto\">\n <h1>{{ 'LABEL_UTILITIES' | translate }}</h1>\n </div>\n </div>\n </header>\n \n <section class=\"page-content container-fluid\">\n \n <div class=\"card m-0 border-0\">\n <div class=\"card-header p-t-25 p-b-20\">\n <h4 class=\"card-title font-weight-600 font-size-18 m-0 text-dark\">{{ vendorProvider?.provider_name }}\n </h4>\n </div>\n <div class=\"tab-content\">\n <div class=\"tab-pane fadeIn active show\">\n <form role=\"form\" class=\"form-horizontal\" [formGroup]=\"detailsForm\" (ngSubmit)=\"submitForm()\">\n <div class=\"card-body\">\n <div class=\"mt-3\">\n @if (fieldsArray.length > 0) {\n <div class=\"row\">\n <div class=\"col-xl-5 offset-xl-3\">\n <!-- <div class=\"form-group form-row\">\n <label\n class=\"control-label text-md-right col-md-4 col-lg-3\">Provider</label>\n <div class=\"col-md-5\">\n <ng-select placeholder=\"Select Provider\" bindLabel=\"provider_name\"\n bindValue=\"id\" [items]=\"vendorProviders\"\n (change)=\"changeVendorProvider($event)\">\n </ng-select>\n </div>\n </div> -->\n <!-- <pre>{{fieldsArray|json}}</pre> -->\n <formly-form [fields]=\"fieldsArray\" [model]=\"fieldsModel\" [form]=\"detailsForm\">\n </formly-form>\n </div>\n </div>\n }\n \n @if (fieldsArray.length === 0) {\n <sdk-no-data title=\"LABEL_FIELDS_NOT_AVAILABLE\"></sdk-no-data>\n }\n </div>\n </div>\n <div class=\"card-footer bg-light text-right\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"back()\">\n {{'COMMON_LABEL_CANCEL' | translate}}\n </button>\n @if (buttonData) {\n <button type=\"submit\" class=\"btn btn-primary\"\n [ngClass]=\"{'qt-loader qt-loader-mini qt-loader-left': showLoader}\"\n [disabled]=\"showLoader\">\n {{ buttonData?.field_title }}\n </button>\n }\n </div>\n </form>\n </div>\n </div>\n </div>\n </section>\n </div>\n}" }]
3178
+ ], template: "\n\n@if (showWorkflowComponent) {\n \n <sdk-bill-workflow \n [selectedBill]=\"selectedBillForWorkflow\"\n (workflowCompleted)=\"onWorkflowCompleted($event)\">\n </sdk-bill-workflow>\n \n \n}@else { \n <div class=\"content\">\n <header class=\"page-header\">\n <div class=\"d-flex align-items-center flex-wrap\">\n <div class=\"mr-auto\">\n <h1>{{ 'LABEL_UTILITIES' | translate }}</h1>\n </div>\n </div>\n </header>\n \n <section class=\"page-content container-fluid\">\n \n <div class=\"card m-0 border-0\">\n <div class=\"card-header p-t-25 p-b-20\">\n <h4 class=\"card-title font-weight-600 font-size-18 m-0 text-dark\">{{ vendorProvider?.provider_name }}\n </h4>\n </div>\n <div class=\"tab-content\">\n <div class=\"tab-pane fadeIn active show\">\n <form role=\"form\" class=\"form-horizontal\" [formGroup]=\"detailsForm\" (ngSubmit)=\"submitForm()\">\n <div class=\"card-body\">\n <div class=\"mt-3\">\n @if (fieldsArray.length > 0) {\n <div class=\"row\">\n <div class=\"col-xl-5 offset-xl-3\">\n <!-- <div class=\"form-group form-row\">\n <label\n class=\"control-label text-md-right col-md-4 col-lg-3\">Provider</label>\n <div class=\"col-md-5\">\n <ng-select placeholder=\"Select Provider\" bindLabel=\"provider_name\"\n bindValue=\"id\" [items]=\"vendorProviders\"\n (change)=\"changeVendorProvider($event)\">\n </ng-select>\n </div>\n </div> -->\n <!-- <pre>{{fieldsArray|json}}</pre> -->\n <formly-form [fields]=\"fieldsArray\" [model]=\"fieldsModel\" [form]=\"detailsForm\">\n </formly-form>\n </div>\n </div>\n }\n \n @if (fieldsArray.length === 0) {\n <sdk-no-data title=\"LABEL_FIELDS_NOT_AVAILABLE\"></sdk-no-data>\n }\n </div>\n </div>\n <div class=\"card-footer bg-light text-right\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"back()\">\n {{'COMMON_LABEL_CANCEL' | translate}}\n </button>\n @if (buttonData) {\n <button type=\"submit\" class=\"btn btn-primary\"\n [ngClass]=\"{'qt-loader qt-loader-mini qt-loader-left': showLoader}\"\n [disabled]=\"showLoader || isFormIncomplete()\">\n {{ buttonData?.field_title }}\n </button>\n }\n </div>\n </form>\n </div>\n </div>\n </div>\n </section>\n </div>\n}" }]
3162
3179
  }], ctorParameters: () => [] });
3163
3180
 
3164
3181
  const REGION_COMMUNE_DATA = {
@@ -3767,7 +3784,6 @@ class ViewBillsComponent {
3767
3784
  this.topupAndBillpaymentService.workFlowUserInput.pipe(takeUntil(this.destroy$)).subscribe((data) => {
3768
3785
  if (isNotNull(data)) {
3769
3786
  this.workFlowUserInput = data;
3770
- console.log("workFlowUserInput==>", this.workFlowUserInput);
3771
3787
  if (data?.length > 1) {
3772
3788
  const latestNumericValue = data?.find((element) => element['value'] && typeof element['value'] === 'number')?.value || null;
3773
3789
  this.userAmount = latestNumericValue;
@@ -3827,6 +3843,7 @@ class ViewBillsComponent {
3827
3843
  this.showLoader = false;
3828
3844
  if (res?.success) {
3829
3845
  this.billsData = res?.data;
3846
+ this.showLoader = false;
3830
3847
  }
3831
3848
  else {
3832
3849
  this.toasterService.error(this.translationService.translate(res?.error[0]));
@@ -5898,6 +5915,7 @@ class TopupAndBillpaymentReviewComponent extends TransactionClass {
5898
5915
  this.back();
5899
5916
  }
5900
5917
  }).catch(() => undefined);
5918
+ this.topupAndBillpaymentService?.deleteWorkflowUserInput();
5901
5919
  }
5902
5920
  removeunderScore(value) {
5903
5921
  return value.replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "digipay-utility-payment",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "peerDependencies": {
5
- "@angular/common": "^20.3.0",
6
- "@angular/core": "^20.3.0"
5
+ "@angular/common": "^20.0.0",
6
+ "@angular/core": "^20.0.0",
7
+ "@ng-select/ng-select": "^15.1.3",
8
+ "@ngx-formly/bootstrap": "^7.0.0",
9
+ "@ngx-formly/core": "^7.0.0",
10
+ "ngx-toastr": "^19.0.0",
11
+ "lodash": "^4.17.21",
12
+ "rxjs": "^7.8.0"
7
13
  },
8
14
  "dependencies": {
9
15
  "@popperjs/core": "^2.11.8",