@jetthai/cuora 1.1.83-cash → 1.1.84-cash

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.84-cash](https://github.com/jetthai/cuora-module/compare/v1.1.84...v1.1.84-cash) (2023-04-26)
6
+
5
7
  ### [1.1.83-cash](https://github.com/jetthai/cuora-module/compare/v1.1.83...v1.1.83-cash) (2023-04-26)
6
8
 
7
9
  ### [1.1.77-cash-6](https://github.com/jetthai/cuora-module/compare/v1.1.77-cash-5...v1.1.77-cash-6) (2023-04-21)
@@ -22,6 +24,8 @@ All notable changes to this project will be documented in this file. See [standa
22
24
 
23
25
  ### [1.1.68-cash](https://github.com/jetthai/cuora-module/compare/v1.1.68...v1.1.68-cash) (2023-04-06)
24
26
 
27
+ ### [1.1.84](https://github.com/jetthai/cuora-module/compare/v1.1.83...v1.1.84) (2023-04-26)
28
+
25
29
  ### [1.1.83](https://github.com/jetthai/cuora-module/compare/v1.1.82...v1.1.83) (2023-04-24)
26
30
 
27
31
  ### [1.1.82](https://github.com/jetthai/cuora-module/compare/v1.1.81...v1.1.82) (2023-04-24)
package/dist/bundle.mjs CHANGED
@@ -15762,7 +15762,7 @@ function auth (request) {
15762
15762
  });
15763
15763
  sentry.setTag('dt', dt);
15764
15764
 
15765
- const affiliateCode = storage.get('affiliateCode');
15765
+ const ac = storage.get('ac');
15766
15766
  const messages = {
15767
15767
  url: window.location.href,
15768
15768
  channelOrders: [
@@ -15770,13 +15770,13 @@ function auth (request) {
15770
15770
  { channel: defaultChannel, subchannel: defaultSubchannel },
15771
15771
  { channel: channel, subchannel: subchannel },
15772
15772
  ],
15773
- affiliateCode,
15773
+ ac,
15774
15774
  };
15775
15775
  sentry.captureMessage(JSON.stringify(messages));
15776
15776
 
15777
15777
  const referralObj = {};
15778
- if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
15779
- referralObj.ac = affiliateCode;
15778
+ if (![undefined, 'undefined', null, 'null'].includes(ac)) {
15779
+ referralObj.ac = ac;
15780
15780
  } else {
15781
15781
  (referralObj.channel = storage.get('channel') || defaultChannel || channel),
15782
15782
  (referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel);
@@ -17011,7 +17011,7 @@ function common (request) {
17011
17011
  let urlParams = new URLSearchParams(window.location.search);
17012
17012
  const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official';
17013
17013
  const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa';
17014
- const affiliateCode = urlParams.get('ac') || storage.get('affiliateCode') || urlParams.get('referralCode') || storage.get('referralCode');
17014
+ const ac = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode');
17015
17015
 
17016
17016
  storage.set('channel', channel, {
17017
17017
  path: '/',
@@ -17021,7 +17021,7 @@ function common (request) {
17021
17021
  path: '/',
17022
17022
  maxAge: 60 * 60 * 24 * 7,
17023
17023
  });
17024
- storage.set('affiliateCode', affiliateCode, {
17024
+ storage.set('ac', ac, {
17025
17025
  path: '/',
17026
17026
  maxAge: 60 * 60 * 24 * 7,
17027
17027
  });
@@ -17029,7 +17029,7 @@ function common (request) {
17029
17029
  return {
17030
17030
  channel,
17031
17031
  subchannel,
17032
- affiliateCode,
17032
+ ac,
17033
17033
  }
17034
17034
  }
17035
17035
  }),
@@ -17170,6 +17170,7 @@ function game_v2_1 (request) {
17170
17170
  id: 'game',
17171
17171
  type: 'parallel',
17172
17172
  context: {
17173
+ base: '',
17173
17174
  loadable: false,
17174
17175
  isLastPage: false,
17175
17176
  room: null,
@@ -17556,7 +17557,7 @@ function game_v2_1 (request) {
17556
17557
  is_demo: false,
17557
17558
  is_mobile: isMobile,
17558
17559
  lang,
17559
- return_url: returnProviders.includes(providerId) ? `${window.location.origin}/return` : window.location.href, // For providers to return.
17560
+ return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
17560
17561
  };
17561
17562
  const { redirect_url } = await request.send(game.playGame(params));
17562
17563
  return { gameURL: redirect_url }
@@ -19657,7 +19658,7 @@ function user_sign_up (request) {
19657
19658
  const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts });
19658
19659
  sentry.setTag('dt', dt);
19659
19660
 
19660
- const affiliateCode = storage.get('affiliateCode');
19661
+ const ac = storage.get('ac');
19661
19662
  const messages = {
19662
19663
  url: window.location.href,
19663
19664
  channelOrders: [
@@ -19665,13 +19666,13 @@ function user_sign_up (request) {
19665
19666
  { channel: defaultChannel, subchannel: defaultSubchannel },
19666
19667
  { channel: channel, subchannel: subchannel },
19667
19668
  ],
19668
- affiliateCode,
19669
+ ac,
19669
19670
  };
19670
19671
  sentry.captureMessage(JSON.stringify(messages));
19671
19672
 
19672
19673
  const referralObj = {};
19673
- if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
19674
- referralObj.ac = affiliateCode;
19674
+ if (![undefined, 'undefined', null, 'null'].includes(ac)) {
19675
+ referralObj.ac = ac;
19675
19676
  } else {
19676
19677
  (referralObj.channel = storage.get('channel') || defaultChannel || channel),
19677
19678
  (referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.83-cash",
3
+ "version": "1.1.84-cash",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -330,7 +330,7 @@ export default function (request) {
330
330
  })
331
331
  sentry.setTag('dt', dt)
332
332
 
333
- const affiliateCode = storage.get('affiliateCode')
333
+ const ac = storage.get('ac')
334
334
  const messages = {
335
335
  url: window.location.href,
336
336
  channelOrders: [
@@ -338,13 +338,13 @@ export default function (request) {
338
338
  { channel: defaultChannel, subchannel: defaultSubchannel },
339
339
  { channel: channel, subchannel: subchannel },
340
340
  ],
341
- affiliateCode,
341
+ ac,
342
342
  }
343
343
  sentry.captureMessage(JSON.stringify(messages))
344
344
 
345
345
  const referralObj = {}
346
- if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
347
- referralObj.ac = affiliateCode
346
+ if (![undefined, 'undefined', null, 'null'].includes(ac)) {
347
+ referralObj.ac = ac
348
348
  } else {
349
349
  ;(referralObj.channel = storage.get('channel') || defaultChannel || channel),
350
350
  (referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel)
@@ -7,13 +7,15 @@ import storage from '../util/storage.js'
7
7
  // const pickBy = require('lodash/pickBy')
8
8
  // const UAParser = require('ua-parser-js')
9
9
 
10
- export default function (request) {
10
+ export default function (request, context) {
11
+ const { site } = context || {}
11
12
  const { appSecret, defaultChannel, defaultSubchannel } = request.config
12
13
  return createMachine(
13
14
  {
14
15
  id: 'common',
15
16
  type: 'parallel',
16
17
  context: {
18
+ site,
17
19
  tick: 2000,
18
20
  siteConfig: {
19
21
  cs: {
@@ -42,6 +44,7 @@ export default function (request) {
42
44
  channel: null,
43
45
  subchannel: null,
44
46
  affiliateCode: null,
47
+ friendCode: null,
45
48
  },
46
49
  states: {
47
50
  config: {
@@ -157,7 +160,8 @@ export default function (request) {
157
160
  let urlParams = new URLSearchParams(window.location.search)
158
161
  const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
159
162
  const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
160
- const affiliateCode = urlParams.get('ac') || storage.get('affiliateCode') || urlParams.get('referralCode') || storage.get('referralCode')
163
+ const ac = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
164
+ const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || storage.get('fc') || storage.get(`${context.site}_affiliate`)
161
165
 
162
166
  storage.set('channel', channel, {
163
167
  path: '/',
@@ -167,7 +171,11 @@ export default function (request) {
167
171
  path: '/',
168
172
  maxAge: 60 * 60 * 24 * 7,
169
173
  })
170
- storage.set('affiliateCode', affiliateCode, {
174
+ storage.set('ac', ac, {
175
+ path: '/',
176
+ maxAge: 60 * 60 * 24 * 7,
177
+ })
178
+ storage.set('fc', friendCode, {
171
179
  path: '/',
172
180
  maxAge: 60 * 60 * 24 * 7,
173
181
  })
@@ -175,7 +183,8 @@ export default function (request) {
175
183
  return {
176
184
  channel,
177
185
  subchannel,
178
- affiliateCode,
186
+ ac,
187
+ friendCode,
179
188
  }
180
189
  }
181
190
  }),
@@ -10,6 +10,7 @@ export default function (request) {
10
10
  id: 'game',
11
11
  type: 'parallel',
12
12
  context: {
13
+ base: '',
13
14
  loadable: false,
14
15
  isLastPage: false,
15
16
  room: null,
@@ -395,7 +396,7 @@ export default function (request) {
395
396
  is_demo: false,
396
397
  is_mobile: isMobile,
397
398
  lang,
398
- return_url: returnProviders.includes(providerId) ? `${window.location.origin}/return` : window.location.href, // For providers to return.
399
+ return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
399
400
  }
400
401
  const { redirect_url } = await request.send(api.playGame(params))
401
402
  return { gameURL: redirect_url }
@@ -112,7 +112,7 @@ export default function (request) {
112
112
  const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts })
113
113
  sentry.setTag('dt', dt)
114
114
 
115
- const affiliateCode = storage.get('affiliateCode')
115
+ const ac = storage.get('ac')
116
116
  const messages = {
117
117
  url: window.location.href,
118
118
  channelOrders: [
@@ -120,13 +120,13 @@ export default function (request) {
120
120
  { channel: defaultChannel, subchannel: defaultSubchannel },
121
121
  { channel: channel, subchannel: subchannel },
122
122
  ],
123
- affiliateCode,
123
+ ac,
124
124
  }
125
125
  sentry.captureMessage(JSON.stringify(messages))
126
126
 
127
127
  const referralObj = {}
128
- if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
129
- referralObj.ac = affiliateCode
128
+ if (![undefined, 'undefined', null, 'null'].includes(ac)) {
129
+ referralObj.ac = ac
130
130
  } else {
131
131
  ;(referralObj.channel = storage.get('channel') || defaultChannel || channel),
132
132
  (referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel)