@adlfe/campaign-management-library 2.13.1 → 2.14.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 (20) hide show
  1. package/bundles/adlfe-campaign-management-library.umd.js +69 -65
  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/environments/environment.js +3 -3
  6. package/esm2015/lib/campaign-management/models/general-information-wa-req.model.js +15 -27
  7. package/esm2015/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +41 -32
  8. package/esm2015/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +1 -2
  9. package/esm2015/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +14 -6
  10. package/esm5/environments/environment.js +3 -3
  11. package/esm5/lib/campaign-management/models/general-information-wa-req.model.js +15 -27
  12. package/esm5/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +41 -32
  13. package/esm5/lib/campaign-management/modules/new-campaign/general-information/general-information.component.js +1 -2
  14. package/esm5/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +14 -6
  15. package/fesm2015/adlfe-campaign-management-library.js +69 -65
  16. package/fesm2015/adlfe-campaign-management-library.js.map +1 -1
  17. package/fesm5/adlfe-campaign-management-library.js +69 -65
  18. package/fesm5/adlfe-campaign-management-library.js.map +1 -1
  19. package/lib/campaign-management/models/general-information-wa-req.model.d.ts +0 -5
  20. package/package.json +1 -1
@@ -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://api-staging.neuapix.com';
773
+ API_CONST = 'https://apibsp-dev.adlsandbox.net';
774
774
  }
775
775
  // 5. Default (Localhost atau lainnya)
776
776
  else {
777
- API_CONST = 'https://api-staging.neuapix.com';
777
+ API_CONST = 'https://apibsp-dev.adlsandbox.net';
778
778
  }
