@jetthai/cuora 1.1.99 → 1.1.101

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.101](https://github.com/jetthai/cuora-module/compare/v1.1.100...v1.1.101) (2023-05-22)
6
+
7
+ ### [1.1.100](https://github.com/jetthai/cuora-module/compare/v1.1.99...v1.1.100) (2023-05-22)
8
+
5
9
  ### [1.1.99](https://github.com/jetthai/cuora-module/compare/v1.1.97...v1.1.99) (2023-05-22)
6
10
 
7
11
  ### [1.1.98](https://github.com/jetthai/cuora-module/compare/v1.1.97...v1.1.98) (2023-05-18)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.99",
3
+ "version": "1.1.101",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -7,9 +7,23 @@ export default function (request) {
7
7
  id: 'favorite',
8
8
  initial: 'fetching',
9
9
  context: {
10
+ auth: false,
10
11
  list: [],
11
12
  },
12
13
  states: {
14
+ idle: {},
15
+ checking: {
16
+ always: [
17
+ {
18
+ target: 'fetching',
19
+ cond: 'hasAuth',
20
+ },
21
+ {
22
+ target: 'idle',
23
+ actions: 'clearList',
24
+ },
25
+ ],
26
+ },
13
27
  fetching: {
14
28
  invoke: {
15
29
  src: 'fetchList',
@@ -17,7 +31,7 @@ export default function (request) {
17
31
  actions: 'setList',
18
32
  },
19
33
  onError: {
20
- actions: assign({ list: [] }),
34
+ actions: 'clearList',
21
35
  },
22
36
  },
23
37
  },
@@ -68,6 +82,13 @@ export default function (request) {
68
82
  actions: 'removeFromList',
69
83
  cond: 'isExist',
70
84
  },
85
+ SET_AUTH: [
86
+ {
87
+ target: 'checking',
88
+ actions: 'setAuth',
89
+ cond: 'isAuthChanged',
90
+ },
91
+ ],
71
92
  },
72
93
  },
73
94
  {
@@ -77,6 +98,11 @@ export default function (request) {
77
98
  list: event.data,
78
99
  }
79
100
  }),
101
+ clearList: assign((context, event) => {
102
+ return {
103
+ list: [],
104
+ }
105
+ }),
80
106
  addToList: assign((context, event) => {
81
107
  return {
82
108
  list: [...context.list, event.data],
@@ -87,10 +113,17 @@ export default function (request) {
87
113
  list: context.list.filter((item) => item.gameCode !== event.data.gameCode),
88
114
  }
89
115
  }),
116
+ setAuth: assign((context, event) => {
117
+ return {
118
+ auth: !!event.data,
119
+ }
120
+ }),
90
121
  },
91
122
  guards: {
92
123
  isExist: (context, event) => context.list.some((item) => item.gameCode === event.data.gameCode),
93
124
  isNotExist: (context, event) => !context.list.some((item) => item.gameCode === event.data.gameCode),
125
+ isAuthChanged: (context, event) => context.auth !== !!event.data,
126
+ hasAuth: (context, event) => context.auth,
94
127
  },
95
128
  services: {
96
129
  add: async (context, event) => {
@@ -9,7 +9,7 @@ export default function (request) {
9
9
  id: 'reward_cash',
10
10
  type: 'parallel',
11
11
  context: {
12
- hasAuth: false,
12
+ auth: false,
13
13
  otherRewardList: [],
14
14
  pointsRewardList: [],
15
15
  rewardList: [],
@@ -27,7 +27,7 @@ export default function (request) {
27
27
  {
28
28
  target: 'loading',
29
29
  cond: (context, event) => {
30
- return context.hasAuth
30
+ return context.auth
31
31
  },
32
32
  },
33
33
  ],
@@ -137,8 +137,7 @@ export default function (request) {
137
137
  target: '.timer.checking',
138
138
  actions: 'setAuth',
139
139
  cond: (context, event) => {
140
- console.log(context.hasAuth, event.data)
141
- return context.hasAuth !== event.data
140
+ return context.auth !== !!event.data
142
141
  },
143
142
  },
144
143
  },
@@ -146,7 +145,7 @@ export default function (request) {
146
145
  {
147
146
  actions: {
148
147
  setAuth: assign((context, event) => {
149
- return { hasAuth: event.data }
148
+ return { auth: !!event.data }
150
149
  }),
151
150
  setRewardList: assign((context, event) => {
152
151
  return {
@@ -3,8 +3,8 @@ import withdraw_vn from './withdraw_vn.js'
3
3
  import withdraw_vn2 from './withdraw_vn2.js'
4
4
  import withdraw_crypto from './withdraw_crypto.js'
5
5
  import withdraw_amb from './withdraw_amb.js'
6
- import crypto_cash from './crypto_cash.js'
7
- import manual_cash from './manual_cash.js'
6
+ import withdraw_crypto_cash from './withdraw_crypto_cash.js'
7
+ import withdraw_manual_cash from './withdraw_manual_cash.js'
8
8
 
9
9
  export default {
10
10
  withdraw_fc,
@@ -12,6 +12,6 @@ export default {
12
12
  withdraw_vn2,
13
13
  withdraw_crypto,
14
14
  withdraw_amb,
15
- crypto_cash,
16
- manual_cash,
15
+ withdraw_crypto_cash,
16
+ withdraw_manual_cash,
17
17
  }
@@ -7,7 +7,7 @@ export default function (request, context) {
7
7
  const { paymentDetail = [] } = context || {}
8
8
  return createMachine(
9
9
  {
10
- id: 'crypto_cash',
10
+ id: 'withdraw_crypto_cash',
11
11
  initial: 'loading',
12
12
  context: {
13
13
  paymentDetail,
@@ -126,7 +126,7 @@ export default function (request, context) {
126
126
  src: 'acknowledge',
127
127
  onDone: [
128
128
  {
129
- target: '#crypto_cash.submitted',
129
+ target: '#withdraw_crypto_cash.submitted',
130
130
  },
131
131
  ],
132
132
  onError: {
@@ -6,7 +6,7 @@ export default function (request, context) {
6
6
  const { paymentDetail = [] } = context || {}
7
7
  return createMachine(
8
8
  {
9
- id: 'manual_cash',
9
+ id: 'withdraw_manual_cash',
10
10
  initial: 'loading',
11
11
  context: {
12
12
  paymentDetail,