@jetthai/cuora 1.1.230 → 1.1.232

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.1.232](https://github.com/jetthai/cuora-module/compare/v1.1.231...v1.1.232) (2024-03-11)
6
+
7
+ ### [1.1.231](https://github.com/jetthai/cuora-module/compare/v1.1.230...v1.1.231) (2024-03-05)
8
+
5
9
  ### [1.1.230](https://github.com/jetthai/cuora-module/compare/v1.1.229...v1.1.230) (2024-03-01)
6
10
 
7
11
  ### [1.1.229](https://github.com/jetthai/cuora-module/compare/v1.1.228...v1.1.229) (2024-02-26)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.230",
3
+ "version": "1.1.232",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -0,0 +1,90 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import api from '../../api/activity.js'
3
+
4
+ export default function (request, context) {
5
+ const { activityNo } = context || {}
6
+ const { appSecret } = request.config
7
+ return createMachine(
8
+ {
9
+ id: 'cash_rain_activity',
10
+ context: {
11
+ activityNo,
12
+ activityDetail: null,
13
+ duration: null,
14
+ },
15
+ initial: 'idle',
16
+ states: {
17
+ idle: {
18
+ on: {
19
+ SET_ACTIVITY_NO: {
20
+ target: 'loading',
21
+ actions: 'setActivityNo',
22
+ },
23
+ },
24
+ },
25
+ loading: {
26
+ invoke: {
27
+ src: 'fetchActivityDetail',
28
+ onDone: {
29
+ target: 'loaded',
30
+ actions: 'setActivityDetail',
31
+ },
32
+ onError: {
33
+ target: 'idle',
34
+ },
35
+ },
36
+ },
37
+ loaded: {
38
+ entry: 'setDuration',
39
+ always: [{ target: 'expired', cond: 'isExpired' }],
40
+ after: {
41
+ 1000: {
42
+ target: 'loaded',
43
+ },
44
+ },
45
+ },
46
+ expired: {},
47
+ },
48
+ on: {
49
+ START: {
50
+ target: '.loading',
51
+ },
52
+ STOP: {
53
+ target: '.idle',
54
+ },
55
+ },
56
+ },
57
+ {
58
+ actions: {
59
+ setActivityNo: assign((context, event) => {
60
+ return {
61
+ activityNo: event.data,
62
+ }
63
+ }),
64
+ setActivityDetail: assign((context, event) => {
65
+ return {
66
+ activityDetail: event.data,
67
+ }
68
+ }),
69
+ setDuration: assign((context, event) => {
70
+ const { activityDetail = {} } = context
71
+ return {
72
+ duration: activityDetail.periodEndTime - new Date().getTime() / 1000,
73
+ }
74
+ }),
75
+ },
76
+ guards: {
77
+ isExpired: (context, event) => {
78
+ return context.duration <= 0
79
+ },
80
+ },
81
+ services: {
82
+ fetchActivityDetail: async (context, event) => {
83
+ const { activityNo } = context
84
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
85
+ return data
86
+ },
87
+ },
88
+ }
89
+ )
90
+ }
@@ -20,6 +20,7 @@ import sign_in_monthly_activity from './sign_in_monthly_activity.js'
20
20
  import otp_verified_activity from './otp_verified_activity.js'
21
21
  import vip_card_activity from './vip_card_activity.js'
22
22
  import instant_rebate_activity from './instant_rebate_activity.js'
23
+ import cash_rain_activity from './cash_rain_activity.js'
23
24
 
24
25
  export default {
25
26
  activity,
@@ -44,4 +45,5 @@ export default {
44
45
  otp_verified_activity,
45
46
  vip_card_activity,
46
47
  instant_rebate_activity,
48
+ cash_rain_activity,
47
49
  }
@@ -13,7 +13,7 @@ export const GAME_TYPE_LIST = [
13
13
  { typeId: 'EGAME', name: 'E-Game', gameTypeMappingId: 10 },
14
14
  { typeId: 'BONUS', name: 'Bonus', gameTypeMappingId: 11 },
15
15
  { typeId: 'BALL', name: 'Ball', gameTypeMappingId: 12 },
16
- { typeId: 'STOCK', name: 'Stock', gameTypeMappingId: 13 },
16
+ { typeId: 'PACHINKO', name: 'Pachinko', gameTypeMappingId: 13 },
17
17
  { typeId: 'GRAPH', name: 'Graph', gameTypeMappingId: 14 },
18
18
  { typeId: 'TURBO', name: 'Turbo', gameTypeMappingId: 15 },
19
19
  { typeId: 'SPORT', name: 'Sports', gameTypeMappingId: 16 },