@jetthai/cuora 1.0.66-sabai-2 → 1.0.67

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +0 -638
  2. package/README.md +0 -6
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.LICENSE.txt +30 -0
  5. package/package.json +11 -13
  6. package/src/api/activity.js +3 -10
  7. package/src/api/auth.js +5 -47
  8. package/src/api/game.js +2 -64
  9. package/src/api/index.js +8 -8
  10. package/src/api/payment.js +7 -86
  11. package/src/api/user.js +0 -18
  12. package/src/index.js +5 -7
  13. package/src/machine/activity/activity.js +10 -97
  14. package/src/machine/activity/continue_deposit_activity.js +1 -1
  15. package/src/machine/activity/deposit_activity.js +1 -1
  16. package/src/machine/activity/{diamond_shop_activity_fc.js → diamond_shop_activity.js} +5 -33
  17. package/src/machine/activity/{diamond_shop_activity_vn.js → diamond_shop_activity_single_exchange.js} +21 -66
  18. package/src/machine/activity/fafafa_activity.js +2 -4
  19. package/src/machine/activity/index.js +10 -24
  20. package/src/machine/activity/invite_friends_activity.js +8 -3
  21. package/src/machine/activity/ranking_activity.js +46 -40
  22. package/src/machine/activity/return_bonus_activity.js +3 -5
  23. package/src/machine/activity/specify_bets_activity.js +1 -1
  24. package/src/machine/auth.js +79 -234
  25. package/src/machine/{auth_otp_v3.js → auth_otp.js} +17 -80
  26. package/src/machine/bank_binding.js +14 -15
  27. package/src/machine/common.js +17 -80
  28. package/src/machine/{deposit/deposit_fc.js → deposit.js} +15 -27
  29. package/src/machine/error.js +1 -1
  30. package/src/machine/game.js +10 -17
  31. package/src/machine/game_favorite.js +2 -2
  32. package/src/machine/game_hot_new.js +1 -1
  33. package/src/machine/game_search.js +7 -3
  34. package/src/machine/inbox.js +6 -5
  35. package/src/machine/index.js +25 -56
  36. package/src/machine/merge.js +2 -2
  37. package/src/machine/payment_data.js +5 -6
  38. package/src/machine/reward.js +3 -84
  39. package/src/machine/setting.js +2 -5
  40. package/src/machine/side.js +27 -34
  41. package/src/machine/user_info.js +1 -1
  42. package/src/machine/user_reset_password.js +2 -2
  43. package/src/machine/user_sign_up.js +56 -111
  44. package/src/machine/welcome.js +8 -6
  45. package/src/machine/withdraw.js +380 -0
  46. package/src/machine/withdraw_vn.js +65 -248
  47. package/src/request/config.js +1 -7
  48. package/src/request/cookie.js +52 -0
  49. package/src/request/request.js +15 -11
  50. package/webpack.config.js +33 -0
  51. package/.husky/pre-commit +0 -4
  52. package/.prettierignore +0 -1
  53. package/dist/bundle.mjs +0 -27623
  54. package/rollup.config.js +0 -12
  55. package/src/lib/fingerprint.js +0 -5779
  56. package/src/machine/activity/affiliate_invite_friends_activity.js +0 -216
  57. package/src/machine/activity/mini_game_activity.js +0 -68
  58. package/src/machine/activity/roulette_activity_v2.js +0 -81
  59. package/src/machine/activity/sign_in_activity.js +0 -149
  60. package/src/machine/activity/specify_turnover_activity.js +0 -113
  61. package/src/machine/activity/time_bomb_activity.js +0 -80
  62. package/src/machine/auth_otp_v2.js +0 -177
  63. package/src/machine/bank_binding_amb.js +0 -140
  64. package/src/machine/bonus.js +0 -75
  65. package/src/machine/deposit/amb.js +0 -90
  66. package/src/machine/deposit/crypto.js +0 -267
  67. package/src/machine/deposit/crypto_button.js +0 -449
  68. package/src/machine/deposit/direct.js +0 -246
  69. package/src/machine/deposit/float.js +0 -295
  70. package/src/machine/deposit/index.js +0 -25
  71. package/src/machine/deposit/loadcard_vn.js +0 -390
  72. package/src/machine/deposit/manual_vn.js +0 -382
  73. package/src/machine/deposit/qrcode_v2.js +0 -451
  74. package/src/machine/deposit/usdt.js +0 -144
  75. package/src/machine/deposit/vpay.js +0 -292
  76. package/src/machine/game_favorite_v2.js +0 -119
  77. package/src/machine/game_search_v2.js +0 -379
  78. package/src/machine/game_v2.js +0 -381
  79. package/src/machine/game_v2_1.js +0 -442
  80. package/src/machine/leaderboard.js +0 -108
  81. package/src/machine/promotions.js +0 -170
  82. package/src/machine/reward_fc.js +0 -97
  83. package/src/machine/roulette_v2.js +0 -271
  84. package/src/machine/side_v2.js +0 -200
  85. package/src/machine/vip_table.js +0 -50
  86. package/src/machine/withdraw_amb.js +0 -373
  87. package/src/machine/withdraw_crypto.js +0 -560
  88. package/src/machine/withdraw_fc.js +0 -251
  89. package/src/util/constant.js +0 -2
  90. package/src/util/deviceToken.js +0 -33
  91. package/src/util/index.js +0 -6
  92. package/src/util/storage.js +0 -28
