@jetthai/cuora 1.1.393-dev-4 → 1.1.393-dev-5

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.393-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.393-dev-4...v1.1.393-dev-5) (2025-10-31)
6
+
5
7
  ### [1.1.393-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.393-dev-3...v1.1.393-dev-4) (2025-10-31)
6
8
 
7
9
  ### [1.1.393-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.393-dev-2...v1.1.393-dev-3) (2025-10-31)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.393-dev-4",
3
+ "version": "1.1.393-dev-5",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -1,7 +1,8 @@
1
1
  export default {
2
- bindingStatus: () => ({ url: 'account-binding/status', method: 'get' }),
3
- applyBinding: (data) => ({ url: 'account-binding/bind', method: 'post', params: data }),
4
- bindingVerification: (data) => ({ url: 'account-binding/acknowledge', method: 'post', params: data }),
2
+ bindingStatus: () => ({ url: 'account-binding/status', method: 'GET' }),
3
+ applyBinding: (data) => ({ url: 'account-binding/bind', method: 'POST', params: data }),
4
+ bindingVerification: (data) => ({ url: 'account-binding/acknowledge', method: 'POST', params: data }),
5
5
  bindThirdParty: (data) => ({ url: 'account-binding/bind-third-party', method: 'GET', params: data }),
6
6
  bindPassword: (data) => ({ url: 'account-binding/bind-password', method: 'POST', params: data }),
7
+ resetOtp: (data) => ({ url: '/account-binding/reset-otp', method: 'POST', params: data }),
7
8
  }
@@ -1,6 +1,7 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import user from '../api/user.js'
3
3
  import auth from '../api/auth.js'
4
+ import account from '../api/account.js'
4
5
 
5
6
  export default function (request) {
6
7
  return createMachine(
@@ -178,12 +179,16 @@ export default function (request) {
178
179
  }
179
180
  }),
180
181
  setVerificationData: assign((context, event) => {
181
- const { requestId, ttl, target, status } = event.data
182
+ const { request_id, ttl, email, countryCode, phone } = event.data
182
183
  return {
183
- requestId,
184
- ttl: ttl * 1000,
185
- target,
186
- status,
184
+ requestId: request_id,
185
+ ttl: ttl, // 後端傳過來的是毫秒
186
+ target: {
187
+ provider: context.strategy,
188
+ email: email,
189
+ countryCode: countryCode,
190
+ phone: phone,
191
+ },
187
192
  }
188
193
  }),
189
194
  decreaseTtl: assign((context, evnet) => {
@@ -239,24 +244,28 @@ export default function (request) {
239
244
  return await request.send(user.getUserInfo())
240
245
  },
241
246
  verify: async (context, event) => {
242
- return await request.send(user.verifyV2Initiate({ strategy: context.strategy }))
247
+ return await request.send(account.applyBinding({ strategy: context.strategy }))
243
248
  },
244
249
  sendPhone: async (context, event) => {
245
250
  const { countryCode, phone } = context
246
- return await request.send(auth.bindPost({ provider: 'phone', countryCode, phone }))
251
+ return await request.send(account.applyBinding({ provider: 'phone', countryCode, phone }))
247
252
  },
248
253
  sendEmail: async (context, event) => {
249
254
  const { email } = context
250
- return await request.send(auth.bindPost({ provider: 'email', email }))
255
+ return await request.send(account.applyBinding({ provider: 'email', email }))
251
256
  },
252
257
  resetOtp: async (context, event) => {
253
258
  const { requestId, target } = context
254
- return await request.send(user.otpReset({ requestId, target }))
259
+ return await request.send(
260
+ account.resetOtp({
261
+ request_id: requestId,
262
+ })
263
+ )
255
264
  },
256
265
  acknowledge: async (context, event) => {
257
266
  const { requestId, target } = context
258
267
  const code = event.data
259
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
268
+ return await request.send(account.bindingVerification({ requestId, code }))
260
269
  },
261
270
  },
262
271
  }