@adlfe/campaign-management-library 2.13.2 → 2.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. package/bundles/adlfe-campaign-management-library.umd.js +70 -67
  2. package/bundles/adlfe-campaign-management-library.umd.js.map +1 -1
  3. package/bundles/adlfe-campaign-management-library.umd.min.js +1 -1
  4. package/bundles/adlfe-campaign-management-library.umd.min.js.map +1 -1
  5. package/esm2015/lib/campaign-management/models/general-information-wa-req.model.js +27 -30
  6. package/esm2015/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +40 -32
  7. package/esm2015/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +1 -2
  8. package/esm2015/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +6 -7
  9. package/esm5/lib/campaign-management/models/general-information-wa-req.model.js +27 -30
  10. package/esm5/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +40 -32
  11. package/esm5/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +1 -2
  12. package/esm5/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +6 -7
  13. package/fesm2015/adlfe-campaign-management-library.js +70 -67
  14. package/fesm2015/adlfe-campaign-management-library.js.map +1 -1
  15. package/fesm5/adlfe-campaign-management-library.js +70 -67
  16. package/fesm5/adlfe-campaign-management-library.js.map +1 -1
  17. package/lib/campaign-management/models/general-information-wa-req.model.d.ts +0 -5
  18. package/package.json +1 -1
@@ -2686,7 +2686,7 @@
2686
2686
  function GeneralInformationWAReqModel() {
2687
2687
  }
2688
2688
  GeneralInformationWAReqModel.prototype.clone = function (source) {
2689
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2689
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
2690
2690
  if (((_a = source) === null || _a === void 0 ? void 0 : _a.media) === 'IMAGE' ||
2691
2691
  ((_b = source) === null || _b === void 0 ? void 0 : _b.media) === 'VIDEO' ||
2692
2692
  ((_c = source) === null || _c === void 0 ? void 0 : _c.media) === 'DOCUMENT') {
@@ -2723,34 +2723,33 @@
2723
2723
  fileName: source.fileName,
2724
2724
  };
2725
2725
  }
2726
- if (source.buttonParams && Array.isArray(source.buttonParams)) {
2727
- this.buttonParams = source.buttonParams.map(function (btn) { return ({
2728
- label: btn.label,
2729
- payload: btn.payload ? btn.payload : btn.label,
2730
- }); });
2731
- }
2732
2726
  if (source.template) {
2727
+ var qrIndex_1 = 0;
2728
+ var finalButtons = (_g = (_f = source.template.buttons) === null || _f === void 0 ? void 0 : _f.map(function (btnDef, idx) {
2729
+ var _a, _b, _c;
2730
+ if (btnDef.type === 'QUICK_REPLY') {
2731
+ var qrParam = source.buttonParams && source.buttonParams[qrIndex_1]
2732
+ ? source.buttonParams[qrIndex_1]
2733
+ : null;
2734
+ qrIndex_1++;
2735
+ return qrParam ? [qrParam.payload ? qrParam.payload : qrParam.label] : [];
2736
+ }
2737
+ else {
2738
+ var otherParam = source.paramButton && source.paramButton[idx]
2739
+ ? source.paramButton[idx]
2740
+ : null;
2741
+ return _c = (_b = (_a = otherParam) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.map(function (t) { return t.name; }), (_c !== null && _c !== void 0 ? _c : []);
2742
+ }
2743
+ }), (_g !== null && _g !== void 0 ? _g : []));
2733
2744
  this.template = {
2734
2745
  id: source.template.ID,
2735
2746
  name: source.template.name,
2736
2747
  lang: source.template.lang,
2737
2748
  headerUrl: source.targetURL,
2738
- header: (_g = (_f = source.paramHeader) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.name; }), (_g !== null && _g !== void 0 ? _g : [])),
2739
- data: ((_h = source.variables) === null || _h === void 0 ? void 0 : _h.length) ? source.variables.map(function (v) { return v.paramName; })
2740
- : (_k = (_j = source.paramBody) === null || _j === void 0 ? void 0 : _j.map(function (t) { return t.name; }), (_k !== null && _k !== void 0 ? _k : [])),
2741
- button: (_l = source.paramButton) === null || _l === void 0 ? void 0 : _l.reduce(function (result, each) {
2742
- var _a;
2743
- result.push((_a = each.name.map(function (t) { return t.name; }), (_a !== null && _a !== void 0 ? _a : [])));
2744
- return result;
2745
- }, []),
2746
- buttonParams: source.buttonParams
2747
- ? source.buttonParams.map(function (btn) {
2748
- return {
2749
- label: btn.label,
2750
- payload: btn.payload ? btn.payload : btn.label,
2751
- };
2752
- })
2753
- : [],
2749
+ header: (_j = (_h = source.paramHeader) === null || _h === void 0 ? void 0 : _h.map(function (t) { return t.name; }), (_j !== null && _j !== void 0 ? _j : [])),
2750
+ data: ((_k = source.variables) === null || _k === void 0 ? void 0 : _k.length) ? source.variables.map(function (v) { return v.paramName; })
2751
+ : (_m = (_l = source.paramBody) === null || _l === void 0 ? void 0 : _l.map(function (t) { return t.name; }), (_m !== null && _m !== void 0 ? _m : [])),
2752
+ button: finalButtons,
2754
2753
  };
