@jetthai/cuora 1.1.34 → 1.1.35-roulette

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',
@@ -3917,7 +3917,7 @@ var form = {
3917
3917
  upload: (formData) => ({ url: 'upload', method: 'post', params: formData, isFormData: true }),
3918
3918
  };
3919
3919
 
3920
- var index$2 = { activity: activity$2, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
3920
+ var index$2 = { activity: api, auth: auth$1, common: common$1, game: game$1, mailbox, payment, user, form };
3921
3921
 
3922
3922
  /*! *****************************************************************************
3923
3923
  Copyright (c) Microsoft Corporation.
@@ -7175,12 +7175,12 @@ function continue_deposit_activity (request) {
7175
7175
  services: {
7176
7176
  fetchActivityDetail: async (context, event) => {
7177
7177
  const { activityNo } = context;
7178
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7178
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7179
7179
  return data
7180
7180
  },
7181
7181
  receiveReward: async (context, event) => {
7182
7182
  const { activityNo, receiveNo } = context;
7183
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
7183
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
7184
7184
  return data
7185
7185
  },
7186
7186
  },
@@ -7264,7 +7264,7 @@ function deposit_activity (request) {
7264
7264
  services: {
7265
7265
  fetchActivityDetail: async (context, event) => {
7266
7266
  const { activityNo } = context;
7267
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7267
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7268
7268
  return data
7269
7269
  },
7270
7270
  },
@@ -7436,12 +7436,12 @@ function diamond_shop_activity_fc (request) {
7436
7436
  },
7437
7437
  services: {
7438
7438
  fetchActivityList: async (context, event) => {
7439
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
7439
+ const { data } = await request.send(api.getActivityList({ appSecret }));
7440
7440
  return data
7441
7441
  },
7442
7442
  fetchActivityDetail: async (context, event) => {
7443
7443
  const { activityNo } = context;
7444
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7444
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7445
7445
  return data
7446
7446
  },
7447
7447
  exchange: async (context, event) => {
@@ -7449,7 +7449,7 @@ function diamond_shop_activity_fc (request) {
7449
7449
  return await Promise.all(
7450
7450
  exchangeList.map((item) =>
7451
7451
  request.send(
7452
- activity$2.exchange({
7452
+ api.exchange({
7453
7453
  exchangeType: 1,
7454
7454
  activityNo,
7455
7455
  exchangeAward: item.award,
@@ -7459,7 +7459,7 @@ function diamond_shop_activity_fc (request) {
7459
7459
  )
7460
7460
  },
7461
7461
  collect: async (context, event) => {
7462
- return await request.send(activity$2.collect({ appSecret }))
7462
+ return await request.send(api.collect({ appSecret }))
7463
7463
  },
7464
7464
  },
7465
7465
  }
@@ -7651,18 +7651,18 @@ function diamond_shop_activity_vn (request) {
7651
7651
  },
7652
7652
  services: {
7653
7653
  fetchActivityList: async (context, event) => {
7654
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
7654
+ const { data } = await request.send(api.getActivityList({ appSecret }));
7655
7655
  return data
7656
7656
  },
7657
7657
  fetchActivityDetail: async (context, event) => {
7658
7658
  const { activityNo } = context;
7659
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7659
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7660
7660
  return data
7661
7661
  },
7662
7662
  exchange: async (context, event) => {
7663
7663
  const { activityNo } = context;
7664
7664
  return await request.send(
7665
- activity$2.exchange({
7665
+ api.exchange({
7666
7666
  exchangeType: 1,
7667
7667
  activityNo,
7668
7668
  exchangeAward: event.data,
@@ -7670,7 +7670,7 @@ function diamond_shop_activity_vn (request) {
7670
7670
  )
7671
7671
  },
7672
7672
  collect: async (context, event) => {
7673
- return await request.send(activity$2.collect({ appSecret }))
7673
+ return await request.send(api.collect({ appSecret }))
7674
7674
  },
7675
7675
  },
7676
7676
  }
@@ -7851,17 +7851,17 @@ function fafafa_activity (request) {
7851
7851
  services: {
7852
7852
  fetchActivityDetail: async (context, event) => {
7853
7853
  const { activityNo } = context;
7854
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
7854
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
7855
7855
  return data
7856
7856
  },
7857
7857
  awardPrize: async (context, event) => {
7858
7858
  const { activityNo } = context;
7859
- const { data } = await request.send(activity$2.sentAward({ activityNo, appSecret }));
7859
+ const { data } = await request.send(api.sentAward({ activityNo, appSecret }));
7860
7860
  return data
7861
7861
  },
7862
7862
  receiveReward: async (context, event) => {
7863
7863
  const { activityNo, receiveNo } = context;
7864
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
7864
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
7865
7865
  return data
7866
7866
  },
7867
7867
  },
@@ -7972,7 +7972,7 @@ function invite_friends_activity (request) {
7972
7972
  },
7973
7973
  awardPrize: async (context, event) => {
7974
7974
  const { activityNo, uidSite, bindingCode } = context;
7975
- const { data } = await request.send(activity$2.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
7975
+ const { data } = await request.send(api.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
7976
7976
  return data
7977
7977
  },
7978
7978
  },
@@ -8170,7 +8170,7 @@ function affiliate_invite_friends_activity (request) {
8170
8170
  },
8171
8171
  awardPrize: async (context, event) => {
8172
8172
  const { activityNo, uidSite, bindingCode } = context;
8173
- const { data } = await request.send(activity$2.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
8173
+ const { data } = await request.send(api.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }));
8174
8174
  return data
8175
8175
  },
8176
8176
  fetchLevelDownLineList: async (context, event) => {
@@ -8279,7 +8279,7 @@ function ranking_activity (request) {
8279
8279
  services: {
8280
8280
  fetchActivityDetail: async (context, event) => {
8281
8281
  const { activityNo } = context;
8282
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8282
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8283
8283
  return data
8284
8284
  },
8285
8285
  },
@@ -8419,16 +8419,16 @@ function return_bonus_activity (request) {
8419
8419
  services: {
8420
8420
  fetchActivityDetail: async (context, event) => {
8421
8421
  const { activityNo } = context;
8422
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8422
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8423
8423
  return data
8424
8424
  },
8425
8425
  receiveReward: async (context, event) => {
8426
8426
  const { activityNo, receiveNo } = context.rewardList[0];
8427
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8427
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8428
8428
  return data
8429
8429
  },
8430
8430
  fetchRewardList: async (context, event) => {
8431
- const { data } = await request.send(activity$2.getRewardList({ appSecret, count: 30 }));
8431
+ const { data } = await request.send(api.getRewardList({ appSecret, count: 30 }));
8432
8432
  return data
8433
8433
  },
8434
8434
  },
@@ -8534,12 +8534,12 @@ function specify_bets_activity (request) {
8534
8534
  services: {
8535
8535
  fetchActivityDetail: async (context, event) => {
8536
8536
  const { activityNo } = context;
8537
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8537
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8538
8538
  return data
8539
8539
  },
8540
8540
  receiveReward: async (context, event) => {
8541
8541
  const { activityNo, receiveNo } = context.activityDetail;
8542
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8542
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8543
8543
  return data
8544
8544
  },
8545
8545
  },
@@ -8645,12 +8645,12 @@ function specify_turnover_activity (request) {
8645
8645
  services: {
8646
8646
  fetchActivityDetail: async (context, event) => {
8647
8647
  const { activityNo } = context;
8648
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8648
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8649
8649
  return data
8650
8650
  },
8651
8651
  receiveReward: async (context, event) => {
8652
8652
  const { activityNo, receiveNo } = context.activityDetail;
8653
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8653
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8654
8654
  return data
8655
8655
  },
8656
8656
  },
@@ -8792,12 +8792,12 @@ function sign_in_activity (request) {
8792
8792
  services: {
8793
8793
  fetchActivityDetail: async (context, event) => {
8794
8794
  const { activityNo } = context;
8795
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8795
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8796
8796
  return data
8797
8797
  },
8798
8798
  receiveReward: async (context, event) => {
8799
8799
  const { activityNo, receiveNo } = context;
8800
- const { data } = await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret }));
8800
+ const { data } = await request.send(api.getReward({ activityNo, receiveNo, appSecret }));
8801
8801
  return data
8802
8802
  },
8803
8803
  },
@@ -8875,7 +8875,7 @@ function time_bomb_activity (request) {
8875
8875
  services: {
8876
8876
  fetchActivityDetail: async (context, event) => {
8877
8877
  const { activityNo } = context;
8878
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8878
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8879
8879
  return data
8880
8880
  },
8881
8881
  },
@@ -8941,7 +8941,86 @@ function mini_game_activity (request) {
8941
8941
  services: {
8942
8942
  fetchActivityDetail: async (context, event) => {
8943
8943
  const { activityNo } = context;
8944
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
8944
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8945
+ return data
8946
+ },
8947
+ },
8948
+ }
8949
+ )
8950
+ }
8951
+
8952
+ function roulette_activity_v2 (request) {
8953
+ const { appSecret } = request.config;
8954
+ return createMachine(
8955
+ {
8956
+ id: 'roulette_activity_v2',
8957
+ context: {
8958
+ activityNo: null,
8959
+ activityDetail: null,
8960
+ duration: null,
8961
+ },
8962
+ initial: 'idle',
8963
+ states: {
8964
+ idle: {
8965
+ on: {
8966
+ SET_ACTIVITY_NO: {
8967
+ target: 'loading',
8968
+ actions: 'setActivityNo',
8969
+ },
8970
+ },
8971
+ },
8972
+ loading: {
8973
+ invoke: {
8974
+ src: 'fetchActivityDetail',
8975
+ onDone: {
8976
+ target: 'loaded',
8977
+ actions: 'setActivityDetail',
8978
+ },
8979
+ onError: {
8980
+ target: 'idle',
8981
+ },
8982
+ },
8983
+ },
8984
+ loaded: {
8985
+ entry: 'setDuration',
8986
+ always: [{ target: 'expired', cond: 'isExpired' }],
8987
+ after: {
8988
+ 1000: {
8989
+ target: 'loaded',
8990
+ },
8991
+ },
8992
+ },
8993
+ expired: {},
8994
+ },
8995
+ },
8996
+ {
8997
+ actions: {
8998
+ setActivityNo: assign((context, event) => {
8999
+ return {
9000
+ activityNo: event.data,
9001
+ }
9002
+ }),
9003
+ setActivityDetail: assign((context, event) => {
9004
+ return {
9005
+ activityDetail: event.data,
9006
+ }
9007
+ }),
9008
+ setDuration: assign((context, event) => {
9009
+ const { activityDetail = {} } = context;
9010
+ return {
9011
+ duration: activityDetail.periodEndTime - new Date().getTime() / 1000,
9012
+ }
9013
+ }),
9014
+ },
9015
+ guards: {
9016
+ isExpired: (context, event) => {
9017
+ return context.duration <= 0
9018
+ },
9019
+ },
9020
+ services: {
9021
+ fetchActivityDetail: async (context, event) => {
9022
+ const { activityNo } = context;
9023
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
8945
9024
  return data
8946
9025
  },
8947
9026
  },
@@ -8957,6 +9036,8 @@ function activity$1 (request) {
8957
9036
  initial: 'fetchingActivityList',
8958
9037
  context: {
8959
9038
  tick: 2000,
9039
+ specifyActivities: [29],
9040
+ activitiesDetailList: [],
8960
9041
  activityList: [],
8961
9042
  activityMap: {},
8962
9043
  tournamentList: [],
@@ -8968,23 +9049,49 @@ function activity$1 (request) {
8968
9049
  invoke: {
8969
9050
  src: 'fetchActivityList',
8970
9051
  onDone: {
8971
- target: 'pending',
9052
+ target: 'idle',
8972
9053
  actions: ['setActivityList', 'setTournamentList'],
8973
9054
  },
8974
9055
  onError: {
8975
- target: 'pending',
9056
+ target: 'idle',
8976
9057
  },
8977
9058
  },
8978
9059
  },
8979
- pending: {
8980
- after: {
8981
- TIMEOUT: {
8982
- target: 'fetchingActivityList',
9060
+ idle: {
9061
+ type: 'parallel',
9062
+ states: {
9063
+ activitiesDetail: {
9064
+ initial: 'checking',
9065
+ states: {
9066
+ checking: {
9067
+ always: [{ target: 'fetchActivityDetail', cond: 'hasSpecifyActivities' }, { target: 'end' }],
9068
+ },
9069
+ fetchActivityDetail: {
9070
+ invoke: {
9071
+ src: 'fetchActivitiesDetail',
9072
+ onDone: {
9073
+ target: 'end',
9074
+ actions: 'setActivitiesDetailList',
9075
+ },
9076
+ onError: {
9077
+ target: 'end',
9078
+ },
9079
+ },
9080
+ },
9081
+ end: {},
9082
+ },
8983
9083
  },
8984
- },
8985
- on: {
8986
- SET_UNREAD: {
8987
- actions: 'setUnread',
9084
+ pending: {
9085
+ after: {
9086
+ TIMEOUT: {
9087
+ target: '#activity.fetchingActivityList',
9088
+ },
9089
+ },
9090
+ on: {
9091
+ SET_UNREAD: {
9092
+ actions: 'setUnread',
9093
+ },
9094
+ },
8988
9095
  },
8989
9096
  },
8990
9097
  },
@@ -9016,6 +9123,11 @@ function activity$1 (request) {
9016
9123
  activityList: list,
9017
9124
  }
9018
9125
  }),
9126
+ setActivitiesDetailList: assign((context, event) => {
9127
+ return {
9128
+ activitiesDetailList: event.data.map((item) => item.data),
9129
+ }
9130
+ }),
9019
9131
  setUnread: assign((context, event) => {
9020
9132
  const { uidSite, activityNo, unread } = event.data;
9021
9133
  const list = JSON.parse(JSON.stringify(context.activityList));
@@ -9032,6 +9144,13 @@ function activity$1 (request) {
9032
9144
  }
9033
9145
  }),
9034
9146
  },
9147
+ guards: {
9148
+ hasSpecifyActivities: (context, event) => {
9149
+ const { activityList = [], specifyActivities = [] } = context;
9150
+ const filterActivityList = activityList.filter((activity) => specifyActivities.includes(activity.activityType));
9151
+ return filterActivityList.length > 0
9152
+ },
9153
+ },
9035
9154
  delays: {
9036
9155
  TIMEOUT: (context, event) => {
9037
9156
  const { tick } = context;
@@ -9040,9 +9159,18 @@ function activity$1 (request) {
9040
9159
  },
9041
9160
  services: {
9042
9161
  fetchActivityList: async (context, event) => {
9043
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
9162
+ const { data } = await request.send(api.getActivityList({ appSecret }));
9044
9163
  return data
9045
9164
  },
9165
+ fetchActivitiesDetail: async (context, event) => {
9166
+ const { activityList = [], specifyActivities = [] } = context;
9167
+ const filterActivityList = activityList.filter((activity) => specifyActivities.includes(activity.activityType));
9168
+ const promiseArray = filterActivityList.map((activity) => {
9169
+ return request.send(api.getActivityDetail({ activityNo: activity.activityNo, appSecret }))
9170
+ });
9171
+ const activitiesDetail = await Promise.all(promiseArray);
9172
+ return activitiesDetail
9173
+ },
9046
9174
  },
9047
9175
  }
9048
9176
  )
@@ -9063,6 +9191,7 @@ var activity = {
9063
9191
  sign_in_activity,
9064
9192
  time_bomb_activity,
9065
9193
  mini_game_activity,
9194
+ roulette_activity_v2,
9066
9195
  activity: activity$1,
9067
9196
  };
9068
9197
 
@@ -12772,7 +12901,7 @@ function inbox (request) {
12772
12901
  fetchMessages: async (context, event) => {
12773
12902
  const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context));
12774
12903
  if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND')) {
12775
- const { data } = await request.send(activity$2.getRewardList({ count: 30, appSecret }));
12904
+ const { data } = await request.send(api.getRewardList({ count: 30, appSecret }));
12776
12905
  inbox[currentTab] = { data, page: 0, totalPage: 1 };
12777
12906
  } else {
12778
12907
  const { page = -1 } = inbox[currentTab] || {};
@@ -13017,12 +13146,12 @@ function reward_fc (request) {
13017
13146
  },
13018
13147
  services: {
13019
13148
  fetchRewardList: async (context, event) => {
13020
- const { data } = await request.send(activity$2.getRewardList({ count: 30, appSecret }));
13149
+ const { data } = await request.send(api.getRewardList({ count: 30, appSecret }));
13021
13150
  return data
13022
13151
  },
13023
13152
  receiveReward: async (context, event) => {
13024
13153
  const { activityNo, receiveNo, attended } = event.data;
13025
- return await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret, attended }))
13154
+ return await request.send(api.getReward({ activityNo, receiveNo, appSecret, attended }))
13026
13155
  },
13027
13156
  },
13028
13157
  }
@@ -13180,9 +13309,9 @@ function reward (request) {
13180
13309
  },
13181
13310
  services: {
13182
13311
  fetchRewardList: async (context, event) => {
13183
- const getRewardAPI = request.send(activity$2.getRewardList({ count: 30, appSecret }));
13184
- const getPointsRewardAPI = request.send(activity$2.getRewardList({ rewardType: 'POINTS', count: 30, appSecret }));
13185
- const getOtherRewardAPI = request.send(activity$2.getRewardList({ rewardType: 'CASH,FREE', count: 30, appSecret }));
13312
+ const getRewardAPI = request.send(api.getRewardList({ count: 30, appSecret }));
13313
+ const getPointsRewardAPI = request.send(api.getRewardList({ rewardType: 'POINTS', count: 30, appSecret }));
13314
+ const getOtherRewardAPI = request.send(api.getRewardList({ rewardType: 'CASH,FREE', count: 30, appSecret }));
13186
13315
  const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI]);
13187
13316
  return [otherRewardList, pointsRewardList, rewardList]
13188
13317
  },
@@ -13193,10 +13322,10 @@ function reward (request) {
13193
13322
  },
13194
13323
  receiveReward: async (context, event) => {
13195
13324
  const { activityNo, receiveNo, attended } = event.data;
13196
- return await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret, attended }))
13325
+ return await request.send(api.getReward({ activityNo, receiveNo, appSecret, attended }))
13197
13326
  },
13198
13327
  receiveAllPoints: async (context, event) => {
13199
- return await request.send(activity$2.collect({ collectType: 'collectPoints', appSecret }))
13328
+ return await request.send(api.collect({ collectType: 'collectPoints', appSecret }))
13200
13329
  },
13201
13330
  },
13202
13331
  }
@@ -16560,9 +16689,9 @@ function loadcard_vn (request) {
16560
16689
  },
16561
16690
  },
16562
16691
  checking: {
16563
- always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
16692
+ always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
16564
16693
  },
16565
- promotionApplyMode: {
16694
+ newWalletMode: {
16566
16695
  initial: 'loaded',
16567
16696
  states: {
16568
16697
  loaded: {
@@ -16572,12 +16701,12 @@ function loadcard_vn (request) {
16572
16701
  actions: 'setCard',
16573
16702
  },
16574
16703
  SELECT_AMOUNT: {
16575
- target: 'submittable',
16704
+ target: 'pending',
16576
16705
  actions: 'setAmount',
16577
16706
  },
16578
16707
  },
16579
16708
  },
16580
- submittable: {
16709
+ pending: {
16581
16710
  on: {
16582
16711
  SELECT_AMOUNT: {
16583
16712
  actions: 'setAmount',
@@ -16854,7 +16983,7 @@ function loadcard_vn (request) {
16854
16983
  }),
16855
16984
  },
16856
16985
  guards: {
16857
- isPromotionApplyMode: (context, event) => {
16986
+ isNewWalletMode: (context, event) => {
16858
16987
  return context.siteConfig?.walletMode === '2'
16859
16988
  },
16860
16989
  isSubmittable: (context, event) => {
@@ -17143,9 +17272,9 @@ function qrcode_v2 (request) {
17143
17272
  },
17144
17273
  },
17145
17274
  checking: {
17146
- always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
17275
+ always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
17147
17276
  },
17148
- promotionApplyMode: {
17277
+ newWalletMode: {
17149
17278
  initial: 'loaded',
17150
17279
  states: {
17151
17280
  loaded: {
@@ -17156,12 +17285,12 @@ function qrcode_v2 (request) {
17156
17285
  },
17157
17286
  SELECT_AMOUNT: [
17158
17287
  {
17159
- target: 'submittable',
17288
+ target: 'pending',
17160
17289
  actions: 'addAmount',
17161
17290
  cond: (context, event) => context.grandTotalEnable === 1,
17162
17291
  },
17163
17292
  {
17164
- target: 'submittable',
17293
+ target: 'pending',
17165
17294
  actions: 'setAmount',
17166
17295
  },
17167
17296
  ],
@@ -17170,7 +17299,7 @@ function qrcode_v2 (request) {
17170
17299
  },
17171
17300
  },
17172
17301
  },
17173
- submittable: {
17302
+ pending: {
17174
17303
  on: {
17175
17304
  SELECT_AMOUNT: [
17176
17305
  {
@@ -17265,7 +17394,7 @@ function qrcode_v2 (request) {
17265
17394
  actions: 'setResult',
17266
17395
  },
17267
17396
  onError: {
17268
- target: 'submittable',
17397
+ target: 'pending',
17269
17398
  },
17270
17399
  },
17271
17400
  },
@@ -17477,7 +17606,7 @@ function qrcode_v2 (request) {
17477
17606
  }),
17478
17607
  },
17479
17608
  guards: {
17480
- isPromotionApplyMode: (context, event) => {
17609
+ isNewWalletMode: (context, event) => {
17481
17610
  return context.siteConfig?.walletMode === '2'
17482
17611
  },
17483
17612
  },
@@ -18423,9 +18552,9 @@ function crypto_button (request) {
18423
18552
  },
18424
18553
  },
18425
18554
  checking: {
18426
- always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
18555
+ always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
18427
18556
  },
18428
- promotionApplyMode: {
18557
+ newWalletMode: {
18429
18558
  initial: 'loaded',
18430
18559
  states: {
18431
18560
  loaded: {
@@ -18778,7 +18907,7 @@ function crypto_button (request) {
18778
18907
  }),
18779
18908
  },
18780
18909
  guards: {
18781
- isPromotionApplyMode: (context, event) => {
18910
+ isNewWalletMode: (context, event) => {
18782
18911
  return context.siteConfig?.walletMode === '2'
18783
18912
  },
18784
18913
  isConfirmable: (context, event) => {
@@ -19885,12 +20014,12 @@ function leaderboard (request) {
19885
20014
  },
19886
20015
  services: {
19887
20016
  fetchActivityList: async (context, event) => {
19888
- const { data } = await request.send(activity$2.getActivityList({ appSecret }));
20017
+ const { data } = await request.send(api.getActivityList({ appSecret }));
19889
20018
  return data
19890
20019
  },
19891
20020
  fetchActivityDetail: async (context, event) => {
19892
20021
  const { activityNo } = context;
19893
- const { data } = await request.send(activity$2.getActivityDetail({ activityNo, appSecret }));
20022
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
19894
20023
  return data
19895
20024
  },
19896
20025
  },
@@ -20355,7 +20484,7 @@ function vip_table (request) {
20355
20484
  },
20356
20485
  services: {
20357
20486
  fetchVipTable: async (context, event) => {
20358
- const { viptable = {} } = await request.send(activity$2.getVipTable());
20487
+ const { viptable = {} } = await request.send(api.getVipTable());
20359
20488
  const { data = [] } = viptable;
20360
20489
  data.map((item) => {
20361
20490
  item.title = item.title.toLowerCase();
@@ -20424,25 +20553,25 @@ function promotions (request) {
20424
20553
  pending: {
20425
20554
  on: {
20426
20555
  CONFIRM: {
20427
- target: 'joinning',
20556
+ target: 'applying',
20428
20557
  },
20429
20558
  BACK: {
20430
20559
  target: 'loaded',
20431
20560
  },
20432
20561
  },
20433
20562
  },
20434
- joinning: {
20563
+ applying: {
20435
20564
  invoke: {
20436
20565
  src: 'applyPromotion',
20437
20566
  onDone: {
20438
- target: 'joined',
20567
+ target: 'applied',
20439
20568
  },
20440
20569
  onError: {
20441
20570
  target: 'loaded',
20442
20571
  },
20443
20572
  },
20444
20573
  },
20445
- joined: {},
20574
+ applied: {},
20446
20575
  fail: {},
20447
20576
  },
20448
20577
  },
@@ -20525,6 +20654,275 @@ function promotions (request) {
20525
20654
  )
20526
20655
  }
20527
20656
 
20657
+ function roulette_v2 (request) {
20658
+ const { appSecret } = request.config;
20659
+ return createMachine(
20660
+ {
20661
+ id: 'roulette_v2',
20662
+ context: {
20663
+ tick: 2000,
20664
+ activityNo: null,
20665
+ activityDetail: null,
20666
+ duration: null,
20667
+ spinCount: 0,
20668
+ duration: null,
20669
+ rewardList: [],
20670
+ unCollectRewards: [],
20671
+ unCollectPoints: 0,
20672
+ unCollectPrize: 0,
20673
+ unCollectFree: 0,
20674
+ unCollectCash: 0,
20675
+ latestSpinLeft: 0,
20676
+ spinLeft: 0,
20677
+ spinResult: {},
20678
+ rouletteV2ExchangeAward: [],
20679
+ calculatedNewSpinRewards: [],
20680
+ awardedCashAmount: 0,
20681
+ awardedFreeAmount: 0,
20682
+ awardedPointsAmount: 0,
20683
+ awardedPrizeCount: 0,
20684
+ },
20685
+ initial: 'idle',
20686
+ states: {
20687
+ idle: {
20688
+ on: {
20689
+ SET_ACTIVITY_NO: {
20690
+ target: 'fetching',
20691
+ actions: 'setActivityNo',
20692
+ },
20693
+ },
20694
+ },
20695
+ fetching: {
20696
+ invoke: {
20697
+ src: 'fetchActivityDetail',
20698
+ onDone: {
20699
+ target: 'loaded',
20700
+ actions: ['setInitData', 'setUncollectRewardData'],
20701
+ },
20702
+ onError: {
20703
+ target: 'loaded',
20704
+ },
20705
+ },
20706
+ },
20707
+ loaded: {
20708
+ type: 'parallel',
20709
+ states: {
20710
+ prepare: {
20711
+ initial: 'countdown',
20712
+ states: {
20713
+ countdown: {
20714
+ entry: 'setDuration',
20715
+ always: [{ target: 'expired', cond: 'isExpired' }],
20716
+ after: {
20717
+ 1000: {
20718
+ target: 'countdown',
20719
+ },
20720
+ },
20721
+ },
20722
+ expired: {},
20723
+ },
20724
+ },
20725
+ init: {
20726
+ initial: 'pending',
20727
+ states: {
20728
+ pending: {
20729
+ on: {
20730
+ SPIN: {
20731
+ target: 'spinning',
20732
+ actions: 'setSpinCount',
20733
+ },
20734
+ GET_REWARD: {
20735
+ target: 'awarding',
20736
+ },
20737
+ },
20738
+ },
20739
+ spinning: {
20740
+ invoke: {
20741
+ src: 'exchange',
20742
+ onDone: {
20743
+ target: 'animation',
20744
+ actions: ['setSpinResult', 'setUncollectRewardData'],
20745
+ },
20746
+ onError: {
20747
+ target: 'pending',
20748
+ },
20749
+ },
20750
+ },
20751
+ animation: {
20752
+ on: {
20753
+ FINISHED: {
20754
+ target: 'finished',
20755
+ },
20756
+ },
20757
+ },
20758
+ finished: {
20759
+ after: {
20760
+ 0: {
20761
+ target: 'pending',
20762
+ },
20763
+ },
20764
+ },
20765
+ awarding: {
20766
+ invoke: {
20767
+ src: 'collect',
20768
+ onDone: {
20769
+ target: 'awarded',
20770
+ actions: 'setCollectResult',
20771
+ },
20772
+ onError: {
20773
+ target: 'pending',
20774
+ },
20775
+ },
20776
+ },
20777
+ awarded: {
20778
+ after: {
20779
+ 0: {
20780
+ target: 'pending',
20781
+ },
20782
+ },
20783
+ },
20784
+ },
20785
+ },
20786
+ },
20787
+ },
20788
+ },
20789
+ },
20790
+ {
20791
+ actions: {
20792
+ setActivityNo: assign((context, event) => {
20793
+ return {
20794
+ activityNo: event.data,
20795
+ }
20796
+ }),
20797
+ setInitData: assign((context, event) => {
20798
+ const { rewardList = [], latestSpinLeft = 0, spinLeft = 0, unCollectRewards = [], periodEndTime = '0' } = event.data || {};
20799
+ const combindedRewardList = rewardList.reduce((arr, item, index) => {
20800
+ if (index === 4) {
20801
+ arr.push({ rewardType: 'Spin All', reward: '', withdrawRule: '' });
20802
+ arr.push(item);
20803
+ } else {
20804
+ arr.push(item);
20805
+ }
20806
+ return arr
20807
+ }, []);
20808
+
20809
+ return {
20810
+ activityDetail: event.data,
20811
+ duration: parseInt(`${periodEndTime}`) - new Date().getTime() / 1000,
20812
+ rewardList: combindedRewardList,
20813
+ unCollectRewards,
20814
+ latestSpinLeft,
20815
+ spinLeft,
20816
+ }
20817
+ }),
20818
+ setUncollectRewardData: assign((context, event) => {
20819
+ const { unCollectRewards = [] } = context;
20820
+ let unCollectPoints = 0;
20821
+ let unCollectFree = 0;
20822
+ let unCollectCash = 0;
20823
+ let unCollectPrize = 0;
20824
+
20825
+ unCollectRewards.forEach((item) => {
20826
+ if (item.rewardType === 'POINTS') {
20827
+ unCollectPoints += parseFloat(`${item.reward}`);
20828
+ }
20829
+ if (item.rewardType === 'FREE') {
20830
+ unCollectFree += parseFloat(`${item.reward}`);
20831
+ }
20832
+ if (item.rewardType === 'CASH') {
20833
+ unCollectCash += parseFloat(`${item.reward}`);
20834
+ }
20835
+ if (item.rewardType === 'PRIZE') {
20836
+ unCollectPrize++;
20837
+ }
20838
+ });
20839
+
20840
+ return {
20841
+ unCollectPoints,
20842
+ unCollectPrize,
20843
+ unCollectFree,
20844
+ unCollectCash,
20845
+ }
20846
+ }),
20847
+ setDuration: assign((context, event) => {
20848
+ const { activityDetail = {} } = context;
20849
+ return {
20850
+ duration: activityDetail.periodEndTime - new Date().getTime() / 1000,
20851
+ }
20852
+ }),
20853
+ setSpinCount: assign((context, event) => {
20854
+ return {
20855
+ spinCount: event.data,
20856
+ }
20857
+ }),
20858
+ setSpinResult: assign((context, event) => {
20859
+ const { unCollectRewards = [], newSpinRewards = [], spinLeft = 0 } = JSON.parse(JSON.stringify(event.data || {}));
20860
+ const calculatedNewSpinRewards = newSpinRewards
20861
+ .map((item) => {
20862
+ item.count = 1;
20863
+ return item
20864
+ })
20865
+ .reduce((arr, spin) => {
20866
+ let newIndex = 0;
20867
+ let alreadyHave = false;
20868
+ if (arr.length > 0) {
20869
+ alreadyHave = arr.find((item, index) => {
20870
+ if (item.rewardType === spin.rewardType && item.reward === spin.reward) {
20871
+ newIndex = index;
20872
+ return true
20873
+ } else {
20874
+ return false
20875
+ }
20876
+ });
20877
+ }
20878
+ if (alreadyHave) {
20879
+ arr[newIndex].count++;
20880
+ } else {
20881
+ arr.push(spin);
20882
+ }
20883
+ return arr
20884
+ }, []);
20885
+
20886
+ return {
20887
+ spinResult: event.data,
20888
+ unCollectRewards,
20889
+ calculatedNewSpinRewards,
20890
+ spinLeft,
20891
+ }
20892
+ }),
20893
+ setCollectResult: assign((context, event) => {
20894
+ const { rouletteV2ExchangeAward } = event.data;
20895
+ return {
20896
+ rouletteV2ExchangeAward,
20897
+ unCollectRewards: [],
20898
+ }
20899
+ }),
20900
+ },
20901
+ guards: {
20902
+ isExpired: (context, event) => {
20903
+ return context.duration <= 0
20904
+ },
20905
+ },
20906
+ services: {
20907
+ fetchActivityDetail: async (context, event) => {
20908
+ const { activityNo } = context;
20909
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }));
20910
+ return data
20911
+ },
20912
+ exchange: async (context, event) => {
20913
+ const { activityNo, spinCount } = context;
20914
+ const { data } = await request.send(api.exchange({ activityNo, exchangeType: 3, numberOfTimes: spinCount }));
20915
+ return data
20916
+ },
20917
+ collect: async (context, event) => {
20918
+ const { data } = await request.send(api.collect({ appSecret, collectType: 'roulettev2' }));
20919
+ return data
20920
+ },
20921
+ },
20922
+ }
20923
+ )
20924
+ }
20925
+
20528
20926
  var index$1 = {
20529
20927
  ...activity,
20530
20928
  auth,
@@ -20563,6 +20961,7 @@ var index$1 = {
20563
20961
  auth_otp_v3,
20564
20962
  vip_table,
20565
20963
  promotions,
20964
+ roulette_v2,
20566
20965
  };
20567
20966
 
20568
20967
  // const pickBy = require('lodash/pickBy')