@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
@@ -446,13 +446,19 @@
446
446
  __decorate([
447
447
  core.Input()
448
448
  ], InputNumericComponent.prototype, "maxLength", void 0);
449
+ __decorate([
450
+ core.Input()
451
+ ], InputNumericComponent.prototype, "suffix", void 0);
452
+ __decorate([
453
+ core.Input()
454
+ ], InputNumericComponent.prototype, "hint", void 0);
449
455
  __decorate([
450
456
  core.ContentChild('suffix')
451
457
  ], InputNumericComponent.prototype, "suffixTmpl", void 0);
452
458
  InputNumericComponent = InputNumericComponent_1 = __decorate([
453
459
  core.Component({
454
460
  selector: 'app-input[type=numeric]',
455
- 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",
461
+ 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",
456
462
  providers: [
457
463
  {
458
464
  provide: forms.NG_VALUE_ACCESSOR,
@@ -1613,6 +1619,7 @@
1613
1619
  catalogue: [{ type: 'required', message: 'Catalog is required' }],
1614
1620
  product: [{ type: 'required', message: 'Product is required' }],
1615
1621
  body: [{ type: 'maxlength', message: 'Maximum character 100' }],
1622
+ paramName: [{ type: 'required', message: 'Variable Name is required' }],
1616
1623
  };
1617
1624
  var GeneralInformationEmailMessageValidationConst = {
1618
1625
  channel: [{ type: 'required', message: 'Message Type is required' }],
@@ -1906,7 +1913,7 @@
1906
1913
  core.Component({
1907
1914
  selector: 'lib-filter-in-list-of-campaign',
1908
1915
  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",
1909
- 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}"]
1916
+ 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}"]
1910
1917
  }),
1911
1918
  core.Injectable({
1912
1919
  providedIn: 'root',
@@ -2679,14 +2686,12 @@
2679
2686
  function GeneralInformationWAReqModel() {
2680
2687
  }
2681
2688
  GeneralInformationWAReqModel.prototype.clone = function (source) {
2682
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2683
- /* Source Mapping */
2689
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2684
2690
  if (((_a = source) === null || _a === void 0 ? void 0 : _a.media) === 'IMAGE' ||
2685
2691
  ((_b = source) === null || _b === void 0 ? void 0 : _b.media) === 'VIDEO' ||
2686
2692
  ((_c = source) === null || _c === void 0 ? void 0 : _c.media) === 'DOCUMENT') {
2687
2693
  source.channel = source.media;
2688
2694
  }
2689
- /* ./ Source Mapping */
2690
2695
  if (source.campaignName) {
2691
2696
  this.name = source.campaignName;
2692
2697
  }
@@ -2718,6 +2723,12 @@
2718
2723
  fileName: source.fileName,
2719
2724
  };
2720
2725
  }
2726
+ if (source.buttonParams && Array.isArray(source.buttonParams)) {
2727
+ this.buttonParams = source.buttonParams.map(function (btn) { return ({
2728
+ label: btn.label,
2729
+ payload: btn.payload ? btn.payload : btn.label,
2730
+ }); });
2731
+ }
2721
2732
  if (source.template) {
2722
2733
  this.template = {
2723
2734
  id: source.template.ID,
@@ -2725,12 +2736,21 @@
2725
2736
  lang: source.template.lang,
2726
2737
  headerUrl: source.targetURL,
2727
2738
  header: (_g = (_f = source.paramHeader) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.name; }), (_g !== null && _g !== void 0 ? _g : [])),
2728
- data: (_j = (_h = source.paramBody) === null || _h === void 0 ? void 0 : _h.map(function (t) { return t.name; }), (_j !== null && _j !== void 0 ? _j : [])),
2729
- button: (_k = source.paramButton) === null || _k === void 0 ? void 0 : _k.reduce(function (result, each) {
2739
+ data: ((_h = source.variables) === null || _h === void 0 ? void 0 : _h.length) ? source.variables.map(function (v) { return v.paramName; })
2740
+ : (_k = (_j = source.paramBody) === null || _j === void 0 ? void 0 : _j.map(function (t) { return t.name; }), (_k !== null && _k !== void 0 ? _k : [])),
2741
+ button: (_l = source.paramButton) === null || _l === void 0 ? void 0 : _l.reduce(function (result, each) {
2730
2742
  var _a;
2731
2743
  result.push((_a = each.name.map(function (t) { return t.name; }), (_a !== null && _a !== void 0 ? _a : [])));
2732
2744
  return result;
2733
2745
  }, []),
2746
+ buttonParams: source.buttonParams
2747
+ ? source.buttonParams.map(function (btn) {
2748
+ return {
2749
+ label: btn.label,
2750
+ payload: btn.payload ? btn.payload : btn.label,
2751
+ };
2752
+ })
2753
+ : [],
2734
2754
  };
2735
2755
  if (source.template.category === 'AUTHENTICATION')
2736
2756
  this.template = {
@@ -2739,6 +2759,7 @@
2739
2759
  header: null,
2740
2760
  data: [source.otpValue],
2741
2761
  button: [[source.otpValue]],
2762
+ buttonParams: [],
2742
2763
  };
2743
2764
  if (source.template.ID)
2744
2765
  this.template.id = source.template.ID;
@@ -2746,11 +2767,25 @@
2746
2767
  if (this.type === 'utility') {
2747
2768
  this.type = 'template';
2748
2769
  this.category = 'utility';
2749
- 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: [] };
2770
+ 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; })
2771
+ : [];
2772
+ if ((_p = source) === null || _p === void 0 ? void 0 : _p.isUseExistingTemplate) {
2773
+ this.template = __assign(__assign({}, source.template), { data: mappedVariables.length > 0 ? mappedVariables : source.template.data || [] });
2774
+ }
2775
+ else {
2776
+ this.template = {
2777
+ name: '',
2778
+ lang: 'id',
2779
+ header: null,
2780
+ button: null,
2781
+ data: mappedVariables,
2782
+ buttonParams: [],
2783
+ };
2784
+ }
2750
2785
  this.isNeedSave = source.isNeedSave;
2751
2786
  this.ttlSeconds = source.ttl;
2752
- if ((_o = source) === null || _o === void 0 ? void 0 : _o.isUseExistingTemplate) {
2753
- 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;
2787
+ if ((_q = source) === null || _q === void 0 ? void 0 : _q.isUseExistingTemplate) {
2788
+ 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);
2754
2789
  }
2755
2790
  }
2756
2791
  return this;
@@ -3022,14 +3057,23 @@
3022
3057
  configurable: true
3023
3058
  });
3024
3059
  NewCampaignComponent.prototype.saveGeneralInformationService = function () {
3060
+ return __awaiter(this, void 0, void 0, function () {
3061
+ var bodyReq, payloadValue;
3062
+ return __generator(this, function (_a) {
3063
+ if (!this.onCheckTwilioCounterValid()) {
3064
+ this.toastr.error('Segment cannot more than 10');
3065
+ this.isSubmit = false;
3066
+ return [2 /*return*/];
3067
+ }
3068
+ bodyReq = new GeneralInformationWAReqModel().clone(__assign({}, this.generalInformationData));
3069
+ payloadValue = bodyReq.convert();
3070
+ this.saveGeneralInformation(payloadValue);
3071
+ return [2 /*return*/];
3072
+ });
3073
+ });
3074
+ };
3075
+ NewCampaignComponent.prototype.saveGeneralInformation = function (payloadValue) {
3025
3076
  var _this = this;
3026
- if (!this.onCheckTwilioCounterValid()) {
3027
- this.toastr.error('Segment cannot more than 10');
3028
- this.isSubmit = false;
3029
- return;
3030
- }
3031
- var bodyReq = new GeneralInformationWAReqModel().clone(__assign({}, this.generalInformationData));
3032
- var payloadValue = bodyReq.convert();
3033
3077
  if (payloadValue.template && this.generalInformationData.template) {
3034
3078
  payloadValue.template.type =
3035
3079
  payloadValue.template.type || this.generalInformationData.template.category;
@@ -4253,7 +4297,6 @@
4253
4297
  { label: 'Create New', value: false },
4254
4298
  { label: 'Use existing template', value: true },
4255
4299
  ];
4256
- this.isUtility = true;
4257
4300
  this.isCheckUtility = false;
4258
4301
  this.updateGeneralInformationForm = new core.EventEmitter();
4259
4302
  }
@@ -4289,14 +4332,12 @@
4289
4332
  this.initValidation();
4290
4333
  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'
4291
4334
  ? (_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 : '');
4292
- this.listenBodyChange();
4293
4335
  /* this.setCurrentLocation(); */
4294
4336
  };
