esoftplay 0.0.252 → 0.0.254

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/bin/files.ts ADDED
@@ -0,0 +1,7 @@
1
+ let packagejson = require('../../../package.json');
2
+ let appjson = require('../../../app.json');
3
+ let configjson = require('../../../config.json');
4
+ let configlivejson = require('../../../config.live.json');
5
+
6
+ export { appjson, configjson, configlivejson, packagejson };
7
+
@@ -1,4 +1,5 @@
1
1
  //noPage
2
+ import { appjson, packagejson } from 'esoftplay/bin/files';
2
3
  import { LibCurl } from 'esoftplay/cache/lib/curl/import';
3
4
  import { LibNavigationProperty } from 'esoftplay/cache/lib/navigation/import';
4
5
  import { UserClass } from 'esoftplay/cache/user/class/import';
@@ -9,8 +10,6 @@ import * as Application from 'expo-application';
9
10
  import Constants from 'expo-constants';
10
11
  import * as FileSystem from 'expo-file-system';
11
12
  import { Platform } from 'react-native';
12
- let pack = require('../../../../package.json');
13
- let app = require('../../../../app.json');
14
13
  const { expoConfig } = Constants;
15
14
 
16
15
  function getTime() {
@@ -60,7 +59,7 @@ export function reportApiError(fetch: any, error: any) {
60
59
  'error: ' + error,
61
60
  '\n\n\ndev: ' + Platform.OS + ' - ' + Constants.deviceName,
62
61
  'time: ' + getTime(),
63
- 'runtimeVersion:' + app.expo.runtimeVersion,
62
+ 'runtimeVersion:' + appjson.expo.runtimeVersion,
64
63
  'app/pub_id: ' + Constants.appOwnership + '/' + (config?.publish_id || '-'),
65
64
  'user_id: ' + user?.id || user?.user_id || '-',
66
65
  'username: ' + user?.username || '-',
@@ -118,11 +117,11 @@ export function getError() {
118
117
  let msg = [
119
118
  'slug: ' + "#" + expoConfig?.slug,
120
119
  'error: \n' + _e.error,
121
- '\n\nname: ' + expoConfig?.name + ' - sdk' + pack?.dependencies?.expo,
120
+ '\n\nname: ' + expoConfig?.name + ' - sdk' + packagejson?.dependencies?.expo,
122
121
  'time: \n' + _e?.time,
123
122
  'domain: ' + config.domain + config.uri,
124
- 'runtimeVersion:' + app.expo.runtimeVersion,
125
- 'package: ' + (Application.nativeBuildVersion) + ' - v' + (Platform.OS == 'ios' ? app.expo.ios.buildNumber : app.expo.android.versionCode),
123
+ 'runtimeVersion:' + appjson.expo.runtimeVersion,
124
+ 'package: ' + (Application.nativeBuildVersion) + ' - v' + (Platform.OS == 'ios' ? appjson.expo.ios.buildNumber : appjson.expo.android.versionCode),
126
125
  'device: ' + Platform.OS + ' | ' + Constants.deviceName,
127
126
  'native/pub_id: ' + expoConfig?.sdkVersion + '/' + (config?.publish_id || '-'),
128
127
  'user_id: ' + _e?.user?.id || _e?.user?.user_id || '-',
@@ -1,5 +1,6 @@
1
1
  //noPage
2
2
 
3
+ import { appjson, configjson, configlivejson } from 'esoftplay/bin/files';
3
4
  import { EspAssets } from 'esoftplay/cache/assets';
4
5
  import cacheConfig from 'esoftplay/cache/config.json';
5
6
  import { LibLocale } from 'esoftplay/cache/lib/locale/import';
@@ -41,20 +42,18 @@ console.warn = (...arg) => {
41
42
  };
42
43
  LogBox.ignoreLogs(ignoreWarns);
43
44
 
44
- let app = require('../../../../app.json');
45
- let conf = require('../../../../config.json');
46
45
  if (!__DEV__) {
47
46
  if (Platform.OS == 'web') {
48
- conf.config.domain = window.location.hostname
47
+ configjson.config.domain = window.location.hostname
49
48
  }
50
49
  }
51
50
  let lconf: any
52
51
  try {
53
- lconf = require('../../../../config.live.json');
52
+ lconf = configlivejson;
54
53
  } catch (error) {
55
54
 
56
55
  }
57
- if (conf?.config?.isDebug == 0)
56
+ if (configjson?.config?.isDebug == 0)
58
57
  LogBox.ignoreAllLogs();
59
58
  /** Klik [disini](https://github.com/dev-esoftplay/mobile-docs/blob/main/esp.md) untuk melihat dokumentasi*/
60
59
  const esp = {
@@ -81,10 +80,10 @@ const esp = {
81
80
  return target;
82
81
  },
83
82
  appjson(): any {
84
- return esp.mergeDeep(app, conf)
83
+ return esp.mergeDeep(appjson, configjson)
85
84
  },
86
85
  assets(path: EspAssets): any {
87
- const _assets = require('../../cache/assets')
86
+ const _assets = require('esoftplay/cache/assets')
88
87
  return _assets(path)
89
88
  },
90
89
  versionName(): string {
@@ -110,7 +109,7 @@ const esp = {
110
109
  if (!lconf) {
111
110
  return false
112
111
  }
113
- return conf.config.domain != lconf.config.domain
112
+ return configjson.config.domain != lconf.config.domain
114
113
  },
115
114
  readDeepObj(obj: any) {
116
115
  return function (param?: string, ...params: string[]): any {
@@ -156,7 +155,7 @@ const esp = {
156
155
  if (modtast[1] == "") {
157
156
  modtast[1] = "index";
158
157
  }
159
- const routers = require('../../cache/routers')
158
+ const routers = require('esoftplay/cache/routers')
160
159
  return routers(modtast.join("/"));
161
160
  },
162
161
  modProp<T extends keyof EspRouterPropertyInterface>(path: T): EspRouterPropertyInterface[T] {
@@ -164,11 +163,11 @@ const esp = {
164
163
  if (modtast[1] == "") {
165
164
  modtast[1] = "index";
166
165
  }
167
- const properties = require('../../cache/properties')
166
+ const properties = require('esoftplay/cache/properties')
168
167
  return properties(modtast.join("/"));
169
168
  },
170
169
  _config(): typeof cacheConfig {
171
- app = esp.mergeDeep(app, conf)
170
+ let app = esp.mergeDeep(appjson, configjson)
172
171
  var msg = ''
173
172
  if (!app.hasOwnProperty('config')) {
174
173
  msg = "tidak ada config"
@@ -214,7 +213,7 @@ const esp = {
214
213
  return config;
215
214
  },
216
215
  navigations(): string[] {
217
- const navs = require('../../cache/navs').default
216
+ const navs = require('esoftplay/cache/navs').default
218
217
  return navs;
219
218
  },
220
219
  home(): any {
@@ -225,7 +224,7 @@ const esp = {
225
224
  return UserRoutes.state().get();
226
225
  },
227
226
  log(message?: any, ...optionalParams: any[]) {
228
- if (esp.config("isDebug") == 1) {
227
+ if (esp.config()?.isDebug == 1) {
229
228
  let out = [message]
230
229
  if (optionalParams)
231
230
  out.push(...optionalParams)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay",
3
- "version": "0.0.252",
3
+ "version": "0.0.254",
4
4
  "description": "embedding data from esoftplay framework (web based) into mobile app",
5
5
  "main": "cache/index.js",
6
6
  "types": "../../index.d.ts",