779
779
  const environment = {
780
780
  production: false,
@@ -2384,7 +2384,7 @@ class FailoverAccountReqModel {
2384
2384
 
2385
2385
  class GeneralInformationWAReqModel {
2386
2386
  clone(source) {
2387
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2387
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
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') {
@@ -2421,12 +2421,6 @@ class GeneralInformationWAReqModel {
2421
2421
  fileName: source.fileName,
2422
2422
  };
2423
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
- }
2430
2424
  if (source.template) {
2431
2425
  this.template = {
2432
2426
  id: source.template.ID,
@@ -2436,19 +2430,15 @@ class GeneralInformationWAReqModel {
2436
2430
  header: (_g = (_f = source.paramHeader) === null || _f === void 0 ? void 0 : _f.map((t) => t.name), (_g !== null && _g !== void 0 ? _g : [])),
2437
2431
  data: ((_h = source.variables) === null || _h === void 0 ? void 0 : _h.length) ? source.variables.map((v) => v.paramName)
2438
2432
  : (_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) => {
2440
- var _a;
2441
- result.push((_a = each.name.map((t) => t.name), (_a !== null && _a !== void 0 ? _a : [])));
2442
- return result;
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
- : [],
2433
+ button: source.buttonParams && source.buttonParams.length > 0
2434
+ ? source.buttonParams.map((btn) => [
2435
+ btn.payload ? btn.payload : btn.label,
2436
+ ])
2437
+ : (_m = (_l = source.paramButton) === null || _l === void 0 ? void 0 : _l.reduce((result, each) => {
2438
+ var _a;
2439
+ result.push((_a = each.name.map((t) => t.name), (_a !== null && _a !== void 0 ? _a : [])));
2440
+ return result;
2441
+ }, []), (_m !== null && _m !== void 0 ? _m : [])),
2452
2442
  };
2453
2443
  if (source.template.category === 'AUTHENTICATION')
2454
2444
  this.template = {
@@ -2457,7 +2447,6 @@ class GeneralInformationWAReqModel {
2457
2447
  header: null,
2458
2448
  data: [source.otpValue],
2459
2449
  button: [[source.otpValue]],
2460
- buttonParams: [],
2461
2450
  };
2462
2451
  if (source.template.ID)
2463
2452
  this.template.id = source.template.ID;
@@ -2465,9 +2454,9 @@ class GeneralInformationWAReqModel {
2465
2454
  if (this.type === 'utility') {
2466
2455
  this.type = 'template';
2467
2456
  this.category = 'utility';
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)
2457
+ const mappedVariables = ((_p = (_o = source) === null || _o === void 0 ? void 0 : _o.variables) === null || _p === void 0 ? void 0 : _p.length) ? source.variables.map((v) => v.paramName)
2469
2458
  : [];
2470
- if ((_p = source) === null || _p === void 0 ? void 0 : _p.isUseExistingTemplate) {
2459
+ if ((_q = source) === null || _q === void 0 ? void 0 : _q.isUseExistingTemplate) {
2471
2460
  this.template = Object.assign(Object.assign({}, source.template), { data: mappedVariables.length > 0 ? mappedVariables : source.template.data || [] });
2472
2461
  }
2473
2462
  else {
@@ -2477,13 +2466,12 @@ class GeneralInformationWAReqModel {
2477
2466
  header: null,
2478
2467
  button: null,
2479
2468
  data: mappedVariables,
2480
- buttonParams: [],
2481
2469
  };
2482
2470
  }
2483
2471
  this.isNeedSave = source.isNeedSave;
2484
2472
  this.ttlSeconds = source.ttl;
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);
2473
+ if ((_r = source) === null || _r === void 0 ? void 0 : _r.isUseExistingTemplate) {
2474
+ 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);
2487
2475
  }
2488
2476
  }
2489
2477
  return this;
@@ -3973,6 +3961,7 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
3973
3961
  ((_c = formValues) === null || _c === void 0 ? void 0 : _c.medium) !== 'WA') {
3974
3962
  return;
3975
3963
  }
3964
+ console.log(formValues, 'formValues');
3976
3965
  (_d = this.getControl('channel')) === null || _d === void 0 ? void 0 : _d.setValue((_e = formValues) === null || _e === void 0 ? void 0 : _e.channel);
3977
3966
  (_f = this.getControl('media')) === null || _f === void 0 ? void 0 : _f.setValue((_g = formValues) === null || _g === void 0 ? void 0 : _g.media);
3978
3967
  (_h = this.getControl('from')) === null || _h === void 0 ? void 0 : _h.setValue((_j = formValues) === null || _j === void 0 ? void 0 : _j.from);
@@ -4145,6 +4134,7 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4145
4134
  this.initParam('pageNo', this.pageNoTemplateOption, 'number'),
4146
4135
  this.initParam('rowPerPage', 20, 'number'),
4147
4136
  this.initParam('platform', 'WA', 'string'),
4137
+ this.initParam('templateType', 'all', 'string'),
4148
4138
  this.initParam('filter', filter, 'string'),
4149
4139
  this.initParam('status', 'APPROVED', 'string'),
4150
4140
  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'),
@@ -4309,73 +4299,80 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
4309
4299
  this.subscribers.push(subs);
4310
4300
  }
4311
4301
  get buttonParamsControls() {
4312
- return this.form.get('buttonParams').controls;
4302
+ const control = this.form.get('buttonParams');
4303
+ return control ? control.controls : [];
4313
4304
  }
4314
4305
  get isUsingExcelBulk() {
4315
4306
  var _a;
4316
4307
  return ((_a = this.getControl('isUpload')) === null || _a === void 0 ? void 0 : _a.value) || false;
4317
4308
  }
4318
4309
  updateTemplate(template) {
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;
4310
+ 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;
4320
4311
  this.isShowParameter = false;
4321
4312
  if (!template)
4322
4313
  return;
4314
+ const formStorage = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
4315
+ const savedButtonParams = ((_c = formStorage) === null || _c === void 0 ? void 0 : _c.buttonParams) || [];
4323
4316
  const buttonParamsArray = this.form.get('buttonParams');
4324
4317
  buttonParamsArray.clear();
4325
4318
  if (template && template.buttons && template.buttons.length > 0) {
4326
4319
  const quickReplyButtons = template.buttons.filter((btn) => btn.type === 'QUICK_REPLY');
4327
- quickReplyButtons.forEach((btn) => {
4320
+ quickReplyButtons.forEach((btn, index) => {
4321
+ var _a;
4322
+ const existingPayload = ((_a = savedButtonParams[index]) === null || _a === void 0 ? void 0 : _a.payload) || '';
4328
4323
  buttonParamsArray.push(new FormGroup({
4329
4324
  label: new FormControl(btn.text),
4330
- payload: new FormControl('', [Validators$1.maxLength(256)]),
4325
+ payload: new FormControl({
4326
+ value: existingPayload,
4327
+ disabled: this.isReadOnlyMode,
4328
+ }, [Validators$1.maxLength(256)]),
4331
4329
  }));
4332
4330
  });
4333
4331
  }
4334
4332
  this.isHaveTemplateParam =
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();
4333
+ (_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 ||
4334
+ (_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 ||
4335
+ (_l = (_k = template.buttons) === null || _k === void 0 ? void 0 : _k.length, (_l !== null && _l !== void 0 ? _l : 0)) > 0;
4336
+ 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())) {
4337
+ (_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)));
4338
+ (_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)));
4339
+ 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());
4340
+ }
4341
+ (_5 = (_4 = template.header.examples) === null || _4 === void 0 ? void 0 : _4.length, (_5 !== null && _5 !== void 0 ? _5 : 0)) > 0
4342
+ ? (_6 = this.getControl('paramHeader')) === null || _6 === void 0 ? void 0 : _6.setValidators(Validators$1.required) : (_7 = this.getControl('paramHeader')) === null || _7 === void 0 ? void 0 : _7.clearValidators();
4343
+ (_9 = (_8 = template.body.examples) === null || _8 === void 0 ? void 0 : _8.length, (_9 !== null && _9 !== void 0 ? _9 : 0)) > 0
4344
+ ? (_10 = this.getControl('paramBody')) === null || _10 === void 0 ? void 0 : _10.setValidators(Validators$1.required) : (_11 = this.getControl('paramBody')) === null || _11 === void 0 ? void 0 : _11.clearValidators();
4345
+ (_13 = (_12 = template.buttons) === null || _12 === void 0 ? void 0 : _12.length, (_13 !== null && _13 !== void 0 ? _13 : 0)) > 0
4346
+ ? (_14 = this.getControl('paramButton')) === null || _14 === void 0 ? void 0 : _14.setValidators(Validators$1.required) : (_15 = this.getControl('paramButton')) === null || _15 === void 0 ? void 0 : _15.clearValidators();
4349
4347
  this.form.get('paramHeader').controls = [];
4350
4348
  this.form.get('paramHeader').reset();
4351
- (_13 = this.getControl('paramHeader')) === null || _13 === void 0 ? void 0 : _13.updateValueAndValidity();
4349
+ (_16 = this.getControl('paramHeader')) === null || _16 === void 0 ? void 0 : _16.updateValueAndValidity();
4352
4350
  this.form.get('paramBody').controls = [];
4353
4351
  this.form.get('paramBody').reset();
4354
- (_14 = this.getControl('paramBody')) === null || _14 === void 0 ? void 0 : _14.updateValueAndValidity();
4352
+ (_17 = this.getControl('paramBody')) === null || _17 === void 0 ? void 0 : _17.updateValueAndValidity();
4355
4353
  this.form.get('paramButton').controls = [];
4356
4354
  this.form.get('paramButton').reset();
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;
4355
+ (_18 = this.getControl('paramButton')) === null || _18 === void 0 ? void 0 : _18.updateValueAndValidity();
4356
+ (_19 = this.getControl('otpValue')) === null || _19 === void 0 ? void 0 : _19.setValue('');
4357
+ (_20 = this.getControl('otpValue')) === null || _20 === void 0 ? void 0 : _20.clearValidators();
4358
+ (_21 = this.getControl('otpValue')) === null || _21 === void 0 ? void 0 : _21.updateValueAndValidity();
4362
4359
  if (template.category === 'AUTHENTICATION') {
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();
4360
+ (_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 = [...(_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 : '')));
4361
+ (_31 = this.getControl('otpValue')) === null || _31 === void 0 ? void 0 : _31.setValidators(Validators$1.required);
4362
+ (_32 = this.getControl('otpValue')) === null || _32 === void 0 ? void 0 : _32.updateValueAndValidity();
4366
4363
  }
4367
- (_32 = template.header.examples) === null || _32 === void 0 ? void 0 : _32.forEach((each, index) => {
4364
+ (_33 = template.header.examples) === null || _33 === void 0 ? void 0 : _33.forEach((each, index) => {
4368
4365
  var _a, _b, _c, _d, _e, _f, _g;
4369
4366
  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 : '')));
4370
4367
  });
4371
- (_33 = template.body.examples) === null || _33 === void 0 ? void 0 : _33.forEach((each, index) => {
4368
+ (_34 = template.body.examples) === null || _34 === void 0 ? void 0 : _34.forEach((each, index) => {
4372
4369
  var _a, _b, _c, _d, _e, _f, _g;
4373
4370
  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 : ''));
4374
4371
  if (['$UnsubscribeAccount'].includes(each))
4375
4372
  paramValue = each;
4376
4373
  this.addParamBody(paramValue);
4377
4374
  });
4378
- (_34 = template.buttons) === null || _34 === void 0 ? void 0 : _34.forEach((each, index) => {
4375
+ (_35 = template.buttons) === null || _35 === void 0 ? void 0 : _35.forEach((each, index) => {
4379
4376
  var _a, _b, _c, _d;
4380
4377
  this.addParamButton();
4381
4378
  const button = this.getButton;
@@ -5036,7 +5033,6 @@ let GeneralInformationComponent = class GeneralInformationComponent {
5036
5033
  this.form.disable();
5037
5034
  }
5038
5035
  updateGeneralInformationForm(form) {
5039
- console.log(form, 'form');
5040
5036
  this.generalInformationForm = form;
5041
5037
  this.isShowMore = false;
5042
5038
  this.generalInformation.emit({
@@ -5331,23 +5327,31 @@ let NewNumberBasesComponent = class NewNumberBasesComponent {
5331
5327
  return found ? true : false;
5332
5328
  }
5333
5329
  onDownloadSampleService() {
5334
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
5330
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
5335
5331
  const genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
5336
5332
  const isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
5337
5333
  const parameterList = [
5338
5334
  this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
5335
+ this.initParam('templateName', (_g = (_f = genInfoForm) === null || _f === void 0 ? void 0 : _f.template) === null || _g === void 0 ? void 0 : _g.name, 'string'),
5336
+ this.initParam('templateLang', (_j = (_h = genInfoForm) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.lang, 'string'),
5339
5337
  ];
5340
5338
  if (isNeedSave) {
5341
5339
  // 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'));
5340
+ parameterList.push(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
5341
  }
5344
5342
  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'));
5343
+ // SKENARIO 2: CREATE NEW (Auto-generated dll)
5344
+ const safeBodyText = encodeURIComponent(((_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.text) || '');
5345
+ parameterList.push(this.initParam('bodyText', safeBodyText, 'string'));
5347
5346
  const variables = (_o = genInfoForm) === null || _o === void 0 ? void 0 : _o.variables;
5348
5347
  if (variables && Array.isArray(variables) && variables.length > 0) {
5349
5348
  const bodyExamplesString = variables.map((v) => v.paramName).join(',');
5350
- parameterList.push(this.initParam('bodyExamples', bodyExamplesString, 'string'));
5349
+ const safeBodyExamples = encodeURIComponent(bodyExamplesString);
5350
+ parameterList.push(this.initParam('bodyExamples', safeBodyExamples, 'string'));
5351
+ }
5352
+ if ((_r = (_q = (_p = genInfoForm) === null || _p === void 0 ? void 0 : _p.template) === null || _q === void 0 ? void 0 : _q.header) === null || _r === void 0 ? void 0 : _r.text) {
5353
+ const safeHeaderText = encodeURIComponent(genInfoForm.template.header.text);
5354
+ parameterList.push(this.initParam('headerText', safeHeaderText, 'string'));
5351
5355
  }
5352
5356
  }
5353
5357
  const subs = this.apiAdapterService