4295
4337
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getCampaignStorage", {
4296
4338
  get: function () {
4297
- return localStorage.getItem('telin.campaign')
4298
- ? JSON.parse(localStorage.getItem('telin.campaign'))
4299
- : {};
4339
+ var campaignData = localStorage.getItem('telin.campaign');
4340
+ return campaignData ? JSON.parse(campaignData) : {};
4300
4341
  },
4301
4342
  enumerable: true,
4302
4343
  configurable: true
@@ -4328,6 +4369,10 @@
4328
4369
  isUseExistingTemplate: new forms.FormControl(false),
4329
4370
  isNeedSave: new forms.FormControl(false),
4330
4371
  ttl: new forms.FormControl(null),
4372
+ isDownloadVariableXLS: new forms.FormControl(false),
4373
+ variables: new forms.FormArray([]),
4374
+ useXlsx: new forms.FormControl(false),
4375
+ buttonParams: new forms.FormArray([]),
4331
4376
  });
4332
4377
  this.form.valueChanges.subscribe(function () {
4333
4378
  setTimeout(function () {
@@ -4342,133 +4387,152 @@
4342
4387
  this.form.disable();
4343
4388
  };
4344
4389
  GeneralInformationWAComponent.prototype.initEdit = function () {
4345
- 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;
4346
- if (Object.entries(this.getCampaignStorage).length === 0 ||
4347
- ((_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')
4390
+ var _this = this;
4391
+ 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;
4392
+ var storageData = this.getCampaignStorage;
4393
+ var formValues = (_b = (_a = storageData) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
4394
+ if (!storageData ||
4395
+ Object.entries(storageData).length === 0 ||
4396
+ ((_c = formValues) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA') {
4348
4397
  return;
4349
- this.form
4350
- .get('channel')
4351
- .setValue((_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.generalInformation) === null || _e === void 0 ? void 0 : _e.form.channel);
4352
- 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);
4353
- 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);
4354
- 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);
4355
- this.form
4356
- .get('targetURL')
4357
- .setValue((_o = (_m = this.getCampaignStorage) === null || _m === void 0 ? void 0 : _m.generalInformation) === null || _o === void 0 ? void 0 : _o.form.targetURL);
4358
- this.form
4359
- .get('fileName')
4360
- .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)));
4361
- this.form
4362
- .get('template')
4363
- .setValue((_t = (_s = this.getCampaignStorage) === null || _s === void 0 ? void 0 : _s.generalInformation) === null || _t === void 0 ? void 0 : _t.form.template);
4364
- this.form
4365
- .get('isUpload')
4366
- .setValue((_v = (_u = this.getCampaignStorage) === null || _u === void 0 ? void 0 : _u.generalInformation) === null || _v === void 0 ? void 0 : _v.form.isUpload);
4367
- 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);
4368
- this.form
4369
- .get('otpValue')
4370
- .setValue((_z = (_y = this.getCampaignStorage) === null || _y === void 0 ? void 0 : _y.generalInformation) === null || _z === void 0 ? void 0 : _z.form.otpValue);
4371
- this.form
4372
- .get('isUseExistingTemplate')
4373
- .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));
4374
- this.form
4375
- .get('isNeedSave')
4376
- .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));
4377
- 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);
4378
- this.isHaveTemplateParam = this.form.get('isUpload').value;
4379
- this.getTemplateOptionService(null, (_9 = this.form.get('template').value) === null || _9 === void 0 ? void 0 : _9.name);
4398
+ }
4399
+ (_d = this.getControl('channel')) === null || _d === void 0 ? void 0 : _d.setValue((_e = formValues) === null || _e === void 0 ? void 0 : _e.channel);
4400
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValue((_g = formValues) === null || _g === void 0 ? void 0 : _g.media);
4401
+ (_h = this.getControl('from')) === null || _h === void 0 ? void 0 : _h.setValue((_j = formValues) === null || _j === void 0 ? void 0 : _j.from);
4402
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.setValue((_l = formValues) === null || _l === void 0 ? void 0 : _l.text);
4403
+ (_m = this.getControl('targetURL')) === null || _m === void 0 ? void 0 : _m.setValue((_o = formValues) === null || _o === void 0 ? void 0 : _o.targetURL);
4404
+ (_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)));
4405
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.setValue((_u = formValues) === null || _u === void 0 ? void 0 : _u.template);
4406
+ (_v = this.getControl('isUpload')) === null || _v === void 0 ? void 0 : _v.setValue((_w = formValues) === null || _w === void 0 ? void 0 : _w.isUpload);
4407
+ (_x = this.getControl('fileId')) === null || _x === void 0 ? void 0 : _x.setValue((_y = formValues) === null || _y === void 0 ? void 0 : _y.fileId);
4408
+ (_z = this.getControl('otpValue')) === null || _z === void 0 ? void 0 : _z.setValue((_0 = formValues) === null || _0 === void 0 ? void 0 : _0.otpValue);
4409
+ (_1 = this.getControl('isUseExistingTemplate')) === null || _1 === void 0 ? void 0 : _1.setValue(!!((_2 = formValues) === null || _2 === void 0 ? void 0 : _2.templateName));
4410
+ (_3 = this.getControl('isNeedSave')) === null || _3 === void 0 ? void 0 : _3.setValue(!!((_4 = formValues) === null || _4 === void 0 ? void 0 : _4.isNeedSave));
4411
+ (_5 = this.getControl('ttl')) === null || _5 === void 0 ? void 0 : _5.setValue((_6 = formValues) === null || _6 === void 0 ? void 0 : _6.ttl);
4412
+ var savedVariables = (_7 = formValues) === null || _7 === void 0 ? void 0 : _7.variables;
4413
+ if (savedVariables && Array.isArray(savedVariables) && savedVariables.length > 0) {
4414
+ this.variables.clear();
4415
+ savedVariables.forEach(function (item) {
4416
+ _this.variables.push(new forms.FormGroup({
4417
+ paramName: new forms.FormControl({ value: item.paramName || '', disabled: _this.isReadOnlyMode }, forms.Validators.required),
4418
+ }));
4419
+ });
4420
+ }
4421
+ this.isHaveTemplateParam = (_8 = this.getControl('isUpload')) === null || _8 === void 0 ? void 0 : _8.value;
4422
+ this.getTemplateOptionService(null, (_10 = (_9 = this.getControl('template')) === null || _9 === void 0 ? void 0 : _9.value) === null || _10 === void 0 ? void 0 : _10.name);
4380
4423
  };
