@adlfe/campaign-management-library 2.15.4 → 2.15.5
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.
- package/bundles/adlfe-campaign-management-library.umd.js +69 -36
- package/bundles/adlfe-campaign-management-library.umd.js.map +1 -1
- package/bundles/adlfe-campaign-management-library.umd.min.js +2 -2
- package/bundles/adlfe-campaign-management-library.umd.min.js.map +1 -1
- package/esm2015/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +42 -8
- package/esm2015/lib/campaign-management/modules/new-campaign/new-campaign.component.js +27 -26
- package/esm2015/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +2 -5
- package/esm5/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.js +43 -8
- package/esm5/lib/campaign-management/modules/new-campaign/new-campaign.component.js +27 -26
- package/esm5/lib/campaign-management/modules/new-campaign/new-number-bases/new-number-bases.component.js +2 -5
- package/fesm2015/adlfe-campaign-management-library.js +68 -36
- package/fesm2015/adlfe-campaign-management-library.js.map +1 -1
- package/fesm5/adlfe-campaign-management-library.js +69 -36
- package/fesm5/adlfe-campaign-management-library.js.map +1 -1
- package/lib/campaign-management/modules/new-campaign/components/general-information-wa/general-information-wa.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2647,7 +2647,7 @@ let NewCampaignComponent = class NewCampaignComponent {
|
|
|
2647
2647
|
const subs = this.apiAdapterService
|
|
2648
2648
|
.executeApiRequest([], `/campaign/${this.campaignID}`, 'GET')
|
|
2649
2649
|
.subscribe((resp) => {
|
|
2650
|
-
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, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76;
|
|
2650
|
+
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, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77;
|
|
2651
2651
|
if (!resp)
|
|
2652
2652
|
return;
|
|
2653
2653
|
const generalInformation = {
|
|
@@ -2694,47 +2694,48 @@ let NewCampaignComponent = class NewCampaignComponent {
|
|
|
2694
2694
|
paramName: val,
|
|
2695
2695
|
})),
|
|
2696
2696
|
isUseExistingTemplate: !!((_36 = resp.data) === null || _36 === void 0 ? void 0 : _36.templateName),
|
|
2697
|
+
isNeedSave: !!((_37 = resp.data) === null || _37 === void 0 ? void 0 : _37.templateName),
|
|
2697
2698
|
template: {
|
|
2698
|
-
ID: (
|
|
2699
|
-
name: (
|
|
2700
|
-
lang: (
|
|
2701
|
-
platform: (
|
|
2702
|
-
headerURL: (
|
|
2699
|
+
ID: (_40 = (_39 = (_38 = resp.data) === null || _38 === void 0 ? void 0 : _38.details) === null || _39 === void 0 ? void 0 : _39.template) === null || _40 === void 0 ? void 0 : _40.id,
|
|
2700
|
+
name: (_43 = (_42 = (_41 = resp.data) === null || _41 === void 0 ? void 0 : _41.details) === null || _42 === void 0 ? void 0 : _42.template) === null || _43 === void 0 ? void 0 : _43.name,
|
|
2701
|
+
lang: (_46 = (_45 = (_44 = resp.data) === null || _44 === void 0 ? void 0 : _44.details) === null || _45 === void 0 ? void 0 : _45.template) === null || _46 === void 0 ? void 0 : _46.lang,
|
|
2702
|
+
platform: (_47 = resp.data) === null || _47 === void 0 ? void 0 : _47.platform,
|
|
2703
|
+
headerURL: (_50 = (_49 = (_48 = resp.data) === null || _48 === void 0 ? void 0 : _48.details) === null || _49 === void 0 ? void 0 : _49.template) === null || _50 === void 0 ? void 0 : _50.headerURL,
|
|
2703
2704
|
header: {
|
|
2704
|
-
examples: (
|
|
2705
|
+
examples: (_53 = (_52 = (_51 = resp.data) === null || _51 === void 0 ? void 0 : _51.details) === null || _52 === void 0 ? void 0 : _52.template) === null || _53 === void 0 ? void 0 : _53.header,
|
|
2705
2706
|
},
|
|
2706
2707
|
body: {
|
|
2707
|
-
examples: (
|
|
2708
|
+
examples: (_56 = (_55 = (_54 = resp.data) === null || _54 === void 0 ? void 0 : _54.details) === null || _55 === void 0 ? void 0 : _55.template) === null || _56 === void 0 ? void 0 : _56.data,
|
|
2708
2709
|
},
|
|
2709
|
-
buttons: (
|
|
2710
|
-
ClientId: (
|
|
2711
|
-
ClientName: (
|
|
2710
|
+
buttons: (_59 = (_58 = (_57 = resp.data) === null || _57 === void 0 ? void 0 : _57.details) === null || _58 === void 0 ? void 0 : _58.template) === null || _59 === void 0 ? void 0 : _59.button,
|
|
2711
|
+
ClientId: (_60 = resp.data) === null || _60 === void 0 ? void 0 : _60.clientId,
|
|
2712
|
+
ClientName: (_61 = resp.data) === null || _61 === void 0 ? void 0 : _61.clientName,
|
|
2712
2713
|
},
|
|
2713
|
-
isUpload: ((
|
|
2714
|
-
fileId: (
|
|
2714
|
+
isUpload: ((_62 = resp.data) === null || _62 === void 0 ? void 0 : _62.fileId) !== '',
|
|
2715
|
+
fileId: (_63 = resp.data) === null || _63 === void 0 ? void 0 : _63.fileId,
|
|
2715
2716
|
};
|
|
2716
2717
|
localStorage.setItem('telin.campaign', JSON.stringify(Object.assign(Object.assign({}, this.getCampaignStorage), {
|
|
2717
2718
|
generalInformation: {
|
|
2718
|
-
id: (
|
|
2719
|
+
id: (_64 = resp.data) === null || _64 === void 0 ? void 0 : _64.id,
|
|
2719
2720
|
form: generalInformation,
|
|
2720
2721
|
},
|
|
2721
|
-
failover: (
|
|
2722
|
-
targetAudience: (
|
|
2722
|
+
failover: (_65 = resp.data) === null || _65 === void 0 ? void 0 : _65.failover,
|
|
2723
|
+
targetAudience: (_66 = resp.data) === null || _66 === void 0 ? void 0 : _66.targets,
|
|
2723
2724
|
targetAudienceFile: {
|
|
2724
|
-
name: (
|
|
2725
|
-
targetURL: (
|
|
2725
|
+
name: (_67 = resp.data) === null || _67 === void 0 ? void 0 : _67.fileName,
|
|
2726
|
+
targetURL: (_68 = resp.data) === null || _68 === void 0 ? void 0 : _68.targetURL,
|
|
2726
2727
|
},
|
|
2727
2728
|
scheduler: {
|
|
2728
|
-
schedulerType: ((
|
|
2729
|
+
schedulerType: ((_69 = resp.data) === null || _69 === void 0 ? void 0 : _69.scheduleType) === 'MULTI'
|
|
2729
2730
|
? 'ONE_TIME'
|
|
2730
|
-
: (
|
|
2731
|
-
startDate: (
|
|
2732
|
-
startTime: (
|
|
2733
|
-
isRepeat: ((
|
|
2734
|
-
delivery: (
|
|
2731
|
+
: (_70 = resp.data) === null || _70 === void 0 ? void 0 : _70.scheduleType,
|
|
2732
|
+
startDate: (_72 = (_71 = resp.data) === null || _71 === void 0 ? void 0 : _71.startTime) === null || _72 === void 0 ? void 0 : _72.split(' ')[0],
|
|
2733
|
+
startTime: (_74 = (_73 = resp.data) === null || _73 === void 0 ? void 0 : _73.startTime) === null || _74 === void 0 ? void 0 : _74.split(' ')[1],
|
|
2734
|
+
isRepeat: ((_75 = resp.data) === null || _75 === void 0 ? void 0 : _75.scheduleType) === 'MULTI',
|
|
2735
|
+
delivery: (_76 = resp.data) === null || _76 === void 0 ? void 0 : _76.repeat,
|
|
2735
2736
|
},
|
|
2736
2737
|
})));
|
|
2737
|
-
this.isLine = ((
|
|
2738
|
+
this.isLine = ((_77 = resp.data) === null || _77 === void 0 ? void 0 : _77.platform) === 'LINE';
|
|
2738
2739
|
this.isLoading = false;
|
|
2739
2740
|
this.initWizard();
|
|
2740
2741
|
}, () => {
|
|
@@ -3975,7 +3976,14 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
|
|
|
3975
3976
|
this.initValidation();
|
|
3976
3977
|
this.getAccountOptionService(((_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'
|
|
3977
3978
|
? (_g = (_f = (_e = (_d = this.getCampaignStorage) === null || _d === void 0 ? void 0 : _d.generalInformation) === null || _e === void 0 ? void 0 : _e.form) === null || _f === void 0 ? void 0 : _f.from) === null || _g === void 0 ? void 0 : _g.name : '');
|
|
3978
|
-
|
|
3979
|
+
// Listen text to changes in the form
|
|
3980
|
+
const textControlForSync = this.getControl('text');
|
|
3981
|
+
if (textControlForSync) {
|
|
3982
|
+
const textSubs = textControlForSync.valueChanges.subscribe((value) => {
|
|
3983
|
+
this.syncVariablesFromText(value);
|
|
3984
|
+
});
|
|
3985
|
+
this.subscribers.push(textSubs);
|
|
3986
|
+
}
|
|
3979
3987
|
}
|
|
3980
3988
|
get getCampaignStorage() {
|
|
3981
3989
|
const campaignData = localStorage.getItem('telin.campaign');
|
|
@@ -4743,16 +4751,43 @@ let GeneralInformationWAComponent = class GeneralInformationWAComponent {
|
|
|
4743
4751
|
get variables() {
|
|
4744
4752
|
return this.getControl('variables');
|
|
4745
4753
|
}
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4754
|
+
syncVariablesFromText(text) {
|
|
4755
|
+
var _a;
|
|
4756
|
+
if (text === null || text === undefined)
|
|
4757
|
+
return;
|
|
4758
|
+
let counter = 1;
|
|
4759
|
+
const normalizedText = text.replace(/\{\{\s*\d+\s*\}\}/g, () => {
|
|
4760
|
+
const replacement = `{{${counter}}}`;
|
|
4761
|
+
counter++;
|
|
4762
|
+
return replacement;
|
|
4749
4763
|
});
|
|
4750
|
-
|
|
4764
|
+
const targetVariableCount = counter - 1;
|
|
4765
|
+
if (text !== normalizedText) {
|
|
4766
|
+
(_a = this.getControl('text')) === null || _a === void 0 ? void 0 : _a.setValue(normalizedText, { emitEvent: false });
|
|
4767
|
+
}
|
|
4768
|
+
const currentCount = this.variables.length;
|
|
4769
|
+
if (targetVariableCount > currentCount) {
|
|
4770
|
+
const diff = targetVariableCount - currentCount;
|
|
4771
|
+
for (let i = 0; i < diff; i++) {
|
|
4772
|
+
this.variables.push(new FormGroup({
|
|
4773
|
+
paramName: new FormControl({ value: '', disabled: this.isReadOnlyMode }, Validators$1.required),
|
|
4774
|
+
}));
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
else if (targetVariableCount < currentCount) {
|
|
4778
|
+
const diff = currentCount - targetVariableCount;
|
|
4779
|
+
for (let i = 0; i < diff; i++) {
|
|
4780
|
+
this.variables.removeAt(this.variables.length - 1);
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
addVariable() {
|
|
4751
4785
|
const textControl = this.getControl('text');
|
|
4752
4786
|
if (textControl) {
|
|
4753
4787
|
const currentBody = textControl.value || '';
|
|
4754
|
-
const
|
|
4755
|
-
|
|
4788
|
+
const nextSequence = this.variables.length + 1;
|
|
4789
|
+
const newSequence = `{{${nextSequence}}}`;
|
|
4790
|
+
textControl.setValue(`${currentBody}${newSequence}`);
|
|
4756
4791
|
}
|
|
4757
4792
|
}
|
|
4758
4793
|
removeVariable(index) {
|
|
@@ -5582,11 +5617,9 @@ let NewNumberBasesComponent = class NewNumberBasesComponent {
|
|
|
5582
5617
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
5583
5618
|
const genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
|
|
5584
5619
|
const isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
|
|
5585
|
-
// 1. Parameter Wajib (Selalu dikirim di semua skenario)
|
|
5586
5620
|
const parameterList = [
|
|
5587
5621
|
this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
|
|
5588
|
-
this.initParam('category', (_g = (_f = this.categorySelected) === null || _f === void 0 ? void 0 : _f.map((t) => t.id).join(), (_g !== null && _g !== void 0 ? _g : '')),
|
|
5589
|
-
'string'),
|
|
5622
|
+
this.initParam('category', (_g = (_f = this.categorySelected) === null || _f === void 0 ? void 0 : _f.map((t) => t.id).join(), (_g !== null && _g !== void 0 ? _g : '')), 'string'),
|
|
5590
5623
|
];
|
|
5591
5624
|
if (isNeedSave) {
|
|
5592
5625
|
// SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
|
|
@@ -5594,7 +5627,6 @@ let NewNumberBasesComponent = class NewNumberBasesComponent {
|
|
|
5594
5627
|
}
|
|
5595
5628
|
else {
|
|
5596
5629
|
// SKENARIO 2: CREATE NEW / DIRECT SEND (Belum di-save)
|
|
5597
|
-
// Cek aman: Kirim templateName & Lang HANYA kalau ada (biar nggak undefined)
|
|
5598
5630
|
if ((_o = (_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.name) {
|
|
5599
5631
|
parameterList.push(this.initParam('templateName', (_q = (_p = genInfoForm) === null || _p === void 0 ? void 0 : _p.template) === null || _q === void 0 ? void 0 : _q.name, 'string'));
|
|
5600
5632
|
}
|