@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.
@@ -59,7 +59,7 @@ export default function (request) {
59
59
  actions: ['setInitialization', 'setPreviousOrder'],
60
60
  cond: 'hasPreviousOrder',
61
61
  },
62
- { target: '#vpay.loaded', actions: 'setInitialization' },
62
+ { target: '#vpay.checking', actions: 'setInitialization' },
63
63
  ],
64
64
  onError: {
65
65
  target: '#vpay.unavailable',
@@ -68,58 +68,52 @@ export default function (request) {
68
68
  },
69
69
  },
70
70
  },
71
+ checking: {
72
+ always: [
73
+ {
74
+ target: 'fetching',
75
+ cond: (context, event) => {
76
+ const { siteConfig = {}, promotion = {} } = context
77
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
78
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
79
+ },
80
+ },
81
+ { target: 'loaded' },
82
+ ],
83
+ },
84
+ fetching: {
85
+ invoke: {
86
+ src: 'fetchBonusPreview',
87
+ onDone: {
88
+ target: 'loaded',
89
+ actions: 'setBonusPreview',
90
+ },
91
+ onError: {
92
+ target: 'loaded',
93
+ },
94
+ },
95
+ },
71
96
  loaded: {
72
- type: 'parallel',
73
97
  entry: 'reset',
74
- states: {
75
- bonusPreview: {
76
- initial: 'checking',
77
- states: {
78
- checking: {
79
- always: [
80
- {
81
- target: 'fetching',
82
- cond: (context, event) => {
83
- const { siteConfig = {}, promotion = {} } = context
84
- return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
85
- },
86
- },
87
- { target: 'end' },
88
- ],
89
- },
90
- fetching: {
91
- invoke: {
92
- src: 'fetchBonusPreview',
93
- onDone: {
94
- target: 'end',
95
- actions: 'setBonusPreview',
96
- },
97
- onError: {
98
- target: 'end',
99
- },
100
- },
101
- },
102
- end: {},
98
+ on: {
99
+ SELECT_AMOUNT: [
100
+ {
101
+ target: 'debouncing',
102
+ actions: 'addAmount',
103
+ cond: 'isGrandTotalEnable',
103
104
  },
104
- },
105
- idle: {
106
- on: {
107
- SELECT_AMOUNT: [
108
- {
109
- target: '#vpay.debouncing',
110
- actions: 'addAmount',
111
- cond: (context, event) => context.grandTotalEnable === 1,
112
- },
113
- {
114
- target: '#vpay.debouncing',
115
- actions: 'setAmount',
116
- },
117
- ],
118
- KEY_IN: {
119
- target: '#vpay.calculating',
120
- actions: 'setAmount',
121
- },
105
+ {
106
+ target: 'debouncing',
107
+ actions: 'setAmount',
122
108
  },
109
+ ],
110
+ KEY_IN: {
111
+ target: 'calculating',
112
+ actions: 'setAmount',
113
+ },
114
+ CLEAR_CALCULATION: {
115
+ target: 'debouncing',
116
+ actions: 'clearCalculation',
123
117
  },
124
118
  },
125
119
  },
@@ -129,7 +123,7 @@ export default function (request) {
129
123
  {
130
124
  target: 'debouncing',
131
125
  actions: 'addAmount',
132
- cond: (context, event) => context.grandTotalEnable === 1,
126
+ cond: 'isGrandTotalEnable',
133
127
  },
134
128
  {
135
129
  target: 'debouncing',
@@ -140,9 +134,6 @@ export default function (request) {
140
134
  target: 'debouncing',
141
135
  actions: 'setAmount',
142
136
  },
143
- BACK: {
144
- target: 'loaded',
145
- },
146
137
  },
147
138
  after: {
148
139
  1000: {
@@ -157,7 +148,7 @@ export default function (request) {
157
148
  {
158
149
  target: 'debouncing',
159
150
  actions: 'addAmount',
160
- cond: (context, event) => context.grandTotalEnable === 1,
151
+ cond: 'isGrandTotalEnable',
161
152
  },
162
153
  {
163
154
  target: 'debouncing',
@@ -168,11 +159,12 @@ export default function (request) {
168
159
  target: 'debouncing',
169
160
  actions: 'setAmount',
170
161
  },
171
- CALCULATE: {
162
+ CLEAR_CALCULATION: {
172
163
  target: 'debouncing',
164
+ actions: 'clearCalculation',
173
165
  },
174
- BACK: {
175
- target: 'loaded',
166
+ CLEAR: {
167
+ actions: 'setAmount',
176
168
  },
177
169
  },
178
170
  },
@@ -194,7 +186,7 @@ export default function (request) {
194
186
  {
195
187
  target: 'debouncing',
196
188
  actions: 'addAmount',
197
- cond: (context, event) => context.grandTotalEnable === 1,
189
+ cond: 'isGrandTotalEnable',
198
190
  },
199
191
  {
200
192
  target: 'debouncing',
@@ -208,19 +200,22 @@ export default function (request) {
208
200
  CONFIRM: {
209
201
  target: 'submitting',
210
202
  },
211
- BACK: {
212
- target: 'loaded',
213
- },
214
203
  CLEAR_CALCULATION: {
215
204
  target: 'debouncing',
216
205
  actions: 'clearCalculation',
217
206
  },
207
+ CLEAR: {
208
+ actions: 'setAmount',
209
+ },
218
210
  },
219
211
  },
220
212
  submitting: {
221
213
  invoke: {
222
214
  src: 'submitDeposit',
223
- onDone: { target: 'submitted', actions: 'setOrder' },
215
+ onDone: {
216
+ target: 'submitted',
217
+ actions: 'setOrder',
218
+ },
224
219
  onError: {
225
220
  target: 'calculated',
226
221
  },
@@ -309,6 +304,9 @@ export default function (request) {
309
304
  hasPreviousOrder: (context, event) => {
310
305
  return event.data.order?.qrcode
311
306
  },
307
+ isGrandTotalEnable: (context, event) => {
308
+ return context.grandTotalEnable === 1
309
+ },
312
310
  },
313
311
  services: {
314
312
  fetchPaymentInfo: async (context, event) => {
@@ -111,7 +111,7 @@ export default function (request) {
111
111
  }
112
112
  return {
113
113
  promotionsList,
114
- selectedPromo: noBonus,
114
+ selectedPromo: siteConfig?.walletMode === '4' ? promotionsList[0] : noBonus,
115
115
  }
116
116
  }),
117
117
  setSelectedPromo: assign((context, event) => {