@inngageregistry/inngage-react 3.3.1-alpha.1 → 3.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inngageregistry/inngage-react",
3
- "version": "3.3.1-alpha.1",
3
+ "version": "3.3.1",
4
4
  "description": "Inngage Plugin for React Native applications for marketing campaign optimization using Push Notification.",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.d.ts",
package/src/Inngage.ts CHANGED
@@ -15,7 +15,7 @@ const getFirebaseAccess = async (): Promise<string | null> => {
15
15
  try {
16
16
  return await handleNotificationsPermission();
17
17
  } catch (error) {
18
- console.log('Erro no getFirebaseAccess: ', error);
18
+ console.error('Erro no getFirebaseAccess: ', error);
19
19
  throw error;
20
20
  }
21
21
  };
@@ -143,7 +143,6 @@ const Inngage = {
143
143
 
144
144
  const request = subscriptionRequestAdapter(rawRequest, customData, customFields)
145
145
  const subscribe = await subscriptionApi(request, dev);
146
- console.log(await subscribe.json())
147
146
  return subscribe;
148
147
  } catch (e) {
149
148
  console.error(e);
@@ -124,7 +124,6 @@ export const Inapp = (props: InappProps) => {
124
124
  if (type === '' || url === '') {
125
125
  return
126
126
  }
127
- console.log(title, body, url, type)
128
127
  const openLinkByType = (type, url) => (type === 'deep' ? Linking.openURL(url) : linkInApp(url))
129
128
 
130
129
  return Linking.canOpenURL(url).then((supported) => {
@@ -226,8 +225,6 @@ export const Inapp = (props: InappProps) => {
226
225
  let temp: any = []
227
226
  const messages = JSON.parse(await AsyncStorage.getItem('inngage') ?? '[]')
228
227
 
229
- console.log("Messages saved on AsyncStorage: ", JSON.stringify(messages))
230
-
231
228
  if (messages !== null) {
232
229
  messages.forEach((el) => {
233
230
  if (!isEmpty(el)) {
@@ -40,13 +40,10 @@ const openLinkByType = (type: string, url: string) => {
40
40
  };
41
41
 
42
42
  const openCommonNotification = ({ appToken, dev, remoteMessage, enableAlert, state }) => {
43
- console.log("Notification Opened from", state)
44
-
45
43
  if (!remoteMessage)
46
44
  return
47
45
 
48
46
  const { data } = remoteMessage
49
- console.log("Data:", data)
50
47
  if (!data || (data && !Object.keys(data).length))
51
48
  return
52
49
 
@@ -82,7 +79,7 @@ const handleUniqueRemoteMessage = async (
82
79
  handleInitialNotification(remoteMessage);
83
80
  }
84
81
  } catch (e) {
85
- console.log(e);
82
+ console.error(e);
86
83
  }
87
84
  };
88
85
 
@@ -98,7 +95,6 @@ export default async ({ appToken, dev, enableAlert, onNotificationOpenedApp }: n
98
95
  if (typeof onNotificationOpenedApp == 'function') {
99
96
  messaging().getInitialNotification().then(async (value) => {
100
97
  onNotificationOpenedApp(value?.data);
101
- // console.log("Remote message ID:", value?.messageId)
102
98
  if (value !== null)
103
99
  handleUniqueRemoteMessage(value, async (value) => {
104
100
  await handleInitialNotification(value);
@@ -107,7 +103,6 @@ export default async ({ appToken, dev, enableAlert, onNotificationOpenedApp }: n
107
103
  }
108
104
 
109
105
  const handleBackgroundMessage = async (remoteMessage: any) => {
110
- console.log('Message handled in the background!', remoteMessage);
111
106
  }
112
107
 
113
108
  const handleNotificationOpenedApp = async (remoteMessage: any) => {
@@ -122,8 +117,6 @@ export default async ({ appToken, dev, enableAlert, onNotificationOpenedApp }: n
122
117
  try {
123
118
  PushNotification.configure({
124
119
  onNotification: function (notification) {
125
- console.log('LOCAL NOTIFICATION ==>', notification)
126
-
127
120
  openCommonNotification({ appToken, dev, remoteMessage, enableAlert, state: 'Foreground' })
128
121
  },
129
122
  popInitialNotification: true,
@@ -137,7 +130,9 @@ export default async ({ appToken, dev, enableAlert, onNotificationOpenedApp }: n
137
130
  playSound: true,
138
131
  soundName: 'default',
139
132
  vibrate: true
140
- }, (created) => console.log(`createChannel returned '${created}'`));
133
+ }, (created) => {
134
+
135
+ });
141
136
 
142
137
  } catch (e) {
143
138
  console.error(e)
@@ -150,11 +145,7 @@ export default async ({ appToken, dev, enableAlert, onNotificationOpenedApp }: n
150
145
  vibration: 300,
151
146
  channelId: "high_importance_channel"
152
147
  });
153
-
154
- console.log('LOCAL NOTIFICATION : ')
155
- console.log(remoteMessage)
156
148
  } catch (e) {
157
- console.error('LOCAL NOTIFICATION ERROR: ')
158
149
  console.error(e)
159
150
  }
160
151
 
@@ -169,7 +160,6 @@ export default async ({ appToken, dev, enableAlert, onNotificationOpenedApp }: n
169
160
  await AsyncStorage.setItem('inngage', JSON.stringify(messageArray));
170
161
  }
171
162
  } else if (remoteMessage != null && !remoteMessage.data!.additional_data) {
172
- console.log(remoteMessage.data!.title)
173
163
  if (enableAlert) {
174
164
  showAlert(remoteMessage.data!.title, remoteMessage.data!.body)
175
165
  }
@@ -179,7 +169,6 @@ export default async ({ appToken, dev, enableAlert, onNotificationOpenedApp }: n
179
169
  messaging().setBackgroundMessageHandler(handleBackgroundMessage)
180
170
  messaging().onNotificationOpenedApp(handleNotificationOpenedApp)
181
171
  messaging().getInitialNotification().then(async (remoteMessage) => {
182
- // console.log("Remote message ID:", remoteMessage?.messageId)
183
172
  if (remoteMessage !== null)
184
173
  handleUniqueRemoteMessage(remoteMessage, async (value) => {
185
174
  await handleInitialNotification(value);
@@ -11,16 +11,16 @@ const requestConfigFactory = (method, request) => {
11
11
  Accept: 'application/json',
12
12
  'Content-Type': 'application/json',
13
13
  }
14
- try{
14
+ try {
15
15
  if (request?.registerSubscriberRequest?.authKey) {
16
16
  header = {
17
17
  ...header,
18
18
  Authorization: request.registerSubscriberRequest.authKey
19
19
  }
20
20
  }
21
- }catch(e){
22
- console.error(e)
23
- }
21
+ } catch (e) {
22
+ console.error(e)
23
+ }
24
24
  let objToSend = {
25
25
  method,
26
26
  body: JSON.stringify(request),
@@ -34,7 +34,6 @@ export const fetchClient = (method, requestBody, path, isDev = false): Promise<R
34
34
  return new Promise((resolve) => {
35
35
  const url = String(baseUrlHook[isDev as any]).concat(path)
36
36
  const request = requestConfigFactory(method, requestBody)
37
- console.log(request)
38
37
  fetch(url, request)
39
38
  .then(resolve)
40
39
  .catch(err => console.error('Fetch Error', err))