@jetthai/cuora 1.1.293-dev-3 → 1.1.293-dev-5

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.293-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.296...v1.1.293-dev-5) (2024-08-20)
6
+
7
+ ### [1.1.293-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.293-dev-3...v1.1.293-dev-4) (2024-08-20)
8
+
5
9
  ### [1.1.293-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.295...v1.1.293-dev-3) (2024-08-17)
6
10
 
7
11
  ### [1.1.293-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.293-dev-1...v1.1.293-dev-2) (2024-08-16)
@@ -12,6 +16,10 @@ All notable changes to this project will be documented in this file. See [standa
12
16
 
13
17
  ### [1.1.294](https://github.com/jetthai/cuora-module/compare/v1.1.293...v1.1.294) (2024-08-14)
14
18
 
19
+ ### [1.1.293-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.293-dev-3...v1.1.293-dev-4) (2024-08-20)
20
+
21
+ ### [1.1.293-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.295...v1.1.293-dev-3) (2024-08-17)
22
+
15
23
  ### [1.1.293-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.293-dev-1...v1.1.293-dev-2) (2024-08-16)
16
24
 
17
25
  ### [1.1.293-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.293-dev...v1.1.293-dev-1) (2024-08-15)
@@ -20,6 +28,18 @@ All notable changes to this project will be documented in this file. See [standa
20
28
 
21
29
  ### [1.1.294](https://github.com/jetthai/cuora-module/compare/v1.1.293...v1.1.294) (2024-08-14)
22
30
 
31
+ ### [1.1.293-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.293-dev-1...v1.1.293-dev-2) (2024-08-16)
32
+
33
+ ### [1.1.293-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.293-dev...v1.1.293-dev-1) (2024-08-15)
34
+
35
+ ### [1.1.293-dev](https://github.com/jetthai/cuora-module/compare/v1.1.294...v1.1.293-dev) (2024-08-15)
36
+
37
+ ### [1.1.294](https://github.com/jetthai/cuora-module/compare/v1.1.293...v1.1.294) (2024-08-14)
38
+
39
+ ### [1.1.296](https://github.com/jetthai/cuora-module/compare/v1.1.295...v1.1.296) (2024-08-20)
40
+
41
+ ### [1.1.295](https://github.com/jetthai/cuora-module/compare/v1.1.293...v1.1.295) (2024-08-17)
42
+
23
43
  ### [1.1.293](https://github.com/jetthai/cuora-module/compare/v1.1.292...v1.1.293) (2024-08-14)
24
44
 
25
45
  ### [1.1.292](https://github.com/jetthai/cuora-module/compare/v1.1.291...v1.1.292) (2024-08-12)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.293-dev-3",
3
+ "version": "1.1.293-dev-5",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/common.js CHANGED
@@ -4,4 +4,5 @@ export default {
4
4
  feeds: ({ appSecret }) => ({ url: 'feeds', method: 'get', params: { appSecret }, isPublic: true }),
5
5
  broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
6
6
  getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
7
+ getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
7
8
  }
@@ -244,7 +244,14 @@ export default function (request, context) {
244
244
  isSubmittable: (context, event) => {
245
245
  const { selectedCrypto, selectedAddress, selectedAmount, depositTime, receipt, calculation, siteConfig } = context
246
246
  const { bankDepositProofIsOptional = '1' } = siteConfig
247
- return selectedCrypto && selectedAddress && selectedAmount && depositTime && calculation && (receipt || bankDepositProofIsOptional === '0')
247
+ return (
248
+ selectedCrypto &&
249
+ selectedAddress &&
250
+ selectedAmount &&
251
+ (bankDepositProofIsOptional === '2' ? true : depositTime) &&
252
+ calculation &&
253
+ (receipt || bankDepositProofIsOptional !== '1')
254
+ )
248
255
  },
249
256
  },
250
257
  services: {
@@ -35,6 +35,7 @@ import promotions from './promotions.js'
35
35
  import roulette_v2 from './roulette_v2.js'
36
36
  import honor_board_cash from './honor_board_cash.js'
37
37
  import user_photo from './user_photo.js'
38
+ import navbar from './navbar.js'
38
39
 
39
40
  export default {
40
41
  ...activity,
@@ -73,5 +74,6 @@ export default {
73
74
  roulette_v2,
74
75
  honor_board_cash,
75
76
  user_photo,
77
+ navbar,
76
78
  ...withdraw,
77
79
  }
@@ -0,0 +1,57 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import common from '../api/common.js'
3
+
4
+ export default function (request) {
5
+ const { appSecret } = request.config
6
+ return createMachine(
7
+ {
8
+ id: 'navbar',
9
+ initial: 'fetching',
10
+ context: {
11
+ navbar: null,
12
+ },
13
+ states: {
14
+ fetching: {
15
+ invoke: {
16
+ src: 'fetchNavbar',
17
+ onDone: {
18
+ target: 'idle',
19
+ actions: 'setNavbar',
20
+ },
21
+ onError: {
22
+ target: 'idle',
23
+ },
24
+ },
25
+ },
26
+ idle: {},
27
+ },
28
+ },
29
+ {
30
+ actions: {
31
+ setNavbar: assign((context, event) => {
32
+ const { navbarConfig } = event.data
33
+ return {
34
+ navbar: navbarConfig,
35
+ }
36
+ }),
37
+ },
38
+ services: {
39
+ fetchNavbar: async (context, event) => {
40
+ const navbar = await request.send(common.getNavbar({ appSecret }))
41
+ const base64Url = navbar.config.split('.')[0]
42
+ const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
43
+ const decodeResult = decodeURIComponent(
44
+ window
45
+ .atob(base64)
46
+ .split('')
47
+ .map((c) => {
48
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
49
+ })
50
+ .join('')
51
+ )
52
+ return { navbarConfig: JSON.parse(decodeResult) }
53
+ },
54
+ },
55
+ }
56
+ )
57
+ }