4381
4424
  GeneralInformationWAComponent.prototype.initValidation = function () {
4425
+ 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;
4426
+ if (!this.form)
4427
+ return;
4382
4428
  for (var key in this.form.controls) {
4383
- this.form.controls[key].clearValidators();
4384
- this.form.controls[key].updateValueAndValidity();
4429
+ if (this.form.controls[key]) {
4430
+ this.form.controls[key].clearValidators();
4431
+ this.form.controls[key].updateValueAndValidity();
4432
+ }
4385
4433
  }
4386
- this.form.get('channel').setValidators(forms.Validators.required);
4434
+ (_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.setValidators(forms.Validators.required);
4387
4435
  if (this.getIsText) {
4388
- this.form.get('from').setValidators(forms.Validators.required);
4389
- this.form.get('text').setValidators(forms.Validators.required);
4390
- this.form.get('from').updateValueAndValidity();
4391
- this.form.get('text').updateValueAndValidity();
4436
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.setValidators(forms.Validators.required);
4437
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.setValidators(forms.Validators.required);
4438
+ (_d = this.getControl('from')) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4439
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4392
4440
  }
4393
4441
  else if (this.getIsMedia) {
4394
- this.form.get('media').setValidators(forms.Validators.required);
4395
- this.form.get('from').setValidators(forms.Validators.required);
4396
- this.form.get('fileName').setValidators(forms.Validators.required);
4397
- this.form.get('media').updateValueAndValidity();
4398
- this.form.get('from').updateValueAndValidity();
4399
- this.form.get('fileName').updateValueAndValidity();
4442
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValidators(forms.Validators.required);
4443
+ (_g = this.getControl('from')) === null || _g === void 0 ? void 0 : _g.setValidators(forms.Validators.required);
4444
+ (_h = this.getControl('fileName')) === null || _h === void 0 ? void 0 : _h.setValidators(forms.Validators.required);
4445
+ (_j = this.getControl('media')) === null || _j === void 0 ? void 0 : _j.updateValueAndValidity();
4446
+ (_k = this.getControl('from')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4447
+ (_l = this.getControl('fileName')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
4400
4448
  }
4401
4449
  else if (this.getIsTemplate) {
4402
- this.form.get('from').setValidators(forms.Validators.required);
4403
- this.form.get('template').setValidators(forms.Validators.required);
4404
- this.form.get('paramHeader').setValidators(forms.Validators.required);
4405
- this.form.get('paramBody').setValidators(forms.Validators.required);
4406
- this.form.get('paramButton').setValidators(forms.Validators.required);
4407
- this.form.get('from').updateValueAndValidity();
4408
- this.form.get('template').updateValueAndValidity();
4409
- this.form.get('paramHeader').updateValueAndValidity();
4410
- this.form.get('paramBody').updateValueAndValidity();
4411
- this.form.get('paramButton').updateValueAndValidity();
4450
+ (_m = this.getControl('from')) === null || _m === void 0 ? void 0 : _m.setValidators(forms.Validators.required);
4451
+ (_o = this.getControl('template')) === null || _o === void 0 ? void 0 : _o.setValidators(forms.Validators.required);
4452
+ (_p = this.getControl('paramHeader')) === null || _p === void 0 ? void 0 : _p.setValidators(forms.Validators.required);
4453
+ (_q = this.getControl('paramBody')) === null || _q === void 0 ? void 0 : _q.setValidators(forms.Validators.required);
4454
+ (_r = this.getControl('paramButton')) === null || _r === void 0 ? void 0 : _r.setValidators(forms.Validators.required);
4455
+ (_s = this.getControl('from')) === null || _s === void 0 ? void 0 : _s.updateValueAndValidity();
4456
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.updateValueAndValidity();
4457
+ (_u = this.getControl('paramHeader')) === null || _u === void 0 ? void 0 : _u.updateValueAndValidity();
4458
+ (_v = this.getControl('paramBody')) === null || _v === void 0 ? void 0 : _v.updateValueAndValidity();
4459
+ (_w = this.getControl('paramButton')) === null || _w === void 0 ? void 0 : _w.updateValueAndValidity();
4412
4460
  }
4413
4461
  else if (this.getIsCatalogue) {
4414
- this.form.get('from').setValidators(forms.Validators.required);
4415
- this.form.get('category').setValidators(forms.Validators.required);
4416
- this.form.get('catalogue').setValidators(forms.Validators.required);
4417
- this.form.get('product').setValidators(forms.Validators.required);
4418
- this.form.get('body').setValidators(forms.Validators.maxLength(100));
4419
- this.form.get('from').updateValueAndValidity();
4420
- this.form.get('category').updateValueAndValidity();
4421
- this.form.get('catalogue').updateValueAndValidity();
4422
- this.form.get('product').updateValueAndValidity();
4423
- this.form.get('body').updateValueAndValidity();
4462
+ (_x = this.getControl('from')) === null || _x === void 0 ? void 0 : _x.setValidators(forms.Validators.required);
4463
+ (_y = this.getControl('category')) === null || _y === void 0 ? void 0 : _y.setValidators(forms.Validators.required);
4464
+ (_z = this.getControl('catalogue')) === null || _z === void 0 ? void 0 : _z.setValidators(forms.Validators.required);
4465
+ (_0 = this.getControl('product')) === null || _0 === void 0 ? void 0 : _0.setValidators(forms.Validators.required);
4466
+ (_1 = this.getControl('body')) === null || _1 === void 0 ? void 0 : _1.setValidators(forms.Validators.maxLength(100));
4467
+ (_2 = this.getControl('from')) === null || _2 === void 0 ? void 0 : _2.updateValueAndValidity();
4468
+ (_3 = this.getControl('category')) === null || _3 === void 0 ? void 0 : _3.updateValueAndValidity();
4469
+ (_4 = this.getControl('catalogue')) === null || _4 === void 0 ? void 0 : _4.updateValueAndValidity();
4470
+ (_5 = this.getControl('product')) === null || _5 === void 0 ? void 0 : _5.updateValueAndValidity();
4471
+ (_6 = this.getControl('body')) === null || _6 === void 0 ? void 0 : _6.updateValueAndValidity();
4424
4472
  }
4425
4473
  else if (this.getIsUtility) {
4426
- this.form.get('from').setValidators(forms.Validators.required);
4427
- this.form.get('text').setValidators([forms.Validators.required, forms.Validators.maxLength(1024)]);
4428
- this.form
4429
- .get('ttl')
4430
- .setValidators([
4474
+ (_7 = this.getControl('from')) === null || _7 === void 0 ? void 0 : _7.setValidators(forms.Validators.required);
4475
+ (_8 = this.getControl('text')) === null || _8 === void 0 ? void 0 : _8.setValidators([
4476
+ forms.Validators.required,
4477
+ forms.Validators.maxLength(1024),
4478
+ ]);
4479
+ (_9 = this.getControl('ttl')) === null || _9 === void 0 ? void 0 : _9.setValidators([
4431
4480
  Validators.min(30, 'Minimum TTL 30'),
4432
4481
  Validators.max(43200, 'Maximum TTL 43200'),
4433
4482
  ]);
4434
- this.form.get('from').updateValueAndValidity();
4435
- this.form.get('text').updateValueAndValidity();
4436
- this.form.get('ttl').updateValueAndValidity();
4483
+ (_10 = this.getControl('from')) === null || _10 === void 0 ? void 0 : _10.updateValueAndValidity();
4484
+ (_11 = this.getControl('text')) === null || _11 === void 0 ? void 0 : _11.updateValueAndValidity();
4485
+ (_12 = this.getControl('ttl')) === null || _12 === void 0 ? void 0 : _12.updateValueAndValidity();
4486
+ (_13 = this.getControl('variables')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4437
4487
  }
4438
4488
  else {
4439
- this.form.get('from').setValidators(forms.Validators.required);
4440
- this.form.get('text').setValidators(forms.Validators.required);
4441
- this.form.get('from').updateValueAndValidity();
4442
- this.form.get('text').updateValueAndValidity();
4489
+ (_14 = this.getControl('from')) === null || _14 === void 0 ? void 0 : _14.setValidators(forms.Validators.required);
4490
+ (_15 = this.getControl('text')) === null || _15 === void 0 ? void 0 : _15.setValidators(forms.Validators.required);
4491
+ (_16 = this.getControl('from')) === null || _16 === void 0 ? void 0 : _16.updateValueAndValidity();
4492
+ (_17 = this.getControl('text')) === null || _17 === void 0 ? void 0 : _17.updateValueAndValidity();
4443
4493
  }
4444
4494
  };
4445
4495
  GeneralInformationWAComponent.prototype.formReset = function (_isMediaType) {
4446
4496
  if (_isMediaType === void 0) { _isMediaType = false; }
4497
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4447
4498
  if (!_isMediaType) {
4448
- this.form.get('media').reset();
4449
- this.form.get('from').reset();
4499
+ (_a = this.getControl('media')) === null || _a === void 0 ? void 0 : _a.reset();
4500
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.reset();
4501
+ }
4502
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.reset();
4503
+ (_d = this.getControl('fileName')) === null || _d === void 0 ? void 0 : _d.reset();
4504
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.reset();
4505
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.reset();
4506
+ (_g = this.getControl('file')) === null || _g === void 0 ? void 0 : _g.reset();
4507
+ (_h = this.getControl('latitude')) === null || _h === void 0 ? void 0 : _h.reset();
4508
+ (_j = this.getControl('longitude')) === null || _j === void 0 ? void 0 : _j.reset();
4509
+ (_k = this.getControl('template')) === null || _k === void 0 ? void 0 : _k.reset();
4510
+ (_l = this.getControl('category')) === null || _l === void 0 ? void 0 : _l.reset();
4511
+ (_m = this.getControl('product')) === null || _m === void 0 ? void 0 : _m.reset();
4512
+ (_o = this.getControl('catalogue')) === null || _o === void 0 ? void 0 : _o.reset();
4513
+ (_p = this.getControl('body')) === null || _p === void 0 ? void 0 : _p.reset();
4514
+ (_q = this.getControl('otpValue')) === null || _q === void 0 ? void 0 : _q.reset();
4515
+ (_r = this.getControl('variables')) === null || _r === void 0 ? void 0 : _r.reset();
4516
+ var paramHeader = this.getControl('paramHeader');
4517
+ if (paramHeader) {
4518
+ paramHeader.clear();
4519
+ paramHeader.reset();
4520
+ }
4521
+ var paramBody = this.getControl('paramBody');
4522
+ if (paramBody) {
4523
+ paramBody.clear();
4524
+ paramBody.reset();
4525
+ }
4526
+ var paramButton = this.getControl('paramButton');
4527
+ if (paramButton) {
4528
+ paramButton.clear();
4529
+ paramButton.reset();
4450
4530
  }
4451
- this.form.get('text').reset();
4452
- this.form.get('fileName').reset();
4453
- this.form.get('targetURL').reset();
4454
- this.form.get('fileType').reset();
4455
- this.form.get('file').reset();
4456
- this.form.get('latitude').reset();
4457
- this.form.get('longitude').reset();
4458
- this.form.get('template').reset();
4459
- this.form.get('category').reset();
4460
- this.form.get('product').reset();
4461
- this.form.get('catalogue').reset();
4462
- this.form.get('body').reset();
4463
- this.form.get('otpValue').reset();
4464
- this.form.get('paramHeader').controls = [];
4465
- this.form.get('paramHeader').reset();
4466
- this.form.get('paramBody').controls = [];
4467
- this.form.get('paramBody').reset();
4468
- this.form.get('paramButton').controls = [];
4469
- this.form.get('paramButton').reset();
4470
4531
  this.initValidation();
4471
4532
  };
4533
+ GeneralInformationWAComponent.prototype.getControl = function (controlName) {
4534
+ return this.form ? this.form.get(controlName) : null;
4535
+ };
4472
4536
  GeneralInformationWAComponent.prototype.initParam = function (_name, _value, _type) {
4473
4537
  return {
4474
4538
  name: _name,
@@ -4492,58 +4556,21 @@
4492
4556
  var subs = this.apiAdapterService
4493
4557
  .executeApiRequest(parameterList, '/admin/account', 'GET')
4494
4558
  .subscribe(function (resp) {
4559
+ var _a;
4495
4560
  if (!resp.data)
4496
4561
  return;
4497
4562
  _this.accountOption = isInfinite ? __spread(_this.accountOption, resp.data) : resp.data;
4498
- _this.isHaveNextAccountOption = resp.haveNext;
4563
+ _this.isHaveNextAccountOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4499
4564
  _this.isLoadingAccountOption = false;
4500
4565
  });
4501
4566
  this.subscribers.push(subs);
4502
4567
  };
4503
- GeneralInformationWAComponent.prototype.listenBodyChange = function () {
4504
- var _this = this;
4505
- var _a;
4506
- (_a = this.form
4507
- .get('text')) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(operators.debounceTime(1000), operators.distinctUntilChanged()).subscribe(function () {
4508
- if (!_this.getIsUtility)
4509
- return;
4510
- _this.validateText();
4511
- });
4512
- };
4513
- GeneralInformationWAComponent.prototype.validateText = function (account) {
4514
- var _this = this;
4515
- var _a, _b;
4516
- this.isCheckUtility = true;
4517
- var _c = this.form.value, from = _c.from, text = _c.text;
4518
- if (!text || !from)
4519
- return;
4520
- if (!((_a = from) === null || _a === void 0 ? void 0 : _a.directSendEnabled))
4521
- return;
4522
- var headers = new http.HttpHeaders()
4523
- .set('Authorization', 'Bearer ' + localStorage.getItem('telin.accessToken'))
4524
- .set('Access-Control-Allow-Origin', '*');
4525
- this.httpClient
4526
- .post(environment.api + "/message/direct-send/" + ((_b = (from || account)) === null || _b === void 0 ? void 0 : _b.id), {
4527
- type: 'text',
4528
- text: { body: text },
4529
- }, { headers: headers })
4530
- .subscribe({
4531
- next: function (response) {
4532
- var _a;
4533
- _this.isUtility = ((_a = response) === null || _a === void 0 ? void 0 : _a.category) === 'UTILITY';
4534
- _this.isCheckUtility = false;
4535
- },
4536
- error: function () {
4537
- _this.isCheckUtility = false;
4538
- },
4539
- });
4540
- };
4541
4568
  GeneralInformationWAComponent.prototype.getTemplateOptionService = function (event, filter, isInfinite) {
4542
4569
  var _this = this;
4543
4570
  if (event === void 0) { event = null; }
4544
4571
  if (filter === void 0) { filter = ''; }
4545
4572
  if (isInfinite === void 0) { isInfinite = false; }
4546
- var _a, _b, _c, _d;
4573
+ var _a, _b, _c, _d, _e, _f, _g;
4547
4574
  this.isLoadingTemplateOption = true;
4548
4575
  var parameterList = [
4549
4576
  this.initParam('pageNo', this.pageNoTemplateOption, 'number'),
@@ -4551,30 +4578,31 @@
4551
4578
  this.initParam('platform', 'WA', 'string'),
4552
4579
  this.initParam('filter', filter, 'string'),
4553
4580
  this.initParam('status', 'APPROVED', 'string'),
4554
- this.initParam('clientId', (_a = this.form.get('from').value) === null || _a === void 0 ? void 0 : _a.clientId, 'string'),
4555
- 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'),
4581
+ 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'),
4582
+ 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'),
4556
4583
  ];
4557
4584
  if (this.isReadOnlyMode)
4558
4585
  parameterList.push(this.initParam('summary', true, 'string'));
4559
- var messageType = (_d = this.form.value) === null || _d === void 0 ? void 0 : _d.channel;
4586
+ var messageType = (_g = this.form.value) === null || _g === void 0 ? void 0 : _g.channel;
4560
4587
  if (messageType === 'utility') {
4561
4588
  parameterList.push(this.initParam('isDirectSend', true, 'string'));
4562
4589
  }
4563
4590
  var subs = this.apiAdapterService
4564
4591
  .executeApiRequest(parameterList, '/message/template', 'GET')
4565
4592
  .subscribe(function (resp) {
4566
- var _a;
4567
- _this.templateOption = isInfinite
4568
- ? __spread(_this.templateOption, resp.data) : resp.data;
4569
- _this.isHaveNextTemplateOption = resp.haveNext;
4593
+ var _a, _b, _c, _d, _e, _f;
4594
+ var currentOptions = _this.templateOption || [];
4595
+ var newData = resp.data || [];
4596
+ _this.templateOption = isInfinite ? __spread(currentOptions, newData) : newData;
4597
+ _this.isHaveNextTemplateOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4570
4598
  _this.isLoadingTemplateOption = false;
4571
- 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); });
4599
+ 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); });
4572
4600
  if (template) {
4573
- _this.form.get('template').setValue(template);
4574
- if (_this.form.get('isUpload').value)
4575
- return _this.updateDownloadCSV(_this.form.get('isUpload').value);
4601
+ (_c = _this.getControl('template')) === null || _c === void 0 ? void 0 : _c.patchValue(template);
4602
+ if ((_d = _this.getControl('isUpload')) === null || _d === void 0 ? void 0 : _d.value)
4603
+ return _this.updateDownloadCSV((_e = _this.getControl('isUpload')) === null || _e === void 0 ? void 0 : _e.value);
4576
4604
  }
4577
- _this.updateTemplate(_this.form.get('template').value);
4605
+ _this.updateTemplate((_f = _this.getControl('template')) === null || _f === void 0 ? void 0 : _f.value);
4578
4606
  });
4579
4607
  this.subscribers.push(subs);
4580
4608
  };
@@ -4634,45 +4662,45 @@
4634
4662
  };
