@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
|
@@ -2953,7 +2953,7 @@
|
|
|
2953
2953
|
var subs = this.apiAdapterService
|
|
2954
2954
|
.executeApiRequest([], "/campaign/" + this.campaignID, 'GET')
|
|
2955
2955
|
.subscribe(function (resp) {
|
|
2956
|
-
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;
|
|
2956
|
+
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;
|
|
2957
2957
|
if (!resp)
|
|
2958
2958
|
return;
|
|
2959
2959
|
var generalInformation = {
|
|
@@ -3000,47 +3000,48 @@
|
|
|
3000
3000
|
paramName: val,
|
|
3001
3001
|
}); }),
|
|
3002
3002
|
isUseExistingTemplate: !!((_36 = resp.data) === null || _36 === void 0 ? void 0 : _36.templateName),
|
|
3003
|
+
isNeedSave: !!((_37 = resp.data) === null || _37 === void 0 ? void 0 : _37.templateName),
|
|
3003
3004
|
template: {
|
|
3004
|
-
ID: (
|
|
3005
|
-
name: (
|
|
3006
|
-
lang: (
|
|
3007
|
-
platform: (
|
|
3008
|
-
headerURL: (
|
|
3005
|
+
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,
|
|
3006
|
+
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,
|
|
3007
|
+
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,
|
|
3008
|
+
platform: (_47 = resp.data) === null || _47 === void 0 ? void 0 : _47.platform,
|
|
3009
|
+
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,
|
|
3009
3010
|
header: {
|
|
3010
|
-
examples: (
|
|
3011
|
+
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,
|
|
3011
3012
|
},
|
|
3012
3013
|
body: {
|
|
3013
|
-
examples: (
|
|
3014
|
+
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,
|
|
3014
3015
|
},
|
|
3015
|
-
buttons: (
|
|
3016
|
-
ClientId: (
|
|
3017
|
-
ClientName: (
|
|
3016
|
+
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,
|
|
3017
|
+
ClientId: (_60 = resp.data) === null || _60 === void 0 ? void 0 : _60.clientId,
|
|
3018
|
+
ClientName: (_61 = resp.data) === null || _61 === void 0 ? void 0 : _61.clientName,
|
|
3018
3019
|
},
|
|
3019
|
-
isUpload: ((
|
|
3020
|
-
fileId: (
|
|
3020
|
+
isUpload: ((_62 = resp.data) === null || _62 === void 0 ? void 0 : _62.fileId) !== '',
|
|
3021
|
+
fileId: (_63 = resp.data) === null || _63 === void 0 ? void 0 : _63.fileId,
|
|
3021
3022
|
};
|
|
3022
3023
|
localStorage.setItem('telin.campaign', JSON.stringify(__assign(__assign({}, _this.getCampaignStorage), {
|
|
3023
3024
|
generalInformation: {
|
|
3024
|
-
id: (
|
|
3025
|
+
id: (_64 = resp.data) === null || _64 === void 0 ? void 0 : _64.id,
|
|
3025
3026
|
form: generalInformation,
|
|
3026
3027
|
},
|
|
3027
|
-
failover: (
|
|
3028
|
-
targetAudience: (
|
|
3028
|
+
failover: (_65 = resp.data) === null || _65 === void 0 ? void 0 : _65.failover,
|
|
3029
|
+
targetAudience: (_66 = resp.data) === null || _66 === void 0 ? void 0 : _66.targets,
|
|
3029
3030
|
targetAudienceFile: {
|
|
3030
|
-
name: (
|
|
3031
|
-
targetURL: (
|
|
3031
|
+
name: (_67 = resp.data) === null || _67 === void 0 ? void 0 : _67.fileName,
|
|
3032
|
+
targetURL: (_68 = resp.data) === null || _68 === void 0 ? void 0 : _68.targetURL,
|
|
3032
3033
|
},
|
|
3033
3034
|
scheduler: {
|
|
3034
|
-
schedulerType: ((
|
|
3035
|
+
schedulerType: ((_69 = resp.data) === null || _69 === void 0 ? void 0 : _69.scheduleType) === 'MULTI'
|
|
3035
3036
|
? 'ONE_TIME'
|
|
3036
|
-
: (
|
|
3037
|
-
startDate: (
|
|
3038
|
-
startTime: (
|
|
3039
|
-
isRepeat: ((
|
|
3040
|
-
delivery: (
|
|
3037
|
+
: (_70 = resp.data) === null || _70 === void 0 ? void 0 : _70.scheduleType,
|
|
3038
|
+
startDate: (_72 = (_71 = resp.data) === null || _71 === void 0 ? void 0 : _71.startTime) === null || _72 === void 0 ? void 0 : _72.split(' ')[0],
|
|
3039
|
+
startTime: (_74 = (_73 = resp.data) === null || _73 === void 0 ? void 0 : _73.startTime) === null || _74 === void 0 ? void 0 : _74.split(' ')[1],
|
|
3040
|
+
isRepeat: ((_75 = resp.data) === null || _75 === void 0 ? void 0 : _75.scheduleType) === 'MULTI',
|
|
3041
|
+
delivery: (_76 = resp.data) === null || _76 === void 0 ? void 0 : _76.repeat,
|
|
3041
3042
|
},
|
|
3042
3043
|
})));
|
|
3043
|
-
_this.isLine = ((
|
|
3044
|
+
_this.isLine = ((_77 = resp.data) === null || _77 === void 0 ? void 0 : _77.platform) === 'LINE';
|
|
3044
3045
|
_this.isLoading = false;
|
|
3045
3046
|
_this.initWizard();
|
|
3046
3047
|
}, function () {
|
|
@@ -4374,6 +4375,7 @@
|
|
|
4374
4375
|
configurable: true
|
|
4375
4376
|
});
|
|
4376
4377
|
GeneralInformationWAComponent.prototype.ngOnInit = function () {
|
|
4378
|
+
var _this = this;
|
|
4377
4379
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4378
4380
|
this.msgTypeWAOption = MsgTypeWAOptionConst;
|
|
4379
4381
|
this.mediaTypeOption = MediaTypeOptionConst;
|
|
@@ -4392,7 +4394,14 @@
|
|
|
4392
4394
|
this.initValidation();
|
|
4393
4395
|
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'
|
|
4394
4396
|
? (_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 : '');
|
|
4395
|
-
|
|
4397
|
+
// Listen text to changes in the form
|
|
4398
|
+
var textControlForSync = this.getControl('text');
|
|
4399
|
+
if (textControlForSync) {
|
|
4400
|
+
var textSubs = textControlForSync.valueChanges.subscribe(function (value) {
|
|
4401
|
+
_this.syncVariablesFromText(value);
|
|
4402
|
+
});
|
|
4403
|
+
this.subscribers.push(textSubs);
|
|
4404
|
+
}
|
|
4396
4405
|
};
|
|
4397
4406
|
Object.defineProperty(GeneralInformationWAComponent.prototype, "getCampaignStorage", {
|
|
4398
4407
|
get: function () {
|
|
@@ -5229,16 +5238,43 @@
|
|
|
5229
5238
|
enumerable: true,
|
|
5230
5239
|
configurable: true
|
|
5231
5240
|
});
|
|
5232
|
-
GeneralInformationWAComponent.prototype.
|
|
5233
|
-
var
|
|
5234
|
-
|
|
5241
|
+
GeneralInformationWAComponent.prototype.syncVariablesFromText = function (text) {
|
|
5242
|
+
var _a;
|
|
5243
|
+
if (text === null || text === undefined)
|
|
5244
|
+
return;
|
|
5245
|
+
var counter = 1;
|
|
5246
|
+
var normalizedText = text.replace(/\{\{\s*\d+\s*\}\}/g, function () {
|
|
5247
|
+
var replacement = "{{" + counter + "}}";
|
|
5248
|
+
counter++;
|
|
5249
|
+
return replacement;
|
|
5235
5250
|
});
|
|
5236
|
-
|
|
5251
|
+
var targetVariableCount = counter - 1;
|
|
5252
|
+
if (text !== normalizedText) {
|
|
5253
|
+
(_a = this.getControl('text')) === null || _a === void 0 ? void 0 : _a.setValue(normalizedText, { emitEvent: false });
|
|
5254
|
+
}
|
|
5255
|
+
var currentCount = this.variables.length;
|
|
5256
|
+
if (targetVariableCount > currentCount) {
|
|
5257
|
+
var diff = targetVariableCount - currentCount;
|
|
5258
|
+
for (var i = 0; i < diff; i++) {
|
|
5259
|
+
this.variables.push(new forms.FormGroup({
|
|
5260
|
+
paramName: new forms.FormControl({ value: '', disabled: this.isReadOnlyMode }, forms.Validators.required),
|
|
5261
|
+
}));
|
|
5262
|
+
}
|
|
5263
|
+
}
|
|
5264
|
+
else if (targetVariableCount < currentCount) {
|
|
5265
|
+
var diff = currentCount - targetVariableCount;
|
|
5266
|
+
for (var i = 0; i < diff; i++) {
|
|
5267
|
+
this.variables.removeAt(this.variables.length - 1);
|
|
5268
|
+
}
|
|
5269
|
+
}
|
|
5270
|
+
};
|
|
5271
|
+
GeneralInformationWAComponent.prototype.addVariable = function () {
|
|
5237
5272
|
var textControl = this.getControl('text');
|
|
5238
5273
|
if (textControl) {
|
|
5239
5274
|
var currentBody = textControl.value || '';
|
|
5240
|
-
var
|
|
5241
|
-
|
|
5275
|
+
var nextSequence = this.variables.length + 1;
|
|
5276
|
+
var newSequence = "{{" + nextSequence + "}}";
|
|
5277
|
+
textControl.setValue("" + currentBody + newSequence);
|
|
5242
5278
|
}
|
|
5243
5279
|
};
|
|
5244
5280
|
GeneralInformationWAComponent.prototype.removeVariable = function (index) {
|
|
@@ -6164,11 +6200,9 @@
|
|
|
6164
6200
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
6165
6201
|
var genInfoForm = (_b = (_a = this.getCampaignStorage) === null || _a === void 0 ? void 0 : _a.generalInformation) === null || _b === void 0 ? void 0 : _b.form;
|
|
6166
6202
|
var isNeedSave = (_c = genInfoForm) === null || _c === void 0 ? void 0 : _c.isNeedSave;
|
|
6167
|
-
// 1. Parameter Wajib (Selalu dikirim di semua skenario)
|
|
6168
6203
|
var parameterList = [
|
|
6169
6204
|
this.initParam('platform', ((_e = (_d = genInfoForm) === null || _d === void 0 ? void 0 : _d.template) === null || _e === void 0 ? void 0 : _e.platform) || 'WA', 'string'),
|
|
6170
|
-
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 : '')),
|
|
6171
|
-
'string'),
|
|
6205
|
+
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'),
|
|
6172
6206
|
];
|
|
6173
6207
|
if (isNeedSave) {
|
|
6174
6208
|
// SKENARIO 1: USE EXISTING / TEMPLATE SUDAH DISAVE
|
|
@@ -6176,7 +6210,6 @@
|
|
|
6176
6210
|
}
|
|
6177
6211
|
else {
|
|
6178
6212
|
// SKENARIO 2: CREATE NEW / DIRECT SEND (Belum di-save)
|
|
6179
|
-
// Cek aman: Kirim templateName & Lang HANYA kalau ada (biar nggak undefined)
|
|
6180
6213
|
if ((_o = (_m = genInfoForm) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.name) {
|
|
6181
6214
|
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'));
|
|
6182
6215
|
}
|