@jetthai/cuora 1.1.63 → 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,143 +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: {
23211
- target: 'submitted',
23212
- actions: 'setResult',
23213
- },
23214
- onError: {
23215
- target: 'loaded',
23216
- },
23217
- },
23218
- },
23219
- submitted: {
23220
- on: {
23221
- BACK: {
23222
- target: 'loaded',
23223
- },
23192
+ SELECT_AMOUNT: [
23193
+ {
23194
+ target: '#loadcard.pending',
23195
+ actions: 'setAmount',
23196
+ cond: 'isFreeWalletMode',
23197
+ },
23198
+ {
23199
+ target: '#loadcard.debouncing',
23200
+ actions: 'setAmount',
23201
+ },
23202
+ ],
23224
23203
  },
23225
23204
  },
23226
23205
  },
23227
23206
  },
23228
- defaultMode: {
23229
- entry: 'reset',
23207
+ pending: {
23230
23208
  on: {
23231
- SELECT_CARD: {
23232
- actions: 'setCard',
23233
- },
23234
23209
  SELECT_AMOUNT: {
23235
- target: 'debouncing',
23236
23210
  actions: 'setAmount',
23237
23211
  },
23212
+ CONFIRM: {
23213
+ target: 'calculating',
23214
+ },
23215
+ BACK: {
23216
+ target: 'loaded',
23217
+ },
23238
23218
  },
23239
23219
  },
23240
23220
  debouncing: {
@@ -23244,7 +23224,7 @@ function loadcard_vn (request) {
23244
23224
  actions: 'setAmount',
23245
23225
  },
23246
23226
  BACK: {
23247
- target: 'defaultMode',
23227
+ target: 'loaded',
23248
23228
  },
23249
23229
  },
23250
23230
  after: {
@@ -23253,22 +23233,6 @@ function loadcard_vn (request) {
23253
23233
  },
23254
23234
  },
23255
23235
  },
23256
- fail: {},
23257
- calculable: {
23258
- entry: 'clearCalculation',
23259
- on: {
23260
- SELECT_AMOUNT: {
23261
- target: 'debouncing',
23262
- actions: 'setAmount',
23263
- },
23264
- CALCULATE: {
23265
- target: 'debouncing',
23266
- },
23267
- BACK: {
23268
- target: 'defaultMode',
23269
- },
23270
- },
23271
- },
23272
23236
  calculating: {
23273
23237
  invoke: {
23274
23238
  src: 'fetchCalculation',
@@ -23281,6 +23245,18 @@ function loadcard_vn (request) {
23281
23245
  },
23282
23246
  },
23283
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
+ },
23284
23260
  calculated: {
23285
23261
  on: {
23286
23262
  SELECT_AMOUNT: {
@@ -23297,7 +23273,7 @@ function loadcard_vn (request) {
23297
23273
  },
23298
23274
  ],
23299
23275
  BACK: {
23300
- target: 'defaultMode',
23276
+ target: 'loaded',
23301
23277
  },
23302
23278
  CLEAR_CALCULATION: {
23303
23279
  target: 'debouncing',
@@ -23318,7 +23294,7 @@ function loadcard_vn (request) {
23318
23294
  cond: 'isSubmittable',
23319
23295
  },
23320
23296
  SELECT_CARD: {
23321
- target: 'defaultMode',
23297
+ target: 'loaded',
23322
23298
  actions: 'setCard',
23323
23299
  },
23324
23300
  },
@@ -23331,18 +23307,23 @@ function loadcard_vn (request) {
23331
23307
  actions: 'setResult',
23332
23308
  },
23333
23309
  onError: {
23334
- target: 'defaultMode',
23310
+ target: 'loaded',
23335
23311
  },
23336
23312
  },
23337
23313
  },
23338
23314
  submitted: {
23339
23315
  on: {
23340
23316
  BACK: {
23341
- target: 'defaultMode',
23317
+ target: 'loaded',
23342
23318
  },
23343
23319
  },
23344
23320
  },
23345
23321
  },
23322
+ on: {
23323
+ SET_PROMOTION: {
23324
+ actions: 'setPromotion',
23325
+ },
23326
+ },
23346
23327
  },
23347
23328
  {
23348
23329
  actions: {
@@ -23355,9 +23336,10 @@ function loadcard_vn (request) {
23355
23336
  }
23356
23337
  }),
