@inngageregistry/inngage-react 4.0.0-beta.2 → 4.0.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/README.md +60 -60
- package/dist/Inngage.d.ts +28 -0
- package/dist/Inngage.js +161 -0
- package/dist/api/api.d.ts +4 -0
- package/{src/api/api.ts → dist/api/api.js} +22 -28
- package/dist/api/handler.d.ts +1 -0
- package/dist/api/handler.js +44 -0
- package/dist/components/in_app.d.ts +6 -0
- package/dist/components/in_app.js +92 -0
- package/dist/components/modal.d.ts +26 -0
- package/dist/components/modal.js +158 -0
- package/dist/components/styles.d.ts +88 -0
- package/dist/components/styles.js +86 -0
- package/dist/firebase/notifications_config.d.ts +3 -0
- package/dist/firebase/notifications_config.js +30 -0
- package/dist/firebase/notifications_listener.d.ts +8 -0
- package/dist/firebase/notifications_listener.js +202 -0
- package/{src/index.ts → dist/index.d.ts} +6 -11
- package/dist/index.js +6 -0
- package/dist/models/inngage_properties.d.ts +11 -0
- package/dist/models/inngage_properties.js +13 -0
- package/dist/models/requests.d.ts +40 -0
- package/{src/models/requests.ts → dist/models/requests.js} +40 -42
- package/dist/services/api_services.d.ts +7 -0
- package/{src/services/api_services.ts → dist/services/api_services.js} +25 -30
- package/dist/services/handler.d.ts +1 -0
- package/dist/services/handler.js +38 -0
- package/dist/services/inngage.d.ts +4 -0
- package/dist/services/inngage.js +22 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +26 -0
- package/package.json +79 -40
- package/.editorconfig +0 -6
- package/src/Inngage.ts +0 -193
- package/src/api/handler.ts +0 -53
- package/src/components/in_app.tsx +0 -192
- package/src/components/modal.tsx +0 -221
- package/src/components/styles.ts +0 -88
- package/src/firebase/notifications_listener.ts +0 -182
- package/src/models/inngage_properties.ts +0 -13
- package/src/services/handler.ts +0 -41
- package/src/services/inngage.ts +0 -23
- package/src/utils.ts +0 -35
- package/tsconfig.json +0 -27
package/src/services/handler.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
}
|
package/src/services/inngage.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
package/src/utils.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Alert } from 'react-native'
|
|
2
|
-
|
|
3
|
-
export const formatDate = (timestamp) => {
|
|
4
|
-
if (!timestamp) {
|
|
5
|
-
return null
|
|
6
|
-
}
|
|
7
|
-
return new Date(timestamp).toISOString()
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const showAlert = (title: string, body: string) => {
|
|
11
|
-
Alert.alert(title, body, [{ text: 'OK', onPress: () => console.log('OK Pressed') }], {
|
|
12
|
-
cancelable: false,
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const showAlertLink = (title: string, body: string, appName: string, link: string) => {
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
Alert.alert(
|
|
19
|
-
title,
|
|
20
|
-
`${body}\n\n${link}`,
|
|
21
|
-
[{ text: 'NO', onPress: () => resolve(false) }, { text: 'OK', onPress: () => resolve(true) }],
|
|
22
|
-
{ cancelable: false },
|
|
23
|
-
)
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const isEmpty = (obj: any) => {
|
|
28
|
-
for (var prop in obj) {
|
|
29
|
-
if (obj.hasOwnProperty(prop)) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return JSON.stringify(obj) === JSON.stringify({});
|
|
35
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"module": "es6",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"outDir": "./build",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"jsx": "react-native",
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"moduleResolution": "node",
|
|
13
|
-
"noImplicitAny": false,
|
|
14
|
-
"lib": [
|
|
15
|
-
"dom",
|
|
16
|
-
"es2015"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"include": [
|
|
20
|
-
"**/*"
|
|
21
|
-
],
|
|
22
|
-
"exclude": [
|
|
23
|
-
"node_modules",
|
|
24
|
-
"**/__tests__/*",
|
|
25
|
-
"build"
|
|
26
|
-
]
|
|
27
|
-
}
|