@jetthai/cuora 1.1.90-ac-1 → 1.1.90
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 +0 -6
- package/dist/bundle.mjs +52 -57
- package/package.json +1 -1
- package/src/api/auth.js +2 -2
- package/src/api/user.js +0 -5
- package/src/machine/activity/{friend_invite_friends_activity.js → affiliate_invite_friends_activity.js} +23 -23
- package/src/machine/activity/index.js +2 -2
- package/src/machine/activity/invite_friends_activity.js +6 -6
- package/src/machine/auth.js +7 -7
- package/src/machine/common.js +4 -4
- package/src/machine/user_sign_up.js +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
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.90-ac-1](https://github.com/jetthai/cuora-module/compare/v1.1.90-ac...v1.1.90-ac-1) (2023-05-05)
|
|
6
|
-
|
|
7
|
-
### [1.1.90-ac](https://github.com/jetthai/cuora-module/compare/v1.1.90...v1.1.90-ac) (2023-05-05)
|
|
8
|
-
|
|
9
|
-
### [1.1.74-ac](https://github.com/jetthai/cuora-module/compare/v1.1.88...v1.1.74-ac) (2023-05-02)
|
|
10
|
-
|
|
11
5
|
### [1.1.90](https://github.com/jetthai/cuora-module/compare/v1.1.89...v1.1.90) (2023-05-02)
|
|
12
6
|
|
|
13
7
|
### [1.1.89](https://github.com/jetthai/cuora-module/compare/v1.1.88...v1.1.89) (2023-05-02)
|
package/dist/bundle.mjs
CHANGED
|
@@ -3582,8 +3582,8 @@ var auth$1 = {
|
|
|
3582
3582
|
},
|
|
3583
3583
|
isPublic: true,
|
|
3584
3584
|
}),
|
|
3585
|
-
register: ({ channel, subchannel,
|
|
3586
|
-
const params = pickBy_1({ channel, subchannel,
|
|
3585
|
+
register: ({ channel, subchannel, referralCode, affiliate = null, reCaptchaToken, dt, ...rest }) => {
|
|
3586
|
+
const params = pickBy_1({ channel, subchannel, referralCode, affiliate }, (value) => {
|
|
3587
3587
|
return value !== undefined && value !== null
|
|
3588
3588
|
});
|
|
3589
3589
|
const qs = Object.keys(params)
|
|
@@ -3885,11 +3885,6 @@ var user = {
|
|
|
3885
3885
|
getAffiliateDashboard: () => ({ url: 'affiliate/dashboard', method: 'get' }),
|
|
3886
3886
|
getAffiliateDashboardList: ({ level, page, row }) => ({ url: 'affiliate/dashboard/list', method: 'post', params: { level, page, row } }),
|
|
3887
3887
|
postAffiliate: ({ affiliateCode }) => ({ url: 'affiliate', method: 'post', params: { affiliateCode } }),
|
|
3888
|
-
getFriends: () => ({ url: 'friends', method: 'get' }),
|
|
3889
|
-
getFriendsHome: () => ({ url: 'friends/home', method: 'get' }),
|
|
3890
|
-
getFriendsDashboard: () => ({ url: 'friends/dashboard', method: 'get' }),
|
|
3891
|
-
getFriendsDashboardList: ({ level, page, row }) => ({ url: 'friends/dashboard/list', method: 'post', params: { level, page, row } }),
|
|
3892
|
-
postFriends: ({ friendCode }) => ({ url: 'friends', method: 'post', params: { friendCode } }),
|
|
3893
3888
|
passwordRecovery: (recoveryData) => ({ url: 'recovery', method: 'post', params: recoveryData, isPublic: true }),
|
|
3894
3889
|
passwordAbandon: ({ number }) => ({ url: 'recovery/abandon', method: 'post', params: { number }, isPublic: true }),
|
|
3895
3890
|
passwordAcknowledge: (acknowledgeData) => ({ url: 'recovery/acknowledge', method: 'post', params: acknowledgeData, isPublic: true }),
|
|
@@ -7896,17 +7891,17 @@ function invite_friends_activity (request) {
|
|
|
7896
7891
|
bindingCode: null,
|
|
7897
7892
|
uidSite: null,
|
|
7898
7893
|
receiveNo: null,
|
|
7899
|
-
|
|
7894
|
+
affiliateCode: null,
|
|
7900
7895
|
downlineCount: 0,
|
|
7901
7896
|
},
|
|
7902
7897
|
initial: 'idle',
|
|
7903
7898
|
states: {
|
|
7904
7899
|
idle: {
|
|
7905
7900
|
on: {
|
|
7906
|
-
|
|
7901
|
+
FETCH_AFFILIATE_CODE: {
|
|
7907
7902
|
target: 'fetching',
|
|
7908
7903
|
},
|
|
7909
|
-
|
|
7904
|
+
BIND_AFFILIATE_CODE: {
|
|
7910
7905
|
target: 'binding',
|
|
7911
7906
|
actions: ['setActivityNo', 'setBindingCode', 'setUidSite'],
|
|
7912
7907
|
},
|
|
@@ -7958,9 +7953,9 @@ function invite_friends_activity (request) {
|
|
|
7958
7953
|
{
|
|
7959
7954
|
actions: {
|
|
7960
7955
|
setAffiliateCode: assign((context, event) => {
|
|
7961
|
-
const {
|
|
7956
|
+
const { affiliateCode, downlineCount } = event.data;
|
|
7962
7957
|
return {
|
|
7963
|
-
|
|
7958
|
+
affiliateCode,
|
|
7964
7959
|
downlineCount,
|
|
7965
7960
|
}
|
|
7966
7961
|
}),
|
|
@@ -7982,7 +7977,7 @@ function invite_friends_activity (request) {
|
|
|
7982
7977
|
},
|
|
7983
7978
|
services: {
|
|
7984
7979
|
postAffiliate: async (context, event) => {
|
|
7985
|
-
return await request.send(user.postAffiliate({
|
|
7980
|
+
return await request.send(user.postAffiliate({ affiliateCode: context.bindingCode }))
|
|
7986
7981
|
},
|
|
7987
7982
|
fetchAffiliate: async (context, event) => {
|
|
7988
7983
|
return await request.send(user.getAffiliate())
|
|
@@ -7997,18 +7992,18 @@ function invite_friends_activity (request) {
|
|
|
7997
7992
|
)
|
|
7998
7993
|
}
|
|
7999
7994
|
|
|
8000
|
-
function
|
|
7995
|
+
function affiliate_invite_friends_activity (request) {
|
|
8001
7996
|
const { appSecret } = request.config;
|
|
8002
7997
|
return createMachine(
|
|
8003
7998
|
{
|
|
8004
|
-
id: '
|
|
7999
|
+
id: 'affiliate_invite_friends_activity',
|
|
8005
8000
|
context: {
|
|
8006
|
-
|
|
8001
|
+
affiliateEnable: false,
|
|
8007
8002
|
activityNo: null,
|
|
8008
8003
|
bindingCode: null,
|
|
8009
8004
|
uidSite: null,
|
|
8010
8005
|
receiveNo: null,
|
|
8011
|
-
|
|
8006
|
+
affiliateCode: '',
|
|
8012
8007
|
commission: 0,
|
|
8013
8008
|
downLine: 0,
|
|
8014
8009
|
activeDownLine: 0,
|
|
@@ -8022,10 +8017,10 @@ function friend_invite_friends_activity (request) {
|
|
|
8022
8017
|
states: {
|
|
8023
8018
|
fetching1: {
|
|
8024
8019
|
invoke: {
|
|
8025
|
-
src: '
|
|
8020
|
+
src: 'fetchAffiliateCode',
|
|
8026
8021
|
onDone: {
|
|
8027
8022
|
target: 'checking',
|
|
8028
|
-
actions: '
|
|
8023
|
+
actions: 'setAffiliateCode',
|
|
8029
8024
|
},
|
|
8030
8025
|
onError: {
|
|
8031
8026
|
target: 'fetching2',
|
|
@@ -8033,11 +8028,11 @@ function friend_invite_friends_activity (request) {
|
|
|
8033
8028
|
},
|
|
8034
8029
|
},
|
|
8035
8030
|
checking: {
|
|
8036
|
-
always: [{ target: 'fetching2', cond: '
|
|
8031
|
+
always: [{ target: 'fetching2', cond: 'isAffiliateEnable' }, { target: 'idle' }],
|
|
8037
8032
|
},
|
|
8038
8033
|
fetching2: {
|
|
8039
8034
|
invoke: {
|
|
8040
|
-
src: '
|
|
8035
|
+
src: 'fetchAffiliateData',
|
|
8041
8036
|
onDone: {
|
|
8042
8037
|
target: 'idle',
|
|
8043
8038
|
actions: 'setInitialData',
|
|
@@ -8049,7 +8044,7 @@ function friend_invite_friends_activity (request) {
|
|
|
8049
8044
|
},
|
|
8050
8045
|
idle: {
|
|
8051
8046
|
on: {
|
|
8052
|
-
|
|
8047
|
+
BIND_AFFILIATE_CODE: {
|
|
8053
8048
|
target: 'binding',
|
|
8054
8049
|
actions: ['setBindingCode', 'setUidSite', 'setActivityNo'],
|
|
8055
8050
|
},
|
|
@@ -8066,7 +8061,7 @@ function friend_invite_friends_activity (request) {
|
|
|
8066
8061
|
},
|
|
8067
8062
|
binding: {
|
|
8068
8063
|
invoke: {
|
|
8069
|
-
src: '
|
|
8064
|
+
src: 'postAffiliate',
|
|
8070
8065
|
onDone: {
|
|
8071
8066
|
target: 'awarding',
|
|
8072
8067
|
},
|
|
@@ -8110,10 +8105,10 @@ function friend_invite_friends_activity (request) {
|
|
|
8110
8105
|
},
|
|
8111
8106
|
{
|
|
8112
8107
|
actions: {
|
|
8113
|
-
|
|
8114
|
-
const {
|
|
8108
|
+
setAffiliateCode: assign((context, event) => {
|
|
8109
|
+
const { affiliateCode = '' } = event.data || {};
|
|
8115
8110
|
return {
|
|
8116
|
-
|
|
8111
|
+
affiliateCode,
|
|
8117
8112
|
}
|
|
8118
8113
|
}),
|
|
8119
8114
|
setInitialData: assign((context, event) => {
|
|
@@ -8170,20 +8165,20 @@ function friend_invite_friends_activity (request) {
|
|
|
8170
8165
|
const { page } = context.levelDownLine;
|
|
8171
8166
|
return page.current < page.total
|
|
8172
8167
|
},
|
|
8173
|
-
|
|
8168
|
+
isAffiliateEnable: (context, event) => context.affiliateEnable,
|
|
8174
8169
|
},
|
|
8175
8170
|
services: {
|
|
8176
|
-
|
|
8177
|
-
return await request.send(user.
|
|
8171
|
+
fetchAffiliateCode: async () => {
|
|
8172
|
+
return await request.send(user.getAffiliate())
|
|
8178
8173
|
},
|
|
8179
|
-
|
|
8180
|
-
const
|
|
8181
|
-
const
|
|
8182
|
-
const [
|
|
8183
|
-
return [
|
|
8174
|
+
fetchAffiliateData: async (context, event) => {
|
|
8175
|
+
const affiliateHomeAPI = request.send(user.getAffiliateHome());
|
|
8176
|
+
const affiliateDashboard = request.send(user.getAffiliateDashboard());
|
|
8177
|
+
const [affiliateHomeData, affiliateDashboardData] = await Promise.all([affiliateHomeAPI, affiliateDashboard]);
|
|
8178
|
+
return [affiliateHomeData, affiliateDashboardData]
|
|
8184
8179
|
},
|
|
8185
|
-
|
|
8186
|
-
return await request.send(user.
|
|
8180
|
+
postAffiliate: async (context, event) => {
|
|
8181
|
+
return await request.send(user.postAffiliate({ affiliateCode: context.bindingCode }))
|
|
8187
8182
|
},
|
|
8188
8183
|
awardPrize: async (context, event) => {
|
|
8189
8184
|
const { activityNo, uidSite, bindingCode } = context;
|
|
@@ -8194,7 +8189,7 @@ function friend_invite_friends_activity (request) {
|
|
|
8194
8189
|
const { currentLevel, page, levelDownLine } = context;
|
|
8195
8190
|
const copiedObj = JSON.parse(JSON.stringify(levelDownLine));
|
|
8196
8191
|
const copiedList = copiedObj.data;
|
|
8197
|
-
const resopnseData = await request.send(user.
|
|
8192
|
+
const resopnseData = await request.send(user.getAffiliateDashboardList({ level: currentLevel, page, row: 10 }));
|
|
8198
8193
|
if (!!copiedList && !!resopnseData?.data) {
|
|
8199
8194
|
const combindData = {
|
|
8200
8195
|
...resopnseData,
|
|
@@ -9275,7 +9270,7 @@ var activity = {
|
|
|
9275
9270
|
diamond_shop_activity_vn,
|
|
9276
9271
|
fafafa_activity,
|
|
9277
9272
|
invite_friends_activity,
|
|
9278
|
-
|
|
9273
|
+
affiliate_invite_friends_activity,
|
|
9279
9274
|
ranking_activity,
|
|
9280
9275
|
return_bonus_activity,
|
|
9281
9276
|
specify_bets_activity,
|
|
@@ -15468,7 +15463,7 @@ function auth (request) {
|
|
|
15468
15463
|
userInfo: {},
|
|
15469
15464
|
redirectURL: null,
|
|
15470
15465
|
reCaptchaToken: null,
|
|
15471
|
-
|
|
15466
|
+
affiliate: null,
|
|
15472
15467
|
},
|
|
15473
15468
|
states: {
|
|
15474
15469
|
idle: {
|
|
@@ -15753,7 +15748,7 @@ function auth (request) {
|
|
|
15753
15748
|
return { token }
|
|
15754
15749
|
}),
|
|
15755
15750
|
redirectTo3Party: async (context, event) => {
|
|
15756
|
-
const { provider, channel, subchannel,
|
|
15751
|
+
const { provider, channel, subchannel, affiliate } = event.data;
|
|
15757
15752
|
|
|
15758
15753
|
const dt = await getDeviceToken({
|
|
15759
15754
|
fpToken,
|
|
@@ -15762,7 +15757,7 @@ function auth (request) {
|
|
|
15762
15757
|
});
|
|
15763
15758
|
sentry.setTag('dt', dt);
|
|
15764
15759
|
|
|
15765
|
-
const
|
|
15760
|
+
const referralCode = storage.get('referralCode');
|
|
15766
15761
|
const messages = {
|
|
15767
15762
|
url: window.location.href,
|
|
15768
15763
|
channelOrders: [
|
|
@@ -15770,13 +15765,13 @@ function auth (request) {
|
|
|
15770
15765
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
15771
15766
|
{ channel: channel, subchannel: subchannel },
|
|
15772
15767
|
],
|
|
15773
|
-
|
|
15768
|
+
referralCode,
|
|
15774
15769
|
};
|
|
15775
15770
|
sentry.captureMessage(JSON.stringify(messages));
|
|
15776
15771
|
|
|
15777
15772
|
const referralObj = {};
|
|
15778
|
-
if (![undefined, 'undefined', null, 'null'].includes(
|
|
15779
|
-
referralObj.
|
|
15773
|
+
if (![undefined, 'undefined', null, 'null'].includes(referralCode)) {
|
|
15774
|
+
referralObj.referralCode = referralCode;
|
|
15780
15775
|
}
|
|
15781
15776
|
|
|
15782
15777
|
referralObj.channel = storage.get('channel') || defaultChannel || channel;
|
|
@@ -15791,7 +15786,7 @@ function auth (request) {
|
|
|
15791
15786
|
...referralObj,
|
|
15792
15787
|
// dt,
|
|
15793
15788
|
platform: 'pwa',
|
|
15794
|
-
|
|
15789
|
+
affiliate,
|
|
15795
15790
|
}).toString()
|
|
15796
15791
|
);
|
|
15797
15792
|
|
|
@@ -16903,7 +16898,7 @@ function common (request) {
|
|
|
16903
16898
|
sentNormalBroadcastList: [],
|
|
16904
16899
|
channel: null,
|
|
16905
16900
|
subchannel: null,
|
|
16906
|
-
|
|
16901
|
+
referralCode: null,
|
|
16907
16902
|
},
|
|
16908
16903
|
states: {
|
|
16909
16904
|
config: {
|
|
@@ -17019,7 +17014,7 @@ function common (request) {
|
|
|
17019
17014
|
let urlParams = new URLSearchParams(window.location.search);
|
|
17020
17015
|
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official';
|
|
17021
17016
|
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa';
|
|
17022
|
-
const
|
|
17017
|
+
const referralCode = urlParams.get('referralCode') || storage.get('referralCode');
|
|
17023
17018
|
|
|
17024
17019
|
storage.set('channel', channel, {
|
|
17025
17020
|
path: '/',
|
|
@@ -17029,7 +17024,7 @@ function common (request) {
|
|
|
17029
17024
|
path: '/',
|
|
17030
17025
|
maxAge: 60 * 60 * 24 * 7,
|
|
17031
17026
|
});
|
|
17032
|
-
storage.set('
|
|
17027
|
+
storage.set('referralCode', referralCode, {
|
|
17033
17028
|
path: '/',
|
|
17034
17029
|
maxAge: 60 * 60 * 24 * 7,
|
|
17035
17030
|
});
|
|
@@ -17037,7 +17032,7 @@ function common (request) {
|
|
|
17037
17032
|
return {
|
|
17038
17033
|
channel,
|
|
17039
17034
|
subchannel,
|
|
17040
|
-
|
|
17035
|
+
referralCode,
|
|
17041
17036
|
}
|
|
17042
17037
|
}
|
|
17043
17038
|
}),
|
|
@@ -20317,7 +20312,7 @@ function user_sign_up (request) {
|
|
|
20317
20312
|
channel: null,
|
|
20318
20313
|
subchannel: null,
|
|
20319
20314
|
signUpData: {},
|
|
20320
|
-
|
|
20315
|
+
affiliate: null,
|
|
20321
20316
|
reCaptchaToken: null,
|
|
20322
20317
|
registrationData: {
|
|
20323
20318
|
account: null,
|
|
@@ -20364,9 +20359,9 @@ function user_sign_up (request) {
|
|
|
20364
20359
|
}
|
|
20365
20360
|
}),
|
|
20366
20361
|
setAffiliate: assign((context, event) => {
|
|
20367
|
-
const {
|
|
20362
|
+
const { affiliate } = event.data;
|
|
20368
20363
|
return {
|
|
20369
|
-
|
|
20364
|
+
affiliate,
|
|
20370
20365
|
}
|
|
20371
20366
|
}),
|
|
20372
20367
|
setSignUpPhone: assign((context, event) => {
|
|
@@ -20415,7 +20410,7 @@ function user_sign_up (request) {
|
|
|
20415
20410
|
const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts });
|
|
20416
20411
|
sentry.setTag('dt', dt);
|
|
20417
20412
|
|
|
20418
|
-
const
|
|
20413
|
+
const referralCode = storage.get('referralCode');
|
|
20419
20414
|
const messages = {
|
|
20420
20415
|
url: window.location.href,
|
|
20421
20416
|
channelOrders: [
|
|
@@ -20423,13 +20418,13 @@ function user_sign_up (request) {
|
|
|
20423
20418
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
20424
20419
|
{ channel: channel, subchannel: subchannel },
|
|
20425
20420
|
],
|
|
20426
|
-
|
|
20421
|
+
referralCode,
|
|
20427
20422
|
};
|
|
20428
20423
|
sentry.captureMessage(JSON.stringify(messages));
|
|
20429
20424
|
|
|
20430
20425
|
const referralObj = {};
|
|
20431
|
-
if (![undefined, 'undefined', null, 'null'].includes(
|
|
20432
|
-
referralObj.
|
|
20426
|
+
if (![undefined, 'undefined', null, 'null'].includes(referralCode)) {
|
|
20427
|
+
referralObj.referralCode = referralCode;
|
|
20433
20428
|
}
|
|
20434
20429
|
|
|
20435
20430
|
referralObj.channel = storage.get('channel') || defaultChannel || channel;
|
|
@@ -20441,7 +20436,7 @@ function user_sign_up (request) {
|
|
|
20441
20436
|
...referralObj,
|
|
20442
20437
|
dt,
|
|
20443
20438
|
reCaptchaToken: context.reCaptchaToken,
|
|
20444
|
-
|
|
20439
|
+
affiliate: context.affiliate,
|
|
20445
20440
|
})
|
|
20446
20441
|
)
|
|
20447
20442
|
},
|
package/package.json
CHANGED
package/src/api/auth.js
CHANGED
|
@@ -31,8 +31,8 @@ export default {
|
|
|
31
31
|
},
|
|
32
32
|
isPublic: true,
|
|
33
33
|
}),
|
|
34
|
-
register: ({ channel, subchannel,
|
|
35
|
-
const params = pickBy({ channel, subchannel,
|
|
34
|
+
register: ({ channel, subchannel, referralCode, affiliate = null, reCaptchaToken, dt, ...rest }) => {
|
|
35
|
+
const params = pickBy({ channel, subchannel, referralCode, affiliate }, (value) => {
|
|
36
36
|
return value !== undefined && value !== null
|
|
37
37
|
})
|
|
38
38
|
const qs = Object.keys(params)
|
package/src/api/user.js
CHANGED
|
@@ -14,11 +14,6 @@ export default {
|
|
|
14
14
|
getAffiliateDashboard: () => ({ url: 'affiliate/dashboard', method: 'get' }),
|
|
15
15
|
getAffiliateDashboardList: ({ level, page, row }) => ({ url: 'affiliate/dashboard/list', method: 'post', params: { level, page, row } }),
|
|
16
16
|
postAffiliate: ({ affiliateCode }) => ({ url: 'affiliate', method: 'post', params: { affiliateCode } }),
|
|
17
|
-
getFriends: () => ({ url: 'friends', method: 'get' }),
|
|
18
|
-
getFriendsHome: () => ({ url: 'friends/home', method: 'get' }),
|
|
19
|
-
getFriendsDashboard: () => ({ url: 'friends/dashboard', method: 'get' }),
|
|
20
|
-
getFriendsDashboardList: ({ level, page, row }) => ({ url: 'friends/dashboard/list', method: 'post', params: { level, page, row } }),
|
|
21
|
-
postFriends: ({ friendCode }) => ({ url: 'friends', method: 'post', params: { friendCode } }),
|
|
22
17
|
passwordRecovery: (recoveryData) => ({ url: 'recovery', method: 'post', params: recoveryData, isPublic: true }),
|
|
23
18
|
passwordAbandon: ({ number }) => ({ url: 'recovery/abandon', method: 'post', params: { number }, isPublic: true }),
|
|
24
19
|
passwordAcknowledge: (acknowledgeData) => ({ url: 'recovery/acknowledge', method: 'post', params: acknowledgeData, isPublic: true }),
|
|
@@ -6,14 +6,14 @@ export default function (request) {
|
|
|
6
6
|
const { appSecret } = request.config
|
|
7
7
|
return createMachine(
|
|
8
8
|
{
|
|
9
|
-
id: '
|
|
9
|
+
id: 'affiliate_invite_friends_activity',
|
|
10
10
|
context: {
|
|
11
|
-
|
|
11
|
+
affiliateEnable: false,
|
|
12
12
|
activityNo: null,
|
|
13
13
|
bindingCode: null,
|
|
14
14
|
uidSite: null,
|
|
15
15
|
receiveNo: null,
|
|
16
|
-
|
|
16
|
+
affiliateCode: '',
|
|
17
17
|
commission: 0,
|
|
18
18
|
downLine: 0,
|
|
19
19
|
activeDownLine: 0,
|
|
@@ -27,10 +27,10 @@ export default function (request) {
|
|
|
27
27
|
states: {
|
|
28
28
|
fetching1: {
|
|
29
29
|
invoke: {
|
|
30
|
-
src: '
|
|
30
|
+
src: 'fetchAffiliateCode',
|
|
31
31
|
onDone: {
|
|
32
32
|
target: 'checking',
|
|
33
|
-
actions: '
|
|
33
|
+
actions: 'setAffiliateCode',
|
|
34
34
|
},
|
|
35
35
|
onError: {
|
|
36
36
|
target: 'fetching2',
|
|
@@ -38,11 +38,11 @@ export default function (request) {
|
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
checking: {
|
|
41
|
-
always: [{ target: 'fetching2', cond: '
|
|
41
|
+
always: [{ target: 'fetching2', cond: 'isAffiliateEnable' }, { target: 'idle' }],
|
|
42
42
|
},
|
|
43
43
|
fetching2: {
|
|
44
44
|
invoke: {
|
|
45
|
-
src: '
|
|
45
|
+
src: 'fetchAffiliateData',
|
|
46
46
|
onDone: {
|
|
47
47
|
target: 'idle',
|
|
48
48
|
actions: 'setInitialData',
|
|
@@ -54,7 +54,7 @@ export default function (request) {
|
|
|
54
54
|
},
|
|
55
55
|
idle: {
|
|
56
56
|
on: {
|
|
57
|
-
|
|
57
|
+
BIND_AFFILIATE_CODE: {
|
|
58
58
|
target: 'binding',
|
|
59
59
|
actions: ['setBindingCode', 'setUidSite', 'setActivityNo'],
|
|
60
60
|
},
|
|
@@ -71,7 +71,7 @@ export default function (request) {
|
|
|
71
71
|
},
|
|
72
72
|
binding: {
|
|
73
73
|
invoke: {
|
|
74
|
-
src: '
|
|
74
|
+
src: 'postAffiliate',
|
|
75
75
|
onDone: {
|
|
76
76
|
target: 'awarding',
|
|
77
77
|
},
|
|
@@ -115,10 +115,10 @@ export default function (request) {
|
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
actions: {
|
|
118
|
-
|
|
119
|
-
const {
|
|
118
|
+
setAffiliateCode: assign((context, event) => {
|
|
119
|
+
const { affiliateCode = '' } = event.data || {}
|
|
120
120
|
return {
|
|
121
|
-
|
|
121
|
+
affiliateCode,
|
|
122
122
|
}
|
|
123
123
|
}),
|
|
124
124
|
setInitialData: assign((context, event) => {
|
|
@@ -175,20 +175,20 @@ export default function (request) {
|
|
|
175
175
|
const { page } = context.levelDownLine
|
|
176
176
|
return page.current < page.total
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
isAffiliateEnable: (context, event) => context.affiliateEnable,
|
|
179
179
|
},
|
|
180
180
|
services: {
|
|
181
|
-
|
|
182
|
-
return await request.send(user.
|
|
181
|
+
fetchAffiliateCode: async () => {
|
|
182
|
+
return await request.send(user.getAffiliate())
|
|
183
183
|
},
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
const [
|
|
188
|
-
return [
|
|
184
|
+
fetchAffiliateData: async (context, event) => {
|
|
185
|
+
const affiliateHomeAPI = request.send(user.getAffiliateHome())
|
|
186
|
+
const affiliateDashboard = request.send(user.getAffiliateDashboard())
|
|
187
|
+
const [affiliateHomeData, affiliateDashboardData] = await Promise.all([affiliateHomeAPI, affiliateDashboard])
|
|
188
|
+
return [affiliateHomeData, affiliateDashboardData]
|
|
189
189
|
},
|
|
190
|
-
|
|
191
|
-
return await request.send(user.
|
|
190
|
+
postAffiliate: async (context, event) => {
|
|
191
|
+
return await request.send(user.postAffiliate({ affiliateCode: context.bindingCode }))
|
|
192
192
|
},
|
|
193
193
|
awardPrize: async (context, event) => {
|
|
194
194
|
const { activityNo, uidSite, bindingCode } = context
|
|
@@ -199,7 +199,7 @@ export default function (request) {
|
|
|
199
199
|
const { currentLevel, page, levelDownLine } = context
|
|
200
200
|
const copiedObj = JSON.parse(JSON.stringify(levelDownLine))
|
|
201
201
|
const copiedList = copiedObj.data
|
|
202
|
-
const resopnseData = await request.send(user.
|
|
202
|
+
const resopnseData = await request.send(user.getAffiliateDashboardList({ level: currentLevel, page, row: 10 }))
|
|
203
203
|
if (!!copiedList && !!resopnseData?.data) {
|
|
204
204
|
const combindData = {
|
|
205
205
|
...resopnseData,
|
|
@@ -4,7 +4,7 @@ import diamond_shop_activity_fc from './diamond_shop_activity_fc.js'
|
|
|
4
4
|
import diamond_shop_activity_vn from './diamond_shop_activity_vn.js'
|
|
5
5
|
import fafafa_activity from './fafafa_activity.js'
|
|
6
6
|
import invite_friends_activity from './invite_friends_activity.js'
|
|
7
|
-
import
|
|
7
|
+
import affiliate_invite_friends_activity from './affiliate_invite_friends_activity.js'
|
|
8
8
|
import ranking_activity from './ranking_activity.js'
|
|
9
9
|
import return_bonus_activity from './return_bonus_activity.js'
|
|
10
10
|
import specify_bets_activity from './specify_bets_activity.js'
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
diamond_shop_activity_vn,
|
|
24
24
|
fafafa_activity,
|
|
25
25
|
invite_friends_activity,
|
|
26
|
-
|
|
26
|
+
affiliate_invite_friends_activity,
|
|
27
27
|
ranking_activity,
|
|
28
28
|
return_bonus_activity,
|
|
29
29
|
specify_bets_activity,
|
|
@@ -12,17 +12,17 @@ export default function (request) {
|
|
|
12
12
|
bindingCode: null,
|
|
13
13
|
uidSite: null,
|
|
14
14
|
receiveNo: null,
|
|
15
|
-
|
|
15
|
+
affiliateCode: null,
|
|
16
16
|
downlineCount: 0,
|
|
17
17
|
},
|
|
18
18
|
initial: 'idle',
|
|
19
19
|
states: {
|
|
20
20
|
idle: {
|
|
21
21
|
on: {
|
|
22
|
-
|
|
22
|
+
FETCH_AFFILIATE_CODE: {
|
|
23
23
|
target: 'fetching',
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
BIND_AFFILIATE_CODE: {
|
|
26
26
|
target: 'binding',
|
|
27
27
|
actions: ['setActivityNo', 'setBindingCode', 'setUidSite'],
|
|
28
28
|
},
|
|
@@ -74,9 +74,9 @@ export default function (request) {
|
|
|
74
74
|
{
|
|
75
75
|
actions: {
|
|
76
76
|
setAffiliateCode: assign((context, event) => {
|
|
77
|
-
const {
|
|
77
|
+
const { affiliateCode, downlineCount } = event.data
|
|
78
78
|
return {
|
|
79
|
-
|
|
79
|
+
affiliateCode,
|
|
80
80
|
downlineCount,
|
|
81
81
|
}
|
|
82
82
|
}),
|
|
@@ -98,7 +98,7 @@ export default function (request) {
|
|
|
98
98
|
},
|
|
99
99
|
services: {
|
|
100
100
|
postAffiliate: async (context, event) => {
|
|
101
|
-
return await request.send(user.postAffiliate({
|
|
101
|
+
return await request.send(user.postAffiliate({ affiliateCode: context.bindingCode }))
|
|
102
102
|
},
|
|
103
103
|
fetchAffiliate: async (context, event) => {
|
|
104
104
|
return await request.send(user.getAffiliate())
|
package/src/machine/auth.js
CHANGED
|
@@ -36,7 +36,7 @@ export default function (request) {
|
|
|
36
36
|
userInfo: {},
|
|
37
37
|
redirectURL: null,
|
|
38
38
|
reCaptchaToken: null,
|
|
39
|
-
|
|
39
|
+
affiliate: null,
|
|
40
40
|
},
|
|
41
41
|
states: {
|
|
42
42
|
idle: {
|
|
@@ -321,7 +321,7 @@ export default function (request) {
|
|
|
321
321
|
return { token }
|
|
322
322
|
}),
|
|
323
323
|
redirectTo3Party: async (context, event) => {
|
|
324
|
-
const { provider, channel, subchannel,
|
|
324
|
+
const { provider, channel, subchannel, affiliate } = event.data
|
|
325
325
|
|
|
326
326
|
const dt = await getDeviceToken({
|
|
327
327
|
fpToken,
|
|
@@ -330,7 +330,7 @@ export default function (request) {
|
|
|
330
330
|
})
|
|
331
331
|
sentry.setTag('dt', dt)
|
|
332
332
|
|
|
333
|
-
const
|
|
333
|
+
const referralCode = storage.get('referralCode')
|
|
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
|
-
|
|
341
|
+
referralCode,
|
|
342
342
|
}
|
|
343
343
|
sentry.captureMessage(JSON.stringify(messages))
|
|
344
344
|
|
|
345
345
|
const referralObj = {}
|
|
346
|
-
if (![undefined, 'undefined', null, 'null'].includes(
|
|
347
|
-
referralObj.
|
|
346
|
+
if (![undefined, 'undefined', null, 'null'].includes(referralCode)) {
|
|
347
|
+
referralObj.referralCode = referralCode
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
referralObj.channel = storage.get('channel') || defaultChannel || channel
|
|
@@ -359,7 +359,7 @@ export default function (request) {
|
|
|
359
359
|
...referralObj,
|
|
360
360
|
// dt,
|
|
361
361
|
platform: 'pwa',
|
|
362
|
-
|
|
362
|
+
affiliate,
|
|
363
363
|
}).toString()
|
|
364
364
|
)
|
|
365
365
|
|
package/src/machine/common.js
CHANGED
|
@@ -41,7 +41,7 @@ export default function (request) {
|
|
|
41
41
|
sentNormalBroadcastList: [],
|
|
42
42
|
channel: null,
|
|
43
43
|
subchannel: null,
|
|
44
|
-
|
|
44
|
+
referralCode: null,
|
|
45
45
|
},
|
|
46
46
|
states: {
|
|
47
47
|
config: {
|
|
@@ -157,7 +157,7 @@ export default function (request) {
|
|
|
157
157
|
let urlParams = new URLSearchParams(window.location.search)
|
|
158
158
|
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
|
|
159
159
|
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
|
|
160
|
-
const
|
|
160
|
+
const referralCode = urlParams.get('referralCode') || storage.get('referralCode')
|
|
161
161
|
|
|
162
162
|
storage.set('channel', channel, {
|
|
163
163
|
path: '/',
|
|
@@ -167,7 +167,7 @@ export default function (request) {
|
|
|
167
167
|
path: '/',
|
|
168
168
|
maxAge: 60 * 60 * 24 * 7,
|
|
169
169
|
})
|
|
170
|
-
storage.set('
|
|
170
|
+
storage.set('referralCode', referralCode, {
|
|
171
171
|
path: '/',
|
|
172
172
|
maxAge: 60 * 60 * 24 * 7,
|
|
173
173
|
})
|
|
@@ -175,7 +175,7 @@ export default function (request) {
|
|
|
175
175
|
return {
|
|
176
176
|
channel,
|
|
177
177
|
subchannel,
|
|
178
|
-
|
|
178
|
+
referralCode,
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}),
|
|
@@ -14,7 +14,7 @@ export default function (request) {
|
|
|
14
14
|
channel: null,
|
|
15
15
|
subchannel: null,
|
|
16
16
|
signUpData: {},
|
|
17
|
-
|
|
17
|
+
affiliate: null,
|
|
18
18
|
reCaptchaToken: null,
|
|
19
19
|
registrationData: {
|
|
20
20
|
account: null,
|
|
@@ -61,9 +61,9 @@ export default function (request) {
|
|
|
61
61
|
}
|
|
62
62
|
}),
|
|
63
63
|
setAffiliate: assign((context, event) => {
|
|
64
|
-
const {
|
|
64
|
+
const { affiliate } = event.data
|
|
65
65
|
return {
|
|
66
|
-
|
|
66
|
+
affiliate,
|
|
67
67
|
}
|
|
68
68
|
}),
|
|
69
69
|
setSignUpPhone: assign((context, event) => {
|
|
@@ -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
|
|
115
|
+
const referralCode = storage.get('referralCode')
|
|
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
|
-
|
|
123
|
+
referralCode,
|
|
124
124
|
}
|
|
125
125
|
sentry.captureMessage(JSON.stringify(messages))
|
|
126
126
|
|
|
127
127
|
const referralObj = {}
|
|
128
|
-
if (![undefined, 'undefined', null, 'null'].includes(
|
|
129
|
-
referralObj.
|
|
128
|
+
if (![undefined, 'undefined', null, 'null'].includes(referralCode)) {
|
|
129
|
+
referralObj.referralCode = referralCode
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
referralObj.channel = storage.get('channel') || defaultChannel || channel
|
|
@@ -138,7 +138,7 @@ export default function (request) {
|
|
|
138
138
|
...referralObj,
|
|
139
139
|
dt,
|
|
140
140
|
reCaptchaToken: context.reCaptchaToken,
|
|
141
|
-
|
|
141
|
+
affiliate: context.affiliate,
|
|
142
142
|
})
|
|
143
143
|
)
|
|
144
144
|
},
|