@jetthai/cuora 1.1.112 → 1.1.113

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.113](https://github.com/jetthai/cuora-module/compare/v1.1.96-signin-5...v1.1.113) (2023-05-31)
6
+
5
7
  ### [1.1.112](https://github.com/jetthai/cuora-module/compare/v1.1.104-1...v1.1.112) (2023-05-31)
6
8
 
7
9
  ### [1.1.111](https://github.com/jetthai/cuora-module/compare/v1.1.110...v1.1.111) (2023-05-30)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.112",
3
+ "version": "1.1.113",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -16,6 +16,7 @@ import sign_in_activity from './sign_in_activity.js'
16
16
  import time_bomb_activity from './time_bomb_activity.js'
17
17
  import mini_game_activity from './mini_game_activity.js'
18
18
  import roulette_activity_v2 from './roulette_activity_v2.js'
19
+ import sign_in_monthly_activity from './sign_in_monthly_activity.js'
19
20
  import otp_verified_activity from './otp_verified_activity.js'
20
21
 
21
22
  export default {
@@ -37,5 +38,6 @@ export default {
37
38
  time_bomb_activity,
38
39
  mini_game_activity,
39
40
  roulette_activity_v2,
41
+ sign_in_monthly_activity,
40
42
  otp_verified_activity,
41
43
  }
@@ -0,0 +1,65 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import api from '@jetthai/cuora/src/api/activity'
3
+
4
+ export default function (request) {
5
+ const { appSecret } = request.config
6
+ return createMachine(
7
+ {
8
+ id: 'sign_in_monthly',
9
+ context: {
10
+ activityNo: null,
11
+ activityDetail: null,
12
+ receiveStatus: 0,
13
+ rewardsCalendar: [],
14
+ },
15
+ initial: 'idle',
16
+ states: {
17
+ idle: {
18
+ on: {
19
+ SET_ACTIVITY_NO: {
20
+ target: 'fetching',
21
+ actions: 'setActivityNo',
22
+ },
23
+ },
24
+ },
25
+ fetching: {
26
+ invoke: {
27
+ src: 'fetchActivityDetail',
28
+ onDone: {
29
+ target: 'loaded',
30
+ actions: 'setInitData',
31
+ },
32
+ onError: {
33
+ target: 'loaded',
34
+ },
35
+ },
36
+ },
37
+ loaded: {},
38
+ },
39
+ },
40
+ {
41
+ actions: {
42
+ setActivityNo: assign((context, event) => {
43
+ return {
44
+ activityNo: event.data,
45
+ }
46
+ }),
47
+ setInitData: assign((context, event) => {
48
+ const { rewardsCalendar = [], receiveStatus = 0 } = event.data || {}
49
+ return {
50
+ activityDetail: event.data,
51
+ rewardsCalendar,
52
+ receiveStatus,
53
+ }
54
+ }),
55
+ },
56
+ services: {
57
+ fetchActivityDetail: async (context, event) => {
58
+ const { activityNo } = context
59
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
60
+ return data
61
+ },
62
+ },
63
+ }
64
+ )
65
+ }