4635
4663
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsText", {
4636
4664
  get: function () {
4637
- var _a;
4638
- return (this.form.get('channel').value &&
4639
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'text');
4665
+ var _a, _b, _c;
4666
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4667
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'text');
4640
4668
  },
4641
4669
  enumerable: true,
4642
4670
  configurable: true
4643
4671
  });
4644
4672
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsMedia", {
4645
4673
  get: function () {
4646
- var _a;
4647
- return (this.form.get('channel').value &&
4648
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'media');
4674
+ var _a, _b, _c;
4675
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4676
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'media');
4649
4677
  },
4650
4678
  enumerable: true,
4651
4679
  configurable: true
4652
4680
  });
4653
4681
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsTemplate", {
4654
4682
  get: function () {
4655
- var _a;
4656
- return (this.form.get('channel').value &&
4657
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'template');
4683
+ var _a, _b, _c;
4684
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4685
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'template');
4658
4686
  },
4659
4687
  enumerable: true,
4660
4688
  configurable: true
4661
4689
  });
4662
4690
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsCatalogue", {
4663
4691
  get: function () {
4664
- var _a;
4665
- return (this.form.get('channel').value &&
4666
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'catalogue');
4692
+ var _a, _b, _c;
4693
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4694
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'catalogue');
4667
4695
  },
4668
4696
  enumerable: true,
4669
4697
  configurable: true
4670
4698
  });
4671
4699
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsUtility", {
4672
4700
  get: function () {
4673
- var _a;
4674
- return (this.form.get('channel').value &&
4675
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'utility');
4701
+ var _a, _b, _c;
4702
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4703
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'utility');
4676
4704
  },
