@bprotsyk/aso-core 2.1.82 → 2.1.84
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.
|
@@ -23,7 +23,7 @@ declare function createCampaign(campaignData: Partial<IKeitaroCampaign>): Promis
|
|
|
23
23
|
declare function getCampaignById(id: number): Promise<IKeitaroCampaign>;
|
|
24
24
|
export declare function upsertStreamToCampaign(campaign: IKeitaroCampaign, stream: Partial<IKeitaroStream>): Promise<void>;
|
|
25
25
|
declare function cloneOWCampaign(app: IApp, platform?: EPlatform): Promise<IKeitaroCampaign | any>;
|
|
26
|
-
declare function cloneDirectCampaign(app: IApp, platform?: EPlatform): Promise<IKeitaroCampaign | any>;
|
|
26
|
+
declare function cloneDirectCampaign(app: IApp, platform?: EPlatform, addDefaultStreams?: boolean): Promise<IKeitaroCampaign | any>;
|
|
27
27
|
declare function cloneDCampaign(app: IApp): Promise<IKeitaroCampaign>;
|
|
28
28
|
declare function changeCampaignsGroup(fromId: number, toId: number, exceptForCampaignIds: number[], onlyForCampaignIds?: number[]): Promise<void>;
|
|
29
29
|
declare function getDomains(onlyActive?: boolean): Promise<IKeitaroDomain[]>;
|
|
@@ -276,7 +276,7 @@ async function cloneOWCampaign(app, platform) {
|
|
|
276
276
|
const updatedCampaign = await getCampaignById(newCampaign.id);
|
|
277
277
|
return updatedCampaign;
|
|
278
278
|
}
|
|
279
|
-
async function cloneDirectCampaign(app, platform) {
|
|
279
|
+
async function cloneDirectCampaign(app, platform, addDefaultStreams) {
|
|
280
280
|
let name = `#${app.id} [➥]`;
|
|
281
281
|
let platformName = platform ? (0, app_1.getPlatformName)(platform) : null;
|
|
282
282
|
const platformCampaignName = `#${app.id} [➥] (${platformName})`;
|
|
@@ -290,25 +290,29 @@ async function cloneDirectCampaign(app, platform) {
|
|
|
290
290
|
// Для конкретної платформи
|
|
291
291
|
const platformName = (0, app_1.getPlatformName)(platform);
|
|
292
292
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
293
|
-
//
|
|
294
|
-
const
|
|
295
|
-
|
|
293
|
+
// Точна перевірка ID з межами слів
|
|
294
|
+
const idPattern = new RegExp(`#${app.id}\\b`);
|
|
295
|
+
const hasId = idPattern.test(c.name);
|
|
296
|
+
// Перевіряємо наявність стрілки (може бути в комбінації з іншими символами)
|
|
296
297
|
const hasArrow = c.name.includes('➥');
|
|
297
|
-
// Перевіряємо наявність платформи в дужках
|
|
298
|
-
const
|
|
298
|
+
// Перевіряємо наявність платформи в дужках в кінці назви
|
|
299
|
+
const platformPattern = new RegExp(`\\(.*${platformName}.*\\)\\s*$`);
|
|
300
|
+
const hasPlatform = platformPattern.test(c.name);
|
|
299
301
|
return hasId && hasArrow && hasPlatform;
|
|
300
302
|
});
|
|
301
303
|
}
|
|
302
304
|
else {
|
|
303
305
|
// Для General платформи
|
|
304
306
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
305
|
-
//
|
|
306
|
-
const
|
|
307
|
-
|
|
307
|
+
// Точна перевірка ID з межами слів
|
|
308
|
+
const idPattern = new RegExp(`#${app.id}\\b`);
|
|
309
|
+
const hasId = idPattern.test(c.name);
|
|
310
|
+
// Перевіряємо наявність стрілки (може бути в комбінації з іншими символами)
|
|
308
311
|
const hasArrow = c.name.includes('➥');
|
|
309
|
-
// Перевіряємо відсутність
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
// Перевіряємо відсутність платформи в дужках в кінці
|
|
313
|
+
// Дозволяємо будь-які інші дужки (як для гео або опису)
|
|
314
|
+
const noPlatformAtEnd = !/\(.*(?:iOS|Android|Desktop|Mobile).*\)\s*$/.test(c.name);
|
|
315
|
+
return hasId && hasArrow && noPlatformAtEnd;
|
|
312
316
|
});
|
|
313
317
|
}
|
|
314
318
|
if (matchingCampaign.length > 0)
|
|
@@ -346,7 +350,9 @@ async function cloneDirectCampaign(app, platform) {
|
|
|
346
350
|
uniqueness_type: originalCampaign.uniqueness_type,
|
|
347
351
|
};
|
|
348
352
|
const newCampaign = await createCampaign(payload);
|
|
349
|
-
|
|
353
|
+
// Додаємо потоки: всі якщо addDefaultStreams === true, інакше тільки перший
|
|
354
|
+
const streamsToAdd = addDefaultStreams ? originalStreams : originalStreams.slice(0, 1);
|
|
355
|
+
for (const stream of streamsToAdd) {
|
|
350
356
|
await http_1.default.post('streams', {
|
|
351
357
|
name: stream.name,
|
|
352
358
|
campaign_id: newCampaign.id,
|
package/package.json
CHANGED
|
@@ -341,7 +341,7 @@ async function cloneOWCampaign(app: IApp, platform?: EPlatform): Promise<IKeitar
|
|
|
341
341
|
return updatedCampaign;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
async function cloneDirectCampaign(app: IApp, platform?: EPlatform): Promise<IKeitaroCampaign | any> {
|
|
344
|
+
async function cloneDirectCampaign(app: IApp, platform?: EPlatform, addDefaultStreams?: boolean): Promise<IKeitaroCampaign | any> {
|
|
345
345
|
let name = `#${app.id} [➥]`
|
|
346
346
|
let platformName = platform ? getPlatformName(platform) : null;
|
|
347
347
|
const platformCampaignName = `#${app.id} [➥] (${platformName})`;
|
|
@@ -360,24 +360,28 @@ async function cloneDirectCampaign(app: IApp, platform?: EPlatform): Promise<IKe
|
|
|
360
360
|
// Для конкретної платформи
|
|
361
361
|
const platformName = getPlatformName(platform);
|
|
362
362
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
363
|
-
//
|
|
364
|
-
const
|
|
365
|
-
|
|
363
|
+
// Точна перевірка ID з межами слів
|
|
364
|
+
const idPattern = new RegExp(`#${app.id}\\b`);
|
|
365
|
+
const hasId = idPattern.test(c.name);
|
|
366
|
+
// Перевіряємо наявність стрілки (може бути в комбінації з іншими символами)
|
|
366
367
|
const hasArrow = c.name.includes('➥');
|
|
367
|
-
// Перевіряємо наявність платформи в дужках
|
|
368
|
-
const
|
|
368
|
+
// Перевіряємо наявність платформи в дужках в кінці назви
|
|
369
|
+
const platformPattern = new RegExp(`\\(.*${platformName}.*\\)\\s*$`);
|
|
370
|
+
const hasPlatform = platformPattern.test(c.name);
|
|
369
371
|
return hasId && hasArrow && hasPlatform;
|
|
370
372
|
});
|
|
371
373
|
} else {
|
|
372
374
|
// Для General платформи
|
|
373
375
|
matchingCampaign = allCampaigns.filter((c) => {
|
|
374
|
-
//
|
|
375
|
-
const
|
|
376
|
-
|
|
376
|
+
// Точна перевірка ID з межами слів
|
|
377
|
+
const idPattern = new RegExp(`#${app.id}\\b`);
|
|
378
|
+
const hasId = idPattern.test(c.name);
|
|
379
|
+
// Перевіряємо наявність стрілки (може бути в комбінації з іншими символами)
|
|
377
380
|
const hasArrow = c.name.includes('➥');
|
|
378
|
-
// Перевіряємо відсутність
|
|
379
|
-
|
|
380
|
-
|
|
381
|
+
// Перевіряємо відсутність платформи в дужках в кінці
|
|
382
|
+
// Дозволяємо будь-які інші дужки (як для гео або опису)
|
|
383
|
+
const noPlatformAtEnd = !/\(.*(?:iOS|Android|Desktop|Mobile).*\)\s*$/.test(c.name);
|
|
384
|
+
return hasId && hasArrow && noPlatformAtEnd;
|
|
381
385
|
});
|
|
382
386
|
}
|
|
383
387
|
|
|
@@ -422,7 +426,10 @@ async function cloneDirectCampaign(app: IApp, platform?: EPlatform): Promise<IKe
|
|
|
422
426
|
|
|
423
427
|
const newCampaign: IKeitaroCampaign = await createCampaign(payload);
|
|
424
428
|
|
|
425
|
-
|
|
429
|
+
// Додаємо потоки: всі якщо addDefaultStreams === true, інакше тільки перший
|
|
430
|
+
const streamsToAdd = addDefaultStreams ? originalStreams : originalStreams.slice(0, 1);
|
|
431
|
+
|
|
432
|
+
for (const stream of streamsToAdd) {
|
|
426
433
|
await keitaroApi.post('streams', {
|
|
427
434
|
name: stream.name,
|
|
428
435
|
campaign_id: newCampaign.id,
|