@chainplatform/sdk 0.3.5 → 0.3.7

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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@chainplatform/sdk",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "@chainplatform/sdk is a React Native library implement for react-native and react-native-web. Require crypto-js and react-native-mmkv packages.",
5
5
  "main": "index.js",
6
6
  "devDependencies": {
7
7
  "react": "*",
8
8
  "react-native": "*",
9
- "react-native-web": "*"
9
+ "react-native-web": "*",
10
+ "react-native-mmkv": "*"
10
11
  },
11
12
  "author": "Chain Platform <santran686@gmail.com> (https://chainplatform.net/)",
12
13
  "license": "MIT",
@@ -17,8 +18,7 @@
17
18
  "@chainplatform/sdk",
18
19
  "crypto-js",
19
20
  "dayjs",
20
- "react-native-mmkv",
21
- "react-device-detect"
21
+ "react-native-mmkv"
22
22
  ],
23
23
  "homepage": "https://github.com/ChainPlatform/ChainSDK",
24
24
  "bugs": "https://github.com/ChainPlatform/ChainSDK/issues",
@@ -32,7 +32,6 @@
32
32
  "react-native": "*",
33
33
  "react-native-web": "*",
34
34
  "react-native-mmkv": "*",
35
- "react-device-detect": "*",
36
35
  "crypto-js": "*"
37
36
  }
38
37
  }