2755
2754
  if (source.template.category === 'AUTHENTICATION')
2756
2755
  this.template = {
@@ -2759,7 +2758,6 @@
2759
2758
  header: null,
2760
2759
  data: [source.otpValue],
2761
2760
  button: [[source.otpValue]],
2762
- buttonParams: [],
2763
2761
  };
2764
2762
  if (source.template.ID)
2765
2763
  this.template.id = source.template.ID;
@@ -2767,9 +2765,9 @@
2767
2765
  if (this.type === 'utility') {
2768
2766
  this.type = 'template';
2769
2767
  this.category = 'utility';
2770
- var mappedVariables = ((_o = (_m = source) === null || _m === void 0 ? void 0 : _m.variables) === null || _o === void 0 ? void 0 : _o.length) ? source.variables.map(function (v) { return v.paramName; })
2768
+ var mappedVariables = ((_p = (_o = source) === null || _o === void 0 ? void 0 : _o.variables) === null || _p === void 0 ? void 0 : _p.length) ? source.variables.map(function (v) { return v.paramName; })
2771
2769
  : [];
2772
- if ((_p = source) === null || _p === void 0 ? void 0 : _p.isUseExistingTemplate) {
2770
+ if ((_q = source) === null || _q === void 0 ? void 0 : _q.isUseExistingTemplate) {
2773
2771
  this.template = __assign(__assign({}, source.template), { data: mappedVariables.length > 0 ? mappedVariables : source.template.data || [] });
2774
2772
  }
2775
2773
  else {
@@ -2779,13 +2777,12 @@
2779
2777
  header: null,
2780
2778
  button: null,
2781
2779
  data: mappedVariables,
2782
- buttonParams: [],
2783
2780
  };
2784
2781
  }
2785
2782
  this.isNeedSave = source.isNeedSave;
2786
2783
  this.ttlSeconds = source.ttl;
2787
- if ((_q = source) === null || _q === void 0 ? void 0 : _q.isUseExistingTemplate) {
2788
- this.text = ((_r = source) === null || _r === void 0 ? void 0 : _r.text) || ((_u = (_t = (_s = source) === null || _s === void 0 ? void 0 : _s.template) === null || _t === void 0 ? void 0 : _t.body) === null || _u === void 0 ? void 0 : _u.text);
2784
+ if ((_r = source) === null || _r === void 0 ? void 0 : _r.isUseExistingTemplate) {
2785
+ this.text = ((_s = source) === null || _s === void 0 ? void 0 : _s.text) || ((_v = (_u = (_t = source) === null || _t === void 0 ? void 0 : _t.template) === null || _u === void 0 ? void 0 : _u.body) === null || _v === void 0 ? void 0 : _v.text);
2789
2786
  }
2790
2787
  }
2791
2788
  return this;
@@ -4576,6 +4573,7 @@
4576
4573
  this.initParam('pageNo', this.pageNoTemplateOption, 'number'),
4577
4574
  this.initParam('rowPerPage', 20, 'number'),
4578
4575
  this.initParam('platform', 'WA', 'string'),
4576
+ this.initParam('templateType', 'all', 'string'),
4579
4577
  this.initParam('filter', filter, 'string'),
4580
4578
  this.initParam('status', 'APPROVED', 'string'),
4581
4579
  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'),
@@ -4778,7 +4776,8 @@
4778
4776
  };
