@adlfe/campaign-management-library 2.11.11 → 2.13.1

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 (35) 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 +422 -265
  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/environments/environment.js +3 -3
  9. package/esm2015/lib/campaign-management/models/general-information-wa-req.model.js +37 -9
  10. package/esm2015/lib/campaign-management/models/template-wa.model.js +1 -1
  11. package/esm2015/lib/campaign-management/modules/campaign-index/component/filter-in-list-of-campaign/filter-in-list-of-campaign.component.js +1 -1
  12. package/esm2015/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +328 -223
  13. package/esm2015/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +6 -12
  14. package/esm2015/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +24 -11
  15. package/esm2015/lib/core/const/validation-message.const.js +2 -1
  16. package/esm2015/public-api.js +6 -1
  17. package/esm5/adlfe-campaign-management-library.js +12 -15
  18. package/esm5/environments/environment.js +3 -3
  19. package/esm5/lib/campaign-management/models/general-information-wa-req.model.js +38 -9
  20. package/esm5/lib/campaign-management/models/template-wa.model.js +1 -1
  21. package/esm5/lib/campaign-management/modules/campaign-index/component/filter-in-list-of-campaign/filter-in-list-of-campaign.component.js +1 -1
  22. package/esm5/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +341 -222
  23. package/esm5/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +6 -12
  24. package/esm5/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +24 -11
  25. package/esm5/lib/core/const/validation-message.const.js +2 -1
  26. package/esm5/public-api.js +6 -1
  27. package/fesm2015/adlfe-campaign-management-library.js +394 -253
  28. package/fesm2015/adlfe-campaign-management-library.js.map +1 -1
  29. package/fesm5/adlfe-campaign-management-library.js +407 -252
  30. package/fesm5/adlfe-campaign-management-library.js.map +1 -1
  31. package/lib/campaign-management/models/general-information-wa-req.model.d.ts +5 -0
  32. package/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.d.ts +10 -3
  33. package/lib/core/const/validation-message.const.d.ts +4 -0
  34. package/package.json +1 -1
  35. package/public-api.d.ts +5 -0
@@ -813,11 +813,11 @@ else if (origin.includes('dashboard-qa')) {
813
813
  }
814
814
  // 4. Cek Demo Dev secara spesifik
815
815
  else if (origin.includes('demo-dev')) {
816
- API_CONST = 'https://apibsp-dev.adlsandbox.net';
816
+ API_CONST = 'https://api-staging.neuapix.com';
817
817
  }
818
818
  // 5. Default (Localhost atau lainnya)
819
819
  else {
820
- API_CONST = 'https://apibsp-dev.adlsandbox.net';
820
+ API_CONST = 'https://api-staging.neuapix.com';
821
821
  }
