@jetthai/cuora 1.1.64 → 1.1.65-doubleWallet

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
@@ -3769,6 +3769,7 @@ var payment = {
3769
3769
  checkTransaction: (paymentMethod) => ({ url: `payment/${paymentMethod}/checkTransaction`, method: 'post' }),
3770
3770
  setBonusSetting: ({ bonus }) => ({ url: 'payment/v2/setting', method: 'post', params: { bonus } }),
3771
3771
  getCurrentWithdrawRule: () => ({ url: 'payment/v2/getCurrentWithdrawRule', method: 'get' }),
3772
+ getDoubleWalletWithdrawRule: ({ walletType }) => ({ url: 'payment/v2/withdrawRule', method: 'post', params: { walletType } }),
3772
3773
  convertFreeCredit: ({ exchangeType, cryptoNetwork, targetAddress }) => ({
3773
3774
  url: 'payment/v2/convertFreeCredit',
3774
3775
  method: 'post',
@@ -3867,6 +3868,7 @@ var payment = {
3867
3868
  }),
3868
3869
  giveUp: () => ({ url: 'payment/v2/bankWallet/promotion/giveUp', method: 'post' }),
3869
3870
  restore: ({ amount }) => ({ url: 'payment/v2/bankWallet/restore', method: 'post', params: { amount } }),
3871
+ restore: () => ({ url: 'payment/v2/bankWallet/restore', method: 'post', params: { amount } }),
3870
3872
  };
3871
3873
 
3872
3874
  var user = {
@@ -9120,7 +9122,7 @@ function activity$1 (request) {
9120
9122
  setActivityList: assign((context, event) => {
9121
9123
  const noRedActivity = [2, 4, 13, 20, 90, 91, 92];
9122
9124
  const { uidSite } = context;
9123
- let list = event.data;
9125
+ let list = JSON.parse(JSON.stringify(event.data));
9124
9126
  list.forEach((activity) => {
9125
9127
  const storageUnread = localStorage.getItem(`unread_${activity.activityNo}_${uidSite}`);
9126
9128
  if (noRedActivity.includes(activity.activityType)) {
@@ -22696,12 +22698,14 @@ function withdraw_amb (request) {
22696
22698
  }
22697
22699
 
22698
22700
  function manual_vn (request) {
22701
+ const { appSecret } = request.config;
22699
22702
  return createMachine(
22700
22703
  {
22701
22704
  id: 'manual',
22702
22705
  initial: 'loading',
22703
22706
  context: {
22704
- paymentDetails: [],
22707
+ siteConfig: null,
22708
+ paymentDetail: [],
22705
22709
 
22706
22710
  houseBanks: [],
22707
22711
  playerBanks: [],
@@ -22767,6 +22771,10 @@ function manual_vn (request) {
22767
22771
  states: {
22768
22772
  promotion: {
22769
22773
  always: [
22774
+ {
22775
+ target: 'idle',
22776
+ cond: 'isDoubleWalletMode',
22777
+ },
22770
22778
  {
22771
22779
  target: 'calculating',
22772
22780
  actions: 'setPromotionDefaultAmount',
@@ -22811,11 +22819,29 @@ function manual_vn (request) {
22811
22819
  actions: 'clearCalculation',
22812
22820
  },
22813
22821
  TRANSACT: {
22814
- target: '#manual.step2',
22822
+ target: 'checking',
22815
22823
  cond: 'isCalculated',
22816
22824
  },
22817
22825
  },
22818
22826
  },
22827
+ checking: {
22828
+ always: [
22829
+ {
22830
+ target: 'pending',
22831
+ cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
22832
+ },
22833
+ {
22834
+ target: '#manual.step2',
22835
+ },
22836
+ ],
22837
+ },
22838
+ pending: {
22839
+ on: {
22840
+ CONFIRM: {
22841
+ target: '#manual.step2',
22842
+ },
22843
+ },
22844
+ },
22819
22845
  step2: {
22820
22846
  initial: 'idle',
22821
22847
  states: {
@@ -22898,15 +22924,16 @@ function manual_vn (request) {
22898
22924
  {
22899
22925
  actions: {
22900
22926
  setInitData: assign((context, event) => {
22901
- const { paymentInfo, paymentDetails } = event.data;
22927
+ const { siteConfig, paymentInfo, paymentDetail } = event.data;
22902
22928
  const bankInfoList = paymentInfo?.bankInfo || [];
22903
- const currentPayment = paymentDetails.find((element) => element.category === context.currentCategory);
22929
+ const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory);
22904
22930
  const houseBanks = currentPayment.banks.map((item) => {
22905
22931
  item.bankCode = item.bankName;
22906
22932
  return item
22907
22933
  });
22908
22934
  return {
22909
- paymentDetails,
22935
+ siteConfig,
22936
+ paymentDetail,
22910
22937
  currentPayment,
22911
22938
  method: currentPayment.method,
22912
22939
  houseBanks,
@@ -23007,6 +23034,9 @@ function manual_vn (request) {
23007
23034
  }),
23008
23035
  },
23009
23036
  guards: {
23037
+ isDoubleWalletMode: (context, event) => {
23038
+ return context.siteConfig?.walletMode === '4'
23039
+ },
23010
23040
  isCalculable: (context, event) => {
23011
23041
  const {
23012
23042
  amount,
@@ -23030,13 +23060,16 @@ function manual_vn (request) {
23030
23060
  },
23031
23061
  services: {
23032
23062
  fetchInitData: async (context, event) => {
23033
- const [paymentInfo, paymentDetails] = await Promise.all([
23063
+ const [{ config }, paymentInfo, paymentDetail] = await Promise.all([
23064
+ request.send(common$1.getConfig({ appSecret })),
23034
23065
  request.send(payment.getPaymentInfo()),
23035
23066
  request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
23036
23067
  ]);
23068
+ const siteConfig = JSON.parse(window.atob(config));
23037
23069
  return {
23070
+ siteConfig,
23038
23071
  paymentInfo,
23039
- paymentDetails,
23072
+ paymentDetail,
23040
23073
  }
23041
23074
  },
23042
23075
  fetchBanksList: async (context, event) => {
@@ -23098,148 +23131,90 @@ function loadcard_vn (request) {
23098
23131
  currentMethod: null,
23099
23132
  currentPayment: null,
23100
23133
  result: null,
23134
+
23135
+ // use for wallet mode 4
23136
+ promotion: null,
23137
+ bonusPreviewData: [],
23101
23138
  },
23102
23139
  states: {
23103
23140
  loading: {
23104
23141
  invoke: {
23105
23142
  src: 'fetchInitData',
23106
23143
  onDone: {
23107
- target: 'checking',
23108
- actions: ['setInitData', 'preset'],
23144
+ target: 'loaded',
23145
+ actions: 'setInitData',
23109
23146
  },
23110
23147
  onError: {
23111
23148
  target: 'fail',
23112
23149
  },
23113
23150
  },
23114
23151
  },
23115
- checking: {
23116
- always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
23117
- },
23118
- newWalletMode: {
23119
- initial: 'loaded',
23152
+ fail: {},
23153
+ loaded: {
23154
+ type: 'parallel',
23155
+ entry: 'reset',
23120
23156
  states: {
23121
- loaded: {
23122
- entry: 'reset',
23123
- on: {
23124
- SELECT_CARD: {
23125
- actions: 'setCard',
23126
- },
23127
- SELECT_AMOUNT: {
23128
- target: 'pending',
23129
- actions: 'setAmount',
23130
- },
23131
- },
23132
- },
23133
- pending: {
23134
- on: {
23135
- SELECT_AMOUNT: {
23136
- actions: 'setAmount',
23137
- },
23138
- CONFIRM: {
23139
- target: 'debouncing',
23140
- },
23141
- BACK: {
23142
- target: 'loaded',
23143
- },
23144
- },
23145
- },
23146
- debouncing: {
23147
- on: {
23148
- SELECT_AMOUNT: {
23149
- target: 'debouncing',
23150
- actions: 'setAmount',
23151
- },
23152
- BACK: {
23153
- target: 'loaded',
23154
- },
23155
- },
23156
- after: {
23157
- 1000: {
23158
- target: 'calculating',
23159
- },
23160
- },
23161
- },
23162
- calculable: {
23163
- entry: 'clearCalculation',
23164
- on: {
23165
- SELECT_AMOUNT: {
23166
- target: 'debouncing',
23167
- actions: 'setAmount',
23168
- },
23169
- CALCULATE: {
23170
- target: 'debouncing',
23171
- },
23172
- BACK: {
23173
- target: 'loaded',
23174
- },
23175
- },
23176
- },
23177
- calculating: {
23178
- invoke: {
23179
- src: 'fetchCalculation',
23180
- onDone: {
23181
- target: 'submitting',
23182
- actions: 'setCalculation',
23157
+ bonusPreview: {
23158
+ initial: 'checking',
23159
+ states: {
23160
+ checking: {
23161
+ always: [
23162
+ {
23163
+ target: 'fetching',
23164
+ cond: (context, event) => {
23165
+ const { siteConfig = {}, promotion = {} } = context;
23166
+ return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23167
+ },
23168
+ },
23169
+ { target: 'end' },
23170
+ ],
23183
23171
  },
23184
- onError: {
23185
- target: 'calculable',
23172
+ fetching: {
23173
+ invoke: {
23174
+ src: 'fetchBonusPreview',
23175
+ onDone: {
23176
+ target: 'end',
23177
+ actions: 'setBonusPreview',
23178
+ },
23179
+ onError: {
23180
+ target: 'end',
23181
+ },
23182
+ },
23186
23183
  },
23184
+ end: {},
23187
23185
  },
23188
23186
  },
23189
- cardInfo: {
23187
+ idle: {
23190
23188
  on: {
23191
- INPUT_CARD_NUMBER: {
23192
- actions: 'setCardNumber',
23193
- },
23194
- INPUT_SERIAL_NUMBER: {
23195
- actions: 'setSerialNumber',
23196
- },
23197
- SUBMIT: {
23198
- target: 'submitting',
23199
- cond: 'isSubmittable',
23200
- },
23201
23189
  SELECT_CARD: {
23202
- target: 'loaded',
23203
23190
  actions: 'setCard',
23204
23191
  },
23205
- },
23206
- },
23207
- submitting: {
23208
- invoke: {
23209
- src: 'submitDeposit',
23210
- onDone: [
23192
+ SELECT_AMOUNT: [
23211
23193
  {
23212
- target: 'submitting',
23213
- cond: 'jumpLinkEnable',
23194
+ target: '#loadcard.pending',
23195
+ actions: 'setAmount',
23196
+ cond: 'isFreeWalletMode',
23214
23197
  },
23215
23198
  {
23216
- target: 'cardInfo',
23199
+ target: '#loadcard.debouncing',
23200
+ actions: 'setAmount',
23217
23201
  },
23218
23202
  ],
23219
- onError: {
23220
- target: 'loaded',
23221
- },
23222
- },
23223
- },
23224
- submitted: {
23225
- on: {
23226
- BACK: {
23227
- target: 'loaded',
23228
- },
23229
23203
  },
23230
23204
  },
23231
23205
  },
23232
23206
  },
23233
- defaultMode: {
23234
- entry: 'reset',
23207
+ pending: {
23235
23208
  on: {
23236
- SELECT_CARD: {
23237
- actions: 'setCard',
23238
- },
23239
23209
  SELECT_AMOUNT: {
23240
- target: 'debouncing',
23241
23210
  actions: 'setAmount',
23242
23211
  },
23212
+ CONFIRM: {
23213
+ target: 'calculating',
23214
+ },
23215
+ BACK: {
23216
+ target: 'loaded',
23217
+ },
23243
23218
  },
23244
23219
  },
23245
23220
  debouncing: {
@@ -23249,7 +23224,7 @@ function loadcard_vn (request) {
23249
23224
  actions: 'setAmount',
23250
23225
  },
23251
23226
  BACK: {
23252
- target: 'defaultMode',
23227
+ target: 'loaded',
23253
23228
  },
23254
23229
  },
23255
23230
  after: {
@@ -23258,22 +23233,6 @@ function loadcard_vn (request) {
23258
23233
  },
23259
23234
  },
23260
23235
  },
23261
- fail: {},
23262
- calculable: {
23263
- entry: 'clearCalculation',
23264
- on: {
23265
- SELECT_AMOUNT: {
23266
- target: 'debouncing',
23267
- actions: 'setAmount',
23268
- },
23269
- CALCULATE: {
23270
- target: 'debouncing',
23271
- },
23272
- BACK: {
23273
- target: 'defaultMode',
23274
- },
23275
- },
23276
- },
23277
23236
  calculating: {
23278
23237
  invoke: {
23279
23238
  src: 'fetchCalculation',
@@ -23286,6 +23245,18 @@ function loadcard_vn (request) {
23286
23245
  },
23287
23246
  },
23288
23247
  },
23248
+ calculable: {
23249
+ entry: 'clearCalculation',
23250
+ on: {
23251
+ SELECT_AMOUNT: {
23252
+ target: 'debouncing',
23253
+ actions: 'setAmount',
23254
+ },
23255
+ BACK: {
23256
+ target: 'loaded',
23257
+ },
23258
+ },
23259
+ },
23289
23260
  calculated: {
23290
23261
  on: {
23291
23262
  SELECT_AMOUNT: {
@@ -23302,7 +23273,7 @@ function loadcard_vn (request) {
23302
23273
  },
23303
23274
  ],
23304
23275
  BACK: {
23305
- target: 'defaultMode',
23276
+ target: 'loaded',
23306
23277
  },
23307
23278
  CLEAR_CALCULATION: {
23308
23279
  target: 'debouncing',
@@ -23323,7 +23294,7 @@ function loadcard_vn (request) {
23323
23294
  cond: 'isSubmittable',
23324
23295
  },
23325
23296
  SELECT_CARD: {
23326
- target: 'defaultMode',
23297
+ target: 'loaded',
23327
23298
  actions: 'setCard',
23328
23299
  },
23329
23300
  },
@@ -23336,18 +23307,23 @@ function loadcard_vn (request) {
23336
23307
  actions: 'setResult',
23337
23308
  },
23338
23309
  onError: {
23339
- target: 'defaultMode',
23310
+ target: 'loaded',
23340
23311
  },
23341
23312
  },
23342
23313
  },
23343
23314
  submitted: {
23344
23315
  on: {
23345
23316
  BACK: {
23346
- target: 'defaultMode',
23317
+ target: 'loaded',
23347
23318
  },
23348
23319
  },
23349
23320
  },
23350
23321
  },
23322
+ on: {
23323
+ SET_PROMOTION: {
23324
+ actions: 'setPromotion',
23325
+ },
23326
+ },
23351
23327
  },
23352
23328
  {
23353
23329
  actions: {
@@ -23360,9 +23336,10 @@ function loadcard_vn (request) {
23360
23336
  }
23361
23337
  }),
23362
23338
  setInitData: assign((context, event) => {
23363
- const { paymentDetail } = event.data;
23339
+ const { siteConfig, paymentDetail } = event.data;
23364
23340
  const cards = paymentDetail.filter((element) => element.category === context.currentCategory);
23365
23341
  return {
23342
+ siteConfig,
23366
23343
  paymentDetail,
23367
23344
  cards,
23368
23345
  selectedCard: cards[0],
@@ -23370,10 +23347,9 @@ function loadcard_vn (request) {
23370
23347
  options: cards[0].optional,
23371
23348
  }
23372
23349
  }),
23373
- preset: assign((context, event) => {
23374
- const { siteConfig } = event.data;
23350
+ setBonusPreview: assign((context, event) => {
23375
23351
  return {
23376
- siteConfig,
23352
+ bonusPreviewData: event.data.bonus,
23377
23353
  }
23378
23354
  }),
23379
23355
  setCard: assign((context, event) => {
@@ -23411,9 +23387,15 @@ function loadcard_vn (request) {
23411
23387
  result: event.data,
23412
23388
  }
23413
23389
  }),
23390
+ setPromotion: assign((context, event) => {
23391
+ const promotion = event.data;
23392
+ return {
23393
+ promotion,
23394
+ }
23395
+ }),
23414
23396
  },
23415
23397
  guards: {
23416
- isNewWalletMode: (context, event) => {
23398
+ isFreeWalletMode: (context, event) => {
23417
23399
  return context.siteConfig?.walletMode === '2'
23418
23400
  },
23419
23401
  isSubmittable: (context, event) => {
@@ -23434,17 +23416,25 @@ function loadcard_vn (request) {
23434
23416
  const siteConfig = JSON.parse(window.atob(config));
23435
23417
  return { siteConfig, paymentDetail }
23436
23418
  },
23419
+ fetchBonusPreview: async (context, event) => {
23420
+ const { currentMethod, promotion } = context;
23421
+ return await request.send({
23422
+ paymentMethod: currentMethod,
23423
+ promotionsNo: promotion?.activityNo,
23424
+ })
23425
+ },
23437
23426
  fetchCalculation: async (context, event) => {
23438
- const { currentMethod, selectedAmount } = context;
23427
+ const { currentMethod, selectedAmount, promotion } = context;
23439
23428
  return await request.send(
23440
23429
  payment.getDepositExpectedResult({
23441
23430
  method: currentMethod,
23442
23431
  amount: selectedAmount,
23432
+ promotionsNo: promotion?.activityNo,
23443
23433
  })
23444
23434
  )
23445
23435
  },
23446
23436
  submitDeposit: async (context, event) => {
23447
- const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber } = context;
23437
+ const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber, promotion } = context;
23448
23438
  return await request.send(
23449
23439
  payment.submitDepositTransactionLoadcard({
23450
23440
  method: currentMethod,
@@ -23452,6 +23442,7 @@ function loadcard_vn (request) {
23452
23442
  card_type: selectedCard.channel_id,
23453
23443
  card_code: cardNumber,
23454
23444
  card_seri: serialNumber,
23445
+ promotionsNo: promotion?.activityNo,
23455
23446
  })
23456
23447
  )
23457
23448
  },
@@ -23484,8 +23475,9 @@ function qrcode_v2 (request) {
23484
23475
 
23485
23476
  grandTotalEnable: 1,
23486
23477
 
23487
- // use for wallet mode 3
23478
+ // use for wallet mode 3 & 4
23488
23479
  promotion: null,
23480
+ bonusPreviewData: [],
23489
23481
  },
23490
23482
  states: {
23491
23483
  loading: {
@@ -23493,7 +23485,7 @@ function qrcode_v2 (request) {
23493
23485
  src: 'fetchInitData',
23494
23486
  onDone: {
23495
23487
  target: 'checking',
23496
- actions: ['setInitData', 'preset'],
23488
+ actions: 'setInitData',
23497
23489
  },
23498
23490
  onError: {
23499
23491
  target: 'fail',
@@ -23502,178 +23494,121 @@ function qrcode_v2 (request) {
23502
23494
  },
23503
23495
  checking: {
23504
23496
  always: [
23505
- { target: 'newWalletMode', cond: 'isNewWalletMode' },
23497
+ {
23498
+ target: 'loaded',
23499
+ cond: 'isDoubleWalletMode',
23500
+ },
23506
23501
  {
23507
23502
  target: 'debouncing',
23508
23503
  actions: 'setPromotionDefaultAmount',
23509
23504
  cond: 'hasMinPromotionDeposit',
23510
23505
  },
23511
- { target: 'defaultMode' },
23506
+ { target: 'loaded' },
23512
23507
  ],
23513
23508
  },
23514
- newWalletMode: {
23515
- initial: 'loaded',
23509
+ fail: {},
23510
+ loaded: {
23511
+ type: 'parallel',
23512
+ entry: 'reset',
23516
23513
  states: {
23517
- loaded: {
23518
- entry: 'reset',
23519
- on: {
23520
- SELECT_QRCODE: {
23521
- actions: 'setQrcode',
23514
+ bonusPreview: {
23515
+ initial: 'checking',
23516
+ states: {
23517
+ checking: {
23518
+ always: [
23519
+ {
23520
+ target: 'fetching',
23521
+ cond: (context, event) => {
23522
+ const { siteConfig = {}, promotion = {} } = context;
23523
+ return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23524
+ },
23525
+ },
23526
+ { target: 'end' },
23527
+ ],
23522
23528
  },
23523
- SELECT_AMOUNT: [
23524
- {
23525
- target: 'pending',
23526
- actions: 'addAmount',
23527
- cond: (context, event) => context.grandTotalEnable === 1,
23528
- },
23529
- {
23530
- target: 'pending',
23531
- actions: 'setAmount',
23529
+ fetching: {
23530
+ invoke: {
23531
+ src: 'fetchBonusPreview',
23532
+ onDone: {
23533
+ target: 'end',
23534
+ actions: 'setBonusPreview',
23535
+ },
23536
+ onError: {
23537
+ target: 'end',
23538
+ },
23532
23539
  },
23533
- ],
23534
- KEY_IN: {
23535
- target: 'pending',
23536
- actions: 'setAmount',
23537
23540
  },
23541
+ end: {},
23538
23542
  },
23539
23543
  },
23540
- pending: {
23544
+ idle: {
23541
23545
  on: {
23542
- SELECT_AMOUNT: [
23546
+ SELECT_QRCODE: [
23543
23547
  {
23544
- actions: 'addAmount',
23545
- cond: (context, event) => context.grandTotalEnable === 1,
23548
+ target: '#qrcode.debouncing',
23549
+ actions: ['setQrcode', 'setPromotionDefaultAmount'],
23550
+ cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
23546
23551
  },
23547
23552
  {
23548
- actions: 'setAmount',
23553
+ actions: 'setQrcode',
23549
23554
  },
23550
23555
  ],
23551
- KEY_IN: {
23552
- actions: 'setAmount',
23553
- },
23554
- CONFIRM: {
23555
- target: 'debouncing',
23556
- },
23557
- BACK: {
23558
- target: 'loaded',
23559
- },
23560
- },
23561
- },
23562
- debouncing: {
23563
- on: {
23564
23556
  SELECT_AMOUNT: [
23565
23557
  {
23566
- target: 'debouncing',
23558
+ target: '#qrcode.pending',
23567
23559
  actions: 'addAmount',
23568
- cond: (context, event) => context.grandTotalEnable === 1,
23560
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23569
23561
  },
23570
23562
  {
23571
- target: 'debouncing',
23563
+ target: '#qrcode.pending',
23572
23564
  actions: 'setAmount',
23565
+ cond: 'isFreeWalletMode',
23573
23566
  },
23574
- ],
23575
- KEY_IN: {
23576
- target: 'debouncing',
23577
- actions: 'setAmount',
23578
- },
23579
- BACK: {
23580
- target: 'loaded',
23581
- },
23582
- },
23583
- after: {
23584
- 1000: {
23585
- target: 'calculating',
23586
- },
23587
- },
23588
- },
23589
- calculable: {
23590
- entry: 'clearCalculation',
23591
- on: {
23592
- SELECT_AMOUNT: [
23593
23567
  {
23594
- target: 'debouncing',
23568
+ target: '#qrcode.debouncing',
23595
23569
  actions: 'addAmount',
23596
- cond: (context, event) => context.grandTotalEnable === 1,
23570
+ cond: 'isGrandTotalEnable',
23597
23571
  },
23598
23572
  {
23599
- target: 'debouncing',
23573
+ target: '#qrcode.debouncing',
23574
+ actions: 'setAmount',
23575
+ },
23576
+ ],
23577
+ KEY_IN: [
23578
+ {
23579
+ target: '#qrcode.pending',
23580
+ actions: 'setAmount',
23581
+ cond: 'isFreeWalletMode',
23582
+ },
23583
+ {
23584
+ target: '#qrcode.calculating',
23600
23585
  actions: 'setAmount',
23601
23586
  },
23602
23587
  ],
23603
- KEY_IN: {
23604
- target: 'debouncing',
23605
- actions: 'setAmount',
23606
- },
23607
- CALCULATE: {
23608
- target: 'debouncing',
23609
- },
23610
- BACK: {
23611
- target: 'loaded',
23612
- },
23613
- },
23614
- },
23615
- calculating: {
23616
- invoke: {
23617
- src: 'fetchCalculation',
23618
- onDone: {
23619
- target: 'submitting',
23620
- actions: 'setCalculation',
23621
- },
23622
- onError: {
23623
- target: 'calculable',
23624
- },
23625
- },
23626
- },
23627
- submitting: {
23628
- invoke: {
23629
- src: 'submitDeposit',
23630
- onDone: {
23631
- target: 'submitted',
23632
- actions: 'setResult',
23633
- },
23634
- onError: {
23635
- target: 'pending',
23636
- },
23637
- },
23638
- },
23639
- submitted: {
23640
- on: {
23641
- SELECT_QRCODE: {
23642
- target: 'loaded',
23643
- actions: 'setQrcode',
23644
- },
23645
23588
  },
23646
23589
  },
23647
23590
  },
23648
23591
  },
23649
- defaultMode: {
23650
- entry: 'reset',
23592
+ pending: {
23651
23593
  on: {
23652
- SELECT_QRCODE: [
23653
- {
23654
- target: 'debouncing',
23655
- actions: ['setQrcode', 'setPromotionDefaultAmount'],
23656
- cond: 'hasMinPromotionDeposit',
23657
- },
23658
- {
23659
- actions: 'setQrcode',
23660
- },
23661
- ],
23662
23594
  SELECT_AMOUNT: [
23663
23595
  {
23664
- target: 'debouncing',
23665
23596
  actions: 'addAmount',
23666
- cond: (context, event) => context.grandTotalEnable === 1,
23597
+ cond: 'isGrandTotalEnable',
23667
23598
  },
23668
23599
  {
23669
- target: 'debouncing',
23670
23600
  actions: 'setAmount',
23671
23601
  },
23672
23602
  ],
23673
23603
  KEY_IN: {
23674
- target: 'calculating',
23675
23604
  actions: 'setAmount',
23676
23605
  },
23606
+ CONFIRM: {
23607
+ target: 'calculating',
23608
+ },
23609
+ BACK: {
23610
+ target: 'loaded',
23611
+ },
23677
23612
  },
23678
23613
  },
23679
23614
  debouncing: {
@@ -23682,19 +23617,25 @@ function qrcode_v2 (request) {
23682
23617
  {
23683
23618
  target: 'debouncing',
23684
23619
  actions: 'addAmount',
23685
- cond: (context, event) => context.grandTotalEnable === 1,
23620
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23621
+ },
23622
+ {
23623
+ target: 'debouncing',
23624
+ actions: 'setAmount',
23625
+ cond: 'isFreeWalletMode',
23626
+ },
23627
+ {
23628
+ target: 'debouncing',
23629
+ actions: 'addAmount',
23630
+ cond: 'isGrandTotalEnable',
23686
23631
  },
23687
23632
  {
23688
23633
  target: 'debouncing',
23689
23634
  actions: 'setAmount',
23690
23635
  },
23691
23636
  ],
23692
- KEY_IN: {
23693
- target: 'debouncing',
23694
- actions: 'setAmount',
23695
- },
23696
23637
  BACK: {
23697
- target: 'defaultMode',
23638
+ target: 'loaded',
23698
23639
  },
23699
23640
  },
23700
23641
  after: {
@@ -23703,15 +23644,24 @@ function qrcode_v2 (request) {
23703
23644
  },
23704
23645
  },
23705
23646
  },
23706
- fail: {},
23707
23647
  calculable: {
23708
23648
  entry: 'clearCalculation',
23709
23649
  on: {
23710
23650
  SELECT_AMOUNT: [
23651
+ {
23652
+ target: 'pending',
23653
+ actions: 'addAmount',
23654
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23655
+ },
23656
+ {
23657
+ target: 'pending',
23658
+ actions: 'setAmount',
23659
+ cond: 'isFreeWalletMode',
23660
+ },
23711
23661
  {
23712
23662
  target: 'debouncing',
23713
23663
  actions: 'addAmount',
23714
- cond: (context, event) => context.grandTotalEnable === 1,
23664
+ cond: 'isGrandTotalEnable',
23715
23665
  },
23716
23666
  {
23717
23667
  target: 'debouncing',
@@ -23719,24 +23669,28 @@ function qrcode_v2 (request) {
23719
23669
  },
23720
23670
  ],
23721
23671
  KEY_IN: {
23722
- target: 'debouncing',
23672
+ target: 'calculating',
23723
23673
  actions: 'setAmount',
23724
23674
  },
23725
- CALCULATE: {
23726
- target: 'debouncing',
23727
- },
23728
23675
  BACK: {
23729
- target: 'defaultMode',
23676
+ target: 'loaded',
23730
23677
  },
23731
23678
  },
23732
23679
  },
23733
23680
  calculating: {
23734
23681
  invoke: {
23735
23682
  src: 'fetchCalculation',
23736
- onDone: {
23737
- target: 'calculated',
23738
- actions: 'setCalculation',
23739
- },
23683
+ onDone: [
23684
+ {
23685
+ target: 'submitting',
23686
+ actions: 'setCalculation',
23687
+ cond: 'isFreeWalletMode',
23688
+ },
23689
+ {
23690
+ target: 'calculated',
23691
+ actions: 'setCalculation',
23692
+ },
23693
+ ],
23740
23694
  onError: {
23741
23695
  target: 'calculable',
23742
23696
  },
@@ -23745,10 +23699,20 @@ function qrcode_v2 (request) {
23745
23699
  calculated: {
23746
23700
  on: {
23747
23701
  SELECT_AMOUNT: [
23702
+ {
23703
+ target: 'pending',
23704
+ actions: 'addAmount',
23705
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23706
+ },
23707
+ {
23708
+ target: 'pending',
23709
+ actions: 'setAmount',
23710
+ cond: 'isFreeWalletMode',
23711
+ },
23748
23712
  {
23749
23713
  target: 'debouncing',
23750
23714
  actions: 'addAmount',
23751
- cond: (context, event) => context.grandTotalEnable === 1,
23715
+ cond: 'isGrandTotalEnable',
23752
23716
  },
23753
23717
  {
23754
23718
  target: 'debouncing',
@@ -23756,14 +23720,14 @@ function qrcode_v2 (request) {
23756
23720
  },
23757
23721
  ],
23758
23722
  KEY_IN: {
23759
- target: 'debouncing',
23723
+ target: 'calculating',
23760
23724
  actions: 'setAmount',
23761
23725
  },
23762
23726
  CONFIRM: {
23763
23727
  target: 'submitting',
23764
23728
  },
23765
23729
  BACK: {
23766
- target: 'defaultMode',
23730
+ target: 'loaded',
23767
23731
  },
23768
23732
  CLEAR_CALCULATION: {
23769
23733
  target: 'debouncing',
@@ -23786,7 +23750,7 @@ function qrcode_v2 (request) {
23786
23750
  submitted: {
23787
23751
  on: {
23788
23752
  SELECT_QRCODE: {
23789
- target: 'defaultMode',
23753
+ target: 'loaded',
23790
23754
  actions: 'setQrcode',
23791
23755
  },
23792
23756
  },
@@ -23807,10 +23771,11 @@ function qrcode_v2 (request) {
23807
23771
  }
23808
23772
  }),
23809
23773
  setInitData: assign((context, event) => {
23810
- const { paymentDetail } = event.data;
23774
+ const { siteConfig, paymentDetail } = event.data;
23811
23775
  const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory);
23812
23776
 
23813
23777
  return {
23778
+ siteConfig,
23814
23779
  paymentDetail,
23815
23780
  qrcodes,
23816
23781
  selectedQrcode: qrcodes[0],
@@ -23819,10 +23784,9 @@ function qrcode_v2 (request) {
23819
23784
  grandTotalEnable: qrcodes[0].grandTotalEnable,
23820
23785
  }
23821
23786
  }),
23822
- preset: assign((context, event) => {
23823
- const { siteConfig } = event.data;
23787
+ setBonusPreview: assign((context, event) => {
23824
23788
  return {
23825
- siteConfig,
23789
+ bonusPreviewData: event.data.bonus,
23826
23790
  }
23827
23791
  }),
23828
23792
  setQrcode: assign((context, event) => {
@@ -23867,9 +23831,15 @@ function qrcode_v2 (request) {
23867
23831
  }),
23868
23832
  },
23869
23833
  guards: {
23870
- isNewWalletMode: (context, event) => {
23834
+ isFreeWalletMode: (context, event) => {
23871
23835
  return context.siteConfig?.walletMode === '2'
23872
23836
  },
23837
+ isDoubleWalletMode: (context, event) => {
23838
+ return context.siteConfig?.walletMode === '4'
23839
+ },
23840
+ isGrandTotalEnable: (context, event) => {
23841
+ return context.grandTotalEnable === 1
23842
+ },
23873
23843
  hasMinPromotionDeposit: (context, event) => {
23874
23844
  return context.promotion?.minimumAmount
23875
23845
  },
@@ -23883,6 +23853,13 @@ function qrcode_v2 (request) {
23883
23853
  const siteConfig = JSON.parse(window.atob(config));
23884
23854
  return { siteConfig, paymentDetail }
23885
23855
  },
23856
+ fetchBonusPreview: async (context, event) => {
23857
+ const { currentMethod, promotion } = context;
23858
+ return await request.send({
23859
+ paymentMethod: currentMethod,
23860
+ promotionsNo: promotion?.activityNo,
23861
+ })
23862
+ },
23886
23863
  fetchCalculation: async (context, event) => {
23887
23864
  const { currentMethod, selectedAmount, promotion } = context;
23888
23865
  return await request.send(
@@ -24512,14 +24489,14 @@ function padStart(string, length, chars) {
24512
24489
 
24513
24490
  var padStart_1 = padStart;
24514
24491
 
24515
- // const padStart = require('lodash/padStart')
24516
-
24517
24492
  function crypto (request) {
24493
+ const { appSecret } = request.config;
24518
24494
  return createMachine(
24519
24495
  {
24520
24496
  id: 'crypto',
24521
24497
  initial: 'loading',
24522
24498
  context: {
24499
+ siteConfig: null,
24523
24500
  paymentDetails: [],
24524
24501
 
24525
24502
  channels: [],
@@ -24536,14 +24513,17 @@ function crypto (request) {
24536
24513
 
24537
24514
  calculation: null,
24538
24515
  result: null,
24516
+
24517
+ // use for wallet mode 4
24518
+ promotion: null,
24539
24519
  },
24540
24520
  states: {
24541
24521
  loading: {
24542
24522
  invoke: {
24543
- src: 'fetchPayments',
24523
+ src: 'fetchInitData',
24544
24524
  onDone: {
24545
24525
  target: 'idle',
24546
- actions: 'setCryptos',
24526
+ actions: 'setInitData',
24547
24527
  },
24548
24528
  onError: {
24549
24529
  target: '#crypto.fail',
@@ -24560,13 +24540,6 @@ function crypto (request) {
24560
24540
  },
24561
24541
  },
24562
24542
  },
24563
- // calculable: {
24564
- // on: {
24565
- // CALCULATE: {
24566
- // target: 'calculating',
24567
- // },
24568
- // },
24569
- // },
24570
24543
  calculating: {
24571
24544
  invoke: {
24572
24545
  src: 'fetchCalculation',
@@ -24580,6 +24553,20 @@ function crypto (request) {
24580
24553
  },
24581
24554
  },
24582
24555
  calculated: {
24556
+ on: {
24557
+ SUBMIT: [
24558
+ {
24559
+ target: 'pending',
24560
+ cond: 'isDoubleWalletMode',
24561
+ },
24562
+ {
24563
+ target: 'submitting',
24564
+ cond: 'isSubmittable',
24565
+ },
24566
+ ],
24567
+ },
24568
+ },
24569
+ pending: {
24583
24570
  on: {
24584
24571
  SUBMIT: {
24585
24572
  target: 'submitting',
@@ -24622,10 +24609,6 @@ function crypto (request) {
24622
24609
  target: '.idle',
24623
24610
  actions: ['setAmount', 'clearCalculation'],
24624
24611
  },
24625
- // CLEAR_CALCULATION: {
24626
- // target: '.idle',
24627
- // actions: 'clearCalculation',
24628
- // },
24629
24612
  CALCULATE: {
24630
24613
  target: '.debouncing',
24631
24614
  actions: 'clearCalculation',
@@ -24634,8 +24617,9 @@ function crypto (request) {
24634
24617
  },
24635
24618
  {
24636
24619
  actions: {
24637
- setCryptos: assign((context, event) => {
24638
- const cryptos = event.data?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
24620
+ setInitData: assign((context, event) => {
24621
+ const { siteConfig, paymentDetail } = event.data;
24622
+ const cryptos = paymentDetail.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
24639
24623
  const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
24640
24624
  const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
24641
24625
  const defaultNetworks =
@@ -24647,6 +24631,7 @@ function crypto (request) {
24647
24631
  }
24648
24632
  }) || [];
24649
24633
  return {
24634
+ siteConfig,
24650
24635
  channels,
24651
24636
  cryptos,
24652
24637
  networks: defaultNetworks,
@@ -24731,6 +24716,9 @@ function crypto (request) {
24731
24716
  }),
24732
24717
  },
24733
24718
  guards: {
24719
+ isDoubleWalletMode: (context, event) => {
24720
+ return context.siteConfig?.walletMode === '4'
24721
+ },
24734
24722
  isCalculable: (context, event) => {
24735
24723
  const {
24736
24724
  selectedCrypto,
@@ -24746,8 +24734,13 @@ function crypto (request) {
24746
24734
  },
24747
24735
  },
24748
24736
  services: {
24749
- fetchPayments: async (context, event) => {
24750
- return await request.send(payment$1.getPaymentDetail({ transferType: 'DEPOSIT' }))
24737
+ fetchInitData: async (context, event) => {
24738
+ const [{ config }, paymentDetail = []] = await Promise.all([
24739
+ request.send(common$1.getConfig({ appSecret })),
24740
+ request.send(payment$1.getPaymentDetail({ transferType: 'DEPOSIT' })),
24741
+ ]);
24742
+ const siteConfig = JSON.parse(window.atob(config));
24743
+ return { siteConfig, paymentDetail }
24751
24744
  },
24752
24745
  fetchCalculation: async (context, event) => {
24753
24746
  const { selectedCrypto, amount } = context;
@@ -24803,28 +24796,58 @@ function crypto_button (request) {
24803
24796
  result: null,
24804
24797
 
24805
24798
  grandTotalEnable: 1,
24799
+
24800
+ // use for wallet mode 4
24801
+ promotion: null,
24802
+ bonusPreviewData: [],
24806
24803
  },
24807
24804
  states: {
24808
24805
  loading: {
24809
24806
  invoke: {
24810
24807
  src: 'fetchInitData',
24811
24808
  onDone: {
24812
- target: 'checking',
24813
- actions: ['setInitData', 'preset'],
24809
+ target: 'loaded',
24810
+ actions: 'setInitData',
24814
24811
  },
24815
24812
  onError: {
24816
24813
  target: 'fail',
24817
24814
  },
24818
24815
  },
24819
24816
  },
24820
- checking: {
24821
- always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
24822
- },
24823
- newWalletMode: {
24824
- initial: 'loaded',
24817
+ loaded: {
24818
+ type: 'parallel',
24825
24819
  states: {
24826
- loaded: {
24827
- entry: 'reset',
24820
+ bonusPreview: {
24821
+ initial: 'checking',
24822
+ states: {
24823
+ checking: {
24824
+ always: [
24825
+ {
24826
+ target: 'fetching',
24827
+ cond: (context, event) => {
24828
+ const { siteConfig = {}, promotion = {} } = context;
24829
+ return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
24830
+ },
24831
+ },
24832
+ { target: 'end' },
24833
+ ],
24834
+ },
24835
+ fetching: {
24836
+ invoke: {
24837
+ src: 'fetchBonusPreview',
24838
+ onDone: {
24839
+ target: 'end',
24840
+ actions: 'setBonusPreview',
24841
+ },
24842
+ onError: {
24843
+ target: 'end',
24844
+ },
24845
+ },
24846
+ },
24847
+ end: {},
24848
+ },
24849
+ },
24850
+ idle: {
24828
24851
  on: {
24829
24852
  SET_CHANNEL: {
24830
24853
  actions: 'setChannel',
@@ -24839,112 +24862,11 @@ function crypto_button (request) {
24839
24862
  actions: 'setAddress',
24840
24863
  },
24841
24864
  CONFIRM: {
24842
- target: 'selecting',
24865
+ target: '#crypro_button.selecting',
24843
24866
  cond: 'isConfirmable',
24844
24867
  },
24845
24868
  },
24846
24869
  },
24847
- selecting: {
24848
- entry: 'reset',
24849
- on: {
24850
- SELECT_AMOUNT: [
24851
- {
24852
- actions: 'addAmount',
24853
- cond: (context, event) => context.grandTotalEnable === 1,
24854
- },
24855
- {
24856
- actions: 'setAmount',
24857
- },
24858
- ],
24859
- KEY_IN: {
24860
- actions: 'setAmount',
24861
- },
24862
- SUBMIT: {
24863
- target: 'debouncing',
24864
- },
24865
- BACK: {
24866
- target: 'loaded',
24867
- },
24868
- CLEAR_ALL: {
24869
- actions: 'reset',
24870
- },
24871
- },
24872
- },
24873
- debouncing: {
24874
- on: {
24875
- SELECT_AMOUNT: [
24876
- {
24877
- target: 'debouncing',
24878
- actions: 'addAmount',
24879
- cond: (context, event) => context.grandTotalEnable === 1,
24880
- },
24881
- {
24882
- target: 'debouncing',
24883
- actions: 'setAmount',
24884
- },
24885
- ],
24886
- KEY_IN: {
24887
- target: 'debouncing',
24888
- actions: 'setAmount',
24889
- },
24890
- BACK: {
24891
- target: 'loaded',
24892
- },
24893
- CLEAR_ALL: {
24894
- actions: 'reset',
24895
- },
24896
- },
24897
- after: {
24898
- 1000: {
24899
- target: 'calculating',
24900
- },
24901
- },
24902
- },
24903
- calculating: {
24904
- invoke: {
24905
- src: 'fetchCalculation',
24906
- onDone: {
24907
- target: 'submitting',
24908
- actions: 'setCalculation',
24909
- },
24910
- onError: {
24911
- target: 'selecting',
24912
- actions: 'reset',
24913
- },
24914
- },
24915
- },
24916
- submitting: {
24917
- invoke: {
24918
- src: 'submitDeposit',
24919
- onDone: {
24920
- target: '#crypro_button.submitted',
24921
- actions: 'setResult',
24922
- },
24923
- onError: {
24924
- target: 'selecting',
24925
- },
24926
- },
24927
- },
24928
- },
24929
- },
24930
- defaultMode: {
24931
- on: {
24932
- SET_CHANNEL: {
24933
- actions: 'setChannel',
24934
- },
24935
- SET_CRYPTO: {
24936
- actions: 'setCrypto',
24937
- },
24938
- SET_NETWORK: {
24939
- actions: 'setNetwork',
24940
- },
24941
- SET_ADDRESS: {
24942
- actions: 'setAddress',
24943
- },
24944
- CONFIRM: {
24945
- target: 'selecting',
24946
- cond: 'isConfirmable',
24947
- },
24948
24870
  },
24949
24871
  },
24950
24872
  fail: {},
@@ -24952,22 +24874,47 @@ function crypto_button (request) {
24952
24874
  entry: 'reset',
24953
24875
  on: {
24954
24876
  SELECT_AMOUNT: [
24877
+ {
24878
+ target: 'debouncing',
24879
+ actions: 'setAmount',
24880
+ cond: 'isDoubleWalletMode',
24881
+ },
24882
+ {
24883
+ actions: 'addAmount',
24884
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
24885
+ },
24886
+ {
24887
+ actions: 'setAmount',
24888
+ cond: (context, event) => context.siteConfig?.walletMode === '2',
24889
+ },
24955
24890
  {
24956
24891
  target: 'debouncing',
24957
24892
  actions: 'addAmount',
24958
- cond: (context, event) => context.grandTotalEnable === 1,
24893
+ cond: 'isGrandTotalEnable',
24959
24894
  },
24960
24895
  {
24961
24896
  target: 'debouncing',
24962
24897
  actions: 'setAmount',
24963
24898
  },
24964
24899
  ],
24965
- KEY_IN: {
24900
+ KEY_IN: [
24901
+ {
24902
+ actions: 'setAmount',
24903
+ cond: 'isFreeWalletMode',
24904
+ },
24905
+ {
24906
+ target: 'debouncing',
24907
+ actions: 'setAmount',
24908
+ },
24909
+ ],
24910
+ SUBMIT: {
24966
24911
  target: 'debouncing',
24967
- actions: 'setAmount',
24968
24912
  },
24969
24913
  BACK: {
24970
- target: 'defaultMode',
24914
+ target: 'loaded',
24915
+ },
24916
+ CLEAR_ALL: {
24917
+ actions: 'reset',
24971
24918
  },
24972
24919
  },
24973
24920
  },
@@ -24977,7 +24924,7 @@ function crypto_button (request) {
24977
24924
  {
24978
24925
  target: 'debouncing',
24979
24926
  actions: 'addAmount',
24980
- cond: (context, event) => context.grandTotalEnable === 1,
24927
+ cond: 'isGrandTotalEnable',
24981
24928
  },
24982
24929
  {
24983
24930
  target: 'debouncing',
@@ -24996,12 +24943,19 @@ function crypto_button (request) {
24996
24943
  },
24997
24944
  },
24998
24945
  calculating: {
24999
- invoke: {
25000
- src: 'fetchCalculation',
25001
- onDone: {
25002
- target: 'calculated',
25003
- actions: 'setCalculation',
25004
- },
24946
+ invoke: {
24947
+ src: 'fetchCalculation',
24948
+ onDone: [
24949
+ {
24950
+ target: 'submitting',
24951
+ actions: 'setCalculation',
24952
+ cond: 'isFreeWalletMode',
24953
+ },
24954
+ {
24955
+ target: 'calculated',
24956
+ actions: 'setCalculation',
24957
+ },
24958
+ ],
25005
24959
  onError: {
25006
24960
  target: 'selecting',
25007
24961
  actions: 'reset',
@@ -25014,7 +24968,7 @@ function crypto_button (request) {
25014
24968
  {
25015
24969
  target: 'debouncing',
25016
24970
  actions: 'addAmount',
25017
- cond: (context, event) => context.grandTotalEnable === 1,
24971
+ cond: 'isGrandTotalEnable',
25018
24972
  },
25019
24973
  {
25020
24974
  target: 'debouncing',
@@ -25053,6 +25007,11 @@ function crypto_button (request) {
25053
25007
  },
25054
25008
  submitted: {},
25055
25009
  },
25010
+ on: {
25011
+ SET_PROMOTION: {
25012
+ actions: 'setPromotion',
25013
+ },
25014
+ },
25056
25015
  },
25057
25016
  {
25058
25017
  actions: {
@@ -25063,7 +25022,7 @@ function crypto_button (request) {
25063
25022
  }
25064
25023
  }),
25065
25024
  setInitData: assign((context, event) => {
25066
- const { paymentDetail } = event.data;
25025
+ const { siteConfig, paymentDetail } = event.data;
25067
25026
  const cryptos = paymentDetail?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
25068
25027
  const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
25069
25028
  const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
@@ -25077,6 +25036,7 @@ function crypto_button (request) {
25077
25036
  }) || [];
25078
25037
  const options = cryptos[0].optional;
25079
25038
  return {
25039
+ siteConfig,
25080
25040
  channels,
25081
25041
  cryptos,
25082
25042
  networks: defaultNetworks,
@@ -25088,12 +25048,6 @@ function crypto_button (request) {
25088
25048
  options,
25089
25049
  }
25090
25050
  }),
25091
- preset: assign((context, event) => {
25092
- const { siteConfig } = event.data;
25093
- return {
25094
- siteConfig,
25095
- }
25096
- }),
25097
25051
  setChannel: assign((context, event) => {
25098
25052
  const { cryptos } = context;
25099
25053
  const selectedCrypto = cryptos.find((crypto) => crypto.method === event.data.value);
@@ -25145,6 +25099,11 @@ function crypto_button (request) {
25145
25099
  setNetwork: assign((context, event) => {
25146
25100
  return { selectedNetwork: event.data }
25147
25101
  }),
25102
+ setBonusPreview: assign((context, event) => {
25103
+ return {
25104
+ bonusPreviewData: event.data.bonus,
25105
+ }
25106
+ }),
25148
25107
  addAmount: assign((context, event) => {
25149
25108
  return { selectedAmount: (context.selectedAmount || 0) + event.data }
25150
25109
  }),
@@ -25171,11 +25130,23 @@ function crypto_button (request) {
25171
25130
  result: event.data,
25172
25131
  }
25173
25132
  }),
25133
+ setPromotion: assign((context, event) => {
25134
+ const promotion = event.data;
25135
+ return {
25136
+ promotion,
25137
+ }
25138
+ }),
25174
25139
  },
25175
25140
  guards: {
25176
- isNewWalletMode: (context, event) => {
25141
+ isFreeWalletMode: (context, event) => {
25177
25142
  return context.siteConfig?.walletMode === '2'
25178
25143
  },
25144
+ isDoubleWalletMode: (context, event) => {
25145
+ return context.siteConfig?.walletMode === '4'
25146
+ },
25147
+ isGrandTotalEnable: (context, event) => {
25148
+ return context.grandTotalEnable === 1
25149
+ },
25179
25150
  isConfirmable: (context, event) => {
25180
25151
  const { selectedCrypto, selectedNetwork } = context;
25181
25152
  return selectedCrypto && selectedNetwork
@@ -25194,6 +25165,13 @@ function crypto_button (request) {
25194
25165
  const siteConfig = JSON.parse(window.atob(config));
25195
25166
  return { siteConfig, paymentDetail }
25196
25167
  },
25168
+ fetchBonusPreview: async (context, event) => {
25169
+ const { selectedCrypto, promotion } = context;
25170
+ return await request.send({
25171
+ paymentMethod: selectedCrypto.method,
25172
+ promotionsNo: promotion?.activityNo,
25173
+ })
25174
+ },
25197
25175
  fetchCalculation: async (context, event) => {
25198
25176
  const { selectedCrypto, selectedAmount } = context;
25199
25177
  return await request.send(
@@ -25222,12 +25200,14 @@ function crypto_button (request) {
25222
25200
  }
25223
25201
 
25224
25202
  function direct (request) {
25203
+ const { appSecret } = request.config;
25225
25204
  return createMachine(
25226
25205
  {
25227
25206
  id: 'direct',
25228
25207
  initial: 'loading',
25229
25208
  context: {
25230
- paymentDetails: [],
25209
+ siteConfig: null,
25210
+ paymentDetail: [],
25231
25211
  directs: [],
25232
25212
  currentDirect: null,
25233
25213
  banks: [],
@@ -25273,6 +25253,10 @@ function direct (request) {
25273
25253
  },
25274
25254
  promotion: {
25275
25255
  always: [
25256
+ {
25257
+ target: 'loaded',
25258
+ cond: 'isDoubleWalletMode',
25259
+ },
25276
25260
  {
25277
25261
  target: 'calculating',
25278
25262
  actions: 'setPromotionDefaultAmount',
@@ -25299,15 +25283,61 @@ function direct (request) {
25299
25283
  actions: 'clearCalculation',
25300
25284
  },
25301
25285
  CALCULATE: {
25302
- target: 'calculating',
25303
- cond: 'isCalculable',
25286
+ target: 'debouncing',
25304
25287
  },
25288
+ SUBMIT: [
25289
+ {
25290
+ target: 'pending',
25291
+ cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
25292
+ },
25293
+ {
25294
+ target: 'submitting',
25295
+ cond: 'isSubmittable',
25296
+ },
25297
+ ],
25298
+ },
25299
+ },
25300
+ pending: {
25301
+ on: {
25305
25302
  SUBMIT: {
25306
25303
  target: 'submitting',
25307
25304
  cond: 'isSubmittable',
25308
25305
  },
25309
25306
  },
25310
25307
  },
25308
+ debouncing: {
25309
+ on: {
25310
+ SELECT_DIRECT: {
25311
+ actions: ['setDirect', 'reset'],
25312
+ target: 'loading.fetching',
25313
+ },
25314
+ SELECT_BANK: {
25315
+ actions: 'setSelectedBank',
25316
+ },
25317
+ SET_AMOUNT: {
25318
+ actions: ['setAmount', 'clearCalculation'],
25319
+ },
25320
+ CLEAR_CALCULATION: {
25321
+ actions: 'clearCalculation',
25322
+ },
25323
+ CALCULATE: {
25324
+ target: 'debouncing',
25325
+ },
25326
+ SUBMIT: [
25327
+ {
25328
+ target: 'pending',
25329
+ cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
25330
+ },
25331
+ {
25332
+ target: 'submitting',
25333
+ cond: 'isSubmittable',
25334
+ },
25335
+ ],
25336
+ },
25337
+ after: {
25338
+ 1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
25339
+ },
25340
+ },
25311
25341
  calculating: {
25312
25342
  invoke: {
25313
25343
  src: 'fetchCalculation',
@@ -25352,11 +25382,12 @@ function direct (request) {
25352
25382
  }
25353
25383
  }),
25354
25384
  setInitData: assign((context, event) => {
25355
- const paymentDetails = event.data;
25356
- const directs = paymentDetails.filter((element) => element.category === context.currentCategory);
25385
+ const { siteConfig, paymentDetail } = event.data;
25386
+ const directs = paymentDetail.filter((element) => element.category === context.currentCategory);
25357
25387
 
25358
25388
  return {
25359
- paymentDetails,
25389
+ siteConfig,
25390
+ paymentDetail,
25360
25391
  directs,
25361
25392
  currentDirect: directs[0],
25362
25393
  currentMethod: directs[0]?.method,
@@ -25413,6 +25444,9 @@ function direct (request) {
25413
25444
  }),
25414
25445
  },
25415
25446
  guards: {
25447
+ isDoubleWalletMode: (context, event) => {
25448
+ return context.siteConfig?.walletMode === '4'
25449
+ },
25416
25450
  isCalculable: (context, event) => {
25417
25451
  const {
25418
25452
  amount,
@@ -25431,7 +25465,12 @@ function direct (request) {
25431
25465
  },
25432
25466
  services: {
25433
25467
  fetchInitData: async (context, event) => {
25434
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
25468
+ const [{ config }, paymentDetail = []] = await Promise.all([
25469
+ request.send(common$1.getConfig({ appSecret })),
25470
+ request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
25471
+ ]);
25472
+ const siteConfig = JSON.parse(window.atob(config));
25473
+ return { siteConfig, paymentDetail }
25435
25474
  },
25436
25475
  fetchBanksList: async (context, event) => {
25437
25476
  const { currentDirect } = context;
@@ -25554,6 +25593,7 @@ function amb (request) {
25554
25593
  }
25555
25594
 
25556
25595
  function float (request) {
25596
+ const { appSecret } = request.config;
25557
25597
  return createMachine(
25558
25598
  {
25559
25599
  id: 'float',
@@ -25561,6 +25601,7 @@ function float (request) {
25561
25601
  context: {
25562
25602
  method: 'amb_float',
25563
25603
  userAccount: {},
25604
+ siteConfig: null,
25564
25605
  amount: 0,
25565
25606
 
25566
25607
  bankList: [],
@@ -25577,6 +25618,9 @@ function float (request) {
25577
25618
 
25578
25619
  grandTotalEnable: 1,
25579
25620
  ttl: 120,
25621
+
25622
+ promotion: null,
25623
+ bonusPreviewData: [],
25580
25624
  },
25581
25625
  states: {
25582
25626
  loading: {
@@ -25601,7 +25645,10 @@ function float (request) {
25601
25645
  initializing: {
25602
25646
  invoke: {
25603
25647
  src: 'initialize',
25604
- onDone: { target: '#float.loaded', actions: 'setInitialization' },
25648
+ onDone: {
25649
+ target: '#float.loaded',
25650
+ actions: 'setInitialization',
25651
+ },
25605
25652
  onError: {
25606
25653
  target: '#float.unavailable',
25607
25654
  },
@@ -25610,22 +25657,57 @@ function float (request) {
25610
25657
  },
25611
25658
  },
25612
25659
  loaded: {
25660
+ type: 'parallel',
25613
25661
  entry: 'reset',
25614
- on: {
25615
- SELECT_AMOUNT: [
25616
- {
25617
- target: 'debouncing',
25618
- actions: 'addAmount',
25619
- cond: (context, event) => context.grandTotalEnable === 1,
25662
+ states: {
25663
+ bonusPreview: {
25664
+ initial: 'checking',
25665
+ states: {
25666
+ checking: {
25667
+ always: [
25668
+ {
25669
+ target: 'fetching',
25670
+ cond: (context, event) => {
25671
+ const { siteConfig = {}, promotion = {} } = context;
25672
+ return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
25673
+ },
25674
+ },
25675
+ { target: 'end' },
25676
+ ],
25677
+ },
25678
+ fetching: {
25679
+ invoke: {
25680
+ src: 'fetchBonusPreview',
25681
+ onDone: {
25682
+ target: 'end',
25683
+ actions: 'setBonusPreview',
25684
+ },
25685
+ onError: {
25686
+ target: 'end',
25687
+ },
25688
+ },
25689
+ },
25690
+ end: {},
25620
25691
  },
25621
- {
25622
- target: 'debouncing',
25623
- actions: 'setAmount',
25692
+ },
25693
+ idle: {
25694
+ on: {
25695
+ SELECT_AMOUNT: [
25696
+ {
25697
+ target: '#float.debouncing',
25698
+ actions: 'addAmount',
25699
+ cond: (context, event) => context.grandTotalEnable === 1,
25700
+ },
25701
+ {
25702
+ target: '#float.debouncing',
25703
+ actions: 'setAmount',
25704
+ },
25705
+ ],
25706
+ KEY_IN: {
25707
+ target: '#float.calculating',
25708
+ actions: 'setAmount',
25709
+ },
25624
25710
  },
25625
- ],
25626
- KEY_IN: {
25627
- target: 'calculating',
25628
- actions: 'setAmount',
25629
25711
  },
25630
25712
  },
25631
25713
  },
@@ -25749,6 +25831,11 @@ function float (request) {
25749
25831
  accountUnbound: {},
25750
25832
  unavailable: {},
25751
25833
  },
25834
+ on: {
25835
+ SET_PROMOTION: {
25836
+ actions: 'setPromotion',
25837
+ },
25838
+ },
25752
25839
  },
25753
25840
  {
25754
25841
  actions: {
@@ -25757,6 +25844,17 @@ function float (request) {
25757
25844
  userAccount: event.data.bankInfo?.[0],
25758
25845
  }
25759
25846
  }),
25847
+ setPromotion: assign((context, event) => {
25848
+ const promotion = event.data;
25849
+ return {
25850
+ promotion,
25851
+ }
25852
+ }),
25853
+ setBonusPreview: assign((context, event) => {
25854
+ return {
25855
+ bonusPreviewData: event.data.bonus,
25856
+ }
25857
+ }),
25760
25858
  setHouseBank: assign((context, event) => {
25761
25859
  const { accountName, accountNumber, bankName, amount } = event.data;
25762
25860
  return {
@@ -25767,9 +25865,10 @@ function float (request) {
25767
25865
  }
25768
25866
  }),
25769
25867
  setInitialization: assign((context, event) => {
25770
- const { housePayment, bankList } = event.data;
25868
+ const { siteConfig, housePayment, bankList } = event.data;
25771
25869
  const { optional, minimum, maximum, grandTotalEnable } = housePayment;
25772
25870
  return {
25871
+ siteConfig,
25773
25872
  options: optional,
25774
25873
  minimum,
25775
25874
  maximum,
@@ -25786,11 +25885,6 @@ function float (request) {
25786
25885
  setAmount: assign((context, event) => {
25787
25886
  return { amount: event.data }
25788
25887
  }),
25789
- clear: assign((context, event) => {
25790
- return {
25791
- amount: 0,
25792
- }
25793
- }),
25794
25888
  setCalculation: assign((context, event) => {
25795
25889
  return {
25796
25890
  calculation: event.data,
@@ -25818,25 +25912,38 @@ function float (request) {
25818
25912
  return await request.send(payment.getPaymentInfo())
25819
25913
  },
25820
25914
  initialize: async (context, event) => {
25821
- const [payments, bankList] = await Promise.all([
25915
+ const [{ config }, payments, bankList] = await Promise.all([
25916
+ request.send(common$1.getConfig({ appSecret })),
25822
25917
  request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
25823
25918
  request.send(payment.getBankList('amb')),
25824
25919
  ]);
25825
- return { housePayment: payments.find((payment) => payment.method === context.method), bankList }
25920
+ const siteConfig = JSON.parse(window.atob(config));
25921
+ return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList }
25922
+ },
25923
+ fetchBonusPreview: async (context, event) => {
25924
+ const { method, promotion } = context;
25925
+ return await request.send({
25926
+ paymentMethod: method,
25927
+ promotionsNo: promotion?.activityNo,
25928
+ })
25826
25929
  },
25827
25930
  submitDeposit: async (context, event) => {
25931
+ const { method, amount, promotion } = context;
25828
25932
  return await request.send(
25829
25933
  payment.submitDepositTransaction({
25830
- method: context.method,
25831
- amount: context.amount,
25934
+ method,
25935
+ amount,
25936
+ promotionsNo: promotion?.activityNo,
25832
25937
  })
25833
25938
  )
25834
25939
  },
25835
25940
  fetchCalculation: async (context, event) => {
25941
+ const { method, amount, promotion } = context;
25836
25942
  return await request.send(
25837
25943
  payment.getDepositExpectedResult({
25838
- method: context.method,
25839
- amount: context.amount,
25944
+ method,
25945
+ amount,
25946
+ promotionsNo: promotion?.activityNo,
25840
25947
  })
25841
25948
  )
25842
25949
  },
@@ -25846,6 +25953,7 @@ function float (request) {
25846
25953
  }
25847
25954
 
25848
25955
  function vpay (request) {
25956
+ const { appSecret } = request.config;
25849
25957
  return createMachine(
25850
25958
  {
25851
25959
  id: 'vpay',
@@ -25853,6 +25961,7 @@ function vpay (request) {
25853
25961
  context: {
25854
25962
  method: 'vpay',
25855
25963
  userAccount: {},
25964
+ siteConfig: null,
25856
25965
  amount: 0,
25857
25966
 
25858
25967
  bankList: [],
@@ -25867,6 +25976,9 @@ function vpay (request) {
25867
25976
  calculatedAmount: 0,
25868
25977
 
25869
25978
  grandTotalEnable: 1,
25979
+
25980
+ promotion: null,
25981
+ bonusPreviewData: [],
25870
25982
  },
25871
25983
  states: {
25872
25984
  loading: {
@@ -25907,22 +26019,57 @@ function vpay (request) {
25907
26019
  },
25908
26020
  },
25909
26021
  loaded: {
26022
+ type: 'parallel',
25910
26023
  entry: 'reset',
25911
- on: {
25912
- SELECT_AMOUNT: [
25913
- {
25914
- target: 'debouncing',
25915
- actions: 'addAmount',
25916
- cond: (context, event) => context.grandTotalEnable === 1,
26024
+ states: {
26025
+ bonusPreview: {
26026
+ initial: 'checking',
26027
+ states: {
26028
+ checking: {
26029
+ always: [
26030
+ {
26031
+ target: 'fetching',
26032
+ cond: (context, event) => {
26033
+ const { siteConfig = {}, promotion = {} } = context;
26034
+ return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
26035
+ },
26036
+ },
26037
+ { target: 'end' },
26038
+ ],
26039
+ },
26040
+ fetching: {
26041
+ invoke: {
26042
+ src: 'fetchBonusPreview',
26043
+ onDone: {
26044
+ target: 'end',
26045
+ actions: 'setBonusPreview',
26046
+ },
26047
+ onError: {
26048
+ target: 'end',
26049
+ },
26050
+ },
26051
+ },
26052
+ end: {},
25917
26053
  },
25918
- {
25919
- target: 'debouncing',
25920
- actions: 'setAmount',
26054
+ },
26055
+ idle: {
26056
+ on: {
26057
+ SELECT_AMOUNT: [
26058
+ {
26059
+ target: '#vpay.debouncing',
26060
+ actions: 'addAmount',
26061
+ cond: (context, event) => context.grandTotalEnable === 1,
26062
+ },
26063
+ {
26064
+ target: '#vpay.debouncing',
26065
+ actions: 'setAmount',
26066
+ },
26067
+ ],
26068
+ KEY_IN: {
26069
+ target: '#vpay.calculating',
26070
+ actions: 'setAmount',
26071
+ },
25921
26072
  },
25922
- ],
25923
- KEY_IN: {
25924
- target: 'calculating',
25925
- actions: 'setAmount',
25926
26073
  },
25927
26074
  },
25928
26075
  },
@@ -26033,6 +26180,11 @@ function vpay (request) {
26033
26180
  accountUnbound: {},
26034
26181
  unavailable: {},
26035
26182
  },
26183
+ on: {
26184
+ SET_PROMOTION: {
26185
+ actions: 'setPromotion',
26186
+ },
26187
+ },
26036
26188
  },
26037
26189
  {
26038
26190
  actions: {
@@ -26041,6 +26193,11 @@ function vpay (request) {
26041
26193
  userAccount: event.data.bankInfo?.[0],
26042
26194
  }
26043
26195
  }),
26196
+ setBonusPreview: assign((context, event) => {
26197
+ return {
26198
+ bonusPreviewData: event.data.bonus,
26199
+ }
26200
+ }),
26044
26201
  setOrder: assign((context, event) => {
26045
26202
  const { amount, qrcode, vpayId } = event.data;
26046
26203
  return {
@@ -26058,9 +26215,10 @@ function vpay (request) {
26058
26215
  }
26059
26216
  }),
26060
26217
  setInitialization: assign((context, event) => {
26061
- const { housePayment, bankList } = event.data;
26218
+ const { siteConfig, housePayment, bankList } = event.data;
26062
26219
  const { optional, minimum, maximum, grandTotalEnable } = housePayment;
26063
26220
  return {
26221
+ siteConfig,
26064
26222
  options: optional,
26065
26223
  minimum,
26066
26224
  maximum,
@@ -26068,6 +26226,12 @@ function vpay (request) {
26068
26226
  grandTotalEnable,
26069
26227
  }
26070
26228
  }),
26229
+ setPromotion: assign((context, event) => {
26230
+ const promotion = event.data;
26231
+ return {
26232
+ promotion,
26233
+ }
26234
+ }),
26071
26235
  addAmount: assign((context, event) => {
26072
26236
  const { amount, maximum } = context;
26073
26237
  return {
@@ -26077,11 +26241,6 @@ function vpay (request) {
26077
26241
  setAmount: assign((context, event) => {
26078
26242
  return { amount: event.data }
26079
26243
  }),
26080
- clear: assign((context, event) => {
26081
- return {
26082
- amount: 0,
26083
- }
26084
- }),
26085
26244
  setCalculation: assign((context, event) => {
26086
26245
  return {
26087
26246
  calculation: event.data,
@@ -26106,27 +26265,39 @@ function vpay (request) {
26106
26265
  return await request.send(payment.getPaymentInfo())
26107
26266
  },
26108
26267
  initialize: async (context, event) => {
26109
- const [payments, bankList, order] = await Promise.all([
26268
+ const [{ config }, payments, bankList, order] = await Promise.all([
26269
+ request.send(common$1.getConfig({ appSecret })),
26110
26270
  request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
26111
26271
  request.send(payment.getBankList('amb')),
26112
26272
  request.send(payment.checkTransaction(context.method)),
26113
26273
  ]);
26114
- return { housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
26274
+ const siteConfig = JSON.parse(window.atob(config));
26275
+ return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
26276
+ },
26277
+ fetchBonusPreview: async (context, event) => {
26278
+ const { method, promotion } = context;
26279
+ return await request.send({
26280
+ paymentMethod: method,
26281
+ promotionsNo: promotion?.activityNo,
26282
+ })
26115
26283
  },
26116
26284
  submitDeposit: async (context, event) => {
26117
- const { method, amount } = context;
26285
+ const { method, amount, promotion } = context;
26118
26286
  return await request.send(
26119
26287
  payment.submitDepositTransaction({
26120
26288
  method,
26121
26289
  amount,
26290
+ promotionsNo: promotion?.activityNo,
26122
26291
  })
26123
26292
  )
26124
26293
  },
26125
26294
  fetchCalculation: async (context, event) => {
26295
+ const { method, amount, promotion } = context;
26126
26296
  return await request.send(
26127
26297
  payment.getDepositExpectedResult({
26128
- method: context.method,
26129
- amount: context.amount,
26298
+ method,
26299
+ amount,
26300
+ promotionsNo: promotion?.activityNo,
26130
26301
  })
26131
26302
  )
26132
26303
  },