@jetthai/cuora 1.1.233 → 1.1.235

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,14 @@
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.235](https://github.com/jetthai/cuora-module/compare/v1.1.234...v1.1.235) (2024-03-25)
6
+
7
+ ### [1.1.234](https://github.com/jetthai/cuora-module/compare/v1.1.233...v1.1.234) (2024-03-13)
8
+
9
+ ### Bug Fixes
10
+
11
+ - game search ([1184b7c](https://github.com/jetthai/cuora-module/commit/1184b7cd9fcd16f6b3273477b1232a14604efe6b))
12
+
5
13
  ### [1.1.233](https://github.com/jetthai/cuora-module/compare/v1.1.232...v1.1.233) (2024-03-12)
6
14
 
7
15
  ### [1.1.232](https://github.com/jetthai/cuora-module/compare/v1.1.231...v1.1.232) (2024-03-11)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.233",
3
+ "version": "1.1.235",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -57,6 +57,11 @@ export default {
57
57
  method: 'get',
58
58
  params: { rewardType, count, appSecret },
59
59
  }),
60
+ getCashRainReward: ({ activityNo, appSecret }) => ({
61
+ url: `activities/cashRain`,
62
+ method: 'post',
63
+ params: { activityNo, appSecret },
64
+ }),
60
65
  getMaxExchangeAmount: (data) => ({ url: 'activities/exchange/diamond/max-amount', method: 'post', params: data }),
61
66
  settleAmount: (data) => ({ url: 'activities/exchange/diamond/settle', method: 'post', params: data }),
62
67
  exchange: (data) => ({ url: 'activities/exchange', method: 'post', params: data }),
@@ -10,7 +10,7 @@ export default function (request) {
10
10
  initial: 'init',
11
11
  context: {
12
12
  tick: 2000,
13
- specifyActivities: [29],
13
+ specifyActivities: [29, 34],
14
14
  activitiesDetailList: [],
15
15
  activityList: [],
16
16
  promotionList: [],
@@ -11,6 +11,10 @@ export default function (request, context) {
11
11
  activityNo,
12
12
  activityDetail: null,
13
13
  duration: null,
14
+
15
+ // 領獎後得到的資訊
16
+ amount: null,
17
+ message: null,
14
18
  },
15
19
  initial: 'idle',
16
20
  states: {
@@ -20,6 +24,10 @@ export default function (request, context) {
20
24
  target: 'loading',
21
25
  actions: 'setActivityNo',
22
26
  },
27
+ RESET_AWARD: {
28
+ target: 'loaded',
29
+ actions: 'resetAward',
30
+ },
23
31
  },
24
32
  },
25
33
  loading: {
@@ -42,6 +50,28 @@ export default function (request, context) {
42
50
  target: 'loaded',
43
51
  },
44
52
  },
53
+ on: {
54
+ AWARD_PRIZE: {
55
+ target: 'awarding',
56
+ actions: 'setCallback',
57
+ },
58
+ },
59
+ },
60
+ awarding: {
61
+ invoke: {
62
+ src: 'awardPrize',
63
+ onDone: [{ target: 'receivable', actions: 'setAward' }],
64
+ onError: {
65
+ target: 'loaded',
66
+ },
67
+ },
68
+ },
69
+ receivable: {
70
+ after: {
71
+ 0: {
72
+ target: 'loading',
73
+ },
74
+ },
45
75
  },
46
76
  expired: {},
47
77
  },
@@ -72,6 +102,24 @@ export default function (request, context) {
72
102
  duration: activityDetail.periodEndTime - new Date().getTime() / 1000,
73
103
  }
74
104
  }),
105
+ setAward: assign((context, event) => {
106
+ const { amount, message } = event.data
107
+ return {
108
+ amount,
109
+ message,
110
+ }
111
+ }),
112
+ setCallback: assign((context, event) => {
113
+ return {
114
+ callback: event.data?.callback || (() => {}),
115
+ }
116
+ }),
117
+ resetAward: assign((context, event) => {
118
+ return {
119
+ amount: null,
120
+ message: null,
121
+ }
122
+ }),
75
123
  },
76
124
  guards: {
77
125
  isExpired: (context, event) => {
@@ -84,6 +132,11 @@ export default function (request, context) {
84
132
  const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
85
133
  return data
86
134
  },
135
+ awardPrize: async (context, event) => {
136
+ const { activityNo } = context
137
+ const { data } = await request.send(api.getCashRainReward({ activityNo, appSecret }))
138
+ return data
139
+ },
87
140
  },
88
141
  }
89
142
  )
@@ -255,9 +255,9 @@ export default function (request) {
255
255
  } else {
256
256
  const { tagId, recentlyGame, youMayLike } = context
257
257
  let gameList = []
258
- if (tagId === 'RECENTLY') {
258
+ if (tagId === 'Recently') {
259
259
  gameList = recentlyGame
260
- } else if (tagId === 'YOU MAY LIKE') {
260
+ } else if (tagId === 'You may like') {
261
261
  gameList = youMayLike
262
262
  }
263
263
  return {
@@ -323,7 +323,7 @@ export default function (request) {
323
323
  guards: {
324
324
  isRecentlyYouMayLike: (context, event) => {
325
325
  const { tagId } = context
326
- return tagId === 'RECENTLY' || tagId === 'YOU MAY LIKE'
326
+ return tagId === 'Recently' || tagId === 'You may like'
327
327
  },
328
328
  hasTagList: (context, event) => {
329
329
  const { tagList } = context
@@ -368,7 +368,7 @@ export default function (request) {
368
368
  isRecentlySearch,
369
369
  } = context
370
370
  let id = tagId
371
- if (tagId === 'RECENTLY' || tagId === 'YOU MAY LIKE') {
371
+ if (tagId === 'Recently' || tagId === 'You may like') {
372
372
  id = null
373
373
  }
374
374
  return await request.send(