@bprotsyk/aso-core 2.1.188 → 2.1.189

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.
@@ -0,0 +1,184 @@
1
+ # Campaign Parameters Update Script
2
+
3
+ This script updates campaign parameters for all campaigns that belong to groups with 3-4 digit numeric names (e.g., "123", "1234").
4
+
5
+ ## What it does
6
+
7
+ The script will:
8
+
9
+ 1. Fetch all campaign groups from Keitaro
10
+ 2. Filter groups with 3-4 digit numeric names
11
+ 3. Find all campaigns belonging to those groups
12
+ 4. Display all campaigns with their current and new parameters
13
+ 5. Ask for ONE confirmation to update all campaigns
14
+ 6. For each campaign:
15
+ - **Update** `sub_id_11`: name="firebase_app_instance_id", alias="Firebase App Instance ID", placeholder="{firebase_app_instance_id}"
16
+ - **Update** `sub_id_12`: name="firebase_user_id", alias="Firebase User ID", placeholder="{firebase_user_id}"
17
+ - **Update** `sub_id_13`: name="firebase_device_language_code", alias="Firebase Device Language Code", placeholder="{firebase_device_language_code}"
18
+ - **Update** `sub_id_14`: name="firebase_push_token", alias="Firebase Push Token", placeholder="{firebase_push_token}"
19
+ - **Remove** `sub_id_15` (set to empty)
20
+ - **Update** `sub_id_17`: name="advertising_id", alias="Appsflyer Advertising ID", placeholder="{advertising_id}"
21
+ - **Update** `sub_id_18`: name="appsflyer_device_id", alias="Appsflyer Device ID", placeholder="{appsflyer_device_id}"
22
+ - **Update** `sub_id_20`: name="campaign", alias="Naming", placeholder="{campaign}"
23
+ - **Remove all S2S postbacks** (if present)
24
+
25
+ ## Parameter Details
26
+
27
+ Each parameter is updated with the exact values specified:
28
+
29
+ ```typescript
30
+ sub_id_11: {
31
+ name: "firebase_app_instance_id",
32
+ placeholder: "{firebase_app_instance_id}",
33
+ alias: "Firebase App Instance ID"
34
+ }
35
+
36
+ sub_id_12: {
37
+ name: "firebase_user_id",
38
+ placeholder: "{firebase_user_id}",
39
+ alias: "Firebase User ID"
40
+ }
41
+
42
+ sub_id_13: {
43
+ name: "firebase_device_language_code",
44
+ placeholder: "{firebase_device_language_code}",
45
+ alias: "Firebase Device Language Code"
46
+ }
47
+
48
+ sub_id_14: {
49
+ name: "firebase_push_token",
50
+ placeholder: "{firebase_push_token}",
51
+ alias: "Firebase Push Token"
52
+ }
53
+
54
+ sub_id_15: {
55
+ name: "",
56
+ placeholder: "",
57
+ alias: ""
58
+ } // REMOVED
59
+
60
+ sub_id_17: {
61
+ name: "advertising_id",
62
+ placeholder: "{advertising_id}",
63
+ alias: "Appsflyer Advertising ID"
64
+ }
65
+
66
+ sub_id_18: {
67
+ name: "appsflyer_device_id",
68
+ placeholder: "{appsflyer_device_id}",
69
+ alias: "Appsflyer Device ID"
70
+ }
71
+
72
+ sub_id_20: {
73
+ name: "campaign",
74
+ placeholder: "{campaign}",
75
+ alias: "Naming"
76
+ }
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ ```bash
82
+ cd core
83
+ npx ts-node update-campaign-params.ts
84
+ ```
85
+
86
+ ## Interactive Mode
87
+
88
+ The script runs in interactive mode by default. It will display ALL campaigns at once, then ask for one confirmation:
89
+
90
+ ```
91
+ ====================================================================================================
92
+ CAMPAIGNS TO BE UPDATED:
93
+ ====================================================================================================
94
+
95
+ Campaign ID: 1234 | Group: [123]
96
+ Name: [123] MyApp [com.example.app] [Android] domain.com
97
+ Has S2S Postbacks: YES (will be removed)
98
+
99
+ CURRENT PARAMETERS:
100
+ sub_id_11: name="" placeholder="" alias=""
101
+ sub_id_12: name="" placeholder="" alias=""
102
+ sub_id_13: name="" placeholder="" alias=""
103
+ sub_id_14: name="" placeholder="" alias=""
104
+ sub_id_15: name="old_naming" placeholder="{naming}" alias="Naming"
105
+ sub_id_17: name="old_adid" placeholder="{advertising_id}" alias="..."
106
+ sub_id_18: name="old_devid" placeholder="{appsflyer_device_id}" alias="..."
107
+ sub_id_20: name="" placeholder="" alias=""
108
+
109
+ NEW PARAMETERS:
110
+ sub_id_11: name="firebase_app_instance_id" placeholder="{firebase_app_instance_id}" alias="Firebase App Instance ID"
111
+ sub_id_12: name="firebase_user_id" placeholder="{firebase_user_id}" alias="Firebase User ID"
112
+ sub_id_13: name="firebase_device_language_code" placeholder="{firebase_device_language_code}" alias="Firebase Device Language Code"
113
+ sub_id_14: name="firebase_push_token" placeholder="{firebase_push_token}" alias="Firebase Push Token"
114
+ sub_id_15: REMOVED (empty)
115
+ sub_id_17: name="advertising_id" placeholder="{advertising_id}" alias="Appsflyer Advertising ID"
116
+ sub_id_18: name="appsflyer_device_id" placeholder="{appsflyer_device_id}" alias="Appsflyer Device ID"
117
+ sub_id_20: name="campaign" placeholder="{campaign}" alias="Naming"
118
+ ----------------------------------------------------------------------------------------------------
119
+
120
+ [... more campaigns ...]
121
+
122
+ ====================================================================================================
123
+ Total campaigns to update: 15
124
+ ====================================================================================================
125
+
126
+ Do you want to update ALL 15 campaigns? (y/n):
127
+ ```
128
+
129
+ ### Response Options:
130
+ - `y` or `yes` - Update all campaigns
131
+ - `n` or `no` - Cancel the operation
132
+
133
+ ## Programmatic Usage
134
+
135
+ You can also use the function directly in your code:
136
+
137
+ ```typescript
138
+ import { TraffleKeitaroService } from './src/network/keitaro/traffle/traffle-keitaro-service';
139
+
140
+ // With confirmation (interactive)
141
+ const result = await TraffleKeitaroService.updateCampaignParametersForNumericGroups(true);
142
+
143
+ // Without confirmation (automatic - use with caution!)
144
+ const result = await TraffleKeitaroService.updateCampaignParametersForNumericGroups(false);
145
+
146
+ console.log(result);
147
+ // { updated: 5, failed: 0, skipped: 2 }
148
+ ```
149
+
150
+ ## Safety Features
151
+
152
+ 1. **Group Validation**: Only processes campaigns in groups with 3-4 digit numeric names
153
+ 2. **Confirmation Required**: By default, asks for ONE confirmation before updating all campaigns
154
+ 3. **Detailed Preview**: Shows ALL campaigns with current and new parameters before asking for confirmation
155
+ 4. **Postback Removal**: Safely removes S2S postbacks for all updated campaigns
156
+ 5. **Error Handling**: Continues processing even if individual campaigns fail
157
+ 6. **Summary Report**: Provides detailed statistics at the end
158
+
159
+ ## Return Value
160
+
161
+ The function returns an object with statistics:
162
+
163
+ ```typescript
164
+ {
165
+ updated: number, // Successfully updated campaigns
166
+ failed: number, // Campaigns that failed to update
167
+ skipped: number // All campaigns skipped if user cancels (0 if user confirms)
168
+ }
169
+ ```
170
+
171
+ ## Requirements
172
+
173
+ - Node.js environment with TypeScript support
174
+ - Access to Keitaro API (configured in `traffle-keitaro-service.ts`)
175
+ - Proper authentication credentials
176
+
177
+ ## Notes
178
+
179
+ - Parameters are set to exact values as specified (not randomly generated)
180
+ - Only campaigns in groups with names matching `/^\d{3,4}$/` (3-4 digits) are processed
181
+ - All S2S postbacks will be removed from updated campaigns
182
+ - The script shows all campaigns at once and requires ONE confirmation to proceed
183
+ - The script is safe to run multiple times - you can review all campaigns before confirming
184
+
@@ -26,6 +26,7 @@ export interface IKeitaroCampaign {
26
26
  source?: string;
27
27
  bind_visitors?: string;
28
28
  group?: string;
29
+ postbacks?: any[];
29
30
  }
30
31
  export interface IKeitaroCampaignParameters {
31
32
  [key: string]: IKeitaroCampaignParameter;
@@ -1,2 +1,3 @@
1
- declare const _default: import("axios").AxiosInstance;
2
- export default _default;
1
+ declare const keitaroApi: import("axios").AxiosInstance;
2
+ export declare const keitaroGroupsApi: import("axios").AxiosInstance;
3
+ export default keitaroApi;
@@ -3,11 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.keitaroGroupsApi = void 0;
6
7
  const axios_1 = __importDefault(require("axios"));
7
- exports.default = axios_1.default.create({
8
+ // API key for groups operations
9
+ const GROUPS_API_KEY = '778a14c0730abe2629e88101cb88d573';
10
+ // API key for all other operations
11
+ const DEFAULT_API_KEY = 'd589bd5356d5726539c32c2e523f1518';
12
+ // Default instance for most operations
13
+ const keitaroApi = axios_1.default.create({
8
14
  baseURL: 'https://traffle-tech.com/admin_api/v1/',
9
15
  headers: {
10
- // "Api-Key": `3e80a8fcf1ceb01a761457d017e43a0a`,
11
- "Api-Key": `778a14c0730abe2629e88101cb88d573`,
16
+ "Api-Key": DEFAULT_API_KEY,
12
17
  },
13
18
  });
19
+ // Separate instance for groups operations
20
+ exports.keitaroGroupsApi = axios_1.default.create({
21
+ baseURL: 'https://traffle-tech.com/admin_api/v1/',
22
+ headers: {
23
+ "Api-Key": GROUPS_API_KEY,
24
+ },
25
+ });
26
+ exports.default = keitaroApi;
@@ -105,6 +105,26 @@ declare function TrafleKeitaroParameters(parameters: any): Promise<{
105
105
  placeholder: string;
106
106
  alias: string;
107
107
  };
108
+ sub_id_11: {
109
+ name: string;
110
+ placeholder: string;
111
+ alias: string;
112
+ };
113
+ sub_id_12: {
114
+ name: string;
115
+ placeholder: string;
116
+ alias: string;
117
+ };
118
+ sub_id_13: {
119
+ name: string;
120
+ placeholder: string;
121
+ alias: string;
122
+ };
123
+ sub_id_14: {
124
+ name: string;
125
+ placeholder: string;
126
+ alias: string;
127
+ };
108
128
  sub_id_15: {
109
129
  name: string;
110
130
  placeholder: string;
@@ -130,14 +150,24 @@ declare function TrafleKeitaroParameters(parameters: any): Promise<{
130
150
  placeholder: any;
131
151
  alias: string;
132
152
  };
153
+ sub_id_20: {
154
+ name: string;
155
+ placeholder: string;
156
+ alias: string;
157
+ };
133
158
  };
134
- } | null>;
159
+ }>;
135
160
  declare function cloneTraffleCampaign(app: IApp, platform: EPlatform, addDefaultStreams?: boolean): Promise<IKeitaroCampaign | any>;
136
161
  export declare function updateStreamsForApp(app: IApp, platform: EPlatform): Promise<boolean>;
137
162
  export declare function updateCampaignNamesToNewPattern(requireConfirmation?: boolean): Promise<{
138
163
  updated: number;
139
164
  failed: number;
140
165
  }>;
166
+ export declare function updateCampaignParametersForNumericGroups(requireConfirmation?: boolean): Promise<{
167
+ updated: number;
168
+ failed: number;
169
+ skipped: number;
170
+ }>;
141
171
  export declare const TraffleKeitaroService: {
142
172
  addOffersToTraffleKeitaro: typeof addOffersToTraffleKeitaro;
143
173
  getTraffleOffersGroups: typeof getTraffleOffersGroups;
@@ -151,5 +181,6 @@ export declare const TraffleKeitaroService: {
151
181
  TrafleKeitaroParameters: typeof TrafleKeitaroParameters;
152
182
  updateStreamsForApp: typeof updateStreamsForApp;
153
183
  updateCampaignNamesToNewPattern: typeof updateCampaignNamesToNewPattern;
184
+ updateCampaignParametersForNumericGroups: typeof updateCampaignParametersForNumericGroups;
154
185
  };
155
186
  export {};