@jetthai/cuora 1.1.65-doubleWallet → 1.1.65-doubleWallet-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.65-doubleWallet",
3
+ "version": "1.1.65-doubleWallet-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -48,58 +48,48 @@ export default function (request) {
48
48
  },
49
49
  },
50
50
  },
51
- loaded: {
52
- type: 'parallel',
53
- states: {
54
- bonusPreview: {
55
- initial: 'checking',
56
- states: {
57
- checking: {
58
- always: [
59
- {
60
- target: 'fetching',
61
- cond: (context, event) => {
62
- const { siteConfig = {}, promotion = {} } = context
63
- return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
64
- },
65
- },
66
- { target: 'end' },
67
- ],
68
- },
69
- fetching: {
70
- invoke: {
71
- src: 'fetchBonusPreview',
72
- onDone: {
73
- target: 'end',
74
- actions: 'setBonusPreview',
75
- },
76
- onError: {
77
- target: 'end',
78
- },
79
- },
80
- },
81
- end: {},
51
+ checking: {
52
+ always: [
53
+ {
54
+ target: 'fetching',
55
+ cond: (context, event) => {
56
+ const { siteConfig = {}, promotion = {} } = context
57
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
58
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
82
59
  },
83
60
  },
84
- idle: {
85
- on: {
86
- SET_CHANNEL: {
87
- actions: 'setChannel',
88
- },
89
- SET_CRYPTO: {
90
- actions: 'setCrypto',
91
- },
92
- SET_NETWORK: {
93
- actions: 'setNetwork',
94
- },
95
- SET_ADDRESS: {
96
- actions: 'setAddress',
97
- },
98
- CONFIRM: {
99
- target: '#crypro_button.selecting',
100
- cond: 'isConfirmable',
101
- },
102
- },
61
+ { target: 'loaded' },
62
+ ],
63
+ },
64
+ fetching: {
65
+ invoke: {
66
+ src: 'fetchBonusPreview',
67
+ onDone: {
68
+ target: 'loaded',
69
+ actions: 'setBonusPreview',
70
+ },
71
+ onError: {
72
+ target: 'loaded',
73
+ },
74
+ },
75
+ },
76
+ loaded: {
77
+ on: {
78
+ SET_CHANNEL: {
79
+ actions: 'setChannel',
80
+ },
81
+ SET_CRYPTO: {
82
+ actions: 'setCrypto',
83
+ },
84
+ SET_NETWORK: {
85
+ actions: 'setNetwork',
86
+ },
87
+ SET_ADDRESS: {
88
+ actions: 'setAddress',
89
+ },
90
+ CONFIRM: {
91
+ target: 'selecting',
92
+ cond: 'isConfirmable',
103
93
  },
104
94
  },
105
95
  },
@@ -407,17 +397,18 @@ export default function (request) {
407
397
  })
408
398
  },
409
399
  fetchCalculation: async (context, event) => {
410
- const { selectedCrypto, selectedAmount } = context
400
+ const { selectedCrypto, selectedAmount, promotion } = context
411
401
  return await request.send(
412
402
  payment.getDepositExpectedResult({
413
403
  method: selectedCrypto.method,
414
404
  amount: selectedAmount,
415
405
  cryptoCurrency: selectedCrypto.channel,
406
+ promotionsNo: promotion?.activityNo,
416
407
  })
417
408
  )
418
409
  },
419
410
  submitDeposit: async (context, event) => {
420
- const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context
411
+ const { selectedCrypto, selectedNetwork, calculation, sourceAddress, promotion } = context
421
412
  return await request.send(
422
413
  payment.submitDepositTransactionCrypto({
423
414
  method: selectedCrypto.method,
@@ -425,6 +416,7 @@ export default function (request) {
425
416
  cryptoCurrency: selectedCrypto.channel,
426
417
  cryptoNetwork: selectedNetwork.value,
427
418
  sourceAddress: sourceAddress,
419
+ promotionsNo: promotion?.activityNo,
428
420
  })
429
421
  )
430
422
  },
@@ -66,58 +66,51 @@ export default function (request) {
66
66
  },
67
67
  },
68
68
  },
69
- loaded: {
70
- type: 'parallel',
71
- entry: 'reset',
72
- states: {
73
- bonusPreview: {
74
- initial: 'checking',
75
- states: {
76
- checking: {
77
- always: [
78
- {
79
- target: 'fetching',
80
- cond: (context, event) => {
81
- const { siteConfig = {}, promotion = {} } = context
82
- return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
83
- },
84
- },
85
- { target: 'end' },
86
- ],
87
- },
88
- fetching: {
89
- invoke: {
90
- src: 'fetchBonusPreview',
91
- onDone: {
92
- target: 'end',
93
- actions: 'setBonusPreview',
94
- },
95
- onError: {
96
- target: 'end',
97
- },
98
- },
99
- },
100
- end: {},
69
+ checking: {
70
+ always: [
71
+ {
72
+ target: 'fetching',
73
+ cond: (context, event) => {
74
+ const { siteConfig = {}, promotion = {} } = context
75
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
76
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
101
77
  },
102
78
  },
103
- idle: {
104
- on: {
105
- SELECT_AMOUNT: [
106
- {
107
- target: '#float.debouncing',
108
- actions: 'addAmount',
109
- cond: (context, event) => context.grandTotalEnable === 1,
110
- },
111
- {
112
- target: '#float.debouncing',
113
- actions: 'setAmount',
114
- },
115
- ],
116
- KEY_IN: {
117
- target: '#float.calculating',
118
- actions: 'setAmount',
119
- },
79
+ { target: 'loaded' },
80
+ ],
81
+ },
82
+ fetching: {
83
+ invoke: {
84
+ src: 'fetchBonusPreview',
85
+ onDone: {
86
+ target: 'loaded',
87
+ actions: 'setBonusPreview',
88
+ },
89
+ onError: {
90
+ target: 'loaded',
91
+ },
92
+ },
93
+ },
94
+ loaded: {
95
+ on: {
96
+ SELECT_AMOUNT: [
97
+ {
98
+ target: 'debouncing',
99
+ actions: 'addAmount',
100
+ cond: 'isGrandTotalEnable',
120
101
  },
102
+ {
103
+ target: 'debouncing',
104
+ actions: 'setAmount',
105
+ },
106
+ ],
107
+ KEY_IN: {
108
+ target: 'calculating',
109
+ actions: 'setAmount',
110
+ },
111
+ CLEAR_CALCULATION: {
112
+ target: 'debouncing',
113
+ actions: 'clearCalculation',
121
114
  },
122
115
  },
123
116
  },
@@ -127,7 +120,7 @@ export default function (request) {
127
120
  {
128
121
  target: 'debouncing',
129
122
  actions: 'addAmount',
130
- cond: (context, event) => context.grandTotalEnable === 1,
123
+ cond: 'isGrandTotalEnable',
131
124
  },
132
125
  {
133
126
  target: 'debouncing',
@@ -138,9 +131,6 @@ export default function (request) {
138
131
  target: 'debouncing',
139
132
  actions: 'setAmount',
140
133
  },
141
- BACK: {
142
- target: 'loaded',
143
- },
144
134
  },
145
135
  after: {
146
136
  1000: {
@@ -155,7 +145,7 @@ export default function (request) {
155
145
  {
156
146
  target: 'debouncing',
157
147
  actions: 'addAmount',
158
- cond: (context, event) => context.grandTotalEnable === 1,
148
+ cond: 'isGrandTotalEnable',
159
149
  },
160
150
  {
161
151
  target: 'debouncing',
@@ -166,11 +156,12 @@ export default function (request) {
166
156
  target: 'debouncing',
167
157
  actions: 'setAmount',
168
158
  },
169
- CALCULATE: {
159
+ CLEAR_CALCULATION: {
170
160
  target: 'debouncing',
161
+ actions: 'clearCalculation',
171
162
  },
172
- BACK: {
173
- target: 'loaded',
163
+ CLEAR: {
164
+ actions: 'setAmount',
174
165
  },
175
166
  },
176
167
  },
@@ -192,7 +183,7 @@ export default function (request) {
192
183
  {
193
184
  target: 'debouncing',
194
185
  actions: 'addAmount',
195
- cond: (context, event) => context.grandTotalEnable === 1,
186
+ cond: 'isGrandTotalEnable',
196
187
  },
197
188
  {
198
189
  target: 'debouncing',
@@ -206,8 +197,8 @@ export default function (request) {
206
197
  CONFIRM: {
207
198
  target: 'submitting',
208
199
  },
209
- BACK: {
210
- target: 'loaded',
200
+ CLEAR: {
201
+ actions: 'setAmount',
211
202
  },
212
203
  CLEAR_CALCULATION: {
213
204
  target: 'debouncing',
@@ -218,7 +209,10 @@ export default function (request) {
218
209
  submitting: {
219
210
  invoke: {
220
211
  src: 'submitDeposit',
221
- onDone: { target: 'countdown', actions: 'setHouseBank' },
212
+ onDone: {
213
+ target: 'countdown',
214
+ actions: 'setHouseBank',
215
+ },
222
216
  onError: {
223
217
  target: 'calculated',
224
218
  },
@@ -293,7 +287,9 @@ export default function (request) {
293
287
  }
294
288
  }),
295
289
  setAmount: assign((context, event) => {
296
- return { amount: event.data }
290
+ return {
291
+ amount: event.data,
292
+ }
297
293
  }),
298
294
  setCalculation: assign((context, event) => {
299
295
  return {
@@ -316,6 +312,9 @@ export default function (request) {
316
312
  hasUserAccount: (context, event) => {
317
313
  return event.data.bankInfo?.[0]
318
314
  },
315
+ isGrandTotalEnable: (context, event) => {
316
+ return context.grandTotalEnable === 1
317
+ },
319
318
  },
320
319
  services: {
321
320
  fetchPaymentInfo: async (context, event) => {
@@ -35,7 +35,7 @@ export default function (request) {
35
35
  invoke: {
36
36
  src: 'fetchInitData',
37
37
  onDone: {
38
- target: 'loaded',
38
+ target: 'checking',
39
39
  actions: 'setInitData',
40
40
  },
41
41
  onError: {
@@ -43,59 +43,60 @@ export default function (request) {
43
43
  },
44
44
  },
45
45
  },
46
+ checking: {
47
+ always: [
48
+ {
49
+ target: 'fetching',
50
+ cond: (context, event) => {
51
+ const { siteConfig = {}, promotion = {} } = context
52
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
53
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
54
+ },
55
+ },
56
+ { target: 'loaded' },
57
+ ],
58
+ },
59
+ fetching: {
60
+ invoke: {
61
+ src: 'fetchBonusPreview',
62
+ onDone: {
63
+ target: 'loaded',
64
+ actions: 'setBonusPreview',
65
+ },
66
+ onError: {
67
+ target: 'loaded',
68
+ },
69
+ },
70
+ },
46
71
  fail: {},
47
72
  loaded: {
48
- type: 'parallel',
49
73
  entry: 'reset',
50
- states: {
51
- bonusPreview: {
52
- initial: 'checking',
53
- states: {
54
- checking: {
55
- always: [
56
- {
57
- target: 'fetching',
58
- cond: (context, event) => {
59
- const { siteConfig = {}, promotion = {} } = context
60
- return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
61
- },
62
- },
63
- { target: 'end' },
64
- ],
65
- },
66
- fetching: {
67
- invoke: {
68
- src: 'fetchBonusPreview',
69
- onDone: {
70
- target: 'end',
71
- actions: 'setBonusPreview',
72
- },
73
- onError: {
74
- target: 'end',
75
- },
76
- },
74
+ on: {
75
+ SELECT_CARD: [
76
+ {
77
+ target: 'fetching',
78
+ actions: 'setCard',
79
+ cond: (context, event) => {
80
+ const { siteConfig = {}, promotion = {} } = context
81
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
82
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
77
83
  },
78
- end: {},
79
84
  },
80
- },
81
- idle: {
82
- on: {
83
- SELECT_CARD: {
84
- actions: 'setCard',
85
- },
86
- SELECT_AMOUNT: [
87
- {
88
- target: '#loadcard.pending',
89
- actions: 'setAmount',
90
- cond: 'isFreeWalletMode',
91
- },
92
- {
93
- target: '#loadcard.debouncing',
94
- actions: 'setAmount',
95
- },
96
- ],
85
+ {
86
+ actions: 'setCard',
97
87
  },
98
- },
88
+ ],
89
+ SELECT_AMOUNT: [
90
+ {
91
+ target: 'pending',
92
+ actions: 'setAmount',
93
+ cond: 'isFreeWalletMode',
94
+ },
95
+ {
96
+ target: 'debouncing',
97
+ actions: 'setAmount',
98
+ },
99
+ ],
99
100
  },
100
101
  },
101
102
  pending: {
@@ -187,10 +188,21 @@ export default function (request) {
187
188
  target: 'submitting',
188
189
  cond: 'isSubmittable',
189
190
  },
190
- SELECT_CARD: {
191
- target: 'loaded',
192
- actions: 'setCard',
193
- },
191
+ SELECT_CARD: [
192
+ {
193
+ target: 'fetching',
194
+ actions: 'setCard',
195
+ cond: (context, event) => {
196
+ const { siteConfig = {}, promotion = {} } = context
197
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
198
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
199
+ },
200
+ },
201
+ {
202
+ target: 'loaded',
203
+ actions: 'setCard',
204
+ },
205
+ ],
194
206
  },
195
207
  },
196
208
  submitting: {
@@ -46,98 +46,91 @@ export default function (request) {
46
46
  checking: {
47
47
  always: [
48
48
  {
49
- target: 'loaded',
50
- cond: 'isDoubleWalletMode',
49
+ target: 'fetching',
50
+ cond: (context, event) => {
51
+ const { siteConfig = {}, promotion = {} } = context
52
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
53
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
54
+ },
51
55
  },
52
56
  {
53
57
  target: 'debouncing',
54
58
  actions: 'setPromotionDefaultAmount',
55
- cond: 'hasMinPromotionDeposit',
59
+ cond: (context, event) => {
60
+ const { siteConfig = {}, promotion = {} } = context
61
+ return siteConfig.walletMode === '3' && !!promotion?.minimumAmount
62
+ },
56
63
  },
57
64
  { target: 'loaded' },
58
65
  ],
59
66
  },
67
+ fetching: {
68
+ invoke: {
69
+ src: 'fetchBonusPreview',
70
+ onDone: {
71
+ target: 'loaded',
72
+ actions: 'setBonusPreview',
73
+ },
74
+ onError: {
75
+ target: 'loaded',
76
+ },
77
+ },
78
+ },
60
79
  fail: {},
61
80
  loaded: {
62
- type: 'parallel',
63
81
  entry: 'reset',
64
- states: {
65
- bonusPreview: {
66
- initial: 'checking',
67
- states: {
68
- checking: {
69
- always: [
70
- {
71
- target: 'fetching',
72
- cond: (context, event) => {
73
- const { siteConfig = {}, promotion = {} } = context
74
- return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
75
- },
76
- },
77
- { target: 'end' },
78
- ],
79
- },
80
- fetching: {
81
- invoke: {
82
- src: 'fetchBonusPreview',
83
- onDone: {
84
- target: 'end',
85
- actions: 'setBonusPreview',
86
- },
87
- onError: {
88
- target: 'end',
89
- },
90
- },
82
+ on: {
83
+ SELECT_QRCODE: [
84
+ {
85
+ target: 'fetching',
86
+ actions: 'setQrcode',
87
+ cond: (context, event) => {
88
+ const { siteConfig = {}, promotion = {} } = context
89
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
90
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
91
91
  },
92
- end: {},
93
92
  },
94
- },
95
- idle: {
96
- on: {
97
- SELECT_QRCODE: [
98
- {
99
- target: '#qrcode.debouncing',
100
- actions: ['setQrcode', 'setPromotionDefaultAmount'],
101
- cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
102
- },
103
- {
104
- actions: 'setQrcode',
105
- },
106
- ],
107
- SELECT_AMOUNT: [
108
- {
109
- target: '#qrcode.pending',
110
- actions: 'addAmount',
111
- cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
112
- },
113
- {
114
- target: '#qrcode.pending',
115
- actions: 'setAmount',
116
- cond: 'isFreeWalletMode',
117
- },
118
- {
119
- target: '#qrcode.debouncing',
120
- actions: 'addAmount',
121
- cond: 'isGrandTotalEnable',
122
- },
123
- {
124
- target: '#qrcode.debouncing',
125
- actions: 'setAmount',
126
- },
127
- ],
128
- KEY_IN: [
129
- {
130
- target: '#qrcode.pending',
131
- actions: 'setAmount',
132
- cond: 'isFreeWalletMode',
133
- },
134
- {
135
- target: '#qrcode.calculating',
136
- actions: 'setAmount',
137
- },
138
- ],
93
+ {
94
+ target: 'debouncing',
95
+ actions: ['setQrcode', 'setPromotionDefaultAmount'],
96
+ cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
139
97
  },
140
- },
98
+ {
99
+ actions: 'setQrcode',
100
+ },
101
+ ],
102
+ SELECT_AMOUNT: [
103
+ {
104
+ target: 'pending',
105
+ actions: 'addAmount',
106
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
107
+ },
108
+ {
109
+ target: 'pending',
110
+ actions: 'setAmount',
111
+ cond: 'isFreeWalletMode',
112
+ },
113
+ {
114
+ target: 'debouncing',
115
+ actions: 'addAmount',
116
+ cond: 'isGrandTotalEnable',
117
+ },
118
+ {
119
+ target: 'debouncing',
120
+ actions: 'setAmount',
121
+ },
122
+ ],
123
+ KEY_IN: [
124
+ {
125
+ target: 'pending',
126
+ actions: 'setAmount',
127
+ cond: 'isFreeWalletMode',
128
+ },
129
+ {
130
+ target: 'calculating',
131
+ actions: 'setAmount',
132
+ },
133
+ ],
141
134
  },
142
135
  },
143
136
  pending: {
@@ -300,10 +293,21 @@ export default function (request) {
300
293
  },
301
294
  submitted: {
302
295
  on: {
303
- SELECT_QRCODE: {
304
- target: 'loaded',
305
- actions: 'setQrcode',
306
- },
296
+ SELECT_QRCODE: [
297
+ {
298
+ target: 'fetching',
299
+ actions: 'setQrcode',
300
+ cond: (context, event) => {
301
+ const { siteConfig = {}, promotion = {} } = context
302
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
303
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
304
+ },
305
+ },
306
+ {
307
+ target: 'loaded',
308
+ actions: 'setQrcode',
309
+ },
310
+ ],
307
311
  },
308
312
  },
309
313
  },
@@ -385,15 +389,9 @@ export default function (request) {
385
389
  isFreeWalletMode: (context, event) => {
386
390
  return context.siteConfig?.walletMode === '2'
387
391
  },
388
- isDoubleWalletMode: (context, event) => {
389
- return context.siteConfig?.walletMode === '4'
390
- },
391
392
  isGrandTotalEnable: (context, event) => {
392
393
  return context.grandTotalEnable === 1
393
394
  },
394
- hasMinPromotionDeposit: (context, event) => {
395
- return context.promotion?.minimumAmount
396
- },
397
395
  },
398
396
  services: {
399
397
  fetchInitData: async (context, event) => {