@jetthai/cuora 1.1.141 → 1.1.143-1

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,12 @@
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.143-1](https://github.com/jetthai/cuora-module/compare/v1.1.143...v1.1.143-1) (2023-07-25)
6
+
7
+ ### [1.1.143](https://github.com/jetthai/cuora-module/compare/v1.1.142...v1.1.143) (2023-07-17)
8
+
9
+ ### [1.1.142](https://github.com/jetthai/cuora-module/compare/v1.1.141...v1.1.142) (2023-07-17)
10
+
5
11
  ### [1.1.141](https://github.com/jetthai/cuora-module/compare/v1.1.140...v1.1.141) (2023-07-17)
6
12
 
7
13
  ### [1.1.140](https://github.com/jetthai/cuora-module/compare/v1.1.139...v1.1.140) (2023-07-17)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.141",
3
+ "version": "1.1.143-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -7,7 +7,7 @@ export default function (request) {
7
7
  return createMachine(
8
8
  {
9
9
  id: 'activity',
10
- initial: 'fetchingList',
10
+ initial: 'init',
11
11
  context: {
12
12
  tick: 2000,
13
13
  specifyActivities: [29],
@@ -18,8 +18,17 @@ export default function (request) {
18
18
  tournamentList: [],
19
19
  refs: {},
20
20
  uidSite: '',
21
+ siteConfig: {},
21
22
  },
22
23
  states: {
24
+ init: {
25
+ on: {
26
+ SET_CONFIG: {
27
+ target: 'fetchingList',
28
+ actions: 'setSiteConifg',
29
+ },
30
+ },
31
+ },
23
32
  fetchingList: {
24
33
  invoke: {
25
34
  src: 'fetchList',
@@ -77,6 +86,11 @@ export default function (request) {
77
86
  },
78
87
  {
79
88
  actions: {
89
+ setSiteConifg: assign((context, event) => {
90
+ return {
91
+ siteConfig: event.data,
92
+ }
93
+ }),
80
94
  setTournamentList: assign((context, event) => {
81
95
  const { activityList } = event.data
82
96
  const tournamentList = activityList.filter((item) => item.tournament === 1)
@@ -146,9 +160,11 @@ export default function (request) {
146
160
  services: {
147
161
  fetchList: async (context, event) => {
148
162
  const hasToken = request.getToken()
163
+ const isDoubleWallet = context.siteConfig?.walletMode === '4'
164
+ const apiCallable = hasToken && isDoubleWallet
149
165
  const [{ data }, promotionList] = await Promise.all([
150
166
  request.send(activity.getActivityList({ appSecret })),
151
- hasToken ? request.send(payment.getPromotionsList()) : [],
167
+ apiCallable ? request.send(payment.getPromotionsList()) : [],
152
168
  ])
153
169
 
154
170
  return { activityList: data, promotionList }
@@ -90,7 +90,7 @@ export default function (request, context) {
90
90
  internal: false,
91
91
  },
92
92
  SELECT_DIRECT: {
93
- target: '.debouncing',
93
+ target: '.loading',
94
94
  actions: 'setDirect',
95
95
  internal: false,
96
96
  },
@@ -1,5 +1,5 @@
1
1
  import uniqBy from 'lodash/uniqBy'
2
- import { load } from '../lib/fingerprint.js'
2
+ import { load, defaultEndpoint } from '../lib/fingerprint.js'
3
3
 
4
4
  const reg = /fnapi\d*/
5
5
 
@@ -15,7 +15,7 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
15
15
  (url) => url
16
16
  )
17
17
 
18
- const fp = await load({ endpoint: endpoints })
18
+ const fp = await load({ endpoint: [...endpoints, defaultEndpoint] })
19
19
  const result = await fp.get({ timeout: 30000 })
20
20
  dt = result.visitorId
21
21