@adlfe/campaign-management-library 2.12.0 → 2.13.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 (42) hide show
  1. package/adlfe-campaign-management-library.d.ts +11 -14
  2. package/adlfe-campaign-management-library.metadata.json +1 -1
  3. package/bundles/adlfe-campaign-management-library.umd.js +453 -343
  4. package/bundles/adlfe-campaign-management-library.umd.js.map +1 -1
  5. package/bundles/adlfe-campaign-management-library.umd.min.js +2 -2
  6. package/bundles/adlfe-campaign-management-library.umd.min.js.map +1 -1
  7. package/esm2015/adlfe-campaign-management-library.js +12 -15
  8. package/esm2015/lib/campaign-management/components/input-numeric/input-numeric.component.js +8 -2
  9. package/esm2015/lib/campaign-management/models/contact-category-dto.model.js +1 -1
  10. package/esm2015/lib/campaign-management/models/general-information-wa-req.model.js +37 -9
  11. package/esm2015/lib/campaign-management/models/template-wa.model.js +1 -1
  12. package/esm2015/lib/campaign-management/modules/campaign-index/component/filter-in-list-of-campaign/filter-in-list-of-campaign.component.js +1 -1
  13. package/esm2015/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +329 -267
  14. package/esm2015/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +6 -12
  15. package/esm2015/lib/campaign-management/modules/new-campaign/new-campaign.component.js +14 -9
  16. package/esm2015/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +34 -38
  17. package/esm2015/lib/core/const/validation-message.const.js +2 -1
  18. package/esm2015/public-api.js +6 -1
  19. package/esm5/adlfe-campaign-management-library.js +12 -15
  20. package/esm5/lib/campaign-management/components/input-numeric/input-numeric.component.js +8 -2
  21. package/esm5/lib/campaign-management/models/contact-category-dto.model.js +1 -1
  22. package/esm5/lib/campaign-management/models/general-information-wa-req.model.js +38 -9
  23. package/esm5/lib/campaign-management/models/template-wa.model.js +1 -1
  24. package/esm5/lib/campaign-management/modules/campaign-index/component/filter-in-list-of-campaign/filter-in-list-of-campaign.component.js +1 -1
  25. package/esm5/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +342 -268
  26. package/esm5/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +6 -12
  27. package/esm5/lib/campaign-management/modules/new-campaign/new-campaign.component.js +18 -9
  28. package/esm5/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +35 -41
  29. package/esm5/lib/core/const/validation-message.const.js +2 -1
  30. package/esm5/public-api.js +6 -1
  31. package/fesm2015/adlfe-campaign-management-library.js +423 -329
  32. package/fesm2015/adlfe-campaign-management-library.js.map +1 -1
  33. package/fesm5/adlfe-campaign-management-library.js +440 -332
  34. package/fesm5/adlfe-campaign-management-library.js.map +1 -1
  35. package/lib/campaign-management/components/input-numeric/input-numeric.component.d.ts +2 -0
  36. package/lib/campaign-management/models/contact-category-dto.model.d.ts +0 -1
  37. package/lib/campaign-management/models/general-information-wa-req.model.d.ts +5 -0
  38. package/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.d.ts +10 -6
  39. package/lib/campaign-management/modules/new-campaign/new-campaign.component.d.ts +1 -0
  40. package/lib/core/const/validation-message.const.d.ts +4 -0
  41. package/package.json +1 -1
  42. package/public-api.d.ts +5 -0
@@ -1,4 +1,4 @@
1
- import { __decorate, __extends, __assign, __spread, __param, __values } from 'tslib';
1
+ import { __decorate, __extends, __assign, __spread, __param, __values, __awaiter, __generator } from 'tslib';
2
2
  import { Component, EventEmitter, Output, Input, NgModule, ContentChild, forwardRef, NgZone, Directive, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, ViewChild } from '@angular/core';
3
3
  import { MapsAPILoader, AgmCoreModule } from '@agm/core';
4
4
  import { CommonModule, DatePipe } from '@angular/common';
