notifly-sdk 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/index.js +7 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -83,13 +83,13 @@ exports.initialize = async function (prjId, userName, password) {
83
83
  try {
84
84
  await logEvent("push_delivered", { "campaign_id": campaign_id, "status": "background-notifee" }, null, true);
85
85
  } catch (err) {
86
- console.error('[Notifly]: ', err);
86
+ console.warn('[Notifly]: ', err);
87
87
  }
88
88
  break;
89
89
  }
90
90
  });
91
91
  } catch (err) {
92
- console.error("[Notifly]: ", err);
92
+ console.warn("[Notifly]: ", err);
93
93
  }
94
94
  }
95
95
 
@@ -118,7 +118,7 @@ exports.foregroundSetting = function () {
118
118
  }
119
119
  await logEvent("push_click", { "campaign_id": campaign_id, "status": "foreground" }, null, true);
120
120
  } catch (err) {
121
- console.error('[Notifly]: ', err);
121
+ console.warn('[Notifly]: ', err);
122
122
  }
123
123
  }
124
124
  });
@@ -144,7 +144,7 @@ async function getCognitoIdToken(userName, password) {
144
144
  const tokens = JSON.parse(result).AuthenticationResult.IdToken
145
145
  return tokens;
146
146
  })
147
- .catch(error => console.error('[Notifly]: ', error));
147
+ .catch(error => console.warn('[Notifly]: ', error));
148
148
 
149
149
  return token;
150
150
  }
@@ -252,7 +252,6 @@ async function logEvent(eventName, eventParams, segmentation_event_param_keys =
252
252
 
253
253
  const response = await _apiCall("https://12lnng07q2.execute-api.ap-northeast-2.amazonaws.com/prod/records", requestOptions);
254
254
  const result = JSON.parse(response)
255
- console.log(result)
256
255
  if (result.message == "The incoming token has expired") {
257
256
  const [userName, password] = await Promise.all([AsyncStorage.getItem('notiflyUserName'), AsyncStorage.getItem('notiflyUserPassword')])
258
257
  const newToken = await getCognitoIdToken(userName, password);
@@ -261,9 +260,9 @@ async function logEvent(eventName, eventParams, segmentation_event_param_keys =
261
260
  }
262
261
 
263
262
  } catch (err) {
264
- console.log(err)
263
+ console.warn('[Notifly]Error: err')
265
264
  if (err == 'Error: null value') {
266
- throw new Error("[Notifly] Fail to log the event.");
265
+ throw new Error("[Notifly] Fail to log the event. Please retry the initialization.");
267
266
  }
268
267
  }
269
268
  }
@@ -272,4 +271,4 @@ async function _apiCall(apiUrl, requestOptions) {
272
271
  const result = fetch(apiUrl, requestOptions)
273
272
  .then(response => response.text());
274
273
  return result;
275
- }
274
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notifly-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {