core-outline 1.0.0 → 1.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.
@@ -0,0 +1,3 @@
1
+ const app_configs = {
2
+ BASE_URL: `https://api.coreoutline.com`,
3
+ }
@@ -0,0 +1,10 @@
1
+ const tracking_endpoints = {
2
+ START_SESSION: "/start-session",
3
+ END_SESSION: "/end-session",
4
+ UPDATE_PAGE: "/update-session",
5
+ TARGET_REACHED:"/update-target"
6
+ }
7
+
8
+ module.exports = {
9
+ tracking_endpoints,
10
+ }
@@ -0,0 +1,8 @@
1
+ const trackingConfigs = require('./components/tracking.js')
2
+ const appConfigs = require('./components/app.js')
3
+
4
+
5
+ module.exports = {
6
+ trackingConfigs,
7
+ appConfigs
8
+ }
File without changes
package/lib/index.js ADDED
@@ -0,0 +1,5 @@
1
+ const { request } = require('axios/app.js')
2
+
3
+ module.exports = {
4
+ request
5
+ }
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-outline",
3
- "version": "1.0.0",
4
- "description": "Connect your node JS application to Core&Outline",
3
+ "version": "1.0.1",
4
+ "description": "Connect your React JS application to Core&Outline",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -19,5 +19,9 @@
19
19
  "bugs": {
20
20
  "url": "https://github.com/TomiTsuma/core-outline-npm/issues"
21
21
  },
22
- "homepage": "https://github.com/TomiTsuma/core-outline-npm#readme"
22
+ "homepage": "https://github.com/TomiTsuma/core-outline-npm#readme",
23
+ "dependencies": {
24
+ "axios": "^1.6.7",
25
+ "react-router-dom": "^6.22.1"
26
+ }
23
27
  }
@@ -0,0 +1,7 @@
1
+ const updatePage = require('./page/update-page.js')
2
+ const startSession = require('./session/start-session.js')
3
+ const endSession = require('./session/end-session.js')
4
+ const targetReached = require('./target/update-target.js')
5
+
6
+
7
+ module.exports = {updatePage, startSession, endSession, targetReached}
@@ -0,0 +1,22 @@
1
+ const request = reqire('../../lib/index.js')
2
+ const { trackingConfigs, appConfigs } = require('../../config/index.js')
3
+
4
+ const updatePage = async(time_in, session_id, time_out) =>{
5
+ const res = await(
6
+ request({
7
+ url: appConfigs.BASE_URL,
8
+ service: trackingConfigs.UPDATE_PAGE,
9
+ body: {
10
+ 'session_id':session_id,
11
+ 'time_in':time_in,
12
+ 'time_out':time_out
13
+ },
14
+ method:'POST',
15
+ params:{
16
+ Authorization: `Bearer ${token}`
17
+ }
18
+ })
19
+ )
20
+ }
21
+
22
+ module.exports = updatePage
@@ -0,0 +1,20 @@
1
+ const request = reqire('../../lib/index.js')
2
+ const { trackingConfigs, appConfigs } = require('../../config/index.js')
3
+
4
+ const endSession = async(session_id) =>{
5
+ const res = await(
6
+ request({
7
+ url: appConfigs.BASE_URL,
8
+ service: trackingConfigs.END_SESSION,
9
+ body: {
10
+ 'session_id':session_id
11
+ },
12
+ method:'POST',
13
+ params:{
14
+ Authorization: `Bearer ${token}`
15
+ }
16
+ })
17
+ )
18
+ }
19
+
20
+ module.exports = endSession
@@ -0,0 +1,24 @@
1
+ const request = reqire('../../lib/index.js')
2
+ const { trackingConfigs } = require('../../config/index.js')
3
+
4
+ const startSession = async(device, browser, latitude, longitude) =>{
5
+ const res = await(
6
+ request({
7
+ url:`https://api.coreoutline.com`,
8
+ service: trackingConfigs.START_SESSION,
9
+ body: {
10
+ 'device':device,
11
+ 'browser':browser,
12
+ 'latitude':latitude,
13
+ 'longitude':longitude
14
+ },
15
+ method:'POST',
16
+ params:{
17
+ Authorization: `Bearer ${token}`
18
+ }
19
+ })
20
+ )
21
+ }
22
+
23
+
24
+ module.exports = startSession
@@ -0,0 +1,20 @@
1
+ const request = reqire('../../lib/index.js')
2
+ const { trackingConfigs, appConfigs } = require('../../config/index.js')
3
+
4
+ const targetReached = async(session_id) =>{
5
+ const res = await(
6
+ request({
7
+ url: appConfigs.BASE_URL,
8
+ service: trackingConfigs.TARGET_REACHED,
9
+ body: {
10
+ 'session_id':session_id
11
+ },
12
+ method:'POST',
13
+ params:{
14
+ Authorization: `Bearer ${token}`
15
+ }
16
+ })
17
+ )
18
+ }
19
+
20
+ module.exports = targetReached
File without changes