4677
4705
  enumerable: true,
4678
4706
  configurable: true
@@ -4700,6 +4728,7 @@
4700
4728
  : '';
4701
4729
  };
4702
4730
  GeneralInformationWAComponent.prototype.onFileSelected = function (event) {
4731
+ var _a, _b, _c, _d, _e, _f;
4703
4732
  var file = event.target.files;
4704
4733
  var accept = this.extFileAccepted.split('/');
4705
4734
  var matchType = accept[0];
@@ -4715,21 +4744,22 @@
4715
4744
  this.toastr.error('Upload media failed, max size 10mb');
4716
4745
  return;
4717
4746
  }
4718
- this.form.get('file').setValue(file[0]);
4719
- this.form.get('fileType').setValue('image');
4720
- this.form.get('fileName').setValue(file[0].name);
4721
- this.form.get('targetURL').setValidators(forms.Validators.required);
4722
- this.form.get('targetURL').updateValueAndValidity();
4747
+ (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.setValue(file[0]);
4748
+ (_b = this.getControl('fileType')) === null || _b === void 0 ? void 0 : _b.setValue('image');
4749
+ (_c = this.getControl('fileName')) === null || _c === void 0 ? void 0 : _c.setValue(file[0].name);
4750
+ (_d = this.getControl('targetURL')) === null || _d === void 0 ? void 0 : _d.setValidators(forms.Validators.required);
4751
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4723
4752
  if (file[0].type.indexOf('video') > -1)
4724
- this.form.get('fileType').setValue('video');
4753
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.setValue('video');
4725
4754
  this.uploadMediaService();
4726
4755
  };
4727
4756
  GeneralInformationWAComponent.prototype.uploadMediaService = function () {
4728
4757
  var _this = this;
4758
+ var _a;
4729
4759
  var parameterList = [
4730
4760
  {
4731
4761
  name: 'file',
4732
- value: this.form.get('file').value,
4762
+ value: (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.value,
4733
4763
  in: 'formData',
4734
4764
  type: 'object',
4735
4765
  },
@@ -4737,75 +4767,93 @@
4737
4767
  var subs = this.apiAdapterService
4738
4768
  .executeApiRequest(parameterList, '/message/media', 'POST')
4739
4769
  .subscribe(function (resp) {
4740
- _this.form.get('targetURL').clearValidators();
4741
- _this.form.get('targetURL').updateValueAndValidity();
4742
- _this.form.get('targetURL').setValue(resp.data.targetURL);
4743
- _this.form.get('file').reset();
4770
+ var _a, _b, _c, _d;
4771
+ (_a = _this.getControl('targetURL')) === null || _a === void 0 ? void 0 : _a.clearValidators();
4772
+ (_b = _this.getControl('targetURL')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4773
+ (_c = _this.getControl('targetURL')) === null || _c === void 0 ? void 0 : _c.setValue(resp.data.targetURL);
4774
+ (_d = _this.getControl('file')) === null || _d === void 0 ? void 0 : _d.reset();
4744
4775
  _this.toastr.success('Upload media success');
4745
4776
  });
4746
4777
  this.subscribers.push(subs);
4747
4778
  };
4779
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "buttonParamsControls", {
4780
+ get: function () {
4781
+ return this.form.get('buttonParams').controls;
4782
+ },
4783
+ enumerable: true,
4784
+ configurable: true
4785
+ });
4786
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "isUsingExcelBulk", {
4787
+ get: function () {
4788
+ var _a;
4789
+ return ((_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.value) || false;
4790
+ },
4791
+ enumerable: true,
4792
+ configurable: true
4793
+ });
4748
4794
  GeneralInformationWAComponent.prototype.updateTemplate = function (template) {
4749
4795
  var _this = this;
4750
- 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;
4796
+ 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;
4751
4797
  this.isShowParameter = false;
4752
4798
  if (!template)
4753
4799
  return;
4800
+ var buttonParamsArray = this.form.get('buttonParams');
4801
+ buttonParamsArray.clear();
4802
+ if (template && template.buttons && template.buttons.length > 0) {
4803
+ var quickReplyButtons = template.buttons.filter(function (btn) { return btn.type === 'QUICK_REPLY'; });
4804
+ quickReplyButtons.forEach(function (btn) {
4805
+ buttonParamsArray.push(new forms.FormGroup({
4806
+ label: new forms.FormControl(btn.text),
4807
+ payload: new forms.FormControl('', [forms.Validators.maxLength(256)]),
4808
+ }));
4809
+ });
4810
+ }
4754
4811
  this.isHaveTemplateParam =
4755
- ((_a = template.header.examples) === null || _a === void 0 ? void 0 : _a.length) > 0 ||
4756
- ((_b = template.body.examples) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
4757
- ((_c = template.buttons) === null || _c === void 0 ? void 0 : _c.length) > 0;
4758
- 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())) {
4759
- this.form
4760
- .get('fileName')
4761
- .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)));
4762
- this.form
4763
- .get('targetURL')
4764
- .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)));
4765
- 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());
4766
- }
4767
- ((_u = template.header.examples) === null || _u === void 0 ? void 0 : _u.length) > 0
4768
- ? this.form.get('paramHeader').setValidators(forms.Validators.required)
4769
- : this.form.get('paramHeader').clearValidators();
4770
- ((_v = template.body.examples) === null || _v === void 0 ? void 0 : _v.length) > 0
4771
- ? this.form.get('paramBody').setValidators(forms.Validators.required)
4772
- : this.form.get('paramBody').clearValidators();
4773
- ((_w = template.buttons) === null || _w === void 0 ? void 0 : _w.length) > 0
4774
- ? this.form.get('paramButton').setValidators(forms.Validators.required)
4775
- : this.form.get('paramButton').clearValidators();
4812
+ (_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 ||
4813
+ (_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 ||
4814
+ (_h = (_g = template.buttons) === null || _g === void 0 ? void 0 : _g.length, (_h !== null && _h !== void 0 ? _h : 0)) > 0;
4815
+ 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())) {
4816
+ (_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)));
4817
+ (_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)));
4818
+ 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());
4819
+ }
4820
+ (_2 = (_1 = template.header.examples) === null || _1 === void 0 ? void 0 : _1.length, (_2 !== null && _2 !== void 0 ? _2 : 0)) > 0
4821
+ ? (_3 = this.getControl('paramHeader')) === null || _3 === void 0 ? void 0 : _3.setValidators(forms.Validators.required) : (_4 = this.getControl('paramHeader')) === null || _4 === void 0 ? void 0 : _4.clearValidators();
4822
+ (_6 = (_5 = template.body.examples) === null || _5 === void 0 ? void 0 : _5.length, (_6 !== null && _6 !== void 0 ? _6 : 0)) > 0
4823
+ ? (_7 = this.getControl('paramBody')) === null || _7 === void 0 ? void 0 : _7.setValidators(forms.Validators.required) : (_8 = this.getControl('paramBody')) === null || _8 === void 0 ? void 0 : _8.clearValidators();
4824
+ (_10 = (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.length, (_10 !== null && _10 !== void 0 ? _10 : 0)) > 0
4825
+ ? (_11 = this.getControl('paramButton')) === null || _11 === void 0 ? void 0 : _11.setValidators(forms.Validators.required) : (_12 = this.getControl('paramButton')) === null || _12 === void 0 ? void 0 : _12.clearValidators();
4776
4826
  this.form.get('paramHeader').controls = [];
4777
4827
  this.form.get('paramHeader').reset();
4778
- this.form.get('paramHeader').updateValueAndValidity();
4828
+ (_13 = this.getControl('paramHeader')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4779
4829
  this.form.get('paramBody').controls = [];
4780
4830
  this.form.get('paramBody').reset();
4781
- this.form.get('paramBody').updateValueAndValidity();
4831
+ (_14 = this.getControl('paramBody')) === null || _14 === void 0 ? void 0 : _14.updateValueAndValidity();
4782
4832
  this.form.get('paramButton').controls = [];
4783
4833
  this.form.get('paramButton').reset();
4784
- this.form.get('paramButton').updateValueAndValidity();
4785
- this.form.get('otpValue').setValue('');
4786
- this.form.get('otpValue').clearValidators();
4787
- this.form.get('otpValue').updateValueAndValidity();
4788
- var formStorage = (_y = (_x = this.getCampaignStorage) === null || _x === void 0 ? void 0 : _x.generalInformation) === null || _y === void 0 ? void 0 : _y.form;
4834
+ (_15 = this.getControl('paramButton')) === null || _15 === void 0 ? void 0 : _15.updateValueAndValidity();
4835
+ (_16 = this.getControl('otpValue')) === null || _16 === void 0 ? void 0 : _16.setValue('');
4836
+ (_17 = this.getControl('otpValue')) === null || _17 === void 0 ? void 0 : _17.clearValidators();
4837
+ (_18 = this.getControl('otpValue')) === null || _18 === void 0 ? void 0 : _18.updateValueAndValidity();
4838
+ var formStorage = (_20 = (_19 = this.getCampaignStorage) === null || _19 === void 0 ? void 0 : _19.generalInformation) === null || _20 === void 0 ? void 0 : _20.form;
4789
4839
  if (template.category === 'AUTHENTICATION') {
4790
- this.form
4791
- .get('otpValue')
4792
- .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 : '')));
4793
- this.form.get('otpValue').setValidators(forms.Validators.required);
4794
- this.form.get('otpValue').updateValueAndValidity();
4840
+ (_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 : '')));
4841
+ (_30 = this.getControl('otpValue')) === null || _30 === void 0 ? void 0 : _30.setValidators(forms.Validators.required);
4842
+ (_31 = this.getControl('otpValue')) === null || _31 === void 0 ? void 0 : _31.updateValueAndValidity();
4795
4843
  }