package/Layout.js DELETED
@@ -1,291 +0,0 @@
1
- export function getScreenSize(layoutWidth, isDesktop, side_bar_width, styles) {
2
- const viewPadding = styles.fs15;
3
- let menuViewWidth = styles.s0;
4
- let bannerViewWidth = styles.s0;
5
- let splitPadding = styles.s0;
6
- let sideBarWidth = styles.s0;
7
- let courseViewWidth = styles.s0;
8
- let newsViewWidth = styles.s0;
9
- let bannerOnScreen = 1;
10
- //Menu
11
- let imageMenuSize = styles.s45;
12
- let fontMenuSize = styles.fs9_5;
13
- let menuTotalItem = 5;
14
- let menuSpace = 4 * styles.s5;
15
- // Course
16
- let courseTotalItem = 2;
17
- let newsTotalItem = 2;
18
- let courseSpace = 0;
19
- let newsSpace = 0;
20
- // News
21
- let newsItem = 1;
22
- let newsPadding = 0;
23
- // New Course
24
- let courseItem = 1;
25
- let coursePadding = 0;
26
- if (isDesktop) {
27
- courseSpace = styles.s30 + styles.fs15;
28
- newsSpace = styles.s30 + styles.fs15;
29
- } else {
30
- courseSpace = styles.fs15;
31
- newsSpace = styles.fs15;
32
- }
33
- if (isDesktop && layoutWidth > styles.base_desktop) {
34
- sideBarWidth = side_bar_width;
35
- // Menu
36
- imageMenuSize = styles.s55;
37
- fontMenuSize = styles.fs12;
38
- // Course
39
- courseTotalItem = 3;
40
- newsTotalItem = 3;
41
- courseSpace = styles.s45 + styles.fs15;
42
- newsSpace = styles.s45 + styles.fs15;
43
- // News
44
- newsItem = 2;
45
- newsPadding = styles.fs15;
46
- // New Course
47
- courseItem = 3;
48
- coursePadding = styles.s30;
49
- }
50
- let viewWidth = styles.s345;
51
- let viewHeight = styles.s195;
52
- if (isDesktop) {
53
- if (layoutWidth >= styles.split_desktop) {
54
- bannerOnScreen = 2;
55
- splitPadding = styles.fs15;
56
- // Menu
57
- menuTotalItem = 10;
58
- menuSpace = 9 * styles.s5;
59
- fontMenuSize = styles.fs13;
60
- // Course
61
- courseTotalItem = 4;
62
- newsTotalItem = 4;
63
- courseSpace = styles.s75;
64
- newsSpace = styles.s75;
65
- // News
66
- newsItem = 3;
67
- newsPadding = styles.s30;
68
- // New Course
69
- courseItem = 4;
70
- coursePadding = styles.s45;
71
- }
72
- if (layoutWidth >= styles.wide_split_desktop) {
73
- // Course
74
- courseTotalItem = 5;
75
- courseSpace = styles.s75 + styles.fs15;
76
- //
77
- courseItem = 5;
78
- coursePadding = styles.s60;
79
- }
80
- bannerViewWidth = layoutWidth - sideBarWidth - 2 * viewPadding - splitPadding;
81
- viewWidth = bannerViewWidth / bannerOnScreen;
82
- viewHeight = styles.s195 * (viewWidth / styles.s345);
83
- }
84
- // Menu
85
- menuViewWidth = layoutWidth - sideBarWidth - 2 * viewPadding - menuSpace;
86
- const menuWidth = menuViewWidth / menuTotalItem;
87
- // Course
88
- courseViewWidth = layoutWidth - sideBarWidth - 2 * viewPadding - courseSpace;
89
- const courseWidth = courseViewWidth / courseTotalItem;
90
- // News
91
- newsViewWidth = layoutWidth - sideBarWidth - 2 * viewPadding - newsSpace;
92
- const newsWidth = newsViewWidth / newsTotalItem;
93
- //
94
- let numberChart = 1;
95
- let padding = styles.s30;
96
- if (layoutWidth > 460 && layoutWidth < styles.base_desktop) {
97
- numberChart = 2;
98
- padding = styles.s45;
99
- }
100
- if (layoutWidth >= styles.base_desktop && layoutWidth < styles.split_desktop) {
101
- numberChart = 3;
102
- padding = styles.s60;
103
- }
104
- if (layoutWidth >= styles.split_desktop) {
105
- numberChart = 5;
106
- padding = styles.s90;
107
- }
108
- let packageWidth = (layoutWidth - padding - sideBarWidth) / numberChart;
109
- if (packageWidth < styles.s232) {
110
- packageWidth = styles.s232;
111
- }
112
- if (packageWidth > styles.s280) {
113
- packageWidth = styles.s280;
114
- }
115
-
116
- let numberwebinarChart = 1;
117
- let webinarPadding = styles.s0;
118
- if (layoutWidth - sideBarWidth - 2 * viewPadding >= 500) {
119
- numberwebinarChart = 2;
120
- webinarPadding = styles.fs15;
121
- }
122
- if (layoutWidth >= styles.split_desktop && side_bar_width == 0) {
123
- numberwebinarChart = 3;
124
- webinarPadding = styles.fs15;
125
- }
126
-
127
- let newsItemViewWidth = layoutWidth - sideBarWidth - 2 * viewPadding - newsPadding;
128
- const newsItemWidth = newsItemViewWidth / newsItem;
129
-
130
- let courseItemViewWidth = layoutWidth - sideBarWidth - 2 * viewPadding - coursePadding;
131
- const courseItemWidth = courseItemViewWidth / courseItem;
132
-
133
- let webinarViewWidth = layoutWidth - sideBarWidth - 2 * viewPadding - (numberwebinarChart - 1) * webinarPadding;
134
- const webinarWidth = webinarViewWidth / numberwebinarChart;
135
-
136
- const layout = layoutWidth - sideBarWidth - (sideBarWidth > 0 ? 2 : 2) * viewPadding;
137
-
138
- let view = {};
139
- view.courseItemWidth = courseItemWidth;
140
- view.courseItem = courseItem;
141
- view.coursePadding = coursePadding;
142
- view.newsItemWidth = newsItemWidth;
143
- view.newsItem = newsItem;
144
- view.newsPadding = newsPadding;
145
- view.webinarWidth = webinarWidth;
146
- view.webinarPadding = webinarPadding;
147
- view.numberWebinar = numberwebinarChart;
148
- view.viewPadding = viewPadding;
149
- view.sideBarWidth = sideBarWidth;
150
- view.layout = layout;
151
- view.bannerOnScreen = bannerOnScreen;
152
- view.imageMenuSize = imageMenuSize;
153
- view.fontMenuSize = fontMenuSize;
154
- view.viewWidth = viewWidth;
155
- view.viewHeight = viewHeight;
156
- view.menuWidth = menuWidth;
157
- view.courseWidth = courseWidth;
158
- view.newsWidth = newsWidth;
159
- view.splitPadding = splitPadding;
160
- view.packageWidth = packageWidth;
161
- return view;
162
- }
163
-
164
- export function getCartLayout(layoutWidth, isDesktop, side_bar_width, styles) {
165
- let viewPadding = styles.s0;
166
- let viewSplit = styles.w100pc;
167
- let borderRadius = styles.s0;
168
- let marginBottom = styles.s1;
169
- let sideBarWidth = styles.s0;
170
- if (isDesktop && layoutWidth > styles.base_desktop) {
171
- sideBarWidth = side_bar_width;
172
- borderRadius = styles.s4;
173
- marginBottom = styles.fs10;
174
- }
175
- if (layoutWidth >= styles.wide_split_desktop) {
176
- viewSplit = styles.w50pc;
177
- }
178
- if (layoutWidth >= 767) {
179
- viewPadding = styles.fs15;
180
- }
181
- let view = {};
182
- view.viewPadding = viewPadding;
183
- view.viewSplit = viewSplit;
184
- view.sideBarWidth = sideBarWidth;
185
- view.itemBorderRadius = borderRadius;
186
- view.itemMarginBottom = marginBottom;
187
- return view;
188
- }
189
-
190
- export function getTransactionLayout(layoutWidth, isDesktop, styles) {
191
- let viewSplit = styles.w100pc;
192
- if (isDesktop && layoutWidth >= 767) {
193
- viewSplit = styles.w50pc;
194
- }
195
- let view = {};
196
- view.viewSplit = viewSplit;
197
- return view;
198
- }
199
-
200
- export function getCourseLayout(layoutWidth, isDesktop, styles) {
201
- let viewSplit = styles.w100pc;
202
- let viewPadding = styles.s0;
203
- let color = 0;
204
- let showButton = 1;
205
- let childViewPadding = styles.fs15;
206
- if (isDesktop && layoutWidth >= 767) {
207
- viewSplit = styles.w50pc;
208
- viewPadding = styles.fs15;
209
- childViewPadding = styles.s0;
210
- color = 1;
211
- showButton = 0;
212
- }
213
- if (isDesktop && layoutWidth > 767 && layoutWidth < 991) {
214
- showButton = 1;
215
- }
216
- let view = {};
217
- view.color = color;
218
- view.viewSplit = viewSplit;
219
- view.viewPadding = viewPadding;
220
- view.childViewPadding = childViewPadding;
221
- view.showButton = showButton;
222
- return view;
223
- }
224
-
225
- export function getUserCourseLayout(layoutWidth, isDesktop, styles) {
226
- let viewPadding = styles.fs7_5;
227
- let numberCol = 2;
228
- if (isDesktop && layoutWidth >= 500) {
229
- numberCol = 3;
230
- }
231
- if (isDesktop && layoutWidth > 767 && layoutWidth < 991) {
232
- numberCol = 4;
233
- }
234
- if (isDesktop && layoutWidth >= 991) {
235
- numberCol = 5;
236
- }
237
- const areaSpace = numberCol * styles.fs15;
238
- const courseWidth = (layoutWidth - areaSpace - 2 * viewPadding) / numberCol;
239
- let view = {};
240
- view.viewPadding = viewPadding;
241
- view.numberCol = numberCol;
242
- view.courseWidth = courseWidth;
243
- return view;
244
- }
245
-
246
- export function getUserOrderLayout(layoutWidth, isDesktop, styles) {
247
- let viewPadding = styles.fs7_5;
248
- let numberCol = 1;
249
- let space = styles.fs15;
250
- if (isDesktop && layoutWidth >= 600) {
251
- numberCol = 2;
252
- space = styles.s30;
253
- }
254
- if (isDesktop && layoutWidth >= 991) {
255
- numberCol = 3;
256
- space = styles.s45;
257
- }
258
- const itemWidth = (layoutWidth - space - 2 * viewPadding) / numberCol;
259
- let view = {};
260
- view.viewPadding = viewPadding;
261
- view.numberCol = numberCol;
262
- view.itemWidth = itemWidth;
263
- return view;
264
- }
265
-
266
- export function getCourseLearingLayout(layoutWidth, isDesktop, styles) {
267
- let sidebarWidth = styles.s0;
268
- let viewPadding = styles.s0;
269
- if (layoutWidth >= 992) {
270
- sidebarWidth = styles.s345;
271
- }
272
- let view = {};
273
- view.sidebarWidth = sidebarWidth;
274
- view.viewPadding = viewPadding;
275
- return view;
276
- }
277
-
278
- export function getScreenWebinarSize(layoutWidth, styles) {
279
- let numberChart = 1;
280
- let padding = styles.s30;
281
- if (layoutWidth >= 500) {
282
- numberChart = 2;
283
- padding = styles.s45;
284
- }
285
- let tmpViewWidth = layoutWidth - padding;
286
- let viewWidth = tmpViewWidth / numberChart;
287
- let view = {};
288
- view.viewWidth = viewWidth;
289
- view.viewPadding = styles.fs15;
290
- return view;
291
- }
package/LayoutAdmin.js DELETED
@@ -1,49 +0,0 @@
1
- export function getLayoutAdmin(layoutWidth, isDesktop, side_bar_width, styles) {
2
- let numberChart = 1;
3
- let padding = styles.s30;
4
- let sideBarWidth = side_bar_width;
5
- let sideBarOpen = false;
6
- let sideBarMiniWidth = styles.s70;
7
- let sideBarSecondWidth = side_bar_width - styles.s70;
8
- if (isDesktop && layoutWidth > styles.base_desktop) {
9
- sideBarWidth = side_bar_width;
10
- }
11
- if (layoutWidth > 600 && layoutWidth < styles.base_desktop) {
12
- numberChart = 2;
13
- padding = styles.s45;
14
- }
15
- if (layoutWidth >= styles.base_desktop && layoutWidth < styles.split_desktop) {
16
- numberChart = 3;
17
- padding = styles.s60;
18
- }
19
- if (layoutWidth >= styles.split_desktop) {
20
- numberChart = 4;
21
- padding = styles.s75;
22
- }
23
- const chartWidth = (layoutWidth - sideBarMiniWidth - padding) / numberChart;
24
- const chartWidthPC = 100 / numberChart;
25
- let view = {};
26
- view.sideBarWidth = sideBarWidth;
27
- view.sideBarMiniWidth = sideBarMiniWidth;
28
- view.sideBarSecondWidth = sideBarSecondWidth;
29
- view.sideBarOpen = sideBarOpen;
30
- view.chartWidth = chartWidth;
31
- view.chartWidthPC = chartWidthPC + "%";
32
- return view;
33
- }
34
-
35
- export function getScreenSizeAdmin(layoutWidth, styles) {
36
- let numberChart = 1;
37
- let padding = styles.s0;
38
- if (layoutWidth > 767) {
39
- numberChart = 2;
40
- padding = styles.s2;
41
- }
42
- const chartWidth = (layoutWidth - padding) / numberChart;
43
- const chartWidthPC = 100 / numberChart;
44
- let view = {};
45
- view.padding = padding;
46
- view.width = chartWidth;
47
- view.widthPC = chartWidthPC + "%";
48
- return view;
49
- }
package/SDK/colors.js DELETED
@@ -1,26 +0,0 @@
1
- export default {
2
- transparent: '#33333300',
3
- cl333: "#333333",
4
- cl33333390: "#33333390",
5
- grey: '#C8C8D5',
6
- red_product: '#FF424E',
7
- primary: '#4056A1',
8
- border_color: '#DADADA80',
9
- background: '#FFFFFF',
10
- green2: "#11b719",
11
- white: '#ffffff',
12
- border: '#DDDDDD',
13
- black: '#24272B',
14
- green: '#09C04C',
15
- tabDefault: '#95989A',
16
- backgroundColor: "#6bb1f1",
17
- cardColor: "#2f73d7",
18
- headColor: "#163b8e",
19
- yellowColor: "#f2d021",
20
- greyColor: "#dddddd",
21
- greenColor: "#5FB35E",
22
- blueColor: "#19B3EF",
23
- redColor: "#f05151",
24
- redRGBAColor: "rgba(240, 81, 81, 0.65)",
25
- headRGBAColor: "rgba(22, 58, 142, 0.5)"
26
- };
package/SDK/styles.js DELETED
@@ -1,137 +0,0 @@
1
- import { Dimensions } from 'react-native';
2
- import mobileCheck from '../helpers/DeviceDetect';
3
-
4
- const DESKTOP = mobileCheck.isMobile ? false : true;
5
- const entireScreenWidth = Dimensions.get('window').width;
6
- const SCREEN_WIDTH = DESKTOP && entireScreenWidth >= 1440 ? 1440 : entireScreenWidth;
7
- const screenWidth = DESKTOP ? Dimensions.get('window').width : 375;
8
- const REM = entireScreenWidth / screenWidth;
9
- const barHeight = DESKTOP ? (57 * REM) : (50 * REM);
10
-
11
- export default {
12
- HEIGHT: Dimensions.get('window').height,
13
- WIDTH: Dimensions.get('window').width,
14
- SCREEN_WIDTH: SCREEN_WIDTH,
15
- DESKTOP: DESKTOP,
16
- REM: REM,
17
- barHeight: barHeight,
18
- headerHeight: mobileCheck.os == "mini_app" ? { height: 39 * REM } : { height: barHeight },
19
- headerRightContainerStyle: mobileCheck.os == "mini_app" ? { paddingRight: 80 * REM } : {},
20
- image_course_width: 356,
21
- image_course_height: 267,
22
- aspectRatio: 16 / 9,
23
- small_logo: 1 / 1,
24
- four_three: 4 / 3,
25
- six_five: 6 / 5,
26
- logo: 96 / 40,
27
- banner: 1200 / 600,
28
- image_course_rate: 9 / 16,
29
- base_banner_width: 345,
30
- base_banner_height: 195,
31
- image_banner_rate: 195 / 345,
32
- activeOpacity: 0.8,
33
- fw800: "800",
34
- fw400: "400",
35
- fw500: "500",
36
- fw600: "600",
37
- fw700: "700",
38
- flexstart: 'flex-start',
39
- flexend: 'flex-end',
40
- lineThrough: 'line-through',
41
- flexWrap: 'wrap',
42
- center: "center",
43
- left: "left",
44
- right: "right",
45
- hidden: "hidden",
46
- fwNormal: 'normal',
47
- fwMedium: 'medium',
48
- fwBold: 'bold',
49
- w20pc: "20%",
50
- w30pc: "30%",
51
- w40pc: "40%",
52
- w45pc: "45%",
53
- w50pc: "50%",
54
- w80pc: "80%",
55
- w85pc: "85%",
56
- w90pc: "90%",
57
- w92pc: "92%",
58
- w100pc: "100%",
59
- w130pc: "130%",
60
- w150pc: "150%",
61
- absolute: "absolute",
62
- uppercase: "uppercase",
63
- spaceBetween: "space-between",
64
- mw500: 500 * REM,
65
- flexRow: 'row',
66
- flexCol: 'column',
67
- textUnderline: 'underline',
68
- textItalic: "italic",
69
- justify: 'justify',
70
- button: {
71
- marginLeft: 20 * REM,
72
- marginRight: 20 * REM,
73
- alignItems: 'center',
74
- justifyContent: 'center',
75
- borderRadius: 5 * REM,
76
- },
77
- buttonTitle: {
78
- fontSize: 15 * REM,
79
- padding: 11 * REM,
80
- fontWeight: 'bold'
81
- },
82
- label: {
83
- marginTop: 10 * REM,
84
- fontWeight: '500',
85
- fontSize: 14 * REM,
86
- marginBottom: 3 * REM,
87
- marginLeft: 20 * REM
88
- },
89
- textInput: {
90
- padding: 10.5 * REM,
91
- marginRight: 20 * REM,
92
- marginLeft: 20 * REM,
93
- borderRadius: 5 * REM,
94
- color: "#333333",
95
- fontSize: 14 * REM,
96
- borderWidth: 1.5 * REM,
97
- borderColor: '#DADADA80'
98
- },
99
- auto: 'auto',
100
- base_desktop: 767,
101
- split_desktop: 991,
102
- wide_split_desktop: 1439,
103
- base: (100 * (335 * REM) / (375 * REM)) + "%",
104
- main_container: {
105
- width: "100%",
106
- maxWidth: 500 * REM,
107
- flex: 1,
108
- margin: 0,
109
- marginLeft: "auto",
110
- marginRight: "auto",
111
- textAlign: 'flex-start'
112
- },
113
- container_text: {
114
- width: 375 * REM,
115
- alignItems: 'flex-start',
116
- marginTop: 20 * REM,
117
- },
118
- shadow: {
119
- shadowColor: "#000",
120
- shadowOffset: {
121
- width: 0,
122
- height: 5 * REM,
123
- },
124
- shadowOpacity: 0.5,
125
- shadowRadius: 8,
126
- elevation: 11,
127
- },
128
- textShadow: {
129
- textShadowColor: 'rgba(255, 255, 255, 0.75)',
130
- textShadowOffset: { width: -1 * REM, height: 2 * REM },
131
- textShadowRadius: 10
132
- }
133
- }
134
-
135
- export function setSize(size) {
136
- return size * REM;
137
- }
@@ -1,5 +0,0 @@
1
- let mobileCheck = {};
2
- mobileCheck.isMobile = true;
3
- mobileCheck.os = "native";
4
-
5
- export default mobileCheck;
@@ -1,9 +0,0 @@
1
- import * as mobiInfos from 'react-device-detect';
2
-
3
- let mobileCheck = mobiInfos;
4
- let os = "browser";
5
- if (typeof window.APP_CONFIG != "undefined" && typeof window.APP_CONFIG.os != "undefined") {
6
- os = window.APP_CONFIG.os;
7
- }
8
- mobileCheck.os = os;
9
- export default mobileCheck;