@croeminc/croem-card-widget 0.6.0-beta.2

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.
Files changed (44) hide show
  1. package/Constants.d.ts +8 -0
  2. package/README.md +125 -0
  3. package/esm2020/Constants.mjs +9 -0
  4. package/esm2020/croeminc-croem-card-widget.mjs +5 -0
  5. package/esm2020/lib/card-widget/Add-card-widget/add-card-widget/add-card-widget.component.mjs +195 -0
  6. package/esm2020/lib/card-widget/Pay-card-widget/payment-card-widget/payment-card-widget.component.mjs +149 -0
  7. package/esm2020/lib/card-widget/Update-card-widget/update-card-widget/update-card-widget.component.mjs +267 -0
  8. package/esm2020/lib/croem-card-widget.component.mjs +77 -0
  9. package/esm2020/lib/croem-card-widget.module.mjs +48 -0
  10. package/esm2020/lib/croem-card-widget.service.mjs +62 -0
  11. package/esm2020/lib/dynamic-form-builder/dynamic-form-fields/dropdown.mjs +32 -0
  12. package/esm2020/lib/dynamic-form-builder/dynamic-form-fields/textbox.mjs +21 -0
  13. package/esm2020/lib/dynamic-form-builder/field-builder.component.mjs +24 -0
  14. package/esm2020/lib/dynamic-form-builder/interfaces/CardModeEnum.mjs +7 -0
  15. package/esm2020/lib/dynamic-form-builder/interfaces/FormFields.Interface.mjs +2 -0
  16. package/esm2020/lib/dynamic-form-builder/interfaces/InputParams.Interface.mjs +2 -0
  17. package/esm2020/lib/dynamic-form-builder/interfaces/apiResponse.Interface.mjs +2 -0
  18. package/esm2020/lib/localizations/en.mjs +16 -0
  19. package/esm2020/lib/localizations/es.mjs +16 -0
  20. package/esm2020/lib/localizations/language.interface.mjs +2 -0
  21. package/esm2020/public-api.mjs +11 -0
  22. package/fesm2015/croeminc-croem-card-widget.mjs +876 -0
  23. package/fesm2015/croeminc-croem-card-widget.mjs.map +1 -0
  24. package/fesm2020/croeminc-croem-card-widget.mjs +868 -0
  25. package/fesm2020/croeminc-croem-card-widget.mjs.map +1 -0
  26. package/index.d.ts +5 -0
  27. package/lib/card-widget/Add-card-widget/add-card-widget/add-card-widget.component.d.ts +61 -0
  28. package/lib/card-widget/Pay-card-widget/payment-card-widget/payment-card-widget.component.d.ts +43 -0
  29. package/lib/card-widget/Update-card-widget/update-card-widget/update-card-widget.component.d.ts +64 -0
  30. package/lib/croem-card-widget.component.d.ts +49 -0
  31. package/lib/croem-card-widget.module.d.ts +16 -0
  32. package/lib/croem-card-widget.service.d.ts +11 -0
  33. package/lib/dynamic-form-builder/dynamic-form-fields/dropdown.d.ts +19 -0
  34. package/lib/dynamic-form-builder/dynamic-form-fields/textbox.d.ts +12 -0
  35. package/lib/dynamic-form-builder/field-builder.component.d.ts +14 -0
  36. package/lib/dynamic-form-builder/interfaces/CardModeEnum.d.ts +5 -0
  37. package/lib/dynamic-form-builder/interfaces/FormFields.Interface.d.ts +14 -0
  38. package/lib/dynamic-form-builder/interfaces/InputParams.Interface.d.ts +17 -0
  39. package/lib/dynamic-form-builder/interfaces/apiResponse.Interface.d.ts +24 -0
  40. package/lib/localizations/en.d.ts +2 -0
  41. package/lib/localizations/es.d.ts +2 -0
  42. package/lib/localizations/language.interface.d.ts +15 -0
  43. package/package.json +48 -0
  44. package/public-api.d.ts +7 -0
