@jetthai/cuora 1.1.45-1 → 1.1.46

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/dist/bundle.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import payment$1 from '@jetthai/cuora/src/api/payment.js';
2
2
 
3
- var activity$2 = {
3
+ var api = {
4
4
  getActivityTypes: ({ appSecret }) => ({ url: 'activities/types', method: 'get', params: { appSecret } }),
5
5
  getActivityList: ({ appSecret, include = 'cl' }) => ({
6
6
  url: 'activities/list',
@@ -3926,7 +3926,7 @@ var form = {
3926
3926
  upload: (formData) => ({ url: 'upload', method: 'post', params: formData, isFormData: true }),
3927
3927
  };
3928
3928
 
3929
- var index$2 = { activity: activity$2, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
3929
+ var index$2 = { activity: api, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
3930
3930
 
3931
3931
  /*! *****************************************************************************
3932
3932
  Copyright (c) Microsoft Corporation.
@@ -7184,12 +7184,12 @@ function continue_deposit_activity (request) {
7184
7184
  services: {
7185
7185
  fetchActivityDetail: async (context, event) => {
7186
7186
  const { activityNo } = context;
7187
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7187
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7188
7188
  return data
7189
7189
  },
7190
7190
  receiveReward: async (context, event) => {
7191
7191
  const { activityNo, receiveNo } = context;
7192
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
7192
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
7193
7193
  return data
7194
7194
  },
7195
7195
  },
@@ -7273,7 +7273,7 @@ function deposit_activity (request) {
7273
7273
  services: {
7274
7274
  fetchActivityDetail: async (context, event) => {
7275
7275
  const { activityNo } = context;
7276
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7276
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7277
7277
  return data
7278
7278
  },
7279
7279
  },
@@ -7445,12 +7445,12 @@ function diamond_shop_activity_fc (request) {
7445
7445
  },
7446
7446
  services: {
7447
7447
  fetchActivityList: async (context, event) => {
7448
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
7448
+ const { data } = await request.send(api.getActivityList({ appSecret }));
7449
7449
  return data
7450
7450
  },
7451
7451
  fetchActivityDetail: async (context, event) => {
7452
7452
  const { activityNo } = context;
7453
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7453
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7454
7454
  return data
7455
7455
  },
7456
7456
  exchange: async (context, event) => {
@@ -7458,7 +7458,7 @@ function diamond_shop_activity_fc (request) {
7458
7458
  return await Promise.all(
7459
7459
  exchangeList.map((item) =>
7460
7460
  request.send(
7461
- activity$2.exchange({
7461
+ api.exchange({
7462
7462
  exchangeType: 1,
7463
7463
  activityNo,
7464
7464
  exchangeAward: item.award,
@@ -7468,7 +7468,7 @@ function diamond_shop_activity_fc (request) {
7468
7468
  )
7469
7469
  },
7470
7470
  collect: async (context, event) => {
7471
- return await request.send(activity$2.collect({ appSecret }))
7471
+ return await request.send(api.collect({ appSecret }))
7472
7472
  },
7473
7473
  },
7474
7474
  }
@@ -7660,18 +7660,18 @@ function diamond_shop_activity_vn (request) {
7660
7660
  },
7661
7661
  services: {
7662
7662
  fetchActivityList: async (context, event) => {
7663
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
7663
+ const { data } = await request.send(api.getActivityList({ appSecret }));
7664
7664
  return data
7665
7665
  },
7666
7666
  fetchActivityDetail: async (context, event) => {
7667
7667
  const { activityNo } = context;
7668
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7668
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7669
7669
  return data
7670
7670
  },
7671
7671
  exchange: async (context, event) => {
7672
7672
  const { activityNo } = context;
7673
7673
  return await request.send(
7674
- activity$2.exchange({
7674
+ api.exchange({
7675
7675
  exchangeType: 1,
7676
7676
  activityNo,
7677
7677
  exchangeAward: event.data,
@@ -7679,7 +7679,7 @@ function diamond_shop_activity_vn (request) {
7679
7679
  )
7680
7680
  },
7681
7681
  collect: async (context, event) => {
7682
- return await request.send(activity$2.collect({ appSecret }))
7682
+ return await request.send(api.collect({ appSecret }))
7683
7683
  },
7684
7684
  },
7685
7685
  }
@@ -7860,17 +7860,17 @@ function fafafa_activity (request) {
7860
7860
  services: {
7861
7861
  fetchActivityDetail: async (context, event) => {
7862
7862
  const { activityNo } = context;
7863
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7863
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7864
7864
  return data
7865
7865
  },
7866
7866
  awardPrize: async (context, event) => {
7867
7867
  const { activityNo } = context;
7868
- const { data } = await request.send(activity$2.sentAward({ activityNo, appSecret }));
7868
+ const { data } = await request.send(api.sentAward({ activityNo, appSecret }));
7869
7869
  return data
7870
7870
  },
7871
7871
  receiveReward: async (context, event) => {
7872
7872
  const { activityNo, receiveNo } = context;
7873
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
7873
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
7874
7874
  return data
7875
7875
  },
7876
7876
  },
@@ -7981,7 +7981,7 @@ function invite_friends_activity (request) {
7981
7981
  },
7982
7982
  awardPrize: async (context, event) => {
7983
7983
  const { activityNo, uidSite, bindingCode } = context;
7984
- const { data } = await request.send(activity$2.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
7984
+ const { data } = await request.send(api.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
7985
7985
  return data
7986
7986
  },
7987
7987
  },
@@ -8179,7 +8179,7 @@ function affiliate_invite_friends_activity (request) {
8179
8179
  },
8180
8180
  awardPrize: async (context, event) => {
8181
8181
  const { activityNo, uidSite, bindingCode } = context;
8182
- const { data } = await request.send(activity$2.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
8182
+ const { data } = await request.send(api.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
8183
8183
  return data
8184
8184
  },
8185
8185
  fetchLevelDownLineList: async (context, event) => {
@@ -8288,7 +8288,7 @@ function ranking_activity (request) {
8288
8288
  services: {
8289
8289
  fetchActivityDetail: async (context, event) => {
8290
8290
  const { activityNo } = context;
8291
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8291
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8292
8292
  return data
8293
8293
  },
8294
8294
  },
@@ -8428,16 +8428,16 @@ function return_bonus_activity (request) {
8428
8428
  services: {
8429
8429
  fetchActivityDetail: async (context, event) => {
8430
8430
  const { activityNo } = context;
8431
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8431
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8432
8432
  return data
8433
8433
  },
8434
8434
  receiveReward: async (context, event) => {
8435
8435
  const { activityNo, receiveNo } = context.rewardList[0];
8436
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8436
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8437
8437
  return data
8438
8438
  },
8439
8439
  fetchRewardList: async (context, event) => {
8440
- const { data } = await request.send(activity$2.getRewardList({ appSecret, count: 30 }));
8440
+ const { data } = await request.send(api.getRewardList({ appSecret, count: 30 }));
8441
8441
  return data
8442
8442
  },
8443
8443
  },
@@ -8543,12 +8543,12 @@ function specify_bets_activity (request) {
8543
8543
  services: {
8544
8544
  fetchActivityDetail: async (context, event) => {
8545
8545
  const { activityNo } = context;
8546
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8546
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8547
8547
  return data
8548
8548
  },
8549
8549
  receiveReward: async (context, event) => {
8550
8550
  const { activityNo, receiveNo } = context.activityDetail;
8551
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8551
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8552
8552
  return data
8553
8553
  },
8554
8554
  },
@@ -8654,12 +8654,12 @@ function specify_turnover_activity (request) {
8654
8654
  services: {
8655
8655
  fetchActivityDetail: async (context, event) => {
8656
8656
  const { activityNo } = context;
8657
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8657
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8658
8658
  return data
8659
8659
  },
8660
8660
  receiveReward: async (context, event) => {
8661
8661
  const { activityNo, receiveNo } = context.activityDetail;
8662
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8662
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8663
8663
  return data
8664
8664
  },
8665
8665
  },
@@ -8801,12 +8801,12 @@ function sign_in_activity (request) {
8801
8801
  services: {
8802
8802
  fetchActivityDetail: async (context, event) => {
8803
8803
  const { activityNo } = context;
8804
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8804
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8805
8805
  return data
8806
8806
  },
8807
8807
  receiveReward: async (context, event) => {
8808
8808
  const { activityNo, receiveNo } = context;
8809
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8809
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8810
8810
  return data
8811
8811
  },
8812
8812
  },
@@ -8884,7 +8884,7 @@ function time_bomb_activity (request) {
8884
8884
  services: {
8885
8885
  fetchActivityDetail: async (context, event) => {
8886
8886
  const { activityNo } = context;
8887
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8887
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8888
8888
  return data
8889
8889
  },
8890
8890
  },
@@ -8950,7 +8950,86 @@ function mini_game_activity (request) {
8950
8950
  services: {
8951
8951
  fetchActivityDetail: async (context, event) => {
8952
8952
  const { activityNo } = context;
8953
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8953
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8954
+ return data
8955
+ },
8956
+ },
8957
+ }
8958
+ )
8959
+ }
8960
+
8961
+ function roulette_activity_v2 (request) {
8962
+ const { appSecret } = request.config;
8963
+ return createMachine(
8964
+ {
8965
+ id: 'roulette_activity_v2',
8966
+ context: {
8967
+ activityNo: null,
8968
+ activityDetail: null,
8969
+ duration: null,
8970
+ },
8971
+ initial: 'idle',
8972
+ states: {
8973
+ idle: {
8974
+ on: {
8975
+ SET_ACTIVITY_NO: {
8976
+ target: 'loading',
8977
+ actions: 'setActivityNo',
8978
+ },
8979
+ },
8980
+ },
8981
+ loading: {
8982
+ invoke: {
8983
+ src: 'fetchActivityDetail',
8984
+ onDone: {
8985
+ target: 'loaded',
8986
+ actions: 'setActivityDetail',
8987
+ },
8988
+ onError: {
8989
+ target: 'idle',
8990
+ },
8991
+ },
8992
+ },
8993
+ loaded: {
8994
+ entry: 'setDuration',
8995
+ always: [{ target: 'expired', cond: 'isExpired' }],
8996
+ after: {
8997
+ 1000: {
8998
+ target: 'loaded',
8999
+ },
9000
+ },
9001
+ },
9002
+ expired: {},
9003
+ },
9004
+ },
9005
+ {
9006
+ actions: {
9007
+ setActivityNo: assign((context, event) => {
9008
+ return {
9009
+ activityNo: event.data,
9010
+ }
9011
+ }),
9012
+ setActivityDetail: assign((context, event) => {
9013
+ return {
9014
+ activityDetail: event.data,
9015
+ }
9016
+ }),
9017
+ setDuration: assign((context, event) => {
9018
+ const { activityDetail = {} } = context;
9019
+ return {
9020
+ duration: activityDetail.periodEndTime - new Date().getTime() / 1000,
9021
+ }
9022
+ }),
9023
+ },
9024
+ guards: {
9025
+ isExpired: (context, event) => {
9026
+ return context.duration <= 0
9027
+ },
9028
+ },
9029
+ services: {
9030
+ fetchActivityDetail: async (context, event) => {
9031
+ const { activityNo } = context;
9032
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8954
9033
  return data
8955
9034
  },
8956
9035
  },
@@ -8966,6 +9045,8 @@ function activity$1 (request) {
8966
9045
  initial: 'fetchingActivityList',
8967
9046
  context: {
8968
9047
  tick: 2000,
9048
+ specifyActivities: [29],
9049
+ activitiesDetailList: [],
8969
9050
  activityList: [],
8970
9051
  activityMap: {},
8971
9052
  tournamentList: [],
@@ -8977,23 +9058,49 @@ function activity$1 (request) {
8977
9058
  invoke: {
8978
9059
  src: 'fetchActivityList',
8979
9060
  onDone: {
8980
- target: 'pending',
9061
+ target: 'idle',
8981
9062
  actions: ['setActivityList', 'setTournamentList'],
8982
9063
  },
8983
9064
  onError: {
8984
- target: 'pending',
9065
+ target: 'idle',
8985
9066
  },
8986
9067
  },
8987
9068
  },
8988
- pending: {
8989
- after: {
8990
- TIMEOUT: {
8991
- target: 'fetchingActivityList',
9069
+ idle: {
9070
+ type: 'parallel',
9071
+ states: {
9072
+ activitiesDetail: {
9073
+ initial: 'checking',
9074
+ states: {
9075
+ checking: {
9076
+ always: [{ target: 'fetchActivityDetail', cond: 'hasSpecifyActivities' }, { target: 'end' }],
9077
+ },
9078
+ fetchActivityDetail: {
9079
+ invoke: {
9080
+ src: 'fetchActivitiesDetail',
9081
+ onDone: {
9082
+ target: 'end',
9083
+ actions: 'setActivitiesDetailList',
9084
+ },
9085
+ onError: {
9086
+ target: 'end',
9087
+ },
9088
+ },
9089
+ },
9090
+ end: {},
9091
+ },
8992
9092
  },
8993
- },
8994
- on: {
8995
- SET_UNREAD: {
8996
- actions: 'setUnread',
9093
+ pending: {
9094
+ after: {
9095
+ TIMEOUT: {
9096
+ target: '#activity.fetchingActivityList',
9097
+ },
9098
+ },
9099
+ on: {
9100
+ SET_UNREAD: {
9101
+ actions: 'setUnread',
9102
+ },
9103
+ },
8997
9104
  },
8998
9105
  },
8999
9106
  },
@@ -9025,6 +9132,11 @@ function activity$1 (request) {
9025
9132
  activityList: list,
9026
9133
  }
9027
9134
  }),
9135
+ setActivitiesDetailList: assign((context, event) => {
9136
+ return {
9137
+ activitiesDetailList: event.data.map((item) => item.data),
9138
+ }
9139
+ }),
9028
9140
  setUnread: assign((context, event) => {
9029
9141
  const { uidSite, activityNo, unread } = event.data;
9030
9142
  const list = JSON.parse(JSON.stringify(context.activityList));
@@ -9041,6 +9153,13 @@ function activity$1 (request) {
9041
9153
  }
9042
9154
  }),
9043
9155
  },
9156
+ guards: {
9157
+ hasSpecifyActivities: (context, event) => {
9158
+ const { activityList = [], specifyActivities = [] } = context;
9159
+ const filterActivityList = activityList.filter((activity) => specifyActivities.includes(activity.activityType));
9160
+ return filterActivityList.length > 0
9161
+ },
9162
+ },
9044
9163
  delays: {
9045
9164
  TIMEOUT: (context, event) => {
9046
9165
  const { tick } = context;
@@ -9049,9 +9168,18 @@ function activity$1 (request) {
9049
9168
  },
9050
9169
  services: {
9051
9170
  fetchActivityList: async (context, event) => {
9052
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
9171
+ const { data } = await request.send(api.getActivityList({ appSecret }));
9053
9172
  return data
9054
9173
  },
9174
+ fetchActivitiesDetail: async (context, event) => {
9175
+ const { activityList = [], specifyActivities = [] } = context;
9176
+ const filterActivityList = activityList.filter((activity) => specifyActivities.includes(activity.activityType));
9177
+ const promiseArray = filterActivityList.map((activity) => {
9178
+ return request.send(api.getActivityDetail({ activityNo: activity.activityNo, appSecret }))
9179
+ });
9180
+ const activitiesDetail = await Promise.all(promiseArray);
9181
+ return activitiesDetail
9182
+ },
9055
9183
  },
9056
9184
  }
9057
9185
  )
@@ -9072,6 +9200,7 @@ var activity = {
9072
9200
  sign_in_activity,
9073
9201
  time_bomb_activity,
9074
9202
  mini_game_activity,
9203
+ roulette_activity_v2,
9075
9204
  activity: activity$1,
9076
9205
  };
9077
9206
 
@@ -12781,7 +12910,7 @@ function inbox (request) {
12781
12910
  fetchMessages: async (context, event) => {
12782
12911
  const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context));
12783
12912
  if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND')) {
12784
- const { data } = await request.send(activity$2.getRewardList({ count: 30, appSecret }));
12913
+ const { data } = await request.send(api.getRewardList({ count: 30, appSecret }));
12785
12914
  inbox[currentTab] = { data, page: 0, totalPage: 1 };
12786
12915
  } else {
12787
12916
  const { page = -1 } = inbox[currentTab] || {};
@@ -13026,12 +13155,12 @@ function reward_fc (request) {
13026
13155
  },
13027
13156
  services: {
13028
13157
  fetchRewardList: async (context, event) => {
13029
- const { data } = await request.send(activity$2.getRewardList({ count: 30, appSecret }));
13158
+ const { data } = await request.send(api.getRewardList({ count: 30, appSecret }));
13030
13159
  return data
13031
13160
  },
13032
13161
  receiveReward: async (context, event) => {
13033
13162
  const { activityNo, receiveNo, attended } = event.data;
13034
- return await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret, attended }))
13163
+ return await request.send(api.getReward({ activityNo, receiveNo, appSecret, attended }))
13035
13164
  },
13036
13165
  },
13037
13166
  }
@@ -13189,9 +13318,9 @@ function reward (request) {
13189
13318
  },
13190
13319
  services: {
13191
13320
  fetchRewardList: async (context, event) => {
13192
- const getRewardAPI = request.send(activity$2.getRewardList({ count: 30, appSecret }));
13193
- const getPointsRewardAPI = request.send(activity$2.getRewardList({ rewardType: 'POINTS', count: 30, appSecret }));
13194
- const getOtherRewardAPI = request.send(activity$2.getRewardList({ rewardType: 'CASH,FREE', count: 30, appSecret }));
13321
+ const getRewardAPI = request.send(api.getRewardList({ count: 30, appSecret }));
13322
+ const getPointsRewardAPI = request.send(api.getRewardList({ rewardType: 'POINTS', count: 30, appSecret }));
13323
+ const getOtherRewardAPI = request.send(api.getRewardList({ rewardType: 'CASH,FREE', count: 30, appSecret }));
13195
13324
  const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI]);
13196
13325
  return [otherRewardList, pointsRewardList, rewardList]
13197
13326
  },
@@ -13202,10 +13331,10 @@ function reward (request) {
13202
13331
  },
13203
13332
  receiveReward: async (context, event) => {
13204
13333
  const { activityNo, receiveNo, attended } = event.data;
13205
- return await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret, attended }))
13334
+ return await request.send(api.getReward({ activityNo, receiveNo, appSecret, attended }))
13206
13335
  },
13207
13336
  receiveAllPoints: async (context, event) => {
13208
- return await request.send(activity$2.collect({ collectType: 'collectPoints', appSecret }))
13337
+ return await request.send(api.collect({ collectType: 'collectPoints', appSecret }))
13209
13338
  },
13210
13339
  },
13211
13340
  }
@@ -14831,7 +14960,6 @@ function withdraw_vn (request) {
14831
14960
  maximumWithdrawAmount: 0,
14832
14961
  enableWithdrawAmount: 0,
14833
14962
  enableWithdraw: false,
14834
- withdrawRules: [],
14835
14963
 
14836
14964
  amount: null,
14837
14965
  bank: null,
@@ -14839,6 +14967,9 @@ function withdraw_vn (request) {
14839
14967
  accountNumber: null,
14840
14968
  holderName: null,
14841
14969
 
14970
+ withdrawDistance: null,
14971
+ withdrawAmount: null,
14972
+
14842
14973
  // otp
14843
14974
  requestId: null,
14844
14975
  status: null,
@@ -15318,7 +15449,6 @@ function withdraw_crypto (request) {
15318
15449
  maxWithdrawAmount: null,
15319
15450
  availableWithdrawAmount: null,
15320
15451
  enableWithdraw: false,
15321
- withdrawRules: [],
15322
15452
 
15323
15453
  attachmentType: null, // null | 'withdraw' | 'pool'
15324
15454
 
@@ -15641,28 +15771,13 @@ function withdraw_crypto (request) {
15641
15771
  const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
15642
15772
  event.data?.withdrawRule;
15643
15773
 
15644
- const withdrawRules = event.data?.withdrawRule?.rules || [];
15645
- const rules = withdrawRules.filter((rule) => rule.maxWithdrawAmount > 0);
15646
-
15647
- const { balance } = context;
15648
- const lastMatchedIndex = findLastIndex_1(rules, (rule) => balance >= rule.greaterEqualThen);
15649
-
15650
- let maxWithdrawAmount = 0;
15651
-
15652
- if (lastMatchedIndex > -1) {
15653
- rules[lastMatchedIndex].match = true;
15654
- maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount;
15655
- } else if (rules.length > 0) {
15656
- maxWithdrawAmount = rules[0].maxWithdrawAmount;
15657
- } else {
15658
- maxWithdrawAmount = balance;
15659
- }
15660
-
15661
15774
  return {
15662
- maxWithdrawAmount,
15775
+ // maxWithdrawAmount: maximumWithdrawAmount,
15776
+ // availableWithdrawAmount: enableWithdrawAmount,
15777
+ maximumWithdrawAmount: +maximumWithdrawAmount,
15663
15778
  enableWithdrawAmount: +enableWithdrawAmount,
15779
+ amount: +enableWithdrawAmount,
15664
15780
  enableWithdraw,
15665
- withdrawRules,
15666
15781
  }
15667
15782
 
15668
15783
  // const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
@@ -19975,12 +20090,12 @@ function leaderboard (request) {
19975
20090
  },
19976
20091
  services: {
19977
20092
  fetchActivityList: async (context, event) => {
19978
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
20093
+ const { data } = await request.send(api.getActivityList({ appSecret }));
19979
20094
  return data
19980
20095
  },
19981
20096
  fetchActivityDetail: async (context, event) => {
19982
20097
  const { activityNo } = context;
19983
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
20098
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
19984
20099
  return data
19985
20100
  },
19986
20101
  },
@@ -20445,7 +20560,7 @@ function vip_table (request) {
20445
20560
  },
20446
20561
  services: {
20447
20562
  fetchVipTable: async (context, event) => {
20448
- const { viptable = {} } = await request.send(activity$2.getVipTable());
20563
+ const { viptable = {} } = await request.send(api.getVipTable());
20449
20564
  const { data = [] } = viptable;
20450
20565
  data.map((item) => {
20451
20566
  item.title = item.title.toLowerCase();
@@ -20615,6 +20730,275 @@ function promotions (request) {
20615
20730
  )
20616
20731
  }
20617
20732
 
20733
+ function roulette_v2 (request) {
20734
+ const { appSecret } = request.config;
20735
+ return createMachine(
20736
+ {
20737
+ id: 'roulette_v2',
20738
+ context: {
20739
+ tick: 2000,
20740
+ activityNo: null,
20741
+ activityDetail: null,
20742
+ duration: null,
20743
+ spinCount: 0,
20744
+ duration: null,
20745
+ rewardList: [],
20746
+ unCollectRewards: [],
20747
+ unCollectPoints: 0,
20748
+ unCollectPrize: 0,
20749
+ unCollectFree: 0,
20750
+ unCollectCash: 0,
20751
+ latestSpinLeft: 0,
20752
+ spinLeft: 0,
20753
+ spinResult: {},
20754
+ rouletteV2ExchangeAward: [],
20755
+ calculatedNewSpinRewards: [],
20756
+ awardedCashAmount: 0,
20757
+ awardedFreeAmount: 0,
20758
+ awardedPointsAmount: 0,
20759
+ awardedPrizeCount: 0,
20760
+ },
20761
+ initial: 'idle',
20762
+ states: {
20763
+ idle: {
20764
+ on: {
20765
+ SET_ACTIVITY_NO: {
20766
+ target: 'fetching',
20767
+ actions: 'setActivityNo',
20768
+ },
20769
+ },
20770
+ },
20771
+ fetching: {
20772
+ invoke: {
20773
+ src: 'fetchActivityDetail',
20774
+ onDone: {
20775
+ target: 'loaded',
20776
+ actions: ['setInitData', 'setUncollectRewardData'],
20777
+ },
20778
+ onError: {
20779
+ target: 'loaded',
20780
+ },
20781
+ },
20782
+ },
20783
+ loaded: {
20784
+ type: 'parallel',
20785
+ states: {
20786
+ prepare: {
20787
+ initial: 'countdown',
20788
+ states: {
20789
+ countdown: {
20790
+ entry: 'setDuration',
20791
+ always: [{ target: 'expired', cond: 'isExpired' }],
20792
+ after: {
20793
+ 1000: {
20794
+ target: 'countdown',
20795
+ },
20796
+ },
20797
+ },
20798
+ expired: {},
20799
+ },
20800
+ },
20801
+ init: {
20802
+ initial: 'pending',
20803
+ states: {
20804
+ pending: {
20805
+ on: {
20806
+ SPIN: {
20807
+ target: 'spinning',
20808
+ actions: 'setSpinCount',
20809
+ },
20810
+ GET_REWARD: {
20811
+ target: 'awarding',
20812
+ },
20813
+ },
20814
+ },
20815
+ spinning: {
20816
+ invoke: {
20817
+ src: 'exchange',
20818
+ onDone: {
20819
+ target: 'animation',
20820
+ actions: ['setSpinResult', 'setUncollectRewardData'],
20821
+ },
20822
+ onError: {
20823
+ target: 'pending',
20824
+ },
20825
+ },
20826
+ },
20827
+ animation: {
20828
+ on: {
20829
+ FINISHED: {
20830
+ target: 'finished',
20831
+ },
20832
+ },
20833
+ },
20834
+ finished: {
20835
+ after: {
20836
+ 0: {
20837
+ target: 'pending',
20838
+ },
20839
+ },
20840
+ },
20841
+ awarding: {
20842
+ invoke: {
20843
+ src: 'collect',
20844
+ onDone: {
20845
+ target: 'awarded',
20846
+ actions: 'setCollectResult',
20847
+ },
20848
+ onError: {
20849
+ target: 'pending',
20850
+ },
20851
+ },
20852
+ },
20853
+ awarded: {
20854
+ after: {
20855
+ 0: {
20856
+ target: 'pending',
20857
+ },
20858
+ },
20859
+ },
20860
+ },
20861
+ },
20862
+ },
20863
+ },
20864
+ },
20865
+ },
20866
+ {
20867
+ actions: {
20868
+ setActivityNo: assign((context, event) => {
20869
+ return {
20870
+ activityNo: event.data,
20871
+ }
20872
+ }),
20873
+ setInitData: assign((context, event) => {
20874
+ const { rewardList = [], latestSpinLeft = 0, spinLeft = 0, unCollectRewards = [], periodEndTime = '0' } = event.data || {};
20875
+ const combindedRewardList = rewardList.reduce((arr, item, index) => {
20876
+ if (index === 4) {
20877
+ arr.push({ rewardType: 'Spin All', reward: '', withdrawRule: '' });
20878
+ arr.push(item);
20879
+ } else {
20880
+ arr.push(item);
20881
+ }
20882
+ return arr
20883
+ }, []);
20884
+
20885
+ return {
20886
+ activityDetail: event.data,
20887
+ duration: parseInt(`${periodEndTime}`) - new Date().getTime() / 1000,
20888
+ rewardList: combindedRewardList,
20889
+ unCollectRewards,
20890
+ latestSpinLeft,
20891
+ spinLeft,
20892
+ }
20893
+ }),
20894
+ setUncollectRewardData: assign((context, event) => {
20895
+ const { unCollectRewards = [] } = context;
20896
+ let unCollectPoints = 0;
20897
+ let unCollectFree = 0;
20898
+ let unCollectCash = 0;
20899
+ let unCollectPrize = 0;
20900
+
20901
+ unCollectRewards.forEach((item) => {
20902
+ if (item.rewardType === 'POINTS') {
20903
+ unCollectPoints += parseFloat(`${item.reward}`);
20904
+ }
20905
+ if (item.rewardType === 'FREE') {
20906
+ unCollectFree += parseFloat(`${item.reward}`);
20907
+ }
20908
+ if (item.rewardType === 'CASH') {
20909
+ unCollectCash += parseFloat(`${item.reward}`);
20910
+ }
20911
+ if (item.rewardType === 'PRIZE') {
20912
+ unCollectPrize++;
20913
+ }
20914
+ });
20915
+
20916
+ return {
20917
+ unCollectPoints,
20918
+ unCollectPrize,
20919
+ unCollectFree,
20920
+ unCollectCash,
20921
+ }
20922
+ }),
20923
+ setDuration: assign((context, event) => {
20924
+ const { activityDetail = {} } = context;
20925
+ return {
20926
+ duration: activityDetail.periodEndTime - new Date().getTime() / 1000,
20927
+ }
20928
+ }),
20929
+ setSpinCount: assign((context, event) => {
20930
+ return {
20931
+ spinCount: event.data,
20932
+ }
20933
+ }),
20934
+ setSpinResult: assign((context, event) => {
20935
+ const { unCollectRewards = [], newSpinRewards = [], spinLeft = 0 } = JSON.parse(JSON.stringify(event.data || {}));
20936
+ const calculatedNewSpinRewards = newSpinRewards
20937
+ .map((item) => {
20938
+ item.count = 1;
20939
+ return item
20940
+ })
20941
+ .reduce((arr, spin) => {
20942
+ let newIndex = 0;
20943
+ let alreadyHave = false;
20944
+ if (arr.length > 0) {
20945
+ alreadyHave = arr.find((item, index) => {
20946
+ if (item.rewardType === spin.rewardType && item.reward === spin.reward) {
20947
+ newIndex = index;
20948
+ return true
20949
+ } else {
20950
+ return false
20951
+ }
20952
+ });
20953
+ }
20954
+ if (alreadyHave) {
20955
+ arr[newIndex].count++;
20956
+ } else {
20957
+ arr.push(spin);
20958
+ }
20959
+ return arr
20960
+ }, []);
20961
+
20962
+ return {
20963
+ spinResult: event.data,
20964
+ unCollectRewards,
20965
+ calculatedNewSpinRewards,
20966
+ spinLeft,
20967
+ }
20968
+ }),
20969
+ setCollectResult: assign((context, event) => {
20970
+ const { rouletteV2ExchangeAward } = event.data;
20971
+ return {
20972
+ rouletteV2ExchangeAward,
20973
+ unCollectRewards: [],
20974
+ }
20975
+ }),
20976
+ },
20977
+ guards: {
20978
+ isExpired: (context, event) => {
20979
+ return context.duration <= 0
20980
+ },
20981
+ },
20982
+ services: {
20983
+ fetchActivityDetail: async (context, event) => {
20984
+ const { activityNo } = context;
20985
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
20986
+ return data
20987
+ },
20988
+ exchange: async (context, event) => {
20989
+ const { activityNo, spinCount } = context;
20990
+ const { data } = await request.send(api.exchange({ activityNo, exchangeType: 3, numberOfTimes: spinCount }));
20991
+ return data
20992
+ },
20993
+ collect: async (context, event) => {
20994
+ const { data } = await request.send(api.collect({ appSecret, collectType: 'roulettev2' }));
20995
+ return data
20996
+ },
20997
+ },
20998
+ }
20999
+ )
21000
+ }
21001
+
20618
21002
  var index$1 = {
20619
21003
  ...activity,
20620
21004
  auth,
@@ -20653,6 +21037,7 @@ var index$1 = {
20653
21037
  auth_otp_v3,
20654
21038
  vip_table,
20655
21039
  promotions,
21040
+ roulette_v2,
20656
21041
  };
20657
21042
 
20658
21043
  // const pickBy = require('lodash/pickBy')