@jetthai/cuora 1.1.386 → 1.1.387-dev-1
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 +6 -0
- package/package.json +1 -1
- package/src/api/activity.js +1 -0
- package/src/machine/common.js +3 -2
- package/src/machine/game_v2_1.js +1 -56
- package/src/machine/user_sign_up.js +4 -0
- package/src/request/request.js +1 -0
- package/src/util/sessionStorage.js +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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.387-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.387-dev...v1.1.387-dev-1) (2025-09-26)
|
|
6
|
+
|
|
7
|
+
### [1.1.387-dev](https://github.com/jetthai/cuora-module/compare/v1.1.387...v1.1.387-dev) (2025-09-26)
|
|
8
|
+
|
|
9
|
+
### [1.1.387](https://github.com/jetthai/cuora-module/compare/v1.1.386...v1.1.387) (2025-09-23)
|
|
10
|
+
|
|
5
11
|
### [1.1.386](https://github.com/jetthai/cuora-module/compare/v1.1.385...v1.1.386) (2025-09-19)
|
|
6
12
|
|
|
7
13
|
### [1.1.385](https://github.com/jetthai/cuora-module/compare/v1.1.384...v1.1.385) (2025-09-17)
|
package/package.json
CHANGED
package/src/api/activity.js
CHANGED
|
@@ -85,6 +85,7 @@ export default {
|
|
|
85
85
|
exchange: (data) => ({ url: 'activities/exchange', method: 'post', params: data }),
|
|
86
86
|
collect: (data) => ({ url: 'activities/collect', method: 'post', params: data }),
|
|
87
87
|
getVipTable: ({ appSecret }) => ({ url: 'activities/viptable', method: 'get', params: { appSecret } }),
|
|
88
|
+
getLevelBonusInfo: () => ({ url: 'activities/level-bonus/info', method: 'get' }),
|
|
88
89
|
getRankingList: () => ({ url: 'activities/ranking', method: 'get' }),
|
|
89
90
|
exchangeDiamond: ({ activityNo, exchangeAward = [] }) => ({
|
|
90
91
|
url: 'activities/exchange/diamond',
|
package/src/machine/common.js
CHANGED
|
@@ -3,6 +3,7 @@ import { assign, createMachine } from 'xstate'
|
|
|
3
3
|
import pickBy from 'lodash/pickBy.js'
|
|
4
4
|
import api from '../api/common.js'
|
|
5
5
|
import storage from '../util/storage.js'
|
|
6
|
+
import sessionStorage from '../util/sessionStorage.js'
|
|
6
7
|
|
|
7
8
|
export default function (request) {
|
|
8
9
|
const { appSecret, defaultChannel, defaultSubchannel } = request.config
|
|
@@ -258,7 +259,7 @@ export default function (request) {
|
|
|
258
259
|
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
|
|
259
260
|
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
|
|
260
261
|
const affiliateCode = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
|
|
261
|
-
const friendCode = urlParams.get('fc') || urlParams.get('affiliate') ||
|
|
262
|
+
const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || sessionStorage.get('fc') || sessionStorage.get('affiliate')
|
|
262
263
|
|
|
263
264
|
storage.set('channel', channel, {
|
|
264
265
|
path: '/',
|
|
@@ -272,7 +273,7 @@ export default function (request) {
|
|
|
272
273
|
path: '/',
|
|
273
274
|
maxAge: 60 * 60 * 24 * 7,
|
|
274
275
|
})
|
|
275
|
-
|
|
276
|
+
sessionStorage.set('fc', friendCode, {
|
|
276
277
|
path: '/',
|
|
277
278
|
maxAge: 60 * 60 * 24 * 7,
|
|
278
279
|
})
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -5,7 +5,7 @@ import { GAME_SEARCH } from '../util/constant.js'
|
|
|
5
5
|
|
|
6
6
|
// 對應 intersectionObserver 版本
|
|
7
7
|
export default function (request) {
|
|
8
|
-
const { appSecret
|
|
8
|
+
const { appSecret } = request.config
|
|
9
9
|
return createMachine(
|
|
10
10
|
{
|
|
11
11
|
id: 'game',
|
|
@@ -518,17 +518,6 @@ export default function (request) {
|
|
|
518
518
|
} else if (additionEnable) {
|
|
519
519
|
const param = { categoryId: room.categoryId, index, appSecret }
|
|
520
520
|
requestChain = event.data.list.map((category, b) => {
|
|
521
|
-
// 參數必填檢查
|
|
522
|
-
if (!category?.id) {
|
|
523
|
-
sentry?.captureMessage('PARAMETER_ERROR', {
|
|
524
|
-
level: 'warning',
|
|
525
|
-
tags: {
|
|
526
|
-
caller: 'batchFetch',
|
|
527
|
-
action: 'getListCategory',
|
|
528
|
-
param: JSON.stringify(category?.id),
|
|
529
|
-
},
|
|
530
|
-
})
|
|
531
|
-
}
|
|
532
521
|
return request
|
|
533
522
|
.send(
|
|
534
523
|
api.getListCategory({
|
|
@@ -539,32 +528,10 @@ export default function (request) {
|
|
|
539
528
|
)
|
|
540
529
|
.then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
|
|
541
530
|
})
|
|
542
|
-
// 參數必填檢查
|
|
543
|
-
if (!param?.categoryId) {
|
|
544
|
-
sentry?.captureMessage('PARAMETER_ERROR', {
|
|
545
|
-
level: 'warning',
|
|
546
|
-
tags: {
|
|
547
|
-
caller: 'batchFetch',
|
|
548
|
-
action: 'getListAddition',
|
|
549
|
-
param: JSON.stringify(param),
|
|
550
|
-
},
|
|
551
|
-
})
|
|
552
|
-
}
|
|
553
531
|
const result = await Promise.all([...requestChain, request.send(api.getListAddition(param))])
|
|
554
532
|
return result.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
555
533
|
} else {
|
|
556
534
|
requestChain = event.data.list.map((category, b) => {
|
|
557
|
-
// 參數必填檢查
|
|
558
|
-
if (!category?.id) {
|
|
559
|
-
sentry?.captureMessage('PARAMETER_ERROR', {
|
|
560
|
-
level: 'warning',
|
|
561
|
-
tags: {
|
|
562
|
-
caller: 'batchFetch/else',
|
|
563
|
-
action: 'getListCategory',
|
|
564
|
-
param: JSON.stringify(category?.id),
|
|
565
|
-
},
|
|
566
|
-
})
|
|
567
|
-
}
|
|
568
535
|
return request
|
|
569
536
|
.send(
|
|
570
537
|
api.getListCategory({
|
|
@@ -595,31 +562,9 @@ export default function (request) {
|
|
|
595
562
|
]
|
|
596
563
|
} else if (additionEnable) {
|
|
597
564
|
const param = { categoryId: room.categoryId, index, appSecret }
|
|
598
|
-
// 參數必填檢查
|
|
599
|
-
if (!param?.categoryId) {
|
|
600
|
-
sentry?.captureMessage('PARAMETER_ERROR', {
|
|
601
|
-
level: 'warning',
|
|
602
|
-
tags: {
|
|
603
|
-
caller: 'getPageContent',
|
|
604
|
-
action: 'getListCategory/getListAddition',
|
|
605
|
-
param: JSON.stringify(param),
|
|
606
|
-
},
|
|
607
|
-
})
|
|
608
|
-
}
|
|
609
565
|
return await Promise.all([request.send(api.getListCategory(param)), request.send(api.getListAddition(param))])
|
|
610
566
|
} else {
|
|
611
567
|
const param = { categoryId: room.categoryId, index, appSecret }
|
|
612
|
-
// 參數必填檢查
|
|
613
|
-
if (!param?.categoryId) {
|
|
614
|
-
sentry?.captureMessage('PARAMETER_ERROR', {
|
|
615
|
-
level: 'warning',
|
|
616
|
-
tags: {
|
|
617
|
-
caller: 'getPageContent/else',
|
|
618
|
-
action: 'getListCategory',
|
|
619
|
-
param: JSON.stringify(param),
|
|
620
|
-
},
|
|
621
|
-
})
|
|
622
|
-
}
|
|
623
568
|
return await Promise.all([request.send(api.getListCategory(param))])
|
|
624
569
|
}
|
|
625
570
|
},
|
|
@@ -76,6 +76,7 @@ export default function (request) {
|
|
|
76
76
|
}),
|
|
77
77
|
setSignUpId: assign((context, event) => {
|
|
78
78
|
const {
|
|
79
|
+
email,
|
|
79
80
|
username,
|
|
80
81
|
nick_name,
|
|
81
82
|
password,
|
|
@@ -93,6 +94,7 @@ export default function (request) {
|
|
|
93
94
|
return {
|
|
94
95
|
signUpData: {
|
|
95
96
|
provider: 'local',
|
|
97
|
+
email,
|
|
96
98
|
username,
|
|
97
99
|
nick_name,
|
|
98
100
|
password,
|
|
@@ -111,6 +113,7 @@ export default function (request) {
|
|
|
111
113
|
}),
|
|
112
114
|
setSignUpPhone: assign((context, event) => {
|
|
113
115
|
const {
|
|
116
|
+
email,
|
|
114
117
|
countryCode,
|
|
115
118
|
phone,
|
|
116
119
|
nick_name,
|
|
@@ -127,6 +130,7 @@ export default function (request) {
|
|
|
127
130
|
return {
|
|
128
131
|
signUpData: {
|
|
129
132
|
provider: 'phone',
|
|
133
|
+
email,
|
|
130
134
|
countryCode,
|
|
131
135
|
phone,
|
|
132
136
|
nick_name,
|
package/src/request/request.js
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
get(name, options) {
|
|
3
|
+
const itemStr = sessionStorage.getItem(name)
|
|
4
|
+
|
|
5
|
+
if (!itemStr) {
|
|
6
|
+
return null
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const item = JSON.parse(itemStr)
|
|
10
|
+
if (item.expiry && new Date().getTime() > item.expiry) {
|
|
11
|
+
sessionStorage.removeItem(name)
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return item.value
|
|
16
|
+
},
|
|
17
|
+
set(name, value, options) {
|
|
18
|
+
const item = { value }
|
|
19
|
+
|
|
20
|
+
if (options?.maxAge) {
|
|
21
|
+
item.expiry = new Date().getTime() + options.maxAge * 1000
|
|
22
|
+
}
|
|
23
|
+
sessionStorage.setItem(name, JSON.stringify(item))
|
|
24
|
+
},
|
|
25
|
+
remove(name, options) {
|
|
26
|
+
sessionStorage.removeItem(name)
|
|
27
|
+
},
|
|
28
|
+
}
|