@jetthai/cuora 1.1.77-cash-5 → 1.1.77-doubleWallet-fix

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.77-cash-5",
3
+ "version": "1.1.77-doubleWallet-fix",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/auth.js CHANGED
@@ -31,8 +31,8 @@ export default {
31
31
  },
32
32
  isPublic: true,
33
33
  }),
34
- register: ({ channel, subchannel, ac, fc = null, reCaptchaToken, dt, ...rest }) => {
35
- const params = pickBy({ channel, subchannel, ac, fc }, (value) => {
34
+ register: ({ channel, subchannel, referralCode, affiliate = null, reCaptchaToken, dt, ...rest }) => {
35
+ const params = pickBy({ channel, subchannel, referralCode, affiliate }, (value) => {
36
36
  return value !== undefined && value !== null
37
37
  })
38
38
  const qs = Object.keys(params)
package/src/api/user.js CHANGED
@@ -9,11 +9,11 @@ export default {
9
9
  changePassword: (data) => ({ url: 'settings/password', method: 'post', params: data }),
10
10
  setPreference: ({ defaultCategory }) => ({ url: 'settings/preference', method: 'post', params: { defaultCategory } }),
11
11
  resetOtp: ({ requestId, number }) => ({ url: 'reset', method: 'post', params: { requestId, number } }),
12
- getAffiliate: () => ({ url: 'friends', method: 'get' }),
13
- getAffiliateHome: () => ({ url: 'friends/home', method: 'get' }),
14
- getAffiliateDashboard: () => ({ url: 'friends/dashboard', method: 'get' }),
15
- getAffiliateDashboardList: ({ level, page, row }) => ({ url: 'friends/dashboard/list', method: 'post', params: { level, page, row } }),
16
- postAffiliate: ({ friendCode }) => ({ url: 'friends', method: 'post', params: { friendCode } }),
12
+ getAffiliate: () => ({ url: 'affiliate', method: 'get' }),
13
+ getAffiliateHome: () => ({ url: 'affiliate/home', method: 'get' }),
14
+ getAffiliateDashboard: () => ({ url: 'affiliate/dashboard', method: 'get' }),
15
+ getAffiliateDashboardList: ({ level, page, row }) => ({ url: 'affiliate/dashboard/list', method: 'post', params: { level, page, row } }),
16
+ postAffiliate: ({ affiliateCode }) => ({ url: 'affiliate', method: 'post', params: { affiliateCode } }),
17
17
  passwordRecovery: (recoveryData) => ({ url: 'recovery', method: 'post', params: recoveryData, isPublic: true }),
18
18
  passwordAbandon: ({ number }) => ({ url: 'recovery/abandon', method: 'post', params: { number }, isPublic: true }),
19
19
  passwordAcknowledge: (acknowledgeData) => ({ url: 'recovery/acknowledge', method: 'post', params: acknowledgeData, isPublic: true }),
@@ -9,7 +9,7 @@ export default function (request) {
9
9
  context: {
10
10
  activityNo: null,
11
11
  activityDetail: null,
12
- duration: 0,
12
+ duration: null,
13
13
  },
14
14
  initial: 'idle',
15
15
  states: {
@@ -62,7 +62,7 @@ export default function (request) {
62
62
  }),
63
63
  setDuration: assign((context, event) => {
64
64
  return {
65
- duration: Math.max(context?.activityDetail?.deadline - new Date().getTime() / 1000, 0),
65
+ duration: context?.activityDetail?.deadline - new Date().getTime() / 1000,
66
66
  }
67
67
  }),
68
68
  },
@@ -2,18 +2,17 @@ import { assign, createMachine } from 'xstate'
2
2
  import isEqual from 'lodash/isEqual.js'
3
3
  import api from '../../api/activity.js'
4
4
 
5
- export default function (request, context) {
5
+ // const isEqual = require('lodash/isEqual')
6
+
7
+ export default function (request) {
6
8
  const { appSecret } = request.config
7
- const { activityNo, isAutoReceiving = true, isLogin = true } = context || {}
8
9
  return createMachine(
9
10
  {
10
11
  id: 'fafafa_activity',
11
12
  context: {
12
- isLogin,
13
- isAutoReceiving,
14
- activityNo,
13
+ isAutoReceiving: true,
14
+ activityNo: null,
15
15
  activityDetail: null,
16
- duration: 0,
17
16
 
18
17
  // 領獎後得到的資訊
19
18
  awards: [],
@@ -27,8 +26,7 @@ export default function (request, context) {
27
26
  initial: 'idle',
28
27
  states: {
29
28
  idle: {
30
- entry: 'reset',
31
- always: [{ target: 'loading', cond: 'isLoadable' }],
29
+ always: [{ target: 'loading', cond: 'hasActivityNo' }],
32
30
  },
33
31
  loading: {
34
32
  invoke: {
@@ -37,24 +35,21 @@ export default function (request, context) {
37
35
  target: 'loaded',
38
36
  actions: 'setActivityDetail',
39
37
  },
38
+ onError: {
39
+ target: 'idle',
40
+ },
40
41
  },
41
42
  },
42
43
  loaded: {
43
44
  always: [{ target: 'awardable', cond: 'isAwardable' }, { target: 'awarded' }],
44
45
  },
45
46
  awardable: {
46
- entry: 'setDuration',
47
47
  on: {
48
48
  AWARD_PRIZE: {
49
49
  target: 'awarding',
50
50
  actions: 'setCallback',
51
51
  },
52
52
  },
53
- after: {
54
- 1000: {
55
- target: 'awardable',
56
- },
57
- },
58
53
  },
59
54
  awarded: {
60
55
  on: {
@@ -95,14 +90,6 @@ export default function (request, context) {
95
90
  actions: 'setActivityNo',
96
91
  cond: 'isActivityChanged',
97
92
  },
98
- START: {
99
- target: '.idle',
100
- actions: assign((context, event) => ({ isLogin: true })),
101
- },
102
- STOP: {
103
- target: '.idle',
104
- actions: assign((context, event) => ({ isLogin: false })),
105
- },
106
93
  },
107
94
  },
108
95
  {
@@ -135,24 +122,13 @@ export default function (request, context) {
135
122
  doCallback: (context, event) => {
136
123
  context.callback()
137
124
  },
138
- setDuration: assign((context, event) => {
139
- return {
140
- duration: Math.max(context?.activityDetail?.periodEndTime - new Date().getTime() / 1000, 0),
141
- }
142
- }),
143
- reset: assign((context, event) => {
144
- return {
145
- activityDetail: null,
146
- duration: 0,
147
- }
148
- }),
149
125
  },
150
126
  guards: {
151
127
  isActivityChanged: (context, event) => {
152
128
  return !isEqual(context.activityNo, event.data)
153
129
  },
154
- isLoadable: (context, event) => {
155
- return context.isLogin && context.activityNo
130
+ hasActivityNo: (context, event) => {
131
+ return context.activityNo
156
132
  },
157
133
  isAwardable: (context, event) => {
158
134
  return context.activityDetail?.receiveStatus === 2
@@ -2,7 +2,6 @@ import continue_deposit_activity from './continue_deposit_activity.js'
2
2
  import deposit_activity from './deposit_activity.js'
3
3
  import diamond_shop_activity_fc from './diamond_shop_activity_fc.js'
4
4
  import diamond_shop_activity_vn from './diamond_shop_activity_vn.js'
5
- import diamond_shop_activity_cash from './diamond_shop_activity_cash.js'
6
5
  import fafafa_activity from './fafafa_activity.js'
7
6
  import invite_friends_activity from './invite_friends_activity.js'
8
7
  import affiliate_invite_friends_activity from './affiliate_invite_friends_activity.js'
@@ -21,7 +20,6 @@ export default {
21
20
  deposit_activity,
22
21
  diamond_shop_activity_fc,
23
22
  diamond_shop_activity_vn,
24
- diamond_shop_activity_cash,
25
23
  fafafa_activity,
26
24
  invite_friends_activity,
27
25
  affiliate_invite_friends_activity,
@@ -1,15 +1,13 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import api from '../../api/activity.js'
3
3
 
4
- export default function (request, context) {
4
+ export default function (request) {
5
5
  const { appSecret } = request.config
6
- const { activityNo, isLogin = true } = context || {}
7
6
  return createMachine(
8
7
  {
9
8
  id: 'ranking_activity',
10
9
  context: {
11
- isLogin,
12
- activityNo,
10
+ activityNo: null,
13
11
  activityDetail: null,
14
12
  duration: null,
15
13
  status: 'not-started', // "not-started" | "started" | "finished"
@@ -17,13 +15,6 @@ export default function (request, context) {
17
15
  initial: 'idle',
18
16
  states: {
19
17
  idle: {
20
- entry: 'reset',
21
- always: [
22
- {
23
- target: 'loading',
24
- cond: 'isLoadable',
25
- },
26
- ],
27
18
  on: {
28
19
  SET_ACTIVITY_NO: {
29
20
  target: 'loading',
@@ -54,16 +45,6 @@ export default function (request, context) {
54
45
  },
55
46
  expired: {},
56
47
  },
57
- on: {
58
- START: {
59
- target: '.idle',
60
- actions: assign((context, event) => ({ isLogin: true })),
61
- },
62
- STOP: {
63
- target: '.idle',
64
- actions: assign((context, event) => ({ isLogin: false })),
65
- },
66
- },
67
48
  },
68
49
  {
69
50
  actions: {
@@ -97,18 +78,8 @@ export default function (request, context) {
97
78
  }
98
79
  }
99
80
  }),
100
- reset: assign((context, event) => {
101
- return {
102
- activityDetail: null,
103
- duration: 0,
104
- status: 'not-started',
105
- }
106
- }),
107
81
  },
108
82
  guards: {
109
- isLoadable: (context, event) => {
110
- return context.isLogin && context.activityNo
111
- },
112
83
  isExpired: (context, event) => {
113
84
  return context.duration <= 0
114
85
  },
@@ -1,29 +1,19 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import api from '../../api/activity.js'
3
3
 
4
- export default function (request, context) {
4
+ export default function (request) {
5
5
  const { appSecret } = request.config
6
- const { activityNo, isLogin = true } = context || {}
7
6
  return createMachine(
8
7
  {
9
8
  id: 'specify_bets_activity',
10
9
  context: {
11
- isLogin,
12
- activityNo,
10
+ activityNo: null,
13
11
  activityDetail: null,
14
12
  callback: () => {},
15
- duration: 0,
16
13
  },
17
14
  initial: 'idle',
18
15
  states: {
19
16
  idle: {
20
- entry: 'reset',
21
- always: [
22
- {
23
- target: 'loading',
24
- cond: 'isLoadable',
25
- },
26
- ],
27
17
  on: {
28
18
  SET_ACTIVITY_NO: {
29
19
  target: 'loading',
@@ -50,14 +40,7 @@ export default function (request, context) {
50
40
  { target: 'receivable', cond: 'isReceivable' },
51
41
  ],
52
42
  },
53
- ongoing: {
54
- entry: 'setDuration',
55
- after: {
56
- 1000: {
57
- target: 'ongoing',
58
- },
59
- },
60
- },
43
+ ongoing: {},
61
44
  received: {},
62
45
  receivable: {
63
46
  on: {
@@ -80,16 +63,6 @@ export default function (request, context) {
80
63
  },
81
64
  },
82
65
  },
83
- on: {
84
- START: {
85
- target: '.idle',
86
- actions: assign((context, event) => ({ isLogin: true })),
87
- },
88
- STOP: {
89
- target: '.idle',
90
- actions: assign((context, event) => ({ isLogin: false })),
91
- },
92
- },
93
66
  },
94
67
  {
95
68
  actions: {
@@ -111,22 +84,8 @@ export default function (request, context) {
111
84
  doCallback: (context, event) => {
112
85
  context.callback(event.data.type)
113
86
  },
114
- setDuration: assign((context, event) => {
115
- return {
116
- duration: Math.max(context?.activityDetail?.activityEndTime - new Date().getTime() / 1000, 0),
117
- }
118
- }),
119
- reset: assign((context, event) => {
120
- return {
121
- activityDetail: null,
122
- duration: 0,
123
- }
124
- }),
125
87
  },
126
88
  guards: {
127
- isLoadable: (context, event) => {
128
- return context.isLogin && context.activityNo
129
- },
130
89
  isReceivable: (context, event) => {
131
90
  return context.activityDetail?.receiveStatus === 2
132
91
  },
@@ -1,29 +1,19 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import api from '../../api/activity.js'
3
3
 
4
- export default function (request, context) {
4
+ export default function (request) {
5
5
  const { appSecret } = request.config
6
- const { activityNo, isLogin = true } = context || {}
7
6
  return createMachine(
8
7
  {
9
8
  id: 'specify_turnover_activity',
10
9
  context: {
11
- isLogin,
12
- activityNo,
10
+ activityNo: null,
13
11
  activityDetail: null,
14
12
  callback: () => {},
15
- duration: 0,
16
13
  },
17
14
  initial: 'idle',
18
15
  states: {
19
16
  idle: {
20
- entry: 'reset',
21
- always: [
22
- {
23
- target: 'loading',
24
- cond: 'isLoadable',
25
- },
26
- ],
27
17
  on: {
28
18
  SET_ACTIVITY_NO: {
29
19
  target: 'loading',
@@ -50,14 +40,7 @@ export default function (request, context) {
50
40
  { target: 'receivable', cond: 'isReceivable' },
51
41
  ],
52
42
  },
53
- ongoing: {
54
- entry: 'setDuration',
55
- after: {
56
- 1000: {
57
- target: 'ongoing',
58
- },
59
- },
60
- },
43
+ ongoing: {},
61
44
  received: {},
62
45
  receivable: {
63
46
  on: {
@@ -80,16 +63,6 @@ export default function (request, context) {
80
63
  },
81
64
  },
82
65
  },
83
- on: {
84
- START: {
85
- target: '.idle',
86
- actions: assign((context, event) => ({ isLogin: true })),
87
- },
88
- STOP: {
89
- target: '.idle',
90
- actions: assign((context, event) => ({ isLogin: false })),
91
- },
92
- },
93
66
  },
94
67
  {
95
68
  actions: {
@@ -111,22 +84,8 @@ export default function (request, context) {
111
84
  doCallback: (context, event) => {
112
85
  context.callback(event.data.type)
113
86
  },
114
- setDuration: assign((context, event) => {
115
- return {
116
- duration: Math.max(context?.activityDetail?.activityEndTime - new Date().getTime() / 1000, 0),
117
- }
118
- }),
119
- reset: assign((context, event) => {
120
- return {
121
- activityDetail: null,
122
- duration: 0,
123
- }
124
- }),
125
87
  },
126
88
  guards: {
127
- isLoadable: (context, event) => {
128
- return context.isLogin && context.activityNo
129
- },
130
89
  isReceivable: (context, event) => {
131
90
  return context.activityDetail?.receiveStatus === 2
132
91
  },
@@ -1,7 +1,6 @@
1
1
  import manual_vn from './manual_vn.js'
2
2
  import loadcard_vn from './loadcard_vn.js'
3
3
  import qrcode_v2 from './qrcode_v2.js'
4
- import qrcode_v_cash from './qrcode_v_cash.js'
5
4
  import deposit_fc from './deposit_fc.js'
6
5
  import crypto from './crypto.js'
7
6
  import crypto_button from './crypto_button.js'
@@ -15,7 +14,6 @@ export default {
15
14
  manual_vn,
16
15
  loadcard_vn,
17
16
  qrcode_v2,
18
- qrcode_v_cash,
19
17
  deposit_fc,
20
18
  crypto,
21
19
  crypto_button,
@@ -100,6 +100,11 @@ export default function (request) {
100
100
  },
101
101
  ],
102
102
  SELECT_AMOUNT: [
103
+ {
104
+ target: 'debouncing',
105
+ actions: 'setAmount',
106
+ cond: 'isDoubleWalletMode',
107
+ },
103
108
  {
104
109
  target: 'pending',
105
110
  actions: 'addAmount',
@@ -158,6 +163,11 @@ export default function (request) {
158
163
  debouncing: {
159
164
  on: {
160
165
  SELECT_AMOUNT: [
166
+ {
167
+ target: 'debouncing',
168
+ actions: 'setAmount',
169
+ cond: 'isDoubleWalletMode',
170
+ },
161
171
  {
162
172
  target: 'debouncing',
163
173
  actions: 'addAmount',
@@ -192,6 +202,11 @@ export default function (request) {
192
202
  entry: 'clearCalculation',
193
203
  on: {
194
204
  SELECT_AMOUNT: [
205
+ {
206
+ target: 'debouncing',
207
+ actions: 'setAmount',
208
+ cond: 'isDoubleWalletMode',
209
+ },
195
210
  {
196
211
  target: 'pending',
197
212
  actions: 'addAmount',
@@ -392,6 +407,9 @@ export default function (request) {
392
407
  }),
393
408
  },
394
409
  guards: {
410
+ isDoubleWalletMode: (context, event) => {
411
+ return context.siteConfig?.walletMode === '4'
412
+ },
395
413
  isFreeWalletMode: (context, event) => {
396
414
  return context.siteConfig?.walletMode === '2'
397
415
  },