822
822
  var environment = {
823
823
  production: false,
@@ -1440,6 +1440,7 @@ var GeneralInformationWAMessageValidationConst = {
1440
1440
  catalogue: [{ type: 'required', message: 'Catalog is required' }],
1441
1441
  product: [{ type: 'required', message: 'Product is required' }],
1442
1442
  body: [{ type: 'maxlength', message: 'Maximum character 100' }],
1443
+ paramName: [{ type: 'required', message: 'Variable Name is required' }],
1443
1444
  };
1444
1445
  var GeneralInformationEmailMessageValidationConst = {
1445
1446
  channel: [{ type: 'required', message: 'Message Type is required' }],
@@ -1733,7 +1734,7 @@ var FilterInListOfCampaignComponent = /** @class */ (function () {
1733
1734
  Component({
1734
1735
  selector: 'lib-filter-in-list-of-campaign',
1735
1736
  template: "<p class=\"font-16px font-bold\">Filter</p>\r\n\r\n<form [formGroup]=\"form\" class=\"contact-filter\">\r\n <div class=\"row\">\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-70\">\r\n <mat-label>Business Name</mat-label>\r\n <mat-select placeholder=\"Select Business Name\" formControlName=\"businessName\">\r\n <div class=\"select-search\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n (searchRes)=\"businessNameSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option value=\"\"> --- select none --- </mat-option>\r\n <mat-option\r\n *ngFor=\"let option of filteredBusinessNameOption\"\r\n [value]=\"option.id\"\r\n >\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"!filteredBusinessNameOption.length\" disabled>\r\n No data found\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-70\">\r\n <mat-label>Channel</mat-label>\r\n\r\n <mat-select placeholder=\"Select the Channel\" formControlName=\"medium\">\r\n <mat-option value=\"\"> --- select none --- </mat-option>\r\n <mat-option\r\n *ngFor=\"let option of filteredChannelOption\"\r\n [value]=\"option.value\"\r\n (click)=\"getTemplateOptionService()\"\r\n >\r\n {{ option.label }}\r\n </mat-option>\r\n <mat-option *ngIf=\"!filteredChannelOption.length\" disabled>\r\n No data found\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template Name</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"templateName\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('templateName').value?.name\"\r\n (searchRes)=\"templateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-70\">\r\n <mat-label>Status</mat-label>\r\n\r\n <mat-select placeholder=\"Select the Status\" formControlName=\"status\">\r\n <div class=\"select-search\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n (searchRes)=\"statusSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option value=\"\"> --- select none --- </mat-option>\r\n <mat-option\r\n *ngFor=\"let option of filteredStatusOption\"\r\n [value]=\"option.value\"\r\n >\r\n {{ option.label }}\r\n </mat-option>\r\n <mat-option *ngIf=\"!filteredStatusOption.length\" disabled>\r\n No data found\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label> Start Date </mat-label>\r\n <input\r\n matInput\r\n [matDatepicker]=\"startDatePicker\"\r\n formControlName=\"startDate\"\r\n class=\"mat-datepicker-input\"\r\n (dateChange)=\"validateBackDate()\"\r\n />\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"startDatePicker\">\r\n </mat-datepicker-toggle>\r\n <mat-icon\r\n *ngIf=\"form.get('startDate').value\"\r\n matDatepickerToggleIcon\r\n (click)=\"clearDate()\"\r\n >clear</mat-icon\r\n >\r\n <mat-datepicker #startDatePicker></mat-datepicker>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col-md-12 col-12\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label> End Date </mat-label>\r\n <input\r\n matInput\r\n [min]=\"form.get('startDate').value\"\r\n [matDatepicker]=\"endDatePicker\"\r\n formControlName=\"endDate\"\r\n class=\"mat-datepicker-input\"\r\n (dateChange)=\"validateBackDate()\"\r\n />\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"endDatePicker\"> </mat-datepicker-toggle>\r\n <mat-icon\r\n *ngIf=\"form.get('endDate').value\"\r\n matDatepickerToggleIcon\r\n (click)=\"clearDate()\"\r\n >clear</mat-icon\r\n >\r\n <mat-datepicker #endDatePicker></mat-datepicker>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <div style=\"display: flex; flex: 1; width: 100%\">\r\n <button\r\n mat-stroked-button\r\n color=\"primary-telin\"\r\n class=\"telin-font-color w-48\"\r\n style=\"width: 100%; margin-bottom: 10px\"\r\n (click)=\"onReset()\"\r\n >\r\n Reset\r\n </button>\r\n </div>\r\n <div class=\"d-flex justify-content-between\">\r\n <button mat-stroked-button color=\"secondary-telin\" class=\"w-48\" (click)=\"onCancel()\">\r\n Cancel\r\n </button>\r\n\r\n <button mat-flat-button color=\"primary-telin-blue2\" class=\"w-48\" (click)=\"onApply()\">\r\n Apply\r\n </button>\r\n </div>\r\n </div>\r\n</form>\r\n",
1736
- styles: [".contact-filter .platform{display:-ms-grid;display:grid;grid-gap:5px;-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto}.button-row{margin:8px 8px 8px 0}.mat-datepicker-input{width:85%}.mat-icon{position:relative;float:right;top:-7px;cursor:pointer;color:rgba(0,0,0,.54)}.select-search{margin:20px}"]
1737
+ styles: [".contact-filter .platform{display:grid;grid-gap:5px;grid-template-columns:auto 1fr auto}.button-row{margin:8px 8px 8px 0}.mat-datepicker-input{width:85%}.mat-icon{position:relative;float:right;top:-7px;cursor:pointer;color:rgba(0,0,0,.54)}.select-search{margin:20px}"]
1737
1738
  }),
1738
1739
  Injectable({
1739
1740
  providedIn: 'root',
@@ -2506,14 +2507,12 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2506
2507
  function GeneralInformationWAReqModel() {
2507
2508
  }
2508
2509
  GeneralInformationWAReqModel.prototype.clone = function (source) {
2509
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2510
- /* Source Mapping */
2510
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2511
2511
  if (((_a = source) === null || _a === void 0 ? void 0 : _a.media) === 'IMAGE' ||
2512
2512
  ((_b = source) === null || _b === void 0 ? void 0 : _b.media) === 'VIDEO' ||
2513
2513
  ((_c = source) === null || _c === void 0 ? void 0 : _c.media) === 'DOCUMENT') {
2514
2514
  source.channel = source.media;
2515
2515
  }
2516
- /* ./ Source Mapping */
2517
2516
  if (source.campaignName) {
2518
2517
  this.name = source.campaignName;
2519
2518
  }
@@ -2545,6 +2544,12 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2545
2544
  fileName: source.fileName,
2546
2545
  };
2547
2546
  }
2547
+ if (source.buttonParams && Array.isArray(source.buttonParams)) {
2548
+ this.buttonParams = source.buttonParams.map(function (btn) { return ({
2549
+ label: btn.label,
2550
+ payload: btn.payload ? btn.payload : btn.label,
2551
+ }); });
2552
+ }
2548
2553
  if (source.template) {
2549
2554
  this.template = {
2550
2555
  id: source.template.ID,
@@ -2552,12 +2557,21 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2552
2557
  lang: source.template.lang,
2553
2558
  headerUrl: source.targetURL,
2554
2559
  header: (_g = (_f = source.paramHeader) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.name; }), (_g !== null && _g !== void 0 ? _g : [])),
2555
- data: (_j = (_h = source.paramBody) === null || _h === void 0 ? void 0 : _h.map(function (t) { return t.name; }), (_j !== null && _j !== void 0 ? _j : [])),
2556
- button: (_k = source.paramButton) === null || _k === void 0 ? void 0 : _k.reduce(function (result, each) {
2560
+ data: ((_h = source.variables) === null || _h === void 0 ? void 0 : _h.length) ? source.variables.map(function (v) { return v.paramName; })
2561
+ : (_k = (_j = source.paramBody) === null || _j === void 0 ? void 0 : _j.map(function (t) { return t.name; }), (_k !== null && _k !== void 0 ? _k : [])),
2562
+ button: (_l = source.paramButton) === null || _l === void 0 ? void 0 : _l.reduce(function (result, each) {
2557
2563
  var _a;
2558
2564
  result.push((_a = each.name.map(function (t) { return t.name; }), (_a !== null && _a !== void 0 ? _a : [])));
2559
2565
  return result;
2560
2566
  }, []),
2567
+ buttonParams: source.buttonParams
2568
+ ? source.buttonParams.map(function (btn) {
2569
+ return {
2570
+ label: btn.label,
2571
+ payload: btn.payload ? btn.payload : btn.label,
2572
+ };
2573
+ })
2574
+ : [],
2561
2575
  };
2562
2576
  if (source.template.category === 'AUTHENTICATION')
2563
2577
  this.template = {
@@ -2566,6 +2580,7 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2566
2580
  header: null,
2567
2581
  data: [source.otpValue],
2568
2582
  button: [[source.otpValue]],
2583
+ buttonParams: [],
2569
2584
  };
2570
2585
  if (source.template.ID)
2571
2586
  this.template.id = source.template.ID;
@@ -2573,11 +2588,25 @@ var GeneralInformationWAReqModel = /** @class */ (function () {
2573
2588
  if (this.type === 'utility') {
2574
2589
  this.type = 'template';
2575
2590
  this.category = 'utility';
2576
- this.template = ((_l = source) === null || _l === void 0 ? void 0 : _l.isUseExistingTemplate) ? (_m = source) === null || _m === void 0 ? void 0 : _m.template : { name: '', lang: 'id', header: null, button: null, data: [] };
2591
+ var mappedVariables = ((_o = (_m = source) === null || _m === void 0 ? void 0 : _m.variables) === null || _o === void 0 ? void 0 : _o.length) ? source.variables.map(function (v) { return v.paramName; })
2592
+ : [];
2593
+ if ((_p = source) === null || _p === void 0 ? void 0 : _p.isUseExistingTemplate) {
2594
+ this.template = __assign(__assign({}, source.template), { data: mappedVariables.length > 0 ? mappedVariables : source.template.data || [] });
2595
+ }
2596
+ else {
2597
+ this.template = {
2598
+ name: '',
2599
+ lang: 'id',
2600
+ header: null,
2601
+ button: null,
2602
+ data: mappedVariables,
2603
+ buttonParams: [],
2604
+ };
2605
+ }
2577
2606
  this.isNeedSave = source.isNeedSave;
2578
2607
  this.ttlSeconds = source.ttl;
2579
- if ((_o = source) === null || _o === void 0 ? void 0 : _o.isUseExistingTemplate) {
2580
- this.text = (_r = (_q = (_p = source) === null || _p === void 0 ? void 0 : _p.template) === null || _q === void 0 ? void 0 : _q.body) === null || _r === void 0 ? void 0 : _r.text;
2608
+ if ((_q = source) === null || _q === void 0 ? void 0 : _q.isUseExistingTemplate) {
2609
+ this.text = ((_r = source) === null || _r === void 0 ? void 0 : _r.text) || ((_u = (_t = (_s = source) === null || _s === void 0 ? void 0 : _s.template) === null || _t === void 0 ? void 0 : _t.body) === null || _u === void 0 ? void 0 : _u.text);
2581
2610
  }
2582
2611
  }
2583
2612
  return this;
@@ -4128,9 +4157,8 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4128
4157
  };
4129
4158
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getCampaignStorage", {
4130
4159
  get: function () {
4131
- return localStorage.getItem('telin.campaign')
4132
- ? JSON.parse(localStorage.getItem('telin.campaign'))
4133
- : {};
4160
+ var campaignData = localStorage.getItem('telin.campaign');
4161
+ return campaignData ? JSON.parse(campaignData) : {};
4134
4162
  },
4135
4163
  enumerable: true,
4136
4164
  configurable: true
@@ -4162,6 +4190,10 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4162
4190
  isUseExistingTemplate: new FormControl(false),
4163
4191
  isNeedSave: new FormControl(false),
4164
4192
  ttl: new FormControl(null),
4193
+ isDownloadVariableXLS: new FormControl(false),
4194
+ variables: new FormArray([]),
4195
+ useXlsx: new FormControl(false),
4196
+ buttonParams: new FormArray([]),
4165
4197
  });
4166
4198
  this.form.valueChanges.subscribe(function () {
4167
4199
  setTimeout(function () {
@@ -4176,133 +4208,152 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4176
4208
  this.form.disable();
4177
4209
  };
4178
4210
  GeneralInformationWAComponent.prototype.initEdit = function () {
4179
- 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;
4180
- if (Object.entries(this.getCampaignStorage).length === 0 ||
4181
- ((_c = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA')
4211
+ var _this = this;
4212
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
4213
+ var storageData = this.getCampaignStorage;
4214
+ var formValues = (_b = (_a = storageData) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
4215
+ if (!storageData ||
4216
+ Object.entries(storageData).length === 0 ||
4217
+ ((_c = formValues) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA') {
4182
4218
  return;
4183
- this.form
4184
- .get('channel')
4185
- .setValue((_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.generalInformation) === null || _e === void 0 ? void 0 : _e.form.channel);
4186
- 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);
4187
- 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);
4188
- 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);
4189
- this.form
4190
- .get('targetURL')
4191
- .setValue((_o = (_m = this.getCampaignStorage) === null || _m === void 0 ? void 0 : _m.generalInformation) === null || _o === void 0 ? void 0 : _o.form.targetURL);
4192
- this.form
4193
- .get('fileName')
4194
- .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)));
4195
- this.form
4196
- .get('template')
4197
- .setValue((_t = (_s = this.getCampaignStorage) === null || _s === void 0 ? void 0 : _s.generalInformation) === null || _t === void 0 ? void 0 : _t.form.template);
4198
- this.form
4199
- .get('isUpload')
4200
- .setValue((_v = (_u = this.getCampaignStorage) === null || _u === void 0 ? void 0 : _u.generalInformation) === null || _v === void 0 ? void 0 : _v.form.isUpload);
4201
- 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);
4202
- this.form
4203
- .get('otpValue')
4204
- .setValue((_z = (_y = this.getCampaignStorage) === null || _y === void 0 ? void 0 : _y.generalInformation) === null || _z === void 0 ? void 0 : _z.form.otpValue);
4205
- this.form
4206
- .get('isUseExistingTemplate')
4207
- .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));
4208
- this.form
4209
- .get('isNeedSave')
4210
- .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));
4211
- 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);
4212
- this.isHaveTemplateParam = this.form.get('isUpload').value;
4213
- this.getTemplateOptionService(null, (_9 = this.form.get('template').value) === null || _9 === void 0 ? void 0 : _9.name);
4219
+ }
4220
+ (_d = this.getControl('channel')) === null || _d === void 0 ? void 0 : _d.setValue((_e = formValues) === null || _e === void 0 ? void 0 : _e.channel);
4221
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValue((_g = formValues) === null || _g === void 0 ? void 0 : _g.media);
4222
+ (_h = this.getControl('from')) === null || _h === void 0 ? void 0 : _h.setValue((_j = formValues) === null || _j === void 0 ? void 0 : _j.from);
4223
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.setValue((_l = formValues) === null || _l === void 0 ? void 0 : _l.text);
4224
+ (_m = this.getControl('targetURL')) === null || _m === void 0 ? void 0 : _m.setValue((_o = formValues) === null || _o === void 0 ? void 0 : _o.targetURL);
4225
+ (_p = this.getControl('fileName')) === null || _p === void 0 ? void 0 : _p.setValue((_r = (_q = formValues) === null || _q === void 0 ? void 0 : _q.fileName, (_r !== null && _r !== void 0 ? _r : (_s = this.getControl('targetURL')) === null || _s === void 0 ? void 0 : _s.value)));
4226
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.setValue((_u = formValues) === null || _u === void 0 ? void 0 : _u.template);
4227
+ (_v = this.getControl('isUpload')) === null || _v === void 0 ? void 0 : _v.setValue((_w = formValues) === null || _w === void 0 ? void 0 : _w.isUpload);
4228
+ (_x = this.getControl('fileId')) === null || _x === void 0 ? void 0 : _x.setValue((_y = formValues) === null || _y === void 0 ? void 0 : _y.fileId);
4229
+ (_z = this.getControl('otpValue')) === null || _z === void 0 ? void 0 : _z.setValue((_0 = formValues) === null || _0 === void 0 ? void 0 : _0.otpValue);
4230
+ (_1 = this.getControl('isUseExistingTemplate')) === null || _1 === void 0 ? void 0 : _1.setValue(!!((_2 = formValues) === null || _2 === void 0 ? void 0 : _2.templateName));
4231
+ (_3 = this.getControl('isNeedSave')) === null || _3 === void 0 ? void 0 : _3.setValue(!!((_4 = formValues) === null || _4 === void 0 ? void 0 : _4.isNeedSave));
4232
+ (_5 = this.getControl('ttl')) === null || _5 === void 0 ? void 0 : _5.setValue((_6 = formValues) === null || _6 === void 0 ? void 0 : _6.ttl);
4233
+ var savedVariables = (_7 = formValues) === null || _7 === void 0 ? void 0 : _7.variables;
4234
+ if (savedVariables && Array.isArray(savedVariables) && savedVariables.length > 0) {
4235
+ this.variables.clear();
4236
+ savedVariables.forEach(function (item) {
4237
+ _this.variables.push(new FormGroup({
4238
+ paramName: new FormControl({ value: item.paramName || '', disabled: _this.isReadOnlyMode }, Validators$1.required),
4239
+ }));
4240
+ });
4241
+ }
4242
+ this.isHaveTemplateParam = (_8 = this.getControl('isUpload')) === null || _8 === void 0 ? void 0 : _8.value;
4243
+ this.getTemplateOptionService(null, (_10 = (_9 = this.getControl('template')) === null || _9 === void 0 ? void 0 : _9.value) === null || _10 === void 0 ? void 0 : _10.name);
4214
4244
  };
4215
4245
  GeneralInformationWAComponent.prototype.initValidation = function () {
4246
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
4247
+ if (!this.form)
4248
+ return;
4216
4249
  for (var key in this.form.controls) {
4217
- this.form.controls[key].clearValidators();
4218
- this.form.controls[key].updateValueAndValidity();
4250
+ if (this.form.controls[key]) {
4251
+ this.form.controls[key].clearValidators();
4252
+ this.form.controls[key].updateValueAndValidity();
4253
+ }
4219
4254
  }
4220
- this.form.get('channel').setValidators(Validators$1.required);
4255
+ (_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.setValidators(Validators$1.required);
4221
4256
  if (this.getIsText) {
4222
- this.form.get('from').setValidators(Validators$1.required);
4223
- this.form.get('text').setValidators(Validators$1.required);
4224
- this.form.get('from').updateValueAndValidity();
4225
- this.form.get('text').updateValueAndValidity();
4257
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.setValidators(Validators$1.required);
4258
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.setValidators(Validators$1.required);
4259
+ (_d = this.getControl('from')) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4260
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4226
4261
  }
4227
4262
  else if (this.getIsMedia) {
4228
- this.form.get('media').setValidators(Validators$1.required);
4229
- this.form.get('from').setValidators(Validators$1.required);
4230
- this.form.get('fileName').setValidators(Validators$1.required);
4231
- this.form.get('media').updateValueAndValidity();
4232
- this.form.get('from').updateValueAndValidity();
4233
- this.form.get('fileName').updateValueAndValidity();
4263
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValidators(Validators$1.required);
4264
+ (_g = this.getControl('from')) === null || _g === void 0 ? void 0 : _g.setValidators(Validators$1.required);
4265
+ (_h = this.getControl('fileName')) === null || _h === void 0 ? void 0 : _h.setValidators(Validators$1.required);
4266
+ (_j = this.getControl('media')) === null || _j === void 0 ? void 0 : _j.updateValueAndValidity();
4267
+ (_k = this.getControl('from')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4268
+ (_l = this.getControl('fileName')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
4234
4269
  }
4235
4270
  else if (this.getIsTemplate) {
4236
- this.form.get('from').setValidators(Validators$1.required);
4237
- this.form.get('template').setValidators(Validators$1.required);
4238
- this.form.get('paramHeader').setValidators(Validators$1.required);
4239
- this.form.get('paramBody').setValidators(Validators$1.required);
4240
- this.form.get('paramButton').setValidators(Validators$1.required);
4241
- this.form.get('from').updateValueAndValidity();
4242
- this.form.get('template').updateValueAndValidity();
4243
- this.form.get('paramHeader').updateValueAndValidity();
4244
- this.form.get('paramBody').updateValueAndValidity();
4245
- this.form.get('paramButton').updateValueAndValidity();
4271
+ (_m = this.getControl('from')) === null || _m === void 0 ? void 0 : _m.setValidators(Validators$1.required);
4272
+ (_o = this.getControl('template')) === null || _o === void 0 ? void 0 : _o.setValidators(Validators$1.required);
4273
+ (_p = this.getControl('paramHeader')) === null || _p === void 0 ? void 0 : _p.setValidators(Validators$1.required);
4274
+ (_q = this.getControl('paramBody')) === null || _q === void 0 ? void 0 : _q.setValidators(Validators$1.required);
4275
+ (_r = this.getControl('paramButton')) === null || _r === void 0 ? void 0 : _r.setValidators(Validators$1.required);
4276
+ (_s = this.getControl('from')) === null || _s === void 0 ? void 0 : _s.updateValueAndValidity();
4277
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.updateValueAndValidity();
4278
+ (_u = this.getControl('paramHeader')) === null || _u === void 0 ? void 0 : _u.updateValueAndValidity();
4279
+ (_v = this.getControl('paramBody')) === null || _v === void 0 ? void 0 : _v.updateValueAndValidity();
4280
+ (_w = this.getControl('paramButton')) === null || _w === void 0 ? void 0 : _w.updateValueAndValidity();
4246
4281
  }
4247
4282
  else if (this.getIsCatalogue) {
4248
- this.form.get('from').setValidators(Validators$1.required);
4249
- this.form.get('category').setValidators(Validators$1.required);
4250
- this.form.get('catalogue').setValidators(Validators$1.required);
4251
- this.form.get('product').setValidators(Validators$1.required);
4252
- this.form.get('body').setValidators(Validators$1.maxLength(100));
4253
- this.form.get('from').updateValueAndValidity();
4254
- this.form.get('category').updateValueAndValidity();
4255
- this.form.get('catalogue').updateValueAndValidity();
4256
- this.form.get('product').updateValueAndValidity();
4257
- this.form.get('body').updateValueAndValidity();
4283
+ (_x = this.getControl('from')) === null || _x === void 0 ? void 0 : _x.setValidators(Validators$1.required);
4284
+ (_y = this.getControl('category')) === null || _y === void 0 ? void 0 : _y.setValidators(Validators$1.required);
4285
+ (_z = this.getControl('catalogue')) === null || _z === void 0 ? void 0 : _z.setValidators(Validators$1.required);
4286
+ (_0 = this.getControl('product')) === null || _0 === void 0 ? void 0 : _0.setValidators(Validators$1.required);
4287
+ (_1 = this.getControl('body')) === null || _1 === void 0 ? void 0 : _1.setValidators(Validators$1.maxLength(100));
4288
+ (_2 = this.getControl('from')) === null || _2 === void 0 ? void 0 : _2.updateValueAndValidity();
4289
+ (_3 = this.getControl('category')) === null || _3 === void 0 ? void 0 : _3.updateValueAndValidity();
4290
+ (_4 = this.getControl('catalogue')) === null || _4 === void 0 ? void 0 : _4.updateValueAndValidity();
4291
+ (_5 = this.getControl('product')) === null || _5 === void 0 ? void 0 : _5.updateValueAndValidity();
4292
+ (_6 = this.getControl('body')) === null || _6 === void 0 ? void 0 : _6.updateValueAndValidity();
4258
4293
  }
4259
4294
  else if (this.getIsUtility) {
4260
- this.form.get('from').setValidators(Validators$1.required);
4261
- this.form.get('text').setValidators([Validators$1.required, Validators$1.maxLength(1024)]);
4262
- this.form
4263
- .get('ttl')
4264
- .setValidators([
4295
+ (_7 = this.getControl('from')) === null || _7 === void 0 ? void 0 : _7.setValidators(Validators$1.required);
4296
+ (_8 = this.getControl('text')) === null || _8 === void 0 ? void 0 : _8.setValidators([
4297
+ Validators$1.required,
4298
+ Validators$1.maxLength(1024),
4299
+ ]);
4300
+ (_9 = this.getControl('ttl')) === null || _9 === void 0 ? void 0 : _9.setValidators([
4265
4301
  Validators.min(30, 'Minimum TTL 30'),
4266
4302
  Validators.max(43200, 'Maximum TTL 43200'),
4267
4303
  ]);
4268
- this.form.get('from').updateValueAndValidity();
4269
- this.form.get('text').updateValueAndValidity();
4270
- this.form.get('ttl').updateValueAndValidity();
4304
+ (_10 = this.getControl('from')) === null || _10 === void 0 ? void 0 : _10.updateValueAndValidity();
4305
+ (_11 = this.getControl('text')) === null || _11 === void 0 ? void 0 : _11.updateValueAndValidity();
4306
+ (_12 = this.getControl('ttl')) === null || _12 === void 0 ? void 0 : _12.updateValueAndValidity();
4307
+ (_13 = this.getControl('variables')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4271
4308
  }
4272
4309
  else {
4273
- this.form.get('from').setValidators(Validators$1.required);
4274
- this.form.get('text').setValidators(Validators$1.required);
4275
- this.form.get('from').updateValueAndValidity();
4276
- this.form.get('text').updateValueAndValidity();
4310
+ (_14 = this.getControl('from')) === null || _14 === void 0 ? void 0 : _14.setValidators(Validators$1.required);
4311
+ (_15 = this.getControl('text')) === null || _15 === void 0 ? void 0 : _15.setValidators(Validators$1.required);
4312
+ (_16 = this.getControl('from')) === null || _16 === void 0 ? void 0 : _16.updateValueAndValidity();
4313
+ (_17 = this.getControl('text')) === null || _17 === void 0 ? void 0 : _17.updateValueAndValidity();
4277
4314
  }
4278
4315
  };
4279
4316
  GeneralInformationWAComponent.prototype.formReset = function (_isMediaType) {
4280
4317
  if (_isMediaType === void 0) { _isMediaType = false; }
4318
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4281
4319
  if (!_isMediaType) {
4282
- this.form.get('media').reset();
4283
- this.form.get('from').reset();
4320
+ (_a = this.getControl('media')) === null || _a === void 0 ? void 0 : _a.reset();
4321
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.reset();
4322
+ }
4323
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.reset();
4324
+ (_d = this.getControl('fileName')) === null || _d === void 0 ? void 0 : _d.reset();
4325
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.reset();
4326
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.reset();
4327
+ (_g = this.getControl('file')) === null || _g === void 0 ? void 0 : _g.reset();
4328
+ (_h = this.getControl('latitude')) === null || _h === void 0 ? void 0 : _h.reset();
4329
+ (_j = this.getControl('longitude')) === null || _j === void 0 ? void 0 : _j.reset();
4330
+ (_k = this.getControl('template')) === null || _k === void 0 ? void 0 : _k.reset();
4331
+ (_l = this.getControl('category')) === null || _l === void 0 ? void 0 : _l.reset();
4332
+ (_m = this.getControl('product')) === null || _m === void 0 ? void 0 : _m.reset();
4333
+ (_o = this.getControl('catalogue')) === null || _o === void 0 ? void 0 : _o.reset();
4334
+ (_p = this.getControl('body')) === null || _p === void 0 ? void 0 : _p.reset();
4335
+ (_q = this.getControl('otpValue')) === null || _q === void 0 ? void 0 : _q.reset();
4336
+ (_r = this.getControl('variables')) === null || _r === void 0 ? void 0 : _r.reset();
4337
+ var paramHeader = this.getControl('paramHeader');
4338
+ if (paramHeader) {
4339
+ paramHeader.clear();
4340
+ paramHeader.reset();
4341
+ }
4342
+ var paramBody = this.getControl('paramBody');
4343
+ if (paramBody) {
4344
+ paramBody.clear();
4345
+ paramBody.reset();
4346
+ }
4347
+ var paramButton = this.getControl('paramButton');
4348
+ if (paramButton) {
4349
+ paramButton.clear();
4350
+ paramButton.reset();
4284
4351
  }
4285
- this.form.get('text').reset();
4286
- this.form.get('fileName').reset();
4287
- this.form.get('targetURL').reset();
4288
- this.form.get('fileType').reset();
4289
- this.form.get('file').reset();
4290
- this.form.get('latitude').reset();
4291
- this.form.get('longitude').reset();
4292
- this.form.get('template').reset();
4293
- this.form.get('category').reset();
4294
- this.form.get('product').reset();
4295
- this.form.get('catalogue').reset();
4296
- this.form.get('body').reset();
4297
- this.form.get('otpValue').reset();
4298
- this.form.get('paramHeader').controls = [];
4299
- this.form.get('paramHeader').reset();
4300
- this.form.get('paramBody').controls = [];
4301
- this.form.get('paramBody').reset();
4302
- this.form.get('paramButton').controls = [];
4303
- this.form.get('paramButton').reset();
4304
4352
  this.initValidation();
4305
4353
  };
4354
+ GeneralInformationWAComponent.prototype.getControl = function (controlName) {
4355
+ return this.form ? this.form.get(controlName) : null;
4356
+ };
4306
4357
  GeneralInformationWAComponent.prototype.initParam = function (_name, _value, _type) {
4307
4358
  return {
4308
4359
  name: _name,
@@ -4326,10 +4377,11 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4326
4377
  var subs = this.apiAdapterService
4327
4378
  .executeApiRequest(parameterList, '/admin/account', 'GET')
4328
4379
  .subscribe(function (resp) {
4380
+ var _a;
4329
4381
  if (!resp.data)
4330
4382
  return;
4331
4383
  _this.accountOption = isInfinite ? __spread(_this.accountOption, resp.data) : resp.data;
4332
- _this.isHaveNextAccountOption = resp.haveNext;
4384
+ _this.isHaveNextAccountOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4333
4385
  _this.isLoadingAccountOption = false;
4334
4386
  });
4335
4387
  this.subscribers.push(subs);
@@ -4339,7 +4391,7 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4339
4391
  if (event === void 0) { event = null; }
4340
4392
  if (filter === void 0) { filter = ''; }
4341
4393
  if (isInfinite === void 0) { isInfinite = false; }
4342
- var _a, _b, _c, _d;
4394
+ var _a, _b, _c, _d, _e, _f, _g;
4343
4395
  this.isLoadingTemplateOption = true;
4344
4396
  var parameterList = [
4345
4397
  this.initParam('pageNo', this.pageNoTemplateOption, 'number'),
@@ -4347,30 +4399,31 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4347
4399
  this.initParam('platform', 'WA', 'string'),
4348
4400
  this.initParam('filter', filter, 'string'),
4349
4401
  this.initParam('status', 'APPROVED', 'string'),
4350
- this.initParam('clientId', (_a = this.form.get('from').value) === null || _a === void 0 ? void 0 : _a.clientId, 'string'),
4351
- this.initParam('wabaId', (_c = (_b = this.form.get('from').value) === null || _b === void 0 ? void 0 : _b.wabaId, (_c !== null && _c !== void 0 ? _c : '')), 'string'),
4402
+ this.initParam('clientId', (_c = (_b = (_a = this.getControl('from')) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.clientId, (_c !== null && _c !== void 0 ? _c : '')), 'string'),
4403
+ this.initParam('wabaId', (_f = (_e = (_d = this.getControl('from')) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.wabaId, (_f !== null && _f !== void 0 ? _f : '')), 'string'),
4352
4404
  ];
4353
4405
  if (this.isReadOnlyMode)
4354
4406
  parameterList.push(this.initParam('summary', true, 'string'));
4355
- var messageType = (_d = this.form.value) === null || _d === void 0 ? void 0 : _d.channel;
4407
+ var messageType = (_g = this.form.value) === null || _g === void 0 ? void 0 : _g.channel;
4356
4408
  if (messageType === 'utility') {
4357
4409
  parameterList.push(this.initParam('isDirectSend', true, 'string'));
4358
4410
  }
4359
4411
  var subs = this.apiAdapterService
4360
4412
  .executeApiRequest(parameterList, '/message/template', 'GET')
4361
4413
  .subscribe(function (resp) {
4362
- var _a;
4363
- _this.templateOption = isInfinite
4364
- ? __spread(_this.templateOption, resp.data) : resp.data;
4365
- _this.isHaveNextTemplateOption = resp.haveNext;
4414
+ var _a, _b, _c, _d, _e, _f;
4415
+ var currentOptions = _this.templateOption || [];
4416
+ var newData = resp.data || [];
4417
+ _this.templateOption = isInfinite ? __spread(currentOptions, newData) : newData;
4418
+ _this.isHaveNextTemplateOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4366
4419
  _this.isLoadingTemplateOption = false;
4367
- var template = (_a = _this.templateOption) === null || _a === void 0 ? void 0 : _a.find(function (t) { var _a; return t.ID === ((_a = _this.form.get('template').value) === null || _a === void 0 ? void 0 : _a.ID); });
4420
+ var template = (_b = _this.templateOption) === null || _b === void 0 ? void 0 : _b.find(function (t) { var _a, _b; return t.ID === ((_b = (_a = _this.getControl('template')) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.ID); });
4368
4421
  if (template) {
4369
- _this.form.get('template').setValue(template);
4370
- if (_this.form.get('isUpload').value)
4371
- return _this.updateDownloadCSV(_this.form.get('isUpload').value);
4422
+ (_c = _this.getControl('template')) === null || _c === void 0 ? void 0 : _c.patchValue(template);
4423
+ if ((_d = _this.getControl('isUpload')) === null || _d === void 0 ? void 0 : _d.value)
4424
+ return _this.updateDownloadCSV((_e = _this.getControl('isUpload')) === null || _e === void 0 ? void 0 : _e.value);
4372
4425
  }
4373
- _this.updateTemplate(_this.form.get('template').value);
4426
+ _this.updateTemplate((_f = _this.getControl('template')) === null || _f === void 0 ? void 0 : _f.value);
4374
4427
  });
4375
4428
  this.subscribers.push(subs);
4376
4429
  };
@@ -4430,45 +4483,45 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4430
4483
  };
4431
4484
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsText", {
4432
4485
  get: function () {
4433
- var _a;
4434
- return (this.form.get('channel').value &&
4435
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'text');
4486
+ var _a, _b, _c;
4487
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4488
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'text');
4436
4489
  },
4437
4490
  enumerable: true,
4438
4491
  configurable: true
4439
4492
  });
4440
4493
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsMedia", {
4441
4494
  get: function () {
4442
- var _a;
4443
- return (this.form.get('channel').value &&
4444
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'media');
4495
+ var _a, _b, _c;
4496
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4497
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'media');
4445
4498
  },
4446
4499
  enumerable: true,
4447
4500
  configurable: true
4448
4501
  });
4449
4502
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsTemplate", {
4450
4503
  get: function () {
4451
- var _a;
4452
- return (this.form.get('channel').value &&
4453
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'template');
4504
+ var _a, _b, _c;
4505
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4506
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'template');
4454
4507
  },
4455
4508
  enumerable: true,
4456
4509
  configurable: true
4457
4510
  });
4458
4511
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsCatalogue", {
4459
4512
  get: function () {
4460
- var _a;
4461
- return (this.form.get('channel').value &&
4462
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'catalogue');
4513
+ var _a, _b, _c;
4514
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4515
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'catalogue');
4463
4516
  },
4464
4517
  enumerable: true,
4465
4518
  configurable: true
4466
4519
  });
