@bprotsyk/aso-core 1.2.116 → 1.2.118

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 @@ export interface IFlashApp extends Document {
23
23
  developerEmail: string;
24
24
  developerOrganization: string;
25
25
  generationOptions: IAppGenerationOptions;
26
- keitaroData: IAppKeitaroData;
26
+ keitaroData: IAppKeitaroData | null;
27
27
  integrationVersion: IntegrationVersion;
28
28
  integrationAlterations: IntegrationAlterations;
29
29
  }
@@ -47,6 +47,7 @@ export interface IAppGenerationOptions {
47
47
  webViewName: string;
48
48
  linkName: string;
49
49
  savedName: string;
50
+ paranoidSeed: number;
50
51
  }
51
52
  export interface IAppKeitaroData {
52
53
  redirectCampaignId: number;
@@ -89,6 +90,7 @@ export declare const FlashAppSchema: mongoose.Schema<any, mongoose.Model<any, an
89
90
  webViewName: string;
90
91
  linkName: string;
91
92
  savedName: string;
93
+ paranoidSeed: number;
92
94
  } | undefined;
93
95
  keitaroData?: {
94
96
  redirectCampaignId: number;
@@ -95,6 +95,11 @@ exports.FlashAppSchema = new mongoose_1.Schema({
95
95
  type: String,
96
96
  required: true
97
97
  },
98
+ paranoidSeed: {
99
+ type: Number,
100
+ unique: true,
101
+ required: true
102
+ },
98
103
  },
99
104
  keitaroData: {
100
105
  redirectCampaignId: {
@@ -126,7 +126,7 @@ let removeGeosFromAllRedirectCampaigns = async (geoToRemove) => {
126
126
  };
127
127
  exports.removeGeosFromAllRedirectCampaigns = removeGeosFromAllRedirectCampaigns;
128
128
  let createOrFindFlashRedirectCampaign = async (app) => {
129
- if (app.keitaroData.redirectCampaignId != 0) {
129
+ if (app.keitaroData && app.keitaroData?.redirectCampaignId != 0) {
130
130
  let campaign = await keitaro_service_1.KeitaroService.getCampaignById(app.keitaroData.redirectCampaignId);
131
131
  return campaign;
132
132
  }
@@ -136,7 +136,8 @@ let createOrFindFlashRedirectCampaign = async (app) => {
136
136
  const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
137
137
  if (matchingCampaigns.length != 0) {
138
138
  let campaign = matchingCampaigns[0];
139
- app.keitaroData.redirectCampaignId = campaign.id;
139
+ if (app.keitaroData)
140
+ app.keitaroData.redirectCampaignId = campaign.id;
140
141
  console.log("Already exists!");
141
142
  // await app.save()
142
143
  return campaign;
@@ -263,12 +264,12 @@ let prepareOWCampaignParameters = (app) => {
263
264
  "alias": ""
264
265
  },
265
266
  sub_id_8: {
266
- "name": app.keitaroData.clickIdParameterName,
267
+ "name": app.keitaroData?.clickIdParameterName || "",
267
268
  "placeholder": "{click_id}",
268
269
  "alias": "click_id"
269
270
  },
270
271
  sub_id_15: {
271
- "name": app.keitaroData.offerIdParameterName,
272
+ "name": app.keitaroData?.offerIdParameterName || "",
272
273
  "placeholder": "{offer_custom_id}",
273
274
  "alias": "offer_custom_id"
274
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.116",
3
+ "version": "1.2.118",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -29,7 +29,7 @@ export interface IFlashApp extends Document {
29
29
  developerEmail: string
30
30
  developerOrganization: string
31
31
  generationOptions: IAppGenerationOptions,
32
- keitaroData: IAppKeitaroData,
32
+ keitaroData: IAppKeitaroData | null,
33
33
  integrationVersion: IntegrationVersion
34
34
  integrationAlterations: IntegrationAlterations
35
35
  }
@@ -56,6 +56,7 @@ export interface IAppGenerationOptions {
56
56
  webViewName: string
57
57
  linkName:string,
58
58
  savedName: string,
59
+ paranoidSeed: number
59
60
  }
60
61
 
61
62
  export interface IAppKeitaroData {
@@ -159,6 +160,11 @@ export const FlashAppSchema = new Schema({
159
160
  type: String,
160
161
  required: true
161
162
  },
163
+ paranoidSeed: {
164
+ type: Number,
165
+ unique: true,
166
+ required: true
167
+ },
162
168
  },
163
169
 
164
170
  keitaroData: {
@@ -137,7 +137,7 @@ export let removeGeosFromAllRedirectCampaigns = async (geoToRemove: string) => {
137
137
  }
138
138
 
139
139
  export let createOrFindFlashRedirectCampaign = async (app: IFlashApp): Promise<IKeitaroCampaign> => {
140
- if (app.keitaroData.redirectCampaignId != 0) {
140
+ if (app.keitaroData && app.keitaroData?.redirectCampaignId != 0) {
141
141
  let campaign = await KeitaroService.getCampaignById(app.keitaroData.redirectCampaignId)
142
142
  return campaign
143
143
  }
@@ -149,7 +149,7 @@ export let createOrFindFlashRedirectCampaign = async (app: IFlashApp): Promise<I
149
149
 
150
150
  if (matchingCampaigns.length != 0) {
151
151
  let campaign = matchingCampaigns[0]
152
- app.keitaroData.redirectCampaignId = campaign.id
152
+ if (app.keitaroData) app.keitaroData.redirectCampaignId = campaign.id
153
153
 
154
154
  console.log("Already exists!")
155
155
  // await app.save()
@@ -289,12 +289,12 @@ export let prepareOWCampaignParameters = (app: IFlashApp): IKeitaroCampaignParam
289
289
  "alias": ""
290
290
  },
291
291
  sub_id_8: {
292
- "name": app.keitaroData.clickIdParameterName,
292
+ "name": app.keitaroData?.clickIdParameterName || "",
293
293
  "placeholder": "{click_id}",
294
294
  "alias": "click_id"
295
295
  },
296
296
  sub_id_15: {
297
- "name": app.keitaroData.offerIdParameterName,
297
+ "name": app.keitaroData?.offerIdParameterName || "",
298
298
  "placeholder": "{offer_custom_id}",
299
299
  "alias": "offer_custom_id"
300
300
  }