@@ -1,26 +1,21 @@
1
1
  import urljoin from 'url-join'
2
- import { assign, createMachine } from 'xstate'
3
- import auth from '../api/auth.js'
4
- import user from '../api/user.js'
5
- import storage from '../util/storage.js'
6
- import { getDeviceToken } from '../util/deviceToken.js'
7
-
8
- // const urljoin = require('url-join')
2
+ import Cookies from 'universal-cookie'
3
+ import qs from 'qs'
4
+ import { assign, createMachine, send } from 'xstate'
5
+ import auth from '../api/auth'
6
+ import user from '../api/user'
9
7
 
10
8
  export default function (request) {
11
- const { clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
9
+ const { clientId } = request.config
12
10
  const tokenKey = `cuora_${clientId}`
13
11
  const userKey = `cuora_tempuser`
14
- const phoneCountryCode = 'phone_countrycode'
15
- const accountPhoneKey = 'account_phone'
16
- const accountEmailKey = 'account_email'
12
+ const cookies = new Cookies()
17
13
 
18
14
  return createMachine(
19
15
  {
20
16
  id: 'auth',
21
17
  initial: 'idle',
22
18
  context: {
23
- base: '',
24
19
  token: null,
25
20
  tick: 2000,
26
21
  isPlaying: false,
@@ -32,49 +27,40 @@ export default function (request) {
32
27
  username: null,
33
28
  password: null,
34
29
  },
35
- countryAbbr: null,
36
30
  userInfo: {},
37
31
  redirectURL: null,
38
- reCaptchaToken: null,
39
- affiliate: null,
40
32
  },
41
33
  states: {
42
34
  idle: {
43
35
  entry: 'fetchToken',
44
- always: [{ target: 'authenticated', cond: 'hasToken' }],
45
- },
46
- authentication: {
47
- invoke: {
48
- src: 'authenticate',
49
- onDone: {
50
- target: 'authenticated',
51
- actions: ['setToken', 'setAccount'],
36
+ always: [{ target: 'login', cond: 'hasToken' }],
37
+ on: {
38
+ LOGIN_PHONE: {
39
+ target: 'authentication',
40
+ actions: 'setLoginPhone',
52
41
  },
53
- onError: {
54
- target: 'idle',
55
- actions: 'removeToken',
42
+ LOGIN_EMAIL: {
43
+ target: 'authentication',
44
+ actions: 'setLoginEmail',
56
45
  },
57
- },
58
- },
59
- authenticationGuest: {
60
- invoke: {
61
- src: 'authenticateGuest',
62
- onDone: {
63
- target: 'authenticated',
64
- actions: 'setToken',
46
+ LOGIN_LOCAL: {
47
+ target: 'authentication',
48
+ actions: 'setLoginLocal',
65
49
  },
66
- onError: {
67
- target: 'idle',
68
- actions: 'removeToken',
50
+ LOGIN_3PARTY: {
51
+ actions: 'redirectTo3Party',
52
+ },
53
+ LOGIN_TOKEN: {
54
+ actions: 'setToken',
69
55
  },
70
56
  },
71
57
  },
72
- authenticationApp: {
58
+ authentication: {
73
59
  invoke: {
74
- src: 'authenticateApp',
60
+ src: 'authenticate',
75
61
  onDone: {
76
- target: 'authenticated',
77
- actions: ['setToken'],
62
+ target: 'login',
63
+ actions: 'setToken',
78
64
  },
79
65
  onError: {
80
66
  target: 'idle',
@@ -82,132 +68,65 @@ export default function (request) {
82
68
  },
83
69
  },
84
70
  },
85
- authenticated: {
86
- invoke: {
87
- src: 'fetchUserInfo',
88
- onDone: {
89
- target: 'inline',
90
- actions: ['setUserInfo', 'extendToken'],
91
- },
92
- onError: {
93
- target: 'leaving',
94
- },
95
- },
96
- },
97
- inline: {
98
- initial: 'pending',
99
- states: {
100
- pending: {
101
- always: [{ target: '#auth.inlineFinish', cond: 'isNotInline' }],
102
- after: {
103
- TIMEOUT: {
104
- target: 'fetching',
105
- },
106
- },
107
- },
108
- fetching: {
109
- invoke: {
110
- src: 'fetchUserInfo',
111
- onDone: {
112
- target: 'pending',
113
- actions: ['setUserInfo', 'extendToken'],
114
- },
115
- onError: {
116
- target: '#auth.leaving',
117
- },
118
- },
119
- },
120
- },
121
- },
122
- inlineFinish: {
123
- after: {
124
- 0: {
125
- target: 'login',
126
- },
127
- },
128
- },
129
71
  login: {
130
- initial: 'fetching',
72
+ type: 'parallel',
131
73
  states: {
132
- fetching: {
133
- invoke: {
134
- src: 'fetchUserInfo',
135
- onDone: {
136
- target: 'pending',
137
- actions: ['setUserInfo', 'extendToken'],
74
+ timer: {
75
+ initial: 'running',
76
+ states: {
77
+ running: {
78
+ invoke: {
79
+ src: 'fetchUserInfo',
80
+ onDone: {
81
+ target: 'pending',
82
+ actions: ['setUserInfo', 'extendToken', send({ type: 'CHECK' })],
83
+ },
84
+ onError: {
85
+ target: '#auth.logout',
86
+ },
87
+ },
138
88
  },
139
- onError: {
140
- target: '#auth.leaving',
89
+ pending: {
90
+ after: {
91
+ TIMEOUT: {
92
+ target: 'running',
93
+ },
94
+ },
141
95
  },
142
96
  },
143
97
  },
144
- pending: {
145
- after: {
146
- TIMEOUT: {
147
- target: 'fetching',
148
- },
98
+ user: {
99
+ initial: 'idle',
100
+ states: {
101
+ idle: {},
102
+ normal: {},
103
+ inline: {},
104
+ },
105
+ on: {
106
+ CHECK: [{ target: '.inline', cond: 'isInline' }, { target: '.normal' }],
149
107
  },
150
108
  },
151
109
  },
152
110
  on: {
153
111
  LOGOUT: {
154
- target: 'leaving',
112
+ target: '#auth.logout',
155
113
  },
156
114
  },
157
115
  },
158
- leaving: {
116
+ logout: {
159
117
  invoke: {
160
118
  src: 'logout',
161
119
  onDone: {
162
- target: 'logout',
120
+ target: 'idle',
121
+ actions: 'removeToken',
163
122
  },
164
123
  onError: {
165
- target: 'logout',
166
- },
167
- },
168
- },
169
- logout: {
170
- after: {
171
- 0: {
172
124
  target: 'idle',
173
125
  actions: 'removeToken',
174
126
  },
175
127
  },
176
128
  },
177
129
  },
178
- on: {
179
- LOGIN_TOKEN: {
180
- target: 'idle',
181
- actions: 'setToken',
182
- },
183
- CLEAR: {
184
- target: '.logout',
185
- },
186
- LOGIN_GUEST: {
187
- target: '.authenticationGuest',
188
- },
189
- LOGIN_PHONE: {
190
- target: '.authentication',
191
- actions: ['setReCaptchaToken', 'setLoginPhone'],
192
- },
193
- LOGIN_EMAIL: {
194
- target: '.authentication',
195
- actions: ['setReCaptchaToken', 'setLoginEmail'],
196
- },
197
- LOGIN_LOCAL: {
198
- target: '.authentication',
199
- actions: 'setLoginLocal',
200
- },
201
- LOGIN_3PARTY: {
202
- actions: 'redirectTo3Party',
203
- },
204
- LOGIN_APP: {
205
- target: '.authenticationApp',
206
- },
207
- SET_PLAY: {
208
- actions: 'setPlay',
209
- },
210
- },
211
130
  },
212
131
  {
213
132
  delays: {
@@ -223,19 +142,10 @@ export default function (request) {
223
142
  isInline: (context, event) => {
224
143
  return context.userInfo?.rank >= 0
225
144
  },
226
- isNotInline: (context, event) => {
227
- return !(context.userInfo?.rank >= 0)
228
- },
229
145
  },
230
146
  actions: {
231
- setReCaptchaToken: assign((context, event) => {
232
- const { reCaptchaToken } = event.data
233
- return {
234
- reCaptchaToken,
235
- }
236
- }),
237
147
  setLoginPhone: assign((context, event) => {
238
- const { countryCode, countryAbbr, phone, password } = event.data
148
+ const { countryCode, phone, password } = event.data
239
149
  return {
240
150
  loginData: {
241
151
  provider: 'phone',
@@ -243,7 +153,6 @@ export default function (request) {
243
153
  phone,
244
154
  password,
245
155
  },
246
- countryAbbr,
247
156
  }
248
157
  }),
249
158
  setLoginEmail: assign((context, event) => {
@@ -258,7 +167,7 @@ export default function (request) {
258
167
  }),
259
168
  setLoginLocal: assign((context, event) => {
260
169
  const { username, password } = event.data
261
- storage.set(userKey, username, {
170
+ cookies.set(userKey, username, {
262
171
  path: '/',
263
172
  maxAge: 60 * 60 * 24,
264
173
  })
@@ -271,13 +180,13 @@ export default function (request) {
271
180
  }
272
181
  }),
273
182
  fetchToken: assign((context, event) => {
274
- const token = storage.get(tokenKey)
183
+ const token = cookies.get(tokenKey)
275
184
  return {
276
185
  token,
277
186
  }
278
187
  }),
279
188
  setToken: assign((context, event) => {
280
- storage.set(tokenKey, event.data, {
189
+ cookies.set(tokenKey, event.data, {
281
190
  path: '/',
282
191
  maxAge: 300,
283
192
  })
@@ -285,110 +194,43 @@ export default function (request) {
285
194
  token: event.data,
286
195
  }
287
196
  }),
288
- setAccount: assign((context, event) => {
289
- if (context.loginData.phone) {
290
- storage.remove(accountEmailKey)
291
- storage.set(accountPhoneKey, `${context.loginData.phone}`, {
292
- path: '/',
293
- maxAge: 60 * 60 * 24 * 7,
294
- })
295
- storage.set(phoneCountryCode, `${context.countryAbbr}_${context.loginData.countryCode}`, {
296
- path: '/',
297
- maxAge: 60 * 60 * 24 * 7,
298
- })
299
- } else if (context.loginData.email) {
300
- storage.remove(accountPhoneKey)
301
- storage.remove(phoneCountryCode)
302
- storage.set(accountEmailKey, context.loginData.email, {
303
- path: '/',
304
- maxAge: 60 * 60 * 24 * 7,
305
- })
306
- }
307
- }),
308
197
  removeToken: assign((context, event) => {
309
- storage.remove(tokenKey, {
198
+ cookies.remove(tokenKey, {
310
199
  path: '/',
311
200
  maxAge: 300,
312
201
  })
313
202
  return { token: null }
314
203
  }),
315
204
  extendToken: assign((context, event) => {
316
- const token = storage.get(tokenKey)
317
- storage.set(tokenKey, token, {
205
+ const token = cookies.get(tokenKey)
206
+ cookies.set(tokenKey, token, {
318
207
  path: '/',
319
208
  maxAge: 300,
320
209
  })
321
210
  return { token }
322
211
  }),
323
- redirectTo3Party: async (context, event) => {
324
- const { provider, channel, subchannel, affiliate } = event.data
325
-
326
- const dt = await getDeviceToken({
327
- fpToken,
328
- sentry,
329
- hosts: request.hosts,
330
- })
331
- sentry.setTag('dt', dt)
332
-
333
- const referralCode = storage.get('referralCode')
334
- const messages = {
335
- url: window.location.href,
336
- channelOrders: [
337
- { channel: storage.get('channel'), subchannel: storage.get('subchannel') },
338
- { channel: defaultChannel, subchannel: defaultSubchannel },
339
- { channel: channel, subchannel: subchannel },
340
- ],
341
- referralCode,
342
- }
343
- sentry.captureMessage(JSON.stringify(messages))
344
-
345
- const referralObj = {}
346
- if (![undefined, 'undefined', null, 'null'].includes(referralCode)) {
347
- referralObj.referralCode = referralCode
348
- } else {
349
- ;(referralObj.channel = storage.get('channel') || defaultChannel || channel),
350
- (referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel)
351
- }
352
-
212
+ redirectTo3Party: (context, event) => {
353
213
  const redirectURL = urljoin(
354
214
  request.config.fullURL,
355
215
  'login?' +
356
- new URLSearchParams({
357
- provider,
358
- redirectURI: `${window.location.protocol}//${window.location.host}${context.base}`,
359
- ...referralObj,
360
- // dt,
361
- platform: 'pwa',
362
- affiliate,
363
- }).toString()
216
+ qs.stringify({
217
+ provider: event.data,
218
+ redirectURI: `${window.location.protocol}//${window.location.host}`,
219
+ channel: 'official',
220
+ subchannel: 'pwa',
221
+ })
364
222
  )
365
-
366
223
  window.location.href = redirectURL
367
224
  },
368
225
  setUserInfo: assign((context, event) => {
369
- sentry.setUser({ id: event.data.uid_site })
370
226
  return {
371
227
  userInfo: event.data,
372
228
  }
373
229
  }),
374
- setPlay: assign((context, event) => {
375
- return {
376
- isPlaying: event.data,
377
- }
378
- }),
379
230
  },
380
231
  services: {
381
- authenticateApp: async (context, event) => {
382
- const { token } = await request.send(auth.loginApp(event.data))
383
- return token
384
- },
385
232
  authenticate: async (context, event) => {
386
- const data = { ...context.loginData, reCaptchaToken: context.reCaptchaToken }
387
- const { token } = await request.send(auth.login(data))
388
- return token
389
- },
390
- authenticateGuest: async (context, event) => {
391
- const { token } = await request.send(auth.guestLogin())
233
+ const { token } = await request.send(auth.login(context.loginData))
392
234
  return token
393
235
  },
394
236
  logout: async (context, event) => {
@@ -397,6 +239,9 @@ export default function (request) {
397
239
  fetchUserInfo: async (context, event) => {
398
240
  return await request.send(user.getUserInfo())
399
241
  },
242
+ updateUserInfo: async (context, event) => {
243
+ return await request.send(user.updateUserInfo(event.data))
244
+ },
400
245
  },
401
246
  }
402
247
  )
@@ -1,33 +1,21 @@
1
- import { assign, createMachine } from 'xstate'
2
- import user from '../api/user.js'
3
- import auth from '../api/auth.js'
1
+ import { createMachine, assign } from 'xstate'
2
+ import api from '../api/user'
4
3
 
5
4
  export default function (request) {
6
5
  return createMachine(
7
6
  {
8
7
  id: 'auth_otp',
9
- initial: 'idle',
8
+ initial: 'fetching',
10
9
  context: {
11
- strategy: null,
12
10
  userInfo: null,
13
11
  error: null,
14
12
  countryCode: null,
15
13
  phone: null,
16
- email: null,
17
- target: null,
14
+ number: null,
18
15
  requestId: null,
19
- status: null,
20
16
  ttl: 0,
21
17
  },
22
18
  states: {
23
- idle: {
24
- on: {
25
- SET_STRATEGY: {
26
- target: 'fetching',
27
- actions: 'setStrategy',
28
- },
29
- },
30
- },
31
19
  fetching: {
32
20
  invoke: {
33
21
  src: 'fetchUserInfo',
@@ -43,8 +31,6 @@ export default function (request) {
43
31
  checking: {
44
32
  always: [
45
33
  { target: 'verified', cond: 'isVerified' },
46
- { target: 'notVerified.email', cond: 'isEmailNotVerified' },
47
- { target: 'notVerified.phone', cond: 'isPhoneNotVerified' },
48
34
  { target: 'notVerified', cond: 'isNotVerified' },
49
35
  ],
50
36
  },
@@ -75,34 +61,15 @@ export default function (request) {
75
61
  },
76
62
  },
77
63
  },
78
- email: {
79
- on: {
80
- SEND_EMAIL: {
81
- target: 'sendingEmail',
82
- actions: 'setEmail',
83
- },
84
- },
85
- },
86
64
  sendingPhone: {
87
65
  invoke: {
88
66
  src: 'sendPhone',
89
67
  onDone: {
90
- target: 'otp',
91
- actions: 'setVerificationData',
68
+ target: 'checkingStatus',
92
69
  },
93
70
  onError: { target: 'phone' },
94
71
  },
95
72
  },
96
- sendingEmail: {
97
- invoke: {
98
- src: 'sendEmail',
99
- onDone: {
100
- target: 'otp',
101
- actions: 'setVerificationData',
102
- },
103
- onError: { target: 'email' },
104
- },
105
- },
106
73
  otp: {
107
74
  type: 'parallel',
108
75
  states: {
@@ -116,14 +83,11 @@ export default function (request) {
116
83
  },
117
84
  },
118
85
  verification: {
119
- initial: 'checking',
86
+ initial: 'idle',
120
87
  states: {
121
- checking: {
122
- always: [{ target: '#auth_otp.verified', cond: 'isAutoVerified' }, { target: 'idle' }],
123
- },
124
88
  idle: {
125
89
  on: {
126
- ACKNOWLEDGE: {
90
+ SEND_OTP: {
127
91
  target: 'acknowledging',
128
92
  },
129
93
  RESET_OTP: {
@@ -167,23 +131,17 @@ export default function (request) {
167
131
  },
168
132
  {
169
133
  actions: {
170
- setStrategy: assign((context, event) => {
171
- return {
172
- strategy: event.data,
173
- }
174
- }),
175
134
  setUserInfo: assign((context, event) => {
176
135
  return {
177
136
  userInfo: event.data,
178
137
  }
179
138
  }),
180
139
  setVerificationData: assign((context, event) => {
181
- const { requestId, ttl, target, status } = event.data
140
+ const { number, requestId, ttl } = event.data
182
141
  return {
142
+ number,
183
143
  requestId,
184
- ttl: ttl * 1000,
185
- target,
186
- status,
144
+ ttl,
187
145
  }
188
146
  }),
189
147
  decreaseTtl: assign((context, evnet) => {
@@ -204,12 +162,6 @@ export default function (request) {
204
162
  phone,
205
163
  }
206
164
  }),
207
- setEmail: assign((context, event) => {
208
- const { email } = event.data
209
- return {
210
- email,
211
- }
212
- }),
213
165
  },
214
166
  guards: {
215
167
  isVerified: (context, event) => {
@@ -218,45 +170,30 @@ export default function (request) {
218
170
  isNotVerified: (context, event) => {
219
171
  return context.userInfo && context.userInfo.verification_status !== 1
220
172
  },
221
- isPhoneNotVerified: (context, event) => {
222
- const { strategy, userInfo } = context
223
- return strategy === 'phone' && userInfo && userInfo.verification_status !== 1 && !userInfo.phone
224
- },
225
- isEmailNotVerified: (context, event) => {
226
- const { strategy, userInfo } = context
227
- return strategy === 'email' && userInfo && userInfo.verification_status !== 1 && !userInfo.email
228
- },
229
173
  hasNoPhone: (context, event) => {
230
174
  const { error } = context
231
175
  return error.code === 'ERR_F106'
232
176
  },
233
- isAutoVerified: (context, event) => {
234
- return context.status === 'success-verified'
235
- },
236
177
  },
237
178
  services: {
238
179
  fetchUserInfo: async (context, event) => {
239
- return await request.send(user.getUserInfo())
180
+ return await request.send(api.getUserInfo())
240
181
  },
241
182
  verify: async (context, event) => {
242
- return await request.send(user.verifyV2Initiate({ strategy: context.strategy }))
183
+ return await request.send(api.verify())
243
184
  },
244
185
  sendPhone: async (context, event) => {
245
186
  const { countryCode, phone } = context
246
- return await request.send(auth.bindPost({ provider: 'phone', countryCode, phone }))
247
- },
248
- sendEmail: async (context, event) => {
249
- const { email } = context
250
- return await request.send(auth.bindPost({ provider: 'email', email }))
187
+ return await request.send(api.updateUserInfo({ countryCode, phone }))
251
188
  },
252
189
  resetOtp: async (context, event) => {
253
- const { requestId, target } = context
254
- return await request.send(user.otpReset({ requestId, target }))
190
+ const { requestId, number } = context
191
+ return await request.send(api.resetOtp({ requestId, number }))
255
192
  },
256
193
  acknowledge: async (context, event) => {
257
- const { requestId, target } = context
194
+ const { requestId } = context
258
195
  const code = event.data
259
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
196
+ return await request.send(api.acknowledge({ requestId, code }))
260
197
  },
261
198
  },
262
199
  }