4467
4520
  Object.defineProperty(GeneralInformationWAComponent.prototype, "getIsUtility", {
4468
4521
  get: function () {
4469
- var _a;
4470
- return (this.form.get('channel').value &&
4471
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'utility');
4522
+ var _a, _b, _c;
4523
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4524
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'utility');
4472
4525
  },
4473
4526
  enumerable: true,
4474
4527
  configurable: true
@@ -4496,6 +4549,7 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4496
4549
  : '';
4497
4550
  };
4498
4551
  GeneralInformationWAComponent.prototype.onFileSelected = function (event) {
4552
+ var _a, _b, _c, _d, _e, _f;
4499
4553
  var file = event.target.files;
4500
4554
  var accept = this.extFileAccepted.split('/');
4501
4555
  var matchType = accept[0];
@@ -4511,21 +4565,22 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4511
4565
  this.toastr.error('Upload media failed, max size 10mb');
4512
4566
  return;
4513
4567
  }
4514
- this.form.get('file').setValue(file[0]);
4515
- this.form.get('fileType').setValue('image');
4516
- this.form.get('fileName').setValue(file[0].name);
4517
- this.form.get('targetURL').setValidators(Validators$1.required);
4518
- this.form.get('targetURL').updateValueAndValidity();
4568
+ (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.setValue(file[0]);
4569
+ (_b = this.getControl('fileType')) === null || _b === void 0 ? void 0 : _b.setValue('image');
4570
+ (_c = this.getControl('fileName')) === null || _c === void 0 ? void 0 : _c.setValue(file[0].name);
4571
+ (_d = this.getControl('targetURL')) === null || _d === void 0 ? void 0 : _d.setValidators(Validators$1.required);
4572
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4519
4573
  if (file[0].type.indexOf('video') > -1)
4520
- this.form.get('fileType').setValue('video');
4574
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.setValue('video');
4521
4575
  this.uploadMediaService();
4522
4576
  };
