@bprotsyk/aso-core 2.1.186 → 2.1.188

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/lib/app/app.d.ts CHANGED
@@ -20,6 +20,7 @@ export interface IApp extends Document {
20
20
  appmetricaAppId?: number;
21
21
  keitaroData: IAppKeitaroData | null;
22
22
  bannerParams?: IBannerParams;
23
+ offersStubParams?: IOffersStubParams;
23
24
  domainParams: IDomainParams;
24
25
  platforms: {
25
26
  [key: string]: IPlatformParams;
@@ -92,6 +93,10 @@ export interface IBannerParams {
92
93
  linkParam: string;
93
94
  showStubOnError?: boolean;
94
95
  }
96
+ export interface IOffersStubParams {
97
+ offersPath: string;
98
+ imagesPath: string;
99
+ }
95
100
  export declare enum AppStatus {
96
101
  ARCHIVED = "ARCHIVED",
97
102
  IN_DEVELOPMENT = "IN_DEVELOPMENT",
@@ -190,6 +195,7 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
190
195
  removeDataParams?: any;
191
196
  privacyPolicyParams?: any;
192
197
  bannerParams?: any;
198
+ offersStubParams?: any;
193
199
  platforms?: any;
194
200
  onesignalAppId?: string | null | undefined;
195
201
  onesignalRestApiKey?: string | null | undefined;
@@ -241,6 +247,7 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
241
247
  removeDataParams?: any;
242
248
  privacyPolicyParams?: any;
243
249
  bannerParams?: any;
250
+ offersStubParams?: any;
244
251
  platforms?: any;
245
252
  onesignalAppId?: string | null | undefined;
246
253
  onesignalRestApiKey?: string | null | undefined;
@@ -292,6 +299,7 @@ export declare const AppSchema: mongoose.Schema<any, mongoose.Model<any, any, an
292
299
  removeDataParams?: any;
293
300
  privacyPolicyParams?: any;
294
301
  bannerParams?: any;
302
+ offersStubParams?: any;
295
303
  platforms?: any;
296
304
  onesignalAppId?: string | null | undefined;
297
305
  onesignalRestApiKey?: string | null | undefined;
package/lib/app/app.js CHANGED
@@ -157,6 +157,7 @@ exports.AppSchema = new mongoose_1.Schema({
157
157
  },
158
158
  privacyPolicyParams: Object,
159
159
  bannerParams: Object,
160
+ offersStubParams: Object,
160
161
  domainParams: {
161
162
  name: {
162
163
  type: String,
@@ -291,23 +291,25 @@ async function checkAndUpdateCampaignParameters(existingCampaign, app, platform)
291
291
  }
292
292
  console.log("Parameters are up to date, no update needed");
293
293
  // Always add postback even if no parameter update is needed
294
- try {
295
- console.log(`[Traffle] Adding postback to campaign ${existingCampaign.id} (no parameter update needed)`);
296
- const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`;
297
- await http_1.default.put(`/campaigns/${existingCampaign.id}`, {
298
- postbacks: [{
299
- id: 0,
300
- campaign_id: existingCampaign.id,
301
- method: "GET",
302
- statuses: ["lead", "sale", "rejected", "rebill"],
303
- url: postbackUrl
304
- }]
305
- });
306
- console.log(`[Traffle] Postback added to campaign ${existingCampaign.id}`);
307
- }
308
- catch (error) {
309
- console.error(`[Traffle] Failed to add postback to campaign ${existingCampaign.id}:`, error);
310
- }
294
+ // COMMENTED OUT: Automatic S2S postback addition
295
+ // try {
296
+ // console.log(`[Traffle] Adding postback to campaign ${existingCampaign.id} (no parameter update needed)`);
297
+ // const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`;
298
+ //
299
+ // await keitaroApi.put(`/campaigns/${existingCampaign.id}`, {
300
+ // postbacks: [{
301
+ // id: 0,
302
+ // campaign_id: existingCampaign.id,
303
+ // method: "GET",
304
+ // statuses: ["lead", "sale", "rejected", "rebill"],
305
+ // url: postbackUrl
306
+ // }]
307
+ // });
308
+ //
309
+ // console.log(`[Traffle] Postback added to campaign ${existingCampaign.id}`);
310
+ // } catch (error) {
311
+ // console.error(`[Traffle] Failed to add postback to campaign ${existingCampaign.id}:`, error);
312
+ // }
311
313
  return false;
312
314
  }
313
315
  return false;
@@ -1039,43 +1041,50 @@ async function updateCampaignNamesToNewPattern(requireConfirmation = false) {
1039
1041
  }
1040
1042
  }
1041
1043
  exports.updateCampaignNamesToNewPattern = updateCampaignNamesToNewPattern;
1042
- async function ensurePostbacksForCampaign(campaignId, appId, bundle) {
1043
- try {
1044
- console.log(`[Traffle] Starting ensurePostbacksForCampaign for campaign ${campaignId}, app ${appId}, bundle ${bundle}`);
1045
- const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`;
1046
- // Check if postback already exists
1047
- console.log(`[Traffle] Getting existing postbacks for campaign ${campaignId}`);
1048
- const existingPostbacks = await getCampaignPostbacks(campaignId);
1049
- console.log(`[Traffle] Existing postbacks:`, existingPostbacks);
1050
- const postbackExists = existingPostbacks?.some(postback => postback.url === postbackUrl &&
1051
- postback.method === "GET" &&
1052
- postback.statuses?.includes("lead"));
1053
- if (postbackExists) {
1054
- console.log(`[Traffle] AppsFlyer postback already exists for Traffle campaign ${campaignId}, skipping`);
1055
- return;
1056
- }
1057
- const postbackData = {
1058
- id: 0,
1059
- campaign_id: campaignId,
1060
- method: "GET",
1061
- statuses: ["lead", "sale", "rejected", "rebill"],
1062
- url: postbackUrl
1063
- };
1064
- console.log(`[Traffle] Adding AppsFlyer postback to Traffle campaign ${campaignId}:`, postbackData);
1065
- // Use Traffle API to add postback via campaign update
1066
- console.log(`[Traffle] Making PUT request to /campaigns/${campaignId} with postbacks:`, [postbackData]);
1067
- const response = await http_1.default.put(`/campaigns/${campaignId}`, {
1068
- postbacks: [postbackData]
1069
- });
1070
- console.log(`[Traffle] Postback creation response:`, response.status, response.data?.postbacks);
1071
- if (response.status === 200) {
1072
- console.log(`[Traffle] Successfully added AppsFlyer postback to Traffle campaign ${campaignId}`);
1073
- }
1074
- }
1075
- catch (error) {
1076
- console.error(`Failed to add AppsFlyer postback to Traffle campaign ${campaignId}:`, error);
1077
- }
1078
- }
1044
+ // COMMENTED OUT: Automatic S2S postback addition function
1045
+ // async function ensurePostbacksForCampaign(campaignId: number, appId: number, bundle: string): Promise<void> {
1046
+ // try {
1047
+ // console.log(`[Traffle] Starting ensurePostbacksForCampaign for campaign ${campaignId}, app ${appId}, bundle ${bundle}`)
1048
+ //
1049
+ // const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`
1050
+ //
1051
+ // // Check if postback already exists
1052
+ // console.log(`[Traffle] Getting existing postbacks for campaign ${campaignId}`)
1053
+ // const existingPostbacks = await getCampaignPostbacks(campaignId)
1054
+ // console.log(`[Traffle] Existing postbacks:`, existingPostbacks)
1055
+ //
1056
+ // const postbackExists = existingPostbacks?.some(postback =>
1057
+ // postback.url === postbackUrl &&
1058
+ // postback.method === "GET" &&
1059
+ // postback.statuses?.includes("lead")
1060
+ // )
1061
+ // if (postbackExists) {
1062
+ // console.log(`[Traffle] AppsFlyer postback already exists for Traffle campaign ${campaignId}, skipping`)
1063
+ // return
1064
+ // }
1065
+ //
1066
+ // const postbackData = {
1067
+ // id: 0, // Will be set by Traffle
1068
+ // campaign_id: campaignId,
1069
+ // method: "GET",
1070
+ // statuses: ["lead", "sale", "rejected", "rebill"],
1071
+ // url: postbackUrl
1072
+ // }
1073
+ // console.log(`[Traffle] Adding AppsFlyer postback to Traffle campaign ${campaignId}:`, postbackData)
1074
+ // // Use Traffle API to add postback via campaign update
1075
+ // console.log(`[Traffle] Making PUT request to /campaigns/${campaignId} with postbacks:`, [postbackData])
1076
+ //
1077
+ // const response = await keitaroApi.put(`/campaigns/${campaignId}`, {
1078
+ // postbacks: [postbackData]
1079
+ // })
1080
+ // console.log(`[Traffle] Postback creation response:`, response.status, response.data?.postbacks)
1081
+ // if (response.status === 200) {
1082
+ // console.log(`[Traffle] Successfully added AppsFlyer postback to Traffle campaign ${campaignId}`)
1083
+ // }
1084
+ // } catch (error) {
1085
+ // console.error(`Failed to add AppsFlyer postback to Traffle campaign ${campaignId}:`, error)
1086
+ // }
1087
+ // }
1079
1088
  async function getCampaignPostbacks(campaignId) {
1080
1089
  try {
1081
1090
  console.log(`[Traffle] Getting postbacks for campaign ${campaignId}`);
@@ -1,4 +1,4 @@
1
- import { AppStatus, IAppKeitaroData, IBannerParams, IDomainParams, IPlatformParams } from "app/app";
1
+ import { AppStatus, ETeam, IAppKeitaroData, IBannerParams, IDomainParams, IOffersStubParams, IPlatformParams } from "app/app";
2
2
  export interface IUpsertAppRequest {
3
3
  id: number;
4
4
  name?: string;
@@ -9,6 +9,7 @@ export interface IUpsertAppRequest {
9
9
  appmetricaAppId?: number;
10
10
  keitaroData?: Partial<IAppKeitaroData>;
11
11
  bannerParams?: IBannerParams;
12
+ offersStubParams?: IOffersStubParams;
12
13
  domainParams: IDomainParams;
13
14
  platforms: {
14
15
  [key: string]: IPlatformParams;
@@ -17,6 +18,7 @@ export interface IUpsertAppRequest {
17
18
  file?: any;
18
19
  status?: AppStatus;
19
20
  policyPath?: string;
21
+ team?: ETeam;
20
22
  }
21
23
  export interface IUpsertAppResponse {
22
24
  data: IUpsertAppRequest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "2.1.186",
3
+ "version": "2.1.188",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
package/src/app/app.ts CHANGED
@@ -29,6 +29,7 @@ export interface IApp extends Document {
29
29
  keitaroData: IAppKeitaroData | null
30
30
 
31
31
  bannerParams?: IBannerParams,
32
+ offersStubParams?: IOffersStubParams,
32
33
  domainParams: IDomainParams
33
34
  platforms: { [key: string]: IPlatformParams },
34
35
 
@@ -132,6 +133,11 @@ export interface IBannerParams {
132
133
  showStubOnError?: boolean,
133
134
  }
134
135
 
136
+ export interface IOffersStubParams {
137
+ offersPath: string,
138
+ imagesPath: string,
139
+ }
140
+
135
141
  export enum AppStatus {
136
142
  ARCHIVED = "ARCHIVED",
137
143
  IN_DEVELOPMENT = "IN_DEVELOPMENT",
@@ -293,6 +299,7 @@ export const AppSchema = new Schema({
293
299
  },
294
300
  privacyPolicyParams: Object,
295
301
  bannerParams: Object,
302
+ offersStubParams: Object,
296
303
  domainParams: {
297
304
  name: {
298
305
  type: String,
@@ -380,24 +380,25 @@ async function checkAndUpdateCampaignParameters(existingCampaign: IKeitaroCampai
380
380
  console.log("Parameters are up to date, no update needed");
381
381
 
382
382
  // Always add postback even if no parameter update is needed
383
- try {
384
- console.log(`[Traffle] Adding postback to campaign ${existingCampaign.id} (no parameter update needed)`);
385
- const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`;
386
-
387
- await keitaroApi.put(`/campaigns/${existingCampaign.id}`, {
388
- postbacks: [{
389
- id: 0,
390
- campaign_id: existingCampaign.id,
391
- method: "GET",
392
- statuses: ["lead", "sale", "rejected", "rebill"],
393
- url: postbackUrl
394
- }]
395
- });
396
-
397
- console.log(`[Traffle] Postback added to campaign ${existingCampaign.id}`);
398
- } catch (error) {
399
- console.error(`[Traffle] Failed to add postback to campaign ${existingCampaign.id}:`, error);
400
- }
383
+ // COMMENTED OUT: Automatic S2S postback addition
384
+ // try {
385
+ // console.log(`[Traffle] Adding postback to campaign ${existingCampaign.id} (no parameter update needed)`);
386
+ // const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`;
387
+ //
388
+ // await keitaroApi.put(`/campaigns/${existingCampaign.id}`, {
389
+ // postbacks: [{
390
+ // id: 0,
391
+ // campaign_id: existingCampaign.id,
392
+ // method: "GET",
393
+ // statuses: ["lead", "sale", "rejected", "rebill"],
394
+ // url: postbackUrl
395
+ // }]
396
+ // });
397
+ //
398
+ // console.log(`[Traffle] Postback added to campaign ${existingCampaign.id}`);
399
+ // } catch (error) {
400
+ // console.error(`[Traffle] Failed to add postback to campaign ${existingCampaign.id}:`, error);
401
+ // }
401
402
 
402
403
  return false;
403
404
  }
@@ -1226,54 +1227,55 @@ export async function updateCampaignNamesToNewPattern(requireConfirmation: boole
1226
1227
  }
1227
1228
  }
1228
1229
 
1229
- async function ensurePostbacksForCampaign(campaignId: number, appId: number, bundle: string): Promise<void> {
1230
- try {
1231
- console.log(`[Traffle] Starting ensurePostbacksForCampaign for campaign ${campaignId}, app ${appId}, bundle ${bundle}`)
1232
-
1233
- const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`
1234
-
1235
- // Check if postback already exists
1236
- console.log(`[Traffle] Getting existing postbacks for campaign ${campaignId}`)
1237
- const existingPostbacks = await getCampaignPostbacks(campaignId)
1238
- console.log(`[Traffle] Existing postbacks:`, existingPostbacks)
1239
-
1240
- const postbackExists = existingPostbacks?.some(postback =>
1241
- postback.url === postbackUrl &&
1242
- postback.method === "GET" &&
1243
- postback.statuses?.includes("lead")
1244
- )
1245
-
1246
- if (postbackExists) {
1247
- console.log(`[Traffle] AppsFlyer postback already exists for Traffle campaign ${campaignId}, skipping`)
1248
- return
1249
- }
1250
-
1251
- const postbackData = {
1252
- id: 0, // Will be set by Traffle
1253
- campaign_id: campaignId,
1254
- method: "GET",
1255
- statuses: ["lead", "sale", "rejected", "rebill"],
1256
- url: postbackUrl
1257
- }
1258
-
1259
- console.log(`[Traffle] Adding AppsFlyer postback to Traffle campaign ${campaignId}:`, postbackData)
1260
-
1261
- // Use Traffle API to add postback via campaign update
1262
- console.log(`[Traffle] Making PUT request to /campaigns/${campaignId} with postbacks:`, [postbackData])
1263
-
1264
- const response = await keitaroApi.put(`/campaigns/${campaignId}`, {
1265
- postbacks: [postbackData]
1266
- })
1267
-
1268
- console.log(`[Traffle] Postback creation response:`, response.status, response.data?.postbacks)
1269
-
1270
- if (response.status === 200) {
1271
- console.log(`[Traffle] Successfully added AppsFlyer postback to Traffle campaign ${campaignId}`)
1272
- }
1273
- } catch (error) {
1274
- console.error(`Failed to add AppsFlyer postback to Traffle campaign ${campaignId}:`, error)
1275
- }
1276
- }
1230
+ // COMMENTED OUT: Automatic S2S postback addition function
1231
+ // async function ensurePostbacksForCampaign(campaignId: number, appId: number, bundle: string): Promise<void> {
1232
+ // try {
1233
+ // console.log(`[Traffle] Starting ensurePostbacksForCampaign for campaign ${campaignId}, app ${appId}, bundle ${bundle}`)
1234
+ //
1235
+ // const postbackUrl = `https://traffle-tech.com/lander/appsflyer-s2s/index.php?status={status}&bundle_id={sub_id_16}&advertising_id={sub_id_17}&appsflyer_device_id={sub_id_18}&appsflyer_dev_key={sub_id_19}`
1236
+ //
1237
+ // // Check if postback already exists
1238
+ // console.log(`[Traffle] Getting existing postbacks for campaign ${campaignId}`)
1239
+ // const existingPostbacks = await getCampaignPostbacks(campaignId)
1240
+ // console.log(`[Traffle] Existing postbacks:`, existingPostbacks)
1241
+ //
1242
+ // const postbackExists = existingPostbacks?.some(postback =>
1243
+ // postback.url === postbackUrl &&
1244
+ // postback.method === "GET" &&
1245
+ // postback.statuses?.includes("lead")
1246
+ // )
1247
+
1248
+ // if (postbackExists) {
1249
+ // console.log(`[Traffle] AppsFlyer postback already exists for Traffle campaign ${campaignId}, skipping`)
1250
+ // return
1251
+ // }
1252
+ //
1253
+ // const postbackData = {
1254
+ // id: 0, // Will be set by Traffle
1255
+ // campaign_id: campaignId,
1256
+ // method: "GET",
1257
+ // statuses: ["lead", "sale", "rejected", "rebill"],
1258
+ // url: postbackUrl
1259
+ // }
1260
+
1261
+ // console.log(`[Traffle] Adding AppsFlyer postback to Traffle campaign ${campaignId}:`, postbackData)
1262
+
1263
+ // // Use Traffle API to add postback via campaign update
1264
+ // console.log(`[Traffle] Making PUT request to /campaigns/${campaignId} with postbacks:`, [postbackData])
1265
+ //
1266
+ // const response = await keitaroApi.put(`/campaigns/${campaignId}`, {
1267
+ // postbacks: [postbackData]
1268
+ // })
1269
+
1270
+ // console.log(`[Traffle] Postback creation response:`, response.status, response.data?.postbacks)
1271
+
1272
+ // if (response.status === 200) {
1273
+ // console.log(`[Traffle] Successfully added AppsFlyer postback to Traffle campaign ${campaignId}`)
1274
+ // }
1275
+ // } catch (error) {
1276
+ // console.error(`Failed to add AppsFlyer postback to Traffle campaign ${campaignId}:`, error)
1277
+ // }
1278
+ // }
1277
1279
 
1278
1280
  async function getCampaignPostbacks(campaignId: number): Promise<any[] | null> {
1279
1281
  try {
@@ -1,4 +1,4 @@
1
- import { AppStatus, IAppKeitaroData, IBannerParams, IDomainParams, IPlatformParams, IPrivacyPolicyParams, IRemoveDataParams } from "app/app"
1
+ import { AppStatus, ETeam, IAppKeitaroData, IBannerParams, IDomainParams, IOffersStubParams, IPlatformParams, IPrivacyPolicyParams, IRemoveDataParams } from "app/app"
2
2
  import { PlugType } from "index"
3
3
 
4
4
  export interface IUpsertAppRequest {
@@ -16,12 +16,14 @@ export interface IUpsertAppRequest {
16
16
 
17
17
  keitaroData?: Partial<IAppKeitaroData>,
18
18
  bannerParams?: IBannerParams,
19
+ offersStubParams?: IOffersStubParams,
19
20
  domainParams: IDomainParams,
20
21
  platforms: { [key: string]: IPlatformParams },
21
22
  ech?: boolean,
22
23
  file?: any
23
24
  status?: AppStatus
24
25
  policyPath?: string
26
+ team?: ETeam
25
27
  }
26
28
 
27
29
  export interface IUpsertAppResponse {