@@ -33,7 +33,7 @@ import { AngularEditorModule } from '@kolkov/angular-editor';
33
33
  import { NgbPaginationModule, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
34
34
  import * as echarts from 'echarts';
35
35
  import { Subject, fromEvent, of } from 'rxjs';
36
- import { debounceTime, takeUntil, tap, distinctUntilChanged } from 'rxjs/operators';
36
+ import { debounceTime, takeUntil, tap } from 'rxjs/operators';
37
37
  import { MatChipsModule } from '@angular/material/chips';
38
38
  import { MatNativeDateModule } from '@angular/material/core';
39
39
  import { MatToolbarModule } from '@angular/material/toolbar';
@@ -267,13 +267,19 @@ var InputNumericComponent = /** @class */ (function () {
267
267
  __decorate([
268
268
  Input()
269
269
  ], InputNumericComponent.prototype, "maxLength", void 0);
270
+ __decorate([
271
+ Input()
272
+ ], InputNumericComponent.prototype, "suffix", void 0);
273
+ __decorate([
274
+ Input()
275
+ ], InputNumericComponent.prototype, "hint", void 0);
270
276
  __decorate([
271
277
  ContentChild('suffix')
272
278
  ], InputNumericComponent.prototype, "suffixTmpl", void 0);
273
279
  InputNumericComponent = InputNumericComponent_1 = __decorate([
274
280
  Component({
275
281
  selector: 'app-input[type=numeric]',
276
- template: "<div class=\"grid\">\r\n <mat-form-field class=\"w-full\" appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label *ngIf=\"label\">\r\n <span>{{ label }}</span>\r\n </mat-label>\r\n <input\r\n type=\"text\"\r\n [id]=\"identifier\"\r\n [attr.data-testid]=\"identifier\"\r\n matInput\r\n [placeholder]=\"placeholder\"\r\n [formControl]=\"formControl\"\r\n (input)=\"handleInput($event)\"\r\n [attr.maxlength]=\"maxLength\"\r\n />\r\n <span *ngIf=\"suffixTmpl\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"suffixTmpl\"></ng-container>\r\n </span>\r\n </mat-form-field>\r\n <mat-error align=\"end\" class=\"leading-zero\" *ngIf=\"isInvalid\">\r\n <small class=\"text-xs\">\r\n {{ errors?.message }}\r\n </small>\r\n </mat-error>\r\n</div>\r\n",
282
+ template: "<div class=\"grid\">\r\n <mat-form-field class=\"w-full\" appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label *ngIf=\"label\">\r\n <span>{{ label }}</span>\r\n </mat-label>\r\n <input\r\n type=\"text\"\r\n [id]=\"identifier\"\r\n [attr.data-testid]=\"identifier\"\r\n matInput\r\n [placeholder]=\"placeholder\"\r\n [formControl]=\"formControl\"\r\n (input)=\"handleInput($event)\"\r\n [attr.maxlength]=\"maxLength\"\r\n />\r\n <span *ngIf=\"suffixTmpl\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"suffixTmpl\"></ng-container>\r\n </span>\r\n\r\n <span *ngIf=\"suffix\" matSuffix>\r\n {{ suffix }}\r\n </span>\r\n </mat-form-field>\r\n <mat-hint *ngIf=\"hint\">\r\n {{ hint }}\r\n </mat-hint>\r\n\r\n <mat-error align=\"end\" class=\"leading-zero\" *ngIf=\"isInvalid\">\r\n <small class=\"text-xs\">\r\n {{ errors?.message }}\r\n </small>\r\n </mat-error>\r\n</div>\r\n",
277
283
  providers: [
278
284
  {
279
285
  provide: NG_VALUE_ACCESSOR,
@@ -1434,6 +1440,7 @@ var GeneralInformationWAMessageValidationConst = {
1434
1440
  catalogue: [{ type: 'required', message: 'Catalog is required' }],
1435
1441
  product: [{ type: 'required', message: 'Product is required' }],
1436
1442
  body: [{ type: 'maxlength', message: 'Maximum character 100' }],
1443
+ paramName: [{ type: 'required', message: 'Variable Name is required' }],
1437
1444
  };
1438
1445
  var GeneralInformationEmailMessageValidationConst = {
1439
1446
  channel: [{ type: 'required', message: 'Message Type is required' }],
@@ -1727,7 +1734,7 @@ var FilterInListOfCampaignComponent = /** @class */ (function () {
1727
1734
  Component({
1728
1735
  selector: 'lib-filter-in-list-of-campaign',
1729
1736
  template: "<p class=\"font-16px font-bold\">Filter</p>\r\n\r\n<form [formGroup]=\"form\" class=\"contact-filter\">\r\n <div class=\"row\">\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-70\">\r\n <mat-label>Business Name</mat-label>\r\n <mat-select placeholder=\"Select Business Name\" formControlName=\"businessName\">\r\n <div class=\"select-search\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n (searchRes)=\"businessNameSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option value=\"\"> --- select none --- </mat-option>\r\n <mat-option\r\n *ngFor=\"let option of filteredBusinessNameOption\"\r\n [value]=\"option.id\"\r\n >\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"!filteredBusinessNameOption.length\" disabled>\r\n No data found\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-70\">\r\n <mat-label>Channel</mat-label>\r\n\r\n <mat-select placeholder=\"Select the Channel\" formControlName=\"medium\">\r\n <mat-option value=\"\"> --- select none --- </mat-option>\r\n <mat-option\r\n *ngFor=\"let option of filteredChannelOption\"\r\n [value]=\"option.value\"\r\n (click)=\"getTemplateOptionService()\"\r\n >\r\n {{ option.label }}\r\n </mat-option>\r\n <mat-option *ngIf=\"!filteredChannelOption.length\" disabled>\r\n No data found\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template Name</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"templateName\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('templateName').value?.name\"\r\n (searchRes)=\"templateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-70\">\r\n <mat-label>Status</mat-label>\r\n\r\n <mat-select placeholder=\"Select the Status\" formControlName=\"status\">\r\n <div class=\"select-search\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n (searchRes)=\"statusSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option value=\"\"> --- select none --- </mat-option>\r\n <mat-option\r\n *ngFor=\"let option of filteredStatusOption\"\r\n [value]=\"option.value\"\r\n >\r\n {{ option.label }}\r\n </mat-option>\r\n <mat-option *ngIf=\"!filteredStatusOption.length\" disabled>\r\n No data found\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label> Start Date </mat-label>\r\n <input\r\n matInput\r\n [matDatepicker]=\"startDatePicker\"\r\n formControlName=\"startDate\"\r\n class=\"mat-datepicker-input\"\r\n (dateChange)=\"validateBackDate()\"\r\n />\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"startDatePicker\">\r\n </mat-datepicker-toggle>\r\n <mat-icon\r\n *ngIf=\"form.get('startDate').value\"\r\n matDatepickerToggleIcon\r\n (click)=\"clearDate()\"\r\n >clear</mat-icon\r\n >\r\n <mat-datepicker #startDatePicker></mat-datepicker>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label> End Date </mat-label>\r\n <input\r\n matInput\r\n [min]=\"form.get('startDate').value\"\r\n [matDatepicker]=\"endDatePicker\"\r\n formControlName=\"endDate\"\r\n class=\"mat-datepicker-input\"\r\n (dateChange)=\"validateBackDate()\"\r\n />\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"endDatePicker\"> </mat-datepicker-toggle>\r\n <mat-icon\r\n *ngIf=\"form.get('endDate').value\"\r\n matDatepickerToggleIcon\r\n (click)=\"clearDate()\"\r\n >clear</mat-icon\r\n >\r\n <mat-datepicker #endDatePicker></mat-datepicker>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div style=\"display: flex; flex: 1; width: 100%\">\r\n <button\r\n mat-stroked-button\r\n color=\"primary-telin\"\r\n class=\"telin-font-color w-48\"\r\n style=\"width: 100%; margin-bottom: 10px\"\r\n (click)=\"onReset()\"\r\n >\r\n Reset\r\n </button>\r\n </div>\r\n <div class=\"d-flex justify-content-between\">\r\n <button mat-stroked-button color=\"secondary-telin\" class=\"w-48\" (click)=\"onCancel()\">\r\n Cancel\r\n </button>\r\n\r\n <button mat-flat-button color=\"primary-telin-blue2\" class=\"w-48\" (click)=\"onApply()\">\r\n Apply\r\n </button>\r\n </div>\r\n </div>\r\n</form>\r\n",
1730
- styles: [".contact-filter .platform{display:-ms-grid;display:grid;grid-gap:5px;-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto}.button-row{margin:8px 8px 8px 0}.mat-datepicker-input{width:85%}.mat-icon{position:relative;float:right;top:-7px;cursor:pointer;color:rgba(0,0,0,.54)}.select-search{margin:20px}"]
1737
+ styles: [".contact-filter .platform{display:grid;grid-gap:5px;grid-template-columns:auto 1fr auto}.button-row{margin:8px 8px 8px 0}.mat-datepicker-input{width:85%}.mat-icon{position:relative;float:right;top:-7px;cursor:pointer;color:rgba(0,0,0,.54)}.select-search{margin:20px}"]
1731
1738
  }),
1732
1739
  Injectable({
1733
1740
  providedIn: 'root',
@@ -2500,14 +2507,12 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2500
2507
  function GeneralInformationWAReqModel() {
2501
2508
  }
2502
2509
  GeneralInformationWAReqModel.prototype.clone = function (source) {
2503
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2504
- /* Source Mapping */
2510
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2505
2511
  if (((_a = source) === null || _a === void 0 ? void 0 : _a.media) === 'IMAGE' ||
2506
2512
  ((_b = source) === null || _b === void 0 ? void 0 : _b.media) === 'VIDEO' ||
2507
2513
  ((_c = source) === null || _c === void 0 ? void 0 : _c.media) === 'DOCUMENT') {
2508
2514
  source.channel = source.media;
2509
2515
  }
2510
- /* ./ Source Mapping */
2511
2516
  if (source.campaignName) {
2512
2517
  this.name = source.campaignName;
2513
2518
  }
@@ -2539,6 +2544,12 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2539
2544
  fileName: source.fileName,
2540
2545
  };
2541
2546
  }
2547
+ if (source.buttonParams && Array.isArray(source.buttonParams)) {
2548
+ this.buttonParams = source.buttonParams.map(function (btn) { return ({
2549
+ label: btn.label,
2550
+ payload: btn.payload ? btn.payload : btn.label,
2551
+ }); });
2552
+ }
2542
2553
  if (source.template) {
2543
2554
  this.template = {
2544
2555
  id: source.template.ID,
@@ -2546,12 +2557,21 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2546
2557
  lang: source.template.lang,
2547
2558
  headerUrl: source.targetURL,
2548
2559
  header: (_g = (_f = source.paramHeader) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.name; }), (_g !== null && _g !== void 0 ? _g : [])),
2549
- data: (_j = (_h = source.paramBody) === null || _h === void 0 ? void 0 : _h.map(function (t) { return t.name; }), (_j !== null && _j !== void 0 ? _j : [])),
2550
- button: (_k = source.paramButton) === null || _k === void 0 ? void 0 : _k.reduce(function (result, each) {
2560
+ data: ((_h = source.variables) === null || _h === void 0 ? void 0 : _h.length) ? source.variables.map(function (v) { return v.paramName; })
2561
+ : (_k = (_j = source.paramBody) === null || _j === void 0 ? void 0 : _j.map(function (t) { return t.name; }), (_k !== null && _k !== void 0 ? _k : [])),
2562
+ button: (_l = source.paramButton) === null || _l === void 0 ? void 0 : _l.reduce(function (result, each) {
2551
2563
  var _a;
2552
2564
  result.push((_a = each.name.map(function (t) { return t.name; }), (_a !== null && _a !== void 0 ? _a : [])));
2553
2565
  return result;
2554
2566
  }, []),
2567
+ buttonParams: source.buttonParams
2568
+ ? source.buttonParams.map(function (btn) {
2569
+ return {
2570
+ label: btn.label,
2571
+ payload: btn.payload ? btn.payload : btn.label,
2572
+ };
2573
+ })
2574
+ : [],
2555
2575
  };
2556
2576
  if (source.template.category === 'AUTHENTICATION')
2557
2577
  this.template = {
@@ -2560,6 +2580,7 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2560
2580
  header: null,
2561
2581
  data: [source.otpValue],
2562
2582
  button: [[source.otpValue]],
2583
+ buttonParams: [],
2563
2584
  };
2564
2585
  if (source.template.ID)
2565
2586
  this.template.id = source.template.ID;
@@ -2567,11 +2588,25 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2567
2588
  if (this.type === 'utility') {
2568
2589
  this.type = 'template';
2569
2590
  this.category = 'utility';
2570
- this.template = ((_l = source) === null || _l === void 0 ? void 0 : _l.isUseExistingTemplate) ? (_m = source) === null || _m === void 0 ? void 0 : _m.template : { name: '', lang: 'id', header: null, button: null, data: [] };
2591
+ var mappedVariables = ((_o = (_m = source) === null || _m === void 0 ? void 0 : _m.variables) === null || _o === void 0 ? void 0 : _o.length) ? source.variables.map(function (v) { return v.paramName; })
2592
+ : [];
2593
+ if ((_p = source) === null || _p === void 0 ? void 0 : _p.isUseExistingTemplate) {
2594
+ this.template = __assign(__assign({}, source.template), { data: mappedVariables.length > 0 ? mappedVariables : source.template.data || [] });
2595
+ }
2596
+ else {
2597
+ this.template = {
2598
+ name: '',
2599
+ lang: 'id',
2600
+ header: null,
2601
+ button: null,
2602
+ data: mappedVariables,
2603
+ buttonParams: [],
2604
+ };
2605
+ }
2571
2606
  this.isNeedSave = source.isNeedSave;
2572
2607
  this.ttlSeconds = source.ttl;
2573
- if ((_o = source) === null || _o === void 0 ? void 0 : _o.isUseExistingTemplate) {
2574
- this.text = (_r = (_q = (_p = source) === null || _p === void 0 ? void 0 : _p.template) === null || _q === void 0 ? void 0 : _q.body) === null || _r === void 0 ? void 0 : _r.text;
2608
+ if ((_q = source) === null || _q === void 0 ? void 0 : _q.isUseExistingTemplate) {
2609
+ this.text = ((_r = source) === null || _r === void 0 ? void 0 : _r.text) || ((_u = (_t = (_s = source) === null || _s === void 0 ? void 0 : _s.template) === null || _t === void 0 ? void 0 : _t.body) === null || _u === void 0 ? void 0 : _u.text);
2575
2610
  }
2576
2611
  }
2577
2612
  return this;
@@ -2843,14 +2878,23 @@ var NewCampaignComponent = /** @class */ (function () {
2843
2878
  configurable: true
2844
2879
  });
2845
2880
  NewCampaignComponent.prototype.saveGeneralInformationService = function () {
2881
+ return __awaiter(this, void 0, void 0, function () {
2882
+ var bodyReq, payloadValue;
2883
+ return __generator(this, function (_a) {
2884
+ if (!this.onCheckTwilioCounterValid()) {
2885
+ this.toastr.error('Segment cannot more than 10');
2886
+ this.isSubmit = false;
2887
+ return [2 /*return*/];
2888
+ }
2889
+ bodyReq = new GeneralInformationWAReqModel().clone(__assign({}, this.generalInformationData));
2890
+ payloadValue = bodyReq.convert();
2891
+ this.saveGeneralInformation(payloadValue);
2892
+ return [2 /*return*/];
2893
+ });
2894
+ });
2895
+ };
2896
+ NewCampaignComponent.prototype.saveGeneralInformation = function (payloadValue) {
2846
2897
  var _this = this;
2847
- if (!this.onCheckTwilioCounterValid()) {
2848
- this.toastr.error('Segment cannot more than 10');
2849
- this.isSubmit = false;
2850
- return;
2851
- }
2852
- var bodyReq = new GeneralInformationWAReqModel().clone(__assign({}, this.generalInformationData));
2853
- var payloadValue = bodyReq.convert();
2854
2898
  if (payloadValue.template && this.generalInformationData.template) {
2855
2899
  payloadValue.template.type =
2856
2900
  payloadValue.template.type || this.generalInformationData.template.category;
@@ -4074,7 +4118,6 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4074
4118
  { label: 'Create New', value: false },
4075
4119
  { label: 'Use existing template', value: true },
4076
4120
  ];
4077
- this.isUtility = true;
4078
4121
  this.isCheckUtility = false;
4079
4122
  this.updateGeneralInformationForm = new EventEmitter();
4080
4123
  }
@@ -4110,14 +4153,12 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4110
4153
  this.initValidation();
4111
4154
  this.getAccountOptionService(((_c = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form) === null || _c === void 0 ? void 0 : _c.medium) === 'WA'
4112
4155
  ? (_g = (_f = (_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.generalInformation) === null || _e === void 0 ? void 0 : _e.form) === null || _f === void 0 ? void 0 : _f.from) === null || _g === void 0 ? void 0 : _g.name : '');
4113
- this.listenBodyChange();
4114
4156
  /* this.setCurrentLocation(); */
4115
4157
  };
4116
4158
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getCampaignStorage", {
4117
4159
  get: function () {
4118
- return localStorage.getItem('telin.campaign')
4119
- ? JSON.parse(localStorage.getItem('telin.campaign'))
4120
- : {};
4160
+ var campaignData = localStorage.getItem('telin.campaign');
4161
+ return campaignData ? JSON.parse(campaignData) : {};
4121
4162
  },
4122
4163
  enumerable: true,
4123
4164
  configurable: true
@@ -4149,6 +4190,10 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4149
4190
  isUseExistingTemplate: new FormControl(false),
4150
4191
  isNeedSave: new FormControl(false),
4151
4192
  ttl: new FormControl(null),
4193
+ isDownloadVariableXLS: new FormControl(false),
4194
+ variables: new FormArray([]),
4195
+ useXlsx: new FormControl(false),
4196
+ buttonParams: new FormArray([]),
4152
4197
  });
4153
4198
  this.form.valueChanges.subscribe(function () {
4154
4199
  setTimeout(function () {
@@ -4163,133 +4208,152 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4163
4208
  this.form.disable();
4164
4209
  };
4165
4210
  GeneralInformationWAComponent.prototype.initEdit = function () {
4166
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
4167
- if (Object.entries(this.getCampaignStorage).length === 0 ||
4168
- ((_c = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA')
4211
+ var _this = this;
4212
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
4213
+ var storageData = this.getCampaignStorage;
4214
+ var formValues = (_b = (_a = storageData) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
4215
+ if (!storageData ||
4216
+ Object.entries(storageData).length === 0 ||
4217
+ ((_c = formValues) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA') {
4169
4218
  return;
4170
- this.form
4171
- .get('channel')
4172
- .setValue((_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.generalInformation) === null || _e === void 0 ? void 0 : _e.form.channel);
4173
- this.form.get('media').setValue((_g = (_f = this.getCampaignStorage) === null || _f === void 0 ? void 0 : _f.generalInformation) === null || _g === void 0 ? void 0 : _g.form.media);
4174
- this.form.get('from').setValue((_j = (_h = this.getCampaignStorage) === null || _h === void 0 ? void 0 : _h.generalInformation) === null || _j === void 0 ? void 0 : _j.form.from);
4175
- this.form.get('text').setValue((_l = (_k = this.getCampaignStorage) === null || _k === void 0 ? void 0 : _k.generalInformation) === null || _l === void 0 ? void 0 : _l.form.text);
4176
- this.form
4177
- .get('targetURL')
4178
- .setValue((_o = (_m = this.getCampaignStorage) === null || _m === void 0 ? void 0 : _m.generalInformation) === null || _o === void 0 ? void 0 : _o.form.targetURL);
4179
- this.form
4180
- .get('fileName')
4181
- .setValue((_r = (_q = (_p = this.getCampaignStorage) === null || _p === void 0 ? void 0 : _p.generalInformation) === null || _q === void 0 ? void 0 : _q.form.fileName, (_r !== null && _r !== void 0 ? _r : this.form.get('targetURL').value)));
4182
- this.form
4183
- .get('template')
4184
- .setValue((_t = (_s = this.getCampaignStorage) === null || _s === void 0 ? void 0 : _s.generalInformation) === null || _t === void 0 ? void 0 : _t.form.template);
4185
- this.form
4186
- .get('isUpload')
4187
- .setValue((_v = (_u = this.getCampaignStorage) === null || _u === void 0 ? void 0 : _u.generalInformation) === null || _v === void 0 ? void 0 : _v.form.isUpload);
4188
- this.form.get('fileId').setValue((_x = (_w = this.getCampaignStorage) === null || _w === void 0 ? void 0 : _w.generalInformation) === null || _x === void 0 ? void 0 : _x.form.fileId);
4189
- this.form
4190
- .get('otpValue')
4191
- .setValue((_z = (_y = this.getCampaignStorage) === null || _y === void 0 ? void 0 : _y.generalInformation) === null || _z === void 0 ? void 0 : _z.form.otpValue);
4192
- this.form
4193
- .get('isUseExistingTemplate')
4194
- .setValue(!!((_2 = (_1 = (_0 = this.getCampaignStorage) === null || _0 === void 0 ? void 0 : _0.generalInformation) === null || _1 === void 0 ? void 0 : _1.form) === null || _2 === void 0 ? void 0 : _2.templateName));
4195
- this.form
4196
- .get('isNeedSave')
4197
- .setValue(!!((_5 = (_4 = (_3 = this.getCampaignStorage) === null || _3 === void 0 ? void 0 : _3.generalInformation) === null || _4 === void 0 ? void 0 : _4.form) === null || _5 === void 0 ? void 0 : _5.isNeedSave));
4198
- this.form.get('ttl').setValue((_8 = (_7 = (_6 = this.getCampaignStorage) === null || _6 === void 0 ? void 0 : _6.generalInformation) === null || _7 === void 0 ? void 0 : _7.form) === null || _8 === void 0 ? void 0 : _8.ttl);
4199
- this.isHaveTemplateParam = this.form.get('isUpload').value;
4200
- this.getTemplateOptionService(null, (_9 = this.form.get('template').value) === null || _9 === void 0 ? void 0 : _9.name);
4219
+ }
4220
+ (_d = this.getControl('channel')) === null || _d === void 0 ? void 0 : _d.setValue((_e = formValues) === null || _e === void 0 ? void 0 : _e.channel);
4221
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValue((_g = formValues) === null || _g === void 0 ? void 0 : _g.media);
4222
+ (_h = this.getControl('from')) === null || _h === void 0 ? void 0 : _h.setValue((_j = formValues) === null || _j === void 0 ? void 0 : _j.from);
4223
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.setValue((_l = formValues) === null || _l === void 0 ? void 0 : _l.text);
4224
+ (_m = this.getControl('targetURL')) === null || _m === void 0 ? void 0 : _m.setValue((_o = formValues) === null || _o === void 0 ? void 0 : _o.targetURL);
4225
+ (_p = this.getControl('fileName')) === null || _p === void 0 ? void 0 : _p.setValue((_r = (_q = formValues) === null || _q === void 0 ? void 0 : _q.fileName, (_r !== null && _r !== void 0 ? _r : (_s = this.getControl('targetURL')) === null || _s === void 0 ? void 0 : _s.value)));
4226
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.setValue((_u = formValues) === null || _u === void 0 ? void 0 : _u.template);
4227
+ (_v = this.getControl('isUpload')) === null || _v === void 0 ? void 0 : _v.setValue((_w = formValues) === null || _w === void 0 ? void 0 : _w.isUpload);
4228
+ (_x = this.getControl('fileId')) === null || _x === void 0 ? void 0 : _x.setValue((_y = formValues) === null || _y === void 0 ? void 0 : _y.fileId);
4229
+ (_z = this.getControl('otpValue')) === null || _z === void 0 ? void 0 : _z.setValue((_0 = formValues) === null || _0 === void 0 ? void 0 : _0.otpValue);
4230
+ (_1 = this.getControl('isUseExistingTemplate')) === null || _1 === void 0 ? void 0 : _1.setValue(!!((_2 = formValues) === null || _2 === void 0 ? void 0 : _2.templateName));
4231
+ (_3 = this.getControl('isNeedSave')) === null || _3 === void 0 ? void 0 : _3.setValue(!!((_4 = formValues) === null || _4 === void 0 ? void 0 : _4.isNeedSave));
4232
+ (_5 = this.getControl('ttl')) === null || _5 === void 0 ? void 0 : _5.setValue((_6 = formValues) === null || _6 === void 0 ? void 0 : _6.ttl);
4233
+ var savedVariables = (_7 = formValues) === null || _7 === void 0 ? void 0 : _7.variables;
4234
+ if (savedVariables && Array.isArray(savedVariables) && savedVariables.length > 0) {
4235
+ this.variables.clear();
4236
+ savedVariables.forEach(function (item) {
4237
+ _this.variables.push(new FormGroup({
4238
+ paramName: new FormControl({ value: item.paramName || '', disabled: _this.isReadOnlyMode }, Validators$1.required),
4239
+ }));
4240
+ });
4241
+ }
4242
+ this.isHaveTemplateParam = (_8 = this.getControl('isUpload')) === null || _8 === void 0 ? void 0 : _8.value;
4243
+ this.getTemplateOptionService(null, (_10 = (_9 = this.getControl('template')) === null || _9 === void 0 ? void 0 : _9.value) === null || _10 === void 0 ? void 0 : _10.name);
4201
4244
  };
4202
4245
  GeneralInformationWAComponent.prototype.initValidation = function () {
4246
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
4247
+ if (!this.form)
4248
+ return;
4203
4249
  for (var key in this.form.controls) {
4204
- this.form.controls[key].clearValidators();
4205
- this.form.controls[key].updateValueAndValidity();
4250
+ if (this.form.controls[key]) {
4251
+ this.form.controls[key].clearValidators();
4252
+ this.form.controls[key].updateValueAndValidity();
4253
+ }
4206
4254
  }
4207
- this.form.get('channel').setValidators(Validators$1.required);
4255
+ (_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.setValidators(Validators$1.required);
4208
4256
  if (this.getIsText) {
4209
- this.form.get('from').setValidators(Validators$1.required);
4210
- this.form.get('text').setValidators(Validators$1.required);
4211
- this.form.get('from').updateValueAndValidity();
4212
- this.form.get('text').updateValueAndValidity();
4257
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.setValidators(Validators$1.required);
4258
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.setValidators(Validators$1.required);
4259
+ (_d = this.getControl('from')) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4260
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4213
4261
  }
4214
4262
  else if (this.getIsMedia) {
4215
- this.form.get('media').setValidators(Validators$1.required);
4216
- this.form.get('from').setValidators(Validators$1.required);
4217
- this.form.get('fileName').setValidators(Validators$1.required);
4218
- this.form.get('media').updateValueAndValidity();
4219
- this.form.get('from').updateValueAndValidity();
4220
- this.form.get('fileName').updateValueAndValidity();
4263
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValidators(Validators$1.required);
4264
+ (_g = this.getControl('from')) === null || _g === void 0 ? void 0 : _g.setValidators(Validators$1.required);
4265
+ (_h = this.getControl('fileName')) === null || _h === void 0 ? void 0 : _h.setValidators(Validators$1.required);
4266
+ (_j = this.getControl('media')) === null || _j === void 0 ? void 0 : _j.updateValueAndValidity();
4267
+ (_k = this.getControl('from')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4268
+ (_l = this.getControl('fileName')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
4221
4269
  }
4222
4270
  else if (this.getIsTemplate) {
4223
- this.form.get('from').setValidators(Validators$1.required);
4224
- this.form.get('template').setValidators(Validators$1.required);
4225
- this.form.get('paramHeader').setValidators(Validators$1.required);
4226
- this.form.get('paramBody').setValidators(Validators$1.required);
4227
- this.form.get('paramButton').setValidators(Validators$1.required);
4228
- this.form.get('from').updateValueAndValidity();
4229
- this.form.get('template').updateValueAndValidity();
4230
- this.form.get('paramHeader').updateValueAndValidity();
4231
- this.form.get('paramBody').updateValueAndValidity();
4232
- this.form.get('paramButton').updateValueAndValidity();
4271
+ (_m = this.getControl('from')) === null || _m === void 0 ? void 0 : _m.setValidators(Validators$1.required);
4272
+ (_o = this.getControl('template')) === null || _o === void 0 ? void 0 : _o.setValidators(Validators$1.required);
4273
+ (_p = this.getControl('paramHeader')) === null || _p === void 0 ? void 0 : _p.setValidators(Validators$1.required);
4274
+ (_q = this.getControl('paramBody')) === null || _q === void 0 ? void 0 : _q.setValidators(Validators$1.required);
4275
+ (_r = this.getControl('paramButton')) === null || _r === void 0 ? void 0 : _r.setValidators(Validators$1.required);
4276
+ (_s = this.getControl('from')) === null || _s === void 0 ? void 0 : _s.updateValueAndValidity();
4277
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.updateValueAndValidity();
4278
+ (_u = this.getControl('paramHeader')) === null || _u === void 0 ? void 0 : _u.updateValueAndValidity();
4279
+ (_v = this.getControl('paramBody')) === null || _v === void 0 ? void 0 : _v.updateValueAndValidity();
4280
+ (_w = this.getControl('paramButton')) === null || _w === void 0 ? void 0 : _w.updateValueAndValidity();
4233
4281
  }
4234
4282
  else if (this.getIsCatalogue) {
4235
- this.form.get('from').setValidators(Validators$1.required);
4236
- this.form.get('category').setValidators(Validators$1.required);
4237
- this.form.get('catalogue').setValidators(Validators$1.required);
4238
- this.form.get('product').setValidators(Validators$1.required);
4239
- this.form.get('body').setValidators(Validators$1.maxLength(100));
4240
- this.form.get('from').updateValueAndValidity();
4241
- this.form.get('category').updateValueAndValidity();
4242
- this.form.get('catalogue').updateValueAndValidity();
4243
- this.form.get('product').updateValueAndValidity();
4244
- this.form.get('body').updateValueAndValidity();
4283
+ (_x = this.getControl('from')) === null || _x === void 0 ? void 0 : _x.setValidators(Validators$1.required);
4284
+ (_y = this.getControl('category')) === null || _y === void 0 ? void 0 : _y.setValidators(Validators$1.required);
4285
+ (_z = this.getControl('catalogue')) === null || _z === void 0 ? void 0 : _z.setValidators(Validators$1.required);
4286
+ (_0 = this.getControl('product')) === null || _0 === void 0 ? void 0 : _0.setValidators(Validators$1.required);
4287
+ (_1 = this.getControl('body')) === null || _1 === void 0 ? void 0 : _1.setValidators(Validators$1.maxLength(100));
4288
+ (_2 = this.getControl('from')) === null || _2 === void 0 ? void 0 : _2.updateValueAndValidity();
4289
+ (_3 = this.getControl('category')) === null || _3 === void 0 ? void 0 : _3.updateValueAndValidity();
4290
+ (_4 = this.getControl('catalogue')) === null || _4 === void 0 ? void 0 : _4.updateValueAndValidity();
4291
+ (_5 = this.getControl('product')) === null || _5 === void 0 ? void 0 : _5.updateValueAndValidity();
4292
+ (_6 = this.getControl('body')) === null || _6 === void 0 ? void 0 : _6.updateValueAndValidity();
4245
4293
  }
4246
4294
  else if (this.getIsUtility) {
4247
- this.form.get('from').setValidators(Validators$1.required);
4248
- this.form.get('text').setValidators([Validators$1.required, Validators$1.maxLength(1024)]);
4249
- this.form
4250
- .get('ttl')
4251
- .setValidators([
4295
+ (_7 = this.getControl('from')) === null || _7 === void 0 ? void 0 : _7.setValidators(Validators$1.required);
4296
+ (_8 = this.getControl('text')) === null || _8 === void 0 ? void 0 : _8.setValidators([
4297
+ Validators$1.required,
4298
+ Validators$1.maxLength(1024),
4299
+ ]);
4300
+ (_9 = this.getControl('ttl')) === null || _9 === void 0 ? void 0 : _9.setValidators([
4252
4301
  Validators.min(30, 'Minimum TTL 30'),
4253
4302
  Validators.max(43200, 'Maximum TTL 43200'),
4254
4303
  ]);
4255
- this.form.get('from').updateValueAndValidity();
4256
- this.form.get('text').updateValueAndValidity();
4257
- this.form.get('ttl').updateValueAndValidity();
4304
+ (_10 = this.getControl('from')) === null || _10 === void 0 ? void 0 : _10.updateValueAndValidity();
4305
+ (_11 = this.getControl('text')) === null || _11 === void 0 ? void 0 : _11.updateValueAndValidity();
4306
+ (_12 = this.getControl('ttl')) === null || _12 === void 0 ? void 0 : _12.updateValueAndValidity();
4307
+ (_13 = this.getControl('variables')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4258
4308
  }
4259
4309
  else {
4260
- this.form.get('from').setValidators(Validators$1.required);
4261
- this.form.get('text').setValidators(Validators$1.required);
4262
- this.form.get('from').updateValueAndValidity();
4263
- this.form.get('text').updateValueAndValidity();
4310
+ (_14 = this.getControl('from')) === null || _14 === void 0 ? void 0 : _14.setValidators(Validators$1.required);
4311
+ (_15 = this.getControl('text')) === null || _15 === void 0 ? void 0 : _15.setValidators(Validators$1.required);
4312
+ (_16 = this.getControl('from')) === null || _16 === void 0 ? void 0 : _16.updateValueAndValidity();
4313
+ (_17 = this.getControl('text')) === null || _17 === void 0 ? void 0 : _17.updateValueAndValidity();
4264
4314
  }
4265
4315
  };
4266
4316
  GeneralInformationWAComponent.prototype.formReset = function (_isMediaType) {
4267
4317
  if (_isMediaType === void 0) { _isMediaType = false; }
4318
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4268
4319
  if (!_isMediaType) {
4269
- this.form.get('media').reset();
4270
- this.form.get('from').reset();
4320
+ (_a = this.getControl('media')) === null || _a === void 0 ? void 0 : _a.reset();
4321
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.reset();
4322
+ }
4323
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.reset();
4324
+ (_d = this.getControl('fileName')) === null || _d === void 0 ? void 0 : _d.reset();
4325
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.reset();
4326
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.reset();
4327
+ (_g = this.getControl('file')) === null || _g === void 0 ? void 0 : _g.reset();
4328
+ (_h = this.getControl('latitude')) === null || _h === void 0 ? void 0 : _h.reset();
4329
+ (_j = this.getControl('longitude')) === null || _j === void 0 ? void 0 : _j.reset();
4330
+ (_k = this.getControl('template')) === null || _k === void 0 ? void 0 : _k.reset();
4331
+ (_l = this.getControl('category')) === null || _l === void 0 ? void 0 : _l.reset();
4332
+ (_m = this.getControl('product')) === null || _m === void 0 ? void 0 : _m.reset();
4333
+ (_o = this.getControl('catalogue')) === null || _o === void 0 ? void 0 : _o.reset();
4334
+ (_p = this.getControl('body')) === null || _p === void 0 ? void 0 : _p.reset();
4335
+ (_q = this.getControl('otpValue')) === null || _q === void 0 ? void 0 : _q.reset();
4336
+ (_r = this.getControl('variables')) === null || _r === void 0 ? void 0 : _r.reset();
4337
+ var paramHeader = this.getControl('paramHeader');
4338
+ if (paramHeader) {
4339
+ paramHeader.clear();
4340
+ paramHeader.reset();
4341
+ }
4342
+ var paramBody = this.getControl('paramBody');
4343
+ if (paramBody) {
4344
+ paramBody.clear();
4345
+ paramBody.reset();
4346
+ }
4347
+ var paramButton = this.getControl('paramButton');
4348
+ if (paramButton) {
4349
+ paramButton.clear();
4350
+ paramButton.reset();
4271
4351
  }
4272
- this.form.get('text').reset();
4273
- this.form.get('fileName').reset();
4274
- this.form.get('targetURL').reset();
4275
- this.form.get('fileType').reset();
4276
- this.form.get('file').reset();
4277
- this.form.get('latitude').reset();
4278
- this.form.get('longitude').reset();
4279
- this.form.get('template').reset();
4280
- this.form.get('category').reset();
4281
- this.form.get('product').reset();
4282
- this.form.get('catalogue').reset();
4283
- this.form.get('body').reset();
4284
- this.form.get('otpValue').reset();
4285
- this.form.get('paramHeader').controls = [];
4286
- this.form.get('paramHeader').reset();
4287
- this.form.get('paramBody').controls = [];
4288
- this.form.get('paramBody').reset();
4289
- this.form.get('paramButton').controls = [];
4290
- this.form.get('paramButton').reset();
4291
4352
  this.initValidation();
4292
4353
  };
4354
+ GeneralInformationWAComponent.prototype.getControl = function (controlName) {
4355
+ return this.form ? this.form.get(controlName) : null;
4356
+ };
4293
4357
  GeneralInformationWAComponent.prototype.initParam = function (_name, _value, _type) {
4294
4358
  return {
4295
4359
  name: _name,
@@ -4313,58 +4377,21 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4313
4377
  var subs = this.apiAdapterService
4314
4378
  .executeApiRequest(parameterList, '/admin/account', 'GET')
4315
4379
  .subscribe(function (resp) {
4380
+ var _a;
4316
4381
  if (!resp.data)
4317
4382
  return;
4318
4383
  _this.accountOption = isInfinite ? __spread(_this.accountOption, resp.data) : resp.data;
4319
- _this.isHaveNextAccountOption = resp.haveNext;
4384
+ _this.isHaveNextAccountOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4320
4385
  _this.isLoadingAccountOption = false;
4321
4386
  });
4322
4387
  this.subscribers.push(subs);
4323
4388
  };
4324
- GeneralInformationWAComponent.prototype.listenBodyChange = function () {
4325
- var _this = this;
4326
- var _a;
4327
- (_a = this.form
4328
- .get('text')) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(debounceTime(1000), distinctUntilChanged()).subscribe(function () {
4329
- if (!_this.getIsUtility)
4330
- return;
4331
- _this.validateText();
4332
- });
4333
- };
4334
- GeneralInformationWAComponent.prototype.validateText = function (account) {
4335
- var _this = this;
4336
- var _a, _b;
4337
- this.isCheckUtility = true;
4338
- var _c = this.form.value, from = _c.from, text = _c.text;
4339
- if (!text || !from)
4340
- return;
4341
- if (!((_a = from) === null || _a === void 0 ? void 0 : _a.directSendEnabled))
4342
- return;
4343
- var headers = new HttpHeaders()
4344
- .set('Authorization', 'Bearer ' + localStorage.getItem('telin.accessToken'))
4345
- .set('Access-Control-Allow-Origin', '*');
4346
- this.httpClient
4347
- .post(environment.api + "/message/direct-send/" + ((_b = (from || account)) === null || _b === void 0 ? void 0 : _b.id), {
4348
- type: 'text',
4349
- text: { body: text },
4350
- }, { headers: headers })
4351
- .subscribe({
4352
- next: function (response) {
4353
- var _a;
4354
- _this.isUtility = ((_a = response) === null || _a === void 0 ? void 0 : _a.category) === 'UTILITY';
4355
- _this.isCheckUtility = false;
4356
- },
4357
- error: function () {
4358
- _this.isCheckUtility = false;
4359
- },
4360
- });
4361
- };
4362
4389
  GeneralInformationWAComponent.prototype.getTemplateOptionService = function (event, filter, isInfinite) {
4363
4390
  var _this = this;
4364
4391
  if (event === void 0) { event = null; }
4365
4392
  if (filter === void 0) { filter = ''; }
4366
4393
  if (isInfinite === void 0) { isInfinite = false; }
4367
- var _a, _b, _c, _d;
4394
+ var _a, _b, _c, _d, _e, _f, _g;
4368
4395
  this.isLoadingTemplateOption = true;
4369
4396
  var parameterList = [
4370
4397
  this.initParam('pageNo', this.pageNoTemplateOption, 'number'),
@@ -4372,30 +4399,31 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4372
4399
  this.initParam('platform', 'WA', 'string'),
4373
4400
  this.initParam('filter', filter, 'string'),
4374
4401
  this.initParam('status', 'APPROVED', 'string'),
4375
- this.initParam('clientId', (_a = this.form.get('from').value) === null || _a === void 0 ? void 0 : _a.clientId, 'string'),
4376
- this.initParam('wabaId', (_c = (_b = this.form.get('from').value) === null || _b === void 0 ? void 0 : _b.wabaId, (_c !== null && _c !== void 0 ? _c : '')), 'string'),
4402
+ this.initParam('clientId', (_c = (_b = (_a = this.getControl('from')) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.clientId, (_c !== null && _c !== void 0 ? _c : '')), 'string'),
4403
+ this.initParam('wabaId', (_f = (_e = (_d = this.getControl('from')) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.wabaId, (_f !== null && _f !== void 0 ? _f : '')), 'string'),
4377
4404
  ];
4378
4405
  if (this.isReadOnlyMode)
4379
4406
  parameterList.push(this.initParam('summary', true, 'string'));
4380
- var messageType = (_d = this.form.value) === null || _d === void 0 ? void 0 : _d.channel;
4407
+ var messageType = (_g = this.form.value) === null || _g === void 0 ? void 0 : _g.channel;
4381
4408
  if (messageType === 'utility') {
4382
4409
  parameterList.push(this.initParam('isDirectSend', true, 'string'));
4383
4410
  }
4384
4411
  var subs = this.apiAdapterService
4385
4412
  .executeApiRequest(parameterList, '/message/template', 'GET')
4386
4413
  .subscribe(function (resp) {
4387
- var _a;
4388
- _this.templateOption = isInfinite
4389
- ? __spread(_this.templateOption, resp.data) : resp.data;
4390
- _this.isHaveNextTemplateOption = resp.haveNext;
4414
+ var _a, _b, _c, _d, _e, _f;
4415
+ var currentOptions = _this.templateOption || [];
4416
+ var newData = resp.data || [];
4417
+ _this.templateOption = isInfinite ? __spread(currentOptions, newData) : newData;
4418
+ _this.isHaveNextTemplateOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4391
4419
  _this.isLoadingTemplateOption = false;
4392
- var template = (_a = _this.templateOption) === null || _a === void 0 ? void 0 : _a.find(function (t) { var _a; return t.ID === ((_a = _this.form.get('template').value) === null || _a === void 0 ? void 0 : _a.ID); });
4420
+ var template = (_b = _this.templateOption) === null || _b === void 0 ? void 0 : _b.find(function (t) { var _a, _b; return t.ID === ((_b = (_a = _this.getControl('template')) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.ID); });
4393
4421
  if (template) {
4394
- _this.form.get('template').setValue(template);
4395
- if (_this.form.get('isUpload').value)
4396
- return _this.updateDownloadCSV(_this.form.get('isUpload').value);
4422
+ (_c = _this.getControl('template')) === null || _c === void 0 ? void 0 : _c.patchValue(template);
4423
+ if ((_d = _this.getControl('isUpload')) === null || _d === void 0 ? void 0 : _d.value)
4424
+ return _this.updateDownloadCSV((_e = _this.getControl('isUpload')) === null || _e === void 0 ? void 0 : _e.value);
4397
4425
  }
4398
- _this.updateTemplate(_this.form.get('template').value);
4426
+ _this.updateTemplate((_f = _this.getControl('template')) === null || _f === void 0 ? void 0 : _f.value);
4399
4427
  });
4400
4428
  this.subscribers.push(subs);
4401
4429
  };
@@ -4455,45 +4483,45 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4455
4483
  };
4456
4484
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsText", {
4457
4485
  get: function () {
4458
- var _a;
4459
- return (this.form.get('channel').value &&
4460
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'text');
4486
+ var _a, _b, _c;
4487
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4488
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'text');
4461
4489
  },
4462
4490
  enumerable: true,
4463
4491
  configurable: true
4464
4492
  });
4465
4493
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsMedia", {
4466
4494
  get: function () {
4467
- var _a;
4468
- return (this.form.get('channel').value &&
4469
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'media');
4495
+ var _a, _b, _c;
4496
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4497
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'media');
4470
4498
  },
4471
4499
  enumerable: true,
4472
4500
  configurable: true
4473
4501
  });
4474
4502
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsTemplate", {
4475
4503
  get: function () {
4476
- var _a;
4477
- return (this.form.get('channel').value &&
4478
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'template');
4504
+ var _a, _b, _c;
4505
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4506
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'template');
4479
4507
  },
4480
4508
  enumerable: true,
4481
4509
  configurable: true
4482
4510
  });
4483
4511
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsCatalogue", {
4484
4512
  get: function () {
4485
- var _a;
4486
- return (this.form.get('channel').value &&
4487
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'catalogue');
4513
+ var _a, _b, _c;
4514
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4515
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'catalogue');
4488
4516
  },
4489
4517
  enumerable: true,
4490
4518
  configurable: true
4491
4519
  });
4492
4520
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsUtility", {
4493
4521
  get: function () {
4494
- var _a;
4495
- return (this.form.get('channel').value &&
4496
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'utility');
4522
+ var _a, _b, _c;
4523
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4524
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'utility');
4497
4525
  },
4498
4526
  enumerable: true,
4499
4527
  configurable: true
@@ -4521,6 +4549,7 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4521
4549
  : '';
4522
4550
  };
4523
4551
  GeneralInformationWAComponent.prototype.onFileSelected = function (event) {
4552
+ var _a, _b, _c, _d, _e, _f;
4524
4553
  var file = event.target.files;
4525
4554
  var accept = this.extFileAccepted.split('/');
4526
4555
  var matchType = accept[0];
@@ -4536,21 +4565,22 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4536
4565
  this.toastr.error('Upload media failed, max size 10mb');
4537
4566
  return;
4538
4567
  }
4539
- this.form.get('file').setValue(file[0]);
4540
- this.form.get('fileType').setValue('image');
4541
- this.form.get('fileName').setValue(file[0].name);
4542
- this.form.get('targetURL').setValidators(Validators$1.required);
4543
- this.form.get('targetURL').updateValueAndValidity();
4568
+ (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.setValue(file[0]);
4569
+ (_b = this.getControl('fileType')) === null || _b === void 0 ? void 0 : _b.setValue('image');
4570
+ (_c = this.getControl('fileName')) === null || _c === void 0 ? void 0 : _c.setValue(file[0].name);
4571
+ (_d = this.getControl('targetURL')) === null || _d === void 0 ? void 0 : _d.setValidators(Validators$1.required);
4572
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4544
4573
  if (file[0].type.indexOf('video') > -1)
4545
- this.form.get('fileType').setValue('video');
4574
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.setValue('video');
4546
4575
  this.uploadMediaService();
4547
4576
  };
4548
4577
  GeneralInformationWAComponent.prototype.uploadMediaService = function () {
4549
4578
  var _this = this;
4579
+ var _a;
4550
4580
  var parameterList = [
4551
4581
  {
4552
4582
  name: 'file',
4553
- value: this.form.get('file').value,
4583
+ value: (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.value,
4554
4584
  in: 'formData',
4555
4585
  type: 'object',
4556
4586
  },
@@ -4558,75 +4588,93 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4558
4588
  var subs = this.apiAdapterService
4559
4589
  .executeApiRequest(parameterList, '/message/media', 'POST')
4560
4590
  .subscribe(function (resp) {
4561
- _this.form.get('targetURL').clearValidators();
4562
- _this.form.get('targetURL').updateValueAndValidity();
4563
- _this.form.get('targetURL').setValue(resp.data.targetURL);
4564
- _this.form.get('file').reset();
4591
+ var _a, _b, _c, _d;
4592
+ (_a = _this.getControl('targetURL')) === null || _a === void 0 ? void 0 : _a.clearValidators();
4593
+ (_b = _this.getControl('targetURL')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4594
+ (_c = _this.getControl('targetURL')) === null || _c === void 0 ? void 0 : _c.setValue(resp.data.targetURL);
4595
+ (_d = _this.getControl('file')) === null || _d === void 0 ? void 0 : _d.reset();
4565
4596
  _this.toastr.success('Upload media success');
4566
4597
  });
4567
4598
  this.subscribers.push(subs);
4568
4599
  };
4600
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "buttonParamsControls", {
4601
+ get: function () {
4602
+ return this.form.get('buttonParams').controls;
4603
+ },
4604
+ enumerable: true,
4605
+ configurable: true
4606
+ });
4607
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "isUsingExcelBulk", {
4608
+ get: function () {
4609
+ var _a;
4610
+ return ((_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.value) || false;
4611
+ },
4612
+ enumerable: true,
4613
+ configurable: true
4614
+ });
4569
4615
  GeneralInformationWAComponent.prototype.updateTemplate = function (template) {
4570
4616
  var _this = this;
4571
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
4617
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
4572
4618
  this.isShowParameter = false;
4573
4619
  if (!template)
4574
4620
  return;
4621
+ var buttonParamsArray = this.form.get('buttonParams');
4622
+ buttonParamsArray.clear();
4623
+ if (template && template.buttons && template.buttons.length > 0) {
4624
+ var quickReplyButtons = template.buttons.filter(function (btn) { return btn.type === 'QUICK_REPLY'; });
4625
+ quickReplyButtons.forEach(function (btn) {
4626
+ buttonParamsArray.push(new FormGroup({
4627
+ label: new FormControl(btn.text),
4628
+ payload: new FormControl('', [Validators$1.maxLength(256)]),
4629
+ }));
4630
+ });
4631
+ }
4575
4632
  this.isHaveTemplateParam =
4576
- ((_a = template.header.examples) === null || _a === void 0 ? void 0 : _a.length) > 0 ||
4577
- ((_b = template.body.examples) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
4578
- ((_c = template.buttons) === null || _c === void 0 ? void 0 : _c.length) > 0;
4579
- if (['image', 'video', 'document'].includes((_f = (_e = (_d = template) === null || _d === void 0 ? void 0 : _d.header) === null || _e === void 0 ? void 0 : _e.type) === null || _f === void 0 ? void 0 : _f.toLowerCase())) {
4580
- this.form
4581
- .get('fileName')
4582
- .setValue((_m = (_j = (_h = (_g = this.getCampaignStorage) === null || _g === void 0 ? void 0 : _g.generalInformation) === null || _h === void 0 ? void 0 : _h.form.fileName, (_j !== null && _j !== void 0 ? _j : (_l = (_k = this.getCampaignStorage) === null || _k === void 0 ? void 0 : _k.generalInformation) === null || _l === void 0 ? void 0 : _l.form.targetURL)), (_m !== null && _m !== void 0 ? _m : template.header.url)));
4583
- this.form
4584
- .get('targetURL')
4585
- .setValue((_q = (_p = (_o = this.getCampaignStorage) === null || _o === void 0 ? void 0 : _o.generalInformation) === null || _p === void 0 ? void 0 : _p.form.targetURL, (_q !== null && _q !== void 0 ? _q : template.header.url)));
4586
- this.fileTypeChange((_t = (_s = (_r = template) === null || _r === void 0 ? void 0 : _r.header) === null || _s === void 0 ? void 0 : _s.type) === null || _t === void 0 ? void 0 : _t.toLowerCase());
4587
- }
4588
- ((_u = template.header.examples) === null || _u === void 0 ? void 0 : _u.length) > 0
4589
- ? this.form.get('paramHeader').setValidators(Validators$1.required)
4590
- : this.form.get('paramHeader').clearValidators();
4591
- ((_v = template.body.examples) === null || _v === void 0 ? void 0 : _v.length) > 0
4592
- ? this.form.get('paramBody').setValidators(Validators$1.required)
4593
- : this.form.get('paramBody').clearValidators();
4594
- ((_w = template.buttons) === null || _w === void 0 ? void 0 : _w.length) > 0
4595
- ? this.form.get('paramButton').setValidators(Validators$1.required)
4596
- : this.form.get('paramButton').clearValidators();
4633
+ (_c = (_b = (_a = template.header) === null || _a === void 0 ? void 0 : _a.examples) === null || _b === void 0 ? void 0 : _b.length, (_c !== null && _c !== void 0 ? _c : 0)) > 0 ||
4634
+ (_f = (_e = (_d = template.body) === null || _d === void 0 ? void 0 : _d.examples) === null || _e === void 0 ? void 0 : _e.length, (_f !== null && _f !== void 0 ? _f : 0)) > 0 ||
4635
+ (_h = (_g = template.buttons) === null || _g === void 0 ? void 0 : _g.length, (_h !== null && _h !== void 0 ? _h : 0)) > 0;
4636
+ if (['image', 'video', 'document'].includes((_l = (_k = (_j = template) === null || _j === void 0 ? void 0 : _j.header) === null || _k === void 0 ? void 0 : _k.type) === null || _l === void 0 ? void 0 : _l.toLowerCase())) {
4637
+ (_m = this.getControl('fileName')) === null || _m === void 0 ? void 0 : _m.setValue((_t = (_q = (_p = (_o = this.getCampaignStorage) === null || _o === void 0 ? void 0 : _o.generalInformation) === null || _p === void 0 ? void 0 : _p.form.fileName, (_q !== null && _q !== void 0 ? _q : (_s = (_r = this.getCampaignStorage) === null || _r === void 0 ? void 0 : _r.generalInformation) === null || _s === void 0 ? void 0 : _s.form.targetURL)), (_t !== null && _t !== void 0 ? _t : template.header.url)));
4638
+ (_u = this.getControl('targetURL')) === null || _u === void 0 ? void 0 : _u.setValue((_x = (_w = (_v = this.getCampaignStorage) === null || _v === void 0 ? void 0 : _v.generalInformation) === null || _w === void 0 ? void 0 : _w.form.targetURL, (_x !== null && _x !== void 0 ? _x : template.header.url)));
4639
+ this.fileTypeChange((_0 = (_z = (_y = template) === null || _y === void 0 ? void 0 : _y.header) === null || _z === void 0 ? void 0 : _z.type) === null || _0 === void 0 ? void 0 : _0.toLowerCase());
4640
+ }
4641
+ (_2 = (_1 = template.header.examples) === null || _1 === void 0 ? void 0 : _1.length, (_2 !== null && _2 !== void 0 ? _2 : 0)) > 0
4642
+ ? (_3 = this.getControl('paramHeader')) === null || _3 === void 0 ? void 0 : _3.setValidators(Validators$1.required) : (_4 = this.getControl('paramHeader')) === null || _4 === void 0 ? void 0 : _4.clearValidators();
4643
+ (_6 = (_5 = template.body.examples) === null || _5 === void 0 ? void 0 : _5.length, (_6 !== null && _6 !== void 0 ? _6 : 0)) > 0
4644
+ ? (_7 = this.getControl('paramBody')) === null || _7 === void 0 ? void 0 : _7.setValidators(Validators$1.required) : (_8 = this.getControl('paramBody')) === null || _8 === void 0 ? void 0 : _8.clearValidators();
4645
+ (_10 = (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.length, (_10 !== null && _10 !== void 0 ? _10 : 0)) > 0
4646
+ ? (_11 = this.getControl('paramButton')) === null || _11 === void 0 ? void 0 : _11.setValidators(Validators$1.required) : (_12 = this.getControl('paramButton')) === null || _12 === void 0 ? void 0 : _12.clearValidators();
4597
4647
  this.form.get('paramHeader').controls = [];
4598
4648
  this.form.get('paramHeader').reset();
4599
- this.form.get('paramHeader').updateValueAndValidity();
4649
+ (_13 = this.getControl('paramHeader')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4600
4650
  this.form.get('paramBody').controls = [];
4601
4651
  this.form.get('paramBody').reset();
4602
- this.form.get('paramBody').updateValueAndValidity();
4652
+ (_14 = this.getControl('paramBody')) === null || _14 === void 0 ? void 0 : _14.updateValueAndValidity();
4603
4653
  this.form.get('paramButton').controls = [];
4604
4654
  this.form.get('paramButton').reset();
4605
- this.form.get('paramButton').updateValueAndValidity();
4606
- this.form.get('otpValue').setValue('');
4607
- this.form.get('otpValue').clearValidators();
4608
- this.form.get('otpValue').updateValueAndValidity();
4609
- var formStorage = (_y = (_x = this.getCampaignStorage) === null || _x === void 0 ? void 0 : _x.generalInformation) === null || _y === void 0 ? void 0 : _y.form;
4655
+ (_15 = this.getControl('paramButton')) === null || _15 === void 0 ? void 0 : _15.updateValueAndValidity();
4656
+ (_16 = this.getControl('otpValue')) === null || _16 === void 0 ? void 0 : _16.setValue('');
4657
+ (_17 = this.getControl('otpValue')) === null || _17 === void 0 ? void 0 : _17.clearValidators();
4658
+ (_18 = this.getControl('otpValue')) === null || _18 === void 0 ? void 0 : _18.updateValueAndValidity();
4659
+ var formStorage = (_20 = (_19 = this.getCampaignStorage) === null || _19 === void 0 ? void 0 : _19.generalInformation) === null || _20 === void 0 ? void 0 : _20.form;
4610
4660
  if (template.category === 'AUTHENTICATION') {
4611
- this.form
4612
- .get('otpValue')
4613
- .setValue((_6 = (_0 = (_z = formStorage) === null || _z === void 0 ? void 0 : _z.otpValue, (_0 !== null && _0 !== void 0 ? _0 : (_5 = __spread((_4 = (_3 = (_2 = (_1 = formStorage) === null || _1 === void 0 ? void 0 : _1.template) === null || _2 === void 0 ? void 0 : _2.body) === null || _3 === void 0 ? void 0 : _3.examples, (_4 !== null && _4 !== void 0 ? _4 : [])))) === null || _5 === void 0 ? void 0 : _5.pop())), (_6 !== null && _6 !== void 0 ? _6 : '')));
4614
- this.form.get('otpValue').setValidators(Validators$1.required);
4615
- this.form.get('otpValue').updateValueAndValidity();
4661
+ (_21 = this.getControl('otpValue')) === null || _21 === void 0 ? void 0 : _21.setValue((_29 = (_23 = (_22 = formStorage) === null || _22 === void 0 ? void 0 : _22.otpValue, (_23 !== null && _23 !== void 0 ? _23 : (_28 = __spread((_27 = (_26 = (_25 = (_24 = formStorage) === null || _24 === void 0 ? void 0 : _24.template) === null || _25 === void 0 ? void 0 : _25.body) === null || _26 === void 0 ? void 0 : _26.examples, (_27 !== null && _27 !== void 0 ? _27 : [])))) === null || _28 === void 0 ? void 0 : _28.pop())), (_29 !== null && _29 !== void 0 ? _29 : '')));
4662
+ (_30 = this.getControl('otpValue')) === null || _30 === void 0 ? void 0 : _30.setValidators(Validators$1.required);
4663
+ (_31 = this.getControl('otpValue')) === null || _31 === void 0 ? void 0 : _31.updateValueAndValidity();
4616
4664
  }
4617
- (_7 = template.header.examples) === null || _7 === void 0 ? void 0 : _7.forEach(function (each, index) {
4665
+ (_32 = template.header.examples) === null || _32 === void 0 ? void 0 : _32.forEach(function (each, index) {
4618
4666
  var _a, _b, _c, _d, _e, _f, _g;
4619
4667
  _this.addParamHeader((_g = (_d = (_c = (_b = (_a = formStorage) === null || _a === void 0 ? void 0 : _a.paramHeader) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.name, (_d !== null && _d !== void 0 ? _d : (_f = (_e = formStorage) === null || _e === void 0 ? void 0 : _e.paramHeader) === null || _f === void 0 ? void 0 : _f[index])), (_g !== null && _g !== void 0 ? _g : '')));
4620
4668
  });
4621
- (_8 = template.body.examples) === null || _8 === void 0 ? void 0 : _8.forEach(function (each, index) {
4669
+ (_33 = template.body.examples) === null || _33 === void 0 ? void 0 : _33.forEach(function (each, index) {
4622
4670
  var _a, _b, _c, _d, _e, _f, _g;
4623
4671
  var paramValue = (_g = (_d = (_c = (_b = (_a = formStorage) === null || _a === void 0 ? void 0 : _a.paramBody) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.name, (_d !== null && _d !== void 0 ? _d : (_f = (_e = formStorage) === null || _e === void 0 ? void 0 : _e.paramBody) === null || _f === void 0 ? void 0 : _f[index])), (_g !== null && _g !== void 0 ? _g : ''));
4624
4672
  if (['$UnsubscribeAccount'].includes(each))
4625
4673
  paramValue = each;
4626
4674
  _this.addParamBody(paramValue);
4627
4675
  });
4628
- (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.forEach(function (each, index) {
4629
- var _a;
4676
+ (_34 = template.buttons) === null || _34 === void 0 ? void 0 : _34.forEach(function (each, index) {
4677
+ var _a, _b, _c, _d;
4630
4678
  _this.addParamButton();
4631
4679
  var button = _this.getButton;
4632
4680
  if (((_a = each.examples) === null || _a === void 0 ? void 0 : _a.length) > 0) {
@@ -4644,8 +4692,9 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4644
4692
  });
4645
4693
  }
4646
4694
  else {
4647
- button[button.length - 1].get('name').clearValidators();
4648
- button[button.length - 1].get('name').updateValueAndValidity();
4695
+ var lastControl = (_b = button[button.length - 1]) === null || _b === void 0 ? void 0 : _b.get('name');
4696
+ (_c = lastControl) === null || _c === void 0 ? void 0 : _c.clearValidators();
4697
+ (_d = lastControl) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4649
4698
  }
4650
4699
  });
4651
4700
  };
@@ -4680,13 +4729,14 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4680
4729
  var autocomplete = new google.maps.places.Autocomplete(_this.mapSearchRef.nativeElement);
4681
4730
  autocomplete.addListener('place_changed', function () {
4682
4731
  _this.ngZone.run(function () {
4732
+ var _a, _b;
4683
4733
  var place = autocomplete.getPlace();
4684
4734
  if (!place.geometry)
4685
4735
  return;
4686
4736
  _this.maps.latitude = place.geometry.location.lat();
4687
4737
  _this.maps.longitude = place.geometry.location.lng();
4688
- _this.form.get('latitude').setValue(_this.maps.latitude);
4689
- _this.form.get('longitude').setValue(_this.maps.longitude);
4738
+ (_a = _this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(_this.maps.latitude);
4739
+ (_b = _this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(_this.maps.longitude);
4690
4740
  });
4691
4741
  });
4692
4742
  });
@@ -4695,69 +4745,139 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4695
4745
  var _this = this;
4696
4746
  if ('geolocation' in navigator) {
4697
4747
  navigator.geolocation.getCurrentPosition(function (position) {
4698
- if (!_this.form.get('longitude').value && !_this.form.get('latitude').value) {
4748
+ var _a, _b, _c, _d;
4749
+ if (!((_a = _this.getControl('longitude')) === null || _a === void 0 ? void 0 : _a.value) && !((_b = _this.getControl('latitude')) === null || _b === void 0 ? void 0 : _b.value)) {
4699
4750
  _this.maps.latitude = position.coords.latitude;
4700
4751
  _this.maps.longitude = position.coords.longitude;
4701
- _this.form.get('latitude').setValue(_this.maps.latitude);
4702
- _this.form.get('longitude').setValue(_this.maps.longitude);
4752
+ (_c = _this.getControl('latitude')) === null || _c === void 0 ? void 0 : _c.setValue(_this.maps.latitude);
4753
+ (_d = _this.getControl('longitude')) === null || _d === void 0 ? void 0 : _d.setValue(_this.maps.longitude);
4703
4754
  }
4704
4755
  });
4705
4756
  }
4706
4757
  };
4707
4758
  GeneralInformationWAComponent.prototype.markerDragEnd = function (event) {
4759
+ var _a, _b;
4708
4760
  if (event.latLng) {
4709
4761
  this.maps.latitude = event.latLng.lat();
4710
4762
  this.maps.longitude = event.latLng.lng();
4711
- this.form.get('latitude').setValue(this.maps.latitude);
4712
- this.form.get('longitude').setValue(this.maps.longitude);
4763
+ (_a = this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(this.maps.latitude);
4764
+ (_b = this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(this.maps.longitude);
4713
4765
  }
4714
4766
  };
4715
4767
  GeneralInformationWAComponent.prototype.updateDownloadCSV = function (isChecked) {
4716
- this.form.get('isUpload').setValue(isChecked);
4768
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4769
+ (_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.setValue(isChecked);
4717
4770
  if (isChecked) {
4718
- this.form.get('paramHeader').controls = [];
4719
- this.form.get('paramHeader').reset();
4720
- this.form.get('paramBody').controls = [];
4721
- this.form.get('paramBody').reset();
4722
- this.form.get('paramButton').controls = [];
4723
- this.form.get('paramButton').reset();
4724
- this.form.get('paramHeader').clearValidators();
4725
- this.form.get('paramBody').clearValidators();
4726
- this.form.get('paramButton').clearValidators();
4727
- this.form.get('paramHeader').updateValueAndValidity();
4728
- this.form.get('paramBody').updateValueAndValidity();
4729
- this.form.get('paramButton').updateValueAndValidity();
4730
- this.form.get('otpValue').reset();
4731
- this.form.get('otpValue').clearValidators();
4732
- this.form.get('otpValue').updateValueAndValidity();
4771
+ this.getControl('paramHeader').controls = [];
4772
+ this.getControl('paramHeader').reset();
4773
+ this.getControl('paramBody').controls = [];
4774
+ this.getControl('paramBody').reset();
4775
+ this.getControl('paramButton').controls = [];
4776
+ this.getControl('paramButton').reset();
4777
+ (_b = this.getControl('paramHeader')) === null || _b === void 0 ? void 0 : _b.clearValidators();
4778
+ (_c = this.getControl('paramBody')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4779
+ (_d = this.getControl('paramButton')) === null || _d === void 0 ? void 0 : _d.clearValidators();
4780
+ (_e = this.getControl('paramHeader')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4781
+ (_f = this.getControl('paramBody')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4782
+ (_g = this.getControl('paramButton')) === null || _g === void 0 ? void 0 : _g.updateValueAndValidity();
4783
+ (_h = this.getControl('otpValue')) === null || _h === void 0 ? void 0 : _h.reset();
4784
+ (_j = this.getControl('otpValue')) === null || _j === void 0 ? void 0 : _j.clearValidators();
4785
+ (_k = this.getControl('otpValue')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4733
4786
  return;
4734
4787
  }
4735
- this.updateTemplate(this.form.get('template').value);
4788
+ this.updateTemplate((_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.value);
4736
4789
  };
4737
4790
  GeneralInformationWAComponent.prototype.handleChangeTemplate = function (useExisting) {
4791
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4792
+ (_a = this.getControl('isDownloadVariableXLS')) === null || _a === void 0 ? void 0 : _a.setValue(false);
4793
+ this.variables.clear();
4794
+ this.updateVariableDownloadXLS(false);
4738
4795
  if (useExisting) {
4739
- this.form.get('template').setValidators(Validators$1.required);
4740
- this.form.get('text').reset();
4741
- this.form.get('text').clearValidators();
4742
- this.form.get('text').updateValueAndValidity();
4743
- this.form.get('template').updateValueAndValidity();
4796
+ (_b = this.getControl('template')) === null || _b === void 0 ? void 0 : _b.setValidators(Validators$1.required);
4797
+ //this.getControl('text')?.reset();
4798
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4799
+ (_d = this.getControl('text')) === null || _d === void 0 ? void 0 : _d.setValue('Halo {{1}}, ini adalah kode verifikasi kamu: {{2}}');
4800
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4801
+ (_f = this.getControl('template')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4802
+ this.variables.push(new FormGroup({
4803
+ paramName: new FormControl('', Validators$1.required),
4804
+ }));
4805
+ this.variables.push(new FormGroup({
4806
+ paramName: new FormControl('', Validators$1.required),
4807
+ }));
4744
4808
  }
4745
4809
  else {
4746
- this.form.get('template').reset();
4747
- this.form.get('template').clearValidators();
4748
- this.form.get('text').setValidators([Validators$1.required, Validators$1.max(1024)]);
4749
- this.form.get('text').updateValueAndValidity();
4750
- this.form.get('template').updateValueAndValidity();
4810
+ (_g = this.getControl('template')) === null || _g === void 0 ? void 0 : _g.reset();
4811
+ (_h = this.getControl('template')) === null || _h === void 0 ? void 0 : _h.clearValidators();
4812
+ (_j = this.getControl('text')) === null || _j === void 0 ? void 0 : _j.setValidators([Validators$1.required, Validators$1.max(1024)]);
4813
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4814
+ (_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
4751
4815
  }
4752
4816
  };
4753
4817
  GeneralInformationWAComponent.prototype.handleChangeFrom = function (value) {
4754
4818
  var isUseExistingTemplate = this.form.value.isUseExistingTemplate;
4755
- if (isUseExistingTemplate) {
4756
- this.getTemplateOptionService(value);
4819
+ if (!isUseExistingTemplate)
4820
+ return;
4821
+ this.getTemplateOptionService(value);
4822
+ };
4823
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "variables", {
4824
+ get: function () {
4825
+ return this.getControl('variables');
4826
+ },
4827
+ enumerable: true,
4828
+ configurable: true
4829
+ });
4830
+ GeneralInformationWAComponent.prototype.addVariable = function () {
4831
+ var variableGroup = new FormGroup({
4832
+ paramName: new FormControl('', Validators$1.required),
4833
+ });
4834
+ this.variables.push(variableGroup);
4835
+ var textControl = this.getControl('text');
4836
+ if (textControl) {
4837
+ var currentBody = textControl.value || '';
4838
+ var newSequence = "{{" + this.variables.controls.length + "}}";
4839
+ textControl.setValue((currentBody + " " + newSequence).trim());
4840
+ }
4841
+ };
4842
+ GeneralInformationWAComponent.prototype.removeVariable = function (index) {
4843
+ var _a;
4844
+ this.variables.removeAt(index);
4845
+ if (this.variables.controls.length === 0) {
4846
+ (_a = this.getControl('useXlsx')) === null || _a === void 0 ? void 0 : _a.setValue(false);
4847
+ }
4848
+ var textControl = this.getControl('text');
4849
+ if (textControl && textControl.value) {
4850
+ var targetSequence_1 = index + 1;
4851
+ var currentBody = textControl.value;
4852
+ var removeRegex = new RegExp("\\s*\\{\\{" + targetSequence_1 + "\\}\\}", 'g');
4853
+ currentBody = currentBody.replace(removeRegex, '');
4854
+ currentBody = currentBody.replace(/\{\{(\d+)\}\}/g, function (match, numStr) {
4855
+ var num = parseInt(numStr, 10);
4856
+ if (num > targetSequence_1) {
4857
+ return "{{" + (num - 1) + "}}";
4858
+ }
4859
+ return match;
4860
+ });
4861
+ textControl.setValue(currentBody.trim());
4862
+ }
4863
+ };
4864
+ GeneralInformationWAComponent.prototype.updateVariableDownloadXLS = function (isChecked) {
4865
+ var variablesArray = this.variables;
4866
+ if (isChecked) {
4867
+ variablesArray.controls.forEach(function (control) {
4868
+ var _a, _b;
4869
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.clearValidators();
4870
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4871
+ });
4757
4872
  }
4758
4873
  else {
4759
- this.validateText(value);
4874
+ variablesArray.controls.forEach(function (control) {
4875
+ var _a, _b;
4876
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.setValidators(Validators$1.required);
4877
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4878
+ });
4760
4879
  }
4880
+ this.form.updateValueAndValidity();
4761
4881
  };
4762
4882
  GeneralInformationWAComponent.prototype.ngOnDestroy = function () {
4763
4883
  this.subscribers.forEach(function (each) { return each.unsubscribe(); });
@@ -4784,8 +4904,8 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4784
4904
  GeneralInformationWAComponent = __decorate([
4785
4905
  Component({
4786
4906
  selector: 'lib-general-information-wa',
4787
- template: "<form autocomplete=\"off\" [formGroup]=\"form\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Message Type</mat-label>\r\n\r\n <mat-select placeholder=\"Select message type\" formControlName=\"channel\">\r\n <mat-option\r\n *ngFor=\"let option of msgTypeWAOption\"\r\n [value]=\"option.code\"\r\n (click)=\"formReset()\"\r\n >\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.channel\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('channel')?.touched && form.get('channel')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n\r\n <div\r\n *ngIf=\"!getIsTemplate\"\r\n role=\"alert\"\r\n class=\"alert alert-warning d-flex align-items-center\"\r\n style=\"margin-top: 16px; border: 1px solid rgb(243, 124, 44)\"\r\n >\r\n <mat-icon style=\"margin-right: 10px !important\">error_outline</mat-icon>\r\n <div *ngIf=\"!getIsUtility\">\r\n If you select this channel, keep in mind that the message might not be delivered to\r\n all selected customers. This is because the customer must have had a conversation\r\n previously with BSP.\r\n </div>\r\n\r\n <div *ngIf=\"getIsUtility\">\r\n You can send directly a utility message. You can choose between existing utility\r\n templates or creating a new one. If you create a new template, the system may check\r\n whether the content already exists as a template.\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getIsText\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from').touched && form.get('from').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label class=\"asterix--after\">Text</mat-label>\r\n\r\n <textarea\r\n matInput\r\n rows=\"6\"\r\n cols=\"50\"\r\n cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"2\"\r\n cdkAutosizeMaxRows=\"15\"\r\n formControlName=\"text\"\r\n placeholder=\"Enter text\"\r\n #autosize=\"cdkTextareaAutosize\"\r\n ></textarea>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.text\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('text')?.touched && form.get('text')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsMedia\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Media Type</mat-label>\r\n\r\n <mat-select\r\n placeholder=\"Select media type\"\r\n formControlName=\"media\"\r\n (selectionChange)=\"updateMediaType($event.value)\"\r\n >\r\n <mat-option *ngFor=\"let option of mediaTypeOption\" [value]=\"option.code\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.media\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('media').touched && form.get('media').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from').touched && form.get('from').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"form.get('media').value?.toLowerCase() !== 'location'\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">File</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n (click)=\"filePicker.click()\"\r\n formControlName=\"fileName\"\r\n />\r\n\r\n <button\r\n mat-button\r\n matSuffix\r\n mat-icon-button\r\n aria-label=\"Choose File\"\r\n (click)=\"filePicker.click()\"\r\n >\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n\r\n <input\r\n #filePicker\r\n hidden\r\n type=\"file\"\r\n [accept]=\"extFileAccepted\"\r\n (change)=\"onFileSelected($event)\"\r\n />\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.fileName\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('fileName').touched &&\r\n form.get('fileName').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('media').value?.toLowerCase() === 'location'\">\r\n <div class=\"w-100\">\r\n <h4 class=\"asterix--after\">Location</h4>\r\n\r\n <div class=\"w-100\">\r\n <agm-map\r\n style=\"width: 100%; height: 400px\"\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [disableDoubleClickZoom]=\"maps.isDoubleClickZoom\"\r\n [zoom]=\"maps.zoom\"\r\n >\r\n <agm-marker\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [markerDraggable]=\"maps.isDraggable\"\r\n (dragEnd)=\"markerDragEnd($event)\"\r\n ></agm-marker>\r\n </agm-map>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Location</mat-label>\r\n\r\n <input\r\n #mapSearch\r\n matInput\r\n type=\"text\"\r\n maxlength=\"100\"\r\n placeholder=\"Enter location here\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsTemplate\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n (selectionChange)=\"getTemplateOptionService($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"template\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n (selectionChange)=\"updateTemplate($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('template').value?.name\"\r\n (searchRes)=\"updateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.template\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('template')?.touched &&\r\n form.get('template')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div *ngIf=\"isHaveTemplateParam\" class=\"d-flex justify-content-end\">\r\n <mat-checkbox\r\n labelPosition=\"before\"\r\n formControlName=\"isUpload\"\r\n (change)=\"updateDownloadCSV($event.checked)\"\r\n >\r\n Using Download XLSX\r\n </mat-checkbox>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!form.get('isUpload')?.value\">\r\n <div\r\n *ngIf=\"form.get('template')?.value?.category === 'AUTHENTICATION'\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label> OTP Value </mat-label>\r\n\r\n <input matInput type=\"text\" formControlName=\"otpValue\" />\r\n </mat-form-field>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getParamHeader?.length > 0\">\r\n <p class=\"font-16px font-PoppinsBold\">Header Parameter</p>\r\n\r\n <div\r\n *ngFor=\"let param of getParamHeader; let paramHeaderIndex = index\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramHeaderIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramHeaderIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getParamBody?.length > 0\">\r\n <p class=\"font-16px font-PoppinsBold mt-3\">Body Parameter</p>\r\n\r\n <div\r\n *ngFor=\"let param of getParamBody; let paramBodyIndex = index\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramBodyIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramBodyIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"isShowParameter\">\r\n <p class=\"font-16px font-PoppinsBold mt-3\">Button Parameter</p>\r\n\r\n <ng-container *ngFor=\"let button of getButton; let buttonIndex = index\">\r\n <ng-container *ngIf=\"getParamButton(buttonIndex)?.length > 0\">\r\n <p class=\"font-14px font-PoppinsBold mt-3\">Button {{ buttonIndex + 1 }}</p>\r\n\r\n <div\r\n *ngFor=\"\r\n let param of getParamButton(buttonIndex);\r\n let paramIndex = index\r\n \"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container\r\n *ngIf=\"\r\n ['image', 'video', 'document'].includes(\r\n form.get('template')?.value?.header?.type?.toLowerCase()\r\n )\r\n \"\r\n >\r\n <p class=\"font-16px font-PoppinsBold mt-3\">File</p>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">File</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n (click)=\"filePicker.click()\"\r\n formControlName=\"fileName\"\r\n />\r\n\r\n <button\r\n mat-button\r\n matSuffix\r\n mat-icon-button\r\n aria-label=\"Choose File\"\r\n (click)=\"filePicker.click()\"\r\n >\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n\r\n <input\r\n #filePicker\r\n hidden\r\n type=\"file\"\r\n [accept]=\"extFileAccepted\"\r\n (change)=\"onFileSelected($event)\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsCatalogue\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">Category</mat-label>\r\n\r\n <mat-select formControlName=\"category\" placeholder=\"Select category\">\r\n <mat-option *ngFor=\"let option of categoryOption\" [value]=\"option.value\">\r\n {{ option.label }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.category\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('category')?.touched &&\r\n form.get('category')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">Catalog</mat-label>\r\n\r\n <mat-select formControlName=\"catalogue\" placeholder=\"Select catalog\">\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.catalogue\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('catalogue')?.touched &&\r\n form.get('catalogue')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"form.get('category')?.value === 'product'\"\r\n style=\"padding: 8px; border-radius: 8px; border: 1px solid #6177c4\"\r\n >\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Product</mat-label>\r\n\r\n <mat-select formControlName=\"product\" placeholder=\"Select product\">\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.product\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('product')?.touched &&\r\n form.get('product')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Body</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n maxlength=\"100\"\r\n formControlName=\"body\"\r\n placeholder=\"Enter body\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsUtility\">\r\n <div style=\"display: grid; gap: 0.5rem\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n <mat-radio-group\r\n style=\"display: flex; gap: 0.5rem; flex-wrap: wrap\"\r\n formControlName=\"isUseExistingTemplate\"\r\n (change)=\"handleChangeTemplate($event.value)\"\r\n >\r\n <mat-radio-button\r\n [value]=\"option.value\"\r\n *ngFor=\"let option of templates\"\r\n color=\"primary\"\r\n >\r\n {{ option.label }}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n (selectionChange)=\"handleChangeFrom($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!form.get('isUseExistingTemplate')?.value; else existingTmpl\">\r\n <ng-container *ngTemplateOutlet=\"stageAlertTmpl\"></ng-container>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label class=\"asterix--after\">Body</mat-label>\r\n\r\n <textarea\r\n matInput\r\n rows=\"6\"\r\n cols=\"50\"\r\n cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"2\"\r\n cdkAutosizeMaxRows=\"15\"\r\n formControlName=\"text\"\r\n placeholder=\"Enter text\"\r\n #autosize=\"cdkTextareaAutosize\"\r\n ></textarea>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.text\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('text').touched && form.get('text').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <app-input\r\n type=\"numeric\"\r\n formControlName=\"ttl\"\r\n label=\"TTL\"\r\n placeholder=\"Enter ttl\"\r\n [trimLeadingZeros]=\"true\"\r\n ></app-input>\r\n </div>\r\n\r\n <div *ngIf=\"!isReadOnlyMode\">\r\n <mat-checkbox formControlName=\"isNeedSave\">\r\n Save this message as future template\r\n </mat-checkbox>\r\n </div>\r\n\r\n <div\r\n role=\"alert\"\r\n class=\"alert alert-warning d-flex align-items-center\"\r\n style=\"margin-top: 8px; border: 1px solid rgb(243, 124, 44)\"\r\n *ngIf=\"!isUtility\"\r\n >\r\n <mat-icon style=\"margin-right: 10px !important\">error_outline</mat-icon>\r\n <div>\r\n Copy mismatch. This copy is not Utility content. Please revise to proceed.\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-template #existingTmpl>\r\n <ng-container *ngTemplateOutlet=\"stageAlertTmpl\"></ng-container>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"template\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n (selectionChange)=\"updateTemplate($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('template').value?.name\"\r\n (searchRes)=\"updateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.template\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('template')?.touched &&\r\n form.get('template')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <app-input\r\n type=\"numeric\"\r\n formControlName=\"ttl\"\r\n label=\"TTL\"\r\n placeholder=\"Enter ttl\"\r\n [trimLeadingZeros]=\"true\"\r\n ></app-input>\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n</form>\r\n\r\n<ng-template #stageAlertTmpl>\r\n <div\r\n role=\"alert\"\r\n class=\"alert alert-warning d-flex align-items-center\"\r\n style=\"margin-top: 8px; border: 1px solid rgb(243, 124, 44)\"\r\n *ngIf=\"form.get('from')?.value && form.get('from')?.value?.directSendRestrictionStage > 0\"\r\n >\r\n <mat-icon style=\"margin-right: 10px !important\">error_outline</mat-icon>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 1\">\r\n Direct Send misuse detected. Please review your messaging practices.\r\n </div>\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 2\">\r\n Direct Send access restricted for 7 days due to continued misuse.\r\n </div>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 3\">\r\n Direct Send access restricted for 30 days due to continued misuse. Final warning before\r\n permanent revocation.\r\n </div>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 4\">\r\n Direct Send access has been permanently revoked.\r\n </div>\r\n </div>\r\n</ng-template>\r\n",
4788
- styles: [".asterix--after:after{content:\"*\";color:red}"]
4907
+ template: "<form autocomplete=\"off\" [formGroup]=\"form\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Message Type</mat-label>\r\n <mat-select placeholder=\"Select message type\" formControlName=\"channel\">\r\n <mat-option\r\n *ngFor=\"let option of msgTypeWAOption\"\r\n [value]=\"option.code\"\r\n (click)=\"formReset()\"\r\n >\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.channel\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('channel')?.touched && form.get('channel')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n\r\n <div\r\n *ngIf=\"!getIsTemplate\"\r\n role=\"alert\"\r\n class=\"alert alert-warning d-flex align-items-center\"\r\n style=\"margin-top: 16px; border: 1px solid rgb(243, 124, 44)\"\r\n >\r\n <mat-icon style=\"margin-right: 10px !important\">error_outline</mat-icon>\r\n <div *ngIf=\"!getIsUtility\">\r\n If you select this channel, keep in mind that the message might not be delivered to\r\n all selected customers. This is because the customer must have had a conversation\r\n previously with BSP.\r\n </div>\r\n\r\n <div *ngIf=\"getIsUtility\">\r\n You can send directly a utility message. You can choose between existing utility\r\n templates or creating a new one. If you create a new template, the system may check\r\n whether the content already exists as a template.\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getIsText\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from').touched && form.get('from').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label class=\"asterix--after\">Text</mat-label>\r\n\r\n <textarea\r\n matInput\r\n rows=\"6\"\r\n cols=\"50\"\r\n cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"2\"\r\n cdkAutosizeMaxRows=\"15\"\r\n formControlName=\"text\"\r\n placeholder=\"Enter text\"\r\n #autosize=\"cdkTextareaAutosize\"\r\n ></textarea>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.text\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('text')?.touched && form.get('text')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsMedia\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Media Type</mat-label>\r\n\r\n <mat-select\r\n placeholder=\"Select media type\"\r\n formControlName=\"media\"\r\n (selectionChange)=\"updateMediaType($event.value)\"\r\n >\r\n <mat-option *ngFor=\"let option of mediaTypeOption\" [value]=\"option.code\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.media\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('media').touched && form.get('media').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from').touched && form.get('from').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"form.get('media').value?.toLowerCase() !== 'location'\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">File</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n (click)=\"filePicker.click()\"\r\n formControlName=\"fileName\"\r\n />\r\n\r\n <button\r\n mat-button\r\n matSuffix\r\n mat-icon-button\r\n aria-label=\"Choose File\"\r\n (click)=\"filePicker.click()\"\r\n >\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n\r\n <input\r\n #filePicker\r\n hidden\r\n type=\"file\"\r\n [accept]=\"extFileAccepted\"\r\n (change)=\"onFileSelected($event)\"\r\n />\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.fileName\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('fileName').touched &&\r\n form.get('fileName').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('media').value?.toLowerCase() === 'location'\">\r\n <div class=\"w-100\">\r\n <h4 class=\"asterix--after\">Location</h4>\r\n\r\n <div class=\"w-100\">\r\n <agm-map\r\n style=\"width: 100%; height: 400px\"\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [disableDoubleClickZoom]=\"maps.isDoubleClickZoom\"\r\n [zoom]=\"maps.zoom\"\r\n >\r\n <agm-marker\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [markerDraggable]=\"maps.isDraggable\"\r\n (dragEnd)=\"markerDragEnd($event)\"\r\n ></agm-marker>\r\n </agm-map>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Location</mat-label>\r\n\r\n <input\r\n #mapSearch\r\n matInput\r\n type=\"text\"\r\n maxlength=\"100\"\r\n placeholder=\"Enter location here\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsTemplate\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n (selectionChange)=\"getTemplateOptionService($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"template\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n (selectionChange)=\"updateTemplate($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('template').value?.name\"\r\n (searchRes)=\"updateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.template\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('template')?.touched &&\r\n form.get('template')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div\r\n class=\"button-parameter-section mt-4\"\r\n *ngIf=\"buttonParamsControls.length > 0 && !isUsingExcelBulk\"\r\n >\r\n <h5 class=\"mb-3 font-weight-bold\">Button Parameter</h5>\r\n\r\n <div formArrayName=\"buttonParams\">\r\n <div\r\n *ngFor=\"let btnControl of buttonParamsControls; let i = index\"\r\n [formGroupName]=\"i\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Button {{ i + 1 }}</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"payload\"\r\n [placeholder]=\"'Parameter ' + (i + 1)\"\r\n maxlength=\"256\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"isHaveTemplateParam\" class=\"d-flex justify-content-end\">\r\n <mat-checkbox\r\n labelPosition=\"before\"\r\n formControlName=\"isUpload\"\r\n (change)=\"updateDownloadCSV($event.checked)\"\r\n >\r\n Using Download XLSX\r\n </mat-checkbox>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!form.get('isUpload')?.value\">\r\n <div\r\n *ngIf=\"form.get('template')?.value?.category === 'AUTHENTICATION'\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label> OTP Value </mat-label>\r\n\r\n <input matInput type=\"text\" formControlName=\"otpValue\" />\r\n </mat-form-field>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getParamHeader?.length > 0\">\r\n <p class=\"font-16px font-PoppinsBold\">Header Parameter</p>\r\n\r\n <div\r\n *ngFor=\"let param of getParamHeader; let paramHeaderIndex = index\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramHeaderIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramHeaderIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getParamBody?.length > 0\">\r\n <p class=\"font-16px font-PoppinsBold mt-3\">Body Parameter</p>\r\n\r\n <div\r\n *ngFor=\"let param of getParamBody; let paramBodyIndex = index\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramBodyIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramBodyIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"isShowParameter\">\r\n <p class=\"font-16px font-PoppinsBold mt-3\">Button Parameter</p>\r\n\r\n <ng-container *ngFor=\"let button of getButton; let buttonIndex = index\">\r\n <ng-container *ngIf=\"getParamButton(buttonIndex)?.length > 0\">\r\n <p class=\"font-14px font-PoppinsBold mt-3\">Button {{ buttonIndex + 1 }}</p>\r\n\r\n <div\r\n *ngFor=\"\r\n let param of getParamButton(buttonIndex);\r\n let paramIndex = index\r\n \"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container\r\n *ngIf=\"\r\n ['image', 'video', 'document'].includes(\r\n form.get('template')?.value?.header?.type?.toLowerCase()\r\n )\r\n \"\r\n >\r\n <p class=\"font-16px font-PoppinsBold mt-3\">File</p>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">File</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n (click)=\"filePicker.click()\"\r\n formControlName=\"fileName\"\r\n />\r\n\r\n <button\r\n mat-button\r\n matSuffix\r\n mat-icon-button\r\n aria-label=\"Choose File\"\r\n (click)=\"filePicker.click()\"\r\n >\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n\r\n <input\r\n #filePicker\r\n hidden\r\n type=\"file\"\r\n [accept]=\"extFileAccepted\"\r\n (change)=\"onFileSelected($event)\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsCatalogue\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">Category</mat-label>\r\n\r\n <mat-select formControlName=\"category\" placeholder=\"Select category\">\r\n <mat-option *ngFor=\"let option of categoryOption\" [value]=\"option.value\">\r\n {{ option.label }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.category\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('category')?.touched &&\r\n form.get('category')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">Catalog</mat-label>\r\n\r\n <mat-select formControlName=\"catalogue\" placeholder=\"Select catalog\">\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.catalogue\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('catalogue')?.touched &&\r\n form.get('catalogue')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"form.get('category')?.value === 'product'\"\r\n style=\"padding: 8px; border-radius: 8px; border: 1px solid #6177c4\"\r\n >\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Product</mat-label>\r\n\r\n <mat-select formControlName=\"product\" placeholder=\"Select product\">\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.product\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('product')?.touched &&\r\n form.get('product')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Body</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n maxlength=\"100\"\r\n formControlName=\"body\"\r\n placeholder=\"Enter body\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsUtility\">\r\n <div style=\"display: grid; gap: 0.5rem\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n <mat-radio-group\r\n style=\"display: flex; gap: 0.5rem; flex-wrap: wrap\"\r\n formControlName=\"isUseExistingTemplate\"\r\n (change)=\"handleChangeTemplate($event.value)\"\r\n >\r\n <mat-radio-button\r\n [value]=\"option.value\"\r\n *ngFor=\"let option of templates\"\r\n color=\"primary\"\r\n >\r\n {{ option.label }}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n (selectionChange)=\"handleChangeFrom($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!form.get('isUseExistingTemplate')?.value; else existingTmpl\">\r\n <ng-container *ngTemplateOutlet=\"stageAlertTmpl\"></ng-container>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label class=\"asterix--after\">Body</mat-label>\r\n\r\n <textarea\r\n matInput\r\n rows=\"6\"\r\n cols=\"50\"\r\n cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"2\"\r\n cdkAutosizeMaxRows=\"15\"\r\n formControlName=\"text\"\r\n placeholder=\"Enter text\"\r\n #autosize=\"cdkTextareaAutosize\"\r\n ></textarea>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.text\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('text').touched && form.get('text').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <app-input\r\n type=\"numeric\"\r\n formControlName=\"ttl\"\r\n label=\"TTL\"\r\n placeholder=\"Enter ttl\"\r\n [trimLeadingZeros]=\"true\"\r\n suffix=\"seconds\"\r\n hint=\"The default TTL is 30 days (2,592,000 seconds) if no value is provided.\"\r\n ></app-input>\r\n </div>\r\n\r\n <div *ngIf=\"!isReadOnlyMode\">\r\n <mat-checkbox formControlName=\"isNeedSave\">\r\n Save this message as future template\r\n </mat-checkbox>\r\n </div>\r\n <div class=\"template-container mt-5\" *ngIf=\"!form.get('isDownloadVariableXLS')?.value\">\r\n <div class=\"add-variable-wrapper\">\r\n <button mat-button class=\"btn-add-variable\" (click)=\"addVariable()\">\r\n <mat-icon class=\"icon-small\">add</mat-icon> Add Variable\r\n </button>\r\n </div>\r\n\r\n <div class=\"body-content-wrapper\">\r\n <h3 class=\"body-content-title\">Body Content</h3>\r\n <p class=\"body-content-subtitle\">\r\n Input the parameter to show during the preview. You can use predefined\r\n variable, drag and drop to text field below\r\n </p>\r\n <div class=\"predefined-variable-wrapper\">\r\n <span class=\"btn-predefined\">\r\n <mat-icon class=\"icon-small\">attach_money</mat-icon>\r\n Unsubscribe Account\r\n </span>\r\n </div>\r\n <div class=\"variables-list\" formArrayName=\"variables\">\r\n <div\r\n class=\"variable-row d-flex align-items-start mb-3\"\r\n *ngFor=\"let variable of variables.controls; let i = index\"\r\n [formGroupName]=\"i\"\r\n >\r\n <div class=\"variable-sequence mr-3\">\r\n {{ '{' + '{' + (i + 1) + '}' + '}' }}\r\n </div>\r\n <div class=\"variable-input-wrapper flex-grow-1\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n class=\"w-100 custom-variable-field\"\r\n >\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"paramName\"\r\n placeholder=\"e.g. Name, Verification code\"\r\n />\r\n </mat-form-field>\r\n\r\n <ng-container\r\n *ngFor=\"let validation of validationMessages?.paramName\"\r\n >\r\n <div\r\n class=\"custom-error-text text-right\"\r\n *ngIf=\"\r\n variable.get('paramName')?.hasError(validation.type) &&\r\n (variable.get('paramName')?.touched ||\r\n variable.get('paramName')?.dirty)\r\n \"\r\n >\r\n <span class=\"font-12px m-0\">{{ validation.message }}</span>\r\n </div>\r\n </ng-container>\r\n </div>\r\n\r\n <button\r\n type=\"button\"\r\n class=\"btn-delete ml-3\"\r\n (click)=\"removeVariable(i)\"\r\n >\r\n <mat-icon color=\"warn\">delete_outline</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"d-flex justify-content-end\">\r\n <mat-checkbox\r\n labelPosition=\"before\"\r\n formControlName=\"isDownloadVariableXLS\"\r\n (change)=\"updateVariableDownloadXLS($event.checked)\"\r\n >\r\n Using Download XLSX\r\n </mat-checkbox>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-template #existingTmpl>\r\n <ng-container *ngTemplateOutlet=\"stageAlertTmpl\"></ng-container>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"template\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n (selectionChange)=\"updateTemplate($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('template').value?.name\"\r\n (searchRes)=\"updateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.template\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('template')?.touched &&\r\n form.get('template')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <app-input\r\n type=\"numeric\"\r\n formControlName=\"ttl\"\r\n label=\"TTL\"\r\n placeholder=\"Enter ttl\"\r\n [trimLeadingZeros]=\"true\"\r\n suffix=\"Seconds\"\r\n hint=\"The default TTL is 30 days (2,592,000 seconds) if no value is provided.\"\r\n ></app-input>\r\n </div>\r\n <div\r\n class=\"template-container mt-5\"\r\n *ngIf=\"!form.get('isDownloadVariableXLS')?.value\"\r\n formArrayName=\"variables\"\r\n >\r\n <div class=\"font-bold mb-3\">Variables</div>\r\n\r\n <div class=\"form-group mb-3\" [formGroupName]=\"0\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100 custom-variable-field\"\r\n >\r\n <mat-label>{{ '{' + '{' + 1 + '}' + '}' }}</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"paramName\"\r\n placeholder=\"Name\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"form-group mb-3\" [formGroupName]=\"1\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100 custom-variable-field\"\r\n >\r\n <mat-label>{{ '{' + '{' + 2 + '}' + '}' }}</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"paramName\"\r\n placeholder=\"Verification code\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"d-flex justify-content-end\">\r\n <mat-checkbox\r\n labelPosition=\"before\"\r\n formControlName=\"isDownloadVariableXLS\"\r\n (change)=\"updateVariableDownloadXLS($event.checked)\"\r\n >\r\n Using Download XLSX\r\n </mat-checkbox>\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n</form>\r\n\r\n<ng-template #stageAlertTmpl>\r\n <div\r\n role=\"alert\"\r\n class=\"alert alert-warning d-flex align-items-center\"\r\n style=\"margin-top: 8px; border: 1px solid rgb(243, 124, 44)\"\r\n *ngIf=\"form.get('from')?.value && form.get('from')?.value?.directSendRestrictionStage > 0\"\r\n >\r\n <mat-icon style=\"margin-right: 10px !important\">error_outline</mat-icon>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 1\">\r\n Direct Send misuse detected. Please review your messaging practices.\r\n </div>\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 2\">\r\n Direct Send access restricted for 7 days due to continued misuse.\r\n </div>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 3\">\r\n Direct Send access restricted for 30 days due to continued misuse. Final warning before\r\n permanent revocation.\r\n </div>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 4\">\r\n Direct Send access has been permanently revoked.\r\n </div>\r\n </div>\r\n</ng-template>\r\n",
4908
+ styles: [".asterix--after:after{content:\"*\";color:red}.template-container{background-color:#fff;border-radius:.5rem;width:100%;max-width:56rem;box-sizing:border-box}.template-container .variable-wapper{margin-bottom:.5rem;display:flex;align-items:center}.template-container .add-variable-wrapper{display:flex;align-items:center;justify-content:flex-end;margin-bottom:.5rem}.template-container .add-variable-wrapper .btn-add-variable{color:#3b82f6!important}.template-container .body-content-wrapper{background-color:#d1e4fd;border-radius:.5rem;padding:1.5rem;margin-bottom:.5rem}.template-container .body-content-wrapper .body-content-title{color:#1e293b;font-size:1.125rem;font-weight:700;margin:0 0 .5rem}.template-container .body-content-wrapper .body-content-subtitle{color:#6b7280;font-size:.875rem;margin:0 0 1.25rem}.template-container .body-content-wrapper .predefined-variable-wrapper{margin-bottom:1.5rem}.template-container .body-content-wrapper .predefined-variable-wrapper .btn-predefined{display:inline-flex;align-items:center;background-color:#22c55e;color:#fff;font-size:.75rem;font-weight:600;padding:.375rem .75rem;border-radius:9999px;cursor:grab;transition:background-color .2s}.template-container .body-content-wrapper .predefined-variable-wrapper .btn-predefined:hover{background-color:#16a34a}.template-container .body-content-wrapper .predefined-variable-wrapper .btn-predefined .icon-small{font-size:16px;width:16px;height:16px;margin-right:.25rem;line-height:16px}.template-container .body-content-wrapper .custom-variable-field ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important;margin-bottom:0!important}.template-container .body-content-wrapper .custom-variable-field ::ng-deep .mat-form-field-outline{background-color:#fff!important;border-radius:5px}.template-container .body-content-wrapper .custom-variable-field ::ng-deep .mat-form-field-flex{background-color:transparent!important}.template-container .body-content-wrapper .custom-variable-field ::ng-deep input.mat-input-element{margin-top:-8px!important}.template-container .body-content-wrapper .custom-error-text{color:#f44336;margin-top:4px;padding-right:12px}.template-container .body-content-wrapper .variable-sequence{background-color:#fff;border:1px solid #e2e8f0;color:#4b5563;border-radius:5px;font-weight:500;min-width:3.5rem;text-align:center;height:51px;display:flex;align-items:center;justify-content:center;margin-top:4px}.template-container .body-content-wrapper .btn-delete{background:0 0;border:none;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;height:51px;margin-top:4px;transition:transform .2s}.template-container .body-content-wrapper .btn-delete:hover{transform:scale(1.1)}.template-container .checkbox-wrapper{display:flex;justify-content:flex-end;margin-top:.5rem}.template-container .checkbox-wrapper .checkbox-xlsx{font-size:.875rem;font-weight:500;color:#374151}"]
4789
4909
  })
4790
4910
  ], GeneralInformationWAComponent);
4791
4911
  return GeneralInformationWAComponent;
@@ -5215,10 +5335,7 @@ var GeneralInformationComponent = /** @class */ (function () {
5215
5335
  var _this = this;
5216
5336
  this.form = new FormGroup({
5217
5337
  id: new FormControl(null),
5218
- campaignName: new FormControl(null, [
5219
- Validators$1.required,
5220
- Validators$1.maxLength(100),
5221
- ]),
5338
+ campaignName: new FormControl(null, [Validators$1.required, Validators$1.maxLength(100)]),
5222
5339
  medium: new FormControl(null, [Validators$1.required]),
5223
5340
  });
5224
5341
  this.form.valueChanges.subscribe(function () {
@@ -5242,12 +5359,8 @@ var GeneralInformationComponent = /** @class */ (function () {
5242
5359
  if (Object.entries(campaign).length === 0)
5243
5360
  return;
5244
5361
  this.form.get('id').setValue((_b = (_a = campaign) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.id);
5245
- this.form
5246
- .get('campaignName')
5247
- .setValue((_d = (_c = campaign) === null || _c === void 0 ? void 0 : _c.generalInformation) === null || _d === void 0 ? void 0 : _d.form.campaignName);
5248
- this.form
5249
- .get('medium')
5250
- .setValue((_f = (_e = campaign) === null || _e === void 0 ? void 0 : _e.generalInformation) === null || _f === void 0 ? void 0 : _f.form.medium);
5362
+ this.form.get('campaignName').setValue((_d = (_c = campaign) === null || _c === void 0 ? void 0 : _c.generalInformation) === null || _d === void 0 ? void 0 : _d.form.campaignName);
5363
+ this.form.get('medium').setValue((_f = (_e = campaign) === null || _e === void 0 ? void 0 : _e.generalInformation) === null || _f === void 0 ? void 0 : _f.form.medium);
5251
5364
  };
5252
5365
  GeneralInformationComponent.prototype.initDisable = function () {
5253
5366
  if (!this.isReadOnlyMode) {
@@ -5256,6 +5369,7 @@ var GeneralInformationComponent = /** @class */ (function () {
5256
5369
  this.form.disable();
5257
5370
  };
5258
5371
  GeneralInformationComponent.prototype.updateGeneralInformationForm = function (form) {
5372
+ console.log(form, 'form');
5259
5373
  this.generalInformationForm = form;
5260
5374
  this.isShowMore = false;
5261
5375
  this.generalInformation.emit({
@@ -5378,7 +5492,7 @@ var GeneralInformationComponent = /** @class */ (function () {
5378
5492
  Component({
5379
5493
  selector: 'lib-new-campaign-general-information',
5380
5494
  template: "<form autocomplete=\"off\" [formGroup]=\"form\">\r\n <div class=\"campaign-info\">\r\n <div class=\"campaign-info-child\">\r\n <mat-card>\r\n <mat-card-content>\r\n <h3 class=\"font-22px font-PoppinsBold mb-4\">General Information</h3>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Broadcast Name</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"campaignName\"\r\n placeholder=\"Enter Broadcast name\"\r\n />\r\n </mat-form-field>\r\n\r\n <div class=\"d-flex justify-content-between align-items-center w-100\">\r\n <mat-hint align=\"start\">\r\n {{ form.get('campaignName').value?.length || 0 }}/100\r\n </mat-hint>\r\n\r\n <div>\r\n <mat-error\r\n align=\"end\"\r\n *ngFor=\"let validation of validationMessages.campaignName\"\r\n >\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('campaignName').touched &&\r\n form.get('campaignName').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Channel</mat-label>\r\n\r\n <mat-select placeholder=\"Select channel\" formControlName=\"medium\">\r\n <mat-option\r\n *ngFor=\"let option of channelOption\"\r\n [value]=\"option.value\"\r\n >\r\n {{ option.label }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.medium\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('medium').touched &&\r\n form.get('medium').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'WA'\">\r\n <lib-general-information-wa\r\n [isTouchedForm]=\"isTouchedWAForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-wa>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'LINE'\">\r\n <lib-general-information-line\r\n [isTouchedForm]=\"isTouchedSMSForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-line>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'SMS'\">\r\n <lib-general-information-sms\r\n [isTouchedForm]=\"isTouchedSMSForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-sms>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'EMAIL'\">\r\n <lib-general-information-email\r\n [isTouchedForm]=\"isTouchedEmailForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-email>\r\n </ng-container>\r\n </mat-card-content>\r\n </mat-card>\r\n </div>\r\n\r\n <div class=\"campaign-info-child pl-20px\">\r\n <h3 class=\"font-22px font-PoppinsBold\">Broadcast Content</h3>\r\n\r\n <div\r\n [ngClass]=\"\r\n form.get('medium').value === 'SMS' || form.get('medium').value === 'EMAIL'\r\n ? 'campaign-border-preview'\r\n : 'campaign-preview'\r\n \"\r\n >\r\n <section\r\n *ngIf=\"\r\n form.get('medium').value === 'SMS' || form.get('medium').value === 'EMAIL'\r\n \"\r\n >\r\n <p\r\n *ngIf=\"getBody\"\r\n class=\"body my-2\"\r\n style=\"max-width: 500px; word-wrap: break-word\"\r\n [innerHTML]=\"getBody\"\r\n ></p>\r\n </section>\r\n\r\n <section *ngIf=\"form.get('medium').value === 'WA'\" class=\"campaign-preview__wa\">\r\n <div class=\"header-preview\">\r\n <div class=\"heading\">\r\n {{ getHeader }}\r\n </div>\r\n </div>\r\n <div class=\"body-preview\">\r\n <section *ngIf=\"getBody || getMedia || displayFile\">\r\n <div\r\n class=\"chat\"\r\n [ngClass]=\"{ 'no-bottom-border': getTemplate?.buttons?.length > 0 }\"\r\n >\r\n <img\r\n *ngIf=\"\r\n (getMedia === 'IMAGE' ||\r\n getTemplate?.header?.type?.toLowerCase() === 'image') &&\r\n displayFile\r\n \"\r\n style=\"max-width: 100%\"\r\n alt=\"image\"\r\n [src]=\"displayFile\"\r\n />\r\n\r\n <video\r\n *ngIf=\"\r\n (getMedia === 'VIDEO' ||\r\n getTemplate?.header?.type?.toLowerCase() === 'video') &&\r\n displayFile\r\n \"\r\n id=\"video\"\r\n style=\"width: 100%\"\r\n [src]=\"displayFile\"\r\n controls\r\n ></video>\r\n\r\n <div *ngIf=\"getMedia === 'DOCUMENT'\" style=\"display: flex\">\r\n <img\r\n style=\"width: 13px; height: 18px\"\r\n alt=\"document\"\r\n src=\"../../../../../assets/images/icon-file.png\"\r\n />\r\n\r\n <span style=\"margin-left: 10px\">Document</span>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getMedia === 'LOCATION'\">\r\n <agm-map\r\n style=\"width: 100%; height: 200px\"\r\n [disableDefaultUI]=\"true\"\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [zoom]=\"maps.zoom\"\r\n >\r\n <agm-marker\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [markerDraggable]=\"false\"\r\n ></agm-marker>\r\n </agm-map>\r\n <a\r\n [href]=\"\r\n 'https://www.google.com/maps/search/?api=1&query=' +\r\n maps.latitude +\r\n ',' +\r\n maps.longitude\r\n \"\r\n >\r\n https://www.google.com/maps/search/?api=1&query={{\r\n maps.latitude\r\n }},{{ maps.longitude }}\r\n </a>\r\n </ng-container>\r\n\r\n <p *ngIf=\"getBody\" class=\"body my-2\" [innerHTML]=\"getBody\"></p>\r\n\r\n <p\r\n *ngIf=\"getTemplate?.footer\"\r\n class=\"mb-2\"\r\n style=\"color: rgb(160, 160, 160)\"\r\n >\r\n {{ getTemplate.footer }}\r\n </p>\r\n </div>\r\n </section>\r\n <section *ngIf=\"getTemplate?.buttons?.length > 0\">\r\n <div\r\n *ngFor=\"let button of getTemplateButton\"\r\n class=\"params-btn pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text || button?.type }}\r\n </p>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"getTemplate?.buttons?.length > 3\"\r\n class=\"params-btn pb-0 pointer\"\r\n (click)=\"isShowMore = !isShowMore\"\r\n >\r\n <p class=\"mb-0\"><mat-icon>list</mat-icon> See all options</p>\r\n </div>\r\n </section>\r\n </div>\r\n </section>\r\n\r\n <section *ngIf=\"form.get('medium').value === 'LINE'\" class=\"campaign-preview__line\">\r\n <div class=\"header-preview\">\r\n <div class=\"heading\">\r\n {{ getHeader }}\r\n </div>\r\n </div>\r\n <div class=\"body-preview\">\r\n <!-- Template Line Text -->\r\n <section *ngIf=\"isText || !isJSON\" class=\"chat\">\r\n <p class=\"body my-2\" [innerHTML]=\"getBody\"></p>\r\n </section>\r\n\r\n <!-- Template Line Button | Confirmation -->\r\n <section\r\n *ngIf=\"['buttons', 'confirm'].includes(getTemplateLine?.type)\"\r\n class=\"chat\"\r\n [ngClass]=\"{ 'no-bottom-border': getTemplateLine?.actions?.length > 0 }\"\r\n >\r\n <img\r\n *ngIf=\"getTemplateLine?.thumbnailImageUrl\"\r\n style=\"max-width: 100%\"\r\n class=\"mb-1\"\r\n [src]=\"getTemplateLine?.thumbnailImageUrl\"\r\n />\r\n\r\n <p\r\n *ngIf=\"getTemplateLine?.title\"\r\n class=\"font-PoppinsBold mb-1\"\r\n [innerHTML]=\"getTemplateLine?.title\"\r\n ></p>\r\n\r\n <p\r\n *ngIf=\"getTemplateLine?.text\"\r\n class=\"mb-0\"\r\n [innerHTML]=\"getTemplateLine?.text\"\r\n ></p>\r\n </section>\r\n\r\n <!-- Template Line Carousel -->\r\n <div\r\n *ngIf=\"['carousel'].includes(getTemplateLine?.type)\"\r\n class=\"d-flex gap-2 overflow-auto\"\r\n >\r\n <div *ngFor=\"let column of getTemplateLine?.columns\">\r\n <section\r\n class=\"chat w-100\"\r\n [ngClass]=\"{ 'no-bottom-border': column?.actions?.length > 0 }\"\r\n >\r\n <img\r\n *ngIf=\"column.thumbnailImageUrl\"\r\n style=\"max-width: 100%\"\r\n class=\"mb-1\"\r\n [src]=\"column.thumbnailImageUrl\"\r\n />\r\n\r\n <p\r\n *ngIf=\"column.title\"\r\n class=\"font-PoppinsBold mb-1\"\r\n [innerHTML]=\"column.title\"\r\n ></p>\r\n\r\n <p\r\n *ngIf=\"column.text\"\r\n class=\"mb-0\"\r\n [innerHTML]=\"column.text\"\r\n ></p>\r\n </section>\r\n <section *ngIf=\"column?.actions?.length > 0\">\r\n <div\r\n *ngFor=\"let button of column?.actions\"\r\n class=\"params-btn mw-100 pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text }}\r\n </p>\r\n </div>\r\n </section>\r\n </div>\r\n </div>\r\n\r\n <!-- Template Line Image Carousel -->\r\n <div\r\n *ngIf=\"['image_carousel'].includes(getTemplateLine?.type)\"\r\n class=\"d-flex gap-2 overflow-auto\"\r\n >\r\n <div *ngFor=\"let column of getTemplateLine?.columns\">\r\n <div class=\"image-container\">\r\n <img [src]=\"column.imageUrl\" alt=\"image\" />\r\n\r\n <div class=\"d-flex justify-content-center\">\r\n <p class=\"font-13px overlay-text\">\r\n {{ column.action.label }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Button Line -->\r\n <section\r\n *ngIf=\"\r\n getTemplateLine?.type !== 'confirm' &&\r\n getTemplateLine?.actions?.length > 0\r\n \"\r\n >\r\n <div\r\n *ngFor=\"let button of getTemplateLine?.actions\"\r\n class=\"params-btn pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text }}\r\n </p>\r\n </div>\r\n </section>\r\n <section\r\n *ngIf=\"\r\n getTemplateLine?.type === 'confirm' &&\r\n getTemplateLine?.actions?.length > 0\r\n \"\r\n class=\"d-flex justify-content-around mw-70 bg-white\"\r\n >\r\n <div\r\n *ngFor=\"let button of getTemplateLine?.actions\"\r\n class=\"params-btn flex pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text }}\r\n </p>\r\n </div>\r\n </section>\r\n <!-- ./ Button Line -->\r\n </div>\r\n </section>\r\n </div>\r\n\r\n <div class=\"d-flex\" style=\"flex-direction: column\">\r\n <span\r\n *ngIf=\"form.get('medium').value === 'SMS'\"\r\n style=\"text-align: right; width: 100%\"\r\n >\r\n {{ twilioResultCounter.fulltext }}\r\n </span>\r\n <span\r\n style=\"text-align: right; width: 100%; color: red\"\r\n *ngIf=\"twilioResultCounter.segments > 10 && form.get('medium').value === 'SMS'\"\r\n >\r\n Maximum Segment is 10\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n\r\n<ng-template #isSpinner>\r\n <div class=\"text-center my-auto\">\r\n <img src=\"../../../../../assets/images/spinner.svg\" />\r\n </div>\r\n</ng-template>\r\n",
5381
- styles: [".campaign-info{display:flex}.campaign-info-child{flex:1}.campaign-info .asterix--after:after{content:\"*\";color:red}.campaign-info .pl-20px{padding-left:20px}.campaign-info .mw-70{max-width:70%}.campaign-info .campaign-preview{width:75%}.campaign-info .campaign-preview .header-preview{padding:15px;min-height:60px;border-radius:10px 10px 0 0}.campaign-info .campaign-preview .header-preview .heading{width:100%;color:#e0e0e0;margin-left:5px;font-size:20px}.campaign-info .campaign-preview .body-preview{padding:15px;min-height:470px}.campaign-info .campaign-preview .body-preview .chat{width:70%;padding:11px;font-size:14px;line-height:22px;color:#494949;border-radius:8px;background:#fff;overflow-wrap:break-word;white-space:pre-line;box-shadow:12px 12px 20px rgba(44,59,113,.04)}.campaign-info .campaign-preview .body-preview .chat .body{max-height:400px;overflow-y:auto;overscroll-behavior-y:contain}.campaign-info .campaign-preview .body-preview .chat.no-bottom-border{border-bottom-left-radius:0;border-bottom-right-radius:0}.campaign-info .campaign-preview__wa .header-preview{background:#065f54}.campaign-info .campaign-preview__wa .body-preview{border-bottom-left-radius:8px;border-bottom-right-radius:8px;background-image:url(../../../../../assets/svg/whatsapp-bg.svg);background-position:center;background-repeat:no-repeat;background-size:cover}.campaign-info .campaign-preview__wa .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__wa .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .header-preview{background:#273046}.campaign-info .campaign-preview__line .body-preview{background:#7692bf;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.campaign-info .campaign-preview__line .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__line .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .body-preview .image-container{position:relative;width:200px;height:200px}.campaign-info .campaign-preview__line .body-preview .image-container img{display:block;width:100%;height:100%}.campaign-info .campaign-preview__line .body-preview .image-container .overlay-text{top:170px;position:absolute;padding:2px 5px;color:#fff;background-color:rgba(49,57,60,.62);border-radius:10px}.campaign-info .campaign-border-preview{width:100%;min-height:100px;padding:32px;border:1px solid #e2e2e2;border-radius:8px}"]
5495
+ styles: [".campaign-info{display:flex}.campaign-info-child{flex:1}.campaign-info .asterix--after:after{content:\"*\";color:red}.campaign-info .pl-20px{padding-left:20px}.campaign-info .mw-70{max-width:70%}.campaign-info .campaign-preview{width:75%}.campaign-info .campaign-preview .header-preview{padding:15px;min-height:60px;border-radius:10px 10px 0 0}.campaign-info .campaign-preview .header-preview .heading{width:100%;color:#e0e0e0;margin-left:5px;font-size:20px}.campaign-info .campaign-preview .body-preview{padding:15px;min-height:470px}.campaign-info .campaign-preview .body-preview .chat{width:70%;padding:11px;font-size:14px;line-height:22px;color:#494949;border-radius:8px;background:#fff;overflow-wrap:break-word;white-space:pre-line;box-shadow:12px 12px 20px rgba(44,59,113,.04)}.campaign-info .campaign-preview .body-preview .chat .body{max-height:400px;overflow-y:auto;overscroll-behavior-y:contain}.campaign-info .campaign-preview .body-preview .chat.no-bottom-border{border-bottom-left-radius:0;border-bottom-right-radius:0}.campaign-info .campaign-preview__wa .header-preview{background:#065f54}.campaign-info .campaign-preview__wa .body-preview{border-bottom-left-radius:8px;border-bottom-right-radius:8px;background-image:url(../../../../assets/svg/whatsapp-bg.svg);background-position:center;background-repeat:no-repeat;background-size:cover}.campaign-info .campaign-preview__wa .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__wa .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .header-preview{background:#273046}.campaign-info .campaign-preview__line .body-preview{background:#7692bf;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.campaign-info .campaign-preview__line .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__line .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .body-preview .image-container{position:relative;width:200px;height:200px}.campaign-info .campaign-preview__line .body-preview .image-container img{display:block;width:100%;height:100%}.campaign-info .campaign-preview__line .body-preview .image-container .overlay-text{top:170px;position:absolute;padding:2px 5px;color:#fff;background-color:rgba(49,57,60,.62);border-radius:10px}.campaign-info .campaign-border-preview{width:100%;min-height:100px;padding:32px;border:1px solid #e2e2e2;border-radius:8px}"]
5382
5496
  })
5383
5497
  ], GeneralInformationComponent);
5384
5498
  return GeneralInformationComponent;
@@ -5421,20 +5535,12 @@ var NewNumberBasesComponent = /** @class */ (function () {
5421
5535
  this.table = new TableModel();
5422
5536
  this.table.labels = [
5423
5537
  'select',
5424
- 'Name',
5425
5538
  'Category',
5426
5539
  'No. Of Customer',
5427
5540
  'Created Date',
5428
5541
  'Updated Date',
5429
5542
  ];
5430
- this.table.columns = [
5431
- 'select',
5432
- 'name',
5433
- 'category',
5434
- 'totalMembers',
5435
- 'createdDate',
5436
- 'updatedDate',
5437
- ];
5543
+ this.table.columns = ['select', 'name', 'totalMembers', 'createdDate', 'updatedDate'];
5438
5544
  };
5439
5545
  Object.defineProperty(NewNumberBasesComponent.prototype, "getCampaignStorage", {
5440
5546
  get: function () {
@@ -5447,15 +5553,16 @@ var NewNumberBasesComponent = /** @class */ (function () {
5447
5553
  });
5448
5554
  NewNumberBasesComponent.prototype.initEdit = function () {
5449
5555
  var _this = this;
5450
- var _a, _b, _c, _d, _e, _f, _g, _h;
5556
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5451
5557
  if (Object.entries(this.getCampaignStorage).length === 0)
5452
5558
  return;
5453
- this.isShowUploadCSV = (_c = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form) === null || _c === void 0 ? void 0 : _c.isUpload;
5559
+ var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5560
+ this.isShowUploadCSV = ((_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isUpload) || ((_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.isDownloadVariableXLS);
5454
5561
  this.fileSelected = {
5455
- name: (_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.targetAudienceFile) === null || _e === void 0 ? void 0 : _e.name,
5456
- targetURL: (_g = (_f = this.getCampaignStorage) === null || _f === void 0 ? void 0 : _f.targetAudienceFile) === null || _g === void 0 ? void 0 : _g.targetURL,
5562
+ name: (_f = (_e = this.getCampaignStorage) === null || _e === void 0 ? void 0 : _e.targetAudienceFile) === null || _f === void 0 ? void 0 : _f.name,
5563
+ targetURL: (_h = (_g = this.getCampaignStorage) === null || _g === void 0 ? void 0 : _g.targetAudienceFile) === null || _h === void 0 ? void 0 : _h.targetURL,
5457
5564
  };
5458
- (_h = this.table.dataSource.data) === null || _h === void 0 ? void 0 : _h.forEach(function (each) {
5565
+ (_j = this.table.dataSource.data) === null || _j === void 0 ? void 0 : _j.forEach(function (each) {
5459
5566
  var _a, _b;
5460
5567
  if ((_b = (_a = _this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.targetAudience) === null || _b === void 0 ? void 0 : _b.includes(each.id))
5461
5568
  _this.onChecked(true, each);
@@ -5482,31 +5589,14 @@ var NewNumberBasesComponent = /** @class */ (function () {
5482
5589
  .executeApiRequest(parameterList, '/admin/category', 'GET')
5483
5590
  .subscribe(function (resp) {
5484
5591
  var _a;
5485
- var customerSegments = JSON.parse(localStorage.getItem('csegment') || '[]');
5486
- var getDate = function (item) {
5487
- return new Date(item.updatedDate || item.createdDate).getTime();
5488
- };
5489
- var data = (((_a = resp) === null || _a === void 0 ? void 0 : _a.data) || []).map(function (item) { return (__assign(__assign({}, item), { category: 'Customer Group' })); });
5490
- if (_this.categoryParam.pageNo === 1) {
5491
- customerSegments
5492
- .sort(function (a, b) { return getDate(b) - getDate(a); })
5493
- .forEach(function (segment) {
5494
- var index = data.findIndex(function (group) { return getDate(group) < getDate(segment); });
5495
- if (index === -1) {
5496
- return;
5497
- }
5498
- var groupId = data[index].id;
5499
- data[index] = __assign(__assign({}, segment), { id: groupId, totalMembers: segment.customerCount, updatedDate: segment.updatedDate || segment.createdDate, category: 'Customer Segment' });
5500
- });
5501
- }
5502
5592
  if (_this.isReadOnlyMode) {
5503
- _this.table.dataSource.data = data.filter(function (each) { var _a, _b; return (_b = (_a = _this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.targetAudience) === null || _b === void 0 ? void 0 : _b.includes(each.id); });
5593
+ _this.table.dataSource.data = (_a = resp.data) === null || _a === void 0 ? void 0 : _a.filter(function (each) { var _a, _b; return (_b = (_a = _this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.targetAudience) === null || _b === void 0 ? void 0 : _b.includes(each.id); });
5504
5594
  _this.categorySelected = _this.table.dataSource.data;
5505
5595
  _this.isLoading = false;
5506
5596
  _this.initEdit();
5507
5597
  return;
5508
5598
  }
5509
- _this.table.dataSource.data = data;
5599
+ _this.table.dataSource.data = resp.data;
5510
5600
  _this.table.setNextPage(resp.haveNext);
5511
5601
  _this.isLoading = false;
5512
5602
  _this.initEdit();
@@ -5641,13 +5731,31 @@ var NewNumberBasesComponent = /** @class */ (function () {
5641
5731
  return found ? true : false;
5642
5732
  };
5643
5733
  NewNumberBasesComponent.prototype.onDownloadSampleService = function () {
5644
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5734
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5735
+ var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5736
+ var isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
5645
5737
  var parameterList = [
5646
- this.initParam('platform', (_d = (_c = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.platform, 'string'),
5647
- this.initParam('templateName', (_h = (_g = (_f = (_e = this.getCampaignStorage) === null || _e === void 0 ? void 0 : _e.generalInformation) === null || _f === void 0 ? void 0 : _f.form) === null || _g === void 0 ? void 0 : _g.template) === null || _h === void 0 ? void 0 : _h.name, 'string'),
5648
- this.initParam('templateLang', (_m = (_l = (_k = (_j = this.getCampaignStorage) === null || _j === void 0 ? void 0 : _j.generalInformation) === null || _k === void 0 ? void 0 : _k.form) === null || _l === void 0 ? void 0 : _l.template) === null || _m === void 0 ? void 0 : _m.lang, 'string'),
5649
- this.initParam('category', (_p = (_o = this.categorySelected) === null || _o === void 0 ? void 0 : _o.map(function (t) { return t.id; }).join(), (_p !== null && _p !== void 0 ? _p : [])), 'string'),
5738
+ this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
5650
5739
  ];
5740
+ if (isNeedSave) {
5741
+ // SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
5742
+ parameterList.push(this.initParam('templateName', (_g = (_f = genInfoForm) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.name, 'string'), this.initParam('templateLang', (_j = (_h = genInfoForm) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.lang, 'string'), this.initParam('category', (_l = (_k = this.categorySelected) === null || _k === void 0 ? void 0 : _k.map(function (t) { return t.id; }).join(), (_l !== null && _l !== void 0 ? _l : '')), 'string'));
5743
+ }
5744
+ else {
5745
+ // SKENARIO 2: CREATE NEW (Belum disave, butuh text & examples)
5746
+ var safeBodyText = encodeURIComponent(((_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.text) || '');
5747
+ parameterList.push(this.initParam('bodyText', safeBodyText, 'string'));
5748
+ var variables = (_o = genInfoForm) === null || _o === void 0 ? void 0 : _o.variables;
5749
+ if (variables && Array.isArray(variables) && variables.length > 0) {
5750
+ var bodyExamplesString = variables.map(function (v) { return v.paramName; }).join(',');
5751
+ var safeBodyExamples = encodeURIComponent(bodyExamplesString);
5752
+ parameterList.push(this.initParam('bodyExamples', safeBodyExamples, 'string'));
5753
+ }
5754
+ if ((_r = (_q = (_p = genInfoForm) === null || _p === void 0 ? void 0 : _p.template) === null || _q === void 0 ? void 0 : _q.header) === null || _r === void 0 ? void 0 : _r.text) {
5755
+ var safeHeaderText = encodeURIComponent(genInfoForm.template.header.text);
5756
+ parameterList.push(this.initParam('headerText', safeHeaderText, 'string'));
5757
+ }
5758
+ }
5651
5759
  var subs = this.apiAdapterService
5652
5760
  .executeApiRequest(parameterList, '/message/bulkupload/template', 'GET', true)
5653
5761
  .subscribe(function (resp) {
@@ -5744,7 +5852,7 @@ var NewNumberBasesComponent = /** @class */ (function () {
5744
5852
  NewNumberBasesComponent = __decorate([
5745
5853
  Component({
5746
5854
  selector: 'lib-new-number-bases',
5747
- template: "<h3 class=\"font-20px font-PoppinsBold asterix--after mb-2\" [ngClass]=\"{ 'mb-3': !isReadOnlyMode }\">\r\n Target Audience\r\n</h3>\r\n<div *ngIf=\"!isReadOnlyMode\" class=\"d-flex justify-content-between\">\r\n <p>Select your target audience (category)</p>\r\n <div *ngIf=\"isShowUploadCSV\">\r\n <button\r\n mat-stroked-button\r\n color=\"primary-telin\"\r\n class=\"telin-font-color mr-2\"\r\n (click)=\"onDownloadSampleService()\"\r\n >\r\n Download Template\r\n </button>\r\n\r\n <button\r\n mat-flat-button\r\n color=\"primary-telin-blue2\"\r\n [disabled]=\"isUpload\"\r\n (click)=\"filePicker.click()\"\r\n >\r\n Upload XLSX\r\n </button>\r\n\r\n <input\r\n #filePicker\r\n hidden\r\n type=\"file\"\r\n [accept]=\"extFileAccepted.join()\"\r\n (change)=\"onFileSelected($event)\"\r\n />\r\n </div>\r\n</div>\r\n\r\n<p\r\n *ngIf=\"\r\n !isReadOnlyMode &&\r\n (getCampaignStorage?.targetAudienceFile?.name ||\r\n getCampaignStorage?.targetAudienceFile?.targetURL)\r\n \"\r\n class=\"text-right my-2\"\r\n>\r\n <span class=\"fw-bold\">Filename:</span>\r\n {{\r\n getCampaignStorage?.targetAudienceFile?.name ||\r\n getCampaignStorage?.targetAudienceFile?.targetURL\r\n }}\r\n</p>\r\n\r\n<div *ngIf=\"!isReadOnlyMode || !fileSelected?.name\" class=\"row align-items-center mb-3\">\r\n <div class=\"col-md-4 col-12\">\r\n <lib-search\r\n *ngIf=\"!isReadOnlyMode\"\r\n [placeholder]=\"'Search'\"\r\n (searchRes)=\"updateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n <div class=\"col-md-8 col-12\">\r\n <p class=\"text-right mb-0\">\r\n Category Selected:\r\n <span class=\"font-bold\">\r\n {{ categorySelected?.length || 0 }}\r\n </span>\r\n </p>\r\n </div>\r\n</div>\r\n\r\n<ng-container *ngIf=\"!isReadOnlyMode || !fileSelected?.name; else isShowFile\">\r\n <table\r\n *ngIf=\"!isLoading; else isSpinner\"\r\n mat-table\r\n matSort\r\n matSortDisableClear\r\n class=\"table w-100 mb-2\"\r\n [dataSource]=\"table.dataSource\"\r\n (matSortChange)=\"sort()\"\r\n >\r\n <ng-container matColumnDef=\"select\">\r\n <th *matHeaderCellDef>\r\n <ng-container *ngIf=\"!isReadOnlyMode\">\r\n <mat-checkbox\r\n [aria-label]=\"checkboxLabel()\"\r\n [checked]=\"selection.hasValue() && isAllSelected()\"\r\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\r\n (change)=\"masterToggle($event.checked)\"\r\n >\r\n </mat-checkbox>\r\n </ng-container>\r\n </th>\r\n <td *matCellDef=\"let row\">\r\n <ng-container *ngIf=\"!isReadOnlyMode\">\r\n <mat-checkbox\r\n [aria-label]=\"checkboxLabel(row)\"\r\n [checked]=\"isChecked(row)\"\r\n (change)=\"onChecked($event.checked, row)\"\r\n >\r\n </mat-checkbox>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container *ngFor=\"let index of [1, 2, 3, 4, 5]\" [matColumnDef]=\"table.columns[index]\">\r\n <th *matHeaderCellDef [mat-sort-header]=\"table.columns[index]\">\r\n {{ table.labels[index] }}\r\n </th>\r\n\r\n <td *matCellDef=\"let row\">\r\n <ng-container *ngIf=\"[1, 2, 3].includes(index)\">\r\n {{ row[table.columns[index]] }}\r\n </ng-container>\r\n <ng-container *ngIf=\"[4, 5].includes(index)\">\r\n {{ row[table.columns[index]] | date: ' d MMM y' }}\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"no-content\">\r\n <th class=\"text-center\" *matHeaderCellDef [colSpan]=\"table.columns.length\">\r\n Data Not Available\r\n </th>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"table.columns\"></tr>\r\n\r\n <tr\r\n mat-header-row\r\n class=\"no-content\"\r\n *matHeaderRowDef=\"['no-content']\"\r\n [style.display]=\"table.dataSource?.data?.length === 0 ? 'table-row' : 'none'\"\r\n ></tr>\r\n\r\n <tr mat-row *matRowDef=\"let row; columns: table.columns\"></tr>\r\n </table>\r\n\r\n <mat-paginator\r\n *ngIf=\"!isReadOnlyMode\"\r\n class=\"campaign-paginator\"\r\n [length]=\"table.totalData\"\r\n [pageSize]=\"table.pageSize\"\r\n [pageIndex]=\"table.getPageIndex()\"\r\n [pageSizeOptions]=\"[10, 25, 50, 100, 250]\"\r\n (page)=\"updatePage($event)\"\r\n ></mat-paginator>\r\n\r\n <ng-template #isSpinner>\r\n <div class=\"text-center my-auto\">\r\n <img src=\"../../../../../assets/images/spinner.svg\" />\r\n </div>\r\n </ng-template>\r\n</ng-container>\r\n\r\n<ng-template #isShowFile>\r\n <p class=\"font-PoppinsBold font-14px\">\r\n File: <a [href]=\"fileSelected?.targetURL\" target=\"_blank\">{{ fileSelected?.name }}</a>\r\n </p>\r\n</ng-template>\r\n",
5855
+ template: "<h3 class=\"font-20px font-PoppinsBold asterix--after mb-2\"\r\n\t[ngClass]=\"{ 'mb-3': !isReadOnlyMode }\">\r\n\tTarget Audience\r\n</h3>\r\n<div *ngIf=\"!isReadOnlyMode\"\r\n\tclass=\"d-flex justify-content-between\">\r\n\t<p>Select your target audience (category)</p>\r\n\t<div *ngIf=\"isShowUploadCSV\">\r\n\t\t<button mat-stroked-button\r\n\t\t\tcolor=\"primary-telin\"\r\n\t\t\tclass=\"telin-font-color mr-2\"\r\n\t\t\t(click)=\"onDownloadSampleService()\">\r\n\t\t\tDownload Template\r\n\t\t</button>\r\n\r\n\t\t<button mat-flat-button\r\n\t\t\tcolor=\"primary-telin-blue2\"\r\n\t\t\t[disabled]=\"isUpload\"\r\n\t\t\t(click)=\"filePicker.click()\">\r\n\t\t\tUpload XLSX\r\n\t\t</button>\r\n\r\n\t\t<input #filePicker\r\n\t\t\thidden\r\n\t\t\ttype=\"file\"\r\n\t\t\t[accept]=\"extFileAccepted.join()\"\r\n\t\t\t(change)=\"onFileSelected($event)\" />\r\n\t</div>\r\n</div>\r\n\r\n<p *ngIf=\"!isReadOnlyMode && (getCampaignStorage?.targetAudienceFile?.name ||\r\ngetCampaignStorage?.targetAudienceFile?.targetURL)\"\r\n\tclass=\"text-right my-2\">\r\n\t<span class=\"fw-bold\">Filename:</span> {{ getCampaignStorage?.targetAudienceFile?.name ||\r\n\tgetCampaignStorage?.targetAudienceFile?.targetURL }}\r\n</p>\r\n\r\n<div *ngIf=\"!isReadOnlyMode || !fileSelected?.name\"\r\n\tclass=\"row align-items-center mb-3\">\r\n\t<div class=\"col-md-4 col-12\">\r\n\t\t<lib-search *ngIf=\"!isReadOnlyMode\"\r\n\t\t\t[placeholder]=\"'Search'\"\r\n\t\t\t(searchRes)=\"updateSearch($event)\"></lib-search>\r\n\t</div>\r\n\t<div class=\"col-md-8 col-12\">\r\n\t\t<p class=\"text-right mb-0\">\r\n\t\t\tCategory Selected:\r\n\t\t\t<span class=\"font-bold\">\r\n\t\t\t\t{{ categorySelected?.length || 0 }}\r\n\t\t\t</span>\r\n\t\t</p>\r\n\t</div>\r\n</div>\r\n\r\n<ng-container *ngIf=\"!isReadOnlyMode || !fileSelected?.name; else isShowFile\">\r\n\t<table *ngIf=\"!isLoading; else isSpinner\"\r\n\t\tmat-table\r\n\t\tmatSort\r\n\t\tmatSortDisableClear\r\n\t\tclass=\"table w-100 mb-2\"\r\n\t\t[dataSource]=\"table.dataSource\"\r\n\t\t(matSortChange)=\"sort()\">\r\n\t\t<ng-container matColumnDef=\"select\">\r\n\t\t\t<th *matHeaderCellDef>\r\n\t\t\t\t<ng-container *ngIf=\"!isReadOnlyMode\">\r\n\t\t\t\t\t<mat-checkbox [aria-label]=\"checkboxLabel()\"\r\n\t\t\t\t\t\t[checked]=\"selection.hasValue() && isAllSelected()\"\r\n\t\t\t\t\t\t[indeterminate]=\"selection.hasValue() && !isAllSelected()\"\r\n\t\t\t\t\t\t(change)=\"masterToggle($event.checked)\">\r\n\t\t\t\t\t</mat-checkbox>\r\n\t\t\t\t</ng-container>\r\n\t\t\t</th>\r\n\t\t\t<td *matCellDef=\"let row\">\r\n\t\t\t\t<ng-container *ngIf=\"!isReadOnlyMode\">\r\n\t\t\t\t\t<mat-checkbox [aria-label]=\"checkboxLabel(row)\"\r\n\t\t\t\t\t\t[checked]=\"isChecked(row)\"\r\n\t\t\t\t\t\t(change)=\"onChecked($event.checked, row)\">\r\n\t\t\t\t\t</mat-checkbox>\r\n\t\t\t\t</ng-container>\r\n\t\t\t</td>\r\n\t\t</ng-container>\r\n\r\n\t\t<ng-container *ngFor=\"let index of [1, 2, 3, 4]\"\r\n\t\t\t[matColumnDef]=\"table.columns[index]\">\r\n\t\t\t<th *matHeaderCellDef\r\n\t\t\t\t[mat-sort-header]=\"table.columns[index]\">\r\n\t\t\t\t{{ table.labels[index] }}\r\n\t\t\t</th>\r\n\r\n\t\t\t<td *matCellDef=\"let row\">\r\n\t\t\t\t<ng-container *ngIf=\"[1, 2].includes(index)\">\r\n\t\t\t\t\t{{ row[table.columns[index]] }}\r\n\t\t\t\t</ng-container>\r\n\t\t\t\t<ng-container *ngIf=\"[3, 4].includes(index)\">\r\n\t\t\t\t\t{{ row[table.columns[index]] | date : ' d MMM y' }}\r\n\t\t\t\t</ng-container>\r\n\t\t\t</td>\r\n\t\t</ng-container>\r\n\r\n\t\t<ng-container matColumnDef=\"no-content\">\r\n\t\t\t<th class=\"text-center\"\r\n\t\t\t\t*matHeaderCellDef\r\n\t\t\t\t[colSpan]=\"table.columns.length\">\r\n\t\t\t\tData Not Available\r\n\t\t\t</th>\r\n\t\t</ng-container>\r\n\r\n\t\t<tr mat-header-row\r\n\t\t\t*matHeaderRowDef=\"table.columns\"></tr>\r\n\r\n\t\t<tr mat-header-row\r\n\t\t\tclass=\"no-content\"\r\n\t\t\t*matHeaderRowDef=\"['no-content']\"\r\n\t\t\t[style.display]=\"table.dataSource?.data?.length === 0 ? 'table-row' : 'none'\"></tr>\r\n\r\n\t\t<tr mat-row\r\n\t\t\t*matRowDef=\"let row; columns: table.columns\"></tr>\r\n\t</table>\r\n\r\n\t<mat-paginator *ngIf=\"!isReadOnlyMode\"\r\n\t\tclass=\"campaign-paginator\"\r\n\t\t[length]=\"table.totalData\"\r\n\t\t[pageSize]=\"table.pageSize\"\r\n\t\t[pageIndex]=\"table.getPageIndex()\"\r\n\t\t[pageSizeOptions]=\"[10, 25, 50, 100, 250]\"\r\n\t\t(page)=\"updatePage($event)\"></mat-paginator>\r\n\r\n\t<ng-template #isSpinner>\r\n\t\t<div class=\"text-center my-auto\">\r\n\t\t\t<img src=\"../../../../../assets/images/spinner.svg\" />\r\n\t\t</div>\r\n\t</ng-template>\r\n</ng-container>\r\n\r\n<ng-template #isShowFile>\r\n\t<p class=\"font-PoppinsBold font-14px\">\r\n\t\tFile: <a [href]=\"fileSelected?.targetURL\"\r\n\t\t\ttarget=\"_blank\">{{ fileSelected?.name }}</a>\r\n\t</p>\r\n</ng-template>\r\n",
5748
5856
  styles: ["::ng-deep .mat-paginator.campaign-paginator .mat-paginator-container{align-items:normal}::ng-deep .mat-paginator.campaign-paginator .mat-tab-body{background-color:#fff}::ng-deep .mat-paginator.campaign-paginator .mat-form-field-underline{bottom:0}"]
5749
5857
  })
5750
5858
  ], NewNumberBasesComponent);
@@ -6023,5 +6131,5 @@ var ConfirmationModule = /** @class */ (function () {
6023
6131
  * Generated bundle index. Do not edit.
6024
6132
  */
6025
6133
 
6026
- export { AdlCampaignManagementLibraryInternalComponent, AdlCampaignManagementLibraryInternalModule, CampaignIndexModule, CampaignManagementComponent, CampaignManagementModule, ConfirmationComponent, ConfirmationModule, DashboardModule, SearchModule, WizardComponent as ɵa, NewCampaignComponent as ɵb, GeneralInformationComponent as ɵc, SchedulerComponent as ɵd, SummaryComponent as ɵe, NewNumberBasesComponent as ɵf, GeneralInformationLineComponent as ɵg, GeneralInformationWAComponent as ɵh, GeneralInformationSMSComponent as ɵi, GeneralInformationEmailComponent as ɵj, PendingApprovalDialogViewComponent as ɵk, FailoverMechanismComponent as ɵl, DashboardComponent as ɵm, ApiAdapterServiceService as ɵn, SearchComponent as ɵo, ViewingListOfCampaignTableComponent as ɵp, FilterInListOfCampaignComponent as ɵq, CampaignIndexComponent as ɵr, ApiAdapterServiceService as ɵs, MatSelectInfiniteScrollDirective as ɵt, InputNumericModule as ɵu, InputNumericComponent as ɵv, CustomPaginator as ɵw, ConfirmationComponent as ɵx, ConfirmationModel as ɵy, SharedServicesService as ɵz };
6134
+ export { AdlCampaignManagementLibraryInternalComponent, AdlCampaignManagementLibraryInternalModule, CampaignIndexComponent, CampaignIndexModule, CampaignManagementComponent, CampaignManagementModule, ConfirmationComponent, ConfirmationModule, DashboardComponent, DashboardModule, MatSelectInfiniteScrollDirective, SearchComponent, SearchModule, SummaryComponent, WizardComponent as ɵa, NewCampaignComponent as ɵb, GeneralInformationComponent as ɵc, SchedulerComponent as ɵd, SummaryComponent as ɵe, NewNumberBasesComponent as ɵf, GeneralInformationLineComponent as ɵg, GeneralInformationWAComponent as ɵh, GeneralInformationSMSComponent as ɵi, GeneralInformationEmailComponent as ɵj, PendingApprovalDialogViewComponent as ɵk, FailoverMechanismComponent as ɵl, ApiAdapterServiceService as ɵm, ViewingListOfCampaignTableComponent as ɵn, FilterInListOfCampaignComponent as ɵo, ApiAdapterServiceService as ɵp, MatSelectInfiniteScrollDirective as ɵq, InputNumericModule as ɵr, InputNumericComponent as ɵs, CustomPaginator as ɵt, ConfirmationComponent as ɵu, ConfirmationModel as ɵv, SharedServicesService as ɵw };
6027
6135
  //# sourceMappingURL=adlfe-campaign-management-library.js.map