@jetthai/cuora 1.1.301 → 1.1.302-dev-2
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,14 @@
|
|
|
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.302-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.302-dev-1...v1.1.302-dev-2) (2024-09-04)
|
|
6
|
+
|
|
7
|
+
### [1.1.302-dev-1](https://github.com/jetthai/cuora-module/compare/v1.0.302-dev-1...v1.1.302-dev-1) (2024-09-04)
|
|
8
|
+
|
|
9
|
+
### [1.0.302-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.302...v1.0.302-dev-1) (2024-09-04)
|
|
10
|
+
|
|
11
|
+
### [1.1.302](https://github.com/jetthai/cuora-module/compare/v1.1.301...v1.1.302) (2024-09-02)
|
|
12
|
+
|
|
5
13
|
### [1.1.301](https://github.com/jetthai/cuora-module/compare/v1.1.300...v1.1.301) (2024-09-02)
|
|
6
14
|
|
|
7
15
|
### [1.1.300](https://github.com/jetthai/cuora-module/compare/v1.1.299...v1.1.300) (2024-08-27)
|
package/package.json
CHANGED
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
|
}
|
|
@@ -7,12 +7,14 @@ export default function (request) {
|
|
|
7
7
|
id: 'instant_rebate_activity',
|
|
8
8
|
context: {
|
|
9
9
|
enableCollectButton: false,
|
|
10
|
+
estimateStartTime: null,
|
|
11
|
+
estimateEndTime: null,
|
|
10
12
|
lastCollectTime: null,
|
|
11
13
|
lastEstimateTime: null,
|
|
12
14
|
collectAvailable: false,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
cumulativeValidTurnover: null,
|
|
16
|
+
cumulativeRebateAmount: null,
|
|
17
|
+
actualRebateAmount: null,
|
|
16
18
|
rewardType: null,
|
|
17
19
|
singleMinimumAmountReceive: null,
|
|
18
20
|
remainingCount: 0,
|
|
@@ -120,16 +122,25 @@ export default function (request) {
|
|
|
120
122
|
}
|
|
121
123
|
}),
|
|
122
124
|
setInitData: assign((context, event) => {
|
|
123
|
-
const {
|
|
124
|
-
|
|
125
|
+
const {
|
|
126
|
+
enableCollectButton = false,
|
|
127
|
+
lastCollectTime = 0,
|
|
128
|
+
lastEstimateTime = 0,
|
|
129
|
+
estimateStartTime = 0,
|
|
130
|
+
estimateEndTime = 0,
|
|
131
|
+
rewardType,
|
|
132
|
+
} = event.data
|
|
133
|
+
return { enableCollectButton, lastCollectTime, lastEstimateTime, estimateStartTime, estimateEndTime, rewardType }
|
|
125
134
|
}),
|
|
126
135
|
setEstimateResult: assign((context, event) => {
|
|
127
136
|
const {
|
|
137
|
+
estimateStartTime = 0,
|
|
138
|
+
estimateEndTime = 0,
|
|
128
139
|
lastCollectTime = 0,
|
|
129
140
|
collectAvailable = false,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
141
|
+
cumulativeValidTurnover = '0',
|
|
142
|
+
cumulativeRebateAmount = '0',
|
|
143
|
+
actualRebateAmount = '0',
|
|
133
144
|
rewardType = null,
|
|
134
145
|
singleMinimumAmountReceive = 0,
|
|
135
146
|
remainingCount = 0,
|
|
@@ -137,11 +148,13 @@ export default function (request) {
|
|
|
137
148
|
} = event.data
|
|
138
149
|
|
|
139
150
|
return {
|
|
151
|
+
estimateStartTime,
|
|
152
|
+
estimateEndTime,
|
|
140
153
|
lastCollectTime,
|
|
141
154
|
collectAvailable,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
155
|
+
cumulativeValidTurnover,
|
|
156
|
+
cumulativeRebateAmount,
|
|
157
|
+
actualRebateAmount,
|
|
145
158
|
rewardType,
|
|
146
159
|
singleMinimumAmountReceive,
|
|
147
160
|
remainingCount,
|
|
@@ -151,14 +164,14 @@ export default function (request) {
|
|
|
151
164
|
},
|
|
152
165
|
guards: {
|
|
153
166
|
isEstimatable: (context, event) => {
|
|
154
|
-
const {
|
|
155
|
-
|
|
167
|
+
const { lastEstimateTime } = context
|
|
168
|
+
const currentTime = new Date().getTime() / 1000
|
|
169
|
+
if (Math.floor(`${currentTime}`) === Math.floor(`${lastEstimateTime}`)) {
|
|
156
170
|
return true
|
|
157
171
|
} else {
|
|
158
172
|
const fiveMinutes = 60 * 5
|
|
159
|
-
const currentTime = new Date().getTime() / 1000
|
|
160
173
|
|
|
161
|
-
return
|
|
174
|
+
return Math.floor(`${currentTime}`) - Math.floor(`${lastEstimateTime}`) > fiveMinutes
|
|
162
175
|
}
|
|
163
176
|
},
|
|
164
177
|
isClaimExhausted: (context, event) => {
|
|
@@ -166,29 +179,29 @@ export default function (request) {
|
|
|
166
179
|
return !collectAvailable && parseInt(`${remainingCount}`) === parseInt(`${dailyRedemptionLimit}`)
|
|
167
180
|
},
|
|
168
181
|
isInsufficientAmount: (context, event) => {
|
|
169
|
-
const { collectAvailable, singleMinimumAmountReceive,
|
|
170
|
-
let splitArray =
|
|
182
|
+
const { collectAvailable, singleMinimumAmountReceive, actualRebateAmount } = context
|
|
183
|
+
let splitArray = actualRebateAmount?.split(',')
|
|
171
184
|
let combindString = '0'
|
|
172
185
|
if (splitArray?.length > 0) {
|
|
173
186
|
splitArray.forEach((item) => {
|
|
174
187
|
combindString += item
|
|
175
188
|
})
|
|
176
189
|
} else {
|
|
177
|
-
combindString =
|
|
190
|
+
combindString = actualRebateAmount
|
|
178
191
|
}
|
|
179
192
|
const deformatRebateAmount = parseFloat(`${combindString}`)
|
|
180
193
|
return !collectAvailable && deformatRebateAmount < parseFloat(`${singleMinimumAmountReceive}`)
|
|
181
194
|
},
|
|
182
195
|
isClaimEnable: (context, event) => {
|
|
183
|
-
const { collectAvailable, remainingCount, dailyRedemptionLimit,
|
|
184
|
-
let splitArray =
|
|
196
|
+
const { collectAvailable, remainingCount, dailyRedemptionLimit, actualRebateAmount, singleMinimumAmountReceive } = context
|
|
197
|
+
let splitArray = actualRebateAmount?.split(',')
|
|
185
198
|
let combindString = '0'
|
|
186
199
|
if (splitArray?.length > 0) {
|
|
187
200
|
splitArray.forEach((item) => {
|
|
188
201
|
combindString += item
|
|
189
202
|
})
|
|
190
203
|
} else {
|
|
191
|
-
combindString =
|
|
204
|
+
combindString = actualRebateAmount
|
|
192
205
|
}
|
|
193
206
|
const deformatRebateAmount = parseFloat(combindString)
|
|
194
207
|
return (
|
package/src/machine/inbox.js
CHANGED
|
@@ -344,9 +344,9 @@ export default function (request) {
|
|
|
344
344
|
const isCustomerReply = data[0]?.from === 'SYSTEM'
|
|
345
345
|
let combindedContent = ''
|
|
346
346
|
if (isCustomerReply) {
|
|
347
|
-
combindedContent = '-\n-------------------------\n' + data[0]
|
|
347
|
+
combindedContent = '-\n-------------------------\n' + data[0]?.content || '' + '\n-------------------------\n' + data[1]?.content || ''
|
|
348
348
|
} else {
|
|
349
|
-
combindedContent = `-\n-------------------------\n${data[0]
|
|
349
|
+
combindedContent = `-\n-------------------------\n${data[0]?.content || ''}`
|
|
350
350
|
}
|
|
351
351
|
return {
|
|
352
352
|
messageDetail: data,
|
package/src/machine/index.js
CHANGED
|
@@ -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 {
|
|
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,
|