@jetthai/cuora 1.1.13-4 → 1.1.15-1
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 +3 -5
- package/dist/bundle.mjs +83 -617
- package/package.json +1 -1
- package/src/api/payment.js +0 -9
- package/src/machine/deposit/crypto_button.js +9 -137
- package/src/machine/deposit/loadcard_vn.js +33 -145
- package/src/machine/deposit/qrcode_v2.js +12 -168
- package/src/machine/game_favorite_v2.js +29 -24
- package/src/machine/index.js +0 -2
- package/src/machine/promotions.js +0 -139
package/package.json
CHANGED
package/src/api/payment.js
CHANGED
|
@@ -114,13 +114,4 @@ export default {
|
|
|
114
114
|
method: 'post',
|
|
115
115
|
params: { transferType: 'WITHDRAW', amount },
|
|
116
116
|
}),
|
|
117
|
-
getPromotionsList: () => ({ url: `payment/v2/bankWallet/promotions`, method: 'get' }),
|
|
118
|
-
applyPromotions: ({ promotionsNo, amount }) => ({
|
|
119
|
-
url: `payment/v2/bankWallet/promotion/apply`,
|
|
120
|
-
method: 'post',
|
|
121
|
-
params: {
|
|
122
|
-
promotionsNo,
|
|
123
|
-
amount,
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
126
117
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import padStart from 'lodash/padStart.js'
|
|
3
3
|
import payment from '../../api/payment.js'
|
|
4
|
-
import common from '../../api/common.js'
|
|
5
4
|
|
|
6
5
|
export default function (request) {
|
|
7
|
-
const { appSecret } = request.config
|
|
8
6
|
return createMachine(
|
|
9
7
|
{
|
|
10
8
|
id: 'crypro_button',
|
|
11
9
|
initial: 'loading',
|
|
12
10
|
context: {
|
|
13
|
-
siteConfig: null,
|
|
14
11
|
paymentDetails: [],
|
|
15
12
|
|
|
16
13
|
channels: [],
|
|
@@ -34,127 +31,17 @@ export default function (request) {
|
|
|
34
31
|
states: {
|
|
35
32
|
loading: {
|
|
36
33
|
invoke: {
|
|
37
|
-
src: '
|
|
34
|
+
src: 'fetchPayments',
|
|
38
35
|
onDone: {
|
|
39
|
-
target: '
|
|
40
|
-
actions:
|
|
36
|
+
target: 'loaded',
|
|
37
|
+
actions: 'setCryptos',
|
|
41
38
|
},
|
|
42
39
|
onError: {
|
|
43
40
|
target: 'fail',
|
|
44
41
|
},
|
|
45
42
|
},
|
|
46
43
|
},
|
|
47
|
-
|
|
48
|
-
always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
|
|
49
|
-
},
|
|
50
|
-
promotionApplyMode: {
|
|
51
|
-
initial: 'loaded',
|
|
52
|
-
states: {
|
|
53
|
-
loaded: {
|
|
54
|
-
entry: 'reset',
|
|
55
|
-
on: {
|
|
56
|
-
SET_CHANNEL: {
|
|
57
|
-
actions: 'setChannel',
|
|
58
|
-
},
|
|
59
|
-
SET_CRYPTO: {
|
|
60
|
-
actions: 'setCrypto',
|
|
61
|
-
},
|
|
62
|
-
SET_NETWORK: {
|
|
63
|
-
actions: 'setNetwork',
|
|
64
|
-
},
|
|
65
|
-
SET_ADDRESS: {
|
|
66
|
-
actions: 'setAddress',
|
|
67
|
-
},
|
|
68
|
-
CONFIRM: {
|
|
69
|
-
target: 'selecting',
|
|
70
|
-
cond: 'isConfirmable',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
selecting: {
|
|
75
|
-
entry: 'reset',
|
|
76
|
-
on: {
|
|
77
|
-
SELECT_AMOUNT: [
|
|
78
|
-
{
|
|
79
|
-
actions: 'addAmount',
|
|
80
|
-
cond: (context, event) => context.grandTotalEnable === 1,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
actions: 'setAmount',
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
KEY_IN: {
|
|
87
|
-
actions: 'setAmount',
|
|
88
|
-
},
|
|
89
|
-
SUBMIT: {
|
|
90
|
-
target: 'debouncing',
|
|
91
|
-
},
|
|
92
|
-
BACK: {
|
|
93
|
-
target: 'loaded',
|
|
94
|
-
},
|
|
95
|
-
CLEAR_ALL: {
|
|
96
|
-
actions: 'reset',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
debouncing: {
|
|
101
|
-
on: {
|
|
102
|
-
SELECT_AMOUNT: [
|
|
103
|
-
{
|
|
104
|
-
target: 'debouncing',
|
|
105
|
-
actions: 'addAmount',
|
|
106
|
-
cond: (context, event) => context.grandTotalEnable === 1,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
target: 'debouncing',
|
|
110
|
-
actions: 'setAmount',
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
KEY_IN: {
|
|
114
|
-
target: 'debouncing',
|
|
115
|
-
actions: 'setAmount',
|
|
116
|
-
},
|
|
117
|
-
BACK: {
|
|
118
|
-
target: 'loaded',
|
|
119
|
-
},
|
|
120
|
-
CLEAR_ALL: {
|
|
121
|
-
actions: 'reset',
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
after: {
|
|
125
|
-
1000: {
|
|
126
|
-
target: 'calculating',
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
calculating: {
|
|
131
|
-
invoke: {
|
|
132
|
-
src: 'fetchCalculation',
|
|
133
|
-
onDone: {
|
|
134
|
-
target: 'submitting',
|
|
135
|
-
actions: 'setCalculation',
|
|
136
|
-
},
|
|
137
|
-
onError: {
|
|
138
|
-
target: 'selecting',
|
|
139
|
-
actions: 'reset',
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
submitting: {
|
|
144
|
-
invoke: {
|
|
145
|
-
src: 'submitDeposit',
|
|
146
|
-
onDone: {
|
|
147
|
-
target: '#crypro_button.submitted',
|
|
148
|
-
actions: 'setResult',
|
|
149
|
-
},
|
|
150
|
-
onError: {
|
|
151
|
-
target: 'selecting',
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
defaultMode: {
|
|
44
|
+
loaded: {
|
|
158
45
|
on: {
|
|
159
46
|
SET_CHANNEL: {
|
|
160
47
|
actions: 'setChannel',
|
|
@@ -194,7 +81,7 @@ export default function (request) {
|
|
|
194
81
|
actions: 'setAmount',
|
|
195
82
|
},
|
|
196
83
|
BACK: {
|
|
197
|
-
target: '
|
|
84
|
+
target: 'loaded',
|
|
198
85
|
},
|
|
199
86
|
},
|
|
200
87
|
},
|
|
@@ -289,9 +176,8 @@ export default function (request) {
|
|
|
289
176
|
calculation: null,
|
|
290
177
|
}
|
|
291
178
|
}),
|
|
292
|
-
|
|
293
|
-
const {
|
|
294
|
-
const cryptos = paymentDetail?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || []
|
|
179
|
+
setCryptos: assign((context, event) => {
|
|
180
|
+
const cryptos = event.data?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || []
|
|
295
181
|
const currentPayment = cryptos.find((element) => element.category === context.currentCategory)
|
|
296
182
|
const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart(String(i + 1), 2, '0')}`, icon: 'channel' }))
|
|
297
183
|
const defaultNetworks =
|
|
@@ -315,12 +201,6 @@ export default function (request) {
|
|
|
315
201
|
options,
|
|
316
202
|
}
|
|
317
203
|
}),
|
|
318
|
-
preset: assign((context, event) => {
|
|
319
|
-
const { siteConfig } = event.data
|
|
320
|
-
return {
|
|
321
|
-
siteConfig,
|
|
322
|
-
}
|
|
323
|
-
}),
|
|
324
204
|
setChannel: assign((context, event) => {
|
|
325
205
|
const { cryptos } = context
|
|
326
206
|
const selectedCrypto = cryptos.find((crypto) => crypto.method === event.data.value)
|
|
@@ -400,9 +280,6 @@ export default function (request) {
|
|
|
400
280
|
}),
|
|
401
281
|
},
|
|
402
282
|
guards: {
|
|
403
|
-
isPromotionApplyMode: (context, event) => {
|
|
404
|
-
return context.siteConfig?.promotionApplyMode === '1'
|
|
405
|
-
},
|
|
406
283
|
isConfirmable: (context, event) => {
|
|
407
284
|
const { selectedCrypto, selectedNetwork } = context
|
|
408
285
|
return selectedCrypto && selectedNetwork
|
|
@@ -413,13 +290,8 @@ export default function (request) {
|
|
|
413
290
|
},
|
|
414
291
|
},
|
|
415
292
|
services: {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
request.send(common.getConfig({ appSecret })),
|
|
419
|
-
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
420
|
-
])
|
|
421
|
-
const siteConfig = JSON.parse(window.atob(config))
|
|
422
|
-
return { siteConfig, paymentDetail }
|
|
293
|
+
fetchPayments: async (context, event) => {
|
|
294
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
423
295
|
},
|
|
424
296
|
fetchCalculation: async (context, event) => {
|
|
425
297
|
const { selectedCrypto, selectedAmount } = context
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
-
import common from '../../api/common.js'
|
|
4
3
|
|
|
5
4
|
export default function (request) {
|
|
6
|
-
const { appSecret } = request.config
|
|
7
5
|
return createMachine(
|
|
8
6
|
{
|
|
9
7
|
id: 'loadcard',
|
|
10
8
|
initial: 'loading',
|
|
11
9
|
context: {
|
|
12
|
-
siteConfig: null,
|
|
13
10
|
cards: [],
|
|
14
11
|
options: [],
|
|
15
12
|
|
|
@@ -20,137 +17,26 @@ export default function (request) {
|
|
|
20
17
|
|
|
21
18
|
calculation: null,
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
paymentDetails: [],
|
|
24
21
|
currentCategory: 'loadcard',
|
|
25
22
|
currentMethod: null,
|
|
26
23
|
currentPayment: null,
|
|
24
|
+
result: null,
|
|
27
25
|
},
|
|
28
26
|
states: {
|
|
29
27
|
loading: {
|
|
30
28
|
invoke: {
|
|
31
29
|
src: 'fetchInitData',
|
|
32
30
|
onDone: {
|
|
33
|
-
target: '
|
|
34
|
-
actions:
|
|
31
|
+
target: 'loaded',
|
|
32
|
+
actions: 'setInitData',
|
|
35
33
|
},
|
|
36
34
|
onError: {
|
|
37
35
|
target: 'fail',
|
|
38
36
|
},
|
|
39
37
|
},
|
|
40
38
|
},
|
|
41
|
-
|
|
42
|
-
always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
|
|
43
|
-
},
|
|
44
|
-
promotionApplyMode: {
|
|
45
|
-
initial: 'loaded',
|
|
46
|
-
states: {
|
|
47
|
-
loaded: {
|
|
48
|
-
entry: 'reset',
|
|
49
|
-
on: {
|
|
50
|
-
SELECT_CARD: {
|
|
51
|
-
actions: 'setCard',
|
|
52
|
-
},
|
|
53
|
-
SELECT_AMOUNT: {
|
|
54
|
-
target: 'submittable',
|
|
55
|
-
actions: 'setAmount',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
submittable: {
|
|
60
|
-
on: {
|
|
61
|
-
SELECT_AMOUNT: {
|
|
62
|
-
actions: 'setAmount',
|
|
63
|
-
},
|
|
64
|
-
CONFIRM: {
|
|
65
|
-
target: 'debouncing',
|
|
66
|
-
},
|
|
67
|
-
BACK: {
|
|
68
|
-
target: 'loaded',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
debouncing: {
|
|
73
|
-
on: {
|
|
74
|
-
SELECT_AMOUNT: {
|
|
75
|
-
target: 'debouncing',
|
|
76
|
-
actions: 'setAmount',
|
|
77
|
-
},
|
|
78
|
-
BACK: {
|
|
79
|
-
target: 'loaded',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
after: {
|
|
83
|
-
1000: {
|
|
84
|
-
target: 'calculating',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
calculable: {
|
|
89
|
-
entry: 'clearCalculation',
|
|
90
|
-
on: {
|
|
91
|
-
SELECT_AMOUNT: {
|
|
92
|
-
target: 'debouncing',
|
|
93
|
-
actions: 'setAmount',
|
|
94
|
-
},
|
|
95
|
-
CALCULATE: {
|
|
96
|
-
target: 'debouncing',
|
|
97
|
-
},
|
|
98
|
-
BACK: {
|
|
99
|
-
target: 'loaded',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
calculating: {
|
|
104
|
-
invoke: {
|
|
105
|
-
src: 'fetchCalculation',
|
|
106
|
-
onDone: {
|
|
107
|
-
target: 'cardInfo',
|
|
108
|
-
actions: 'setCalculation',
|
|
109
|
-
},
|
|
110
|
-
onError: {
|
|
111
|
-
target: 'calculable',
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
cardInfo: {
|
|
116
|
-
on: {
|
|
117
|
-
INPUT_CARD_NUMBER: {
|
|
118
|
-
actions: 'setCardNumber',
|
|
119
|
-
},
|
|
120
|
-
INPUT_SERIAL_NUMBER: {
|
|
121
|
-
actions: 'setSerialNumber',
|
|
122
|
-
},
|
|
123
|
-
SUBMIT: {
|
|
124
|
-
target: 'submitting',
|
|
125
|
-
cond: 'isSubmittable',
|
|
126
|
-
},
|
|
127
|
-
SELECT_CARD: {
|
|
128
|
-
target: 'loaded',
|
|
129
|
-
actions: 'setCard',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
submitting: {
|
|
134
|
-
invoke: {
|
|
135
|
-
src: 'submitDeposit',
|
|
136
|
-
onDone: {
|
|
137
|
-
target: 'submitted',
|
|
138
|
-
},
|
|
139
|
-
onError: {
|
|
140
|
-
target: 'cardInfo',
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
submitted: {
|
|
145
|
-
on: {
|
|
146
|
-
BACK: {
|
|
147
|
-
target: 'loaded',
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
defaultMode: {
|
|
39
|
+
loaded: {
|
|
154
40
|
entry: 'reset',
|
|
155
41
|
on: {
|
|
156
42
|
SELECT_CARD: {
|
|
@@ -169,7 +55,7 @@ export default function (request) {
|
|
|
169
55
|
actions: 'setAmount',
|
|
170
56
|
},
|
|
171
57
|
BACK: {
|
|
172
|
-
target: '
|
|
58
|
+
target: 'loaded',
|
|
173
59
|
},
|
|
174
60
|
},
|
|
175
61
|
after: {
|
|
@@ -190,7 +76,7 @@ export default function (request) {
|
|
|
190
76
|
target: 'debouncing',
|
|
191
77
|
},
|
|
192
78
|
BACK: {
|
|
193
|
-
target: '
|
|
79
|
+
target: 'loaded',
|
|
194
80
|
},
|
|
195
81
|
},
|
|
196
82
|
},
|
|
@@ -212,11 +98,17 @@ export default function (request) {
|
|
|
212
98
|
target: 'debouncing',
|
|
213
99
|
actions: 'setAmount',
|
|
214
100
|
},
|
|
215
|
-
CONFIRM:
|
|
216
|
-
|
|
217
|
-
|
|
101
|
+
CONFIRM: [
|
|
102
|
+
{
|
|
103
|
+
target: 'submitting',
|
|
104
|
+
cond: 'jumpLinkEnable',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
target: 'cardInfo',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
218
110
|
BACK: {
|
|
219
|
-
target: '
|
|
111
|
+
target: 'loaded',
|
|
220
112
|
},
|
|
221
113
|
CLEAR_CALCULATION: {
|
|
222
114
|
target: 'debouncing',
|
|
@@ -237,7 +129,7 @@ export default function (request) {
|
|
|
237
129
|
cond: 'isSubmittable',
|
|
238
130
|
},
|
|
239
131
|
SELECT_CARD: {
|
|
240
|
-
target: '
|
|
132
|
+
target: 'loaded',
|
|
241
133
|
actions: 'setCard',
|
|
242
134
|
},
|
|
243
135
|
},
|
|
@@ -247,6 +139,7 @@ export default function (request) {
|
|
|
247
139
|
src: 'submitDeposit',
|
|
248
140
|
onDone: {
|
|
249
141
|
target: 'submitted',
|
|
142
|
+
actions: 'setResult',
|
|
250
143
|
},
|
|
251
144
|
onError: {
|
|
252
145
|
target: 'cardInfo',
|
|
@@ -256,7 +149,7 @@ export default function (request) {
|
|
|
256
149
|
submitted: {
|
|
257
150
|
on: {
|
|
258
151
|
BACK: {
|
|
259
|
-
target: '
|
|
152
|
+
target: 'loaded',
|
|
260
153
|
},
|
|
261
154
|
},
|
|
262
155
|
},
|
|
@@ -273,22 +166,16 @@ export default function (request) {
|
|
|
273
166
|
}
|
|
274
167
|
}),
|
|
275
168
|
setInitData: assign((context, event) => {
|
|
276
|
-
const
|
|
277
|
-
const cards =
|
|
169
|
+
const paymentDetails = event.data
|
|
170
|
+
const cards = paymentDetails.filter((element) => element.category === context.currentCategory)
|
|
278
171
|
return {
|
|
279
|
-
|
|
172
|
+
paymentDetails,
|
|
280
173
|
cards,
|
|
281
174
|
selectedCard: cards[0],
|
|
282
175
|
currentMethod: cards[0].method,
|
|
283
176
|
options: cards[0].optional,
|
|
284
177
|
}
|
|
285
178
|
}),
|
|
286
|
-
preset: assign((context, event) => {
|
|
287
|
-
const { siteConfig } = event.data
|
|
288
|
-
return {
|
|
289
|
-
siteConfig,
|
|
290
|
-
}
|
|
291
|
-
}),
|
|
292
179
|
setCard: assign((context, event) => {
|
|
293
180
|
return {
|
|
294
181
|
selectedCard: event.data,
|
|
@@ -319,24 +206,25 @@ export default function (request) {
|
|
|
319
206
|
calculation: null,
|
|
320
207
|
}
|
|
321
208
|
}),
|
|
209
|
+
setResult: assign((context, event) => {
|
|
210
|
+
return {
|
|
211
|
+
result: event.data,
|
|
212
|
+
}
|
|
213
|
+
}),
|
|
322
214
|
},
|
|
323
215
|
guards: {
|
|
324
|
-
isPromotionApplyMode: (context, event) => {
|
|
325
|
-
return context.siteConfig?.promotionApplyMode === '1'
|
|
326
|
-
},
|
|
327
216
|
isSubmittable: (context, event) => {
|
|
328
217
|
const { cardNumber, serialNumber } = context
|
|
329
218
|
return cardNumber && serialNumber
|
|
330
219
|
},
|
|
220
|
+
jumpLinkEnable: (context, event) => {
|
|
221
|
+
const { selectedCard } = context
|
|
222
|
+
return selectedCard.jumpLinkEnable === 1
|
|
223
|
+
},
|
|
331
224
|
},
|
|
332
225
|
services: {
|
|
333
226
|
fetchInitData: async (context, event) => {
|
|
334
|
-
|
|
335
|
-
request.send(common.getConfig({ appSecret })),
|
|
336
|
-
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
337
|
-
])
|
|
338
|
-
const siteConfig = JSON.parse(window.atob(config))
|
|
339
|
-
return { siteConfig, paymentDetail }
|
|
227
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
340
228
|
},
|
|
341
229
|
fetchCalculation: async (context, event) => {
|
|
342
230
|
const { currentMethod, selectedAmount } = context
|