4523
4577
  GeneralInformationWAComponent.prototype.uploadMediaService = function () {
4524
4578
  var _this = this;
4579
+ var _a;
4525
4580
  var parameterList = [
4526
4581
  {
4527
4582
  name: 'file',
4528
- value: this.form.get('file').value,
4583
+ value: (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.value,
4529
4584
  in: 'formData',
4530
4585
  type: 'object',
4531
4586
  },
@@ -4533,75 +4588,93 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4533
4588
  var subs = this.apiAdapterService
4534
4589
  .executeApiRequest(parameterList, '/message/media', 'POST')
4535
4590
  .subscribe(function (resp) {
4536
- _this.form.get('targetURL').clearValidators();
4537
- _this.form.get('targetURL').updateValueAndValidity();
4538
- _this.form.get('targetURL').setValue(resp.data.targetURL);
4539
- _this.form.get('file').reset();
4591
+ var _a, _b, _c, _d;
4592
+ (_a = _this.getControl('targetURL')) === null || _a === void 0 ? void 0 : _a.clearValidators();
4593
+ (_b = _this.getControl('targetURL')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4594
+ (_c = _this.getControl('targetURL')) === null || _c === void 0 ? void 0 : _c.setValue(resp.data.targetURL);
4595
+ (_d = _this.getControl('file')) === null || _d === void 0 ? void 0 : _d.reset();
4540
4596
  _this.toastr.success('Upload media success');
4541
4597
  });
4542
4598
  this.subscribers.push(subs);
4543
4599
  };
4600
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "buttonParamsControls", {
4601
+ get: function () {
4602
+ return this.form.get('buttonParams').controls;
4603
+ },
4604
+ enumerable: true,
4605
+ configurable: true
4606
+ });
4607
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "isUsingExcelBulk", {
4608
+ get: function () {
4609
+ var _a;
4610
+ return ((_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.value) || false;
4611
+ },
4612
+ enumerable: true,
4613
+ configurable: true
4614
+ });
4544
4615
  GeneralInformationWAComponent.prototype.updateTemplate = function (template) {
4545
4616
  var _this = this;
4546
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
4617
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
4547
4618
  this.isShowParameter = false;
4548
4619
  if (!template)
4549
4620
  return;
4621
+ var buttonParamsArray = this.form.get('buttonParams');
4622
+ buttonParamsArray.clear();
4623
+ if (template && template.buttons && template.buttons.length > 0) {
4624
+ var quickReplyButtons = template.buttons.filter(function (btn) { return btn.type === 'QUICK_REPLY'; });
4625
+ quickReplyButtons.forEach(function (btn) {
4626
+ buttonParamsArray.push(new FormGroup({
4627
+ label: new FormControl(btn.text),
4628
+ payload: new FormControl('', [Validators$1.maxLength(256)]),
4629
+ }));
4630
+ });
4631
+ }
4550
4632
  this.isHaveTemplateParam =
4551
- ((_a = template.header.examples) === null || _a === void 0 ? void 0 : _a.length) > 0 ||
4552
- ((_b = template.body.examples) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
4553
- ((_c = template.buttons) === null || _c === void 0 ? void 0 : _c.length) > 0;
4554
- 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())) {
4555
- this.form
4556
- .get('fileName')
4557
- .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)));
4558
- this.form
4559
- .get('targetURL')
4560
- .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)));
4561
- 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());
4562
- }
4563
- ((_u = template.header.examples) === null || _u === void 0 ? void 0 : _u.length) > 0
4564
- ? this.form.get('paramHeader').setValidators(Validators$1.required)
4565
- : this.form.get('paramHeader').clearValidators();
4566
- ((_v = template.body.examples) === null || _v === void 0 ? void 0 : _v.length) > 0
4567
- ? this.form.get('paramBody').setValidators(Validators$1.required)
4568
- : this.form.get('paramBody').clearValidators();
4569
- ((_w = template.buttons) === null || _w === void 0 ? void 0 : _w.length) > 0
4570
- ? this.form.get('paramButton').setValidators(Validators$1.required)
4571
- : this.form.get('paramButton').clearValidators();
4633
+ (_c = (_b = (_a = template.header) === null || _a === void 0 ? void 0 : _a.examples) === null || _b === void 0 ? void 0 : _b.length, (_c !== null && _c !== void 0 ? _c : 0)) > 0 ||
4634
+ (_f = (_e = (_d = template.body) === null || _d === void 0 ? void 0 : _d.examples) === null || _e === void 0 ? void 0 : _e.length, (_f !== null && _f !== void 0 ? _f : 0)) > 0 ||
4635
+ (_h = (_g = template.buttons) === null || _g === void 0 ? void 0 : _g.length, (_h !== null && _h !== void 0 ? _h : 0)) > 0;
4636
+ if (['image', 'video', 'document'].includes((_l = (_k = (_j = template) === null || _j === void 0 ? void 0 : _j.header) === null || _k === void 0 ? void 0 : _k.type) === null || _l === void 0 ? void 0 : _l.toLowerCase())) {
4637
+ (_m = this.getControl('fileName')) === null || _m === void 0 ? void 0 : _m.setValue((_t = (_q = (_p = (_o = this.getCampaignStorage) === null || _o === void 0 ? void 0 : _o.generalInformation) === null || _p === void 0 ? void 0 : _p.form.fileName, (_q !== null && _q !== void 0 ? _q : (_s = (_r = this.getCampaignStorage) === null || _r === void 0 ? void 0 : _r.generalInformation) === null || _s === void 0 ? void 0 : _s.form.targetURL)), (_t !== null && _t !== void 0 ? _t : template.header.url)));
4638
+ (_u = this.getControl('targetURL')) === null || _u === void 0 ? void 0 : _u.setValue((_x = (_w = (_v = this.getCampaignStorage) === null || _v === void 0 ? void 0 : _v.generalInformation) === null || _w === void 0 ? void 0 : _w.form.targetURL, (_x !== null && _x !== void 0 ? _x : template.header.url)));
4639
+ this.fileTypeChange((_0 = (_z = (_y = template) === null || _y === void 0 ? void 0 : _y.header) === null || _z === void 0 ? void 0 : _z.type) === null || _0 === void 0 ? void 0 : _0.toLowerCase());
4640
+ }
4641
+ (_2 = (_1 = template.header.examples) === null || _1 === void 0 ? void 0 : _1.length, (_2 !== null && _2 !== void 0 ? _2 : 0)) > 0
4642
+ ? (_3 = this.getControl('paramHeader')) === null || _3 === void 0 ? void 0 : _3.setValidators(Validators$1.required) : (_4 = this.getControl('paramHeader')) === null || _4 === void 0 ? void 0 : _4.clearValidators();
4643
+ (_6 = (_5 = template.body.examples) === null || _5 === void 0 ? void 0 : _5.length, (_6 !== null && _6 !== void 0 ? _6 : 0)) > 0
4644
+ ? (_7 = this.getControl('paramBody')) === null || _7 === void 0 ? void 0 : _7.setValidators(Validators$1.required) : (_8 = this.getControl('paramBody')) === null || _8 === void 0 ? void 0 : _8.clearValidators();
4645
+ (_10 = (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.length, (_10 !== null && _10 !== void 0 ? _10 : 0)) > 0
4646
+ ? (_11 = this.getControl('paramButton')) === null || _11 === void 0 ? void 0 : _11.setValidators(Validators$1.required) : (_12 = this.getControl('paramButton')) === null || _12 === void 0 ? void 0 : _12.clearValidators();
4572
4647
  this.form.get('paramHeader').controls = [];
4573
4648
  this.form.get('paramHeader').reset();
4574
- this.form.get('paramHeader').updateValueAndValidity();
4649
+ (_13 = this.getControl('paramHeader')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4575
4650
  this.form.get('paramBody').controls = [];
4576
4651
  this.form.get('paramBody').reset();
4577
- this.form.get('paramBody').updateValueAndValidity();
4652
+ (_14 = this.getControl('paramBody')) === null || _14 === void 0 ? void 0 : _14.updateValueAndValidity();
4578
4653
  this.form.get('paramButton').controls = [];
4579
4654
  this.form.get('paramButton').reset();
4580
- this.form.get('paramButton').updateValueAndValidity();
4581
- this.form.get('otpValue').setValue('');
4582
- this.form.get('otpValue').clearValidators();
4583
- this.form.get('otpValue').updateValueAndValidity();
4584
- var formStorage = (_y = (_x = this.getCampaignStorage) === null || _x === void 0 ? void 0 : _x.generalInformation) === null || _y === void 0 ? void 0 : _y.form;
4655
+ (_15 = this.getControl('paramButton')) === null || _15 === void 0 ? void 0 : _15.updateValueAndValidity();
4656
+ (_16 = this.getControl('otpValue')) === null || _16 === void 0 ? void 0 : _16.setValue('');
4657
+ (_17 = this.getControl('otpValue')) === null || _17 === void 0 ? void 0 : _17.clearValidators();
4658
+ (_18 = this.getControl('otpValue')) === null || _18 === void 0 ? void 0 : _18.updateValueAndValidity();
4659
+ var formStorage = (_20 = (_19 = this.getCampaignStorage) === null || _19 === void 0 ? void 0 : _19.generalInformation) === null || _20 === void 0 ? void 0 : _20.form;
4585
4660
  if (template.category === 'AUTHENTICATION') {
4586
- this.form
4587
- .get('otpValue')
4588
- .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 : '')));
4589
- this.form.get('otpValue').setValidators(Validators$1.required);
4590
- this.form.get('otpValue').updateValueAndValidity();
4661
+ (_21 = this.getControl('otpValue')) === null || _21 === void 0 ? void 0 : _21.setValue((_29 = (_23 = (_22 = formStorage) === null || _22 === void 0 ? void 0 : _22.otpValue, (_23 !== null && _23 !== void 0 ? _23 : (_28 = __spread((_27 = (_26 = (_25 = (_24 = formStorage) === null || _24 === void 0 ? void 0 : _24.template) === null || _25 === void 0 ? void 0 : _25.body) === null || _26 === void 0 ? void 0 : _26.examples, (_27 !== null && _27 !== void 0 ? _27 : [])))) === null || _28 === void 0 ? void 0 : _28.pop())), (_29 !== null && _29 !== void 0 ? _29 : '')));
4662
+ (_30 = this.getControl('otpValue')) === null || _30 === void 0 ? void 0 : _30.setValidators(Validators$1.required);
4663
+ (_31 = this.getControl('otpValue')) === null || _31 === void 0 ? void 0 : _31.updateValueAndValidity();
4591
4664
  }
