@adlfe/campaign-management-library 2.14.1 → 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.
@@ -2724,23 +2724,32 @@
2724
2724
  };
2725
2725
  }
2726
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 : []));
2727
2744
  this.template = {
2728
2745
  id: source.template.ID,
2729
2746
  name: source.template.name,
2730
2747
  lang: source.template.lang,
2731
2748
  headerUrl: source.targetURL,
2732
- header: (_g = (_f = source.paramHeader) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.name; }), (_g !== null && _g !== void 0 ? _g : [])),
2733
- data: ((_h = source.variables) === null || _h === void 0 ? void 0 : _h.length) ? source.variables.map(function (v) { return v.paramName; })
2734
- : (_k = (_j = source.paramBody) === null || _j === void 0 ? void 0 : _j.map(function (t) { return t.name; }), (_k !== null && _k !== void 0 ? _k : [])),
2735
- button: source.buttonParams && source.buttonParams.length > 0
2736
- ? source.buttonParams.map(function (btn) { return [
2737
- btn.payload ? btn.payload : btn.label,
2738
- ]; })
2739
- : (_m = (_l = source.paramButton) === null || _l === void 0 ? void 0 : _l.reduce(function (result, each) {
2740
- var _a;
2741
- result.push((_a = each.name.map(function (t) { return t.name; }), (_a !== null && _a !== void 0 ? _a : [])));
2742
- return result;
2743
- }, []), (_m !== null && _m !== void 0 ? _m : [])),
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,
2744
2753
  };
2745
2754
  if (source.template.category === 'AUTHENTICATION')
2746
2755
  this.template = {
@@ -4384,7 +4393,6 @@
4384
4393
  ((_c = formValues) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA') {
4385
4394
  return;
4386
4395
  }
4387
- console.log(formValues, 'formValues');
4388
4396
  (_d = this.getControl('channel')) === null || _d === void 0 ? void 0 : _d.setValue((_e = formValues) === null || _e === void 0 ? void 0 : _e.channel);
4389
4397
  (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValue((_g = formValues) === null || _g === void 0 ? void 0 : _g.media);
4390
4398
  (_h = this.getControl('from')) === null || _h === void 0 ? void 0 : _h.setValue((_j = formValues) === null || _j === void 0 ? void 0 : _j.from);
@@ -5913,13 +5921,10 @@
5913
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'),
5914
5922
  this.initParam('templateName', (_g = (_f = genInfoForm) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.name, 'string'),
5915
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'),
5916
5925
  ];
5917
- if (isNeedSave) {
5918
- // SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
5919
- parameterList.push(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'));
5920
- }
5921
- else {
5922
- // SKENARIO 2: CREATE NEW (Auto-generated dll)
5926
+ // 2. Parameter Tambahan HANYA JIKA skenario Create New (Belum di-save)
5927
+ if (!isNeedSave) {
5923
5928
  var safeBodyText = encodeURIComponent(((_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.text) || '');
5924
5929
  parameterList.push(this.initParam('bodyText', safeBodyText, 'string'));
5925
5930
  var variables = (_o = genInfoForm) === null || _o === void 0 ? void 0 : _o.variables;