23357
23338
  setInitData: assign((context, event) => {
23358
- const { paymentDetail } = event.data;
23339
+ const { siteConfig, paymentDetail } = event.data;
23359
23340
  const cards = paymentDetail.filter((element) => element.category === context.currentCategory);
23360
23341
  return {
23342
+ siteConfig,
23361
23343
  paymentDetail,
23362
23344
  cards,
23363
23345
  selectedCard: cards[0],
@@ -23365,10 +23347,9 @@ function loadcard_vn (request) {
23365
23347
  options: cards[0].optional,
23366
23348
  }
23367
23349
  }),
23368
- preset: assign((context, event) => {
23369
- const { siteConfig } = event.data;
23350
+ setBonusPreview: assign((context, event) => {
23370
23351
  return {
23371
- siteConfig,
23352
+ bonusPreviewData: event.data.bonus,
23372
23353
  }
23373
23354
  }),
23374
23355
  setCard: assign((context, event) => {
@@ -23406,9 +23387,15 @@ function loadcard_vn (request) {
23406
23387
  result: event.data,
23407
23388
  }
23408
23389
  }),
23390
+ setPromotion: assign((context, event) => {
23391
+ const promotion = event.data;
23392
+ return {
23393
+ promotion,
23394
+ }
23395
+ }),
23409
23396
  },
23410
23397
  guards: {
23411
- isNewWalletMode: (context, event) => {
23398
+ isFreeWalletMode: (context, event) => {
23412
23399
  return context.siteConfig?.walletMode === '2'
23413
23400
  },
23414
23401
  isSubmittable: (context, event) => {
@@ -23429,17 +23416,25 @@ function loadcard_vn (request) {
23429
23416
  const siteConfig = JSON.parse(window.atob(config));
23430
23417
  return { siteConfig, paymentDetail }
23431
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
+ },
23432
23426
  fetchCalculation: async (context, event) => {
23433
- const { currentMethod, selectedAmount } = context;
23427
+ const { currentMethod, selectedAmount, promotion } = context;
23434
23428
  return await request.send(
23435
23429
  payment.getDepositExpectedResult({
23436
23430
  method: currentMethod,
23437
23431
  amount: selectedAmount,
23432
+ promotionsNo: promotion?.activityNo,
23438
23433
  })
23439
23434
  )
23440
23435
  },
23441
23436
  submitDeposit: async (context, event) => {
23442
- const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber } = context;
23437
+ const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber, promotion } = context;
23443
23438
  return await request.send(
23444
23439
  payment.submitDepositTransactionLoadcard({
23445
23440
  method: currentMethod,
@@ -23447,6 +23442,7 @@ function loadcard_vn (request) {
23447
23442
  card_type: selectedCard.channel_id,
23448
23443
  card_code: cardNumber,
23449
23444
  card_seri: serialNumber,
23445
+ promotionsNo: promotion?.activityNo,
23450
23446
  })
23451
23447
  )
23452
23448
  },
@@ -23479,8 +23475,9 @@ function qrcode_v2 (request) {
23479
23475
 
23480
23476
  grandTotalEnable: 1,
23481
23477
 
23482
- // use for wallet mode 3
23478
+ // use for wallet mode 3 & 4
23483
23479
  promotion: null,
23480
+ bonusPreviewData: [],
23484
23481
  },
23485
23482
  states: {
23486
23483
  loading: {
@@ -23488,7 +23485,7 @@ function qrcode_v2 (request) {
23488
23485
  src: 'fetchInitData',
23489
23486
  onDone: {
23490
23487
  target: 'checking',
23491
- actions: ['setInitData', 'preset'],
23488
+ actions: 'setInitData',
23492
23489
  },
23493
23490
  onError: {
23494
23491
  target: 'fail',
@@ -23497,178 +23494,121 @@ function qrcode_v2 (request) {
23497
23494
  },
23498
23495
  checking: {
23499
23496
  always: [
23500
- { target: 'newWalletMode', cond: 'isNewWalletMode' },
23497
+ {
23498
+ target: 'loaded',
23499
+ cond: 'isDoubleWalletMode',
23500
+ },
23501
23501
  {
23502
23502
  target: 'debouncing',
23503
23503
  actions: 'setPromotionDefaultAmount',
23504
23504
  cond: 'hasMinPromotionDeposit',
23505
23505
  },
23506
- { target: 'defaultMode' },
23506
+ { target: 'loaded' },
23507
23507
  ],
23508
23508
  },
23509
- newWalletMode: {
23510
- initial: 'loaded',
23509
+ fail: {},
23510
+ loaded: {
23511
+ type: 'parallel',
23512
+ entry: 'reset',
23511
23513
  states: {
23512
- loaded: {
23513
- entry: 'reset',
23514
- on: {
23515
- SELECT_QRCODE: {
23516
- 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
+ ],
23517
23528
  },
23518
- SELECT_AMOUNT: [
23519
- {
23520
- target: 'pending',
23521
- actions: 'addAmount',
23522
- cond: (context, event) => context.grandTotalEnable === 1,
23523
- },
23524
- {
23525
- target: 'pending',
23526
- actions: 'setAmount',
23529
+ fetching: {
23530
+ invoke: {
23531
+ src: 'fetchBonusPreview',
23532
+ onDone: {
23533
+ target: 'end',
23534
+ actions: 'setBonusPreview',
23535
+ },
23536
+ onError: {
23537
+ target: 'end',
23538
+ },
23527
23539
  },
23528
- ],
23529
- KEY_IN: {
23530
- target: 'pending',
23531
- actions: 'setAmount',
23532
23540
  },
23541
+ end: {},
23533
23542
  },
23534
23543
  },
23535
- pending: {
23544
+ idle: {
23536
23545
  on: {
23537
- SELECT_AMOUNT: [
23546
+ SELECT_QRCODE: [
23538
23547
  {
23539
- actions: 'addAmount',
23540
- 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,
23541
23551
  },
23542
23552
  {
23543
- actions: 'setAmount',
23553
+ actions: 'setQrcode',
23544
23554
  },
23545
23555
  ],
23546
- KEY_IN: {
23547
- actions: 'setAmount',
23548
- },
23549
- CONFIRM: {
23550
- target: 'debouncing',
23551
- },
23552
- BACK: {
23553
- target: 'loaded',
23554
- },
23555
- },
23556
- },
23557
- debouncing: {
23558
- on: {
23559
23556
  SELECT_AMOUNT: [
23560
23557
  {
23561
- target: 'debouncing',
23558
+ target: '#qrcode.pending',
23562
23559
  actions: 'addAmount',
23563
- cond: (context, event) => context.grandTotalEnable === 1,
23560
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23564
23561
  },
23565
23562
  {
23566
- target: 'debouncing',
23563
+ target: '#qrcode.pending',
23567
23564
  actions: 'setAmount',
23565
+ cond: 'isFreeWalletMode',
23568
23566
  },
23569
- ],
23570
- KEY_IN: {
23571
- target: 'debouncing',
23572
- actions: 'setAmount',
23573
- },
23574
- BACK: {
23575
- target: 'loaded',
23576
- },
23577
- },
23578
- after: {
23579
- 1000: {
23580
- target: 'calculating',
23581
- },
23582
- },
23583
- },
23584
- calculable: {
23585
- entry: 'clearCalculation',
23586
- on: {
23587
- SELECT_AMOUNT: [
23588
23567
  {
23589
- target: 'debouncing',
23568
+ target: '#qrcode.debouncing',
23590
23569
  actions: 'addAmount',
23591
- cond: (context, event) => context.grandTotalEnable === 1,
23570
+ cond: 'isGrandTotalEnable',
23592
23571
  },
23593
23572
  {
23594
- 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',
23595
23585
  actions: 'setAmount',
23596
23586
  },
23597
23587
  ],
23598
- KEY_IN: {
23599
- target: 'debouncing',
23600
- actions: 'setAmount',
23601
- },
23602
- CALCULATE: {
23603
- target: 'debouncing',
23604
- },
23605
- BACK: {
23606
- target: 'loaded',
23607
- },
23608
- },
23609
- },
23610
- calculating: {
23611
- invoke: {
23612
- src: 'fetchCalculation',
23613
- onDone: {
23614
- target: 'submitting',
23615
- actions: 'setCalculation',
23616
- },
23617
- onError: {
23618
- target: 'calculable',
23619
- },
23620
- },
23621
- },
23622
- submitting: {
23623
- invoke: {
23624
- src: 'submitDeposit',
23625
- onDone: {
23626
- target: 'submitted',
23627
- actions: 'setResult',
23628
- },
23629
- onError: {
23630
- target: 'pending',
23631
- },
23632
- },
23633
- },
23634
- submitted: {
23635
- on: {
23636
- SELECT_QRCODE: {
23637
- target: 'loaded',
23638
- actions: 'setQrcode',
23639
- },
23640
23588
  },
23641
23589
  },
23642
23590
  },
23643
23591
  },
23644
- defaultMode: {
23645
- entry: 'reset',
23592
+ pending: {
23646
23593
  on: {
23647
- SELECT_QRCODE: [
23648
- {
23649
- target: 'debouncing',
23650
- actions: ['setQrcode', 'setPromotionDefaultAmount'],
23651
- cond: 'hasMinPromotionDeposit',
23652
- },
23653
- {
23654
- actions: 'setQrcode',
23655
- },
23656
- ],
23657
23594
  SELECT_AMOUNT: [
23658
23595
  {
23659
- target: 'debouncing',
23660
23596
  actions: 'addAmount',
23661
- cond: (context, event) => context.grandTotalEnable === 1,
23597
+ cond: 'isGrandTotalEnable',
23662
23598
  },
23663
23599
  {
23664
- target: 'debouncing',
23665
23600
  actions: 'setAmount',
23666
23601
  },
23667
23602
  ],
23668
23603
  KEY_IN: {
23669
- target: 'calculating',
23670
23604
  actions: 'setAmount',
23671
23605
  },
23606
+ CONFIRM: {
23607
+ target: 'calculating',
23608
+ },
23609
+ BACK: {
23610
+ target: 'loaded',
23611
+ },
23672
23612
  },
23673
23613
  },
23674
23614
  debouncing: {
@@ -23677,19 +23617,25 @@ function qrcode_v2 (request) {
23677
23617
  {
23678
23618
  target: 'debouncing',
23679
23619
  actions: 'addAmount',
23680
- 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',
23681
23631
  },
23682
23632
  {
23683
23633
  target: 'debouncing',
23684
23634
  actions: 'setAmount',
23685
23635
  },
23686
23636
  ],
23687
- KEY_IN: {
23688
- target: 'debouncing',
23689
- actions: 'setAmount',
23690
- },
23691
23637
  BACK: {
23692
- target: 'defaultMode',
23638
+ target: 'loaded',
23693
23639
  },
23694
23640
  },
23695
23641
  after: {
@@ -23698,15 +23644,24 @@ function qrcode_v2 (request) {
23698
23644
  },
23699
23645
  },
23700
23646
  },
23701
- fail: {},
23702
23647
  calculable: {
23703
23648
  entry: 'clearCalculation',
23704
23649
  on: {
23705
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
+ },
23706
23661
  {
23707
23662
  target: 'debouncing',
23708
23663
  actions: 'addAmount',
23709
- cond: (context, event) => context.grandTotalEnable === 1,
23664
+ cond: 'isGrandTotalEnable',
23710
23665
  },
23711
23666
  {
23712
23667
  target: 'debouncing',
@@ -23714,24 +23669,28 @@ function qrcode_v2 (request) {
23714
23669
  },
23715
23670
  ],
23716
23671
  KEY_IN: {
23717
- target: 'debouncing',
23672
+ target: 'calculating',
23718
23673
  actions: 'setAmount',
23719
23674
  },
23720
- CALCULATE: {
23721
- target: 'debouncing',
23722
- },
23723
23675
  BACK: {
23724
- target: 'defaultMode',
23676
+ target: 'loaded',
23725
23677
  },
23726
23678
  },
23727
23679
  },
23728
23680
  calculating: {
23729
23681
  invoke: {
23730
23682
  src: 'fetchCalculation',
23731
- onDone: {
23732
- target: 'calculated',
23733
- actions: 'setCalculation',
23734
- },
23683
+ onDone: [
23684
+ {
23685
+ target: 'submitting',
23686
+ actions: 'setCalculation',
23687
+ cond: 'isFreeWalletMode',
23688
+ },
23689
+ {
23690
+ target: 'calculated',
23691
+ actions: 'setCalculation',
23692
+ },
23693
+ ],
23735
23694
  onError: {
23736
23695
  target: 'calculable',
23737
23696
  },
@@ -23740,10 +23699,20 @@ function qrcode_v2 (request) {
23740
23699
  calculated: {
23741
23700
  on: {
23742
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
+ },
23743
23712
  {
23744
23713
  target: 'debouncing',
23745
23714
  actions: 'addAmount',
23746
- cond: (context, event) => context.grandTotalEnable === 1,
23715
+ cond: 'isGrandTotalEnable',
23747
23716
  },
23748
23717
  {
23749
23718
  target: 'debouncing',
@@ -23751,14 +23720,14 @@ function qrcode_v2 (request) {
23751
23720
  },
23752
23721
  ],
23753
23722
  KEY_IN: {
23754
- target: 'debouncing',
23723
+ target: 'calculating',
23755
23724
  actions: 'setAmount',
23756
23725
  },
23757
23726
  CONFIRM: {
23758
23727
  target: 'submitting',
23759
23728
  },
23760
23729
  BACK: {
23761
- target: 'defaultMode',
23730
+ target: 'loaded',
23762
23731
  },
23763
23732
  CLEAR_CALCULATION: {
23764
23733
  target: 'debouncing',
@@ -23781,7 +23750,7 @@ function qrcode_v2 (request) {
23781
23750
  submitted: {
23782
23751
  on: {
23783
23752
  SELECT_QRCODE: {
23784
- target: 'defaultMode',
23753
+ target: 'loaded',
23785
23754
  actions: 'setQrcode',
23786
23755
  },
23787
23756
  },
@@ -23802,10 +23771,11 @@ function qrcode_v2 (request) {
23802
23771
  }
23803
23772
  }),
23804
23773
  setInitData: assign((context, event) => {
23805
- const { paymentDetail } = event.data;
23774
+ const { siteConfig, paymentDetail } = event.data;
23806
23775
  const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory);
23807
23776
 
23808
23777
  return {
23778
+ siteConfig,
23809
23779
  paymentDetail,
23810
23780
  qrcodes,
23811
23781
  selectedQrcode: qrcodes[0],
@@ -23814,10 +23784,9 @@ function qrcode_v2 (request) {
23814
23784
  grandTotalEnable: qrcodes[0].grandTotalEnable,
23815
23785
  }
23816
23786
  }),
23817
- preset: assign((context, event) => {
23818
- const { siteConfig } = event.data;
23787
+ setBonusPreview: assign((context, event) => {
23819
23788
  return {
23820
- siteConfig,
23789
+ bonusPreviewData: event.data.bonus,
23821
23790
  }
23822
23791
  }),
23823
23792
  setQrcode: assign((context, event) => {
@@ -23862,9 +23831,15 @@ function qrcode_v2 (request) {
23862
23831
  }),
23863
23832
  },
23864
23833
  guards: {
23865
- isNewWalletMode: (context, event) => {
23834
+ isFreeWalletMode: (context, event) => {
23866
23835
  return context.siteConfig?.walletMode === '2'
23867
23836
  },
23837
+ isDoubleWalletMode: (context, event) => {
23838
+ return context.siteConfig?.walletMode === '4'
23839
+ },
23840
+ isGrandTotalEnable: (context, event) => {
23841
+ return context.grandTotalEnable === 1
23842
+ },
23868
23843
  hasMinPromotionDeposit: (context, event) => {
23869
23844
  return context.promotion?.minimumAmount
23870
23845
  },
@@ -23878,6 +23853,13 @@ function qrcode_v2 (request) {
23878
23853
  const siteConfig = JSON.parse(window.atob(config));
23879
23854
  return { siteConfig, paymentDetail }
23880
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
+ },
23881
23863
  fetchCalculation: async (context, event) => {
23882
23864
  const { currentMethod, selectedAmount, promotion } = context;
23883
23865
  return await request.send(
@@ -24507,14 +24489,14 @@ function padStart(string, length, chars) {
24507
24489
 
24508
24490
  var padStart_1 = padStart;
24509
24491
 
24510
- // const padStart = require('lodash/padStart')
24511
-
24512
24492
  function crypto (request) {
24493
+ const { appSecret } = request.config;
24513
24494
  return createMachine(
24514
24495
  {
24515
24496
  id: 'crypto',
24516
24497
  initial: 'loading',
24517
24498
  context: {
24499
+ siteConfig: null,
24518
24500
  paymentDetails: [],
24519
24501
 
24520
24502
  channels: [],
@@ -24531,14 +24513,17 @@ function crypto (request) {
24531
24513
 
24532
24514
  calculation: null,
24533
24515
  result: null,
24516
+
24517
+ // use for wallet mode 4
24518
+ promotion: null,
24534
24519
  },
24535
24520
  states: {
24536
24521
  loading: {
24537
24522
  invoke: {
24538
- src: 'fetchPayments',
24523
+ src: 'fetchInitData',
24539
24524
  onDone: {
24540
24525
  target: 'idle',
24541
- actions: 'setCryptos',
24526
+ actions: 'setInitData',
24542
24527
  },
24543
24528
  onError: {
24544
24529
  target: '#crypto.fail',
@@ -24555,13 +24540,6 @@ function crypto (request) {
24555
24540
  },
24556
24541
  },
24557
24542
  },
24558
- // calculable: {
24559
- // on: {
24560
- // CALCULATE: {
24561
- // target: 'calculating',
24562
- // },
24563
- // },
24564
- // },
24565
24543
  calculating: {
24566
24544
  invoke: {
24567
24545
  src: 'fetchCalculation',
@@ -24575,6 +24553,20 @@ function crypto (request) {
24575
24553
  },
24576
24554
  },
24577
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: {
24578
24570
  on: {
24579
24571
  SUBMIT: {
24580
24572
  target: 'submitting',
@@ -24617,10 +24609,6 @@ function crypto (request) {
24617
24609
  target: '.idle',
24618
24610
  actions: ['setAmount', 'clearCalculation'],
24619
24611
  },
24620
- // CLEAR_CALCULATION: {
24621
- // target: '.idle',
24622
- // actions: 'clearCalculation',
24623
- // },
24624
24612
  CALCULATE: {
24625
24613
  target: '.debouncing',
24626
24614
  actions: 'clearCalculation',
@@ -24629,8 +24617,9 @@ function crypto (request) {
24629
24617
  },
24630
24618
  {
24631
24619
  actions: {
24632
- setCryptos: assign((context, event) => {
24633
- 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 })) || [];
24634
24623
  const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
24635
24624
  const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
24636
24625
  const defaultNetworks =
@@ -24642,6 +24631,7 @@ function crypto (request) {
24642
24631
  }
24643
24632
  }) || [];
24644
24633
  return {
24634
+ siteConfig,
24645
24635
  channels,
24646
24636
  cryptos,
24647
24637
  networks: defaultNetworks,
@@ -24726,6 +24716,9 @@ function crypto (request) {
24726
24716
  }),
24727
24717
  },
24728
24718
  guards: {
24719
+ isDoubleWalletMode: (context, event) => {
24720
+ return context.siteConfig?.walletMode === '4'
24721
+ },
24729
24722
  isCalculable: (context, event) => {
24730
24723
  const {
24731
24724
  selectedCrypto,
@@ -24741,8 +24734,13 @@ function crypto (request) {
24741
24734
  },
24742
24735
  },
24743
24736
  services: {
24744
- fetchPayments: async (context, event) => {
24745
- 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 }
24746
24744
  },
24747
24745
  fetchCalculation: async (context, event) => {
24748
24746
  const { selectedCrypto, amount } = context;
@@ -24798,28 +24796,58 @@ function crypto_button (request) {
24798
24796
  result: null,
24799
24797
 
24800
24798
  grandTotalEnable: 1,
24799
+
24800
+ // use for wallet mode 4
24801
+ promotion: null,
24802
+ bonusPreviewData: [],
24801
24803
  },
24802
24804
  states: {
24803
24805
  loading: {
24804
24806
  invoke: {
24805
24807
  src: 'fetchInitData',
24806
24808
  onDone: {
24807
- target: 'checking',
24808
- actions: ['setInitData', 'preset'],
24809
+ target: 'loaded',
24810
+ actions: 'setInitData',
24809
24811
  },
24810
24812
  onError: {
24811
24813
  target: 'fail',
24812
24814
  },
24813
24815
  },
24814
24816
  },
24815
- checking: {
24816
- always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
24817
- },
24818
- newWalletMode: {
24819
- initial: 'loaded',
24817
+ loaded: {
24818
+ type: 'parallel',
24820
24819
  states: {
24821
- loaded: {
24822
- 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: {
24823
24851
  on: {
24824
24852
  SET_CHANNEL: {
24825
24853
  actions: 'setChannel',
@@ -24834,112 +24862,11 @@ function crypto_button (request) {
24834
24862
  actions: 'setAddress',
24835
24863
  },
24836
24864
  CONFIRM: {
24837
- target: 'selecting',
24865
+ target: '#crypro_button.selecting',
24838
24866
  cond: 'isConfirmable',
24839
24867
  },
24840
24868
  },
24841
24869
  },
24842
- selecting: {
24843
- entry: 'reset',
24844
- on: {
24845
- SELECT_AMOUNT: [
24846
- {
24847
- actions: 'addAmount',
24848
- cond: (context, event) => context.grandTotalEnable === 1,
24849
- },
24850
- {
24851
- actions: 'setAmount',
24852
- },
24853
- ],
24854
- KEY_IN: {
24855
- actions: 'setAmount',
24856
- },
24857
- SUBMIT: {
24858
- target: 'debouncing',
24859
- },
24860
- BACK: {
24861
- target: 'loaded',
24862
- },
24863
- CLEAR_ALL: {
24864
- actions: 'reset',
24865
- },
24866
- },
24867
- },
24868
- debouncing: {
24869
- on: {
24870
- SELECT_AMOUNT: [
24871
- {
24872
- target: 'debouncing',
24873
- actions: 'addAmount',
24874
- cond: (context, event) => context.grandTotalEnable === 1,
24875
- },
24876
- {
24877
- target: 'debouncing',
24878
- actions: 'setAmount',
24879
- },
24880
- ],
24881
- KEY_IN: {
24882
- target: 'debouncing',
24883
- actions: 'setAmount',
24884
- },
24885
- BACK: {
24886
- target: 'loaded',
24887
- },
24888
- CLEAR_ALL: {
24889
- actions: 'reset',
24890
- },
24891
- },
24892
- after: {
24893
- 1000: {
24894
- target: 'calculating',
24895
- },
24896
- },
24897
- },
24898
- calculating: {
24899
- invoke: {
24900
- src: 'fetchCalculation',
24901
- onDone: {
24902
- target: 'submitting',
24903
- actions: 'setCalculation',
24904
- },
24905
- onError: {
24906
- target: 'selecting',
24907
- actions: 'reset',
24908
- },
24909
- },
24910
- },
24911
- submitting: {
24912
- invoke: {
24913
- src: 'submitDeposit',
24914
- onDone: {
24915
- target: '#crypro_button.submitted',
24916
- actions: 'setResult',
24917
- },
24918
- onError: {
24919
- target: 'selecting',
24920
- },
24921
- },
24922
- },
24923
- },
24924
- },
24925
- defaultMode: {
24926
- on: {
24927
- SET_CHANNEL: {
24928
- actions: 'setChannel',
24929
- },
24930
- SET_CRYPTO: {
24931
- actions: 'setCrypto',
24932
- },
24933
- SET_NETWORK: {
24934
- actions: 'setNetwork',
24935
- },
24936
- SET_ADDRESS: {
24937
- actions: 'setAddress',
24938
- },
24939
- CONFIRM: {
24940
- target: 'selecting',
24941
- cond: 'isConfirmable',
24942
- },
24943
24870
  },
24944
24871
  },
24945
24872
  fail: {},
@@ -24947,22 +24874,47 @@ function crypto_button (request) {
24947
24874
  entry: 'reset',
24948
24875
  on: {
24949
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
+ },
24950
24890
  {
24951
24891
  target: 'debouncing',
24952
24892
  actions: 'addAmount',
24953
- cond: (context, event) => context.grandTotalEnable === 1,
24893
+ cond: 'isGrandTotalEnable',
24954
24894
  },
24955
24895
  {
24956
24896
  target: 'debouncing',
24957
24897
  actions: 'setAmount',
24958
24898
  },
24959
24899
  ],
24960
- KEY_IN: {
24900
+ KEY_IN: [
24901
+ {
24902
+ actions: 'setAmount',
24903
+ cond: 'isFreeWalletMode',
24904
+ },
24905
+ {
24906
+ target: 'debouncing',
24907
+ actions: 'setAmount',
24908
+ },
24909
+ ],
24910
+ SUBMIT: {
24961
24911
  target: 'debouncing',
24962
- actions: 'setAmount',
24963
24912
  },
24964
24913
  BACK: {
24965
- target: 'defaultMode',
24914
+ target: 'loaded',
24915
+ },
24916
+ CLEAR_ALL: {
24917
+ actions: 'reset',
24966
24918
  },
24967
24919
  },
24968
24920
  },
@@ -24972,7 +24924,7 @@ function crypto_button (request) {
24972
24924
  {
24973
24925
  target: 'debouncing',
24974
24926
  actions: 'addAmount',
24975
- cond: (context, event) => context.grandTotalEnable === 1,
24927
+ cond: 'isGrandTotalEnable',
24976
24928
  },
24977
24929
  {
24978
24930
  target: 'debouncing',
@@ -24991,12 +24943,19 @@ function crypto_button (request) {
24991
24943
  },
24992
24944
  },
24993
24945
  calculating: {
24994
- invoke: {
24995
- src: 'fetchCalculation',
24996
- onDone: {
24997
- target: 'calculated',
24998
- actions: 'setCalculation',
24999
- },
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
+ ],
25000
24959
  onError: {
25001
24960
  target: 'selecting',
25002
24961
  actions: 'reset',
@@ -25009,7 +24968,7 @@ function crypto_button (request) {
25009
24968
  {
25010
24969
  target: 'debouncing',
25011
24970
  actions: 'addAmount',
25012
- cond: (context, event) => context.grandTotalEnable === 1,
24971
+ cond: 'isGrandTotalEnable',
25013
24972
  },
25014
24973
  {
25015
24974
  target: 'debouncing',
@@ -25048,6 +25007,11 @@ function crypto_button (request) {
25048
25007
  },
25049
25008
  submitted: {},
25050
25009
  },
25010
+ on: {
25011
+ SET_PROMOTION: {
25012
+ actions: 'setPromotion',
25013
+ },
25014
+ },
25051
25015
  },
25052
25016
  {
25053
25017
  actions: {
@@ -25058,7 +25022,7 @@ function crypto_button (request) {
25058
25022
  }
25059
25023
  }),
25060
25024
  setInitData: assign((context, event) => {
25061
- const { paymentDetail } = event.data;
25025
+ const { siteConfig, paymentDetail } = event.data;
25062
25026
  const cryptos = paymentDetail?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
25063
25027
  const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
25064
25028
  const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
@@ -25072,6 +25036,7 @@ function crypto_button (request) {
25072
25036
  }) || [];
25073
25037
  const options = cryptos[0].optional;
25074
25038
  return {
25039
+ siteConfig,
25075
25040
  channels,
25076
25041
  cryptos,
25077
25042
  networks: defaultNetworks,
@@ -25083,12 +25048,6 @@ function crypto_button (request) {
25083
25048
  options,
25084
25049
  }
25085
25050
  }),
25086
- preset: assign((context, event) => {
25087
- const { siteConfig } = event.data;
25088
- return {
25089
- siteConfig,
25090
- }
25091
- }),
25092
25051
  setChannel: assign((context, event) => {
25093
25052
  const { cryptos } = context;
25094
25053
  const selectedCrypto = cryptos.find((crypto) => crypto.method === event.data.value);
@@ -25140,6 +25099,11 @@ function crypto_button (request) {
25140
25099
  setNetwork: assign((context, event) => {
25141
25100
  return { selectedNetwork: event.data }
25142
25101
  }),
25102
+ setBonusPreview: assign((context, event) => {
25103
+ return {
25104
+ bonusPreviewData: event.data.bonus,
25105
+ }
25106
+ }),
25143
25107
  addAmount: assign((context, event) => {
25144
25108
  return { selectedAmount: (context.selectedAmount || 0) + event.data }
25145
25109
  }),
@@ -25166,11 +25130,23 @@ function crypto_button (request) {
25166
25130
  result: event.data,
25167
25131
  }
25168
25132
  }),
25133
+ setPromotion: assign((context, event) => {
25134
+ const promotion = event.data;
25135
+ return {
25136
+ promotion,
25137
+ }
25138
+ }),
25169
25139
  },
25170
25140
  guards: {
25171
- isNewWalletMode: (context, event) => {
25141
+ isFreeWalletMode: (context, event) => {
25172
25142
  return context.siteConfig?.walletMode === '2'
25173
25143
  },
25144
+ isDoubleWalletMode: (context, event) => {
25145
+ return context.siteConfig?.walletMode === '4'
25146
+ },
25147
+ isGrandTotalEnable: (context, event) => {
25148
+ return context.grandTotalEnable === 1
25149
+ },
25174
25150
  isConfirmable: (context, event) => {
25175
25151
  const { selectedCrypto, selectedNetwork } = context;
25176
25152
  return selectedCrypto && selectedNetwork
@@ -25189,6 +25165,13 @@ function crypto_button (request) {
25189
25165
  const siteConfig = JSON.parse(window.atob(config));
25190
25166
  return { siteConfig, paymentDetail }
25191
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
+ },
25192
25175
  fetchCalculation: async (context, event) => {
25193
25176
  const { selectedCrypto, selectedAmount } = context;
25194
25177
  return await request.send(
@@ -25217,12 +25200,14 @@ function crypto_button (request) {
25217
25200
  }
25218
25201
 
25219
25202
  function direct (request) {
25203
+ const { appSecret } = request.config;
25220
25204
  return createMachine(
25221
25205
  {
25222
25206
  id: 'direct',
25223
25207
  initial: 'loading',
25224
25208
  context: {
25225
- paymentDetails: [],
25209
+ siteConfig: null,
25210
+ paymentDetail: [],
25226
25211
  directs: [],
25227
25212
  currentDirect: null,
25228
25213
  banks: [],
@@ -25268,6 +25253,10 @@ function direct (request) {
25268
25253
  },
25269
25254
  promotion: {
25270
25255
  always: [
25256
+ {
25257
+ target: 'loaded',
25258
+ cond: 'isDoubleWalletMode',
25259
+ },
25271
25260
  {
25272
25261
  target: 'calculating',
25273
25262
  actions: 'setPromotionDefaultAmount',
@@ -25294,15 +25283,61 @@ function direct (request) {
25294
25283
  actions: 'clearCalculation',
25295
25284
  },
25296
25285
  CALCULATE: {
25297
- target: 'calculating',
25298
- cond: 'isCalculable',
25286
+ target: 'debouncing',
25299
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: {
25300
25302
  SUBMIT: {
25301
25303
  target: 'submitting',
25302
25304
  cond: 'isSubmittable',
25303
25305
  },
25304
25306
  },
25305
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
+ },
25306
25341
  calculating: {
25307
25342
  invoke: {
25308
25343
  src: 'fetchCalculation',
@@ -25347,11 +25382,12 @@ function direct (request) {
25347
25382
  }
25348
25383
  }),
25349
25384
  setInitData: assign((context, event) => {
25350
- const paymentDetails = event.data;
25351
- 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);
25352
25387
 
25353
25388
  return {
25354
- paymentDetails,
25389
+ siteConfig,
25390
+ paymentDetail,
25355
25391
  directs,
25356
25392
  currentDirect: directs[0],
25357
25393
  currentMethod: directs[0]?.method,
@@ -25408,6 +25444,9 @@ function direct (request) {
25408
25444
  }),
25409
25445
  },
25410
25446
  guards: {
25447
+ isDoubleWalletMode: (context, event) => {
25448
+ return context.siteConfig?.walletMode === '4'
25449
+ },
25411
25450
  isCalculable: (context, event) => {
25412
25451
  const {
25413
25452
  amount,
@@ -25426,7 +25465,12 @@ function direct (request) {
25426
25465
  },
25427
25466
  services: {
25428
25467
  fetchInitData: async (context, event) => {
25429
- 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 }
25430
25474
  },
25431
25475
  fetchBanksList: async (context, event) => {
25432
25476
  const { currentDirect } = context;
@@ -25549,6 +25593,7 @@ function amb (request) {
25549
25593
  }
25550
25594
 
25551
25595
  function float (request) {
25596
+ const { appSecret } = request.config;
25552
25597
  return createMachine(
25553
25598
  {
25554
25599
  id: 'float',
@@ -25556,6 +25601,7 @@ function float (request) {
25556
25601
  context: {
25557
25602
  method: 'amb_float',
25558
25603
  userAccount: {},
25604
+ siteConfig: null,
25559
25605
  amount: 0,
25560
25606
 
25561
25607
  bankList: [],
@@ -25572,6 +25618,9 @@ function float (request) {
25572
25618
 
25573
25619
  grandTotalEnable: 1,
25574
25620
  ttl: 120,
25621
+
25622
+ promotion: null,
25623
+ bonusPreviewData: [],
25575
25624
  },
25576
25625
  states: {
25577
25626
  loading: {
@@ -25596,7 +25645,10 @@ function float (request) {
25596
25645
  initializing: {
25597
25646
  invoke: {
25598
25647
  src: 'initialize',
25599
- onDone: { target: '#float.loaded', actions: 'setInitialization' },
25648
+ onDone: {
25649
+ target: '#float.loaded',
25650
+ actions: 'setInitialization',
25651
+ },
25600
25652
  onError: {
25601
25653
  target: '#float.unavailable',
25602
25654
  },
@@ -25605,22 +25657,57 @@ function float (request) {
25605
25657
  },
25606
25658
  },
25607
25659
  loaded: {
25660
+ type: 'parallel',
25608
25661
  entry: 'reset',
25609
- on: {
25610
- SELECT_AMOUNT: [
25611
- {
25612
- target: 'debouncing',
25613
- actions: 'addAmount',
25614
- 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: {},
25615
25691
  },
25616
- {
25617
- target: 'debouncing',
25618
- 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
+ },
25619
25710
  },
25620
- ],
25621
- KEY_IN: {
25622
- target: 'calculating',
25623
- actions: 'setAmount',
25624
25711
  },
25625
25712
  },
25626
25713
  },
@@ -25744,6 +25831,11 @@ function float (request) {
25744
25831
  accountUnbound: {},
25745
25832
  unavailable: {},
25746
25833
  },
25834
+ on: {
25835
+ SET_PROMOTION: {
25836
+ actions: 'setPromotion',
25837
+ },
25838
+ },
25747
25839
  },
25748
25840
  {
25749
25841
  actions: {
@@ -25752,6 +25844,17 @@ function float (request) {
25752
25844
  userAccount: event.data.bankInfo?.[0],
25753
25845
  }
25754
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
+ }),
25755
25858
  setHouseBank: assign((context, event) => {
25756
25859
  const { accountName, accountNumber, bankName, amount } = event.data;
25757
25860
  return {
@@ -25762,9 +25865,10 @@ function float (request) {
25762
25865
  }
25763
25866
  }),
25764
25867
  setInitialization: assign((context, event) => {
25765
- const { housePayment, bankList } = event.data;
25868
+ const { siteConfig, housePayment, bankList } = event.data;
25766
25869
  const { optional, minimum, maximum, grandTotalEnable } = housePayment;
25767
25870
  return {
25871
+ siteConfig,
25768
25872
  options: optional,
25769
25873
  minimum,
25770
25874
  maximum,
@@ -25781,11 +25885,6 @@ function float (request) {
25781
25885
  setAmount: assign((context, event) => {
25782
25886
  return { amount: event.data }
25783
25887
  }),
25784
- clear: assign((context, event) => {
25785
- return {
25786
- amount: 0,
25787
- }
25788
- }),
25789
25888
  setCalculation: assign((context, event) => {
25790
25889
  return {
25791
25890
  calculation: event.data,
@@ -25813,25 +25912,38 @@ function float (request) {
25813
25912
  return await request.send(payment.getPaymentInfo())
25814
25913
  },
25815
25914
  initialize: async (context, event) => {
25816
- const [payments, bankList] = await Promise.all([
25915
+ const [{ config }, payments, bankList] = await Promise.all([
25916
+ request.send(common$1.getConfig({ appSecret })),
25817
25917
  request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
25818
25918
  request.send(payment.getBankList('amb')),
25819
25919
  ]);
25820
- 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
+ })
25821
25929
  },
25822
25930
  submitDeposit: async (context, event) => {
25931
+ const { method, amount, promotion } = context;
25823
25932
  return await request.send(
25824
25933
  payment.submitDepositTransaction({
25825
- method: context.method,
25826
- amount: context.amount,
25934
+ method,
25935
+ amount,
25936
+ promotionsNo: promotion?.activityNo,
25827
25937
  })
25828
25938
  )
25829
25939
  },
25830
25940
  fetchCalculation: async (context, event) => {
25941
+ const { method, amount, promotion } = context;
25831
25942
  return await request.send(
25832
25943
  payment.getDepositExpectedResult({
25833
- method: context.method,
25834
- amount: context.amount,
25944
+ method,
25945
+ amount,
25946
+ promotionsNo: promotion?.activityNo,
25835
25947
  })
25836
25948
  )
25837
25949
  },
@@ -25841,6 +25953,7 @@ function float (request) {
25841
25953
  }
25842
25954
 
25843
25955
  function vpay (request) {
25956
+ const { appSecret } = request.config;
25844
25957
  return createMachine(
25845
25958
  {
25846
25959
  id: 'vpay',
@@ -25848,6 +25961,7 @@ function vpay (request) {
25848
25961
  context: {
25849
25962
  method: 'vpay',
25850
25963
  userAccount: {},
25964
+ siteConfig: null,
25851
25965
  amount: 0,
25852
25966
 
25853
25967
  bankList: [],
@@ -25862,6 +25976,9 @@ function vpay (request) {
25862
25976
  calculatedAmount: 0,
25863
25977
 
25864
25978
  grandTotalEnable: 1,
25979
+
25980
+ promotion: null,
25981
+ bonusPreviewData: [],
25865
25982
  },
25866
25983
  states: {
25867
25984
  loading: {
@@ -25902,22 +26019,57 @@ function vpay (request) {
25902
26019
  },
25903
26020
  },
25904
26021
  loaded: {
26022
+ type: 'parallel',
25905
26023
  entry: 'reset',
25906
- on: {
25907
- SELECT_AMOUNT: [
25908
- {
25909
- target: 'debouncing',
25910
- actions: 'addAmount',
25911
- 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: {},
25912
26053
  },
25913
- {
25914
- target: 'debouncing',
25915
- 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
+ },
25916
26072
  },
25917
- ],
25918
- KEY_IN: {
25919
- target: 'calculating',
25920
- actions: 'setAmount',
25921
26073
  },
25922
26074
  },
25923
26075
  },
@@ -26028,6 +26180,11 @@ function vpay (request) {
26028
26180
  accountUnbound: {},
26029
26181
  unavailable: {},
26030
26182
  },
26183
+ on: {
26184
+ SET_PROMOTION: {
26185
+ actions: 'setPromotion',
26186
+ },
26187
+ },
26031
26188
  },
26032
26189
  {
26033
26190
  actions: {
@@ -26036,6 +26193,11 @@ function vpay (request) {
26036
26193
  userAccount: event.data.bankInfo?.[0],
26037
26194
  }
26038
26195
  }),
26196
+ setBonusPreview: assign((context, event) => {
26197
+ return {
26198
+ bonusPreviewData: event.data.bonus,
26199
+ }
26200
+ }),
26039
26201
  setOrder: assign((context, event) => {
26040
26202
  const { amount, qrcode, vpayId } = event.data;
26041
26203
  return {
@@ -26053,9 +26215,10 @@ function vpay (request) {
26053
26215
  }
26054
26216
  }),
26055
26217
  setInitialization: assign((context, event) => {
26056
- const { housePayment, bankList } = event.data;
26218
+ const { siteConfig, housePayment, bankList } = event.data;
26057
26219
  const { optional, minimum, maximum, grandTotalEnable } = housePayment;
26058
26220
  return {
26221
+ siteConfig,
26059
26222
  options: optional,
26060
26223
  minimum,
26061
26224
  maximum,
@@ -26063,6 +26226,12 @@ function vpay (request) {
26063
26226
  grandTotalEnable,
26064
26227
  }
26065
26228
  }),
26229
+ setPromotion: assign((context, event) => {
26230
+ const promotion = event.data;
26231
+ return {
26232
+ promotion,
26233
+ }
26234
+ }),
26066
26235
  addAmount: assign((context, event) => {
26067
26236
  const { amount, maximum } = context;
26068
26237
  return {
@@ -26072,11 +26241,6 @@ function vpay (request) {
26072
26241
  setAmount: assign((context, event) => {
26073
26242
  return { amount: event.data }
26074
26243
  }),
26075
- clear: assign((context, event) => {
26076
- return {
26077
- amount: 0,
26078
- }
26079
- }),
26080
26244
  setCalculation: assign((context, event) => {
26081
26245
  return {
26082
26246
  calculation: event.data,
@@ -26101,27 +26265,39 @@ function vpay (request) {
26101
26265
  return await request.send(payment.getPaymentInfo())
26102
26266
  },
26103
26267
  initialize: async (context, event) => {
26104
- const [payments, bankList, order] = await Promise.all([
26268
+ const [{ config }, payments, bankList, order] = await Promise.all([
26269
+ request.send(common$1.getConfig({ appSecret })),
26105
26270
  request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
26106
26271
  request.send(payment.getBankList('amb')),
26107
26272
  request.send(payment.checkTransaction(context.method)),
26108
26273
  ]);
26109
- 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
+ })
26110
26283
  },
26111
26284
  submitDeposit: async (context, event) => {
26112
- const { method, amount } = context;
26285
+ const { method, amount, promotion } = context;
26113
26286
  return await request.send(
26114
26287
  payment.submitDepositTransaction({
26115
26288
  method,
26116
26289
  amount,
26290
+ promotionsNo: promotion?.activityNo,
26117
26291
  })
26118
26292
  )
26119
26293
  },
26120
26294
  fetchCalculation: async (context, event) => {
26295
+ const { method, amount, promotion } = context;
26121
26296
  return await request.send(
26122
26297
  payment.getDepositExpectedResult({
26123
- method: context.method,
26124
- amount: context.amount,
26298
+ method,
26299
+ amount,
26300
+ promotionsNo: promotion?.activityNo,
26125
26301
  })
26126
26302
  )
26127
26303
  },