@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
|
@@ -2774,7 +2774,7 @@ var NewCampaignComponent = /** @class */ (function () {
|
|
|
2774
2774
|
var subs = this.apiAdapterService
|
|
2775
2775
|
.executeApiRequest([], "/campaign/" + this.campaignID, 'GET')
|
|
2776
2776
|
.subscribe(function (resp) {
|
|
2777
|
-
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;
|
|
2777
|
+
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;
|
|
2778
2778
|
if (!resp)
|
|
2779
2779
|
return;
|
|
2780
2780
|
var generalInformation = {
|
|
@@ -2821,47 +2821,48 @@ var NewCampaignComponent = /** @class */ (function () {
|
|
|
2821
2821
|
paramName: val,
|
|
2822
2822
|
}); }),
|
|
2823
2823
|
isUseExistingTemplate: !!((_36 = resp.data) === null || _36 === void 0 ? void 0 : _36.templateName),
|
|
2824
|
+
isNeedSave: !!((_37 = resp.data) === null || _37 === void 0 ? void 0 : _37.templateName),
|
|
2824
2825
|
template: {
|
|
2825
|
-
ID: (
|
|
2826
|
-
name: (
|
|
2827
|
-
lang: (
|
|
2828
|
-
platform: (
|
|
2829
|
-
headerURL: (
|
|
2826
|
+
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,
|
|
2827
|
+
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,
|
|
2828
|
+
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,
|
|
2829
|
+
platform: (_47 = resp.data) === null || _47 === void 0 ? void 0 : _47.platform,
|
|
2830
|
+
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,
|
|
2830
2831
|
header: {
|
|
2831
|
-
examples: (
|
|
2832
|
+
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,
|
|
2832
2833
|
},
|
|
2833
2834
|
body: {
|
|
2834
|
-
examples: (
|
|
2835
|
+
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,
|
|
2835
2836
|
},
|
|
2836
|
-
buttons: (
|
|
2837
|
-
ClientId: (
|
|
2838
|
-
ClientName: (
|
|
2837
|
+
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,
|
|
2838
|
+
ClientId: (_60 = resp.data) === null || _60 === void 0 ? void 0 : _60.clientId,
|
|
2839
|
+
ClientName: (_61 = resp.data) === null || _61 === void 0 ? void 0 : _61.clientName,
|
|
2839
2840
|
},
|
|
2840
|
-
isUpload: ((
|
|
2841
|
-
fileId: (
|
|
2841
|
+
isUpload: ((_62 = resp.data) === null || _62 === void 0 ? void 0 : _62.fileId) !== '',
|
|
2842
|
+
fileId: (_63 = resp.data) === null || _63 === void 0 ? void 0 : _63.fileId,
|
|
2842
2843
|
};
|
|
2843
2844
|
localStorage.setItem('telin.campaign', JSON.stringify(__assign(__assign({}, _this.getCampaignStorage), {
|
|
2844
2845
|
generalInformation: {
|
|
2845
|
-
id: (
|
|
2846
|
+
id: (_64 = resp.data) === null || _64 === void 0 ? void 0 : _64.id,
|
|
2846
2847
|
form: generalInformation,
|
|
2847
2848
|
},
|
|
2848
|
-
failover: (
|
|
2849
|
-
targetAudience: (
|
|
2849
|
+
failover: (_65 = resp.data) === null || _65 === void 0 ? void 0 : _65.failover,
|
|
2850
|
+
targetAudience: (_66 = resp.data) === null || _66 === void 0 ? void 0 : _66.targets,
|
|
2850
2851
|
targetAudienceFile: {
|
|
2851
|
-
name: (
|
|
2852
|
-
targetURL: (
|
|
2852
|
+
name: (_67 = resp.data) === null || _67 === void 0 ? void 0 : _67.fileName,
|
|
2853
|
+
targetURL: (_68 = resp.data) === null || _68 === void 0 ? void 0 : _68.targetURL,
|
|
2853
2854
|
},
|
|
2854
2855
|
scheduler: {
|
|
2855
|
-
schedulerType: ((
|
|
2856
|
+
schedulerType: ((_69 = resp.data) === null || _69 === void 0 ? void 0 : _69.scheduleType) === 'MULTI'
|
|
2856
2857
|
? 'ONE_TIME'
|
|
2857
|
-
: (
|
|
2858
|
-
startDate: (
|
|
2859
|
-
startTime: (
|
|
2860
|
-
isRepeat: ((
|
|
2861
|
-
delivery: (
|
|
2858
|
+
: (_70 = resp.data) === null || _70 === void 0 ? void 0 : _70.scheduleType,
|
|
2859
|
+
startDate: (_72 = (_71 = resp.data) === null || _71 === void 0 ? void 0 : _71.startTime) === null || _72 === void 0 ? void 0 : _72.split(' ')[0],
|
|
2860
|
+
startTime: (_74 = (_73 = resp.data) === null || _73 === void 0 ? void 0 : _73.startTime) === null || _74 === void 0 ? void 0 : _74.split(' ')[1],
|
|
2861
|
+
isRepeat: ((_75 = resp.data) === null || _75 === void 0 ? void 0 : _75.scheduleType) === 'MULTI',
|
|
2862
|
+
delivery: (_76 = resp.data) === null || _76 === void 0 ? void 0 : _76.repeat,
|
|
2862
2863
|
},
|
|
2863
2864
|
})));
|
|
2864
|
-
_this.isLine = ((
|
|
2865
|
+
_this.isLine = ((_77 = resp.data) === null || _77 === void 0 ? void 0 : _77.platform) === 'LINE';
|
|
2865
2866
|
_this.isLoading = false;
|
|
2866
2867
|
_this.initWizard();
|
|
2867
2868
|
}, function () {
|
|
@@ -4195,6 +4196,7 @@ var GeneralInformationWAComponent = /** @class */ (function () {
|
|
|
4195
4196
|
configurable: true
|
|
4196
4197
|
});
|
|
4197
4198
|
GeneralInformationWAComponent.prototype.ngOnInit = function () {
|
|
4199
|
+
var _this = this;
|
|
4198
4200
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4199
4201
|
this.msgTypeWAOption = MsgTypeWAOptionConst;
|
|
4200
4202
|
this.mediaTypeOption = MediaTypeOptionConst;
|
|
@@ -4213,7 +4215,14 @@ var GeneralInformationWAComponent = /** @class */ (function () {
|
|
|
4213
4215
|
this.initValidation();
|
|
4214
4216
|
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'
|
|
4215
4217
|
? (_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 : '');
|
|
4216
|
-
|
|
4218
|
+
// Listen text to changes in the form
|
|
4219
|
+
var textControlForSync = this.getControl('text');
|
|
4220
|
+
if (textControlForSync) {
|
|
4221
|
+
var textSubs = textControlForSync.valueChanges.subscribe(function (value) {
|
|
4222
|
+
_this.syncVariablesFromText(value);
|
|
4223
|
+
});
|
|
4224
|
+
this.subscribers.push(textSubs);
|
|
4225
|
+
}
|
|
4217
4226
|
};
|
|
4218
4227
|
Object.defineProperty(GeneralInformationWAComponent.prototype, "getCampaignStorage", {
|
|
4219
4228
|
get: function () {
|
|
@@ -5050,16 +5059,43 @@ var GeneralInformationWAComponent = /** @class */ (function () {
|
|
|
5050
5059
|
enumerable: true,
|
|
5051
5060
|
configurable: true
|
|
5052
5061
|
});
|
|
5053
|
-
GeneralInformationWAComponent.prototype.
|
|
5054
|
-
var
|
|
5055
|
-
|
|
5062
|
+
GeneralInformationWAComponent.prototype.syncVariablesFromText = function (text) {
|
|
5063
|
+
var _a;
|
|
5064
|
+
if (text === null || text === undefined)
|
|
5065
|
+
return;
|
|
5066
|
+
var counter = 1;
|
|
5067
|
+
var normalizedText = text.replace(/\{\{\s*\d+\s*\}\}/g, function () {
|
|
5068
|
+
var replacement = "{{" + counter + "}}";
|
|
5069
|
+
counter++;
|
|
5070
|
+
return replacement;
|
|
5056
5071
|
});
|
|
5057
|
-
|
|
5072
|
+
var targetVariableCount = counter - 1;
|
|
5073
|
+
if (text !== normalizedText) {
|
|
5074
|
+
(_a = this.getControl('text')) === null || _a === void 0 ? void 0 : _a.setValue(normalizedText, { emitEvent: false });
|
|
5075
|
+
}
|
|
5076
|
+
var currentCount = this.variables.length;
|
|
5077
|
+
if (targetVariableCount > currentCount) {
|
|
5078
|
+
var diff = targetVariableCount - currentCount;
|
|
5079
|
+
for (var i = 0; i < diff; i++) {
|
|
5080
|
+
this.variables.push(new FormGroup({
|
|
5081
|
+
paramName: new FormControl({ value: '', disabled: this.isReadOnlyMode }, Validators$1.required),
|
|
5082
|
+
}));
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
else if (targetVariableCount < currentCount) {
|
|
5086
|
+
var diff = currentCount - targetVariableCount;
|
|
5087
|
+
for (var i = 0; i < diff; i++) {
|
|
5088
|
+
this.variables.removeAt(this.variables.length - 1);
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
};
|
|
5092
|
+
GeneralInformationWAComponent.prototype.addVariable = function () {
|
|
5058
5093
|
var textControl = this.getControl('text');
|
|
5059
5094
|
if (textControl) {
|
|
5060
5095
|
var currentBody = textControl.value || '';
|
|
5061
|
-
var
|
|
5062
|
-
|
|
5096
|
+
var nextSequence = this.variables.length + 1;
|
|
5097
|
+
var newSequence = "{{" + nextSequence + "}}";
|
|
5098
|
+
textControl.setValue("" + currentBody + newSequence);
|
|
5063
5099
|
}
|
|
5064
5100
|
};
|
|
5065
5101
|
GeneralInformationWAComponent.prototype.removeVariable = function (index) {
|
|
@@ -5985,11 +6021,9 @@ var NewNumberBasesComponent = /** @class */ (function () {
|
|
|
5985
6021
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
5986
6022
|
var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
|
|
5987
6023
|
var isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
|
|
5988
|
-
// 1. Parameter Wajib (Selalu dikirim di semua skenario)
|
|
5989
6024
|
var parameterList = [
|
|
5990
6025
|
this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
|
|
5991
|
-
this.initParam('category', (_g = (_f = this.categorySelected) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.id; }).join(), (_g !== null && _g !== void 0 ? _g : '')),
|
|
5992
|
-
'string'),
|
|
6026
|
+
this.initParam('category', (_g = (_f = this.categorySelected) === null || _f === void 0 ? void 0 : _f.map(function (t) { return t.id; }).join(), (_g !== null && _g !== void 0 ? _g : '')), 'string'),
|
|
5993
6027
|
];
|
|
5994
6028
|
if (isNeedSave) {
|
|
5995
6029
|
// SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
|
|
@@ -5997,7 +6031,6 @@ var NewNumberBasesComponent = /** @class */ (function () {
|
|
|
5997
6031
|
}
|
|
5998
6032
|
else {
|
|
5999
6033
|
// SKENARIO 2: CREATE NEW / DIRECT SEND (Belum di-save)
|
|
6000
|
-
// Cek aman: Kirim templateName & Lang HANYA kalau ada (biar nggak undefined)
|
|
6001
6034
|
if ((_o = (_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.name) {
|
|
6002
6035
|
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'));
|
|
6003
6036
|
}
|