4779
4777
  Object.defineProperty(GeneralInformationWAComponent.prototype, "buttonParamsControls", {
4780
4778
  get: function () {
4781
- return this.form.get('buttonParams').controls;
4779
+ var control = this.form.get('buttonParams');
4780
+ return control ? control.controls : [];
4782
4781
  },
4783
4782
  enumerable: true,
4784
4783
  configurable: true
@@ -4793,66 +4792,72 @@
4793
4792
  });
4794
4793
  GeneralInformationWAComponent.prototype.updateTemplate = function (template) {
4795
4794
  var _this = this;
4796
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
4795
+ 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, _35;
4797
4796
  this.isShowParameter = false;
4798
4797
  if (!template)
4799
4798
  return;
4799
+ var formStorage = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
4800
+ var savedButtonParams = ((_c = formStorage) === null || _c === void 0 ? void 0 : _c.buttonParams) || [];
4800
4801
  var buttonParamsArray = this.form.get('buttonParams');
4801
4802
  buttonParamsArray.clear();
4802
4803
  if (template && template.buttons && template.buttons.length > 0) {
4803
4804
  var quickReplyButtons = template.buttons.filter(function (btn) { return btn.type === 'QUICK_REPLY'; });
4804
- quickReplyButtons.forEach(function (btn) {
4805
+ quickReplyButtons.forEach(function (btn, index) {
4806
+ var _a;
4807
+ var existingPayload = ((_a = savedButtonParams[index]) === null || _a === void 0 ? void 0 : _a.payload) || '';
4805
4808
  buttonParamsArray.push(new forms.FormGroup({
4806
4809
  label: new forms.FormControl(btn.text),
4807
- payload: new forms.FormControl('', [forms.Validators.maxLength(256)]),
4810
+ payload: new forms.FormControl({
4811
+ value: existingPayload,
4812
+ disabled: _this.isReadOnlyMode,
4813
+ }, [forms.Validators.maxLength(256)]),
4808
4814
  }));
4809
4815
  });
4810
4816
  }
4811
4817
  this.isHaveTemplateParam =
4812
- (_c = (_b = (_a = template.header) === null || _a === void 0 ? void 0 : _a.examples) === null || _b === void 0 ? void 0 : _b.length, (_c !== null && _c !== void 0 ? _c : 0)) > 0 ||
4813
- (_f = (_e = (_d = template.body) === null || _d === void 0 ? void 0 : _d.examples) === null || _e === void 0 ? void 0 : _e.length, (_f !== null && _f !== void 0 ? _f : 0)) > 0 ||
4814
- (_h = (_g = template.buttons) === null || _g === void 0 ? void 0 : _g.length, (_h !== null && _h !== void 0 ? _h : 0)) > 0;
4815
- if (['image', 'video', 'document'].includes((_l = (_k = (_j = template) === null || _j === void 0 ? void 0 : _j.header) === null || _k === void 0 ? void 0 : _k.type) === null || _l === void 0 ? void 0 : _l.toLowerCase())) {
4816
- (_m = this.getControl('fileName')) === null || _m === void 0 ? void 0 : _m.setValue((_t = (_q = (_p = (_o = this.getCampaignStorage) === null || _o === void 0 ? void 0 : _o.generalInformation) === null || _p === void 0 ? void 0 : _p.form.fileName, (_q !== null && _q !== void 0 ? _q : (_s = (_r = this.getCampaignStorage) === null || _r === void 0 ? void 0 : _r.generalInformation) === null || _s === void 0 ? void 0 : _s.form.targetURL)), (_t !== null && _t !== void 0 ? _t : template.header.url)));
4817
- (_u = this.getControl('targetURL')) === null || _u === void 0 ? void 0 : _u.setValue((_x = (_w = (_v = this.getCampaignStorage) === null || _v === void 0 ? void 0 : _v.generalInformation) === null || _w === void 0 ? void 0 : _w.form.targetURL, (_x !== null && _x !== void 0 ? _x : template.header.url)));
4818
- this.fileTypeChange((_0 = (_z = (_y = template) === null || _y === void 0 ? void 0 : _y.header) === null || _z === void 0 ? void 0 : _z.type) === null || _0 === void 0 ? void 0 : _0.toLowerCase());
4819
- }
4820
- (_2 = (_1 = template.header.examples) === null || _1 === void 0 ? void 0 : _1.length, (_2 !== null && _2 !== void 0 ? _2 : 0)) > 0
4821
- ? (_3 = this.getControl('paramHeader')) === null || _3 === void 0 ? void 0 : _3.setValidators(forms.Validators.required) : (_4 = this.getControl('paramHeader')) === null || _4 === void 0 ? void 0 : _4.clearValidators();
4822
- (_6 = (_5 = template.body.examples) === null || _5 === void 0 ? void 0 : _5.length, (_6 !== null && _6 !== void 0 ? _6 : 0)) > 0
4823
- ? (_7 = this.getControl('paramBody')) === null || _7 === void 0 ? void 0 : _7.setValidators(forms.Validators.required) : (_8 = this.getControl('paramBody')) === null || _8 === void 0 ? void 0 : _8.clearValidators();
4824
- (_10 = (_9 = template.buttons) === null || _9 === void 0 ? void 0 : _9.length, (_10 !== null && _10 !== void 0 ? _10 : 0)) > 0
4825
- ? (_11 = this.getControl('paramButton')) === null || _11 === void 0 ? void 0 : _11.setValidators(forms.Validators.required) : (_12 = this.getControl('paramButton')) === null || _12 === void 0 ? void 0 : _12.clearValidators();
4818
+ (_f = (_e = (_d = template.header) === null || _d === void 0 ? void 0 : _d.examples) === null || _e === void 0 ? void 0 : _e.length, (_f !== null && _f !== void 0 ? _f : 0)) > 0 ||
4819
+ (_j = (_h = (_g = template.body) === null || _g === void 0 ? void 0 : _g.examples) === null || _h === void 0 ? void 0 : _h.length, (_j !== null && _j !== void 0 ? _j : 0)) > 0 ||
4820
+ (_l = (_k = template.buttons) === null || _k === void 0 ? void 0 : _k.length, (_l !== null && _l !== void 0 ? _l : 0)) > 0;
4821
+ if (['image', 'video', 'document'].includes((_p = (_o = (_m = template) === null || _m === void 0 ? void 0 : _m.header) === null || _o === void 0 ? void 0 : _o.type) === null || _p === void 0 ? void 0 : _p.toLowerCase())) {
4822
+ (_q = this.getControl('fileName')) === null || _q === void 0 ? void 0 : _q.setValue((_w = (_t = (_s = (_r = this.getCampaignStorage) === null || _r === void 0 ? void 0 : _r.generalInformation) === null || _s === void 0 ? void 0 : _s.form.fileName, (_t !== null && _t !== void 0 ? _t : (_v = (_u = this.getCampaignStorage) === null || _u === void 0 ? void 0 : _u.generalInformation) === null || _v === void 0 ? void 0 : _v.form.targetURL)), (_w !== null && _w !== void 0 ? _w : template.header.url)));
4823
+ (_x = this.getControl('targetURL')) === null || _x === void 0 ? void 0 : _x.setValue((_0 = (_z = (_y = this.getCampaignStorage) === null || _y === void 0 ? void 0 : _y.generalInformation) === null || _z === void 0 ? void 0 : _z.form.targetURL, (_0 !== null && _0 !== void 0 ? _0 : template.header.url)));
4824
+ this.fileTypeChange((_3 = (_2 = (_1 = template) === null || _1 === void 0 ? void 0 : _1.header) === null || _2 === void 0 ? void 0 : _2.type) === null || _3 === void 0 ? void 0 : _3.toLowerCase());
4825
+ }
4826
+ (_5 = (_4 = template.header.examples) === null || _4 === void 0 ? void 0 : _4.length, (_5 !== null && _5 !== void 0 ? _5 : 0)) > 0
4827
+ ? (_6 = this.getControl('paramHeader')) === null || _6 === void 0 ? void 0 : _6.setValidators(forms.Validators.required) : (_7 = this.getControl('paramHeader')) === null || _7 === void 0 ? void 0 : _7.clearValidators();
4828
+ (_9 = (_8 = template.body.examples) === null || _8 === void 0 ? void 0 : _8.length, (_9 !== null && _9 !== void 0 ? _9 : 0)) > 0
4829
+ ? (_10 = this.getControl('paramBody')) === null || _10 === void 0 ? void 0 : _10.setValidators(forms.Validators.required) : (_11 = this.getControl('paramBody')) === null || _11 === void 0 ? void 0 : _11.clearValidators();
4830
+ (_13 = (_12 = template.buttons) === null || _12 === void 0 ? void 0 : _12.length, (_13 !== null && _13 !== void 0 ? _13 : 0)) > 0
4831
+ ? (_14 = this.getControl('paramButton')) === null || _14 === void 0 ? void 0 : _14.setValidators(forms.Validators.required) : (_15 = this.getControl('paramButton')) === null || _15 === void 0 ? void 0 : _15.clearValidators();
4826
4832
  this.form.get('paramHeader').controls = [];
4827
4833
  this.form.get('paramHeader').reset();
4828
- (_13 = this.getControl('paramHeader')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4834
+ (_16 = this.getControl('paramHeader')) === null || _16 === void 0 ? void 0 : _16.updateValueAndValidity();
4829
4835
  this.form.get('paramBody').controls = [];
4830
4836
  this.form.get('paramBody').reset();
4831
- (_14 = this.getControl('paramBody')) === null || _14 === void 0 ? void 0 : _14.updateValueAndValidity();
4837
+ (_17 = this.getControl('paramBody')) === null || _17 === void 0 ? void 0 : _17.updateValueAndValidity();
4832
4838
  this.form.get('paramButton').controls = [];
4833
4839
  this.form.get('paramButton').reset();
4834
- (_15 = this.getControl('paramButton')) === null || _15 === void 0 ? void 0 : _15.updateValueAndValidity();
4835
- (_16 = this.getControl('otpValue')) === null || _16 === void 0 ? void 0 : _16.setValue('');
4836
- (_17 = this.getControl('otpValue')) === null || _17 === void 0 ? void 0 : _17.clearValidators();
4837
- (_18 = this.getControl('otpValue')) === null || _18 === void 0 ? void 0 : _18.updateValueAndValidity();
4838
- var formStorage = (_20 = (_19 = this.getCampaignStorage) === null || _19 === void 0 ? void 0 : _19.generalInformation) === null || _20 === void 0 ? void 0 : _20.form;
4840
+ (_18 = this.getControl('paramButton')) === null || _18 === void 0 ? void 0 : _18.updateValueAndValidity();
4841
+ (_19 = this.getControl('otpValue')) === null || _19 === void 0 ? void 0 : _19.setValue('');
4842
+ (_20 = this.getControl('otpValue')) === null || _20 === void 0 ? void 0 : _20.clearValidators();
4843
+ (_21 = this.getControl('otpValue')) === null || _21 === void 0 ? void 0 : _21.updateValueAndValidity();
4839
4844
  if (template.category === 'AUTHENTICATION') {
4840
- (_21 = this.getControl('otpValue')) === null || _21 === void 0 ? void 0 : _21.setValue((_29 = (_23 = (_22 = formStorage) === null || _22 === void 0 ? void 0 : _22.otpValue, (_23 !== null && _23 !== void 0 ? _23 : (_28 = __spread((_27 = (_26 = (_25 = (_24 = formStorage) === null || _24 === void 0 ? void 0 : _24.template) === null || _25 === void 0 ? void 0 : _25.body) === null || _26 === void 0 ? void 0 : _26.examples, (_27 !== null && _27 !== void 0 ? _27 : [])))) === null || _28 === void 0 ? void 0 : _28.pop())), (_29 !== null && _29 !== void 0 ? _29 : '')));
4841
- (_30 = this.getControl('otpValue')) === null || _30 === void 0 ? void 0 : _30.setValidators(forms.Validators.required);
4842
- (_31 = this.getControl('otpValue')) === null || _31 === void 0 ? void 0 : _31.updateValueAndValidity();
4845
+ (_22 = this.getControl('otpValue')) === null || _22 === void 0 ? void 0 : _22.setValue((_30 = (_24 = (_23 = formStorage) === null || _23 === void 0 ? void 0 : _23.otpValue, (_24 !== null && _24 !== void 0 ? _24 : (_29 = __spread((_28 = (_27 = (_26 = (_25 = formStorage) === null || _25 === void 0 ? void 0 : _25.template) === null || _26 === void 0 ? void 0 : _26.body) === null || _27 === void 0 ? void 0 : _27.examples, (_28 !== null && _28 !== void 0 ? _28 : [])))) === null || _29 === void 0 ? void 0 : _29.pop())), (_30 !== null && _30 !== void 0 ? _30 : '')));
4846
+ (_31 = this.getControl('otpValue')) === null || _31 === void 0 ? void 0 : _31.setValidators(forms.Validators.required);
4847
+ (_32 = this.getControl('otpValue')) === null || _32 === void 0 ? void 0 : _32.updateValueAndValidity();
4843
4848
  }
4844
- (_32 = template.header.examples) === null || _32 === void 0 ? void 0 : _32.forEach(function (each, index) {
4849
+ (_33 = template.header.examples) === null || _33 === void 0 ? void 0 : _33.forEach(function (each, index) {
4845
4850
  var _a, _b, _c, _d, _e, _f, _g;
4846
4851
  _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 : '')));
4847
4852
  });
4848
- (_33 = template.body.examples) === null || _33 === void 0 ? void 0 : _33.forEach(function (each, index) {
4853
+ (_34 = template.body.examples) === null || _34 === void 0 ? void 0 : _34.forEach(function (each, index) {
4849
4854
  var _a, _b, _c, _d, _e, _f, _g;
4850
4855
  var paramValue = (_g = (_d = (_c = (_b = (_a = formStorage) === null || _a === void 0 ? void 0 : _a.paramBody) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.name, (_d !== null && _d !== void 0 ? _d : (_f = (_e = formStorage) === null || _e === void 0 ? void 0 : _e.paramBody) === null || _f === void 0 ? void 0 : _f[index])), (_g !== null && _g !== void 0 ? _g : ''));
4851
4856
  if (['$UnsubscribeAccount'].includes(each))
4852
4857
  paramValue = each;
4853
4858
  _this.addParamBody(paramValue);
4854
4859
  });
4855
- (_34 = template.buttons) === null || _34 === void 0 ? void 0 : _34.forEach(function (each, index) {
4860
+ (_35 = template.buttons) === null || _35 === void 0 ? void 0 : _35.forEach(function (each, index) {
4856
4861
  var _a, _b, _c, _d;
4857
4862
  _this.addParamButton();
4858
4863
  var button = _this.getButton;
@@ -5548,7 +5553,6 @@
5548
5553
  this.form.disable();
5549
5554
  };
5550
5555
  GeneralInformationComponent.prototype.updateGeneralInformationForm = function (form) {
5551
- console.log(form, 'form');
5552
5556
  this.generalInformationForm = form;
5553
5557
  this.isShowMore = false;
5554
5558
  this.generalInformation.emit({
@@ -5915,13 +5919,12 @@
5915
5919
  var isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
5916
5920
  var parameterList = [
5917
5921
  this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
5922
+ this.initParam('templateName', (_g = (_f = genInfoForm) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.name, 'string'),
5923
+ this.initParam('templateLang', (_j = (_h = genInfoForm) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.lang, 'string'),
5924
+ this.initParam('category', (_l = (_k = this.categorySelected) === null || _k === void 0 ? void 0 : _k.map(function (t) { return t.id; }).join(), (_l !== null && _l !== void 0 ? _l : '')), 'string'),
5918
5925
  ];
5919
- if (isNeedSave) {
5920
- // SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
5921
- parameterList.push(this.initParam('templateName', (_g = (_f = genInfoForm) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.name, 'string'), this.initParam('templateLang', (_j = (_h = genInfoForm) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.lang, 'string'), this.initParam('category', (_l = (_k = this.categorySelected) === null || _k === void 0 ? void 0 : _k.map(function (t) { return t.id; }).join(), (_l !== null && _l !== void 0 ? _l : '')), 'string'));
5922
- }
5923
- else {
5924
- // SKENARIO 2: CREATE NEW (Belum disave, butuh text & examples)
5926
+ // 2. Parameter Tambahan HANYA JIKA skenario Create New (Belum di-save)
5927
+ if (!isNeedSave) {
5925
5928
  var safeBodyText = encodeURIComponent(((_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.text) || '');
5926
5929
  parameterList.push(this.initParam('bodyText', safeBodyText, 'string'));
5927
5930
  var variables = (_o = genInfoForm) === null || _o === void 0 ? void 0 : _o.variables;