react-native-netmera 1.4.8 → 1.5.0-alpha01

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/src/Netmera.js DELETED
@@ -1,223 +0,0 @@
1
- import {AppRegistry, NativeEventEmitter, NativeModules, Platform} from "react-native";
2
- import {
3
- NetmeraCategory,
4
- NetmeraCategoryFilter,
5
- NetmeraInboxFilter,
6
- NetmeraPushInbox,
7
- NMCategoryPreference,
8
- NMInboxStatusCountFilter
9
- } from "./NetmeraInbox";
10
-
11
- const {RNNetmera, RNNetmeraRCTEventEmitter} = NativeModules;
12
- const netmeraRCTEventEmitter = new NativeEventEmitter(RNNetmeraRCTEventEmitter);
13
-
14
- export default class Netmera {
15
-
16
- static get PUSH_OBJECT_STATUS_READ() {
17
- return 1
18
- }
19
-
20
- static get PUSH_OBJECT_STATUS_UNREAD() {
21
- return 2
22
- }
23
-
24
- static get PUSH_OBJECT_STATUS_READ_OR_UNREAD() {
25
- return 3
26
- }
27
-
28
- static get PUSH_OBJECT_STATUS_DELETED() {
29
- return 4
30
- }
31
-
32
- static get PUSH_OBJECT_STATUS_ALL() {
33
- return 7
34
- }
35
-
36
- static initBroadcastReceiver(onPushRegister,
37
- onPushReceive,
38
- onPushOpen,
39
- onPushDismiss,
40
- onPushButtonClicked,
41
- onCarouselObjectSelected) {
42
- if (onPushRegister) {
43
- if (Platform.OS === 'android') {
44
- AppRegistry.registerHeadlessTask("onPushRegister", () => onPushRegister);
45
- } else {
46
- netmeraRCTEventEmitter.addListener("onPushRegister", onPushRegister)
47
- }
48
- }
49
- if (onPushReceive) {
50
- if (Platform.OS === 'android') {
51
- AppRegistry.registerHeadlessTask("onPushReceive", () => onPushReceive);
52
- } else {
53
- netmeraRCTEventEmitter.addListener("onPushReceive", onPushReceive)
54
- }
55
- }
56
- if (onPushOpen) {
57
- if (Platform.OS === 'android') {
58
- AppRegistry.registerHeadlessTask("onPushOpen", () => onPushOpen);
59
- } else {
60
- netmeraRCTEventEmitter.addListener("onPushOpen", onPushOpen)
61
- }
62
- }
63
- if (onPushDismiss) {
64
- if (Platform.OS === 'android') {
65
- AppRegistry.registerHeadlessTask("onPushDismiss", () => onPushDismiss);
66
- } else {
67
- netmeraRCTEventEmitter.addListener("onPushDismiss", onPushDismiss)
68
- }
69
- }
70
- if (onPushButtonClicked) {
71
- if (Platform.OS === 'android') {
72
- AppRegistry.registerHeadlessTask("onPushButtonClicked", () => onPushButtonClicked);
73
- }
74
- }
75
- if (onCarouselObjectSelected) {
76
- if (Platform.OS === 'android') {
77
- AppRegistry.registerHeadlessTask("onCarouselObjectSelected", () => onCarouselObjectSelected);
78
- }
79
- }
80
- }
81
-
82
- static async currentExternalId(): Promise<string> {
83
- return RNNetmera.currentExternalId()
84
- }
85
-
86
- static setBaseUrl(baseUrl: string) {
87
- RNNetmera.setBaseUrl(baseUrl)
88
- }
89
-
90
- static requestPushNotificationAuthorization() {
91
- if (Platform.OS === "ios") {
92
- RNNetmera.requestPushNotificationAuthorization()
93
- }
94
- }
95
-
96
- static requestPermissionsForLocation() {
97
- RNNetmera.requestPermissionsForLocation()
98
- }
99
-
100
- static setNetmeraMaxActiveRegions(maxActiveRegions: number) {
101
- RNNetmera.setNetmeraMaxActiveRegions(maxActiveRegions)
102
- }
103
-
104
- static enablePopupPresentation() {
105
- RNNetmera.enablePopupPresentation()
106
- }
107
-
108
- static disablePopupPresentation() {
109
- RNNetmera.disablePopupPresentation()
110
- }
111
-
112
- static async isPushEnabled(): Promise<boolean> {
113
- return RNNetmera.isPushEnabled()
114
- }
115
-
116
- static enablePush() {
117
- RNNetmera.enablePush()
118
- }
119
-
120
- static disablePush() {
121
- RNNetmera.disablePush()
122
- }
123
-
124
- static turnOffSendingEventAndUserUpdate(turnOff: boolean) {
125
- if (Platform.OS === 'android') {
126
- RNNetmera.turnOffSendingEventAndUserUpdate(turnOff)
127
- }
128
- }
129
-
130
- static fetchInbox(netmeraInboxFilter: NetmeraInboxFilter): Promise<Array<NetmeraPushInbox>> {
131
- return RNNetmera.fetchInbox(netmeraInboxFilter)
132
- }
133
-
134
- static fetchNextPage(): Promise<Array<NetmeraPushInbox>> {
135
- return RNNetmera.fetchNextPage();
136
- }
137
-
138
- static countForStatus(status = this.PUSH_OBJECT_STATUS_UNREAD) {
139
- return RNNetmera.countForStatus(status)
140
- }
141
-
142
- static inboxUpdateStatus(fromIndex: number, toIndex: number, status: number = this.PUSH_OBJECT_STATUS_UNREAD) {
143
- return RNNetmera.inboxUpdateStatus(fromIndex, toIndex, status)
144
- }
145
-
146
- static fetchCategory(categoryFilter: NetmeraCategoryFilter): Promise<Array<NetmeraCategory>> {
147
- return RNNetmera.fetchCategory(categoryFilter)
148
- }
149
-
150
- static fetchNextCategoryPage(): Promise<Array<NetmeraCategory>> {
151
- return RNNetmera.fetchNextCategoryPage();
152
- }
153
-
154
- static sendEvent(event) {
155
- RNNetmera.sendEvent(event)
156
- }
157
-
158
- static updateUser(user: NetmeraUser) {
159
- RNNetmera.updateUser(user)
160
- }
161
-
162
- static updateAll(inboxStatus: number) {
163
- return RNNetmera.updateAll(inboxStatus)
164
- }
165
-
166
- static handlePushObject(pushId: string) {
167
- RNNetmera.handlePushObject(pushId)
168
- }
169
-
170
- static handleInteractiveAction(pushId: string) {
171
- RNNetmera.handleInteractiveAction(pushId)
172
- }
173
-
174
- static setApiKey(apiKey: string) {
175
- RNNetmera.setApiKey(apiKey)
176
- }
177
-
178
- static handleLastMessage(categoryName: string) {
179
- RNNetmera.handleLastMessage(categoryName)
180
- }
181
-
182
- static updateStatusByCategories(fromIndex: number, toIndex: number, status: number = this.PUSH_OBJECT_STATUS_UNREAD) {
183
- return RNNetmera.updateStatusByCategories(fromIndex, toIndex, status)
184
- }
185
-
186
- static getInboxCountForStatus(nmInboxStatusCountFilter: NMInboxStatusCountFilter) {
187
- return RNNetmera.getInboxCountForStatus(nmInboxStatusCountFilter)
188
- }
189
-
190
- static getUserCategoryPreferenceList(): Promise<Array<NMCategoryPreference>> {
191
- return RNNetmera.getUserCategoryPreferenceList()
192
- }
193
-
194
- static setUserCategoryPreference(categoryId: number, categoryEnabled: string) {
195
- return RNNetmera.setUserCategoryPreference(categoryId, categoryEnabled)
196
- }
197
-
198
- static onNetmeraFirebasePushMessageReceived(from: string, data: Map) {
199
- console.log(typeof data)
200
- if (Platform.OS === "android") {
201
- data["google.c.sender.id"] = from
202
- RNNetmera.onNetmeraPushMessageReceived(data)
203
- }
204
- }
205
-
206
- static onNetmeraHuaweiPushMessageReceived(from: string, data: Map) {
207
- data["_nm"] = JSON.stringify(data["_nm"])
208
- if (Platform.OS === "android") {
209
- data["from"] = from
210
- RNNetmera.onNetmeraPushMessageReceived(data)
211
- }
212
- }
213
-
214
- static onNetmeraNewToken(pushToken: string) {
215
- if (Platform.OS === "android") {
216
- RNNetmera.onNetmeraNewToken(pushToken)
217
- }
218
- }
219
-
220
- static isNetmeraRemoteMessage(data: Object): boolean {
221
- return Platform.OS === "android" && data["_nm"] !== undefined;
222
- }
223
- }
@@ -1,95 +0,0 @@
1
- class NetmeraInboxFilter {
2
- constructor() {
3
- this.pageSize = undefined;
4
- this.status = undefined;
5
- this.categories = undefined;
6
- this.includeExpiredObjects = undefined;
7
- }
8
- }
9
-
10
- class NetmeraCategoryFilter {
11
- constructor() {
12
- this.pageSize = undefined;
13
- this.status = undefined;
14
- this.includeExpiredObjects = false;
15
- }
16
- }
17
-
18
- class NMInboxStatusCountFilter {
19
- set nmInboxStatus(nmInboxStatus) {
20
- this.status = nmInboxStatus
21
- }
22
-
23
- set categoryList(categoryList) {
24
- this.categories = categoryList
25
- }
26
-
27
- set includeExpired(includeExpired) {
28
- this.includeExpiredObjects = includeExpired
29
- }
30
- }
31
-
32
- class NetmeraPushInbox {
33
- title: string
34
- subtitle: string
35
- body: string
36
- pushType: number
37
- pushId: string
38
- pushInstanceId: string
39
- sendDate: string
40
- inboxStatus: number
41
- deepLink: string
42
- webPage: string
43
- externalId: string
44
- customJson: any
45
- pushAction: string
46
- carousel: any
47
- mediaAttachmentURL: string
48
- category: string
49
- categories: any
50
- interactiveActions: string
51
- expireTime: string
52
- }
53
-
54
- class NetmeraCategory {
55
- categoryName: string
56
- categoryStatus: string
57
- lastMessage: NetmeraPushInbox
58
- readCount: number
59
- deletedCount: number
60
- unreadCount: number
61
- }
62
-
63
- class NMCategoryPreference {
64
- categoryId: number
65
- categoryName: string
66
- optInStatus: boolean
67
- }
68
-
69
- class NMInboxStatus {
70
- static get STATUS_READ() {
71
- return 1
72
- }
73
-
74
- static get STATUS_UNREAD() {
75
- return 2
76
- }
77
-
78
- static get STATUS_DELETED() {
79
- return 4
80
- }
81
-
82
- static get STATUS_ALL() {
83
- return 7
84
- }
85
- }
86
-
87
- export {
88
- NMInboxStatusCountFilter,
89
- NMInboxStatus,
90
- NetmeraInboxFilter,
91
- NetmeraCategoryFilter,
92
- NetmeraCategory,
93
- NetmeraPushInbox,
94
- NMCategoryPreference
95
- };
@@ -1,92 +0,0 @@
1
- export default class NetmeraUser {
2
-
3
- static get GENDER_MALE() {
4
- return 0
5
- }
6
-
7
- static get GENDER_FEMALE() {
8
- return 1
9
- }
10
-
11
- static get GENDER_NOT_SPECIFIED() {
12
- return 2
13
- }
14
-
15
- static get MARITAL_STATUS_SINGLE() {
16
- return 0
17
- }
18
-
19
- static get MARITAL_STATUS_MARRIED() {
20
- return 1
21
- }
22
-
23
- static get MARITAL_STATUS_NOT_SPECIFIED() {
24
- return 2
25
- }
26
-
27
- constructor() {
28
- this.userId = null;
29
- this.msisdn = null;
30
- this.email = null
31
- }
32
-
33
- set name(value) {
34
- this.pa = value
35
- }
36
-
37
- set surname(value) {
38
- this.pb = value
39
- }
40
-
41
- set externalSegments(value) {
42
- this.pc = value
43
- }
44
-
45
- set gender(value) {
46
- this.pd = value
47
- }
48
-
49
- set dateOfBirth(value) {
50
- this.pe = value
51
- }
52
-
53
- set maritalStatus(value) {
54
- this.pf = value
55
- }
56
-
57
- set childCount(value) {
58
- this.pg = value
59
- }
60
-
61
- set country(value) {
62
- this.ph = value
63
- }
64
-
65
- set state(value) {
66
- this.pi = value
67
- }
68
-
69
- set city(value) {
70
- this.pj = value
71
- }
72
-
73
- set district(value) {
74
- this.pk = value
75
- }
76
-
77
- set occupation(value) {
78
- this.pl = value
79
- }
80
-
81
- set industry(value) {
82
- this.pm = value
83
- }
84
-
85
- set favoriteTeam(value) {
86
- this.pn = value
87
- }
88
-
89
- set language(value) {
90
- this.po = value
91
- }
92
- }