4796
- (_7 = template.header.examples) === null || _7 === void 0 ? void 0 : _7.forEach(function (each, index) {
4844
+ (_32 = template.header.examples) === null || _32 === void 0 ? void 0 : _32.forEach(function (each, index) {
4797
4845
  var _a, _b, _c, _d, _e, _f, _g;
4798
4846
  _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 : '')));
4799
4847
  });
4800
- (_8 = template.body.examples) === null || _8 === void 0 ? void 0 : _8.forEach(function (each, index) {
4848
+ (_33 = template.body.examples) === null || _33 === void 0 ? void 0 : _33.forEach(function (each, index) {
4801
4849
  var _a, _b, _c, _d, _e, _f, _g;
4802
4850
  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 : ''));
4803
4851
  if (['$UnsubscribeAccount'].includes(each))
4804
4852
  paramValue = each;
4805
4853
  _this.addParamBody(paramValue);
4806
4854
  });
4807
- (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.forEach(function (each, index) {
4808
- var _a;
4855
+ (_34 = template.buttons) === null || _34 === void 0 ? void 0 : _34.forEach(function (each, index) {
4856
+ var _a, _b, _c, _d;
4809
4857
  _this.addParamButton();
4810
4858
  var button = _this.getButton;
4811
4859
  if (((_a = each.examples) === null || _a === void 0 ? void 0 : _a.length) > 0) {
@@ -4823,8 +4871,9 @@
4823
4871
  });
4824
4872
  }
4825
4873
  else {
4826
- button[button.length - 1].get('name').clearValidators();
4827
- button[button.length - 1].get('name').updateValueAndValidity();
4874
+ var lastControl = (_b = button[button.length - 1]) === null || _b === void 0 ? void 0 : _b.get('name');
4875
+ (_c = lastControl) === null || _c === void 0 ? void 0 : _c.clearValidators();
4876
+ (_d = lastControl) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4828
4877
  }
4829
4878
  });
4830
4879
  };
@@ -4859,13 +4908,14 @@
4859
4908
  var autocomplete = new google.maps.places.Autocomplete(_this.mapSearchRef.nativeElement);
4860
4909
  autocomplete.addListener('place_changed', function () {
4861
4910
  _this.ngZone.run(function () {
4911
+ var _a, _b;
4862
4912
  var place = autocomplete.getPlace();
4863
4913
  if (!place.geometry)
4864
4914
  return;
4865
4915
  _this.maps.latitude = place.geometry.location.lat();
4866
4916
  _this.maps.longitude = place.geometry.location.lng();
4867
- _this.form.get('latitude').setValue(_this.maps.latitude);
4868
- _this.form.get('longitude').setValue(_this.maps.longitude);
4917
+ (_a = _this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(_this.maps.latitude);
4918
+ (_b = _this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(_this.maps.longitude);
4869
4919
  });
4870
4920
  });
4871
4921
  });
@@ -4874,69 +4924,139 @@
4874
4924
  var _this = this;
4875
4925
  if ('geolocation' in navigator) {
4876
4926
  navigator.geolocation.getCurrentPosition(function (position) {
4877
- if (!_this.form.get('longitude').value && !_this.form.get('latitude').value) {
4927
+ var _a, _b, _c, _d;
4928
+ 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)) {
4878
4929
  _this.maps.latitude = position.coords.latitude;
4879
4930
  _this.maps.longitude = position.coords.longitude;
4880
- _this.form.get('latitude').setValue(_this.maps.latitude);
4881
- _this.form.get('longitude').setValue(_this.maps.longitude);
4931
+ (_c = _this.getControl('latitude')) === null || _c === void 0 ? void 0 : _c.setValue(_this.maps.latitude);
4932
+ (_d = _this.getControl('longitude')) === null || _d === void 0 ? void 0 : _d.setValue(_this.maps.longitude);
4882
4933
  }
4883
4934
  });
4884
4935
  }
4885
4936
  };