@@ -0,0 +1,876 @@
1
+ import { __awaiter } from 'tslib';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable, Component, Input, EventEmitter, Output, NgModule } from '@angular/core';
4
+ import * as i3 from '@angular/common';
5
+ import { CommonModule } from '@angular/common';
6
+ import * as i1 from '@angular/forms';
7
+ import { Validators, FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
+ import * as cardValidator from 'card-validator';
9
+ import * as i3$1 from '@ng-select/ng-select';
10
+ import { NgSelectModule } from '@ng-select/ng-select';
11
+
12
+ const LANG_EN = {
13
+ CardNumber: "Card Number",
14
+ CardHolderName: "Card Holder Name",
15
+ ExpiryDate: "Expiry Date",
16
+ CardType: "Card Type",
17
+ DoYouWishTo: "Do you wish to proceed with this request?",
18
+ RequestCancelled: "The request has been cancelled.",
19
+ APIKeyNull: "APIKey is NULL",
20
+ lblSave: "Save",
21
+ CVV: "CVV",
22
+ ValidThru: "Valid Thru",
23
+ Proceed: "Proceed to Pay",
24
+ TokenEmpty: "Token is Empty",
25
+ Update: "Update"
26
+ };
27
+
28
+ const LANG_ES = {
29
+ CardNumber: "Número de tarjeta",
30
+ CardHolderName: "Nombre del titular de la tarjeta",
31
+ ExpiryDate: "Fecha de caducidad",
32
+ CardType: "Tipo de tarjeta",
33
+ RequestCancelled: "La solicitud ha sido cancelada.",
34
+ DoYouWishTo: "¿Desea continuar con esta solicitud?",
35
+ APIKeyNull: "APIKey es nula",
36
+ lblSave: "Ahorrar",
37
+ CVV: "CVV",
38
+ ValidThru: "Valid Thru",
39
+ Proceed: "Proceda a pagar",
40
+ TokenEmpty: "El token está vacío.",
41
+ Update: "Actualizar"
42
+ };
43
+
44
+ class CroemCardWidgetService {
45
+ constructor() { }
46
+ CardPayment(data, language, apiUrl, encryptedString) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const queryString = `?request=${encodeURIComponent(encryptedString)}`;
49
+ const fullUrl = apiUrl + queryString;
50
+ if (language === 'en') {
51
+ this.currentLang = LANG_EN;
52
+ }
53
+ else if (language === 'es') {
54
+ this.currentLang = LANG_ES;
55
+ }
56
+ data.isSale = false;
57
+ if (data.APIKey != null) {
58
+ return this.apiCall(fullUrl);
59
+ }
60
+ else {
61
+ throw new Error(this.currentLang["APIKeyNull"]);
62
+ }
63
+ });
64
+ }
65
+ addUpdateCardAPICall(apiUrl, encryptedString) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const queryString = `?request=${encodeURIComponent(encryptedString)}`;
68
+ const fullUrl = apiUrl + queryString;
69
+ return this.apiCall(fullUrl);
70
+ });
71
+ }
72
+ apiCall(fullUrl) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ var response;
75
+ try {
76
+ if (fullUrl.includes('GetCreditCard')) {
77
+ response = yield fetch(fullUrl, {
78
+ method: 'GET'
79
+ });
80
+ }
81
+ else {
82
+ response = yield fetch(fullUrl, {
83
+ method: 'POST'
84
+ });
85
+ }
86
+ if (!response.ok) {
87
+ throw new Error(`HTTP error! Status: ${response.status}`);
88
+ }
89
+ const responseText = yield response.text();
90
+ return JSON.parse(responseText);
91
+ }
92
+ catch (error) {
93
+ console.log(error);
94
+ return error;
95
+ }
96
+ });
97
+ }
98
+ }
99
+ CroemCardWidgetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
100
+ CroemCardWidgetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetService, providedIn: 'root' });
101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetService, decorators: [{
102
+ type: Injectable,
103
+ args: [{
104
+ providedIn: 'root'
105
+ }]
106
+ }], ctorParameters: function () { return []; } });
107
+
108
+ var CardMode;
109
+ (function (CardMode) {
110
+ CardMode["Add"] = "0";
111
+ CardMode["Edit"] = "1";
112
+ CardMode["Show"] = "2";
113
+ })(CardMode || (CardMode = {}));
114
+
115
+ const constants = {
116
+ urls: {
117
+ updateDTRUrl: "api/UIComponentApi/UpdateCreditCard",
118
+ addDTRUrl: "api/UIComponentApi/CreateCreditCard",
119
+ paymentDTRUrl: "api/UIComponentApi/PerformTransaction",
120
+ getCardInfoByToken: "api/UIComponentApi/GetCreditCard"
121
+ }
122
+ };
123
+
124
+ class TextBoxComponent {
125
+ get isValid() { return this.form.controls[this.field.name].valid; }
126
+ get isDirty() { return this.form.controls[this.field.name].dirty; }
127
+ constructor() {
128
+ }
129
+ }
130
+ TextBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
131
+ TextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TextBoxComponent, selector: "textbox", inputs: { field: "field", form: "form" }, ngImport: i0, template: "<div [formGroup]=\"form\">\r\n <input \r\n *ngIf=\"!field.multiline\" \r\n [attr.type]=\"field.type\"\r\n class=\"form-control\" \r\n [id]=\"field.name\" \r\n [name]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [placeholder]=\"field.placeholder\" >\r\n\r\n <textarea *ngIf=\"field.multiline\" [formControlName]=\"field.name\" [id]=\"field.name\"\r\n rows=\"9\" class=\"form-control\" [placeholder]=\"field.placeholder\"></textarea>\r\n \r\n</div> ", dependencies: [{ kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TextBoxComponent, decorators: [{
133
+ type: Component,
134
+ args: [{ selector: 'textbox', template: "<div [formGroup]=\"form\">\r\n <input \r\n *ngIf=\"!field.multiline\" \r\n [attr.type]=\"field.type\"\r\n class=\"form-control\" \r\n [id]=\"field.name\" \r\n [name]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [placeholder]=\"field.placeholder\" >\r\n\r\n <textarea *ngIf=\"field.multiline\" [formControlName]=\"field.name\" [id]=\"field.name\"\r\n rows=\"9\" class=\"form-control\" [placeholder]=\"field.placeholder\"></textarea>\r\n \r\n</div> " }]
135
+ }], ctorParameters: function () { return []; }, propDecorators: { field: [{
136
+ type: Input
137
+ }], form: [{
138
+ type: Input
139
+ }] } });
140
+
141
+ class DropDownComponent {
142
+ ngOnInit() {
143
+ this.originalOptions = this.field.options ? [...this.field.options] : undefined;
144
+ }
145
+ filterOptions(options, event) {
146
+ const searchTerm = event.target.value;
147
+ if (options) {
148
+ return options.filter(opt => opt.label.toLowerCase().includes(searchTerm.toLowerCase()));
149
+ }
150
+ else {
151
+ return [];
152
+ }
153
+ }
154
+ constructor() {
155
+ }
156
+ }
157
+ DropDownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropDownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
158
+ DropDownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DropDownComponent, selector: "dropdown", inputs: { field: "field", form: "form" }, ngImport: i0, template: "<div [formGroup]=\"form\">\r\n <ng-select [placeholder]=\"'Select a ' + field.label\" [formControlName]=\"field.name\" [id]=\"field.name\"\r\n [searchable]=\"false\" class=\"custom-ng-select\" [readonly]=\"field.disable\">\r\n <ng-template ng-header-tmp>\r\n <input class=\"custom-ng-select-search\" style=\"width: 100%; line-height: 24px\" type=\"text\"\r\n (input)=\"field.options = filterOptions(originalOptions, $event)\" [formControlName]=\"field.name\"\r\n placeholder=\"\" />\r\n </ng-template>\r\n\r\n <ng-option *ngFor=\"let opt of field.options\" [value]=\"opt.key\" aria-readonly=\"true\">{{opt.label}}</ng-option>\r\n </ng-select>\r\n</div>", dependencies: [{ kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3$1.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "component", type: i3$1.NgOptionComponent, selector: "ng-option", inputs: ["value", "disabled"] }, { kind: "directive", type: i3$1.NgHeaderTemplateDirective, selector: "[ng-header-tmp]" }] });
159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DropDownComponent, decorators: [{
160
+ type: Component,
161
+ args: [{ selector: 'dropdown', template: "<div [formGroup]=\"form\">\r\n <ng-select [placeholder]=\"'Select a ' + field.label\" [formControlName]=\"field.name\" [id]=\"field.name\"\r\n [searchable]=\"false\" class=\"custom-ng-select\" [readonly]=\"field.disable\">\r\n <ng-template ng-header-tmp>\r\n <input class=\"custom-ng-select-search\" style=\"width: 100%; line-height: 24px\" type=\"text\"\r\n (input)=\"field.options = filterOptions(originalOptions, $event)\" [formControlName]=\"field.name\"\r\n placeholder=\"\" />\r\n </ng-template>\r\n\r\n <ng-option *ngFor=\"let opt of field.options\" [value]=\"opt.key\" aria-readonly=\"true\">{{opt.label}}</ng-option>\r\n </ng-select>\r\n</div>" }]
162
+ }], ctorParameters: function () { return []; }, propDecorators: { field: [{
163
+ type: Input
164
+ }], form: [{
165
+ type: Input
166
+ }] } });
167
+
168
+ class FieldBuilderComponent {
169
+ get isValid() { return this.form.controls[this.field.name].valid; }
170
+ get isDirty() { return this.form.controls[this.field.name].dirty; }
171
+ constructor() { }
172
+ ngOnInit() {
173
+ }
174
+ }
175
+ FieldBuilderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FieldBuilderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
176
+ FieldBuilderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FieldBuilderComponent, selector: "field-builder", inputs: { field: "field", form: "form" }, ngImport: i0, template: "<div class=\"form-group row\" [formGroup]=\"form\">\r\n <label class=\"col-md-12 form-control-label\" [attr.for]=\"field.name\">\r\n {{field.label}}\r\n <strong class=\"text-danger\" *ngIf=\"field.required\">*</strong>\r\n </label>\r\n <div class=\"col-md-12\" [ngSwitch]=\"field.type\">\r\n <textbox *ngSwitchCase=\"'text'\" [field]=\"field\" [form]=\"form\"></textbox>\r\n <dropdown *ngSwitchCase=\"'dropdown'\" [field]=\"field\" [form]=\"form\"></dropdown>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: TextBoxComponent, selector: "textbox", inputs: ["field", "form"] }, { kind: "component", type: DropDownComponent, selector: "dropdown", inputs: ["field", "form"] }] });
177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FieldBuilderComponent, decorators: [{
178
+ type: Component,
179
+ args: [{ selector: 'field-builder', template: "<div class=\"form-group row\" [formGroup]=\"form\">\r\n <label class=\"col-md-12 form-control-label\" [attr.for]=\"field.name\">\r\n {{field.label}}\r\n <strong class=\"text-danger\" *ngIf=\"field.required\">*</strong>\r\n </label>\r\n <div class=\"col-md-12\" [ngSwitch]=\"field.type\">\r\n <textbox *ngSwitchCase=\"'text'\" [field]=\"field\" [form]=\"form\"></textbox>\r\n <dropdown *ngSwitchCase=\"'dropdown'\" [field]=\"field\" [form]=\"form\"></dropdown>\r\n </div>\r\n</div>" }]
180
+ }], ctorParameters: function () { return []; }, propDecorators: { field: [{
181
+ type: Input
182
+ }], form: [{
183
+ type: Input
184
+ }] } });
185
+
186
+ class AddCardWidgetComponent {
187
+ constructor(formBuilder, croemCardService) {
188
+ this.formBuilder = formBuilder;
189
+ this.croemCardService = croemCardService;
190
+ this.widgetResponseEmitter = new EventEmitter();
191
+ this.fieldResponseEmitter = new EventEmitter();
192
+ this.loader = new EventEmitter();
193
+ this.fields = [];
194
+ this.dynamicFields = {};
195
+ this.showLoader = false;
196
+ this.showInputErrorNumber = true;
197
+ this.showInputErrorDate = true;
198
+ this.showInputErrorName = true;
199
+ this.maxLength = 19;
200
+ this.maxExpYear = 28;
201
+ }
202
+ ngOnInit() {
203
+ this.switchLanguage(this.inputParamsForWidgetForAdd.Culture);
204
+ //---Dynamic Form creation innitializing form group(i.e cardForm) to pass onto the dynamic form builder component ------
205
+ for (const field of this.fields) {
206
+ const validators = [];
207
+ if (field.required) {
208
+ validators.push(Validators.required);
209
+ }
210
+ this.dynamicFields[field.name] = [field.value || null, validators];
211
+ }
212
+ const predefinedControls = {
213
+ name: ['', [Validators.required]],
214
+ cardNumber: ['', [Validators.required, Validators.minLength(10), Validators.maxLength(19)]],
215
+ validityDate: ['', [Validators.required, Validators.minLength(5)]],
216
+ };
217
+ this.cardForm = this.formBuilder.group(Object.assign(Object.assign({}, predefinedControls), this.dynamicFields));
218
+ let fieldsContrls = {};
219
+ for (let f of this.fields) {
220
+ if (f.type !== 'checkbox') {
221
+ fieldsContrls[f.name] = new FormControl(f.value || '', Validators.required);
222
+ }
223
+ else {
224
+ let opts = {};
225
+ if (f.options) {
226
+ for (let opt of f.options) {
227
+ opts[opt.key] = new FormControl(opt.label);
228
+ }
229
+ }
230
+ fieldsContrls[f.name] = new FormGroup(opts);
231
+ }
232
+ }
233
+ }
234
+ //---localization To add a new property to this go localization dir and add your property insdei en.ts and es.ts ------
235
+ switchLanguage(language) {
236
+ if (language === 'en') {
237
+ this.currentLang = LANG_EN;
238
+ }
239
+ else if (language === 'es') {
240
+ this.currentLang = LANG_ES;
241
+ }
242
+ }
243
+ createCard() {
244
+ this.addCard();
245
+ }
246
+ addCard() {
247
+ return __awaiter(this, void 0, void 0, function* () {
248
+ try {
249
+ this.showLoader = true;
250
+ this.loader.emit(this.showLoader);
251
+ const apiUrl = this.inputParamsForWidgetForAdd.DtrUrl + constants.urls.addDTRUrl;
252
+ //----encryption-------
253
+ var encode = this.encoding(); //--encoding parameters
254
+ this.encryptedString = this.innitializeKey(encode); //--innitializing DSA key
255
+ this.addCardResponse = yield this.croemCardService.addUpdateCardAPICall(apiUrl, this.encryptedString); //--API Call to add card in DTR
256
+ this.showLoader = false;
257
+ this.fieldResponseEmitter.emit(this.cardForm.controls);
258
+ this.widgetResponseEmitter.emit(this.addCardResponse);
259
+ }
260
+ catch (error) {
261
+ console.log(error);
262
+ this.showLoader = false;
263
+ this.widgetResponseEmitter.emit(this.addCardResponse);
264
+ }
265
+ });
266
+ }
267
+ encoding() {
268
+ var _a, _b, _c, _d;
269
+ return this.cardForm.value.cardNumber + "\\" +
270
+ this.cardForm.value.name + "\\" +
271
+ this.cardForm.value.validityDate.substring(0, 2) + "\\" +
272
+ this.cardForm.value.validityDate.substring(3) + "\\" +
273
+ "" + "\\" +
274
+ "" + "\\" +
275
+ this.inputParamsForWidgetForAdd.APIKey + "\\" +
276
+ this.inputParamsForWidgetForAdd.Culture + "\\" +
277
+ "" + "\\" +
278
+ ((_a = this.inputParamsForWidgetForAdd.IsSale) !== null && _a !== void 0 ? _a : false) + "\\" +
279
+ ((_b = this.inputParamsForWidgetForAdd.Amount) !== null && _b !== void 0 ? _b : "0") + "\\" +
280
+ ((_c = this.inputParamsForWidgetForAdd.ProductDetails) !== null && _c !== void 0 ? _c : "0") + "\\" +
281
+ "" + "\\" +
282
+ "" + "\\" +
283
+ ((_d = this.inputParamsForWidgetForAdd.Itbms) !== null && _d !== void 0 ? _d : "0") + "\\" +
284
+ this.inputParamsForWidgetForAdd.Mode;
285
+ }
286
+ innitializeKey(encode) {
287
+ var key = initializeKey(this.inputParamsForWidgetForAdd.Keys.EncKey1, this.inputParamsForWidgetForAdd.Keys.EncKey2);
288
+ return encryptedString(key, encode);
289
+ }
290
+ formatDate(event) {
291
+ let input = event.target.value;
292
+ input = input.replace(/\D/g, '');
293
+ const month = this.formatMonth(input.substring(0, 2));
294
+ const year = input.substring(2, 4);
295
+ const formattedDate = month + (year ? '/' + year : '');
296
+ event.target.value = formattedDate;
297
+ this.cardForm.controls['validityDate'].setValue(formattedDate);
298
+ this.validityDate = this.cardForm.controls['validityDate'].value;
299
+ this.validateDate();
300
+ }
301
+ formatMonth(month) {
302
+ const validMonth = parseInt(month, 10);
303
+ return (validMonth > 1 && validMonth <= 9) ? '0' + validMonth : month;
304
+ }
305
+ maskCardNumber() {
306
+ if (this.cardNumber && this.cardNumber.length > 0) {
307
+ const maskedNumber = '•'.repeat(Math.max(0, this.cardNumber.length - 4)) + this.cardNumber.slice(-4);
308
+ return maskedNumber.replace(/(•{4})/g, '$1 ');
309
+ }
310
+ else {
311
+ return '•••• •••• •••• ••••';
312
+ }
313
+ }
314
+ maskName() {
315
+ return this.name ? this.name : 'Your Name';
316
+ }
317
+ maskDate() {
318
+ return this.validityDate ? this.validityDate : '••/••';
319
+ }
320
+ validateDate() {
321
+ if (!this.inputParamsForWidgetForAdd.IsSale) {
322
+ this.showInputErrorDate = cardValidator.expirationDate(this.validityDate, this.maxExpYear).isValid;
323
+ }
324
+ else {
325
+ this.showInputErrorDate = true;
326
+ }
327
+ }
328
+ validateNumber() {
329
+ const valid = cardValidator.number(this.cardNumber).isValid;
330
+ this.showInputErrorNumber = valid;
331
+ }
332
+ bindNumber(event) {
333
+ this.cardNumber = event.target.value;
334
+ this.validateNumber();
335
+ }
336
+ bindName(event) {
337
+ this.name = event.target.value;
338
+ this.validateName();
339
+ }
340
+ restControl(controlname) {
341
+ const control = this.cardForm.get(controlname);
342
+ control.reset();
343
+ }
344
+ validateName() {
345
+ if (this.name.length > 4) {
346
+ this.showInputErrorName = true;
347
+ }
348
+ else {
349
+ this.showInputErrorName = false;
350
+ }
351
+ }
352
+ }
353
+ AddCardWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AddCardWidgetComponent, deps: [{ token: i1.FormBuilder }, { token: CroemCardWidgetService }], target: i0.ɵɵFactoryTarget.Component });
354
+ AddCardWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AddCardWidgetComponent, selector: "lib-add-card-widget", inputs: { inputParamsForWidgetForAdd: "inputParamsForWidgetForAdd", fields: "fields" }, outputs: { widgetResponseEmitter: "widgetResponseEmitter", fieldResponseEmitter: "fieldResponseEmitter", loader: "loader" }, ngImport: i0, template: "<form class=\"container-fluid py-3\" [formGroup]=\"cardForm\" *ngIf=\"(inputParamsForWidgetForAdd.APIKey)\">\r\n <div class=\"p-0\">\r\n <div class=\"d-flex justify-content-center mb-4\">\r\n <div class=\"card\">\r\n <div class=\"card-inner\">\r\n <div class=\"front\">\r\n <!-- Top Bar: Chip & Brand Logo -->\r\n <div class=\"card-top-bar\">\r\n <div class=\"chip\"></div>\r\n <div class=\"card-brand\">\r\n <span class=\"brand-text\">SECURE CARD</span>\r\n </div>\r\n </div>\r\n\r\n <!-- Middle Bar: Card Number -->\r\n <div class=\"card-number-display\">\r\n <span>{{maskCardNumber()}}</span>\r\n </div>\r\n\r\n <!-- Bottom Bar: Cardholder Name & Expiration Date -->\r\n <div class=\"card-bottom-bar\">\r\n <div class=\"card-holder-info\">\r\n <label class=\"card-label\">CARDHOLDER</label>\r\n <span class=\"card-value\">{{maskName()}}</span>\r\n </div>\r\n <div class=\"card-expiry-info\">\r\n <label class=\"card-label\">{{currentLang[\"ValidThru\"]}}</label>\r\n <span class=\"card-value\">{{maskDate()}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Dynamic Form Fields -->\r\n <div class=\"dynamic-fields-container mb-3\">\r\n <div *ngFor=\"let field of fields\" class=\"mb-3\">\r\n <field-builder [field]=\"field\" [form]=\"cardForm\"></field-builder>\r\n </div>\r\n </div>\r\n\r\n <!-- Static Form Fields -->\r\n <div class=\"card-form-fields\">\r\n <div class=\"row mb-3\">\r\n <div class=\"col-12\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"card-number\" class=\"form-label-custom\">\r\n {{currentLang[\"CardNumber\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"card-number\"\r\n [class.inputError]=\"!showInputErrorNumber\" [placeholder]=\"currentLang['CardNumber']\"\r\n formControlName=\"cardNumber\" (input)=\"bindNumber($event)\" [maxlength]=\"maxLength\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mb-3\">\r\n <div class=\"col-12\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"name\" class=\"form-label-custom\">\r\n {{currentLang[\"CardHolderName\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"name\"\r\n [placeholder]=\"currentLang['CardHolderName']\" [class.inputError]=\"!showInputErrorName\"\r\n (input)=\"bindName($event)\" formControlName=\"name\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mb-4\">\r\n <div class=\"col-6\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"validity-date\" class=\"form-label-custom\">\r\n {{currentLang[\"ExpiryDate\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper date-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"validity-date\"\r\n [class.inputError]=\"!showInputErrorDate\" placeholder=\"MM/YY\"\r\n formControlName=\"validityDate\" (input)=\"formatDate($event)\" />\r\n <span class=\"calendar-icon\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-actions-custom\">\r\n <button class=\"btn-submit\" type=\"submit\" [disabled]=\"!cardForm.valid\" (click)=\"createCard()\">\r\n <span class=\"btn-text\">{{currentLang[\"lblSave\"]}}</span>\r\n </button>\r\n </div>\r\n</form>", styles: [".card{width:100%;max-width:400px;height:230px;color:#fff;perspective:1000px;border:none;background:transparent;margin:0 auto}.card-inner{width:100%;height:100%;position:relative;transition:transform .8s cubic-bezier(.175,.885,.32,1.275);transform-style:preserve-3d}.front{width:100%;height:100%;position:absolute;top:0;left:0;padding:24px 28px;border-radius:20px;overflow:hidden;z-index:1;backface-visibility:hidden;background:linear-gradient(135deg,rgba(17,24,39,.95) 0%,rgba(31,41,55,.95) 100%);box-shadow:0 20px 35px #00000040,inset 0 1px #ffffff26;border:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;justify-content:space-between;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:all .3s ease}.front:before{content:\"\";position:absolute;top:-50%;left:-50%;width:200%;height:200%;background:radial-gradient(circle,rgba(99,102,241,.12) 0%,transparent 70%);pointer-events:none}.card-top-bar{display:flex;justify-content:space-between;align-items:center}.chip{width:48px;height:35px;background:linear-gradient(135deg,#f59e0b 0%,#d97706 100%);border-radius:6px;position:relative;box-shadow:inset 0 1px 2px #ffffff4d}.chip:before{content:\"\";position:absolute;inset:0;border:1px solid rgba(0,0,0,.15);border-radius:6px;background-image:linear-gradient(90deg,transparent 50%,rgba(0,0,0,.1) 50%),linear-gradient(0deg,transparent 50%,rgba(0,0,0,.1) 50%);background-size:10px 10px}.brand-text{font-size:10px;letter-spacing:2px;color:#ffffffb3;font-weight:700;text-shadow:0 2px 4px rgba(0,0,0,.2)}.card-number-display{font-family:Courier New,Courier,monospace;font-size:20px;letter-spacing:3px;color:#fff;text-shadow:0 2px 4px rgba(0,0,0,.3);margin:18px 0;text-align:center;-webkit-user-select:none;user-select:none}.card-bottom-bar{display:flex;justify-content:space-between;align-items:flex-end}.card-label{display:block;font-size:8px;color:#fff6;letter-spacing:1.5px;margin-bottom:2px;text-transform:uppercase}.card-value{display:block;font-size:13px;color:#fff;letter-spacing:.5px;font-weight:600;max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.form-group-custom{display:flex;flex-direction:column;margin-bottom:12px}.form-label-custom{font-size:13px;font-weight:600;color:#374151;margin-bottom:6px;letter-spacing:.2px}.input-wrapper{position:relative;width:100%}.form-control-custom{width:100%;background-color:#f9fafb;border:1px solid #d1d5db;border-radius:8px;padding:10px 14px;font-size:14px;color:#1f2937;transition:all .2s ease-in-out;box-shadow:inset 0 1px 2px #00000005}.form-control-custom:focus{background-color:#fff;border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51f;outline:none}.inputError,.inputError:focus{border-color:#ef4444!important;box-shadow:0 0 0 3px #ef44441f!important}.date-wrapper{display:flex;align-items:center}.calendar-icon{width:18px;height:18px;position:absolute;right:12px;pointer-events:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain}.form-actions-custom{display:flex;justify-content:flex-end;margin-top:20px;border-top:1px solid #f3f4f6;padding-top:16px}.btn-submit{color:#fff;background-color:#5a75b6;border:solid 2px #5A75B6;border-radius:8px;padding:8px;min-width:120px;margin-right:10px}.btn-submit:hover{background-color:#3e578e;color:#fff}.btn-submit:disabled,.btn-previous:disabled,.btn-next:disabled{background-color:#ecebeb!important;border:solid 2px #ecebeb!important;color:#9c9c9c!important;cursor:not-allowed}.breathing-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0f172a99;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:9999}.show{display:block}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FieldBuilderComponent, selector: "field-builder", inputs: ["field", "form"] }] });
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AddCardWidgetComponent, decorators: [{
356
+ type: Component,
357
+ args: [{ selector: 'lib-add-card-widget', template: "<form class=\"container-fluid py-3\" [formGroup]=\"cardForm\" *ngIf=\"(inputParamsForWidgetForAdd.APIKey)\">\r\n <div class=\"p-0\">\r\n <div class=\"d-flex justify-content-center mb-4\">\r\n <div class=\"card\">\r\n <div class=\"card-inner\">\r\n <div class=\"front\">\r\n <!-- Top Bar: Chip & Brand Logo -->\r\n <div class=\"card-top-bar\">\r\n <div class=\"chip\"></div>\r\n <div class=\"card-brand\">\r\n <span class=\"brand-text\">SECURE CARD</span>\r\n </div>\r\n </div>\r\n\r\n <!-- Middle Bar: Card Number -->\r\n <div class=\"card-number-display\">\r\n <span>{{maskCardNumber()}}</span>\r\n </div>\r\n\r\n <!-- Bottom Bar: Cardholder Name & Expiration Date -->\r\n <div class=\"card-bottom-bar\">\r\n <div class=\"card-holder-info\">\r\n <label class=\"card-label\">CARDHOLDER</label>\r\n <span class=\"card-value\">{{maskName()}}</span>\r\n </div>\r\n <div class=\"card-expiry-info\">\r\n <label class=\"card-label\">{{currentLang[\"ValidThru\"]}}</label>\r\n <span class=\"card-value\">{{maskDate()}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Dynamic Form Fields -->\r\n <div class=\"dynamic-fields-container mb-3\">\r\n <div *ngFor=\"let field of fields\" class=\"mb-3\">\r\n <field-builder [field]=\"field\" [form]=\"cardForm\"></field-builder>\r\n </div>\r\n </div>\r\n\r\n <!-- Static Form Fields -->\r\n <div class=\"card-form-fields\">\r\n <div class=\"row mb-3\">\r\n <div class=\"col-12\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"card-number\" class=\"form-label-custom\">\r\n {{currentLang[\"CardNumber\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"card-number\"\r\n [class.inputError]=\"!showInputErrorNumber\" [placeholder]=\"currentLang['CardNumber']\"\r\n formControlName=\"cardNumber\" (input)=\"bindNumber($event)\" [maxlength]=\"maxLength\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mb-3\">\r\n <div class=\"col-12\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"name\" class=\"form-label-custom\">\r\n {{currentLang[\"CardHolderName\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"name\"\r\n [placeholder]=\"currentLang['CardHolderName']\" [class.inputError]=\"!showInputErrorName\"\r\n (input)=\"bindName($event)\" formControlName=\"name\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mb-4\">\r\n <div class=\"col-6\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"validity-date\" class=\"form-label-custom\">\r\n {{currentLang[\"ExpiryDate\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper date-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"validity-date\"\r\n [class.inputError]=\"!showInputErrorDate\" placeholder=\"MM/YY\"\r\n formControlName=\"validityDate\" (input)=\"formatDate($event)\" />\r\n <span class=\"calendar-icon\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-actions-custom\">\r\n <button class=\"btn-submit\" type=\"submit\" [disabled]=\"!cardForm.valid\" (click)=\"createCard()\">\r\n <span class=\"btn-text\">{{currentLang[\"lblSave\"]}}</span>\r\n </button>\r\n </div>\r\n</form>", styles: [".card{width:100%;max-width:400px;height:230px;color:#fff;perspective:1000px;border:none;background:transparent;margin:0 auto}.card-inner{width:100%;height:100%;position:relative;transition:transform .8s cubic-bezier(.175,.885,.32,1.275);transform-style:preserve-3d}.front{width:100%;height:100%;position:absolute;top:0;left:0;padding:24px 28px;border-radius:20px;overflow:hidden;z-index:1;backface-visibility:hidden;background:linear-gradient(135deg,rgba(17,24,39,.95) 0%,rgba(31,41,55,.95) 100%);box-shadow:0 20px 35px #00000040,inset 0 1px #ffffff26;border:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;justify-content:space-between;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:all .3s ease}.front:before{content:\"\";position:absolute;top:-50%;left:-50%;width:200%;height:200%;background:radial-gradient(circle,rgba(99,102,241,.12) 0%,transparent 70%);pointer-events:none}.card-top-bar{display:flex;justify-content:space-between;align-items:center}.chip{width:48px;height:35px;background:linear-gradient(135deg,#f59e0b 0%,#d97706 100%);border-radius:6px;position:relative;box-shadow:inset 0 1px 2px #ffffff4d}.chip:before{content:\"\";position:absolute;inset:0;border:1px solid rgba(0,0,0,.15);border-radius:6px;background-image:linear-gradient(90deg,transparent 50%,rgba(0,0,0,.1) 50%),linear-gradient(0deg,transparent 50%,rgba(0,0,0,.1) 50%);background-size:10px 10px}.brand-text{font-size:10px;letter-spacing:2px;color:#ffffffb3;font-weight:700;text-shadow:0 2px 4px rgba(0,0,0,.2)}.card-number-display{font-family:Courier New,Courier,monospace;font-size:20px;letter-spacing:3px;color:#fff;text-shadow:0 2px 4px rgba(0,0,0,.3);margin:18px 0;text-align:center;-webkit-user-select:none;user-select:none}.card-bottom-bar{display:flex;justify-content:space-between;align-items:flex-end}.card-label{display:block;font-size:8px;color:#fff6;letter-spacing:1.5px;margin-bottom:2px;text-transform:uppercase}.card-value{display:block;font-size:13px;color:#fff;letter-spacing:.5px;font-weight:600;max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.form-group-custom{display:flex;flex-direction:column;margin-bottom:12px}.form-label-custom{font-size:13px;font-weight:600;color:#374151;margin-bottom:6px;letter-spacing:.2px}.input-wrapper{position:relative;width:100%}.form-control-custom{width:100%;background-color:#f9fafb;border:1px solid #d1d5db;border-radius:8px;padding:10px 14px;font-size:14px;color:#1f2937;transition:all .2s ease-in-out;box-shadow:inset 0 1px 2px #00000005}.form-control-custom:focus{background-color:#fff;border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51f;outline:none}.inputError,.inputError:focus{border-color:#ef4444!important;box-shadow:0 0 0 3px #ef44441f!important}.date-wrapper{display:flex;align-items:center}.calendar-icon{width:18px;height:18px;position:absolute;right:12px;pointer-events:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain}.form-actions-custom{display:flex;justify-content:flex-end;margin-top:20px;border-top:1px solid #f3f4f6;padding-top:16px}.btn-submit{color:#fff;background-color:#5a75b6;border:solid 2px #5A75B6;border-radius:8px;padding:8px;min-width:120px;margin-right:10px}.btn-submit:hover{background-color:#3e578e;color:#fff}.btn-submit:disabled,.btn-previous:disabled,.btn-next:disabled{background-color:#ecebeb!important;border:solid 2px #ecebeb!important;color:#9c9c9c!important;cursor:not-allowed}.breathing-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0f172a99;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:9999}.show{display:block}\n"] }]
358
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: CroemCardWidgetService }]; }, propDecorators: { inputParamsForWidgetForAdd: [{
359
+ type: Input
360
+ }], widgetResponseEmitter: [{
361
+ type: Output
362
+ }], fieldResponseEmitter: [{
363
+ type: Output
364
+ }], loader: [{
365
+ type: Output
366
+ }], fields: [{
367
+ type: Input
368
+ }] } });
369
+
370
+ class UpdateCardWidgetComponent {
371
+ constructor(formBuilder, croemCardService) {
372
+ this.formBuilder = formBuilder;
373
+ this.croemCardService = croemCardService;
374
+ this.widgetResponseEmitter = new EventEmitter();
375
+ this.getWidgetDataResponseEmitter = new EventEmitter();
376
+ this.fieldResponseEmitter = new EventEmitter();
377
+ this.loader = new EventEmitter();
378
+ this.fields = [];
379
+ this.dynamicFields = {};
380
+ this.showLoader = false;
381
+ this.showInputErrorDate = true;
382
+ this.showInputErrorName = true;
383
+ this.CardMode = CardMode;
384
+ this.maxLength = 19;
385
+ this.maxExpYear = 28;
386
+ }
387
+ ngOnInit() {
388
+ this.switchLanguage(this.inputParamsForWidgetForUpdate.Culture);
389
+ this.getCardDetails();
390
+ //---Dynamic Form creation innitializing form group(i.e cardForm) to pass onto the dynamic form builder component ------
391
+ for (const field of this.fields) {
392
+ const validators = [];
393
+ if (field.required) {
394
+ validators.push(Validators.required);
395
+ }
396
+ this.dynamicFields[field.name] = [field.value || null, validators];
397
+ }
398
+ const predefinedControls = {
399
+ name: ['', [Validators.required]],
400
+ validityDate: ['', [Validators.required, Validators.minLength(5)]],
401
+ };
402
+ this.cardForm = this.formBuilder.group(Object.assign(Object.assign({}, predefinedControls), this.dynamicFields));
403
+ let fieldsContrls = {};
404
+ for (let f of this.fields) {
405
+ if (f.type !== 'checkbox') {
406
+ fieldsContrls[f.name] = new FormControl(f.value || '', Validators.required);
407
+ }
408
+ else {
409
+ let opts = {};
410
+ if (f.options) {
411
+ for (let opt of f.options) {
412
+ opts[opt.key] = new FormControl(opt.label);
413
+ }
414
+ }
415
+ fieldsContrls[f.name] = new FormGroup(opts);
416
+ }
417
+ }
418
+ }
419
+ ngOnChanges(changes) {
420
+ for (const field of this.fields) {
421
+ const validators = [];
422
+ if (field.required) {
423
+ validators.push(Validators.required);
424
+ }
425
+ this.dynamicFields[field.name] = [field.value || null, validators];
426
+ }
427
+ let fieldsContrls = {};
428
+ for (let f of this.fields) {
429
+ if (f.type !== 'checkbox') {
430
+ fieldsContrls[f.name] = new FormControl(f.value || '', Validators.required);
431
+ }
432
+ else {
433
+ let opts = {};
434
+ if (f.options) {
435
+ for (let opt of f.options) {
436
+ opts[opt.key] = new FormControl(opt.label);
437
+ }
438
+ }
439
+ fieldsContrls[f.name] = new FormGroup(opts);
440
+ }
441
+ }
442
+ }
443
+ //---localization To add a new property to this go localization dir and add your property insdei en.ts and es.ts ------
444
+ switchLanguage(language) {
445
+ if (language === 'en') {
446
+ this.currentLang = LANG_EN;
447
+ }
448
+ else if (language === 'es') {
449
+ this.currentLang = LANG_ES;
450
+ }
451
+ }
452
+ UpdateCardDetails() {
453
+ this.EditCardDetails();
454
+ }
455
+ getCardDetails() {
456
+ return __awaiter(this, void 0, void 0, function* () {
457
+ this.showLoader = true;
458
+ this.loader.emit(this.showLoader);
459
+ try {
460
+ const apiUrl = this.inputParamsForWidgetForUpdate.DtrUrl + constants.urls.getCardInfoByToken;
461
+ //----encryption-------
462
+ var encode = this.encodingForGet(); //--encoding parameters
463
+ this.encryptedString = this.innitializeKey(encode); //--innitializing DSA key
464
+ var getCardResponse = yield this.croemCardService.addUpdateCardAPICall(apiUrl, this.encryptedString); //--API Call to add card in DTR
465
+ this.showLoader = false;
466
+ this.updateCardResponse = getCardResponse;
467
+ this.updateName(getCardResponse.ResponseData.CardHolderName || getCardResponse.ResponseData.CardholderName, getCardResponse.ResponseData.ExpirationDate, getCardResponse.ResponseData.Number);
468
+ this.getWidgetDataResponseEmitter.emit(this.updateCardResponse);
469
+ }
470
+ catch (error) {
471
+ console.log(error);
472
+ this.showLoader = false;
473
+ this.getWidgetDataResponseEmitter.emit(this.updateCardResponse);
474
+ }
475
+ });
476
+ }
477
+ EditCardDetails() {
478
+ return __awaiter(this, void 0, void 0, function* () {
479
+ try {
480
+ this.showLoader = true;
481
+ this.loader.emit(this.showLoader);
482
+ const apiUrl = this.inputParamsForWidgetForUpdate.DtrUrl + constants.urls.updateDTRUrl;
483
+ //----encryption-------
484
+ var encode = this.encoding(); //--encoding parameters
485
+ this.encryptedString = this.innitializeKey(encode); //--innitializing DSA key
486
+ this.updateCardResponse = yield this.croemCardService.addUpdateCardAPICall(apiUrl, this.encryptedString); //--API Call to add card in DTR
487
+ this.showLoader = false;
488
+ this.fieldResponseEmitter.emit(this.cardForm.controls);
489
+ this.widgetResponseEmitter.emit(this.updateCardResponse);
490
+ }
491
+ catch (error) {
492
+ console.log(error);
493
+ this.showLoader = false;
494
+ this.widgetResponseEmitter.emit(this.updateCardResponse);
495
+ }
496
+ });
497
+ }
498
+ updateName(newName, newDate, newNumber = '') {
499
+ if (newDate.length === 4) {
500
+ newDate = newDate.substring(0, 2) + '/' + newDate.substring(2);
501
+ }
502
+ this.cardForm.patchValue({
503
+ name: newName,
504
+ validityDate: newDate
505
+ });
506
+ this.name = newName;
507
+ this.validityDate = newDate;
508
+ if (newNumber) {
509
+ this.cardNumber = newNumber;
510
+ }
511
+ }
512
+ maskCardNumber() {
513
+ if (this.cardNumber && this.cardNumber.length > 0) {
514
+ const maskedNumber = '•'.repeat(Math.max(0, this.cardNumber.length - 4)) + this.cardNumber.slice(-4);
515
+ return maskedNumber.replace(/(•{4})/g, '$1 ');
516
+ }
517
+ else {
518
+ return '•••• •••• •••• ••••';
519
+ }
520
+ }
521
+ encodingForGet() {
522
+ return "" + "\\" +
523
+ "" + "\\" +
524
+ "" + "\\" +
525
+ "" + "\\" +
526
+ this.inputParamsForWidgetForUpdate.Token + "\\" +
527
+ "" + "\\" +
528
+ this.inputParamsForWidgetForUpdate.APIKey + "\\" +
529
+ this.inputParamsForWidgetForUpdate.Culture + "\\" +
530
+ "" + "\\" +
531
+ this.inputParamsForWidgetForUpdate.IsSale + "\\" +
532
+ this.inputParamsForWidgetForUpdate.Amount + "\\" +
533
+ this.inputParamsForWidgetForUpdate.ProductDetails + "\\" +
534
+ "" + "\\" +
535
+ "" + "\\" +
536
+ this.inputParamsForWidgetForUpdate.Itbms + "\\" +
537
+ this.inputParamsForWidgetForUpdate.Mode;
538
+ }
539
+ encoding() {
540
+ var _a, _b, _c, _d;
541
+ return "" + "\\" +
542
+ this.cardForm.value.name + "\\" +
543
+ this.cardForm.value.validityDate.substring(0, 2) + "\\" +
544
+ this.cardForm.value.validityDate.substring(3) + "\\" +
545
+ this.inputParamsForWidgetForUpdate.Token + "\\" +
546
+ "" + "\\" +
547
+ this.inputParamsForWidgetForUpdate.APIKey + "\\" +
548
+ this.inputParamsForWidgetForUpdate.Culture + "\\" +
549
+ "" + "\\" +
550
+ ((_a = this.inputParamsForWidgetForUpdate.IsSale) !== null && _a !== void 0 ? _a : false) + "\\" +
551
+ ((_b = this.inputParamsForWidgetForUpdate.Amount) !== null && _b !== void 0 ? _b : "0") + "\\" +
552
+ ((_c = this.inputParamsForWidgetForUpdate.ProductDetails) !== null && _c !== void 0 ? _c : "0") + "\\" +
553
+ "" + "\\" +
554
+ "" + "\\" +
555
+ ((_d = this.inputParamsForWidgetForUpdate.Itbms) !== null && _d !== void 0 ? _d : "0") + "\\" +
556
+ this.inputParamsForWidgetForUpdate.Mode;
557
+ }
558
+ innitializeKey(encode) {
559
+ var key = initializeKey(this.inputParamsForWidgetForUpdate.Keys.EncKey1, this.inputParamsForWidgetForUpdate.Keys.EncKey2);
560
+ return encryptedString(key, encode);
561
+ }
562
+ formatDate(event) {
563
+ let input = event.target.value;
564
+ input = input.replace(/\D/g, '');
565
+ const month = this.formatMonth(input.substring(0, 2));
566
+ const year = input.substring(2, 4);
567
+ const formattedDate = month + (year ? '/' + year : '');
568
+ event.target.value = formattedDate;
569
+ this.cardForm.controls['validityDate'].setValue(formattedDate);
570
+ this.validityDate = this.cardForm.controls['validityDate'].value;
571
+ this.validateDate();
572
+ }
573
+ formatMonth(month) {
574
+ const validMonth = parseInt(month, 10);
575
+ return (validMonth > 1 && validMonth <= 9) ? '0' + validMonth : month;
576
+ }
577
+ maskName() {
578
+ return this.name ? this.name : 'Your Name';
579
+ }
580
+ maskDate() {
581
+ return this.validityDate ? this.validityDate : '••/••';
582
+ }
583
+ validateDate() {
584
+ if (!this.inputParamsForWidgetForUpdate.IsSale) {
585
+ this.showInputErrorDate = cardValidator.expirationDate(this.validityDate, this.maxExpYear).isValid;
586
+ }
587
+ else {
588
+ this.showInputErrorDate = true;
589
+ }
590
+ }
591
+ bindName(event) {
592
+ this.name = event.target.value;
593
+ this.validateName();
594
+ }
595
+ bindDate(event) {
596
+ this.validityDate = event.target.value;
597
+ ;
598
+ }
599
+ validateName() {
600
+ if (this.name.length > 4) {
601
+ this.showInputErrorName = true;
602
+ }
603
+ else {
604
+ this.showInputErrorName = false;
605
+ }
606
+ }
607
+ }
608
+ UpdateCardWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UpdateCardWidgetComponent, deps: [{ token: i1.FormBuilder }, { token: CroemCardWidgetService }], target: i0.ɵɵFactoryTarget.Component });
609
+ UpdateCardWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: UpdateCardWidgetComponent, selector: "lib-update-card-widget", inputs: { inputParamsForWidgetForUpdate: "inputParamsForWidgetForUpdate", fields: "fields" }, outputs: { widgetResponseEmitter: "widgetResponseEmitter", getWidgetDataResponseEmitter: "getWidgetDataResponseEmitter", fieldResponseEmitter: "fieldResponseEmitter", loader: "loader" }, usesOnChanges: true, ngImport: i0, template: "<form class=\"container-fluid py-3\" [formGroup]=\"cardForm\" *ngIf=\"(inputParamsForWidgetForUpdate.APIKey)\">\r\n <div class=\"p-0\">\r\n <div class=\"d-flex justify-content-center mb-4\">\r\n <div class=\"card\">\r\n <div class=\"card-inner\">\r\n <div class=\"front\">\r\n <!-- Top Bar: Chip & Brand Logo -->\r\n <div class=\"card-top-bar\">\r\n <div class=\"chip\"></div>\r\n <div class=\"card-brand\">\r\n <span class=\"brand-text\">SECURE CARD</span>\r\n </div>\r\n </div>\r\n \r\n <!-- Middle Bar: Card Number (Masked) -->\r\n <div class=\"card-number-display\">\r\n <span>{{maskCardNumber()}}</span>\r\n </div>\r\n \r\n <!-- Bottom Bar: Cardholder Name & Expiration Date -->\r\n <div class=\"card-bottom-bar\">\r\n <div class=\"card-holder-info\">\r\n <label class=\"card-label\">CARDHOLDER</label>\r\n <span class=\"card-value\">{{maskName()}}</span>\r\n </div>\r\n <div class=\"card-expiry-info\">\r\n <label class=\"card-label\">{{currentLang[\"ValidThru\"]}}</label>\r\n <span class=\"card-value\">{{maskDate()}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Dynamic Form Fields -->\r\n <div class=\"dynamic-fields-container mb-3\">\r\n <div *ngFor=\"let field of fields\" class=\"mb-3\">\r\n <field-builder [field]=\"field\" [form]=\"cardForm\"></field-builder>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Static Form Fields -->\r\n <div class=\"card-form-fields\">\r\n <div class=\"row mb-3\">\r\n <div class=\"col-12\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"name\" class=\"form-label-custom\">\r\n {{currentLang[\"CardHolderName\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"name\" [placeholder]=\"currentLang['CardHolderName']\"\r\n [class.inputError]=\"!showInputErrorName\" (input)=\"bindName($event)\" formControlName=\"name\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mb-4\">\r\n <div class=\"col-6\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"validity-date\" class=\"form-label-custom\">\r\n {{currentLang[\"ExpiryDate\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper date-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"validity-date\"\r\n [class.inputError]=\"!showInputErrorDate\" placeholder=\"MM/YY\"\r\n formControlName=\"validityDate\" (input)=\"formatDate($event)\" />\r\n <span class=\"calendar-icon\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-actions-custom\">\r\n <button class=\"btn-submit\" *ngIf=\"(inputParamsForWidgetForUpdate.Mode==CardMode.Edit)\" type=\"submit\" [disabled]=\"!cardForm.valid\"\r\n (click)=\"UpdateCardDetails()\">\r\n <span class=\"btn-text\">{{currentLang[\"Update\"]}}</span>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".card{width:100%;max-width:400px;height:230px;color:#fff;perspective:1000px;border:none;background:transparent;margin:0 auto}.card-inner{width:100%;height:100%;position:relative;transition:transform .8s cubic-bezier(.175,.885,.32,1.275);transform-style:preserve-3d}.front{width:100%;height:100%;position:absolute;top:0;left:0;padding:24px 28px;border-radius:20px;overflow:hidden;z-index:1;backface-visibility:hidden;background:linear-gradient(135deg,rgba(17,24,39,.95) 0%,rgba(31,41,55,.95) 100%);box-shadow:0 20px 35px #00000040,inset 0 1px #ffffff26;border:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;justify-content:space-between;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:all .3s ease}.front:before{content:\"\";position:absolute;top:-50%;left:-50%;width:200%;height:200%;background:radial-gradient(circle,rgba(99,102,241,.12) 0%,transparent 70%);pointer-events:none}.card-top-bar{display:flex;justify-content:space-between;align-items:center}.chip{width:48px;height:35px;background:linear-gradient(135deg,#f59e0b 0%,#d97706 100%);border-radius:6px;position:relative;box-shadow:inset 0 1px 2px #ffffff4d}.chip:before{content:\"\";position:absolute;inset:0;border:1px solid rgba(0,0,0,.15);border-radius:6px;background-image:linear-gradient(90deg,transparent 50%,rgba(0,0,0,.1) 50%),linear-gradient(0deg,transparent 50%,rgba(0,0,0,.1) 50%);background-size:10px 10px}.brand-text{font-size:10px;letter-spacing:2px;color:#ffffffb3;font-weight:700;text-shadow:0 2px 4px rgba(0,0,0,.2)}.card-number-display{font-family:Courier New,Courier,monospace;font-size:20px;letter-spacing:3px;color:#fff;text-shadow:0 2px 4px rgba(0,0,0,.3);margin:18px 0;text-align:center;-webkit-user-select:none;user-select:none}.card-bottom-bar{display:flex;justify-content:space-between;align-items:flex-end}.card-label{display:block;font-size:8px;color:#fff6;letter-spacing:1.5px;margin-bottom:2px;text-transform:uppercase}.card-value{display:block;font-size:13px;color:#fff;letter-spacing:.5px;font-weight:600;max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.form-group-custom{display:flex;flex-direction:column;margin-bottom:12px}.form-label-custom{font-size:13px;font-weight:600;color:#374151;margin-bottom:6px;letter-spacing:.2px}.input-wrapper{position:relative;width:100%}.form-control-custom{width:100%;background-color:#f9fafb;border:1px solid #d1d5db;border-radius:8px;padding:10px 14px;font-size:14px;color:#1f2937;transition:all .2s ease-in-out;box-shadow:inset 0 1px 2px #00000005}.form-control-custom:focus{background-color:#fff;border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51f;outline:none}.inputError,.inputError:focus{border-color:#ef4444!important;box-shadow:0 0 0 3px #ef44441f!important}.date-wrapper{display:flex;align-items:center}.calendar-icon{width:18px;height:18px;position:absolute;right:12px;pointer-events:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain}.form-actions-custom{display:flex;justify-content:flex-end;margin-top:20px;border-top:1px solid #f3f4f6;padding-top:16px}.btn-submit{color:#fff;background-color:#5a75b6;border:solid 2px #5A75B6;border-radius:8px;padding:8px;min-width:120px;margin-right:10px}.btn-submit:hover{background-color:#3e578e;color:#fff}.btn-submit:disabled,.btn-previous:disabled,.btn-next:disabled{background-color:#ecebeb!important;border:solid 2px #ecebeb!important;color:#9c9c9c!important;cursor:not-allowed}.breathing-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0f172a99;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:9999}.show{display:block}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FieldBuilderComponent, selector: "field-builder", inputs: ["field", "form"] }] });
610
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: UpdateCardWidgetComponent, decorators: [{
611
+ type: Component,
612
+ args: [{ selector: 'lib-update-card-widget', template: "<form class=\"container-fluid py-3\" [formGroup]=\"cardForm\" *ngIf=\"(inputParamsForWidgetForUpdate.APIKey)\">\r\n <div class=\"p-0\">\r\n <div class=\"d-flex justify-content-center mb-4\">\r\n <div class=\"card\">\r\n <div class=\"card-inner\">\r\n <div class=\"front\">\r\n <!-- Top Bar: Chip & Brand Logo -->\r\n <div class=\"card-top-bar\">\r\n <div class=\"chip\"></div>\r\n <div class=\"card-brand\">\r\n <span class=\"brand-text\">SECURE CARD</span>\r\n </div>\r\n </div>\r\n \r\n <!-- Middle Bar: Card Number (Masked) -->\r\n <div class=\"card-number-display\">\r\n <span>{{maskCardNumber()}}</span>\r\n </div>\r\n \r\n <!-- Bottom Bar: Cardholder Name & Expiration Date -->\r\n <div class=\"card-bottom-bar\">\r\n <div class=\"card-holder-info\">\r\n <label class=\"card-label\">CARDHOLDER</label>\r\n <span class=\"card-value\">{{maskName()}}</span>\r\n </div>\r\n <div class=\"card-expiry-info\">\r\n <label class=\"card-label\">{{currentLang[\"ValidThru\"]}}</label>\r\n <span class=\"card-value\">{{maskDate()}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Dynamic Form Fields -->\r\n <div class=\"dynamic-fields-container mb-3\">\r\n <div *ngFor=\"let field of fields\" class=\"mb-3\">\r\n <field-builder [field]=\"field\" [form]=\"cardForm\"></field-builder>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Static Form Fields -->\r\n <div class=\"card-form-fields\">\r\n <div class=\"row mb-3\">\r\n <div class=\"col-12\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"name\" class=\"form-label-custom\">\r\n {{currentLang[\"CardHolderName\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"name\" [placeholder]=\"currentLang['CardHolderName']\"\r\n [class.inputError]=\"!showInputErrorName\" (input)=\"bindName($event)\" formControlName=\"name\" />\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mb-4\">\r\n <div class=\"col-6\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"validity-date\" class=\"form-label-custom\">\r\n {{currentLang[\"ExpiryDate\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper date-wrapper\">\r\n <input class=\"form-control-custom\" type=\"text\" id=\"validity-date\"\r\n [class.inputError]=\"!showInputErrorDate\" placeholder=\"MM/YY\"\r\n formControlName=\"validityDate\" (input)=\"formatDate($event)\" />\r\n <span class=\"calendar-icon\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-actions-custom\">\r\n <button class=\"btn-submit\" *ngIf=\"(inputParamsForWidgetForUpdate.Mode==CardMode.Edit)\" type=\"submit\" [disabled]=\"!cardForm.valid\"\r\n (click)=\"UpdateCardDetails()\">\r\n <span class=\"btn-text\">{{currentLang[\"Update\"]}}</span>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [".card{width:100%;max-width:400px;height:230px;color:#fff;perspective:1000px;border:none;background:transparent;margin:0 auto}.card-inner{width:100%;height:100%;position:relative;transition:transform .8s cubic-bezier(.175,.885,.32,1.275);transform-style:preserve-3d}.front{width:100%;height:100%;position:absolute;top:0;left:0;padding:24px 28px;border-radius:20px;overflow:hidden;z-index:1;backface-visibility:hidden;background:linear-gradient(135deg,rgba(17,24,39,.95) 0%,rgba(31,41,55,.95) 100%);box-shadow:0 20px 35px #00000040,inset 0 1px #ffffff26;border:1px solid rgba(255,255,255,.1);display:flex;flex-direction:column;justify-content:space-between;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:all .3s ease}.front:before{content:\"\";position:absolute;top:-50%;left:-50%;width:200%;height:200%;background:radial-gradient(circle,rgba(99,102,241,.12) 0%,transparent 70%);pointer-events:none}.card-top-bar{display:flex;justify-content:space-between;align-items:center}.chip{width:48px;height:35px;background:linear-gradient(135deg,#f59e0b 0%,#d97706 100%);border-radius:6px;position:relative;box-shadow:inset 0 1px 2px #ffffff4d}.chip:before{content:\"\";position:absolute;inset:0;border:1px solid rgba(0,0,0,.15);border-radius:6px;background-image:linear-gradient(90deg,transparent 50%,rgba(0,0,0,.1) 50%),linear-gradient(0deg,transparent 50%,rgba(0,0,0,.1) 50%);background-size:10px 10px}.brand-text{font-size:10px;letter-spacing:2px;color:#ffffffb3;font-weight:700;text-shadow:0 2px 4px rgba(0,0,0,.2)}.card-number-display{font-family:Courier New,Courier,monospace;font-size:20px;letter-spacing:3px;color:#fff;text-shadow:0 2px 4px rgba(0,0,0,.3);margin:18px 0;text-align:center;-webkit-user-select:none;user-select:none}.card-bottom-bar{display:flex;justify-content:space-between;align-items:flex-end}.card-label{display:block;font-size:8px;color:#fff6;letter-spacing:1.5px;margin-bottom:2px;text-transform:uppercase}.card-value{display:block;font-size:13px;color:#fff;letter-spacing:.5px;font-weight:600;max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.form-group-custom{display:flex;flex-direction:column;margin-bottom:12px}.form-label-custom{font-size:13px;font-weight:600;color:#374151;margin-bottom:6px;letter-spacing:.2px}.input-wrapper{position:relative;width:100%}.form-control-custom{width:100%;background-color:#f9fafb;border:1px solid #d1d5db;border-radius:8px;padding:10px 14px;font-size:14px;color:#1f2937;transition:all .2s ease-in-out;box-shadow:inset 0 1px 2px #00000005}.form-control-custom:focus{background-color:#fff;border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51f;outline:none}.inputError,.inputError:focus{border-color:#ef4444!important;box-shadow:0 0 0 3px #ef44441f!important}.date-wrapper{display:flex;align-items:center}.calendar-icon{width:18px;height:18px;position:absolute;right:12px;pointer-events:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain}.form-actions-custom{display:flex;justify-content:flex-end;margin-top:20px;border-top:1px solid #f3f4f6;padding-top:16px}.btn-submit{color:#fff;background-color:#5a75b6;border:solid 2px #5A75B6;border-radius:8px;padding:8px;min-width:120px;margin-right:10px}.btn-submit:hover{background-color:#3e578e;color:#fff}.btn-submit:disabled,.btn-previous:disabled,.btn-next:disabled{background-color:#ecebeb!important;border:solid 2px #ecebeb!important;color:#9c9c9c!important;cursor:not-allowed}.breathing-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0f172a99;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:9999}.show{display:block}\n"] }]
613
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: CroemCardWidgetService }]; }, propDecorators: { inputParamsForWidgetForUpdate: [{
614
+ type: Input
615
+ }], widgetResponseEmitter: [{
616
+ type: Output
617
+ }], getWidgetDataResponseEmitter: [{
618
+ type: Output
619
+ }], fieldResponseEmitter: [{
620
+ type: Output
621
+ }], loader: [{
622
+ type: Output
623
+ }], fields: [{
624
+ type: Input
625
+ }] } });
626
+
627
+ class PaymentCardWidgetComponent {
628
+ constructor(formBuilder, croemCardService) {
629
+ this.formBuilder = formBuilder;
630
+ this.croemCardService = croemCardService;
631
+ this.widgetResponseEmitter = new EventEmitter();
632
+ this.fieldResponseEmitter = new EventEmitter();
633
+ this.loader = new EventEmitter();
634
+ this.HandleError = new EventEmitter();
635
+ this.fields = [];
636
+ this.dynamicFields = {};
637
+ this.showCVVPrepend = false;
638
+ this.showInputError = true;
639
+ }
640
+ ngOnInit() {
641
+ this.switchLanguage(this.inputParamsForWidgetForPayment.Culture);
642
+ //---Dynamic Form creation innitializing form group(i.e cardForm) to pass onto the dynamic form builder component ------
643
+ for (const field of this.fields) {
644
+ const validators = [];
645
+ if (field.required) {
646
+ validators.push(Validators.required);
647
+ }
648
+ this.dynamicFields[field.name] = [field.value || null, validators];
649
+ }
650
+ const predefinedControls = {
651
+ cvv: ['', [Validators.required, Validators.maxLength(4)]]
652
+ };
653
+ this.cardForm = this.formBuilder.group(Object.assign(Object.assign({}, predefinedControls), this.dynamicFields));
654
+ let fieldsContrls = {};
655
+ for (let f of this.fields) {
656
+ if (f.type !== 'checkbox') {
657
+ fieldsContrls[f.name] = new FormControl(f.value || '', Validators.required);
658
+ }
659
+ else {
660
+ let opts = {};
661
+ if (f.options) {
662
+ for (let opt of f.options) {
663
+ opts[opt.key] = new FormControl(opt.label);
664
+ }
665
+ }
666
+ fieldsContrls[f.name] = new FormGroup(opts);
667
+ }
668
+ }
669
+ }
670
+ makePayment() {
671
+ this.makeTransactionWithToken();
672
+ }
673
+ switchLanguage(language) {
674
+ if (language === 'en') {
675
+ this.currentLang = LANG_EN;
676
+ }
677
+ else if (language === 'es') {
678
+ this.currentLang = LANG_ES;
679
+ }
680
+ }
681
+ makeTransactionWithToken() {
682
+ return __awaiter(this, void 0, void 0, function* () {
683
+ try {
684
+ this.showLoader = true;
685
+ this.loader.emit(this.showLoader);
686
+ const apiUrl = this.inputParamsForWidgetForPayment.DtrUrl + constants.urls.paymentDTRUrl;
687
+ //----encryption-------
688
+ var encode = this.encoding(); //--encoding parameters
689
+ this.encryptedString = this.innitializeKey(encode); //--innitializing DSA key
690
+ //-----request--------
691
+ this.paidCardResponse = yield this.croemCardService.CardPayment(this.inputParamsForWidgetForPayment, this.inputParamsForWidgetForPayment.Culture, apiUrl, this.encryptedString); //--API Call to make sale through cardToken in DTR
692
+ this.showLoader = false;
693
+ this.fieldResponseEmitter.emit(this.cardForm.controls); //emmiting controls
694
+ this.widgetResponseEmitter.emit(this.paidCardResponse); // emitting response
695
+ }
696
+ catch (error) {
697
+ console.log(error);
698
+ this.showLoader = false;
699
+ this.widgetResponseEmitter.emit(this.paidCardResponse);
700
+ }
701
+ });
702
+ }
703
+ encoding() {
704
+ return "" + "\\" +
705
+ "" + "\\" +
706
+ "" + "\\" +
707
+ "" + "\\" +
708
+ this.inputParamsForWidgetForPayment.Token + "\\" +
709
+ "" + "\\" +
710
+ this.inputParamsForWidgetForPayment.APIKey + "\\" +
711
+ this.inputParamsForWidgetForPayment.Culture + "\\" +
712
+ this.cardForm.value.cvv + "\\" +
713
+ this.inputParamsForWidgetForPayment.IsSale + "\\" +
714
+ this.inputParamsForWidgetForPayment.Amount + "\\" +
715
+ this.inputParamsForWidgetForPayment.ProductDetails + "\\" +
716
+ "" + "\\" +
717
+ "" + "\\" +
718
+ this.inputParamsForWidgetForPayment.Itbms + "\\" +
719
+ "";
720
+ }
721
+ innitializeKey(encode) {
722
+ var key = initializeKey(this.inputParamsForWidgetForPayment.Keys.EncKey1, this.inputParamsForWidgetForPayment.Keys.EncKey2);
723
+ return encryptedString(key, encode);
724
+ }
725
+ bindCVV(event) {
726
+ const inputElement = event.target;
727
+ const numericValue = inputElement.value.replace(/\D/g, ''); // Remove non-numeric characters
728
+ this.cvv = numericValue; // Update form control value
729
+ inputElement.value = numericValue; // Update input value to remove non-numeric characters
730
+ this.validateCvv();
731
+ }
732
+ validateCvv() {
733
+ this.showCVVPrepend = false;
734
+ if (cardValidator.cvv(this.cvv, 4).isValid || cardValidator.cvv(this.cvv).isValid) {
735
+ this.showInputError = true;
736
+ }
737
+ else {
738
+ this.showInputError = false;
739
+ }
740
+ if (this.cvv) {
741
+ this.showCVVPrepend = true;
742
+ }
743
+ }
744
+ }
745
+ PaymentCardWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PaymentCardWidgetComponent, deps: [{ token: i1.FormBuilder }, { token: CroemCardWidgetService }], target: i0.ɵɵFactoryTarget.Component });
746
+ PaymentCardWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PaymentCardWidgetComponent, selector: "lib-payment-card-widget", inputs: { inputParamsForWidgetForPayment: "inputParamsForWidgetForPayment", fields: "fields" }, outputs: { widgetResponseEmitter: "widgetResponseEmitter", fieldResponseEmitter: "fieldResponseEmitter", loader: "loader", HandleError: "HandleError" }, ngImport: i0, template: "<form class=\"container-fluid py-3\" [formGroup]=\"cardForm\" *ngIf=\"(inputParamsForWidgetForPayment.APIKey)\">\r\n <div class=\"p-0\">\r\n <!-- Dynamic Form Fields -->\r\n <div class=\"dynamic-fields-container mb-3\">\r\n <div *ngFor=\"let field of fields\" class=\"mb-3\">\r\n <field-builder [field]=\"field\" [form]=\"cardForm\"></field-builder>\r\n </div>\r\n </div>\r\n\r\n <!-- CVV and Proceed Fields -->\r\n <div class=\"payment-fields-custom\">\r\n <div class=\"row align-items-end\">\r\n <div class=\"col-12 mb-3 mb-md-0\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"cvv\" class=\"form-label-custom\">\r\n {{currentLang[\"CVV\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper cvv-wrapper\">\r\n <input class=\"form-control-custom\" type=\"password\" id=\"cvv\" [class.inputError]=\"!showInputError\"\r\n placeholder=\"CVV\" pattern=\"[0-9]*\" formControlName=\"cvv\" (input)=\"bindCVV($event)\" minlength=\"3\"\r\n maxlength=\"4\" />\r\n <span *ngIf=\"!showCVVPrepend\" class=\"cvv-icon\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12\">\r\n <button class=\"btn-submit-custom w-100 py-3\" type=\"submit\" [disabled]=\"!cardForm.valid\" (click)=\"makePayment()\">\r\n <span class=\"btn-text\">{{currentLang[\"Proceed\"]}}</span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n", styles: [".form-group-custom{display:flex;flex-direction:column;margin-bottom:12px}.form-label-custom{font-size:13px;font-weight:600;color:#374151;margin-bottom:6px;letter-spacing:.2px}.input-wrapper{position:relative;width:100%}.form-control-custom{width:100%;background-color:#f9fafb;border:1px solid #d1d5db;border-radius:8px;padding:10px 14px;font-size:14px;color:#1f2937;transition:all .2s ease-in-out;box-shadow:inset 0 1px 2px #00000005}.form-control-custom:focus{background-color:#fff;border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51f;outline:none}.inputError,.inputError:focus{border-color:#ef4444!important;box-shadow:0 0 0 3px #ef44441f!important}.cvv-wrapper{display:flex;align-items:center}.cvv-icon{width:20px;height:20px;position:absolute;right:12px;pointer-events:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain}.btn-submit-custom{background:#5A75B6;border:solid 2px #5A75B6;color:#fff;padding:10px 20px;font-weight:600;font-size:14px;border-radius:8px;transition:all .2s ease-in-out;box-shadow:0 4px 10px #5a75b640;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}.btn-submit-custom:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 6px 14px #5a75b659;background:#3E578E;border-color:#3e578e}.btn-submit-custom:active:not(:disabled){transform:translateY(0)}.btn-submit-custom:disabled{background:#ecebeb!important;border:solid 2px #ecebeb!important;color:#9c9c9c!important;cursor:not-allowed;box-shadow:none}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FieldBuilderComponent, selector: "field-builder", inputs: ["field", "form"] }] });
747
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PaymentCardWidgetComponent, decorators: [{
748
+ type: Component,
749
+ args: [{ selector: 'lib-payment-card-widget', template: "<form class=\"container-fluid py-3\" [formGroup]=\"cardForm\" *ngIf=\"(inputParamsForWidgetForPayment.APIKey)\">\r\n <div class=\"p-0\">\r\n <!-- Dynamic Form Fields -->\r\n <div class=\"dynamic-fields-container mb-3\">\r\n <div *ngFor=\"let field of fields\" class=\"mb-3\">\r\n <field-builder [field]=\"field\" [form]=\"cardForm\"></field-builder>\r\n </div>\r\n </div>\r\n\r\n <!-- CVV and Proceed Fields -->\r\n <div class=\"payment-fields-custom\">\r\n <div class=\"row align-items-end\">\r\n <div class=\"col-12 mb-3 mb-md-0\">\r\n <div class=\"form-group-custom\">\r\n <label for=\"cvv\" class=\"form-label-custom\">\r\n {{currentLang[\"CVV\"]}} <span class=\"text-danger\">*</span>\r\n </label>\r\n <div class=\"input-wrapper cvv-wrapper\">\r\n <input class=\"form-control-custom\" type=\"password\" id=\"cvv\" [class.inputError]=\"!showInputError\"\r\n placeholder=\"CVV\" pattern=\"[0-9]*\" formControlName=\"cvv\" (input)=\"bindCVV($event)\" minlength=\"3\"\r\n maxlength=\"4\" />\r\n <span *ngIf=\"!showCVVPrepend\" class=\"cvv-icon\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12\">\r\n <button class=\"btn-submit-custom w-100 py-3\" type=\"submit\" [disabled]=\"!cardForm.valid\" (click)=\"makePayment()\">\r\n <span class=\"btn-text\">{{currentLang[\"Proceed\"]}}</span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n", styles: [".form-group-custom{display:flex;flex-direction:column;margin-bottom:12px}.form-label-custom{font-size:13px;font-weight:600;color:#374151;margin-bottom:6px;letter-spacing:.2px}.input-wrapper{position:relative;width:100%}.form-control-custom{width:100%;background-color:#f9fafb;border:1px solid #d1d5db;border-radius:8px;padding:10px 14px;font-size:14px;color:#1f2937;transition:all .2s ease-in-out;box-shadow:inset 0 1px 2px #00000005}.form-control-custom:focus{background-color:#fff;border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51f;outline:none}.inputError,.inputError:focus{border-color:#ef4444!important;box-shadow:0 0 0 3px #ef44441f!important}.cvv-wrapper{display:flex;align-items:center}.cvv-icon{width:20px;height:20px;position:absolute;right:12px;pointer-events:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:contain}.btn-submit-custom{background:#5A75B6;border:solid 2px #5A75B6;color:#fff;padding:10px 20px;font-weight:600;font-size:14px;border-radius:8px;transition:all .2s ease-in-out;box-shadow:0 4px 10px #5a75b640;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}.btn-submit-custom:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 6px 14px #5a75b659;background:#3E578E;border-color:#3e578e}.btn-submit-custom:active:not(:disabled){transform:translateY(0)}.btn-submit-custom:disabled{background:#ecebeb!important;border:solid 2px #ecebeb!important;color:#9c9c9c!important;cursor:not-allowed;box-shadow:none}\n"] }]
750
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: CroemCardWidgetService }]; }, propDecorators: { inputParamsForWidgetForPayment: [{
751
+ type: Input
752
+ }], widgetResponseEmitter: [{
753
+ type: Output
754
+ }], fieldResponseEmitter: [{
755
+ type: Output
756
+ }], loader: [{
757
+ type: Output
758
+ }], HandleError: [{
759
+ type: Output
760
+ }], fields: [{
761
+ type: Input
762
+ }] } });
763
+
764
+ class CroemCardWidgetComponent {
765
+ //-------------new updated-code---------------------//
766
+ handleError(data) {
767
+ this.HandleError.emit(data);
768
+ }
769
+ handleApiResponse(data) {
770
+ this.widgetResponseEmitter.emit(data);
771
+ }
772
+ getFormFields(data) {
773
+ this.fieldResponseEmitter.emit(data);
774
+ }
775
+ getUpdateApiResponse(data) {
776
+ this.getWidgetDataResponseEmitter.emit(data);
777
+ }
778
+ showloader(loader) {
779
+ this.loader.emit(loader);
780
+ }
781
+ constructor() {
782
+ this.widgetResponseEmitter = new EventEmitter();
783
+ this.getWidgetDataResponseEmitter = new EventEmitter();
784
+ this.fieldResponseEmitter = new EventEmitter();
785
+ this.HandleError = new EventEmitter();
786
+ this.loader = new EventEmitter();
787
+ this.fields = [];
788
+ this.showLoader = false;
789
+ }
790
+ ngOnInit() {
791
+ if (((this.inputParamsForWidget.Mode == CardMode.Edit) || (this.inputParamsForWidget.Mode == CardMode.Show)) && (!this.inputParamsForWidget.IsSale)) {
792
+ this.updateShow = true;
793
+ }
794
+ this.switchLanguage(this.inputParamsForWidget.Culture);
795
+ if (!this.inputParamsForWidget.APIKey) {
796
+ this.HandleError.emit("ApiKey404");
797
+ }
798
+ }
799
+ getFields() {
800
+ return this.fields;
801
+ }
802
+ switchLanguage(language) {
803
+ if (language === 'en') {
804
+ this.currentLang = LANG_EN;
805
+ }
806
+ else if (language === 'es') {
807
+ this.currentLang = LANG_ES;
808
+ }
809
+ }
810
+ }
811
+ CroemCardWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
812
+ CroemCardWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CroemCardWidgetComponent, selector: "lib-croem-card-widget", inputs: { inputParamsForWidget: "inputParamsForWidget", fields: "fields" }, outputs: { widgetResponseEmitter: "widgetResponseEmitter", getWidgetDataResponseEmitter: "getWidgetDataResponseEmitter", fieldResponseEmitter: "fieldResponseEmitter", HandleError: "HandleError", loader: "loader" }, ngImport: i0, template: "<lib-add-card-widget *ngIf=\"(this.inputParamsForWidget.APIKey)&&(inputParamsForWidget.Mode=='0')\"\r\n [inputParamsForWidgetForAdd]=\"inputParamsForWidget\" [fields]=\"getFields()\" (loader)=showloader($event)\r\n (widgetResponseEmitter)=\"handleApiResponse($event)\"\r\n (fieldResponseEmitter)=\"getFormFields($event)\"></lib-add-card-widget>\r\n\r\n\r\n<lib-payment-card-widget\r\n *ngIf=\"(this.inputParamsForWidget.APIKey)&&(inputParamsForWidget.Token)&&(inputParamsForWidget.IsSale)\" (HandleError)=\"handleError($event)\"\r\n [inputParamsForWidgetForPayment]=\"inputParamsForWidget\" [fields]=\"getFields()\"\r\n (widgetResponseEmitter)=\"handleApiResponse($event)\" (loader)=showloader($event)\r\n (fieldResponseEmitter)=\"getFormFields($event)\"></lib-payment-card-widget>\r\n\r\n\r\n<lib-update-card-widget\r\n *ngIf=\"updateShow\"\r\n [inputParamsForWidgetForUpdate]=\"inputParamsForWidget\" [fields]=\"getFields()\" (loader)=showloader($event)\r\n (widgetResponseEmitter)=\"handleApiResponse($event)\" (getWidgetDataResponseEmitter)=\"getUpdateApiResponse($event)\"\r\n (fieldResponseEmitter)=\"getFormFields($event)\"></lib-update-card-widget>\r\n ", styles: [""], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: AddCardWidgetComponent, selector: "lib-add-card-widget", inputs: ["inputParamsForWidgetForAdd", "fields"], outputs: ["widgetResponseEmitter", "fieldResponseEmitter", "loader"] }, { kind: "component", type: UpdateCardWidgetComponent, selector: "lib-update-card-widget", inputs: ["inputParamsForWidgetForUpdate", "fields"], outputs: ["widgetResponseEmitter", "getWidgetDataResponseEmitter", "fieldResponseEmitter", "loader"] }, { kind: "component", type: PaymentCardWidgetComponent, selector: "lib-payment-card-widget", inputs: ["inputParamsForWidgetForPayment", "fields"], outputs: ["widgetResponseEmitter", "fieldResponseEmitter", "loader", "HandleError"] }] });
813
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetComponent, decorators: [{
814
+ type: Component,
815
+ args: [{ selector: 'lib-croem-card-widget', template: "<lib-add-card-widget *ngIf=\"(this.inputParamsForWidget.APIKey)&&(inputParamsForWidget.Mode=='0')\"\r\n [inputParamsForWidgetForAdd]=\"inputParamsForWidget\" [fields]=\"getFields()\" (loader)=showloader($event)\r\n (widgetResponseEmitter)=\"handleApiResponse($event)\"\r\n (fieldResponseEmitter)=\"getFormFields($event)\"></lib-add-card-widget>\r\n\r\n\r\n<lib-payment-card-widget\r\n *ngIf=\"(this.inputParamsForWidget.APIKey)&&(inputParamsForWidget.Token)&&(inputParamsForWidget.IsSale)\" (HandleError)=\"handleError($event)\"\r\n [inputParamsForWidgetForPayment]=\"inputParamsForWidget\" [fields]=\"getFields()\"\r\n (widgetResponseEmitter)=\"handleApiResponse($event)\" (loader)=showloader($event)\r\n (fieldResponseEmitter)=\"getFormFields($event)\"></lib-payment-card-widget>\r\n\r\n\r\n<lib-update-card-widget\r\n *ngIf=\"updateShow\"\r\n [inputParamsForWidgetForUpdate]=\"inputParamsForWidget\" [fields]=\"getFields()\" (loader)=showloader($event)\r\n (widgetResponseEmitter)=\"handleApiResponse($event)\" (getWidgetDataResponseEmitter)=\"getUpdateApiResponse($event)\"\r\n (fieldResponseEmitter)=\"getFormFields($event)\"></lib-update-card-widget>\r\n " }]
816
+ }], ctorParameters: function () { return []; }, propDecorators: { inputParamsForWidget: [{
817
+ type: Input
818
+ }], widgetResponseEmitter: [{
819
+ type: Output
820
+ }], getWidgetDataResponseEmitter: [{
821
+ type: Output
822
+ }], fieldResponseEmitter: [{
823
+ type: Output
824
+ }], HandleError: [{
825
+ type: Output
826
+ }], loader: [{
827
+ type: Output
828
+ }], fields: [{
829
+ type: Input
830
+ }] } });
831
+
832
+ class CroemCardWidgetModule {
833
+ }
834
+ CroemCardWidgetModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
835
+ CroemCardWidgetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetModule, declarations: [CroemCardWidgetComponent,
836
+ FieldBuilderComponent,
837
+ FieldBuilderComponent,
838
+ TextBoxComponent,
839
+ DropDownComponent,
840
+ AddCardWidgetComponent,
841
+ UpdateCardWidgetComponent,
842
+ PaymentCardWidgetComponent], imports: [FormsModule, ReactiveFormsModule, CommonModule, NgSelectModule], exports: [CroemCardWidgetComponent] });
843
+ CroemCardWidgetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetModule, providers: [CroemCardWidgetService], imports: [FormsModule, ReactiveFormsModule, CommonModule, NgSelectModule] });
844
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CroemCardWidgetModule, decorators: [{
845
+ type: NgModule,
846
+ args: [{
847
+ declarations: [
848
+ CroemCardWidgetComponent,
849
+ FieldBuilderComponent,
850
+ FieldBuilderComponent,
851
+ TextBoxComponent,
852
+ DropDownComponent,
853
+ AddCardWidgetComponent,
854
+ UpdateCardWidgetComponent,
855
+ PaymentCardWidgetComponent,
856
+ ],
857
+ providers: [CroemCardWidgetService],
858
+ imports: [
859
+ FormsModule, ReactiveFormsModule, CommonModule, NgSelectModule
860
+ ],
861
+ exports: [
862
+ CroemCardWidgetComponent
863
+ ]
864
+ }]
865
+ }] });
866
+
867
+ /*
868
+ * Public API Surface of croem-card-widget
869
+ */
870
+
871
+ /**
872
+ * Generated bundle index. Do not edit.
873
+ */
874
+
875
+ export { CroemCardWidgetComponent, CroemCardWidgetModule, CroemCardWidgetService, constants };
876
+ //# sourceMappingURL=croeminc-croem-card-widget.mjs.map