@jetthai/cuora 1.0.61 → 1.0.63

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,10 @@
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.0.63](https://github.com/jetthai/cuora-module/compare/v1.0.62...v1.0.63) (2021-12-22)
6
+
7
+ ### [1.0.62](https://github.com/jetthai/cuora-module/compare/v1.0.61...v1.0.62) (2021-12-22)
8
+
5
9
  ### [1.0.61](https://github.com/jetthai/cuora-module/compare/v1.0.60...v1.0.61) (2021-12-22)
6
10
 
7
11
  ### [1.0.60](https://github.com/jetthai/cuora-module/compare/v1.0.59...v1.0.60) (2021-12-20)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -8,9 +8,17 @@ export default function (request) {
8
8
  {
9
9
  id: 'fafafa_activity',
10
10
  context: {
11
+ isAutoReceiving: true,
11
12
  activityNo: null,
12
13
  activityDetail: null,
14
+
15
+ // 領獎後得到的資訊
16
+ awards: [],
17
+ periodBeginTime: null,
18
+ periodEndTime: null,
13
19
  receiveNo: null,
20
+ receiveReward: null,
21
+
14
22
  callback: () => {},
15
23
  },
16
24
  initial: 'idle',
@@ -31,12 +39,7 @@ export default function (request) {
31
39
  },
32
40
  },
33
41
  loaded: {
34
- always: [{ target: 'awardable', cond: 'isAwardable' }],
35
- on: {
36
- REFRESH_ACTIVITY: {
37
- target: 'loading',
38
- },
39
- },
42
+ always: [{ target: 'awardable', cond: 'isAwardable' }, { target: 'awarded' }],
40
43
  },
41
44
  awardable: {
42
45
  on: {
@@ -49,10 +52,10 @@ export default function (request) {
49
52
  awarding: {
50
53
  invoke: {
51
54
  src: 'awardPrize',
52
- onDone: {
53
- target: 'receiving',
54
- actions: 'setReceiveNo',
55
- },
55
+ onDone: [
56
+ { target: 'receiving', actions: 'setAward', cond: 'isAutoReceiving' },
57
+ { target: 'awarded', actions: 'setAward' },
58
+ ],
56
59
  onError: {
57
60
  target: 'loaded',
58
61
  },
@@ -70,6 +73,13 @@ export default function (request) {
70
73
  },
71
74
  },
72
75
  },
76
+ awarded: {
77
+ on: {
78
+ REFRESH_ACTIVITY: {
79
+ target: 'loading',
80
+ },
81
+ },
82
+ },
73
83
  },
74
84
  on: {
75
85
  SET_ACTIVITY_NO: {
@@ -91,9 +101,14 @@ export default function (request) {
91
101
  activityDetail: event.data,
92
102
  }
93
103
  }),
94
- setReceiveNo: assign((context, event) => {
104
+ setAward: assign((context, event) => {
105
+ const { awards, periodBeginTime, periodEndTime, receiveNo, receiveReward } = event.data
95
106
  return {
96
- receiveNo: event.data.receiveNo,
107
+ awards,
108
+ periodBeginTime,
109
+ periodEndTime,
110
+ receiveNo,
111
+ receiveReward,
97
112
  }
98
113
  }),
99
114
  setCallback: assign((context, event) => {
@@ -115,6 +130,9 @@ export default function (request) {
115
130
  isAwardable: (context, event) => {
116
131
  return context.activityDetail?.receiveStatus === 2
117
132
  },
133
+ isAutoReceiving: (context, event) => {
134
+ return context.isAutoReceiving
135
+ },
118
136
  },
119
137
  services: {
120
138
  fetchActivityDetail: async (context, event) => {