@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
@@ -770,11 +770,11 @@ else if (origin.includes('dashboard-qa')) {
770
770
  }
771
771
  // 4. Cek Demo Dev secara spesifik
772
772
  else if (origin.includes('demo-dev')) {
773
- API_CONST = 'https://apibsp-dev.adlsandbox.net';
773
+ API_CONST = 'https://api-staging.neuapix.com';
774
774
  }
775
775
  // 5. Default (Localhost atau lainnya)
776
776
  else {
777
- API_CONST = 'https://apibsp-dev.adlsandbox.net';
777
+ API_CONST = 'https://api-staging.neuapix.com';
778
778
  }
779
779
  const environment = {
780
780
  production: false,
@@ -1386,6 +1386,7 @@ const GeneralInformationWAMessageValidationConst = {
1386
1386
  catalogue: [{ type: 'required', message: 'Catalog is required' }],
1387
1387
  product: [{ type: 'required', message: 'Product is required' }],
1388
1388
  body: [{ type: 'maxlength', message: 'Maximum character 100' }],
1389
+ paramName: [{ type: 'required', message: 'Variable Name is required' }],
1389
1390
  };
1390
1391
  const GeneralInformationEmailMessageValidationConst = {
1391
1392
  channel: [{ type: 'required', message: 'Message Type is required' }],
@@ -1668,7 +1669,7 @@ FilterInListOfCampaignComponent = __decorate([
1668
1669
  Component({
1669
1670
  selector: 'lib-filter-in-list-of-campaign',
1670
1671
  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",
1671
- 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}"]
1672
+ 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}"]
1672
1673
  }),
1673
1674
  Injectable({
1674
1675
  providedIn: 'root',
@@ -2383,14 +2384,12 @@ class FailoverAccountReqModel {
2383
2384
 
2384
2385
  class GeneralInformationWAReqModel {
2385
2386
  clone(source) {
2386
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2387
- /* Source Mapping */
2387
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2388
2388
  if (((_a = source) === null || _a === void 0 ? void 0 : _a.media) === 'IMAGE' ||
2389
2389
  ((_b = source) === null || _b === void 0 ? void 0 : _b.media) === 'VIDEO' ||
2390
2390
  ((_c = source) === null || _c === void 0 ? void 0 : _c.media) === 'DOCUMENT') {
2391
2391
  source.channel = source.media;
2392
2392
  }
2393
- /* ./ Source Mapping */
2394
2393
  if (source.campaignName) {
2395
2394
  this.name = source.campaignName;
2396
2395
  }
@@ -2422,6 +2421,12 @@ class GeneralInformationWAReqModel {
2422
2421
  fileName: source.fileName,
2423
2422
  };
2424
2423
  }
2424
+ if (source.buttonParams && Array.isArray(source.buttonParams)) {
2425
+ this.buttonParams = source.buttonParams.map((btn) => ({
2426
+ label: btn.label,
2427
+ payload: btn.payload ? btn.payload : btn.label,
2428
+ }));
2429
+ }
2425
2430
  if (source.template) {
2426
2431
  this.template = {
2427
2432
  id: source.template.ID,
@@ -2429,12 +2434,21 @@ class GeneralInformationWAReqModel {
2429
2434
  lang: source.template.lang,
2430
2435
  headerUrl: source.targetURL,
2431
2436
  header: (_g = (_f = source.paramHeader) === null || _f === void 0 ? void 0 : _f.map((t) => t.name), (_g !== null && _g !== void 0 ? _g : [])),
2432
- data: (_j = (_h = source.paramBody) === null || _h === void 0 ? void 0 : _h.map((t) => t.name), (_j !== null && _j !== void 0 ? _j : [])),
2433
- button: (_k = source.paramButton) === null || _k === void 0 ? void 0 : _k.reduce((result, each) => {
2437
+ data: ((_h = source.variables) === null || _h === void 0 ? void 0 : _h.length) ? source.variables.map((v) => v.paramName)
2438
+ : (_k = (_j = source.paramBody) === null || _j === void 0 ? void 0 : _j.map((t) => t.name), (_k !== null && _k !== void 0 ? _k : [])),
2439
+ button: (_l = source.paramButton) === null || _l === void 0 ? void 0 : _l.reduce((result, each) => {
2434
2440
  var _a;
2435
2441
  result.push((_a = each.name.map((t) => t.name), (_a !== null && _a !== void 0 ? _a : [])));
2436
2442
  return result;
2437
2443
  }, []),
2444
+ buttonParams: source.buttonParams
2445
+ ? source.buttonParams.map((btn) => {
2446
+ return {
2447
+ label: btn.label,
2448
+ payload: btn.payload ? btn.payload : btn.label,
2449
+ };
2450
+ })
2451
+ : [],
2438
2452
  };
2439
2453
  if (source.template.category === 'AUTHENTICATION')
2440
2454
  this.template = {
@@ -2443,6 +2457,7 @@ class GeneralInformationWAReqModel {
2443
2457
  header: null,
2444
2458
  data: [source.otpValue],
2445
2459
  button: [[source.otpValue]],
2460
+ buttonParams: [],
2446
2461
  };
2447
2462
  if (source.template.ID)
2448
2463
  this.template.id = source.template.ID;
@@ -2450,11 +2465,25 @@ class GeneralInformationWAReqModel {
2450
2465
  if (this.type === 'utility') {
2451
2466
  this.type = 'template';
2452
2467
  this.category = 'utility';
2453
- 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: [] };
2468
+ const mappedVariables = ((_o = (_m = source) === null || _m === void 0 ? void 0 : _m.variables) === null || _o === void 0 ? void 0 : _o.length) ? source.variables.map((v) => v.paramName)
2469
+ : [];
2470
+ if ((_p = source) === null || _p === void 0 ? void 0 : _p.isUseExistingTemplate) {
2471
+ this.template = Object.assign(Object.assign({}, source.template), { data: mappedVariables.length > 0 ? mappedVariables : source.template.data || [] });
2472
+ }
2473
+ else {
2474
+ this.template = {
2475
+ name: '',
2476
+ lang: 'id',
2477
+ header: null,
2478
+ button: null,
2479
+ data: mappedVariables,
2480
+ buttonParams: [],
2481
+ };
2482
+ }
2454
2483
  this.isNeedSave = source.isNeedSave;
2455
2484
  this.ttlSeconds = source.ttl;
2456
- if ((_o = source) === null || _o === void 0 ? void 0 : _o.isUseExistingTemplate) {
2457
- 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;
2485
+ if ((_q = source) === null || _q === void 0 ? void 0 : _q.isUseExistingTemplate) {
2486
+ 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);
2458
2487
  }
2459
2488
  }
2460
2489
  return this;
@@ -3889,9 +3918,8 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
3889
3918
  /* this.setCurrentLocation(); */
3890
3919
  }
3891
3920
  get getCampaignStorage() {
3892
- return localStorage.getItem('telin.campaign')
3893
- ? JSON.parse(localStorage.getItem('telin.campaign'))
3894
- : {};
3921
+ const campaignData = localStorage.getItem('telin.campaign');
3922
+ return campaignData ? JSON.parse(campaignData) : {};
3895
3923
  }
3896
3924
  initForm() {
3897
3925
  this.form = new FormGroup({
@@ -3919,6 +3947,10 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
3919
3947
  isUseExistingTemplate: new FormControl(false),
3920
3948
  isNeedSave: new FormControl(false),
3921
3949
  ttl: new FormControl(null),
3950
+ isDownloadVariableXLS: new FormControl(false),
3951
+ variables: new FormArray([]),
3952
+ useXlsx: new FormControl(false),
3953
+ buttonParams: new FormArray([]),
3922
3954
  });
3923
3955
  this.form.valueChanges.subscribe(() => {
3924
3956
  setTimeout(() => {
@@ -3933,132 +3965,150 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
3933
3965
  this.form.disable();
3934
3966
  }
3935
3967
  initEdit() {
3936
- 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;
3937
- if (Object.entries(this.getCampaignStorage).length === 0 ||
3938
- ((_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')
3968
+ 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;
3969
+ const storageData = this.getCampaignStorage;
3970
+ const formValues = (_b = (_a = storageData) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
3971
+ if (!storageData ||
3972
+ Object.entries(storageData).length === 0 ||
3973
+ ((_c = formValues) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA') {
3939
3974
  return;
3940
- this.form
3941
- .get('channel')
3942
- .setValue((_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.generalInformation) === null || _e === void 0 ? void 0 : _e.form.channel);
3943
- 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);
3944
- 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);
3945
- 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);
3946
- this.form
3947
- .get('targetURL')
3948
- .setValue((_o = (_m = this.getCampaignStorage) === null || _m === void 0 ? void 0 : _m.generalInformation) === null || _o === void 0 ? void 0 : _o.form.targetURL);
3949
- this.form
3950
- .get('fileName')
3951
- .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)));
3952
- this.form
3953
- .get('template')
3954
- .setValue((_t = (_s = this.getCampaignStorage) === null || _s === void 0 ? void 0 : _s.generalInformation) === null || _t === void 0 ? void 0 : _t.form.template);
3955
- this.form
3956
- .get('isUpload')
3957
- .setValue((_v = (_u = this.getCampaignStorage) === null || _u === void 0 ? void 0 : _u.generalInformation) === null || _v === void 0 ? void 0 : _v.form.isUpload);
3958
- 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);
3959
- this.form
3960
- .get('otpValue')
3961
- .setValue((_z = (_y = this.getCampaignStorage) === null || _y === void 0 ? void 0 : _y.generalInformation) === null || _z === void 0 ? void 0 : _z.form.otpValue);
3962
- this.form
3963
- .get('isUseExistingTemplate')
3964
- .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));
3965
- this.form
3966
- .get('isNeedSave')
3967
- .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));
3968
- 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);
3969
- this.isHaveTemplateParam = this.form.get('isUpload').value;
3970
- this.getTemplateOptionService(null, (_9 = this.form.get('template').value) === null || _9 === void 0 ? void 0 : _9.name);
3975
+ }
3976
+ (_d = this.getControl('channel')) === null || _d === void 0 ? void 0 : _d.setValue((_e = formValues) === null || _e === void 0 ? void 0 : _e.channel);
3977
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValue((_g = formValues) === null || _g === void 0 ? void 0 : _g.media);
3978
+ (_h = this.getControl('from')) === null || _h === void 0 ? void 0 : _h.setValue((_j = formValues) === null || _j === void 0 ? void 0 : _j.from);
3979
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.setValue((_l = formValues) === null || _l === void 0 ? void 0 : _l.text);
3980
+ (_m = this.getControl('targetURL')) === null || _m === void 0 ? void 0 : _m.setValue((_o = formValues) === null || _o === void 0 ? void 0 : _o.targetURL);
3981
+ (_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)));
3982
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.setValue((_u = formValues) === null || _u === void 0 ? void 0 : _u.template);
3983
+ (_v = this.getControl('isUpload')) === null || _v === void 0 ? void 0 : _v.setValue((_w = formValues) === null || _w === void 0 ? void 0 : _w.isUpload);
3984
+ (_x = this.getControl('fileId')) === null || _x === void 0 ? void 0 : _x.setValue((_y = formValues) === null || _y === void 0 ? void 0 : _y.fileId);
3985
+ (_z = this.getControl('otpValue')) === null || _z === void 0 ? void 0 : _z.setValue((_0 = formValues) === null || _0 === void 0 ? void 0 : _0.otpValue);
3986
+ (_1 = this.getControl('isUseExistingTemplate')) === null || _1 === void 0 ? void 0 : _1.setValue(!!((_2 = formValues) === null || _2 === void 0 ? void 0 : _2.templateName));
3987
+ (_3 = this.getControl('isNeedSave')) === null || _3 === void 0 ? void 0 : _3.setValue(!!((_4 = formValues) === null || _4 === void 0 ? void 0 : _4.isNeedSave));
3988
+ (_5 = this.getControl('ttl')) === null || _5 === void 0 ? void 0 : _5.setValue((_6 = formValues) === null || _6 === void 0 ? void 0 : _6.ttl);
3989
+ const savedVariables = (_7 = formValues) === null || _7 === void 0 ? void 0 : _7.variables;
3990
+ if (savedVariables && Array.isArray(savedVariables) && savedVariables.length > 0) {
3991
+ this.variables.clear();
3992
+ savedVariables.forEach((item) => {
3993
+ this.variables.push(new FormGroup({
3994
+ paramName: new FormControl({ value: item.paramName || '', disabled: this.isReadOnlyMode }, Validators$1.required),
3995
+ }));
3996
+ });
3997
+ }
3998
+ this.isHaveTemplateParam = (_8 = this.getControl('isUpload')) === null || _8 === void 0 ? void 0 : _8.value;
3999
+ this.getTemplateOptionService(null, (_10 = (_9 = this.getControl('template')) === null || _9 === void 0 ? void 0 : _9.value) === null || _10 === void 0 ? void 0 : _10.name);
3971
4000
  }
3972
4001
  initValidation() {
4002
+ 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;
4003
+ if (!this.form)
4004
+ return;
3973
4005
  for (const key in this.form.controls) {
3974
- this.form.controls[key].clearValidators();
3975
- this.form.controls[key].updateValueAndValidity();
4006
+ if (this.form.controls[key]) {
4007
+ this.form.controls[key].clearValidators();
4008
+ this.form.controls[key].updateValueAndValidity();
4009
+ }
3976
4010
  }
3977
- this.form.get('channel').setValidators(Validators$1.required);
4011
+ (_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.setValidators(Validators$1.required);
3978
4012
  if (this.getIsText) {
3979
- this.form.get('from').setValidators(Validators$1.required);
3980
- this.form.get('text').setValidators(Validators$1.required);
3981
- this.form.get('from').updateValueAndValidity();
3982
- this.form.get('text').updateValueAndValidity();
4013
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.setValidators(Validators$1.required);
4014
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.setValidators(Validators$1.required);
4015
+ (_d = this.getControl('from')) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4016
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
3983
4017
  }
3984
4018
  else if (this.getIsMedia) {
3985
- this.form.get('media').setValidators(Validators$1.required);
3986
- this.form.get('from').setValidators(Validators$1.required);
3987
- this.form.get('fileName').setValidators(Validators$1.required);
3988
- this.form.get('media').updateValueAndValidity();
3989
- this.form.get('from').updateValueAndValidity();
3990
- this.form.get('fileName').updateValueAndValidity();
4019
+ (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValidators(Validators$1.required);
4020
+ (_g = this.getControl('from')) === null || _g === void 0 ? void 0 : _g.setValidators(Validators$1.required);
4021
+ (_h = this.getControl('fileName')) === null || _h === void 0 ? void 0 : _h.setValidators(Validators$1.required);
4022
+ (_j = this.getControl('media')) === null || _j === void 0 ? void 0 : _j.updateValueAndValidity();
4023
+ (_k = this.getControl('from')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4024
+ (_l = this.getControl('fileName')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
3991
4025
  }
3992
4026
  else if (this.getIsTemplate) {
3993
- this.form.get('from').setValidators(Validators$1.required);
3994
- this.form.get('template').setValidators(Validators$1.required);
3995
- this.form.get('paramHeader').setValidators(Validators$1.required);
3996
- this.form.get('paramBody').setValidators(Validators$1.required);
3997
- this.form.get('paramButton').setValidators(Validators$1.required);
3998
- this.form.get('from').updateValueAndValidity();
3999
- this.form.get('template').updateValueAndValidity();
4000
- this.form.get('paramHeader').updateValueAndValidity();
4001
- this.form.get('paramBody').updateValueAndValidity();
4002
- this.form.get('paramButton').updateValueAndValidity();
4027
+ (_m = this.getControl('from')) === null || _m === void 0 ? void 0 : _m.setValidators(Validators$1.required);
4028
+ (_o = this.getControl('template')) === null || _o === void 0 ? void 0 : _o.setValidators(Validators$1.required);
4029
+ (_p = this.getControl('paramHeader')) === null || _p === void 0 ? void 0 : _p.setValidators(Validators$1.required);
4030
+ (_q = this.getControl('paramBody')) === null || _q === void 0 ? void 0 : _q.setValidators(Validators$1.required);
4031
+ (_r = this.getControl('paramButton')) === null || _r === void 0 ? void 0 : _r.setValidators(Validators$1.required);
4032
+ (_s = this.getControl('from')) === null || _s === void 0 ? void 0 : _s.updateValueAndValidity();
4033
+ (_t = this.getControl('template')) === null || _t === void 0 ? void 0 : _t.updateValueAndValidity();
4034
+ (_u = this.getControl('paramHeader')) === null || _u === void 0 ? void 0 : _u.updateValueAndValidity();
4035
+ (_v = this.getControl('paramBody')) === null || _v === void 0 ? void 0 : _v.updateValueAndValidity();
4036
+ (_w = this.getControl('paramButton')) === null || _w === void 0 ? void 0 : _w.updateValueAndValidity();
4003
4037
  }
4004
4038
  else if (this.getIsCatalogue) {
4005
- this.form.get('from').setValidators(Validators$1.required);
4006
- this.form.get('category').setValidators(Validators$1.required);
4007
- this.form.get('catalogue').setValidators(Validators$1.required);
4008
- this.form.get('product').setValidators(Validators$1.required);
4009
- this.form.get('body').setValidators(Validators$1.maxLength(100));
4010
- this.form.get('from').updateValueAndValidity();
4011
- this.form.get('category').updateValueAndValidity();
4012
- this.form.get('catalogue').updateValueAndValidity();
4013
- this.form.get('product').updateValueAndValidity();
4014
- this.form.get('body').updateValueAndValidity();
4039
+ (_x = this.getControl('from')) === null || _x === void 0 ? void 0 : _x.setValidators(Validators$1.required);
4040
+ (_y = this.getControl('category')) === null || _y === void 0 ? void 0 : _y.setValidators(Validators$1.required);
4041
+ (_z = this.getControl('catalogue')) === null || _z === void 0 ? void 0 : _z.setValidators(Validators$1.required);
4042
+ (_0 = this.getControl('product')) === null || _0 === void 0 ? void 0 : _0.setValidators(Validators$1.required);
4043
+ (_1 = this.getControl('body')) === null || _1 === void 0 ? void 0 : _1.setValidators(Validators$1.maxLength(100));
4044
+ (_2 = this.getControl('from')) === null || _2 === void 0 ? void 0 : _2.updateValueAndValidity();
4045
+ (_3 = this.getControl('category')) === null || _3 === void 0 ? void 0 : _3.updateValueAndValidity();
4046
+ (_4 = this.getControl('catalogue')) === null || _4 === void 0 ? void 0 : _4.updateValueAndValidity();
4047
+ (_5 = this.getControl('product')) === null || _5 === void 0 ? void 0 : _5.updateValueAndValidity();
4048
+ (_6 = this.getControl('body')) === null || _6 === void 0 ? void 0 : _6.updateValueAndValidity();
4015
4049
  }
4016
4050
  else if (this.getIsUtility) {
4017
- this.form.get('from').setValidators(Validators$1.required);
4018
- this.form.get('text').setValidators([Validators$1.required, Validators$1.maxLength(1024)]);
4019
- this.form
4020
- .get('ttl')
4021
- .setValidators([
4051
+ (_7 = this.getControl('from')) === null || _7 === void 0 ? void 0 : _7.setValidators(Validators$1.required);
4052
+ (_8 = this.getControl('text')) === null || _8 === void 0 ? void 0 : _8.setValidators([
4053
+ Validators$1.required,
4054
+ Validators$1.maxLength(1024),
4055
+ ]);
4056
+ (_9 = this.getControl('ttl')) === null || _9 === void 0 ? void 0 : _9.setValidators([
4022
4057
  Validators.min(30, 'Minimum TTL 30'),
4023
4058
  Validators.max(43200, 'Maximum TTL 43200'),
4024
4059
  ]);
4025
- this.form.get('from').updateValueAndValidity();
4026
- this.form.get('text').updateValueAndValidity();
4027
- this.form.get('ttl').updateValueAndValidity();
4060
+ (_10 = this.getControl('from')) === null || _10 === void 0 ? void 0 : _10.updateValueAndValidity();
4061
+ (_11 = this.getControl('text')) === null || _11 === void 0 ? void 0 : _11.updateValueAndValidity();
4062
+ (_12 = this.getControl('ttl')) === null || _12 === void 0 ? void 0 : _12.updateValueAndValidity();
4063
+ (_13 = this.getControl('variables')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4028
4064
  }
4029
4065
  else {
4030
- this.form.get('from').setValidators(Validators$1.required);
4031
- this.form.get('text').setValidators(Validators$1.required);
4032
- this.form.get('from').updateValueAndValidity();
4033
- this.form.get('text').updateValueAndValidity();
4066
+ (_14 = this.getControl('from')) === null || _14 === void 0 ? void 0 : _14.setValidators(Validators$1.required);
4067
+ (_15 = this.getControl('text')) === null || _15 === void 0 ? void 0 : _15.setValidators(Validators$1.required);
4068
+ (_16 = this.getControl('from')) === null || _16 === void 0 ? void 0 : _16.updateValueAndValidity();
4069
+ (_17 = this.getControl('text')) === null || _17 === void 0 ? void 0 : _17.updateValueAndValidity();
4034
4070
  }
4035
4071
  }
4036
4072
  formReset(_isMediaType = false) {
4073
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
4037
4074
  if (!_isMediaType) {
4038
- this.form.get('media').reset();
4039
- this.form.get('from').reset();
4075
+ (_a = this.getControl('media')) === null || _a === void 0 ? void 0 : _a.reset();
4076
+ (_b = this.getControl('from')) === null || _b === void 0 ? void 0 : _b.reset();
4077
+ }
4078
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.reset();
4079
+ (_d = this.getControl('fileName')) === null || _d === void 0 ? void 0 : _d.reset();
4080
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.reset();
4081
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.reset();
4082
+ (_g = this.getControl('file')) === null || _g === void 0 ? void 0 : _g.reset();
4083
+ (_h = this.getControl('latitude')) === null || _h === void 0 ? void 0 : _h.reset();
4084
+ (_j = this.getControl('longitude')) === null || _j === void 0 ? void 0 : _j.reset();
4085
+ (_k = this.getControl('template')) === null || _k === void 0 ? void 0 : _k.reset();
4086
+ (_l = this.getControl('category')) === null || _l === void 0 ? void 0 : _l.reset();
4087
+ (_m = this.getControl('product')) === null || _m === void 0 ? void 0 : _m.reset();
4088
+ (_o = this.getControl('catalogue')) === null || _o === void 0 ? void 0 : _o.reset();
4089
+ (_p = this.getControl('body')) === null || _p === void 0 ? void 0 : _p.reset();
4090
+ (_q = this.getControl('otpValue')) === null || _q === void 0 ? void 0 : _q.reset();
4091
+ (_r = this.getControl('variables')) === null || _r === void 0 ? void 0 : _r.reset();
4092
+ const paramHeader = this.getControl('paramHeader');
4093
+ if (paramHeader) {
4094
+ paramHeader.clear();
4095
+ paramHeader.reset();
4096
+ }
4097
+ const paramBody = this.getControl('paramBody');
4098
+ if (paramBody) {
4099
+ paramBody.clear();
4100
+ paramBody.reset();
4101
+ }
4102
+ const paramButton = this.getControl('paramButton');
4103
+ if (paramButton) {
4104
+ paramButton.clear();
4105
+ paramButton.reset();
4040
4106
  }
4041
- this.form.get('text').reset();
4042
- this.form.get('fileName').reset();
4043
- this.form.get('targetURL').reset();
4044
- this.form.get('fileType').reset();
4045
- this.form.get('file').reset();
4046
- this.form.get('latitude').reset();
4047
- this.form.get('longitude').reset();
4048
- this.form.get('template').reset();
4049
- this.form.get('category').reset();
4050
- this.form.get('product').reset();
4051
- this.form.get('catalogue').reset();
4052
- this.form.get('body').reset();
4053
- this.form.get('otpValue').reset();
4054
- this.form.get('paramHeader').controls = [];
4055
- this.form.get('paramHeader').reset();
4056
- this.form.get('paramBody').controls = [];
4057
- this.form.get('paramBody').reset();
4058
- this.form.get('paramButton').controls = [];
4059
- this.form.get('paramButton').reset();
4060
4107
  this.initValidation();
4061
4108
  }
4109
+ getControl(controlName) {
4110
+ return this.form ? this.form.get(controlName) : null;
4111
+ }
4062
4112
  initParam(_name, _value, _type) {
4063
4113
  return {
4064
4114
  name: _name,
@@ -4079,16 +4129,17 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4079
4129
  const subs = this.apiAdapterService
4080
4130
  .executeApiRequest(parameterList, '/admin/account', 'GET')
4081
4131
  .subscribe((resp) => {
4132
+ var _a;
4082
4133
  if (!resp.data)
4083
4134
  return;
4084
4135
  this.accountOption = isInfinite ? [...this.accountOption, ...resp.data] : resp.data;
4085
- this.isHaveNextAccountOption = resp.haveNext;
4136
+ this.isHaveNextAccountOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4086
4137
  this.isLoadingAccountOption = false;
4087
4138
  });
4088
4139
  this.subscribers.push(subs);
4089
4140
  }
4090
4141
  getTemplateOptionService(event = null, filter = '', isInfinite = false) {
4091
- var _a, _b, _c, _d;
4142
+ var _a, _b, _c, _d, _e, _f, _g;
4092
4143
  this.isLoadingTemplateOption = true;
4093
4144
  const parameterList = [
4094
4145
  this.initParam('pageNo', this.pageNoTemplateOption, 'number'),
@@ -4096,31 +4147,31 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4096
4147
  this.initParam('platform', 'WA', 'string'),
4097
4148
  this.initParam('filter', filter, 'string'),
4098
4149
  this.initParam('status', 'APPROVED', 'string'),
4099
- this.initParam('clientId', (_a = this.form.get('from').value) === null || _a === void 0 ? void 0 : _a.clientId, 'string'),
4100
- 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'),
4150
+ 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'),
4151
+ 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'),
4101
4152
  ];
4102
4153
  if (this.isReadOnlyMode)
4103
4154
  parameterList.push(this.initParam('summary', true, 'string'));
4104
- const messageType = (_d = this.form.value) === null || _d === void 0 ? void 0 : _d.channel;
4155
+ const messageType = (_g = this.form.value) === null || _g === void 0 ? void 0 : _g.channel;
4105
4156
  if (messageType === 'utility') {
4106
4157
  parameterList.push(this.initParam('isDirectSend', true, 'string'));
4107
4158
  }
4108
4159
  const subs = this.apiAdapterService
4109
4160
  .executeApiRequest(parameterList, '/message/template', 'GET')
4110
4161
  .subscribe((resp) => {
4111
- var _a;
4112
- this.templateOption = isInfinite
4113
- ? [...this.templateOption, ...resp.data]
4114
- : resp.data;
4115
- this.isHaveNextTemplateOption = resp.haveNext;
4162
+ var _a, _b, _c, _d, _e, _f;
4163
+ const currentOptions = this.templateOption || [];
4164
+ const newData = resp.data || [];
4165
+ this.templateOption = isInfinite ? [...currentOptions, ...newData] : newData;
4166
+ this.isHaveNextTemplateOption = (_a = resp.haveNext, (_a !== null && _a !== void 0 ? _a : true));
4116
4167
  this.isLoadingTemplateOption = false;
4117
- const template = (_a = this.templateOption) === null || _a === void 0 ? void 0 : _a.find((t) => { var _a; return t.ID === ((_a = this.form.get('template').value) === null || _a === void 0 ? void 0 : _a.ID); });
4168
+ const template = (_b = this.templateOption) === null || _b === void 0 ? void 0 : _b.find((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); });
4118
4169
  if (template) {
4119
- this.form.get('template').setValue(template);
4120
- if (this.form.get('isUpload').value)
4121
- return this.updateDownloadCSV(this.form.get('isUpload').value);
4170
+ (_c = this.getControl('template')) === null || _c === void 0 ? void 0 : _c.patchValue(template);
4171
+ if ((_d = this.getControl('isUpload')) === null || _d === void 0 ? void 0 : _d.value)
4172
+ return this.updateDownloadCSV((_e = this.getControl('isUpload')) === null || _e === void 0 ? void 0 : _e.value);
4122
4173
  }
4123
- this.updateTemplate(this.form.get('template').value);
4174
+ this.updateTemplate((_f = this.getControl('template')) === null || _f === void 0 ? void 0 : _f.value);
4124
4175
  });
4125
4176
  this.subscribers.push(subs);
4126
4177
  }
@@ -4163,29 +4214,29 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4163
4214
  this.form.get('paramButton').push(form);
4164
4215
  }
4165
4216
  get getIsText() {
4166
- var _a;
4167
- return (this.form.get('channel').value &&
4168
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'text');
4217
+ var _a, _b, _c;
4218
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4219
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'text');
4169
4220
  }
4170
4221
  get getIsMedia() {
4171
- var _a;
4172
- return (this.form.get('channel').value &&
4173
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'media');
4222
+ var _a, _b, _c;
4223
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4224
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'media');
4174
4225
  }
4175
4226
  get getIsTemplate() {
4176
- var _a;
4177
- return (this.form.get('channel').value &&
4178
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'template');
4227
+ var _a, _b, _c;
4228
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4229
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'template');
4179
4230
  }
4180
4231
  get getIsCatalogue() {
4181
- var _a;
4182
- return (this.form.get('channel').value &&
4183
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'catalogue');
4232
+ var _a, _b, _c;
4233
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4234
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'catalogue');
4184
4235
  }
4185
4236
  get getIsUtility() {
4186
- var _a;
4187
- return (this.form.get('channel').value &&
4188
- ((_a = this.form.get('channel').value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'utility');
4237
+ var _a, _b, _c;
4238
+ return (((_a = this.getControl('channel')) === null || _a === void 0 ? void 0 : _a.value) &&
4239
+ ((_c = (_b = this.getControl('channel')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'utility');
4189
4240
  }
4190
4241
  getNextAccountBatch() {
4191
4242
  if (!this.isHaveNextAccountOption)
@@ -4210,6 +4261,7 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4210
4261
  : '';
4211
4262
  }
4212
4263
  onFileSelected(event) {
4264
+ var _a, _b, _c, _d, _e, _f;
4213
4265
  const file = event.target.files;
4214
4266
  const accept = this.extFileAccepted.split('/');
4215
4267
  let matchType = accept[0];
@@ -4225,20 +4277,21 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4225
4277
  this.toastr.error('Upload media failed, max size 10mb');
4226
4278
  return;
4227
4279
  }
4228
- this.form.get('file').setValue(file[0]);
4229
- this.form.get('fileType').setValue('image');
4230
- this.form.get('fileName').setValue(file[0].name);
4231
- this.form.get('targetURL').setValidators(Validators$1.required);
4232
- this.form.get('targetURL').updateValueAndValidity();
4280
+ (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.setValue(file[0]);
4281
+ (_b = this.getControl('fileType')) === null || _b === void 0 ? void 0 : _b.setValue('image');
4282
+ (_c = this.getControl('fileName')) === null || _c === void 0 ? void 0 : _c.setValue(file[0].name);
4283
+ (_d = this.getControl('targetURL')) === null || _d === void 0 ? void 0 : _d.setValidators(Validators$1.required);
4284
+ (_e = this.getControl('targetURL')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4233
4285
  if (file[0].type.indexOf('video') > -1)
4234
- this.form.get('fileType').setValue('video');
4286
+ (_f = this.getControl('fileType')) === null || _f === void 0 ? void 0 : _f.setValue('video');
4235
4287
  this.uploadMediaService();
4236
4288
  }
4237
4289
  uploadMediaService() {
4290
+ var _a;
4238
4291
  const parameterList = [
4239
4292
  {
4240
4293
  name: 'file',
4241
- value: this.form.get('file').value,
4294
+ value: (_a = this.getControl('file')) === null || _a === void 0 ? void 0 : _a.value,
4242
4295
  in: 'formData',
4243
4296
  type: 'object',
4244
4297
  },
@@ -4246,74 +4299,84 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4246
4299
  const subs = this.apiAdapterService
4247
4300
  .executeApiRequest(parameterList, '/message/media', 'POST')
4248
4301
  .subscribe((resp) => {
4249
- this.form.get('targetURL').clearValidators();
4250
- this.form.get('targetURL').updateValueAndValidity();
4251
- this.form.get('targetURL').setValue(resp.data.targetURL);
4252
- this.form.get('file').reset();
4302
+ var _a, _b, _c, _d;
4303
+ (_a = this.getControl('targetURL')) === null || _a === void 0 ? void 0 : _a.clearValidators();
4304
+ (_b = this.getControl('targetURL')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4305
+ (_c = this.getControl('targetURL')) === null || _c === void 0 ? void 0 : _c.setValue(resp.data.targetURL);
4306
+ (_d = this.getControl('file')) === null || _d === void 0 ? void 0 : _d.reset();
4253
4307
  this.toastr.success('Upload media success');
4254
4308
  });
4255
4309
  this.subscribers.push(subs);
4256
4310
  }
4311
+ get buttonParamsControls() {
4312
+ return this.form.get('buttonParams').controls;
4313
+ }
4314
+ get isUsingExcelBulk() {
4315
+ var _a;
4316
+ return ((_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.value) || false;
4317
+ }
4257
4318
  updateTemplate(template) {
4258
- 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;
4319
+ 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;
4259
4320
  this.isShowParameter = false;
4260
4321
  if (!template)
4261
4322
  return;
4323
+ const buttonParamsArray = this.form.get('buttonParams');
4324
+ buttonParamsArray.clear();
4325
+ if (template && template.buttons && template.buttons.length > 0) {
4326
+ const quickReplyButtons = template.buttons.filter((btn) => btn.type === 'QUICK_REPLY');
4327
+ quickReplyButtons.forEach((btn) => {
4328
+ buttonParamsArray.push(new FormGroup({
4329
+ label: new FormControl(btn.text),
4330
+ payload: new FormControl('', [Validators$1.maxLength(256)]),
4331
+ }));
4332
+ });
4333
+ }
4262
4334
  this.isHaveTemplateParam =
4263
- ((_a = template.header.examples) === null || _a === void 0 ? void 0 : _a.length) > 0 ||
4264
- ((_b = template.body.examples) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
4265
- ((_c = template.buttons) === null || _c === void 0 ? void 0 : _c.length) > 0;
4266
- 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())) {
4267
- this.form
4268
- .get('fileName')
4269
- .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)));
4270
- this.form
4271
- .get('targetURL')
4272
- .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)));
4273
- 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());
4274
- }
4275
- ((_u = template.header.examples) === null || _u === void 0 ? void 0 : _u.length) > 0
4276
- ? this.form.get('paramHeader').setValidators(Validators$1.required)
4277
- : this.form.get('paramHeader').clearValidators();
4278
- ((_v = template.body.examples) === null || _v === void 0 ? void 0 : _v.length) > 0
4279
- ? this.form.get('paramBody').setValidators(Validators$1.required)
4280
- : this.form.get('paramBody').clearValidators();
4281
- ((_w = template.buttons) === null || _w === void 0 ? void 0 : _w.length) > 0
4282
- ? this.form.get('paramButton').setValidators(Validators$1.required)
4283
- : this.form.get('paramButton').clearValidators();
4335
+ (_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 ||
4336
+ (_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 ||
4337
+ (_h = (_g = template.buttons) === null || _g === void 0 ? void 0 : _g.length, (_h !== null && _h !== void 0 ? _h : 0)) > 0;
4338
+ 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())) {
4339
+ (_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)));
4340
+ (_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)));
4341
+ 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());
4342
+ }
4343
+ (_2 = (_1 = template.header.examples) === null || _1 === void 0 ? void 0 : _1.length, (_2 !== null && _2 !== void 0 ? _2 : 0)) > 0
4344
+ ? (_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();
4345
+ (_6 = (_5 = template.body.examples) === null || _5 === void 0 ? void 0 : _5.length, (_6 !== null && _6 !== void 0 ? _6 : 0)) > 0
4346
+ ? (_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();
4347
+ (_10 = (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.length, (_10 !== null && _10 !== void 0 ? _10 : 0)) > 0
4348
+ ? (_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();
4284
4349
  this.form.get('paramHeader').controls = [];
4285
4350
  this.form.get('paramHeader').reset();
4286
- this.form.get('paramHeader').updateValueAndValidity();
4351
+ (_13 = this.getControl('paramHeader')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4287
4352
  this.form.get('paramBody').controls = [];
4288
4353
  this.form.get('paramBody').reset();
4289
- this.form.get('paramBody').updateValueAndValidity();
4354
+ (_14 = this.getControl('paramBody')) === null || _14 === void 0 ? void 0 : _14.updateValueAndValidity();
4290
4355
  this.form.get('paramButton').controls = [];
4291
4356
  this.form.get('paramButton').reset();
4292
- this.form.get('paramButton').updateValueAndValidity();
4293
- this.form.get('otpValue').setValue('');
4294
- this.form.get('otpValue').clearValidators();
4295
- this.form.get('otpValue').updateValueAndValidity();
4296
- const formStorage = (_y = (_x = this.getCampaignStorage) === null || _x === void 0 ? void 0 : _x.generalInformation) === null || _y === void 0 ? void 0 : _y.form;
4357
+ (_15 = this.getControl('paramButton')) === null || _15 === void 0 ? void 0 : _15.updateValueAndValidity();
4358
+ (_16 = this.getControl('otpValue')) === null || _16 === void 0 ? void 0 : _16.setValue('');
4359
+ (_17 = this.getControl('otpValue')) === null || _17 === void 0 ? void 0 : _17.clearValidators();
4360
+ (_18 = this.getControl('otpValue')) === null || _18 === void 0 ? void 0 : _18.updateValueAndValidity();
4361
+ const formStorage = (_20 = (_19 = this.getCampaignStorage) === null || _19 === void 0 ? void 0 : _19.generalInformation) === null || _20 === void 0 ? void 0 : _20.form;
4297
4362
  if (template.category === 'AUTHENTICATION') {
4298
- this.form
4299
- .get('otpValue')
4300
- .setValue((_6 = (_0 = (_z = formStorage) === null || _z === void 0 ? void 0 : _z.otpValue, (_0 !== null && _0 !== void 0 ? _0 : (_5 = [...(_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 : '')));
4301
- this.form.get('otpValue').setValidators(Validators$1.required);
4302
- this.form.get('otpValue').updateValueAndValidity();
4363
+ (_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 = [...(_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 : '')));
4364
+ (_30 = this.getControl('otpValue')) === null || _30 === void 0 ? void 0 : _30.setValidators(Validators$1.required);
4365
+ (_31 = this.getControl('otpValue')) === null || _31 === void 0 ? void 0 : _31.updateValueAndValidity();
4303
4366
  }
4304
- (_7 = template.header.examples) === null || _7 === void 0 ? void 0 : _7.forEach((each, index) => {
4367
+ (_32 = template.header.examples) === null || _32 === void 0 ? void 0 : _32.forEach((each, index) => {
4305
4368
  var _a, _b, _c, _d, _e, _f, _g;
4306
4369
  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 : '')));
4307
4370
  });
4308
- (_8 = template.body.examples) === null || _8 === void 0 ? void 0 : _8.forEach((each, index) => {
4371
+ (_33 = template.body.examples) === null || _33 === void 0 ? void 0 : _33.forEach((each, index) => {
4309
4372
  var _a, _b, _c, _d, _e, _f, _g;
4310
4373
  let 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 : ''));
4311
4374
  if (['$UnsubscribeAccount'].includes(each))
4312
4375
  paramValue = each;
4313
4376
  this.addParamBody(paramValue);
4314
4377
  });
4315
- (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.forEach((each, index) => {
4316
- var _a;
4378
+ (_34 = template.buttons) === null || _34 === void 0 ? void 0 : _34.forEach((each, index) => {
4379
+ var _a, _b, _c, _d;
4317
4380
  this.addParamButton();
4318
4381
  const button = this.getButton;
4319
4382
  if (((_a = each.examples) === null || _a === void 0 ? void 0 : _a.length) > 0) {
@@ -4331,8 +4394,9 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4331
4394
  });
4332
4395
  }
4333
4396
  else {
4334
- button[button.length - 1].get('name').clearValidators();
4335
- button[button.length - 1].get('name').updateValueAndValidity();
4397
+ const lastControl = (_b = button[button.length - 1]) === null || _b === void 0 ? void 0 : _b.get('name');
4398
+ (_c = lastControl) === null || _c === void 0 ? void 0 : _c.clearValidators();
4399
+ (_d = lastControl) === null || _d === void 0 ? void 0 : _d.updateValueAndValidity();
4336
4400
  }
4337
4401
  });
4338
4402
  }
@@ -4366,13 +4430,14 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4366
4430
  const autocomplete = new google.maps.places.Autocomplete(this.mapSearchRef.nativeElement);
4367
4431
  autocomplete.addListener('place_changed', () => {
4368
4432
  this.ngZone.run(() => {
4433
+ var _a, _b;
4369
4434
  const place = autocomplete.getPlace();
4370
4435
  if (!place.geometry)
4371
4436
  return;
4372
4437
  this.maps.latitude = place.geometry.location.lat();
4373
4438
  this.maps.longitude = place.geometry.location.lng();
4374
- this.form.get('latitude').setValue(this.maps.latitude);
4375
- this.form.get('longitude').setValue(this.maps.longitude);
4439
+ (_a = this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(this.maps.latitude);
4440
+ (_b = this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(this.maps.longitude);
4376
4441
  });
4377
4442
  });
4378
4443
  });
@@ -4380,59 +4445,73 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4380
4445
  setCurrentLocation() {
4381
4446
  if ('geolocation' in navigator) {
4382
4447
  navigator.geolocation.getCurrentPosition((position) => {
4383
- if (!this.form.get('longitude').value && !this.form.get('latitude').value) {
4448
+ var _a, _b, _c, _d;
4449
+ 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)) {
4384
4450
  this.maps.latitude = position.coords.latitude;
4385
4451
  this.maps.longitude = position.coords.longitude;
4386
- this.form.get('latitude').setValue(this.maps.latitude);
4387
- this.form.get('longitude').setValue(this.maps.longitude);
4452
+ (_c = this.getControl('latitude')) === null || _c === void 0 ? void 0 : _c.setValue(this.maps.latitude);
4453
+ (_d = this.getControl('longitude')) === null || _d === void 0 ? void 0 : _d.setValue(this.maps.longitude);
4388
4454
  }
4389
4455
  });
4390
4456
  }
4391
4457
  }
4392
4458
  markerDragEnd(event) {
4459
+ var _a, _b;
4393
4460
  if (event.latLng) {
4394
4461
  this.maps.latitude = event.latLng.lat();
4395
4462
  this.maps.longitude = event.latLng.lng();
4396
- this.form.get('latitude').setValue(this.maps.latitude);
4397
- this.form.get('longitude').setValue(this.maps.longitude);
4463
+ (_a = this.getControl('latitude')) === null || _a === void 0 ? void 0 : _a.setValue(this.maps.latitude);
4464
+ (_b = this.getControl('longitude')) === null || _b === void 0 ? void 0 : _b.setValue(this.maps.longitude);
4398
4465
  }
4399
4466
  }
4400
4467
  updateDownloadCSV(isChecked) {
4401
- this.form.get('isUpload').setValue(isChecked);
4468
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4469
+ (_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.setValue(isChecked);
4402
4470
  if (isChecked) {
4403
- this.form.get('paramHeader').controls = [];
4404
- this.form.get('paramHeader').reset();
4405
- this.form.get('paramBody').controls = [];
4406
- this.form.get('paramBody').reset();
4407
- this.form.get('paramButton').controls = [];
4408
- this.form.get('paramButton').reset();
4409
- this.form.get('paramHeader').clearValidators();
4410
- this.form.get('paramBody').clearValidators();
4411
- this.form.get('paramButton').clearValidators();
4412
- this.form.get('paramHeader').updateValueAndValidity();
4413
- this.form.get('paramBody').updateValueAndValidity();
4414
- this.form.get('paramButton').updateValueAndValidity();
4415
- this.form.get('otpValue').reset();
4416
- this.form.get('otpValue').clearValidators();
4417
- this.form.get('otpValue').updateValueAndValidity();
4471
+ this.getControl('paramHeader').controls = [];
4472
+ this.getControl('paramHeader').reset();
4473
+ this.getControl('paramBody').controls = [];
4474
+ this.getControl('paramBody').reset();
4475
+ this.getControl('paramButton').controls = [];
4476
+ this.getControl('paramButton').reset();
4477
+ (_b = this.getControl('paramHeader')) === null || _b === void 0 ? void 0 : _b.clearValidators();
4478
+ (_c = this.getControl('paramBody')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4479
+ (_d = this.getControl('paramButton')) === null || _d === void 0 ? void 0 : _d.clearValidators();
4480
+ (_e = this.getControl('paramHeader')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4481
+ (_f = this.getControl('paramBody')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4482
+ (_g = this.getControl('paramButton')) === null || _g === void 0 ? void 0 : _g.updateValueAndValidity();
4483
+ (_h = this.getControl('otpValue')) === null || _h === void 0 ? void 0 : _h.reset();
4484
+ (_j = this.getControl('otpValue')) === null || _j === void 0 ? void 0 : _j.clearValidators();
4485
+ (_k = this.getControl('otpValue')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4418
4486
  return;
4419
4487
  }
4420
- this.updateTemplate(this.form.get('template').value);
4488
+ this.updateTemplate((_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.value);
4421
4489
  }
4422
4490
  handleChangeTemplate(useExisting) {
4491
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4492
+ (_a = this.getControl('isDownloadVariableXLS')) === null || _a === void 0 ? void 0 : _a.setValue(false);
4493
+ this.variables.clear();
4494
+ this.updateVariableDownloadXLS(false);
4423
4495
  if (useExisting) {
4424
- this.form.get('template').setValidators(Validators$1.required);
4425
- this.form.get('text').reset();
4426
- this.form.get('text').clearValidators();
4427
- this.form.get('text').updateValueAndValidity();
4428
- this.form.get('template').updateValueAndValidity();
4496
+ (_b = this.getControl('template')) === null || _b === void 0 ? void 0 : _b.setValidators(Validators$1.required);
4497
+ //this.getControl('text')?.reset();
4498
+ (_c = this.getControl('text')) === null || _c === void 0 ? void 0 : _c.clearValidators();
4499
+ (_d = this.getControl('text')) === null || _d === void 0 ? void 0 : _d.setValue('Halo {{1}}, ini adalah kode verifikasi kamu: {{2}}');
4500
+ (_e = this.getControl('text')) === null || _e === void 0 ? void 0 : _e.updateValueAndValidity();
4501
+ (_f = this.getControl('template')) === null || _f === void 0 ? void 0 : _f.updateValueAndValidity();
4502
+ this.variables.push(new FormGroup({
4503
+ paramName: new FormControl('', Validators$1.required),
4504
+ }));
4505
+ this.variables.push(new FormGroup({
4506
+ paramName: new FormControl('', Validators$1.required),
4507
+ }));
4429
4508
  }
4430
4509
  else {
4431
- this.form.get('template').reset();
4432
- this.form.get('template').clearValidators();
4433
- this.form.get('text').setValidators([Validators$1.required, Validators$1.max(1024)]);
4434
- this.form.get('text').updateValueAndValidity();
4435
- this.form.get('template').updateValueAndValidity();
4510
+ (_g = this.getControl('template')) === null || _g === void 0 ? void 0 : _g.reset();
4511
+ (_h = this.getControl('template')) === null || _h === void 0 ? void 0 : _h.clearValidators();
4512
+ (_j = this.getControl('text')) === null || _j === void 0 ? void 0 : _j.setValidators([Validators$1.required, Validators$1.max(1024)]);
4513
+ (_k = this.getControl('text')) === null || _k === void 0 ? void 0 : _k.updateValueAndValidity();
4514
+ (_l = this.getControl('template')) === null || _l === void 0 ? void 0 : _l.updateValueAndValidity();
4436
4515
  }
4437
4516
  }
4438
4517
  handleChangeFrom(value) {
@@ -4441,6 +4520,61 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4441
4520
  return;
4442
4521
  this.getTemplateOptionService(value);
4443
4522
  }
4523
+ get variables() {
4524
+ return this.getControl('variables');
4525
+ }
4526
+ addVariable() {
4527
+ const variableGroup = new FormGroup({
4528
+ paramName: new FormControl('', Validators$1.required),
4529
+ });
4530
+ this.variables.push(variableGroup);
4531
+ const textControl = this.getControl('text');
4532
+ if (textControl) {
4533
+ const currentBody = textControl.value || '';
4534
+ const newSequence = `{{${this.variables.controls.length}}}`;
4535
+ textControl.setValue(`${currentBody} ${newSequence}`.trim());
4536
+ }
4537
+ }
4538
+ removeVariable(index) {
4539
+ var _a;
4540
+ this.variables.removeAt(index);
4541
+ if (this.variables.controls.length === 0) {
4542
+ (_a = this.getControl('useXlsx')) === null || _a === void 0 ? void 0 : _a.setValue(false);
4543
+ }
4544
+ const textControl = this.getControl('text');
4545
+ if (textControl && textControl.value) {
4546
+ const targetSequence = index + 1;
4547
+ let currentBody = textControl.value;
4548
+ const removeRegex = new RegExp(`\\s*\\{\\{${targetSequence}\\}\\}`, 'g');
4549
+ currentBody = currentBody.replace(removeRegex, '');
4550
+ currentBody = currentBody.replace(/\{\{(\d+)\}\}/g, (match, numStr) => {
4551
+ const num = parseInt(numStr, 10);
4552
+ if (num > targetSequence) {
4553
+ return `{{${num - 1}}}`;
4554
+ }
4555
+ return match;
4556
+ });
4557
+ textControl.setValue(currentBody.trim());
4558
+ }
4559
+ }
4560
+ updateVariableDownloadXLS(isChecked) {
4561
+ const variablesArray = this.variables;
4562
+ if (isChecked) {
4563
+ variablesArray.controls.forEach((control) => {
4564
+ var _a, _b;
4565
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.clearValidators();
4566
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4567
+ });
4568
+ }
4569
+ else {
4570
+ variablesArray.controls.forEach((control) => {
4571
+ var _a, _b;
4572
+ (_a = control.get('paramName')) === null || _a === void 0 ? void 0 : _a.setValidators(Validators$1.required);
4573
+ (_b = control.get('paramName')) === null || _b === void 0 ? void 0 : _b.updateValueAndValidity();
4574
+ });
4575
+ }
4576
+ this.form.updateValueAndValidity();
4577
+ }
4444
4578
  ngOnDestroy() {
4445
4579
  this.subscribers.forEach((each) => each.unsubscribe());
4446
4580
  }
@@ -4467,8 +4601,8 @@ __decorate([
4467
4601
  GeneralInformationWAComponent = __decorate([
4468
4602
  Component({
4469
4603
  selector: 'lib-general-information-wa',
4470
- 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",
4471
- styles: [".asterix--after:after{content:\"*\";color:red}"]
4604
+ 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",
4605
+ 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}"]
4472
4606
  })
4473
4607
  ], GeneralInformationWAComponent);
4474
4608
 
@@ -4868,10 +5002,7 @@ let GeneralInformationComponent = class GeneralInformationComponent {
4868
5002
  initForm() {
4869
5003
  this.form = new FormGroup({
4870
5004
  id: new FormControl(null),
4871
- campaignName: new FormControl(null, [
4872
- Validators$1.required,
4873
- Validators$1.maxLength(100),
4874
- ]),
5005
+ campaignName: new FormControl(null, [Validators$1.required, Validators$1.maxLength(100)]),
4875
5006
  medium: new FormControl(null, [Validators$1.required]),
4876
5007
  });
4877
5008
  this.form.valueChanges.subscribe(() => {
@@ -4895,12 +5026,8 @@ let GeneralInformationComponent = class GeneralInformationComponent {
4895
5026
  if (Object.entries(campaign).length === 0)
4896
5027
  return;
4897
5028
  this.form.get('id').setValue((_b = (_a = campaign) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.id);
4898
- this.form
4899
- .get('campaignName')
4900
- .setValue((_d = (_c = campaign) === null || _c === void 0 ? void 0 : _c.generalInformation) === null || _d === void 0 ? void 0 : _d.form.campaignName);
4901
- this.form
4902
- .get('medium')
4903
- .setValue((_f = (_e = campaign) === null || _e === void 0 ? void 0 : _e.generalInformation) === null || _f === void 0 ? void 0 : _f.form.medium);
5029
+ 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);
5030
+ 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);
4904
5031
  }
4905
5032
  initDisable() {
4906
5033
  if (!this.isReadOnlyMode) {
@@ -4909,6 +5036,7 @@ let GeneralInformationComponent = class GeneralInformationComponent {
4909
5036
  this.form.disable();
4910
5037
  }
4911
5038
  updateGeneralInformationForm(form) {
5039
+ console.log(form, 'form');
4912
5040
  this.generalInformationForm = form;
4913
5041
  this.isShowMore = false;
4914
5042
  this.generalInformation.emit({
@@ -4992,7 +5120,7 @@ GeneralInformationComponent = __decorate([
4992
5120
  Component({
4993
5121
  selector: 'lib-new-campaign-general-information',
4994
5122
  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",
4995
- 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}"]
5123
+ 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}"]
4996
5124
  })
4997
5125
  ], GeneralInformationComponent);
4998
5126
 
@@ -5046,15 +5174,16 @@ let NewNumberBasesComponent = class NewNumberBasesComponent {
5046
5174
  : {};
5047
5175
  }
5048
5176
  initEdit() {
5049
- var _a, _b, _c, _d, _e, _f, _g, _h;
5177
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5050
5178
  if (Object.entries(this.getCampaignStorage).length === 0)
5051
5179
  return;
5052
- 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;
5180
+ const genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5181
+ this.isShowUploadCSV = ((_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isUpload) || ((_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.isDownloadVariableXLS);
5053
5182
  this.fileSelected = {
5054
- name: (_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.targetAudienceFile) === null || _e === void 0 ? void 0 : _e.name,
5055
- targetURL: (_g = (_f = this.getCampaignStorage) === null || _f === void 0 ? void 0 : _f.targetAudienceFile) === null || _g === void 0 ? void 0 : _g.targetURL,
5183
+ name: (_f = (_e = this.getCampaignStorage) === null || _e === void 0 ? void 0 : _e.targetAudienceFile) === null || _f === void 0 ? void 0 : _f.name,
5184
+ targetURL: (_h = (_g = this.getCampaignStorage) === null || _g === void 0 ? void 0 : _g.targetAudienceFile) === null || _h === void 0 ? void 0 : _h.targetURL,
5056
5185
  };
5057
- (_h = this.table.dataSource.data) === null || _h === void 0 ? void 0 : _h.forEach((each) => {
5186
+ (_j = this.table.dataSource.data) === null || _j === void 0 ? void 0 : _j.forEach((each) => {
5058
5187
  var _a, _b;
5059
5188
  if ((_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.targetAudience) === null || _b === void 0 ? void 0 : _b.includes(each.id))
5060
5189
  this.onChecked(true, each);
@@ -5202,13 +5331,25 @@ let NewNumberBasesComponent = class NewNumberBasesComponent {
5202
5331
  return found ? true : false;
5203
5332
  }
5204
5333
  onDownloadSampleService() {
5205
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
5334
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
5335
+ const genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5336
+ const isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
5206
5337
  const parameterList = [
5207
- 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'),
5208
- 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'),
5209
- 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'),
5210
- this.initParam('category', (_p = (_o = this.categorySelected) === null || _o === void 0 ? void 0 : _o.map((t) => t.id).join(), (_p !== null && _p !== void 0 ? _p : [])), 'string'),
5338
+ this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
5211
5339
  ];
5340
+ if (isNeedSave) {
5341
+ // SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
5342
+ 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((t) => t.id).join(), (_l !== null && _l !== void 0 ? _l : '')), 'string'));
5343
+ }
5344
+ else {
5345
+ // SKENARIO 2: CREATE NEW (Belum disave, butuh text & examples)
5346
+ parameterList.push(this.initParam('bodyText', (_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.text, 'string'));
5347
+ const variables = (_o = genInfoForm) === null || _o === void 0 ? void 0 : _o.variables;
5348
+ if (variables && Array.isArray(variables) && variables.length > 0) {
5349
+ const bodyExamplesString = variables.map((v) => v.paramName).join(',');
5350
+ parameterList.push(this.initParam('bodyExamples', bodyExamplesString, 'string'));
5351
+ }
5352
+ }
5212
5353
  const subs = this.apiAdapterService
5213
5354
  .executeApiRequest(parameterList, '/message/bulkupload/template', 'GET', true)
5214
5355
  .subscribe((resp) => {
@@ -5564,5 +5705,5 @@ ConfirmationModule = __decorate([
5564
5705
  * Generated bundle index. Do not edit.
5565
5706
  */
5566
5707
 
5567
- 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 };
5708
+ 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 };
5568
5709
  //# sourceMappingURL=adlfe-campaign-management-library.js.map