@jetthai/cuora 1.1.387-dev → 1.1.387-dev-2

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.387-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.387-dev-1...v1.1.387-dev-2) (2025-10-01)
6
+
7
+ ### [1.1.387-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.387-dev...v1.1.387-dev-1) (2025-09-26)
8
+
5
9
  ### [1.1.387-dev](https://github.com/jetthai/cuora-module/compare/v1.1.387...v1.1.387-dev) (2025-09-26)
6
10
 
7
11
  ### [1.1.387](https://github.com/jetthai/cuora-module/compare/v1.1.386...v1.1.387) (2025-09-23)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.387-dev",
3
+ "version": "1.1.387-dev-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -85,6 +85,7 @@ export default {
85
85
  exchange: (data) => ({ url: 'activities/exchange', method: 'post', params: data }),
86
86
  collect: (data) => ({ url: 'activities/collect', method: 'post', params: data }),
87
87
  getVipTable: ({ appSecret }) => ({ url: 'activities/viptable', method: 'get', params: { appSecret } }),
88
+ getLevelBonusInfo: () => ({ url: 'activities/level-bonus/info', method: 'get' }),
88
89
  getRankingList: () => ({ url: 'activities/ranking', method: 'get' }),
89
90
  exchangeDiamond: ({ activityNo, exchangeAward = [] }) => ({
90
91
  url: 'activities/exchange/diamond',
package/src/api/common.js CHANGED
@@ -7,4 +7,10 @@ export default {
7
7
  getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
8
8
  getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
9
9
  getSiteInfoConfig: ({ appSecret, config }) => ({ url: 'get-site-config', method: 'get', params: { appSecret, config }, isPublic: true }),
10
+ sendPixel: ({ appSecret, eventId, fbc, fbp, event }) => ({
11
+ url: 'pixel',
12
+ method: 'post',
13
+ params: { appSecret, eventId, fbc, fbp, event },
14
+ isPublic: true,
15
+ }),
10
16
  }
@@ -3,6 +3,7 @@ import { assign, createMachine } from 'xstate'
3
3
  import pickBy from 'lodash/pickBy.js'
4
4
  import api from '../api/common.js'
5
5
  import storage from '../util/storage.js'
6
+ import sessionStorage from '../util/sessionStorage.js'
6
7
 
7
8
  export default function (request) {
8
9
  const { appSecret, defaultChannel, defaultSubchannel } = request.config
@@ -54,7 +55,7 @@ export default function (request) {
54
55
  },
55
56
  },
56
57
  fetching: {
57
- entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel'],
58
+ entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel', 'setFbclid'],
58
59
  invoke: {
59
60
  src: 'fetchConfig',
60
61
  onDone: [
@@ -223,6 +224,18 @@ export default function (request) {
223
224
  isMobile: userAgent?.device?.type,
224
225
  }
225
226
  }),
227
+ setFbclid: assign(() => {
228
+ const urlParams = new URLSearchParams(window.location.search)
229
+ const fbclid = urlParams.get('fbclid') || ''
230
+ if (fbclid !== '') {
231
+ const timestamp = Date.now()
232
+ const cookieRecord = 'fb.1.' + timestamp + '.' + fbclid
233
+ document.cookie = `_fbc=${cookieRecord}; path=/; max-age=${60 * 60 * 24 * 7}`
234
+ }
235
+ return {
236
+ fbclid,
237
+ }
238
+ }),
226
239
  setPixel: assign(() => {
227
240
  let urlParams = new URLSearchParams(window.location.search)
228
241
  const pix = urlParams.get('pix') || storage.get('pix') || ''
@@ -258,7 +271,7 @@ export default function (request) {
258
271
  const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
259
272
  const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
260
273
  const affiliateCode = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
261
- const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || storage.get('fc') || storage.get('affiliate')
274
+ const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || sessionStorage.get('fc') || sessionStorage.get('affiliate')
262
275
 
263
276
  storage.set('channel', channel, {
264
277
  path: '/',
@@ -272,7 +285,7 @@ export default function (request) {
272
285
  path: '/',
273
286
  maxAge: 60 * 60 * 24 * 7,
274
287
  })
275
- storage.set('fc', friendCode, {
288
+ sessionStorage.set('fc', friendCode, {
276
289
  path: '/',
277
290
  maxAge: 60 * 60 * 24 * 7,
278
291
  })
@@ -111,6 +111,7 @@ const supportVersion2List = [
111
111
  'activities/types',
112
112
  'activities/promo',
113
113
  'activities/viptable',
114
+ 'activities/level-bonus/info',
114
115
  'activities/numbers',
115
116
  'activities/honorBroadcast',
116
117
  'activities/exchange/diamond/max-amount',
@@ -139,6 +140,8 @@ const supportVersion2List = [
139
140
  'game/list/v3/gameInfo',
140
141
  'payment/v2/uploadCommonSlip',
141
142
  'game/history/options',
143
+ // 09/30
144
+ 'pixel',
142
145
  ]
143
146
 
144
147
  function isValid(value) {
@@ -0,0 +1,28 @@
1
+ export default {
2
+ get(name, options) {
3
+ const itemStr = sessionStorage.getItem(name)
4
+
5
+ if (!itemStr) {
6
+ return null
7
+ }
8
+
9
+ const item = JSON.parse(itemStr)
10
+ if (item.expiry && new Date().getTime() > item.expiry) {
11
+ sessionStorage.removeItem(name)
12
+ return null
13
+ }
14
+
15
+ return item.value
16
+ },
17
+ set(name, value, options) {
18
+ const item = { value }
19
+
20
+ if (options?.maxAge) {
21
+ item.expiry = new Date().getTime() + options.maxAge * 1000
22
+ }
23
+ sessionStorage.setItem(name, JSON.stringify(item))
24
+ },
25
+ remove(name, options) {
26
+ sessionStorage.removeItem(name)
27
+ },
28
+ }