@jetthai/cuora 1.1.302 → 1.1.304-sl

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,12 @@
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.304-sl](https://github.com/jetthai/cuora-module/compare/v1.1.304...v1.1.304-sl) (2024-09-09)
6
+
7
+ ### [1.1.304](https://github.com/jetthai/cuora-module/compare/v1.1.303...v1.1.304) (2024-09-09)
8
+
9
+ ### [1.1.303](https://github.com/jetthai/cuora-module/compare/v1.1.302...v1.1.303) (2024-09-09)
10
+
5
11
  ### [1.1.302](https://github.com/jetthai/cuora-module/compare/v1.1.301...v1.1.302) (2024-09-02)
6
12
 
7
13
  ### [1.1.301](https://github.com/jetthai/cuora-module/compare/v1.1.300...v1.1.301) (2024-09-02)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.302",
3
+ "version": "1.1.304-sl",
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
  }
@@ -166,13 +166,25 @@ export default function (request) {
166
166
  invoke: {
167
167
  src: 'checkDeviceToken',
168
168
  onDone: {
169
- target: 'fetching',
169
+ target: 'checkDeviceTokenDone',
170
170
  },
171
171
  onError: {
172
172
  target: 'fetching',
173
173
  },
174
174
  },
175
175
  },
176
+ checkDeviceTokenDone: {
177
+ invoke: {
178
+ src: 'fetchUserInfo',
179
+ onDone: {
180
+ target: 'pending',
181
+ actions: ['setUserInfo', 'extendToken'],
182
+ },
183
+ onError: {
184
+ target: '#auth.leaving',
185
+ },
186
+ },
187
+ },
176
188
  fetching: {
177
189
  invoke: {
178
190
  src: 'fetchUserInfo',
@@ -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.settings,
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
+ }
@@ -143,7 +143,21 @@ export default function (request) {
143
143
  }
144
144
  }),
145
145
  setSignUpEmail: assign((context, event) => {
146
- const { email, nick_name, password, channel, subchannel, bankCode, bankAccount, holderName, branch, branchCode, affiliateCode } = event.data
146
+ const {
147
+ email,
148
+ nick_name,
149
+ password,
150
+ channel,
151
+ subchannel,
152
+ bankCode,
153
+ bankAccount,
154
+ holderName,
155
+ branch,
156
+ branchCode,
157
+ affiliateCode,
158
+ countryCode,
159
+ phone,
160
+ } = event.data
147
161
  return {
148
162
  signUpData: {
149
163
  provider: 'email',
@@ -156,6 +170,8 @@ export default function (request) {
156
170
  branch,
157
171
  branchCode,
158
172
  affiliateCode,
173
+ countryCode,
174
+ phone,
159
175
  },
160
176
  channel,
161
177
  subchannel,