@bprotsyk/aso-core 1.2.117 → 1.2.119

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
  }
@@ -126,7 +126,8 @@ 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
+ console.log(app.keitaroData?.redirectCampaignId);
130
131
  let campaign = await keitaro_service_1.KeitaroService.getCampaignById(app.keitaroData.redirectCampaignId);
131
132
  return campaign;
132
133
  }
@@ -136,7 +137,8 @@ let createOrFindFlashRedirectCampaign = async (app) => {
136
137
  const matchingCampaigns = allCampaigns.filter(campaign => regexp.exec(campaign.name));
137
138
  if (matchingCampaigns.length != 0) {
138
139
  let campaign = matchingCampaigns[0];
139
- app.keitaroData.redirectCampaignId = campaign.id;
140
+ if (app.keitaroData)
141
+ app.keitaroData.redirectCampaignId = campaign.id;
140
142
  console.log("Already exists!");
141
143
  // await app.save()
142
144
  return campaign;
@@ -263,12 +265,12 @@ let prepareOWCampaignParameters = (app) => {
263
265
  "alias": ""
264
266
  },
265
267
  sub_id_8: {
266
- "name": app.keitaroData.clickIdParameterName,
268
+ "name": app.keitaroData?.clickIdParameterName || "",
267
269
  "placeholder": "{click_id}",
268
270
  "alias": "click_id"
269
271
  },
270
272
  sub_id_15: {
271
- "name": app.keitaroData.offerIdParameterName,
273
+ "name": app.keitaroData?.offerIdParameterName || "",
272
274
  "placeholder": "{offer_custom_id}",
273
275
  "alias": "offer_custom_id"
274
276
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.117",
3
+ "version": "1.2.119",
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
  }
@@ -137,7 +137,8 @@ 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
+ console.log(app.keitaroData?.redirectCampaignId)
141
142
  let campaign = await KeitaroService.getCampaignById(app.keitaroData.redirectCampaignId)
142
143
  return campaign
143
144
  }
@@ -149,7 +150,7 @@ export let createOrFindFlashRedirectCampaign = async (app: IFlashApp): Promise<I
149
150
 
150
151
  if (matchingCampaigns.length != 0) {
151
152
  let campaign = matchingCampaigns[0]
152
- app.keitaroData.redirectCampaignId = campaign.id
153
+ if (app.keitaroData) app.keitaroData.redirectCampaignId = campaign.id
153
154
 
154
155
  console.log("Already exists!")
155
156
  // await app.save()
@@ -289,12 +290,12 @@ export let prepareOWCampaignParameters = (app: IFlashApp): IKeitaroCampaignParam
289
290
  "alias": ""
290
291
  },
291
292
  sub_id_8: {
292
- "name": app.keitaroData.clickIdParameterName,
293
+ "name": app.keitaroData?.clickIdParameterName || "",
293
294
  "placeholder": "{click_id}",
294
295
  "alias": "click_id"
295
296
  },
296
297
  sub_id_15: {
297
- "name": app.keitaroData.offerIdParameterName,
298
+ "name": app.keitaroData?.offerIdParameterName || "",
298
299
  "placeholder": "{offer_custom_id}",
299
300
  "alias": "offer_custom_id"
300
301
  }