4592
- (_7 = template.header.examples) === null || _7 === void 0 ? void 0 : _7.forEach(function (each, index) {
4665
+ (_32 = template.header.examples) === null || _32 === void 0 ? void 0 : _32.forEach(function (each, index) {
4593
4666
  var _a, _b, _c, _d, _e, _f, _g;
4594
4667
  _this.addParamHeader((_g = (_d = (_c = (_b = (_a = formStorage) === null || _a === void 0 ? void 0 : _a.paramHeader) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.name, (_d !== null && _d !== void 0 ? _d : (_f = (_e = formStorage) === null || _e === void 0 ? void 0 : _e.paramHeader) === null || _f === void 0 ? void 0 : _f[index])), (_g !== null && _g !== void 0 ? _g : '')));
4595
4668
  });
4596
- (_8 = template.body.examples) === null || _8 === void 0 ? void 0 : _8.forEach(function (each, index) {
4669
+ (_33 = template.body.examples) === null || _33 === void 0 ? void 0 : _33.forEach(function (each, index) {
4597
4670
  var _a, _b, _c, _d, _e, _f, _g;
4598
4671
  var paramValue = (_g = (_d = (_c = (_b = (_a = formStorage) === null || _a === void 0 ? void 0 : _a.paramBody) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.name, (_d !== null && _d !== void 0 ? _d : (_f = (_e = formStorage) === null || _e === void 0 ? void 0 : _e.paramBody) === null || _f === void 0 ? void 0 : _f[index])), (_g !== null && _g !== void 0 ? _g : ''));
4599
4672
  if (['$UnsubscribeAccount'].includes(each))
4600
4673
  paramValue = each;
4601
4674
  _this.addParamBody(paramValue);
4602
4675
  });
4603
- (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.forEach(function (each, index) {
4604
- var _a;
4676
+ (_34 = template.buttons) === null || _34 === void 0 ? void 0 : _34.forEach(function (each, index) {
4677
+ var _a, _b, _c, _d;
4605
4678
  _this.addParamButton();
4606
4679
  var button = _this.getButton;
4607
4680
  if (((_a = each.examples) === null || _a === void 0 ? void 0 : _a.length) > 0) {
@@ -4619,8 +4692,9 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4619
4692
  });
4620
4693
  }
4621
4694
  else {
4622
- button[button.length - 1].get('name').clearValidators();
4623
- button[button.length - 1].get('name').updateValueAndValidity();
4695
+ var lastControl = (_b = button[button.length - 1]) === null || _b === void 0 ? void 0 : _b.get('name');
4696
+ (_c = lastControl) === null || _c === void 0 ? void 0 : _c.clearValidators();
4697
+ (_d = lastControl) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4624
4698
  }
4625
4699
  });
4626
4700
  };
@@ -4655,13 +4729,14 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4655
4729
  var autocomplete = new google.maps.places.Autocomplete(_this.mapSearchRef.nativeElement);
4656
4730
  autocomplete.addListener('place_changed', function () {
4657
4731
  _this.ngZone.run(function () {
4732
+ var _a, _b;
4658
4733
  var place = autocomplete.getPlace();
4659
4734
  if (!place.geometry)
4660
4735
  return;
4661
4736
  _this.maps.latitude = place.geometry.location.lat();
4662
4737
  _this.maps.longitude = place.geometry.location.lng();
4663
- _this.form.get('latitude').setValue(_this.maps.latitude);
4664
- _this.form.get('longitude').setValue(_this.maps.longitude);
4738
+ (_a = _this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(_this.maps.latitude);
4739
+ (_b = _this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(_this.maps.longitude);
4665
4740
  });
4666
4741
  });
4667
4742
  });
@@ -4670,59 +4745,73 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4670
4745
  var _this = this;
4671
4746
  if ('geolocation' in navigator) {
4672
4747
  navigator.geolocation.getCurrentPosition(function (position) {
4673
- if (!_this.form.get('longitude').value && !_this.form.get('latitude').value) {
4748
+ var _a, _b, _c, _d;
4749
+ if (!((_a = _this.getControl('longitude')) === null || _a === void 0 ? void 0 : _a.value) && !((_b = _this.getControl('latitude')) === null || _b === void 0 ? void 0 : _b.value)) {
4674
4750
  _this.maps.latitude = position.coords.latitude;
4675
4751
  _this.maps.longitude = position.coords.longitude;
4676
- _this.form.get('latitude').setValue(_this.maps.latitude);
4677
- _this.form.get('longitude').setValue(_this.maps.longitude);
4752
+ (_c = _this.getControl('latitude')) === null || _c === void 0 ? void 0 : _c.setValue(_this.maps.latitude);
4753
+ (_d = _this.getControl('longitude')) === null || _d === void 0 ? void 0 : _d.setValue(_this.maps.longitude);
4678
4754
  }
4679
4755
  });
4680
4756
  }
4681
4757
  };
4682
4758
  GeneralInformationWAComponent.prototype.markerDragEnd = function (event) {
4759
+ var _a, _b;
4683
4760
  if (event.latLng) {
4684
4761
  this.maps.latitude = event.latLng.lat();
4685
4762
  this.maps.longitude = event.latLng.lng();
4686
- this.form.get('latitude').setValue(this.maps.latitude);
4687
- this.form.get('longitude').setValue(this.maps.longitude);
4763
+ (_a = this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(this.maps.latitude);
4764
+ (_b = this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(this.maps.longitude);
4688
4765
  }
4689
4766
  };
4690
4767
  GeneralInformationWAComponent.prototype.updateDownloadCSV = function (isChecked) {
4691
- this.form.get('isUpload').setValue(isChecked);
4768
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4769
+ (_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.setValue(isChecked);
4692
4770
  if (isChecked) {
4693
- this.form.get('paramHeader').controls = [];
4694
- this.form.get('paramHeader').reset();
4695
- this.form.get('paramBody').controls = [];
4696
- this.form.get('paramBody').reset();
4697
- this.form.get('paramButton').controls = [];
4698
- this.form.get('paramButton').reset();
4699
- this.form.get('paramHeader').clearValidators();
4700
- this.form.get('paramBody').clearValidators();
4701
- this.form.get('paramButton').clearValidators();
4702
- this.form.get('paramHeader').updateValueAndValidity();
4703
- this.form.get('paramBody').updateValueAndValidity();
4704
- this.form.get('paramButton').updateValueAndValidity();
4705
- this.form.get('otpValue').reset();
4706
- this.form.get('otpValue').clearValidators();
4707
- this.form.get('otpValue').updateValueAndValidity();
4771
+ this.getControl('paramHeader').controls = [];
4772
+ this.getControl('paramHeader').reset();
4773
+ this.getControl('paramBody').controls = [];
4774
+ this.getControl('paramBody').reset();
4775
+ this.getControl('paramButton').controls = [];
4776
+ this.getControl('paramButton').reset();
4777
+ (_b = this.getControl('paramHeader')) === null || _b === void 0 ? void 0 : _b.clearValidators();
4778
+ (_c = this.getControl('paramBody')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4779
+ (_d = this.getControl('paramButton')) === null || _d === void 0 ? void 0 : _d.clearValidators();
4780
+ (_e = this.getControl('paramHeader')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4781
+ (_f = this.getControl('paramBody')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4782
+ (_g = this.getControl('paramButton')) === null || _g === void 0 ? void 0 : _g.updateValueAndValidity();
4783
+ (_h = this.getControl('otpValue')) === null || _h === void 0 ? void 0 : _h.reset();
4784
+ (_j = this.getControl('otpValue')) === null || _j === void 0 ? void 0 : _j.clearValidators();
4785
+ (_k = this.getControl('otpValue')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4708
4786
  return;
4709
4787
  }
4710
- this.updateTemplate(this.form.get('template').value);
4788
+ this.updateTemplate((_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.value);
4711
4789
  };
4712
4790
  GeneralInformationWAComponent.prototype.handleChangeTemplate = function (useExisting) {
4791
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4792
+ (_a = this.getControl('isDownloadVariableXLS')) === null || _a === void 0 ? void 0 : _a.setValue(false);
4793
+ this.variables.clear();
4794
+ this.updateVariableDownloadXLS(false);
4713
4795
  if (useExisting) {
4714
- this.form.get('template').setValidators(Validators$1.required);
4715
- this.form.get('text').reset();
4716
- this.form.get('text').clearValidators();
4717
- this.form.get('text').updateValueAndValidity();
4718
- this.form.get('template').updateValueAndValidity();
4796
+ (_b = this.getControl('template')) === null || _b === void 0 ? void 0 : _b.setValidators(Validators$1.required);
4797
+ //this.getControl('text')?.reset();
4798
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4799
+ (_d = this.getControl('text')) === null || _d === void 0 ? void 0 : _d.setValue('Halo {{1}}, ini adalah kode verifikasi kamu: {{2}}');
4800
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4801
+ (_f = this.getControl('template')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4802
+ this.variables.push(new FormGroup({
4803
+ paramName: new FormControl('', Validators$1.required),
4804
+ }));
4805
+ this.variables.push(new FormGroup({
4806
+ paramName: new FormControl('', Validators$1.required),
4807
+ }));
4719
4808
  }
4720
4809
  else {
4721
- this.form.get('template').reset();
4722
- this.form.get('template').clearValidators();
4723
- this.form.get('text').setValidators([Validators$1.required, Validators$1.max(1024)]);
4724
- this.form.get('text').updateValueAndValidity();
4725
- this.form.get('template').updateValueAndValidity();
4810
+ (_g = this.getControl('template')) === null || _g === void 0 ? void 0 : _g.reset();
4811
+ (_h = this.getControl('template')) === null || _h === void 0 ? void 0 : _h.clearValidators();
4812
+ (_j = this.getControl('text')) === null || _j === void 0 ? void 0 : _j.setValidators([Validators$1.required, Validators$1.max(1024)]);
4813
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4814
+ (_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
4726
4815
  }
4727
4816
  };
4728
4817
  GeneralInformationWAComponent.prototype.handleChangeFrom = function (value) {
@@ -4731,6 +4820,65 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4731
4820
  return;
4732
4821
  this.getTemplateOptionService(value);
4733
4822
  };
4823
+ Object.defineProperty(GeneralInformationWAComponent.prototype, "variables", {
4824
+ get: function () {
4825
+ return this.getControl('variables');
4826
+ },
4827
+ enumerable: true,
4828
+ configurable: true
4829
+ });
4830
+ GeneralInformationWAComponent.prototype.addVariable = function () {
4831
+ var variableGroup = new FormGroup({
4832
+ paramName: new FormControl('', Validators$1.required),
4833
+ });
4834
+ this.variables.push(variableGroup);
4835
+ var textControl = this.getControl('text');
4836
+ if (textControl) {
4837
+ var currentBody = textControl.value || '';
4838
+ var newSequence = "{{" + this.variables.controls.length + "}}";
4839
+ textControl.setValue((currentBody + " " + newSequence).trim());
4840
+ }
4841
+ };
4842
+ GeneralInformationWAComponent.prototype.removeVariable = function (index) {
4843
+ var _a;
4844
+ this.variables.removeAt(index);
4845
+ if (this.variables.controls.length === 0) {
4846
+ (_a = this.getControl('useXlsx')) === null || _a === void 0 ? void 0 : _a.setValue(false);
4847
+ }
4848
+ var textControl = this.getControl('text');
4849
+ if (textControl && textControl.value) {
4850
+ var targetSequence_1 = index + 1;
4851
+ var currentBody = textControl.value;
4852
+ var removeRegex = new RegExp("\\s*\\{\\{" + targetSequence_1 + "\\}\\}", 'g');
4853
+ currentBody = currentBody.replace(removeRegex, '');
4854
+ currentBody = currentBody.replace(/\{\{(\d+)\}\}/g, function (match, numStr) {
4855
+ var num = parseInt(numStr, 10);
4856
+ if (num > targetSequence_1) {
4857
+ return "{{" + (num - 1) + "}}";
4858
+ }
4859
+ return match;
4860
+ });
4861
+ textControl.setValue(currentBody.trim());
4862
+ }
4863
+ };
4864
+ GeneralInformationWAComponent.prototype.updateVariableDownloadXLS = function (isChecked) {
4865
+ var variablesArray = this.variables;
4866
+ if (isChecked) {
4867
+ variablesArray.controls.forEach(function (control) {
4868
+ var _a, _b;
4869
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.clearValidators();
4870
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4871
+ });
4872
+ }
4873
+ else {
4874
+ variablesArray.controls.forEach(function (control) {
4875
+ var _a, _b;
4876
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.setValidators(Validators$1.required);
4877
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4878
+ });
4879
+ }
4880
+ this.form.updateValueAndValidity();
4881
+ };
4734
4882
  GeneralInformationWAComponent.prototype.ngOnDestroy = function () {
4735
4883
  this.subscribers.forEach(function (each) { return each.unsubscribe(); });
4736
4884
  };
@@ -4756,8 +4904,8 @@ var GeneralInformationWAComponent = /** @class */ (function () {
4756
4904
  GeneralInformationWAComponent = __decorate([
4757
4905
  Component({
4758
4906
  selector: 'lib-general-information-wa',
4759
- 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 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 </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 </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",
4760
- styles: [".asterix--after:after{content:\"*\";color:red}"]
4907
+ template: "<form autocomplete=\"off\" [formGroup]=\"form\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Message Type</mat-label>\r\n <mat-select placeholder=\"Select message type\" formControlName=\"channel\">\r\n <mat-option\r\n *ngFor=\"let option of msgTypeWAOption\"\r\n [value]=\"option.code\"\r\n (click)=\"formReset()\"\r\n >\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.channel\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('channel')?.touched && form.get('channel')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n\r\n <div\r\n *ngIf=\"!getIsTemplate\"\r\n role=\"alert\"\r\n class=\"alert alert-warning d-flex align-items-center\"\r\n style=\"margin-top: 16px; border: 1px solid rgb(243, 124, 44)\"\r\n >\r\n <mat-icon style=\"margin-right: 10px !important\">error_outline</mat-icon>\r\n <div *ngIf=\"!getIsUtility\">\r\n If you select this channel, keep in mind that the message might not be delivered to\r\n all selected customers. This is because the customer must have had a conversation\r\n previously with BSP.\r\n </div>\r\n\r\n <div *ngIf=\"getIsUtility\">\r\n You can send directly a utility message. You can choose between existing utility\r\n templates or creating a new one. If you create a new template, the system may check\r\n whether the content already exists as a template.\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getIsText\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from').touched && form.get('from').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label class=\"asterix--after\">Text</mat-label>\r\n\r\n <textarea\r\n matInput\r\n rows=\"6\"\r\n cols=\"50\"\r\n cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"2\"\r\n cdkAutosizeMaxRows=\"15\"\r\n formControlName=\"text\"\r\n placeholder=\"Enter text\"\r\n #autosize=\"cdkTextareaAutosize\"\r\n ></textarea>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.text\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('text')?.touched && form.get('text')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsMedia\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Media Type</mat-label>\r\n\r\n <mat-select\r\n placeholder=\"Select media type\"\r\n formControlName=\"media\"\r\n (selectionChange)=\"updateMediaType($event.value)\"\r\n >\r\n <mat-option *ngFor=\"let option of mediaTypeOption\" [value]=\"option.code\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.media\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('media').touched && form.get('media').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from').touched && form.get('from').hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"form.get('media').value?.toLowerCase() !== 'location'\">\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">File</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n (click)=\"filePicker.click()\"\r\n formControlName=\"fileName\"\r\n />\r\n\r\n <button\r\n mat-button\r\n matSuffix\r\n mat-icon-button\r\n aria-label=\"Choose File\"\r\n (click)=\"filePicker.click()\"\r\n >\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n\r\n <input\r\n #filePicker\r\n hidden\r\n type=\"file\"\r\n [accept]=\"extFileAccepted\"\r\n (change)=\"onFileSelected($event)\"\r\n />\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.fileName\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('fileName').touched &&\r\n form.get('fileName').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('media').value?.toLowerCase() === 'location'\">\r\n <div class=\"w-100\">\r\n <h4 class=\"asterix--after\">Location</h4>\r\n\r\n <div class=\"w-100\">\r\n <agm-map\r\n style=\"width: 100%; height: 400px\"\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [disableDoubleClickZoom]=\"maps.isDoubleClickZoom\"\r\n [zoom]=\"maps.zoom\"\r\n >\r\n <agm-marker\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [markerDraggable]=\"maps.isDraggable\"\r\n (dragEnd)=\"markerDragEnd($event)\"\r\n ></agm-marker>\r\n </agm-map>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Location</mat-label>\r\n\r\n <input\r\n #mapSearch\r\n matInput\r\n type=\"text\"\r\n maxlength=\"100\"\r\n placeholder=\"Enter location here\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsTemplate\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n (selectionChange)=\"getTemplateOptionService($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"template\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n (selectionChange)=\"updateTemplate($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('template').value?.name\"\r\n (searchRes)=\"updateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.template\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('template')?.touched &&\r\n form.get('template')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div\r\n class=\"button-parameter-section mt-4\"\r\n *ngIf=\"buttonParamsControls.length > 0 && !isUsingExcelBulk\"\r\n >\r\n <h5 class=\"mb-3 font-weight-bold\">Button Parameter</h5>\r\n\r\n <div formArrayName=\"buttonParams\">\r\n <div\r\n *ngFor=\"let btnControl of buttonParamsControls; let i = index\"\r\n [formGroupName]=\"i\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Button {{ i + 1 }}</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"payload\"\r\n [placeholder]=\"'Parameter ' + (i + 1)\"\r\n maxlength=\"256\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"isHaveTemplateParam\" class=\"d-flex justify-content-end\">\r\n <mat-checkbox\r\n labelPosition=\"before\"\r\n formControlName=\"isUpload\"\r\n (change)=\"updateDownloadCSV($event.checked)\"\r\n >\r\n Using Download XLSX\r\n </mat-checkbox>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!form.get('isUpload')?.value\">\r\n <div\r\n *ngIf=\"form.get('template')?.value?.category === 'AUTHENTICATION'\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label> OTP Value </mat-label>\r\n\r\n <input matInput type=\"text\" formControlName=\"otpValue\" />\r\n </mat-form-field>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getParamHeader?.length > 0\">\r\n <p class=\"font-16px font-PoppinsBold\">Header Parameter</p>\r\n\r\n <div\r\n *ngFor=\"let param of getParamHeader; let paramHeaderIndex = index\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramHeaderIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramHeaderIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getParamBody?.length > 0\">\r\n <p class=\"font-16px font-PoppinsBold mt-3\">Body Parameter</p>\r\n\r\n <div\r\n *ngFor=\"let param of getParamBody; let paramBodyIndex = index\"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramBodyIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramBodyIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"isShowParameter\">\r\n <p class=\"font-16px font-PoppinsBold mt-3\">Button Parameter</p>\r\n\r\n <ng-container *ngFor=\"let button of getButton; let buttonIndex = index\">\r\n <ng-container *ngIf=\"getParamButton(buttonIndex)?.length > 0\">\r\n <p class=\"font-14px font-PoppinsBold mt-3\">Button {{ buttonIndex + 1 }}</p>\r\n\r\n <div\r\n *ngFor=\"\r\n let param of getParamButton(buttonIndex);\r\n let paramIndex = index\r\n \"\r\n class=\"form-group\"\r\n >\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Parameter {{ paramIndex + 1 }}</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n [placeholder]=\"'Parameter ' + (paramIndex + 1)\"\r\n [formControl]=\"param.get('name')\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container\r\n *ngIf=\"\r\n ['image', 'video', 'document'].includes(\r\n form.get('template')?.value?.header?.type?.toLowerCase()\r\n )\r\n \"\r\n >\r\n <p class=\"font-16px font-PoppinsBold mt-3\">File</p>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">File</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n (click)=\"filePicker.click()\"\r\n formControlName=\"fileName\"\r\n />\r\n\r\n <button\r\n mat-button\r\n matSuffix\r\n mat-icon-button\r\n aria-label=\"Choose File\"\r\n (click)=\"filePicker.click()\"\r\n >\r\n <mat-icon>attach_file</mat-icon>\r\n </button>\r\n\r\n <input\r\n #filePicker\r\n hidden\r\n type=\"file\"\r\n [accept]=\"extFileAccepted\"\r\n (change)=\"onFileSelected($event)\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsCatalogue\">\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">Category</mat-label>\r\n\r\n <mat-select formControlName=\"category\" placeholder=\"Select category\">\r\n <mat-option *ngFor=\"let option of categoryOption\" [value]=\"option.value\">\r\n {{ option.label }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.category\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('category')?.touched &&\r\n form.get('category')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">Catalog</mat-label>\r\n\r\n <mat-select formControlName=\"catalogue\" placeholder=\"Select catalog\">\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.catalogue\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('catalogue')?.touched &&\r\n form.get('catalogue')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"form.get('category')?.value === 'product'\"\r\n style=\"padding: 8px; border-radius: 8px; border: 1px solid #6177c4\"\r\n >\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Product</mat-label>\r\n\r\n <mat-select formControlName=\"product\" placeholder=\"Select product\">\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.product\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('product')?.touched &&\r\n form.get('product')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label>Body</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n maxlength=\"100\"\r\n formControlName=\"body\"\r\n placeholder=\"Enter body\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"getIsUtility\">\r\n <div style=\"display: grid; gap: 0.5rem\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n <mat-radio-group\r\n style=\"display: flex; gap: 0.5rem; flex-wrap: wrap\"\r\n formControlName=\"isUseExistingTemplate\"\r\n (change)=\"handleChangeTemplate($event.value)\"\r\n >\r\n <mat-radio-button\r\n [value]=\"option.value\"\r\n *ngFor=\"let option of templates\"\r\n color=\"primary\"\r\n >\r\n {{ option.label }}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100\"\r\n style=\"margin-bottom: 20\"\r\n >\r\n <mat-label class=\"asterix--after\">From</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"from\"\r\n placeholder=\"Select from\"\r\n [complete]=\"isHaveNextAccountOption === false\"\r\n [compareWith]=\"accountSelectedDisplay\"\r\n (infiniteScroll)=\"getNextAccountBatch()\"\r\n (selectionChange)=\"handleChangeFrom($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('from').value?.name\"\r\n (searchRes)=\"updateSearchAccount($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of accountOption\" [value]=\"option\">\r\n {{ option.name + ' (' + option.accountNo + ')' }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingAccountOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.from\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"form.get('from')?.touched && form.get('from')?.hasError(validation.type)\"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"!form.get('isUseExistingTemplate')?.value; else existingTmpl\">\r\n <ng-container *ngTemplateOutlet=\"stageAlertTmpl\"></ng-container>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\">\r\n <mat-label class=\"asterix--after\">Body</mat-label>\r\n\r\n <textarea\r\n matInput\r\n rows=\"6\"\r\n cols=\"50\"\r\n cdkTextareaAutosize\r\n cdkAutosizeMinRows=\"2\"\r\n cdkAutosizeMaxRows=\"15\"\r\n formControlName=\"text\"\r\n placeholder=\"Enter text\"\r\n #autosize=\"cdkTextareaAutosize\"\r\n ></textarea>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.text\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('text').touched && form.get('text').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <app-input\r\n type=\"numeric\"\r\n formControlName=\"ttl\"\r\n label=\"TTL\"\r\n placeholder=\"Enter ttl\"\r\n [trimLeadingZeros]=\"true\"\r\n suffix=\"seconds\"\r\n hint=\"The default TTL is 30 days (2,592,000 seconds) if no value is provided.\"\r\n ></app-input>\r\n </div>\r\n\r\n <div *ngIf=\"!isReadOnlyMode\">\r\n <mat-checkbox formControlName=\"isNeedSave\">\r\n Save this message as future template\r\n </mat-checkbox>\r\n </div>\r\n <div class=\"template-container mt-5\" *ngIf=\"!form.get('isDownloadVariableXLS')?.value\">\r\n <div class=\"add-variable-wrapper\">\r\n <button mat-button class=\"btn-add-variable\" (click)=\"addVariable()\">\r\n <mat-icon class=\"icon-small\">add</mat-icon> Add Variable\r\n </button>\r\n </div>\r\n\r\n <div class=\"body-content-wrapper\">\r\n <h3 class=\"body-content-title\">Body Content</h3>\r\n <p class=\"body-content-subtitle\">\r\n Input the parameter to show during the preview. You can use predefined\r\n variable, drag and drop to text field below\r\n </p>\r\n <div class=\"predefined-variable-wrapper\">\r\n <span class=\"btn-predefined\">\r\n <mat-icon class=\"icon-small\">attach_money</mat-icon>\r\n Unsubscribe Account\r\n </span>\r\n </div>\r\n <div class=\"variables-list\" formArrayName=\"variables\">\r\n <div\r\n class=\"variable-row d-flex align-items-start mb-3\"\r\n *ngFor=\"let variable of variables.controls; let i = index\"\r\n [formGroupName]=\"i\"\r\n >\r\n <div class=\"variable-sequence mr-3\">\r\n {{ '{' + '{' + (i + 1) + '}' + '}' }}\r\n </div>\r\n <div class=\"variable-input-wrapper flex-grow-1\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n class=\"w-100 custom-variable-field\"\r\n >\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"paramName\"\r\n placeholder=\"e.g. Name, Verification code\"\r\n />\r\n </mat-form-field>\r\n\r\n <ng-container\r\n *ngFor=\"let validation of validationMessages?.paramName\"\r\n >\r\n <div\r\n class=\"custom-error-text text-right\"\r\n *ngIf=\"\r\n variable.get('paramName')?.hasError(validation.type) &&\r\n (variable.get('paramName')?.touched ||\r\n variable.get('paramName')?.dirty)\r\n \"\r\n >\r\n <span class=\"font-12px m-0\">{{ validation.message }}</span>\r\n </div>\r\n </ng-container>\r\n </div>\r\n\r\n <button\r\n type=\"button\"\r\n class=\"btn-delete ml-3\"\r\n (click)=\"removeVariable(i)\"\r\n >\r\n <mat-icon color=\"warn\">delete_outline</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"d-flex justify-content-end\">\r\n <mat-checkbox\r\n labelPosition=\"before\"\r\n formControlName=\"isDownloadVariableXLS\"\r\n (change)=\"updateVariableDownloadXLS($event.checked)\"\r\n >\r\n Using Download XLSX\r\n </mat-checkbox>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-template #existingTmpl>\r\n <ng-container *ngTemplateOutlet=\"stageAlertTmpl\"></ng-container>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Template</mat-label>\r\n\r\n <mat-select\r\n matSelectInfiniteScroll\r\n formControlName=\"template\"\r\n placeholder=\"Select template\"\r\n [complete]=\"isHaveNextTemplateOption === false\"\r\n [compareWith]=\"templateSelectedDisplay\"\r\n (infiniteScroll)=\"getNextTemplateBatch()\"\r\n (selectionChange)=\"updateTemplate($event.value)\"\r\n >\r\n <div style=\"margin: 20px\">\r\n <lib-search\r\n [placeholder]=\"'Search'\"\r\n [currentValue]=\"form?.get('template').value?.name\"\r\n (searchRes)=\"updateSearch($event)\"\r\n ></lib-search>\r\n </div>\r\n\r\n <mat-option *ngFor=\"let option of templateOption\" [value]=\"option\">\r\n {{ option.name }}\r\n </mat-option>\r\n <mat-option *ngIf=\"isLoadingTemplateOption\">Loading...</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.template\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('template')?.touched &&\r\n form.get('template')?.hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <app-input\r\n type=\"numeric\"\r\n formControlName=\"ttl\"\r\n label=\"TTL\"\r\n placeholder=\"Enter ttl\"\r\n [trimLeadingZeros]=\"true\"\r\n suffix=\"Seconds\"\r\n hint=\"The default TTL is 30 days (2,592,000 seconds) if no value is provided.\"\r\n ></app-input>\r\n </div>\r\n <div\r\n class=\"template-container mt-5\"\r\n *ngIf=\"!form.get('isDownloadVariableXLS')?.value\"\r\n formArrayName=\"variables\"\r\n >\r\n <div class=\"font-bold mb-3\">Variables</div>\r\n\r\n <div class=\"form-group mb-3\" [formGroupName]=\"0\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100 custom-variable-field\"\r\n >\r\n <mat-label>{{ '{' + '{' + 1 + '}' + '}' }}</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"paramName\"\r\n placeholder=\"Name\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"form-group mb-3\" [formGroupName]=\"1\">\r\n <mat-form-field\r\n appearance=\"outline\"\r\n floatLabel=\"always\"\r\n class=\"w-100 custom-variable-field\"\r\n >\r\n <mat-label>{{ '{' + '{' + 2 + '}' + '}' }}</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"paramName\"\r\n placeholder=\"Verification code\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"d-flex justify-content-end\">\r\n <mat-checkbox\r\n labelPosition=\"before\"\r\n formControlName=\"isDownloadVariableXLS\"\r\n (change)=\"updateVariableDownloadXLS($event.checked)\"\r\n >\r\n Using Download XLSX\r\n </mat-checkbox>\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n</form>\r\n\r\n<ng-template #stageAlertTmpl>\r\n <div\r\n role=\"alert\"\r\n class=\"alert alert-warning d-flex align-items-center\"\r\n style=\"margin-top: 8px; border: 1px solid rgb(243, 124, 44)\"\r\n *ngIf=\"form.get('from')?.value && form.get('from')?.value?.directSendRestrictionStage > 0\"\r\n >\r\n <mat-icon style=\"margin-right: 10px !important\">error_outline</mat-icon>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 1\">\r\n Direct Send misuse detected. Please review your messaging practices.\r\n </div>\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 2\">\r\n Direct Send access restricted for 7 days due to continued misuse.\r\n </div>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 3\">\r\n Direct Send access restricted for 30 days due to continued misuse. Final warning before\r\n permanent revocation.\r\n </div>\r\n\r\n <div *ngIf=\"form.get('from')?.value?.directSendRestrictionStage === 4\">\r\n Direct Send access has been permanently revoked.\r\n </div>\r\n </div>\r\n</ng-template>\r\n",
4908
+ styles: [".asterix--after:after{content:\"*\";color:red}.template-container{background-color:#fff;border-radius:.5rem;width:100%;max-width:56rem;box-sizing:border-box}.template-container .variable-wapper{margin-bottom:.5rem;display:flex;align-items:center}.template-container .add-variable-wrapper{display:flex;align-items:center;justify-content:flex-end;margin-bottom:.5rem}.template-container .add-variable-wrapper .btn-add-variable{color:#3b82f6!important}.template-container .body-content-wrapper{background-color:#d1e4fd;border-radius:.5rem;padding:1.5rem;margin-bottom:.5rem}.template-container .body-content-wrapper .body-content-title{color:#1e293b;font-size:1.125rem;font-weight:700;margin:0 0 .5rem}.template-container .body-content-wrapper .body-content-subtitle{color:#6b7280;font-size:.875rem;margin:0 0 1.25rem}.template-container .body-content-wrapper .predefined-variable-wrapper{margin-bottom:1.5rem}.template-container .body-content-wrapper .predefined-variable-wrapper .btn-predefined{display:inline-flex;align-items:center;background-color:#22c55e;color:#fff;font-size:.75rem;font-weight:600;padding:.375rem .75rem;border-radius:9999px;cursor:grab;transition:background-color .2s}.template-container .body-content-wrapper .predefined-variable-wrapper .btn-predefined:hover{background-color:#16a34a}.template-container .body-content-wrapper .predefined-variable-wrapper .btn-predefined .icon-small{font-size:16px;width:16px;height:16px;margin-right:.25rem;line-height:16px}.template-container .body-content-wrapper .custom-variable-field ::ng-deep .mat-form-field-wrapper{padding-bottom:0!important;margin-bottom:0!important}.template-container .body-content-wrapper .custom-variable-field ::ng-deep .mat-form-field-outline{background-color:#fff!important;border-radius:5px}.template-container .body-content-wrapper .custom-variable-field ::ng-deep .mat-form-field-flex{background-color:transparent!important}.template-container .body-content-wrapper .custom-variable-field ::ng-deep input.mat-input-element{margin-top:-8px!important}.template-container .body-content-wrapper .custom-error-text{color:#f44336;margin-top:4px;padding-right:12px}.template-container .body-content-wrapper .variable-sequence{background-color:#fff;border:1px solid #e2e8f0;color:#4b5563;border-radius:5px;font-weight:500;min-width:3.5rem;text-align:center;height:51px;display:flex;align-items:center;justify-content:center;margin-top:4px}.template-container .body-content-wrapper .btn-delete{background:0 0;border:none;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;height:51px;margin-top:4px;transition:transform .2s}.template-container .body-content-wrapper .btn-delete:hover{transform:scale(1.1)}.template-container .checkbox-wrapper{display:flex;justify-content:flex-end;margin-top:.5rem}.template-container .checkbox-wrapper .checkbox-xlsx{font-size:.875rem;font-weight:500;color:#374151}"]
4761
4909
  })
4762
4910
  ], GeneralInformationWAComponent);
4763
4911
  return GeneralInformationWAComponent;
@@ -5187,10 +5335,7 @@ var GeneralInformationComponent = /** @class */ (function () {
5187
5335
  var _this = this;
5188
5336
  this.form = new FormGroup({
5189
5337
  id: new FormControl(null),
5190
- campaignName: new FormControl(null, [
5191
- Validators$1.required,
5192
- Validators$1.maxLength(100),
5193
- ]),
5338
+ campaignName: new FormControl(null, [Validators$1.required, Validators$1.maxLength(100)]),
5194
5339
  medium: new FormControl(null, [Validators$1.required]),
5195
5340
  });
5196
5341
  this.form.valueChanges.subscribe(function () {
@@ -5214,12 +5359,8 @@ var GeneralInformationComponent = /** @class */ (function () {
5214
5359
  if (Object.entries(campaign).length === 0)
5215
5360
  return;
5216
5361
  this.form.get('id').setValue((_b = (_a = campaign) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.id);
5217
- this.form
5218
- .get('campaignName')
5219
- .setValue((_d = (_c = campaign) === null || _c === void 0 ? void 0 : _c.generalInformation) === null || _d === void 0 ? void 0 : _d.form.campaignName);
5220
- this.form
5221
- .get('medium')
5222
- .setValue((_f = (_e = campaign) === null || _e === void 0 ? void 0 : _e.generalInformation) === null || _f === void 0 ? void 0 : _f.form.medium);
5362
+ this.form.get('campaignName').setValue((_d = (_c = campaign) === null || _c === void 0 ? void 0 : _c.generalInformation) === null || _d === void 0 ? void 0 : _d.form.campaignName);
5363
+ this.form.get('medium').setValue((_f = (_e = campaign) === null || _e === void 0 ? void 0 : _e.generalInformation) === null || _f === void 0 ? void 0 : _f.form.medium);
5223
5364
  };
5224
5365
  GeneralInformationComponent.prototype.initDisable = function () {
5225
5366
  if (!this.isReadOnlyMode) {
@@ -5228,6 +5369,7 @@ var GeneralInformationComponent = /** @class */ (function () {
5228
5369
  this.form.disable();
5229
5370
  };
5230
5371
  GeneralInformationComponent.prototype.updateGeneralInformationForm = function (form) {
5372
+ console.log(form, 'form');
5231
5373
  this.generalInformationForm = form;
5232
5374
  this.isShowMore = false;
5233
5375
  this.generalInformation.emit({
@@ -5350,7 +5492,7 @@ var GeneralInformationComponent = /** @class */ (function () {
5350
5492
  Component({
5351
5493
  selector: 'lib-new-campaign-general-information',
5352
5494
  template: "<form autocomplete=\"off\" [formGroup]=\"form\">\r\n <div class=\"campaign-info\">\r\n <div class=\"campaign-info-child\">\r\n <mat-card>\r\n <mat-card-content>\r\n <h3 class=\"font-22px font-PoppinsBold mb-4\">General Information</h3>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Broadcast Name</mat-label>\r\n\r\n <input\r\n matInput\r\n type=\"text\"\r\n formControlName=\"campaignName\"\r\n placeholder=\"Enter Broadcast name\"\r\n />\r\n </mat-form-field>\r\n\r\n <div class=\"d-flex justify-content-between align-items-center w-100\">\r\n <mat-hint align=\"start\">\r\n {{ form.get('campaignName').value?.length || 0 }}/100\r\n </mat-hint>\r\n\r\n <div>\r\n <mat-error\r\n align=\"end\"\r\n *ngFor=\"let validation of validationMessages.campaignName\"\r\n >\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('campaignName').touched &&\r\n form.get('campaignName').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <mat-form-field appearance=\"outline\" floatLabel=\"always\" class=\"w-100\">\r\n <mat-label class=\"asterix--after\">Channel</mat-label>\r\n\r\n <mat-select placeholder=\"Select channel\" formControlName=\"medium\">\r\n <mat-option\r\n *ngFor=\"let option of channelOption\"\r\n [value]=\"option.value\"\r\n >\r\n {{ option.label }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n\r\n <mat-error align=\"end\" *ngFor=\"let validation of validationMessages.medium\">\r\n <p\r\n class=\"font-12px mb-0\"\r\n *ngIf=\"\r\n form.get('medium').touched &&\r\n form.get('medium').hasError(validation.type)\r\n \"\r\n >\r\n {{ validation.message }}\r\n </p>\r\n </mat-error>\r\n </div>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'WA'\">\r\n <lib-general-information-wa\r\n [isTouchedForm]=\"isTouchedWAForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-wa>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'LINE'\">\r\n <lib-general-information-line\r\n [isTouchedForm]=\"isTouchedSMSForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-line>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'SMS'\">\r\n <lib-general-information-sms\r\n [isTouchedForm]=\"isTouchedSMSForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-sms>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"form.get('medium').value === 'EMAIL'\">\r\n <lib-general-information-email\r\n [isTouchedForm]=\"isTouchedEmailForm\"\r\n [isReadOnlyMode]=\"isReadOnlyMode\"\r\n (updateGeneralInformationForm)=\"updateGeneralInformationForm($event)\"\r\n ></lib-general-information-email>\r\n </ng-container>\r\n </mat-card-content>\r\n </mat-card>\r\n </div>\r\n\r\n <div class=\"campaign-info-child pl-20px\">\r\n <h3 class=\"font-22px font-PoppinsBold\">Broadcast Content</h3>\r\n\r\n <div\r\n [ngClass]=\"\r\n form.get('medium').value === 'SMS' || form.get('medium').value === 'EMAIL'\r\n ? 'campaign-border-preview'\r\n : 'campaign-preview'\r\n \"\r\n >\r\n <section\r\n *ngIf=\"\r\n form.get('medium').value === 'SMS' || form.get('medium').value === 'EMAIL'\r\n \"\r\n >\r\n <p\r\n *ngIf=\"getBody\"\r\n class=\"body my-2\"\r\n style=\"max-width: 500px; word-wrap: break-word\"\r\n [innerHTML]=\"getBody\"\r\n ></p>\r\n </section>\r\n\r\n <section *ngIf=\"form.get('medium').value === 'WA'\" class=\"campaign-preview__wa\">\r\n <div class=\"header-preview\">\r\n <div class=\"heading\">\r\n {{ getHeader }}\r\n </div>\r\n </div>\r\n <div class=\"body-preview\">\r\n <section *ngIf=\"getBody || getMedia || displayFile\">\r\n <div\r\n class=\"chat\"\r\n [ngClass]=\"{ 'no-bottom-border': getTemplate?.buttons?.length > 0 }\"\r\n >\r\n <img\r\n *ngIf=\"\r\n (getMedia === 'IMAGE' ||\r\n getTemplate?.header?.type?.toLowerCase() === 'image') &&\r\n displayFile\r\n \"\r\n style=\"max-width: 100%\"\r\n alt=\"image\"\r\n [src]=\"displayFile\"\r\n />\r\n\r\n <video\r\n *ngIf=\"\r\n (getMedia === 'VIDEO' ||\r\n getTemplate?.header?.type?.toLowerCase() === 'video') &&\r\n displayFile\r\n \"\r\n id=\"video\"\r\n style=\"width: 100%\"\r\n [src]=\"displayFile\"\r\n controls\r\n ></video>\r\n\r\n <div *ngIf=\"getMedia === 'DOCUMENT'\" style=\"display: flex\">\r\n <img\r\n style=\"width: 13px; height: 18px\"\r\n alt=\"document\"\r\n src=\"../../../../../assets/images/icon-file.png\"\r\n />\r\n\r\n <span style=\"margin-left: 10px\">Document</span>\r\n </div>\r\n\r\n <ng-container *ngIf=\"getMedia === 'LOCATION'\">\r\n <agm-map\r\n style=\"width: 100%; height: 200px\"\r\n [disableDefaultUI]=\"true\"\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [zoom]=\"maps.zoom\"\r\n >\r\n <agm-marker\r\n [latitude]=\"maps.latitude\"\r\n [longitude]=\"maps.longitude\"\r\n [markerDraggable]=\"false\"\r\n ></agm-marker>\r\n </agm-map>\r\n <a\r\n [href]=\"\r\n 'https://www.google.com/maps/search/?api=1&query=' +\r\n maps.latitude +\r\n ',' +\r\n maps.longitude\r\n \"\r\n >\r\n https://www.google.com/maps/search/?api=1&query={{\r\n maps.latitude\r\n }},{{ maps.longitude }}\r\n </a>\r\n </ng-container>\r\n\r\n <p *ngIf=\"getBody\" class=\"body my-2\" [innerHTML]=\"getBody\"></p>\r\n\r\n <p\r\n *ngIf=\"getTemplate?.footer\"\r\n class=\"mb-2\"\r\n style=\"color: rgb(160, 160, 160)\"\r\n >\r\n {{ getTemplate.footer }}\r\n </p>\r\n </div>\r\n </section>\r\n <section *ngIf=\"getTemplate?.buttons?.length > 0\">\r\n <div\r\n *ngFor=\"let button of getTemplateButton\"\r\n class=\"params-btn pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text || button?.type }}\r\n </p>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"getTemplate?.buttons?.length > 3\"\r\n class=\"params-btn pb-0 pointer\"\r\n (click)=\"isShowMore = !isShowMore\"\r\n >\r\n <p class=\"mb-0\"><mat-icon>list</mat-icon> See all options</p>\r\n </div>\r\n </section>\r\n </div>\r\n </section>\r\n\r\n <section *ngIf=\"form.get('medium').value === 'LINE'\" class=\"campaign-preview__line\">\r\n <div class=\"header-preview\">\r\n <div class=\"heading\">\r\n {{ getHeader }}\r\n </div>\r\n </div>\r\n <div class=\"body-preview\">\r\n <!-- Template Line Text -->\r\n <section *ngIf=\"isText || !isJSON\" class=\"chat\">\r\n <p class=\"body my-2\" [innerHTML]=\"getBody\"></p>\r\n </section>\r\n\r\n <!-- Template Line Button | Confirmation -->\r\n <section\r\n *ngIf=\"['buttons', 'confirm'].includes(getTemplateLine?.type)\"\r\n class=\"chat\"\r\n [ngClass]=\"{ 'no-bottom-border': getTemplateLine?.actions?.length > 0 }\"\r\n >\r\n <img\r\n *ngIf=\"getTemplateLine?.thumbnailImageUrl\"\r\n style=\"max-width: 100%\"\r\n class=\"mb-1\"\r\n [src]=\"getTemplateLine?.thumbnailImageUrl\"\r\n />\r\n\r\n <p\r\n *ngIf=\"getTemplateLine?.title\"\r\n class=\"font-PoppinsBold mb-1\"\r\n [innerHTML]=\"getTemplateLine?.title\"\r\n ></p>\r\n\r\n <p\r\n *ngIf=\"getTemplateLine?.text\"\r\n class=\"mb-0\"\r\n [innerHTML]=\"getTemplateLine?.text\"\r\n ></p>\r\n </section>\r\n\r\n <!-- Template Line Carousel -->\r\n <div\r\n *ngIf=\"['carousel'].includes(getTemplateLine?.type)\"\r\n class=\"d-flex gap-2 overflow-auto\"\r\n >\r\n <div *ngFor=\"let column of getTemplateLine?.columns\">\r\n <section\r\n class=\"chat w-100\"\r\n [ngClass]=\"{ 'no-bottom-border': column?.actions?.length > 0 }\"\r\n >\r\n <img\r\n *ngIf=\"column.thumbnailImageUrl\"\r\n style=\"max-width: 100%\"\r\n class=\"mb-1\"\r\n [src]=\"column.thumbnailImageUrl\"\r\n />\r\n\r\n <p\r\n *ngIf=\"column.title\"\r\n class=\"font-PoppinsBold mb-1\"\r\n [innerHTML]=\"column.title\"\r\n ></p>\r\n\r\n <p\r\n *ngIf=\"column.text\"\r\n class=\"mb-0\"\r\n [innerHTML]=\"column.text\"\r\n ></p>\r\n </section>\r\n <section *ngIf=\"column?.actions?.length > 0\">\r\n <div\r\n *ngFor=\"let button of column?.actions\"\r\n class=\"params-btn mw-100 pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text }}\r\n </p>\r\n </div>\r\n </section>\r\n </div>\r\n </div>\r\n\r\n <!-- Template Line Image Carousel -->\r\n <div\r\n *ngIf=\"['image_carousel'].includes(getTemplateLine?.type)\"\r\n class=\"d-flex gap-2 overflow-auto\"\r\n >\r\n <div *ngFor=\"let column of getTemplateLine?.columns\">\r\n <div class=\"image-container\">\r\n <img [src]=\"column.imageUrl\" alt=\"image\" />\r\n\r\n <div class=\"d-flex justify-content-center\">\r\n <p class=\"font-13px overlay-text\">\r\n {{ column.action.label }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Button Line -->\r\n <section\r\n *ngIf=\"\r\n getTemplateLine?.type !== 'confirm' &&\r\n getTemplateLine?.actions?.length > 0\r\n \"\r\n >\r\n <div\r\n *ngFor=\"let button of getTemplateLine?.actions\"\r\n class=\"params-btn pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text }}\r\n </p>\r\n </div>\r\n </section>\r\n <section\r\n *ngIf=\"\r\n getTemplateLine?.type === 'confirm' &&\r\n getTemplateLine?.actions?.length > 0\r\n \"\r\n class=\"d-flex justify-content-around mw-70 bg-white\"\r\n >\r\n <div\r\n *ngFor=\"let button of getTemplateLine?.actions\"\r\n class=\"params-btn flex pb-0 pointer\"\r\n >\r\n <p class=\"mb-0\">\r\n {{ button?.text }}\r\n </p>\r\n </div>\r\n </section>\r\n <!-- ./ Button Line -->\r\n </div>\r\n </section>\r\n </div>\r\n\r\n <div class=\"d-flex\" style=\"flex-direction: column\">\r\n <span\r\n *ngIf=\"form.get('medium').value === 'SMS'\"\r\n style=\"text-align: right; width: 100%\"\r\n >\r\n {{ twilioResultCounter.fulltext }}\r\n </span>\r\n <span\r\n style=\"text-align: right; width: 100%; color: red\"\r\n *ngIf=\"twilioResultCounter.segments > 10 && form.get('medium').value === 'SMS'\"\r\n >\r\n Maximum Segment is 10\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n\r\n<ng-template #isSpinner>\r\n <div class=\"text-center my-auto\">\r\n <img src=\"../../../../../assets/images/spinner.svg\" />\r\n </div>\r\n</ng-template>\r\n",
5353
- styles: [".campaign-info{display:flex}.campaign-info-child{flex:1}.campaign-info .asterix--after:after{content:\"*\";color:red}.campaign-info .pl-20px{padding-left:20px}.campaign-info .mw-70{max-width:70%}.campaign-info .campaign-preview{width:75%}.campaign-info .campaign-preview .header-preview{padding:15px;min-height:60px;border-radius:10px 10px 0 0}.campaign-info .campaign-preview .header-preview .heading{width:100%;color:#e0e0e0;margin-left:5px;font-size:20px}.campaign-info .campaign-preview .body-preview{padding:15px;min-height:470px}.campaign-info .campaign-preview .body-preview .chat{width:70%;padding:11px;font-size:14px;line-height:22px;color:#494949;border-radius:8px;background:#fff;overflow-wrap:break-word;white-space:pre-line;box-shadow:12px 12px 20px rgba(44,59,113,.04)}.campaign-info .campaign-preview .body-preview .chat .body{max-height:400px;overflow-y:auto;overscroll-behavior-y:contain}.campaign-info .campaign-preview .body-preview .chat.no-bottom-border{border-bottom-left-radius:0;border-bottom-right-radius:0}.campaign-info .campaign-preview__wa .header-preview{background:#065f54}.campaign-info .campaign-preview__wa .body-preview{border-bottom-left-radius:8px;border-bottom-right-radius:8px;background-image:url(../../../../../assets/svg/whatsapp-bg.svg);background-position:center;background-repeat:no-repeat;background-size:cover}.campaign-info .campaign-preview__wa .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__wa .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .header-preview{background:#273046}.campaign-info .campaign-preview__line .body-preview{background:#7692bf;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.campaign-info .campaign-preview__line .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__line .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .body-preview .image-container{position:relative;width:200px;height:200px}.campaign-info .campaign-preview__line .body-preview .image-container img{display:block;width:100%;height:100%}.campaign-info .campaign-preview__line .body-preview .image-container .overlay-text{top:170px;position:absolute;padding:2px 5px;color:#fff;background-color:rgba(49,57,60,.62);border-radius:10px}.campaign-info .campaign-border-preview{width:100%;min-height:100px;padding:32px;border:1px solid #e2e2e2;border-radius:8px}"]
5495
+ styles: [".campaign-info{display:flex}.campaign-info-child{flex:1}.campaign-info .asterix--after:after{content:\"*\";color:red}.campaign-info .pl-20px{padding-left:20px}.campaign-info .mw-70{max-width:70%}.campaign-info .campaign-preview{width:75%}.campaign-info .campaign-preview .header-preview{padding:15px;min-height:60px;border-radius:10px 10px 0 0}.campaign-info .campaign-preview .header-preview .heading{width:100%;color:#e0e0e0;margin-left:5px;font-size:20px}.campaign-info .campaign-preview .body-preview{padding:15px;min-height:470px}.campaign-info .campaign-preview .body-preview .chat{width:70%;padding:11px;font-size:14px;line-height:22px;color:#494949;border-radius:8px;background:#fff;overflow-wrap:break-word;white-space:pre-line;box-shadow:12px 12px 20px rgba(44,59,113,.04)}.campaign-info .campaign-preview .body-preview .chat .body{max-height:400px;overflow-y:auto;overscroll-behavior-y:contain}.campaign-info .campaign-preview .body-preview .chat.no-bottom-border{border-bottom-left-radius:0;border-bottom-right-radius:0}.campaign-info .campaign-preview__wa .header-preview{background:#065f54}.campaign-info .campaign-preview__wa .body-preview{border-bottom-left-radius:8px;border-bottom-right-radius:8px;background-image:url(../../../../assets/svg/whatsapp-bg.svg);background-position:center;background-repeat:no-repeat;background-size:cover}.campaign-info .campaign-preview__wa .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__wa .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .header-preview{background:#273046}.campaign-info .campaign-preview__line .body-preview{background:#7692bf;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.campaign-info .campaign-preview__line .body-preview .params-btn{width:auto;max-width:70%;color:#34b7f1;background:#fff;box-shadow:12px 12px 20px rgba(44,59,113,.04);border-radius:0;font-size:16px;line-height:43px;padding:0;text-align:center;font-family:Poppins;overflow-wrap:break-word}.campaign-info .campaign-preview__line .body-preview .params-btn b{font-family:PoppinsBold}.campaign-info .campaign-preview__line .body-preview .image-container{position:relative;width:200px;height:200px}.campaign-info .campaign-preview__line .body-preview .image-container img{display:block;width:100%;height:100%}.campaign-info .campaign-preview__line .body-preview .image-container .overlay-text{top:170px;position:absolute;padding:2px 5px;color:#fff;background-color:rgba(49,57,60,.62);border-radius:10px}.campaign-info .campaign-border-preview{width:100%;min-height:100px;padding:32px;border:1px solid #e2e2e2;border-radius:8px}"]
5354
5496
  })
5355
5497
  ], GeneralInformationComponent);
5356
5498
  return GeneralInformationComponent;
@@ -5411,15 +5553,16 @@ var NewNumberBasesComponent = /** @class */ (function () {
5411
5553
  });
5412
5554
  NewNumberBasesComponent.prototype.initEdit = function () {
5413
5555
  var _this = this;
5414
- var _a, _b, _c, _d, _e, _f, _g, _h;
5556
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5415
5557
  if (Object.entries(this.getCampaignStorage).length === 0)
5416
5558
  return;
5417
- this.isShowUploadCSV = (_c = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form) === null || _c === void 0 ? void 0 : _c.isUpload;
5559
+ var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5560
+ this.isShowUploadCSV = ((_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isUpload) || ((_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.isDownloadVariableXLS);
5418
5561
  this.fileSelected = {
5419
- name: (_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.targetAudienceFile) === null || _e === void 0 ? void 0 : _e.name,
5420
- targetURL: (_g = (_f = this.getCampaignStorage) === null || _f === void 0 ? void 0 : _f.targetAudienceFile) === null || _g === void 0 ? void 0 : _g.targetURL,
5562
+ name: (_f = (_e = this.getCampaignStorage) === null || _e === void 0 ? void 0 : _e.targetAudienceFile) === null || _f === void 0 ? void 0 : _f.name,
5563
+ targetURL: (_h = (_g = this.getCampaignStorage) === null || _g === void 0 ? void 0 : _g.targetAudienceFile) === null || _h === void 0 ? void 0 : _h.targetURL,
5421
5564
  };
5422
- (_h = this.table.dataSource.data) === null || _h === void 0 ? void 0 : _h.forEach(function (each) {
5565
+ (_j = this.table.dataSource.data) === null || _j === void 0 ? void 0 : _j.forEach(function (each) {
5423
5566
  var _a, _b;
5424
5567
  if ((_b = (_a = _this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.targetAudience) === null || _b === void 0 ? void 0 : _b.includes(each.id))
5425
5568
  _this.onChecked(true, each);
@@ -5588,13 +5731,25 @@ var NewNumberBasesComponent = /** @class */ (function () {
5588
5731
  return found ? true : false;
5589
5732
  };
5590
5733
  NewNumberBasesComponent.prototype.onDownloadSampleService = function () {
5591
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5734
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
5735
+ var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5736
+ var isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
5592
5737
  var parameterList = [
5593
- 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'),
5594
- 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'),
5595
- 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'),
5596
- this.initParam('category', (_p = (_o = this.categorySelected) === null || _o === void 0 ? void 0 : _o.map(function (t) { return t.id; }).join(), (_p !== null && _p !== void 0 ? _p : [])), 'string'),
5738
+ this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
5597
5739
  ];
5740
+ if (isNeedSave) {
5741
+ // SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
5742
+ parameterList.push(this.initParam('templateName', (_g = (_f = genInfoForm) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.name, 'string'), this.initParam('templateLang', (_j = (_h = genInfoForm) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.lang, 'string'), this.initParam('category', (_l = (_k = this.categorySelected) === null || _k === void 0 ? void 0 : _k.map(function (t) { return t.id; }).join(), (_l !== null && _l !== void 0 ? _l : '')), 'string'));
5743
+ }
5744
+ else {
5745
+ // SKENARIO 2: CREATE NEW (Belum disave, butuh text & examples)
5746
+ parameterList.push(this.initParam('bodyText', (_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.text, 'string'));
5747
+ var variables = (_o = genInfoForm) === null || _o === void 0 ? void 0 : _o.variables;
5748
+ if (variables && Array.isArray(variables) && variables.length > 0) {
5749
+ var bodyExamplesString = variables.map(function (v) { return v.paramName; }).join(',');
5750
+ parameterList.push(this.initParam('bodyExamples', bodyExamplesString, 'string'));
5751
+ }
5752
+ }
5598
5753
  var subs = this.apiAdapterService
5599
5754
  .executeApiRequest(parameterList, '/message/bulkupload/template', 'GET', true)
5600
5755
  .subscribe(function (resp) {
@@ -5970,5 +6125,5 @@ var ConfirmationModule = /** @class */ (function () {
5970
6125
  * Generated bundle index. Do not edit.
5971
6126
  */
5972
6127
 
5973
- export { AdlCampaignManagementLibraryInternalComponent, AdlCampaignManagementLibraryInternalModule, CampaignIndexModule, CampaignManagementComponent, CampaignManagementModule, ConfirmationComponent, ConfirmationModule, DashboardModule, SearchModule, WizardComponent as ɵa, NewCampaignComponent as ɵb, GeneralInformationComponent as ɵc, SchedulerComponent as ɵd, SummaryComponent as ɵe, NewNumberBasesComponent as ɵf, GeneralInformationLineComponent as ɵg, GeneralInformationWAComponent as ɵh, GeneralInformationSMSComponent as ɵi, GeneralInformationEmailComponent as ɵj, PendingApprovalDialogViewComponent as ɵk, FailoverMechanismComponent as ɵl, DashboardComponent as ɵm, ApiAdapterServiceService as ɵn, SearchComponent as ɵo, ViewingListOfCampaignTableComponent as ɵp, FilterInListOfCampaignComponent as ɵq, CampaignIndexComponent as ɵr, ApiAdapterServiceService as ɵs, MatSelectInfiniteScrollDirective as ɵt, InputNumericModule as ɵu, InputNumericComponent as ɵv, CustomPaginator as ɵw, ConfirmationComponent as ɵx, ConfirmationModel as ɵy, SharedServicesService as ɵz };
6128
+ export { AdlCampaignManagementLibraryInternalComponent, AdlCampaignManagementLibraryInternalModule, CampaignIndexComponent, CampaignIndexModule, CampaignManagementComponent, CampaignManagementModule, ConfirmationComponent, ConfirmationModule, DashboardComponent, DashboardModule, MatSelectInfiniteScrollDirective, SearchComponent, SearchModule, SummaryComponent, WizardComponent as ɵa, NewCampaignComponent as ɵb, GeneralInformationComponent as ɵc, SchedulerComponent as ɵd, SummaryComponent as ɵe, NewNumberBasesComponent as ɵf, GeneralInformationLineComponent as ɵg, GeneralInformationWAComponent as ɵh, GeneralInformationSMSComponent as ɵi, GeneralInformationEmailComponent as ɵj, PendingApprovalDialogViewComponent as ɵk, FailoverMechanismComponent as ɵl, ApiAdapterServiceService as ɵm, ViewingListOfCampaignTableComponent as ɵn, FilterInListOfCampaignComponent as ɵo, ApiAdapterServiceService as ɵp, MatSelectInfiniteScrollDirective as ɵq, InputNumericModule as ɵr, InputNumericComponent as ɵs, CustomPaginator as ɵt, ConfirmationComponent as ɵu, ConfirmationModel as ɵv, SharedServicesService as ɵw };
5974
6129
  //# sourceMappingURL=adlfe-campaign-management-library.js.map