@inngageregistry/inngage-react 4.0.0-beta.2 → 4.0.0

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 (42) hide show
  1. package/README.md +60 -60
  2. package/dist/Inngage.d.ts +28 -0
  3. package/dist/Inngage.js +149 -0
  4. package/dist/api/api.d.ts +4 -0
  5. package/{src/api/api.ts → dist/api/api.js} +22 -28
  6. package/dist/api/handler.d.ts +1 -0
  7. package/dist/api/handler.js +44 -0
  8. package/dist/components/in_app.d.ts +6 -0
  9. package/dist/components/in_app.js +92 -0
  10. package/dist/components/modal.d.ts +26 -0
  11. package/dist/components/modal.js +158 -0
  12. package/dist/components/styles.d.ts +88 -0
  13. package/dist/components/styles.js +86 -0
  14. package/dist/firebase/notifications_listener.d.ts +6 -0
  15. package/dist/firebase/notifications_listener.js +170 -0
  16. package/{src/index.ts → dist/index.d.ts} +6 -11
  17. package/dist/index.js +6 -0
  18. package/dist/models/inngage_properties.d.ts +11 -0
  19. package/dist/models/inngage_properties.js +13 -0
  20. package/dist/models/requests.d.ts +40 -0
  21. package/{src/models/requests.ts → dist/models/requests.js} +40 -42
  22. package/dist/services/api_services.d.ts +7 -0
  23. package/{src/services/api_services.ts → dist/services/api_services.js} +25 -30
  24. package/dist/services/handler.d.ts +1 -0
  25. package/dist/services/handler.js +38 -0
  26. package/dist/services/inngage.d.ts +4 -0
  27. package/dist/services/inngage.js +22 -0
  28. package/dist/utils.d.ts +4 -0
  29. package/dist/utils.js +25 -0
  30. package/package.json +79 -40
  31. package/.editorconfig +0 -6
  32. package/src/Inngage.ts +0 -193
  33. package/src/api/handler.ts +0 -53
  34. package/src/components/in_app.tsx +0 -192
  35. package/src/components/modal.tsx +0 -221
  36. package/src/components/styles.ts +0 -88
  37. package/src/firebase/notifications_listener.ts +0 -182
  38. package/src/models/inngage_properties.ts +0 -13
  39. package/src/services/handler.ts +0 -41
  40. package/src/services/inngage.ts +0 -23
  41. package/src/utils.ts +0 -35
  42. package/tsconfig.json +0 -27
@@ -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
- }
@@ -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
- }