4886
4937
  GeneralInformationWAComponent.prototype.markerDragEnd = function (event) {
4938
+ var _a, _b;
4887
4939
  if (event.latLng) {
4888
4940
  this.maps.latitude = event.latLng.lat();
4889
4941
  this.maps.longitude = event.latLng.lng();
4890
- this.form.get('latitude').setValue(this.maps.latitude);
4891
- this.form.get('longitude').setValue(this.maps.longitude);
4942
+ (_a = this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(this.maps.latitude);
4943
+ (_b = this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(this.maps.longitude);
4892
4944
  }
4893
4945
  };
4894
4946
  GeneralInformationWAComponent.prototype.updateDownloadCSV = function (isChecked) {
4895
- this.form.get('isUpload').setValue(isChecked);
4947
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4948
+ (_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.setValue(isChecked);
4896
4949
  if (isChecked) {
4897
- this.form.get('paramHeader').controls = [];
4898
- this.form.get('paramHeader').reset();
4899
- this.form.get('paramBody').controls = [];
4900
- this.form.get('paramBody').reset();
4901
- this.form.get('paramButton').controls = [];
4902
- this.form.get('paramButton').reset();
4903
- this.form.get('paramHeader').clearValidators();
4904
- this.form.get('paramBody').clearValidators();
4905
- this.form.get('paramButton').clearValidators();
4906
- this.form.get('paramHeader').updateValueAndValidity();
4907
- this.form.get('paramBody').updateValueAndValidity();
4908
- this.form.get('paramButton').updateValueAndValidity();
4909
- this.form.get('otpValue').reset();
4910
- this.form.get('otpValue').clearValidators();
4911
- this.form.get('otpValue').updateValueAndValidity();
4950
+ this.getControl('paramHeader').controls = [];
4951
+ this.getControl('paramHeader').reset();
4952
+ this.getControl('paramBody').controls = [];
4953
+ this.getControl('paramBody').reset();
4954
+ this.getControl('paramButton').controls = [];
4955
+ this.getControl('paramButton').reset();
4956
+ (_b = this.getControl('paramHeader')) === null || _b === void 0 ? void 0 : _b.clearValidators();
4957
+ (_c = this.getControl('paramBody')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4958
+ (_d = this.getControl('paramButton')) === null || _d === void 0 ? void 0 : _d.clearValidators();
4959
+ (_e = this.getControl('paramHeader')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4960
+ (_f = this.getControl('paramBody')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4961
+ (_g = this.getControl('paramButton')) === null || _g === void 0 ? void 0 : _g.updateValueAndValidity();
4962
+ (_h = this.getControl('otpValue')) === null || _h === void 0 ? void 0 : _h.reset();
4963
+ (_j = this.getControl('otpValue')) === null || _j === void 0 ? void 0 : _j.clearValidators();
4964
+ (_k = this.getControl('otpValue')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4912
4965
  return;
4913
4966
  }
4914
- this.updateTemplate(this.form.get('template').value);
4967
+ this.updateTemplate((_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.value);
4915
4968
  };
4916
4969
  GeneralInformationWAComponent.prototype.handleChangeTemplate = function (useExisting) {
4970
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4971
+ (_a = this.getControl('isDownloadVariableXLS')) === null || _a === void 0 ? void 0 : _a.setValue(false);
4972
+ this.variables.clear();
4973
+ this.updateVariableDownloadXLS(false);
4917
4974
  if (useExisting) {
4918
- this.form.get('template').setValidators(forms.Validators.required);
4919
- this.form.get('text').reset();
4920
- this.form.get('text').clearValidators();
4921
- this.form.get('text').updateValueAndValidity();
4922
- this.form.get('template').updateValueAndValidity();
4975
+ (_b = this.getControl('template')) === null || _b === void 0 ? void 0 : _b.setValidators(forms.Validators.required);
4976
+ //this.getControl('text')?.reset();
4977
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4978
+ (_d = this.getControl('text')) === null || _d === void 0 ? void 0 : _d.setValue('Halo {{1}}, ini adalah kode verifikasi kamu: {{2}}');
4979
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4980
+ (_f = this.getControl('template')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4981
+ this.variables.push(new forms.FormGroup({
4982
+ paramName: new forms.FormControl('', forms.Validators.required),
4983
+ }));
4984
+ this.variables.push(new forms.FormGroup({
4985
+ paramName: new forms.FormControl('', forms.Validators.required),
4986
+ }));
4923
4987
  }
4924
4988
  else {
4925
- this.form.get('template').reset();
4926
- this.form.get('template').clearValidators();
4927
- this.form.get('text').setValidators([forms.Validators.required, forms.Validators.max(1024)]);
4928
- this.form.get('text').updateValueAndValidity();
4929
- this.form.get('template').updateValueAndValidity();
4989
+ (_g = this.getControl('template')) === null || _g === void 0 ? void 0 : _g.reset();
4990
+ (_h = this.getControl('template')) === null || _h === void 0 ? void 0 : _h.clearValidators();
4991
+ (_j = this.getControl('text')) === null || _j === void 0 ? void 0 : _j.setValidators([forms.Validators.required, forms.Validators.max(1024)]);
4992
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4993
+ (_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
4930
4994
  }
4931
4995
  };
4932
4996
  GeneralInformationWAComponent.prototype.handleChangeFrom = function (value) {
4933
4997
  var isUseExistingTemplate = this.form.value.isUseExistingTemplate;
4934
- if (isUseExistingTemplate) {
4935
- this.getTemplateOptionService(value);
4998
+ if (!isUseExistingTemplate)
4999
+ return;
5000
+ this.getTemplateOptionService(value);
5001
+ };
5002
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "variables", {
5003
+ get: function () {
5004
+ return this.getControl('variables');
5005
+ },
5006
+ enumerable: true,
5007
+ configurable: true
5008
+ });
5009
+ GeneralInformationWAComponent.prototype.addVariable = function () {
5010
+ var variableGroup = new forms.FormGroup({
5011
+ paramName: new forms.FormControl('', forms.Validators.required),
5012
+ });
5013
+ this.variables.push(variableGroup);
5014
+ var textControl = this.getControl('text');
5015
+ if (textControl) {
5016
+ var currentBody = textControl.value || '';
5017
+ var newSequence = "{{" + this.variables.controls.length + "}}";
5018
+ textControl.setValue((currentBody + " " + newSequence).trim());
5019
+ }
5020
+ };
5021
+ GeneralInformationWAComponent.prototype.removeVariable = function (index) {
5022
+ var _a;
5023
+ this.variables.removeAt(index);
5024
+ if (this.variables.controls.length === 0) {
5025
+ (_a = this.getControl('useXlsx')) === null || _a === void 0 ? void 0 : _a.setValue(false);
5026
+ }
5027
+ var textControl = this.getControl('text');
5028
+ if (textControl && textControl.value) {
5029
+ var targetSequence_1 = index + 1;
5030
+ var currentBody = textControl.value;
5031
+ var removeRegex = new RegExp("\\s*\\{\\{" + targetSequence_1 + "\\}\\}", 'g');
5032
+ currentBody = currentBody.replace(removeRegex, '');
5033
+ currentBody = currentBody.replace(/\{\{(\d+)\}\}/g, function (match, numStr) {
5034
+ var num = parseInt(numStr, 10);
5035
+ if (num > targetSequence_1) {
5036
+ return "{{" + (num - 1) + "}}";
5037
+ }
5038
+ return match;
5039
+ });
5040
+ textControl.setValue(currentBody.trim());
5041
+ }
5042
+ };
5043
+ GeneralInformationWAComponent.prototype.updateVariableDownloadXLS = function (isChecked) {
5044
+ var variablesArray = this.variables;
5045
+ if (isChecked) {
5046
+ variablesArray.controls.forEach(function (control) {
5047
+ var _a, _b;
5048
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.clearValidators();
5049
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
5050
+ });
4936
5051
  }
4937
5052
  else {
4938
- this.validateText(value);
5053
+ variablesArray.controls.forEach(function (control) {
5054
+ var _a, _b;
5055
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.setValidators(forms.Validators.required);
5056
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
5057
+ });
4939
5058
  }
5059
+ this.form.updateValueAndValidity();
4940
5060
  };
4941
5061
  GeneralInformationWAComponent.prototype.ngOnDestroy = function () {
4942
5062
  this.subscribers.forEach(function (each) { return each.unsubscribe(); });
@@ -4963,8 +5083,8 @@
4963
5083
  GeneralInformationWAComponent = __decorate([
4964
5084
  core.Component({
4965
5085
  selector: 'lib-general-information-wa',
4966
- 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",
4967
- styles: [".asterix--after:after{content:\"*\";color:red}"]
5086
+ 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",
5087
+ 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}"]
4968
5088
  })
4969
5089
  ], GeneralInformationWAComponent);
4970
5090
  return GeneralInformationWAComponent;
@@ -5394,10 +5514,7 @@
5394
5514
  var _this = this;
5395
5515
  this.form = new forms.FormGroup({
5396
5516
  id: new forms.FormControl(null),
5397
- campaignName: new forms.FormControl(null, [
5398
- forms.Validators.required,
5399
- forms.Validators.maxLength(100),
5400
- ]),
5517
+ campaignName: new forms.FormControl(null, [forms.Validators.required, forms.Validators.maxLength(100)]),
5401
5518
  medium: new forms.FormControl(null, [forms.Validators.required]),
5402
5519
  });
5403
5520
  this.form.valueChanges.subscribe(function () {
@@ -5421,12 +5538,8 @@
5421
5538
  if (Object.entries(campaign).length === 0)
5422
5539
  return;
5423
5540
  this.form.get('id').setValue((_b = (_a = campaign) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.id);
5424
- this.form
5425
- .get('campaignName')
5426
- .setValue((_d = (_c = campaign) === null || _c === void 0 ? void 0 : _c.generalInformation) === null || _d === void 0 ? void 0 : _d.form.campaignName);
5427
- this.form
5428
- .get('medium')
5429
- .setValue((_f = (_e = campaign) === null || _e === void 0 ? void 0 : _e.generalInformation) === null || _f === void 0 ? void 0 : _f.form.medium);
5541
+ 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);
5542
+ 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);
5430
5543
  };
5431
5544
  GeneralInformationComponent.prototype.initDisable = function () {
5432
5545
  if (!this.isReadOnlyMode) {
@@ -5435,6 +5548,7 @@
5435
5548
  this.form.disable();
5436
5549
  };
5437
5550
  GeneralInformationComponent.prototype.updateGeneralInformationForm = function (form) {
5551
+ console.log(form, 'form');
5438
5552
  this.generalInformationForm = form;
5439
5553
  this.isShowMore = false;
5440
5554
  this.generalInformation.emit({
@@ -5557,7 +5671,7 @@
5557
5671
  core.Component({
5558
5672
  selector: 'lib-new-campaign-general-information',
5559
5673
  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",
5560
- 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}"]
5674
+ 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}"]
5561
5675
  })
5562
5676
  ], GeneralInformationComponent);
5563
5677
  return GeneralInformationComponent;
@@ -5600,20 +5714,12 @@
5600
5714
  this.table = new TableModel();
5601
5715
  this.table.labels = [
5602
5716
  'select',
5603
- 'Name',
5604
5717
  'Category',
5605
5718
  'No. Of Customer',
5606
5719
  'Created Date',
5607
5720
  'Updated Date',
5608
5721
  ];
5609
- this.table.columns = [
5610
- 'select',
5611
- 'name',
5612
- 'category',
5613
- 'totalMembers',
5614
- 'createdDate',
5615
- 'updatedDate',
5616
- ];
5722
+ this.table.columns = ['select', 'name', 'totalMembers', 'createdDate', 'updatedDate'];
5617
5723
  };
5618
5724
  Object.defineProperty(NewNumberBasesComponent.prototype, "getCampaignStorage", {
5619
5725
  get: function () {
@@ -5626,15 +5732,16 @@
5626
5732
  });
5627
5733
  NewNumberBasesComponent.prototype.initEdit = function () {
5628
5734
  var _this = this;
5629
- var _a, _b, _c, _d, _e, _f, _g, _h;
5735
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5630
5736
  if (Object.entries(this.getCampaignStorage).length === 0)
5631
5737
  return;
5632
- 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;
5738
+ var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5739
+ this.isShowUploadCSV = ((_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isUpload) || ((_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.isDownloadVariableXLS);
5633
5740
  this.fileSelected = {
5634
- name: (_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.targetAudienceFile) === null || _e === void 0 ? void 0 : _e.name,
5635
- targetURL: (_g = (_f = this.getCampaignStorage) === null || _f === void 0 ? void 0 : _f.targetAudienceFile) === null || _g === void 0 ? void 0 : _g.targetURL,
5741
+ name: (_f = (_e = this.getCampaignStorage) === null || _e === void 0 ? void 0 : _e.targetAudienceFile) === null || _f === void 0 ? void 0 : _f.name,
5742
+ targetURL: (_h = (_g = this.getCampaignStorage) === null || _g === void 0 ? void 0 : _g.targetAudienceFile) === null || _h === void 0 ? void 0 : _h.targetURL,
5636
5743
  };
5637
- (_h = this.table.dataSource.data) === null || _h === void 0 ? void 0 : _h.forEach(function (each) {
5744
+ (_j = this.table.dataSource.data) === null || _j === void 0 ? void 0 : _j.forEach(function (each) {
5638
5745
  var _a, _b;
5639
5746
  if ((_b = (_a = _this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.targetAudience) === null || _b === void 0 ? void 0 : _b.includes(each.id))
5640
5747
  _this.onChecked(true, each);
@@ -5661,31 +5768,14 @@
5661
5768
  .executeApiRequest(parameterList, '/admin/category', 'GET')
5662
5769
  .subscribe(function (resp) {
5663
5770
  var _a;
5664
- var customerSegments = JSON.parse(localStorage.getItem('csegment') || '[]');
5665
- var getDate = function (item) {
5666
- return new Date(item.updatedDate || item.createdDate).getTime();
5667
- };
5668
- var data = (((_a = resp) === null || _a === void 0 ? void 0 : _a.data) || []).map(function (item) { return (__assign(__assign({}, item), { category: 'Customer Group' })); });
5669
- if (_this.categoryParam.pageNo === 1) {
5670
- customerSegments
5671
- .sort(function (a, b) { return getDate(b) - getDate(a); })
5672
- .forEach(function (segment) {
5673
- var index = data.findIndex(function (group) { return getDate(group) < getDate(segment); });
5674
- if (index === -1) {
5675
- return;
5676
- }
5677
- var groupId = data[index].id;
5678
- data[index] = __assign(__assign({}, segment), { id: groupId, totalMembers: segment.customerCount, updatedDate: segment.updatedDate || segment.createdDate, category: 'Customer Segment' });
5679
- });
5680
- }
5681
5771
  if (_this.isReadOnlyMode) {
5682
- _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); });
5772
+ _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); });
5683
5773
  _this.categorySelected = _this.table.dataSource.data;
5684
5774
  _this.isLoading = false;
5685
5775
  _this.initEdit();
5686
5776
  return;
5687
5777
  }
5688
- _this.table.dataSource.data = data;
5778
+ _this.table.dataSource.data = resp.data;
5689
5779
  _this.table.setNextPage(resp.haveNext);
5690
5780
  _this.isLoading = false;
5691
5781
  _this.initEdit();
@@ -5820,13 +5910,31 @@
5820
5910
  return found ? true : false;
5821
5911
  };
5822
5912
  NewNumberBasesComponent.prototype.onDownloadSampleService = function () {
5823
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5913
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5914
+ var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5915
+ var isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
5824
5916
  var parameterList = [
5825
- 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'),
5826
- 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'),
5827
- 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'),
5828
- 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'),
5917
+ this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
5829
5918
  ];
5919
+ if (isNeedSave) {
5920
+ // SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
5921
+ 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'));
5922
+ }
5923
+ else {
5924
+ // SKENARIO 2: CREATE NEW (Belum disave, butuh text & examples)
5925
+ var safeBodyText = encodeURIComponent(((_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.text) || '');
5926
+ parameterList.push(this.initParam('bodyText', safeBodyText, 'string'));
5927
+ var variables = (_o = genInfoForm) === null || _o === void 0 ? void 0 : _o.variables;
5928
+ if (variables && Array.isArray(variables) && variables.length > 0) {
5929
+ var bodyExamplesString = variables.map(function (v) { return v.paramName; }).join(',');
5930
+ var safeBodyExamples = encodeURIComponent(bodyExamplesString);
5931
+ parameterList.push(this.initParam('bodyExamples', safeBodyExamples, 'string'));
5932
+ }
5933
+ 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) {
5934
+ var safeHeaderText = encodeURIComponent(genInfoForm.template.header.text);
5935
+ parameterList.push(this.initParam('headerText', safeHeaderText, 'string'));
5936
+ }
5937
+ }
5830
5938
  var subs = this.apiAdapterService
5831
5939
  .executeApiRequest(parameterList, '/message/bulkupload/template', 'GET', true)
5832
5940
  .subscribe(function (resp) {
@@ -5923,7 +6031,7 @@
5923
6031
  NewNumberBasesComponent = __decorate([
5924
6032
  core.Component({
5925
6033
  selector: 'lib-new-number-bases',
5926
- 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",
6034
+ 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",
5927
6035
  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}"]
5928
6036
  })
5929
6037
  ], NewNumberBasesComponent);
@@ -6196,13 +6304,18 @@
6196
6304
 
6197
6305
  exports.AdlCampaignManagementLibraryInternalComponent = AdlCampaignManagementLibraryInternalComponent;
6198
6306
  exports.AdlCampaignManagementLibraryInternalModule = AdlCampaignManagementLibraryInternalModule;
6307
+ exports.CampaignIndexComponent = CampaignIndexComponent;
6199
6308
  exports.CampaignIndexModule = CampaignIndexModule;
6200
6309
  exports.CampaignManagementComponent = CampaignManagementComponent;
6201
6310
  exports.CampaignManagementModule = CampaignManagementModule;
6202
6311
  exports.ConfirmationComponent = ConfirmationComponent;
6203
6312
  exports.ConfirmationModule = ConfirmationModule;
6313
+ exports.DashboardComponent = DashboardComponent;
6204
6314
  exports.DashboardModule = DashboardModule;
6315
+ exports.MatSelectInfiniteScrollDirective = MatSelectInfiniteScrollDirective;
6316
+ exports.SearchComponent = SearchComponent;
6205
6317
  exports.SearchModule = SearchModule;
6318
+ exports.SummaryComponent = SummaryComponent;
6206
6319
  exports.ɵa = WizardComponent;
6207
6320
  exports.ɵb = NewCampaignComponent;
6208
6321
  exports.ɵc = GeneralInformationComponent;
@@ -6215,20 +6328,17 @@
6215
6328
  exports.ɵj = GeneralInformationEmailComponent;
6216
6329
  exports.ɵk = PendingApprovalDialogViewComponent;
6217
6330
  exports.ɵl = FailoverMechanismComponent;
6218
- exports.ɵm = DashboardComponent;
6219
- exports.ɵn = ApiAdapterServiceService;
6220
- exports.ɵo = SearchComponent;
6221
- exports.ɵp = ViewingListOfCampaignTableComponent;
6222
- exports.ɵq = FilterInListOfCampaignComponent;
6223
- exports.ɵr = CampaignIndexComponent;
6224
- exports.ɵs = ApiAdapterServiceService;
6225
- exports.ɵt = MatSelectInfiniteScrollDirective;
6226
- exports.ɵu = InputNumericModule;
6227
- exports.ɵv = InputNumericComponent;
6228
- exports.ɵw = CustomPaginator;
6229
- exports.ɵx = ConfirmationComponent;
6230
- exports.ɵy = ConfirmationModel;
6231
- exports.ɵz = SharedServicesService;
6331
+ exports.ɵm = ApiAdapterServiceService;
6332
+ exports.ɵn = ViewingListOfCampaignTableComponent;
6333
+ exports.ɵo = FilterInListOfCampaignComponent;
6334
+ exports.ɵp = ApiAdapterServiceService;
6335
+ exports.ɵq = MatSelectInfiniteScrollDirective;
6336
+ exports.ɵr = InputNumericModule;
6337
+ exports.ɵs = InputNumericComponent;
6338
+ exports.ɵt = CustomPaginator;
6339
+ exports.ɵu = ConfirmationComponent;
6340
+ exports.ɵv = ConfirmationModel;
6341
+ exports.ɵw = SharedServicesService;
6232
6342
 
6233
6343
  Object.defineProperty(exports, '__esModule', { value: true });
6234
6344