@jetthai/cuora 1.1.400-dev-12 → 1.1.400
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 +0 -24
- package/package.json +1 -1
- package/src/api/common.js +0 -5
- package/src/api/index.js +1 -3
- package/src/api/user.js +0 -1
- package/src/machine/auth.js +5 -1
- package/src/machine/auth_otp_v3.js +11 -43
- package/src/machine/common.js +1 -13
- package/src/machine/user_reset_password.js +2 -4
- package/src/request/request.js +25 -16
- package/src/api/account.js +0 -8
- package/src/api/otp.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,30 +2,6 @@
|
|
|
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.400-dev-12](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-11...v1.1.400-dev-12) (2025-12-18)
|
|
6
|
-
|
|
7
|
-
### [1.1.400-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-10...v1.1.400-dev-11) (2025-12-18)
|
|
8
|
-
|
|
9
|
-
### [1.1.400-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-9...v1.1.400-dev-10) (2025-12-18)
|
|
10
|
-
|
|
11
|
-
### [1.1.400-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-8...v1.1.400-dev-9) (2025-12-17)
|
|
12
|
-
|
|
13
|
-
### [1.1.400-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-7...v1.1.400-dev-8) (2025-12-16)
|
|
14
|
-
|
|
15
|
-
### [1.1.400-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-6...v1.1.400-dev-7) (2025-12-16)
|
|
16
|
-
|
|
17
|
-
### [1.1.400-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-5...v1.1.400-dev-6) (2025-12-16)
|
|
18
|
-
|
|
19
|
-
### [1.1.400-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-4...v1.1.400-dev-5) (2025-12-16)
|
|
20
|
-
|
|
21
|
-
### [1.1.400-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-3...v1.1.400-dev-4) (2025-12-16)
|
|
22
|
-
|
|
23
|
-
### [1.1.400-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-2...v1.1.400-dev-3) (2025-12-16)
|
|
24
|
-
|
|
25
|
-
### [1.1.400-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-1...v1.1.400-dev-2) (2025-12-16)
|
|
26
|
-
|
|
27
|
-
### [1.1.400-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.400...v1.1.400-dev-1) (2025-12-09)
|
|
28
|
-
|
|
29
5
|
### [1.1.400](https://github.com/jetthai/cuora-module/compare/v1.1.399...v1.1.400) (2025-11-25)
|
|
30
6
|
|
|
31
7
|
### [1.1.399](https://github.com/jetthai/cuora-module/compare/v1.2.0...v1.1.399) (2025-11-19)
|
package/package.json
CHANGED
package/src/api/common.js
CHANGED
|
@@ -7,9 +7,4 @@ export default {
|
|
|
7
7
|
getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
8
|
getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
|
|
9
9
|
getSiteInfoConfig: ({ appSecret, config }) => ({ url: 'get-site-config', method: 'get', params: { appSecret, config }, isPublic: true }),
|
|
10
|
-
sendPixel: ({ appSecret, eventId, fbc, fbp, event }) => ({
|
|
11
|
-
url: 'pixel',
|
|
12
|
-
method: 'post',
|
|
13
|
-
params: { appSecret, eventId, fbc, fbp, event },
|
|
14
|
-
}),
|
|
15
10
|
}
|
package/src/api/index.js
CHANGED
|
@@ -7,7 +7,5 @@ import payment from './payment.js'
|
|
|
7
7
|
import user from './user.js'
|
|
8
8
|
import form from './form.js'
|
|
9
9
|
import ranking from './ranking.js'
|
|
10
|
-
import account from './account.js'
|
|
11
|
-
import otp from './otp.js'
|
|
12
10
|
|
|
13
|
-
export default { activity, auth, common, game, mailbox, payment, user, form, ranking
|
|
11
|
+
export default { activity, auth, common, game, mailbox, payment, user, form, ranking }
|
package/src/api/user.js
CHANGED
|
@@ -65,5 +65,4 @@ export default {
|
|
|
65
65
|
otpReset: ({ requestId, target }) => ({ url: '/otpsso/reset', method: 'post', params: { requestId, target }, isPublic: true }),
|
|
66
66
|
getUserPhotoList: () => ({ url: 'getAllAvatar', method: 'get' }),
|
|
67
67
|
updateUserPhoto: (data) => ({ url: 'updateUserAvatar', method: 'post', params: data }),
|
|
68
|
-
getUserProfile: () => ({ url: 'user-info/get-profile', method: 'get' }),
|
|
69
68
|
}
|
package/src/machine/auth.js
CHANGED
|
@@ -465,7 +465,11 @@ export default function (request) {
|
|
|
465
465
|
referralObj.channel = storage.get('channel') || defaultChannel || channel
|
|
466
466
|
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
|
|
467
467
|
|
|
468
|
-
|
|
468
|
+
// OZE、ZAZA 先使用 v2 測試 ,等待確認沒問題後再統一用 v2
|
|
469
|
+
// 但 ZALO 仍維持 v1
|
|
470
|
+
const fullURL =
|
|
471
|
+
['OZE', 'ZAZA'].includes(clientId) && provider !== 'zalo' ? request.config.fullURL.replace('/v1/', '/v2/') : request.config.fullURL
|
|
472
|
+
|
|
469
473
|
const redirectURL = urljoin(
|
|
470
474
|
fullURL,
|
|
471
475
|
'login?' +
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import user from '../api/user.js'
|
|
3
|
-
import
|
|
3
|
+
import auth from '../api/auth.js'
|
|
4
4
|
|
|
5
5
|
export default function (request) {
|
|
6
6
|
return createMachine(
|
|
@@ -178,16 +178,12 @@ export default function (request) {
|
|
|
178
178
|
}
|
|
179
179
|
}),
|
|
180
180
|
setVerificationData: assign((context, event) => {
|
|
181
|
-
const {
|
|
181
|
+
const { requestId, ttl, target, status } = event.data
|
|
182
182
|
return {
|
|
183
|
-
requestId
|
|
184
|
-
ttl: ttl
|
|
185
|
-
target
|
|
186
|
-
|
|
187
|
-
email: email,
|
|
188
|
-
countryCode: countryCode,
|
|
189
|
-
phone: phone,
|
|
190
|
-
},
|
|
183
|
+
requestId,
|
|
184
|
+
ttl: ttl * 1000,
|
|
185
|
+
target,
|
|
186
|
+
status,
|
|
191
187
|
}
|
|
192
188
|
}),
|
|
193
189
|
decreaseTtl: assign((context, evnet) => {
|
|
@@ -243,52 +239,24 @@ export default function (request) {
|
|
|
243
239
|
return await request.send(user.getUserInfo())
|
|
244
240
|
},
|
|
245
241
|
verify: async (context, event) => {
|
|
246
|
-
|
|
247
|
-
return await request.send(
|
|
248
|
-
otp.verification({
|
|
249
|
-
strategy: provider,
|
|
250
|
-
email: provider === 'email' ? event.data.email : undefined,
|
|
251
|
-
countryCode: provider === 'phone' ? event.data.country_code : undefined,
|
|
252
|
-
phone: provider === 'phone' ? event.data.tel : undefined,
|
|
253
|
-
})
|
|
254
|
-
)
|
|
242
|
+
return await request.send(user.verifyV2Initiate({ strategy: context.strategy }))
|
|
255
243
|
},
|
|
256
244
|
sendPhone: async (context, event) => {
|
|
257
245
|
const { countryCode, phone } = context
|
|
258
|
-
return await request.send(
|
|
259
|
-
otp.verification({
|
|
260
|
-
strategy: 'phone',
|
|
261
|
-
countryCode,
|
|
262
|
-
phone,
|
|
263
|
-
})
|
|
264
|
-
)
|
|
246
|
+
return await request.send(auth.bindPost({ provider: 'phone', countryCode, phone }))
|
|
265
247
|
},
|
|
266
248
|
sendEmail: async (context, event) => {
|
|
267
249
|
const { email } = context
|
|
268
|
-
return await request.send(
|
|
269
|
-
otp.verification({
|
|
270
|
-
strategy: 'email',
|
|
271
|
-
email,
|
|
272
|
-
})
|
|
273
|
-
)
|
|
250
|
+
return await request.send(auth.bindPost({ provider: 'email', email }))
|
|
274
251
|
},
|
|
275
252
|
resetOtp: async (context, event) => {
|
|
276
253
|
const { requestId, target } = context
|
|
277
|
-
return await request.send(
|
|
278
|
-
otp.reset({
|
|
279
|
-
request_id: requestId,
|
|
280
|
-
})
|
|
281
|
-
)
|
|
254
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
282
255
|
},
|
|
283
256
|
acknowledge: async (context, event) => {
|
|
284
257
|
const { requestId, target } = context
|
|
285
258
|
const code = event.data
|
|
286
|
-
return await request.send(
|
|
287
|
-
otp.acknowledge({
|
|
288
|
-
request_id: requestId,
|
|
289
|
-
code,
|
|
290
|
-
})
|
|
291
|
-
)
|
|
259
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
292
260
|
},
|
|
293
261
|
},
|
|
294
262
|
}
|
package/src/machine/common.js
CHANGED
|
@@ -55,7 +55,7 @@ export default function (request) {
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
fetching: {
|
|
58
|
-
entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel'
|
|
58
|
+
entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel'],
|
|
59
59
|
invoke: {
|
|
60
60
|
src: 'fetchConfig',
|
|
61
61
|
onDone: [
|
|
@@ -237,18 +237,6 @@ export default function (request) {
|
|
|
237
237
|
isMobile: userAgent?.device?.type,
|
|
238
238
|
}
|
|
239
239
|
}),
|
|
240
|
-
setFbclid: assign(() => {
|
|
241
|
-
const urlParams = new URLSearchParams(window.location.search)
|
|
242
|
-
const fbclid = urlParams.get('fbclid') || ''
|
|
243
|
-
if (fbclid !== '') {
|
|
244
|
-
const timestamp = Date.now()
|
|
245
|
-
const cookieRecord = 'fb.1.' + timestamp + '.' + fbclid
|
|
246
|
-
document.cookie = `_fbc=${cookieRecord}; path=/; max-age=${60 * 60 * 24 * 7}`
|
|
247
|
-
}
|
|
248
|
-
return {
|
|
249
|
-
fbclid,
|
|
250
|
-
}
|
|
251
|
-
}),
|
|
252
240
|
setPixel: assign(() => {
|
|
253
241
|
let urlParams = new URLSearchParams(window.location.search)
|
|
254
242
|
const pix = urlParams.get('pix') || storage.get('pix') || ''
|
|
@@ -184,9 +184,8 @@ export default function (request) {
|
|
|
184
184
|
}
|
|
185
185
|
}),
|
|
186
186
|
decreaseTtl: assign((context, event) => {
|
|
187
|
-
const ms = context.ttl
|
|
188
187
|
return {
|
|
189
|
-
ttl: Math.max(
|
|
188
|
+
ttl: Math.max(context.ttl - 1, 0),
|
|
190
189
|
}
|
|
191
190
|
}),
|
|
192
191
|
setAcknowledgeResult: assign((context, event) => {
|
|
@@ -196,9 +195,8 @@ export default function (request) {
|
|
|
196
195
|
}
|
|
197
196
|
}),
|
|
198
197
|
decreaseAcknowledgeTtl: assign((context, event) => {
|
|
199
|
-
const ms = context.acknowledgeTtl
|
|
200
198
|
return {
|
|
201
|
-
acknowledgeTtl: Math.max(
|
|
199
|
+
acknowledgeTtl: Math.max(context.acknowledgeTtl - 1, 0),
|
|
202
200
|
}
|
|
203
201
|
}),
|
|
204
202
|
setNewPassword: assign((context, event) => {
|
package/src/request/request.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import pickBy from 'lodash/pickBy.js'
|
|
2
2
|
import storage from '../util/storage.js'
|
|
3
3
|
|
|
4
|
+
// const pickBy = require('lodash/pickBy')
|
|
4
5
|
const supportVersion2List = [
|
|
5
6
|
// 04-09 Update
|
|
6
7
|
'game/play',
|
|
@@ -139,21 +140,6 @@ const supportVersion2List = [
|
|
|
139
140
|
'game/list/v3/gameInfo',
|
|
140
141
|
'payment/v2/uploadCommonSlip',
|
|
141
142
|
'game/history/options',
|
|
142
|
-
// 09/30
|
|
143
|
-
'pixel',
|
|
144
|
-
// 10/09
|
|
145
|
-
'account-binding/status',
|
|
146
|
-
'account-binding/bind',
|
|
147
|
-
'account-binding/acknowledge',
|
|
148
|
-
'account-binding/bind-third-party',
|
|
149
|
-
'account-binding/bind-password',
|
|
150
|
-
'account-binding/reset-otp',
|
|
151
|
-
// 11/10
|
|
152
|
-
'otp-verification-point/verify',
|
|
153
|
-
'otp-verification-point/acknowledge',
|
|
154
|
-
'otp-verification-point/reset-otp',
|
|
155
|
-
// 12/02
|
|
156
|
-
'user-info/get-profile',
|
|
157
143
|
]
|
|
158
144
|
|
|
159
145
|
function isValid(value) {
|
|
@@ -280,7 +266,30 @@ export default class Request {
|
|
|
280
266
|
_createConfig(req, cancelToken) {
|
|
281
267
|
const { method, url, params, isPublic, isFormData, headers } = req
|
|
282
268
|
let fullURL = this.config.fullURL
|
|
283
|
-
let urlName =
|
|
269
|
+
let urlName = url
|
|
270
|
+
// 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
|
|
271
|
+
const cleanUrl = url.split('?')[0]
|
|
272
|
+
|
|
273
|
+
const isV2Supported = supportVersion2List.some((supportedUrl) => {
|
|
274
|
+
// 如果包含動態參數(:parameter),則使用模式匹配
|
|
275
|
+
if (supportedUrl.includes(':')) {
|
|
276
|
+
const pattern = supportedUrl.replace(/:[^/]+/g, '[^/]+')
|
|
277
|
+
const regex = new RegExp(`^${pattern}$`)
|
|
278
|
+
return regex.test(cleanUrl)
|
|
279
|
+
}
|
|
280
|
+
return supportedUrl === cleanUrl
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
// 目前全站都支援V2,若有需要限制為V1的站點可以填入,此段等轉換全部完成之後就可以移除了
|
|
284
|
+
const supportV2Toggle = [''].includes(this.config?.clientId)
|
|
285
|
+
|
|
286
|
+
if (isV2Supported && !supportV2Toggle) {
|
|
287
|
+
fullURL = fullURL.replace('/v1/', '/v2/')
|
|
288
|
+
urlName = this._convertUrlToKebabCase(url)
|
|
289
|
+
// console.log(`*[DEV_ONLY]V2`, 'url:', urlName)
|
|
290
|
+
} else {
|
|
291
|
+
// console.log(`*[DEV_ONLY]V2-不支援:`, 'url:', urlName)
|
|
292
|
+
}
|
|
284
293
|
|
|
285
294
|
if (isFormData) {
|
|
286
295
|
return {
|
package/src/api/account.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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 }),
|
|
5
|
-
bindThirdParty: (data) => ({ url: 'account-binding/bind-third-party', method: 'GET', params: data }),
|
|
6
|
-
bindPassword: (data) => ({ url: 'account-binding/bind-password', method: 'POST', params: data }),
|
|
7
|
-
resetOtp: (data) => ({ url: 'account-binding/reset-otp', method: 'POST', params: data }),
|
|
8
|
-
}
|
package/src/api/otp.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
verification: (data) => ({ url: 'otp-verification-point/verify', method: 'POST', params: data }),
|
|
3
|
-
acknowledge: (data) => ({ url: 'otp-verification-point/acknowledge', method: 'POST', params: data }),
|
|
4
|
-
reset: (data) => ({ url: 'otp-verification-point/reset-otp', method: 'POST', params: data }),
|
|
5
|
-
}
|