@inngageregistry/inngage-react 4.0.0-alpha.3 → 4.0.0-beta.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 +1 -1
- package/src/Inngage.ts +3 -4
- package/src/api/handler.ts +39 -39
- package/src/components/in_app.tsx +136 -135
- package/src/firebase/notifications_listener.ts +37 -5
- package/src/services/handler.ts +41 -0
- package/src/services/inngage.ts +23 -0
- /package/src/services/{api_service.ts → api_services.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inngageregistry/inngage-react",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.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
|
@@ -4,12 +4,12 @@ import * as RNLocalize from "react-native-localize";
|
|
|
4
4
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
5
5
|
|
|
6
6
|
import { formatDate } from "./utils";
|
|
7
|
-
import { InngageNotificationMessage } from "./firebase/notifications_listener";
|
|
7
|
+
import { InngageNotificationMessage, messagingHeadlessTask } from "./firebase/notifications_listener";
|
|
8
8
|
import { InngageProperties } from './models/inngage_properties';
|
|
9
9
|
|
|
10
10
|
import RNPermissions, { NotificationOption, RESULTS } from 'react-native-permissions';
|
|
11
11
|
|
|
12
|
-
import ApiService from './services/
|
|
12
|
+
import ApiService from './services/api_services';
|
|
13
13
|
|
|
14
14
|
const API_LEVEL_33 = 33;
|
|
15
15
|
|
|
@@ -57,7 +57,6 @@ const getFirebaseToken = async () => {
|
|
|
57
57
|
|
|
58
58
|
interface SubscriptionProps {
|
|
59
59
|
appToken: string,
|
|
60
|
-
enableAlert: boolean,
|
|
61
60
|
dev?: boolean,
|
|
62
61
|
friendlyIdentifier?: string,
|
|
63
62
|
customFields?: any,
|
|
@@ -90,7 +89,7 @@ class Inngage {
|
|
|
90
89
|
return Inngage.instance;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
static
|
|
92
|
+
static notificationListener(firebaseListenCallback?: any) {
|
|
94
93
|
try {
|
|
95
94
|
InngageNotificationMessage(firebaseListenCallback)
|
|
96
95
|
} catch (e) {
|
package/src/api/handler.ts
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
const baseUrlHook = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
[false as any]: 'https://api.inngage.com.br/v1',
|
|
3
|
+
[undefined as any]: 'https://api.inngage.com.br/v1',
|
|
4
|
+
[null as any]: 'https://api.inngage.com.br/v1',
|
|
5
|
+
[true as any]: 'https://apid.inngage.com.br/v1',
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const requestConfigFactory = (method, request) => {
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
let header: any = {
|
|
11
|
+
Accept: 'application/json',
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
if (request?.registerSubscriberRequest?.authKey) {
|
|
16
|
+
header = {
|
|
17
|
+
...header,
|
|
18
|
+
Authorization: request.registerSubscriberRequest.authKey
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error(e)
|
|
23
|
+
}
|
|
24
|
+
let objToSend = {
|
|
25
|
+
method,
|
|
26
|
+
body: JSON.stringify(request),
|
|
27
|
+
headers: header
|
|
20
28
|
}
|
|
21
|
-
} catch (e) {
|
|
22
|
-
console.error(e)
|
|
23
|
-
}
|
|
24
|
-
let objToSend = {
|
|
25
|
-
method,
|
|
26
|
-
body: JSON.stringify(request),
|
|
27
|
-
headers: header
|
|
28
|
-
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
return objToSend
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export const fetchClient = async (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
method: string,
|
|
35
|
+
requestBody: any,
|
|
36
|
+
path: string,
|
|
37
|
+
isDev = false
|
|
38
38
|
): Promise<Response> => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
try {
|
|
40
|
+
const url: URL = new URL(`${baseUrlHook[isDev as any]}${path}`);
|
|
41
|
+
const request: RequestInit = requestConfigFactory(method, requestBody);
|
|
42
|
+
const response: Response = await fetch(url, request);
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
throw new Error(`Network response was not ok (${response.status})`);
|
|
46
|
+
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
return response;
|
|
49
|
+
} catch (error: any) {
|
|
50
|
+
console.error('Fetch Error:', error.message);
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
53
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
StyleSheet,
|
|
4
|
+
Image,
|
|
5
|
+
View,
|
|
6
|
+
Text,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
ImageBackground,
|
|
9
|
+
Dimensions,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
|
|
12
12
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
@@ -17,142 +17,143 @@ import { Modal } from "../components/modal";
|
|
|
17
17
|
import { InngageProperties } from "../models/inngage_properties";
|
|
18
18
|
|
|
19
19
|
interface InAppData {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
inapp_message: boolean
|
|
21
|
+
title: string
|
|
22
|
+
body: string
|
|
23
|
+
title_font_color: string
|
|
24
|
+
body_font_color: string
|
|
25
|
+
background_color: string
|
|
26
|
+
btn_left_txt_color: string
|
|
27
|
+
btn_left_bg_color: string
|
|
28
|
+
btn_right_txt_color: string
|
|
29
|
+
btn_right_bg_color: string
|
|
30
|
+
background_image: string
|
|
31
|
+
btn_left_txt: string
|
|
32
|
+
btn_left_action_type: string
|
|
33
|
+
btn_left_action_link: string
|
|
34
|
+
btn_right_txt: string
|
|
35
|
+
btn_right_action_type: string
|
|
36
|
+
btn_right_action_link: string
|
|
37
|
+
rich_content: string
|
|
38
|
+
inpression: string
|
|
39
|
+
bg_img_action_type: string
|
|
40
|
+
bg_img_action_link: string
|
|
41
|
+
dot_color: string
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
interface InAppRichContent {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
carousel: boolean
|
|
46
|
+
img1: string
|
|
47
|
+
img2: string
|
|
48
|
+
img3: string
|
|
49
|
+
img4: string
|
|
50
|
+
img5: string
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
interface InAppProps {
|
|
54
|
-
|
|
54
|
+
onDismiss: () => void;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function InApp(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
57
|
+
export function InApp({ onDismiss }: InAppProps): JSX.Element {
|
|
58
|
+
const { width: screenWidth } = Dimensions.get('window');
|
|
59
|
+
|
|
60
|
+
const sliderWidth = screenWidth;
|
|
61
|
+
const itemWidth = screenWidth * 0.9;
|
|
62
|
+
|
|
63
|
+
const [data, setData] = React.useState<InAppData>();
|
|
64
|
+
const [richContent, setRichContent] = React.useState<InAppRichContent>();
|
|
65
|
+
const [visible, setVisible] = React.useState(false);
|
|
66
|
+
|
|
67
|
+
React.useEffect(() => {
|
|
68
|
+
const fetchAdditionalData = async () => {
|
|
69
|
+
try {
|
|
70
|
+
console.log('in app message')
|
|
71
|
+
const data = await AsyncStorage.getItem('inapp');
|
|
72
|
+
if (data) {
|
|
73
|
+
const parsedData = JSON.parse(data);
|
|
74
|
+
const richContentData = parsedData.rich_content;
|
|
75
|
+
|
|
76
|
+
setVisible(true);
|
|
77
|
+
setData(parsedData);
|
|
78
|
+
setRichContent(richContentData);
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error('Error retrieving additionalData from AsyncStorage:', error);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
fetchAdditionalData();
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
88
|
+
const styles = buildStyles(data, screenWidth * 0.9);
|
|
89
|
+
|
|
90
|
+
const handleDismissInApp = async () => {
|
|
91
|
+
await AsyncStorage.removeItem('inapp');
|
|
92
|
+
setVisible(false);
|
|
93
|
+
onDismiss();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const imageUrls: string[] = [
|
|
97
|
+
richContent?.img1 ?? '',
|
|
98
|
+
richContent?.img2 ?? '',
|
|
99
|
+
richContent?.img3 ?? '',
|
|
100
|
+
richContent?.img4 ?? '',
|
|
101
|
+
richContent?.img5 ?? ''
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
const stylesCarousel = StyleSheet.create({
|
|
105
|
+
itemContainer: {
|
|
106
|
+
justifyContent: 'center',
|
|
107
|
+
height: 250
|
|
108
|
+
},
|
|
109
|
+
itemImg: {
|
|
110
|
+
height: 250,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const _renderItem = ({ item, index }) => {
|
|
115
|
+
return (
|
|
116
|
+
<View style={stylesCarousel.itemContainer}>
|
|
117
|
+
<Image style={[stylesCarousel.itemImg]} source={{ uri: item }} />
|
|
118
|
+
</View>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (InngageProperties.getDebugMode() && data != null) {
|
|
123
|
+
console.log('INNGAGE - Data In App:', data)
|
|
124
|
+
console.log('INNGAGE - Data Rich Content:', richContent)
|
|
125
|
+
}
|
|
126
|
+
|
|
114
127
|
return (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
<Modal
|
|
129
|
+
renderToHardwareTextureAndroid={true}
|
|
130
|
+
transparent={true}
|
|
131
|
+
visible={visible}>
|
|
132
|
+
<ImageBackground style={styles.content} source={{ uri: data?.background_image }}>
|
|
133
|
+
{richContent?.carousel ? <Carousel
|
|
134
|
+
layout={"default"}
|
|
135
|
+
data={imageUrls}
|
|
136
|
+
sliderWidth={sliderWidth}
|
|
137
|
+
itemWidth={itemWidth}
|
|
138
|
+
renderItem={_renderItem} /> : null}
|
|
139
|
+
<TouchableOpacity style={styles.closeButton} onPress={handleDismissInApp}>
|
|
140
|
+
<Text>X</Text>
|
|
141
|
+
</TouchableOpacity>
|
|
142
|
+
<View style={styles.messageData}>
|
|
143
|
+
<Text style={styles.title}>{data?.title}</Text>
|
|
144
|
+
<Text style={styles.body}>{data?.body}</Text>
|
|
145
|
+
</View>
|
|
146
|
+
<View style={styles.footer}>
|
|
147
|
+
{data?.btn_left_txt != null ? <TouchableOpacity
|
|
148
|
+
style={styles.buttonLeft}>
|
|
149
|
+
<Text style={styles.textButton}>{data?.btn_left_txt}</Text>
|
|
150
|
+
</TouchableOpacity> : null}
|
|
151
|
+
{data?.btn_right_txt != null ? <TouchableOpacity
|
|
152
|
+
style={styles.buttonRight}>
|
|
153
|
+
<Text style={styles.textButton}>{data?.btn_right_txt}</Text>
|
|
154
|
+
</TouchableOpacity> : null}
|
|
155
|
+
</View>
|
|
156
|
+
</ImageBackground>
|
|
157
|
+
</Modal>
|
|
118
158
|
)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (InngageProperties.getDebugMode() && data != null) {
|
|
122
|
-
console.log('INNGAGE - Data In App:', data)
|
|
123
|
-
console.log('INNGAGE - Data Rich Content:', richContent)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<Modal
|
|
128
|
-
renderToHardwareTextureAndroid={true}
|
|
129
|
-
transparent={true}
|
|
130
|
-
visible={visible}>
|
|
131
|
-
<ImageBackground style={styles.content} source={{ uri: data?.background_image }}>
|
|
132
|
-
{richContent?.carousel ? <Carousel
|
|
133
|
-
layout={"default"}
|
|
134
|
-
data={imageUrls}
|
|
135
|
-
sliderWidth={sliderWidth}
|
|
136
|
-
itemWidth={itemWidth}
|
|
137
|
-
renderItem={_renderItem} /> : null}
|
|
138
|
-
<TouchableOpacity style={styles.closeButton} onPress={handleDismissInApp}>
|
|
139
|
-
<Text>X</Text>
|
|
140
|
-
</TouchableOpacity>
|
|
141
|
-
<View style={styles.messageData}>
|
|
142
|
-
<Text style={styles.title}>{data?.title}</Text>
|
|
143
|
-
<Text style={styles.body}>{data?.body}</Text>
|
|
144
|
-
</View>
|
|
145
|
-
<View style={styles.footer}>
|
|
146
|
-
{data?.btn_left_txt != null ? <TouchableOpacity
|
|
147
|
-
style={styles.buttonLeft}>
|
|
148
|
-
<Text style={styles.textButton}>{data?.btn_left_txt}</Text>
|
|
149
|
-
</TouchableOpacity> : null}
|
|
150
|
-
{data?.btn_right_txt != null ? <TouchableOpacity
|
|
151
|
-
style={styles.buttonRight}>
|
|
152
|
-
<Text style={styles.textButton}>{data?.btn_right_txt}</Text>
|
|
153
|
-
</TouchableOpacity> : null}
|
|
154
|
-
</View>
|
|
155
|
-
</ImageBackground>
|
|
156
|
-
</Modal>
|
|
157
|
-
)
|
|
158
159
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
4
|
|
|
@@ -6,17 +6,49 @@ import messaging from '@react-native-firebase/messaging';
|
|
|
6
6
|
import PushNotification, { Importance } from 'react-native-push-notification'
|
|
7
7
|
|
|
8
8
|
import { InngageProperties } from '../models/inngage_properties';
|
|
9
|
-
import * as ApiService from '../services/
|
|
9
|
+
import * as ApiService from '../services/api_services'
|
|
10
|
+
import { AppState } from 'react-native';
|
|
10
11
|
|
|
11
12
|
export const messagingHeadlessTask = () => {
|
|
12
13
|
return messaging().setBackgroundMessageHandler(async remoteMessage => {
|
|
13
14
|
if (InngageProperties.getDebugMode())
|
|
14
|
-
console.log('INNGAGE
|
|
15
|
-
|
|
15
|
+
console.log('INNGAGE BACKGROUND AND CLOSED DATA: ', remoteMessage)
|
|
16
|
+
|
|
17
|
+
if (remoteMessage?.data?.additional_data != null) {
|
|
16
18
|
await AsyncStorage.setItem('inapp', remoteMessage?.data?.additional_data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return Promise.resolve();
|
|
17
22
|
});
|
|
18
23
|
}
|
|
19
24
|
|
|
25
|
+
export const useInAppHandler = () => {
|
|
26
|
+
const [showInApp, setShowInApp] = useState(false);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const checkInAppData = async () => {
|
|
30
|
+
const inAppData = await AsyncStorage.getItem('inapp');
|
|
31
|
+
if (inAppData) {
|
|
32
|
+
setShowInApp(true);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
checkInAppData();
|
|
37
|
+
|
|
38
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
39
|
+
if (nextAppState === 'active') {
|
|
40
|
+
checkInAppData();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return () => {
|
|
45
|
+
subscription.remove();
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
return { showInApp, setShowInApp };
|
|
50
|
+
}
|
|
51
|
+
|
|
20
52
|
export const InngageNotificationMessage = (firebaseListenCallback?: any) => {
|
|
21
53
|
useEffect(() => {
|
|
22
54
|
PushNotification.configure({
|
|
@@ -80,7 +112,6 @@ export const InngageNotificationMessage = (firebaseListenCallback?: any) => {
|
|
|
80
112
|
|
|
81
113
|
useEffect(() => {
|
|
82
114
|
messaging().getInitialNotification().then(async (value) => {
|
|
83
|
-
|
|
84
115
|
if (value !== null)
|
|
85
116
|
handleUniqueRemoteMessage(value);
|
|
86
117
|
});
|
|
@@ -89,6 +120,7 @@ export const InngageNotificationMessage = (firebaseListenCallback?: any) => {
|
|
|
89
120
|
const handleUniqueRemoteMessage = async (
|
|
90
121
|
remoteMessage: { messageId?: string }) => {
|
|
91
122
|
try {
|
|
123
|
+
console.log('oi')
|
|
92
124
|
const lastRemoteMessageId = await AsyncStorage.getItem('LAST_REMOTE_MESSAGE_ID');
|
|
93
125
|
const newRemoteMessageId = remoteMessage?.messageId;
|
|
94
126
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const baseUrlHook = {
|
|
2
|
+
[false as any]: 'https://api.inngage.com.br/v1',
|
|
3
|
+
[undefined as any]: 'https://api.inngage.com.br/v1',
|
|
4
|
+
[null as any]: 'https://api.inngage.com.br/v1',
|
|
5
|
+
[true as any]: 'https://apid.inngage.com.br/v1',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const requestConfigFactory = (method, request) => {
|
|
9
|
+
|
|
10
|
+
let header: any = {
|
|
11
|
+
Accept: 'application/json',
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
if (request?.registerSubscriberRequest?.authKey) {
|
|
16
|
+
header = {
|
|
17
|
+
...header,
|
|
18
|
+
Authorization: request.registerSubscriberRequest.authKey
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error(e)
|
|
23
|
+
}
|
|
24
|
+
let objToSend = {
|
|
25
|
+
method,
|
|
26
|
+
body: JSON.stringify(request),
|
|
27
|
+
headers: header
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return objToSend
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const fetchClient = (method, requestBody, path, isDev = false): Promise<Response> => {
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
const url = String(baseUrlHook[isDev as any]).concat(path)
|
|
36
|
+
const request = requestConfigFactory(method, requestBody)
|
|
37
|
+
fetch(url, request)
|
|
38
|
+
.then(resolve)
|
|
39
|
+
.catch(err => console.error('Fetch Error', err))
|
|
40
|
+
})
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InngageProperties } from '../models/inngage_properties'
|
|
2
|
+
import { fetchClient } from './handler'
|
|
3
|
+
|
|
4
|
+
export const subscriptionApi = (request, dev = false) => {
|
|
5
|
+
if (InngageProperties.getDebugMode())
|
|
6
|
+
console.log('subscriptionApi', request)
|
|
7
|
+
return fetchClient('POST', request, '/subscription/', !!dev)
|
|
8
|
+
}
|
|
9
|
+
export const notificationApi = (request, dev = false) => {
|
|
10
|
+
if (InngageProperties.getDebugMode())
|
|
11
|
+
console.log('notificationApi', request)
|
|
12
|
+
return fetchClient('POST', request, '/notification/', !!dev)
|
|
13
|
+
}
|
|
14
|
+
export const eventsApi = (request, dev = false) => {
|
|
15
|
+
if (InngageProperties.getDebugMode())
|
|
16
|
+
console.log('eventsApi', request)
|
|
17
|
+
return fetchClient('POST', request, '/events/newEvent/', !!dev)
|
|
18
|
+
}
|
|
19
|
+
export const addUserDataApi = (request, dev = false) => {
|
|
20
|
+
if (InngageProperties.getDebugMode())
|
|
21
|
+
console.log('addUserData', request)
|
|
22
|
+
return fetchClient('POST', request, '/subscription/addCustomField', !!dev)
|
|
23
|
+
}
|
|
File without changes
|