@jetthai/cuora 1.1.64 → 1.1.65-doubleWallet-1

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,6 +23131,10 @@ 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: {
@@ -23105,7 +23142,7 @@ function loadcard_vn (request) {
23105
23142
  src: 'fetchInitData',
23106
23143
  onDone: {
23107
23144
  target: 'checking',
23108
- actions: ['setInitData', 'preset'],
23145
+ actions: 'setInitData',
23109
23146
  },
23110
23147
  onError: {
23111
23148
  target: 'fail',
@@ -23113,133 +23150,72 @@ function loadcard_vn (request) {
23113
23150
  },
23114
23151
  },
23115
23152
  checking: {
23116
- always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
23117
- },
23118
- newWalletMode: {
23119
- initial: 'loaded',
23120
- 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
- },
23153
+ always: [
23154
+ {
23155
+ target: 'fetching',
23156
+ cond: (context, event) => {
23157
+ const { siteConfig = {}, promotion = {} } = context;
23158
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
23159
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23144
23160
  },
23145
23161
  },
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
- },
23162
+ { target: 'loaded' },
23163
+ ],
23164
+ },
23165
+ fetching: {
23166
+ invoke: {
23167
+ src: 'fetchBonusPreview',
23168
+ onDone: {
23169
+ target: 'loaded',
23170
+ actions: 'setBonusPreview',
23161
23171
  },
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
- },
23172
+ onError: {
23173
+ target: 'loaded',
23176
23174
  },
23177
- calculating: {
23178
- invoke: {
23179
- src: 'fetchCalculation',
23180
- onDone: {
23181
- target: 'submitting',
23182
- actions: 'setCalculation',
23183
- },
23184
- onError: {
23185
- target: 'calculable',
23175
+ },
23176
+ },
23177
+ fail: {},
23178
+ loaded: {
23179
+ entry: 'reset',
23180
+ on: {
23181
+ SELECT_CARD: [
23182
+ {
23183
+ target: 'fetching',
23184
+ actions: 'setCard',
23185
+ cond: (context, event) => {
23186
+ const { siteConfig = {}, promotion = {} } = context;
23187
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
23188
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23186
23189
  },
23187
23190
  },
23188
- },
23189
- cardInfo: {
23190
- 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
- SELECT_CARD: {
23202
- target: 'loaded',
23203
- actions: 'setCard',
23204
- },
23191
+ {
23192
+ actions: 'setCard',
23205
23193
  },
23206
- },
23207
- submitting: {
23208
- invoke: {
23209
- src: 'submitDeposit',
23210
- onDone: [
23211
- {
23212
- target: 'submitting',
23213
- cond: 'jumpLinkEnable',
23214
- },
23215
- {
23216
- target: 'cardInfo',
23217
- },
23218
- ],
23219
- onError: {
23220
- target: 'loaded',
23221
- },
23194
+ ],
23195
+ SELECT_AMOUNT: [
23196
+ {
23197
+ target: 'pending',
23198
+ actions: 'setAmount',
23199
+ cond: 'isFreeWalletMode',
23222
23200
  },
23223
- },
23224
- submitted: {
23225
- on: {
23226
- BACK: {
23227
- target: 'loaded',
23228
- },
23201
+ {
23202
+ target: 'debouncing',
23203
+ actions: 'setAmount',
23229
23204
  },
23230
- },
23205
+ ],
23231
23206
  },
23232
23207
  },
23233
- defaultMode: {
23234
- entry: 'reset',
23208
+ pending: {
23235
23209
  on: {
23236
- SELECT_CARD: {
23237
- actions: 'setCard',
23238
- },
23239
23210
  SELECT_AMOUNT: {
23240
- target: 'debouncing',
23241
23211
  actions: 'setAmount',
23242
23212
  },
23213
+ CONFIRM: {
23214
+ target: 'calculating',
23215
+ },
23216
+ BACK: {
23217
+ target: 'loaded',
23218
+ },
23243
23219
  },
23244
23220
  },
23245
23221
  debouncing: {
@@ -23249,7 +23225,7 @@ function loadcard_vn (request) {
23249
23225
  actions: 'setAmount',
23250
23226
  },
23251
23227
  BACK: {
23252
- target: 'defaultMode',
23228
+ target: 'loaded',
23253
23229
  },
23254
23230
  },
23255
23231
  after: {
@@ -23258,22 +23234,6 @@ function loadcard_vn (request) {
23258
23234
  },
23259
23235
  },
23260
23236
  },
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
23237
  calculating: {
23278
23238
  invoke: {
23279
23239
  src: 'fetchCalculation',
@@ -23286,6 +23246,18 @@ function loadcard_vn (request) {
23286
23246
  },
23287
23247
  },
23288
23248
  },
23249
+ calculable: {
23250
+ entry: 'clearCalculation',
23251
+ on: {
23252
+ SELECT_AMOUNT: {
23253
+ target: 'debouncing',
23254
+ actions: 'setAmount',
23255
+ },
23256
+ BACK: {
23257
+ target: 'loaded',
23258
+ },
23259
+ },
23260
+ },
23289
23261
  calculated: {
23290
23262
  on: {
23291
23263
  SELECT_AMOUNT: {
@@ -23302,7 +23274,7 @@ function loadcard_vn (request) {
23302
23274
  },
23303
23275
  ],
23304
23276
  BACK: {
23305
- target: 'defaultMode',
23277
+ target: 'loaded',
23306
23278
  },
23307
23279
  CLEAR_CALCULATION: {
23308
23280
  target: 'debouncing',
@@ -23322,10 +23294,21 @@ function loadcard_vn (request) {
23322
23294
  target: 'submitting',
23323
23295
  cond: 'isSubmittable',
23324
23296
  },
23325
- SELECT_CARD: {
23326
- target: 'defaultMode',
23327
- actions: 'setCard',
23328
- },
23297
+ SELECT_CARD: [
23298
+ {
23299
+ target: 'fetching',
23300
+ actions: 'setCard',
23301
+ cond: (context, event) => {
23302
+ const { siteConfig = {}, promotion = {} } = context;
23303
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
23304
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23305
+ },
23306
+ },
23307
+ {
23308
+ target: 'loaded',
23309
+ actions: 'setCard',
23310
+ },
23311
+ ],
23329
23312
  },
23330
23313
  },
23331
23314
  submitting: {
@@ -23336,18 +23319,23 @@ function loadcard_vn (request) {
23336
23319
  actions: 'setResult',
23337
23320
  },
23338
23321
  onError: {
23339
- target: 'defaultMode',
23322
+ target: 'loaded',
23340
23323
  },
23341
23324
  },
23342
23325
  },
23343
23326
  submitted: {
23344
23327
  on: {
23345
23328
  BACK: {
23346
- target: 'defaultMode',
23329
+ target: 'loaded',
23347
23330
  },
23348
23331
  },
23349
23332
  },
23350
23333
  },
23334
+ on: {
23335
+ SET_PROMOTION: {
23336
+ actions: 'setPromotion',
23337
+ },
23338
+ },
23351
23339
  },
23352
23340
  {
23353
23341
  actions: {
@@ -23360,9 +23348,10 @@ function loadcard_vn (request) {
23360
23348
  }
23361
23349
  }),
23362
23350
  setInitData: assign((context, event) => {
23363
- const { paymentDetail } = event.data;
23351
+ const { siteConfig, paymentDetail } = event.data;
23364
23352
  const cards = paymentDetail.filter((element) => element.category === context.currentCategory);
23365
23353
  return {
23354
+ siteConfig,
23366
23355
  paymentDetail,
23367
23356
  cards,
23368
23357
  selectedCard: cards[0],
@@ -23370,10 +23359,9 @@ function loadcard_vn (request) {
23370
23359
  options: cards[0].optional,
23371
23360
  }
23372
23361
  }),
23373
- preset: assign((context, event) => {
23374
- const { siteConfig } = event.data;
23362
+ setBonusPreview: assign((context, event) => {
23375
23363
  return {
23376
- siteConfig,
23364
+ bonusPreviewData: event.data.bonus,
23377
23365
  }
23378
23366
  }),
23379
23367
  setCard: assign((context, event) => {
@@ -23411,9 +23399,15 @@ function loadcard_vn (request) {
23411
23399
  result: event.data,
23412
23400
  }
23413
23401
  }),
23402
+ setPromotion: assign((context, event) => {
23403
+ const promotion = event.data;
23404
+ return {
23405
+ promotion,
23406
+ }
23407
+ }),
23414
23408
  },
23415
23409
  guards: {
23416
- isNewWalletMode: (context, event) => {
23410
+ isFreeWalletMode: (context, event) => {
23417
23411
  return context.siteConfig?.walletMode === '2'
23418
23412
  },
23419
23413
  isSubmittable: (context, event) => {
@@ -23434,17 +23428,25 @@ function loadcard_vn (request) {
23434
23428
  const siteConfig = JSON.parse(window.atob(config));
23435
23429
  return { siteConfig, paymentDetail }
23436
23430
  },
23431
+ fetchBonusPreview: async (context, event) => {
23432
+ const { currentMethod, promotion } = context;
23433
+ return await request.send({
23434
+ paymentMethod: currentMethod,
23435
+ promotionsNo: promotion?.activityNo,
23436
+ })
23437
+ },
23437
23438
  fetchCalculation: async (context, event) => {
23438
- const { currentMethod, selectedAmount } = context;
23439
+ const { currentMethod, selectedAmount, promotion } = context;
23439
23440
  return await request.send(
23440
23441
  payment.getDepositExpectedResult({
23441
23442
  method: currentMethod,
23442
23443
  amount: selectedAmount,
23444
+ promotionsNo: promotion?.activityNo,
23443
23445
  })
23444
23446
  )
23445
23447
  },
23446
23448
  submitDeposit: async (context, event) => {
23447
- const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber } = context;
23449
+ const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber, promotion } = context;
23448
23450
  return await request.send(
23449
23451
  payment.submitDepositTransactionLoadcard({
23450
23452
  method: currentMethod,
@@ -23452,6 +23454,7 @@ function loadcard_vn (request) {
23452
23454
  card_type: selectedCard.channel_id,
23453
23455
  card_code: cardNumber,
23454
23456
  card_seri: serialNumber,
23457
+ promotionsNo: promotion?.activityNo,
23455
23458
  })
23456
23459
  )
23457
23460
  },
@@ -23484,8 +23487,9 @@ function qrcode_v2 (request) {
23484
23487
 
23485
23488
  grandTotalEnable: 1,
23486
23489
 
23487
- // use for wallet mode 3
23490
+ // use for wallet mode 3 & 4
23488
23491
  promotion: null,
23492
+ bonusPreviewData: [],
23489
23493
  },
23490
23494
  states: {
23491
23495
  loading: {
@@ -23493,187 +23497,123 @@ function qrcode_v2 (request) {
23493
23497
  src: 'fetchInitData',
23494
23498
  onDone: {
23495
23499
  target: 'checking',
23496
- actions: ['setInitData', 'preset'],
23500
+ actions: 'setInitData',
23497
23501
  },
23498
23502
  onError: {
23499
23503
  target: 'fail',
23500
23504
  },
23501
23505
  },
23502
- },
23503
- checking: {
23504
- always: [
23505
- { target: 'newWalletMode', cond: 'isNewWalletMode' },
23506
- {
23507
- target: 'debouncing',
23508
- actions: 'setPromotionDefaultAmount',
23509
- cond: 'hasMinPromotionDeposit',
23510
- },
23511
- { target: 'defaultMode' },
23512
- ],
23513
- },
23514
- newWalletMode: {
23515
- initial: 'loaded',
23516
- states: {
23517
- loaded: {
23518
- entry: 'reset',
23519
- on: {
23520
- SELECT_QRCODE: {
23521
- actions: 'setQrcode',
23522
- },
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',
23532
- },
23533
- ],
23534
- KEY_IN: {
23535
- target: 'pending',
23536
- actions: 'setAmount',
23537
- },
23538
- },
23539
- },
23540
- pending: {
23541
- on: {
23542
- SELECT_AMOUNT: [
23543
- {
23544
- actions: 'addAmount',
23545
- cond: (context, event) => context.grandTotalEnable === 1,
23546
- },
23547
- {
23548
- actions: 'setAmount',
23549
- },
23550
- ],
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
- SELECT_AMOUNT: [
23565
- {
23566
- target: 'debouncing',
23567
- actions: 'addAmount',
23568
- cond: (context, event) => context.grandTotalEnable === 1,
23569
- },
23570
- {
23571
- target: 'debouncing',
23572
- actions: 'setAmount',
23573
- },
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
- {
23594
- target: 'debouncing',
23595
- actions: 'addAmount',
23596
- cond: (context, event) => context.grandTotalEnable === 1,
23597
- },
23598
- {
23599
- target: 'debouncing',
23600
- actions: 'setAmount',
23601
- },
23602
- ],
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
- },
23506
+ },
23507
+ checking: {
23508
+ always: [
23509
+ {
23510
+ target: 'fetching',
23511
+ cond: (context, event) => {
23512
+ const { siteConfig = {}, promotion = {} } = context;
23513
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
23514
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23625
23515
  },
23626
23516
  },
23627
- submitting: {
23628
- invoke: {
23629
- src: 'submitDeposit',
23630
- onDone: {
23631
- target: 'submitted',
23632
- actions: 'setResult',
23633
- },
23634
- onError: {
23635
- target: 'pending',
23636
- },
23517
+ {
23518
+ target: 'debouncing',
23519
+ actions: 'setPromotionDefaultAmount',
23520
+ cond: (context, event) => {
23521
+ const { siteConfig = {}, promotion = {} } = context;
23522
+ return siteConfig.walletMode === '3' && !!promotion?.minimumAmount
23637
23523
  },
23638
23524
  },
23639
- submitted: {
23640
- on: {
23641
- SELECT_QRCODE: {
23642
- target: 'loaded',
23643
- actions: 'setQrcode',
23644
- },
23645
- },
23525
+ { target: 'loaded' },
23526
+ ],
23527
+ },
23528
+ fetching: {
23529
+ invoke: {
23530
+ src: 'fetchBonusPreview',
23531
+ onDone: {
23532
+ target: 'loaded',
23533
+ actions: 'setBonusPreview',
23534
+ },
23535
+ onError: {
23536
+ target: 'loaded',
23646
23537
  },
23647
23538
  },
23648
23539
  },
23649
- defaultMode: {
23540
+ fail: {},
23541
+ loaded: {
23650
23542
  entry: 'reset',
23651
23543
  on: {
23652
23544
  SELECT_QRCODE: [
23545
+ {
23546
+ target: 'fetching',
23547
+ actions: 'setQrcode',
23548
+ cond: (context, event) => {
23549
+ const { siteConfig = {}, promotion = {} } = context;
23550
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
23551
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23552
+ },
23553
+ },
23653
23554
  {
23654
23555
  target: 'debouncing',
23655
23556
  actions: ['setQrcode', 'setPromotionDefaultAmount'],
23656
- cond: 'hasMinPromotionDeposit',
23557
+ cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
23657
23558
  },
23658
23559
  {
23659
23560
  actions: 'setQrcode',
23660
23561
  },
23661
23562
  ],
23662
23563
  SELECT_AMOUNT: [
23564
+ {
23565
+ target: 'pending',
23566
+ actions: 'addAmount',
23567
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23568
+ },
23569
+ {
23570
+ target: 'pending',
23571
+ actions: 'setAmount',
23572
+ cond: 'isFreeWalletMode',
23573
+ },
23663
23574
  {
23664
23575
  target: 'debouncing',
23665
23576
  actions: 'addAmount',
23666
- cond: (context, event) => context.grandTotalEnable === 1,
23577
+ cond: 'isGrandTotalEnable',
23667
23578
  },
23668
23579
  {
23669
23580
  target: 'debouncing',
23670
23581
  actions: 'setAmount',
23671
23582
  },
23672
23583
  ],
23584
+ KEY_IN: [
23585
+ {
23586
+ target: 'pending',
23587
+ actions: 'setAmount',
23588
+ cond: 'isFreeWalletMode',
23589
+ },
23590
+ {
23591
+ target: 'calculating',
23592
+ actions: 'setAmount',
23593
+ },
23594
+ ],
23595
+ },
23596
+ },
23597
+ pending: {
23598
+ on: {
23599
+ SELECT_AMOUNT: [
23600
+ {
23601
+ actions: 'addAmount',
23602
+ cond: 'isGrandTotalEnable',
23603
+ },
23604
+ {
23605
+ actions: 'setAmount',
23606
+ },
23607
+ ],
23673
23608
  KEY_IN: {
23674
- target: 'calculating',
23675
23609
  actions: 'setAmount',
23676
23610
  },
23611
+ CONFIRM: {
23612
+ target: 'calculating',
23613
+ },
23614
+ BACK: {
23615
+ target: 'loaded',
23616
+ },
23677
23617
  },
23678
23618
  },
23679
23619
  debouncing: {
@@ -23682,19 +23622,25 @@ function qrcode_v2 (request) {
23682
23622
  {
23683
23623
  target: 'debouncing',
23684
23624
  actions: 'addAmount',
23685
- cond: (context, event) => context.grandTotalEnable === 1,
23625
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23626
+ },
23627
+ {
23628
+ target: 'debouncing',
23629
+ actions: 'setAmount',
23630
+ cond: 'isFreeWalletMode',
23631
+ },
23632
+ {
23633
+ target: 'debouncing',
23634
+ actions: 'addAmount',
23635
+ cond: 'isGrandTotalEnable',
23686
23636
  },
23687
23637
  {
23688
23638
  target: 'debouncing',
23689
23639
  actions: 'setAmount',
23690
23640
  },
23691
23641
  ],
23692
- KEY_IN: {
23693
- target: 'debouncing',
23694
- actions: 'setAmount',
23695
- },
23696
23642
  BACK: {
23697
- target: 'defaultMode',
23643
+ target: 'loaded',
23698
23644
  },
23699
23645
  },
23700
23646
  after: {
@@ -23703,15 +23649,24 @@ function qrcode_v2 (request) {
23703
23649
  },
23704
23650
  },
23705
23651
  },
23706
- fail: {},
23707
23652
  calculable: {
23708
23653
  entry: 'clearCalculation',
23709
23654
  on: {
23710
23655
  SELECT_AMOUNT: [
23656
+ {
23657
+ target: 'pending',
23658
+ actions: 'addAmount',
23659
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23660
+ },
23661
+ {
23662
+ target: 'pending',
23663
+ actions: 'setAmount',
23664
+ cond: 'isFreeWalletMode',
23665
+ },
23711
23666
  {
23712
23667
  target: 'debouncing',
23713
23668
  actions: 'addAmount',
23714
- cond: (context, event) => context.grandTotalEnable === 1,
23669
+ cond: 'isGrandTotalEnable',
23715
23670
  },
23716
23671
  {
23717
23672
  target: 'debouncing',
@@ -23719,24 +23674,28 @@ function qrcode_v2 (request) {
23719
23674
  },
23720
23675
  ],
23721
23676
  KEY_IN: {
23722
- target: 'debouncing',
23677
+ target: 'calculating',
23723
23678
  actions: 'setAmount',
23724
23679
  },
23725
- CALCULATE: {
23726
- target: 'debouncing',
23727
- },
23728
23680
  BACK: {
23729
- target: 'defaultMode',
23681
+ target: 'loaded',
23730
23682
  },
23731
23683
  },
23732
23684
  },
23733
23685
  calculating: {
23734
23686
  invoke: {
23735
23687
  src: 'fetchCalculation',
23736
- onDone: {
23737
- target: 'calculated',
23738
- actions: 'setCalculation',
23739
- },
23688
+ onDone: [
23689
+ {
23690
+ target: 'submitting',
23691
+ actions: 'setCalculation',
23692
+ cond: 'isFreeWalletMode',
23693
+ },
23694
+ {
23695
+ target: 'calculated',
23696
+ actions: 'setCalculation',
23697
+ },
23698
+ ],
23740
23699
  onError: {
23741
23700
  target: 'calculable',
23742
23701
  },
@@ -23745,10 +23704,20 @@ function qrcode_v2 (request) {
23745
23704
  calculated: {
23746
23705
  on: {
23747
23706
  SELECT_AMOUNT: [
23707
+ {
23708
+ target: 'pending',
23709
+ actions: 'addAmount',
23710
+ cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
23711
+ },
23712
+ {
23713
+ target: 'pending',
23714
+ actions: 'setAmount',
23715
+ cond: 'isFreeWalletMode',
23716
+ },
23748
23717
  {
23749
23718
  target: 'debouncing',
23750
23719
  actions: 'addAmount',
23751
- cond: (context, event) => context.grandTotalEnable === 1,
23720
+ cond: 'isGrandTotalEnable',
23752
23721
  },
23753
23722
  {
23754
23723
  target: 'debouncing',
@@ -23756,14 +23725,14 @@ function qrcode_v2 (request) {
23756
23725
  },
23757
23726
  ],
23758
23727
  KEY_IN: {
23759
- target: 'debouncing',
23728
+ target: 'calculating',
23760
23729
  actions: 'setAmount',
23761
23730
  },
23762
23731
  CONFIRM: {
23763
23732
  target: 'submitting',
23764
23733
  },
23765
23734
  BACK: {
23766
- target: 'defaultMode',
23735
+ target: 'loaded',
23767
23736
  },
23768
23737
  CLEAR_CALCULATION: {
23769
23738
  target: 'debouncing',
@@ -23785,10 +23754,21 @@ function qrcode_v2 (request) {
23785
23754
  },
23786
23755
  submitted: {
23787
23756
  on: {
23788
- SELECT_QRCODE: {
23789
- target: 'defaultMode',
23790
- actions: 'setQrcode',
23791
- },
23757
+ SELECT_QRCODE: [
23758
+ {
23759
+ target: 'fetching',
23760
+ actions: 'setQrcode',
23761
+ cond: (context, event) => {
23762
+ const { siteConfig = {}, promotion = {} } = context;
23763
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
23764
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
23765
+ },
23766
+ },
23767
+ {
23768
+ target: 'loaded',
23769
+ actions: 'setQrcode',
23770
+ },
23771
+ ],
23792
23772
  },
23793
23773
  },
23794
23774
  },
@@ -23807,10 +23787,11 @@ function qrcode_v2 (request) {
23807
23787
  }
23808
23788
  }),
23809
23789
  setInitData: assign((context, event) => {
23810
- const { paymentDetail } = event.data;
23790
+ const { siteConfig, paymentDetail } = event.data;
23811
23791
  const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory);
23812
23792
 
23813
23793
  return {
23794
+ siteConfig,
23814
23795
  paymentDetail,
23815
23796
  qrcodes,
23816
23797
  selectedQrcode: qrcodes[0],
@@ -23819,10 +23800,9 @@ function qrcode_v2 (request) {
23819
23800
  grandTotalEnable: qrcodes[0].grandTotalEnable,
23820
23801
  }
23821
23802
  }),
23822
- preset: assign((context, event) => {
23823
- const { siteConfig } = event.data;
23803
+ setBonusPreview: assign((context, event) => {
23824
23804
  return {
23825
- siteConfig,
23805
+ bonusPreviewData: event.data.bonus,
23826
23806
  }
23827
23807
  }),
23828
23808
  setQrcode: assign((context, event) => {
@@ -23867,11 +23847,11 @@ function qrcode_v2 (request) {
23867
23847
  }),
23868
23848
  },
23869
23849
  guards: {
23870
- isNewWalletMode: (context, event) => {
23850
+ isFreeWalletMode: (context, event) => {
23871
23851
  return context.siteConfig?.walletMode === '2'
23872
23852
  },
23873
- hasMinPromotionDeposit: (context, event) => {
23874
- return context.promotion?.minimumAmount
23853
+ isGrandTotalEnable: (context, event) => {
23854
+ return context.grandTotalEnable === 1
23875
23855
  },
23876
23856
  },
23877
23857
  services: {
@@ -23883,6 +23863,13 @@ function qrcode_v2 (request) {
23883
23863
  const siteConfig = JSON.parse(window.atob(config));
23884
23864
  return { siteConfig, paymentDetail }
23885
23865
  },
23866
+ fetchBonusPreview: async (context, event) => {
23867
+ const { currentMethod, promotion } = context;
23868
+ return await request.send({
23869
+ paymentMethod: currentMethod,
23870
+ promotionsNo: promotion?.activityNo,
23871
+ })
23872
+ },
23886
23873
  fetchCalculation: async (context, event) => {
23887
23874
  const { currentMethod, selectedAmount, promotion } = context;
23888
23875
  return await request.send(
@@ -24512,14 +24499,14 @@ function padStart(string, length, chars) {
24512
24499
 
24513
24500
  var padStart_1 = padStart;
24514
24501
 
24515
- // const padStart = require('lodash/padStart')
24516
-
24517
24502
  function crypto (request) {
24503
+ const { appSecret } = request.config;
24518
24504
  return createMachine(
24519
24505
  {
24520
24506
  id: 'crypto',
24521
24507
  initial: 'loading',
24522
24508
  context: {
24509
+ siteConfig: null,
24523
24510
  paymentDetails: [],
24524
24511
 
24525
24512
  channels: [],
@@ -24536,14 +24523,17 @@ function crypto (request) {
24536
24523
 
24537
24524
  calculation: null,
24538
24525
  result: null,
24526
+
24527
+ // use for wallet mode 4
24528
+ promotion: null,
24539
24529
  },
24540
24530
  states: {
24541
24531
  loading: {
24542
24532
  invoke: {
24543
- src: 'fetchPayments',
24533
+ src: 'fetchInitData',
24544
24534
  onDone: {
24545
24535
  target: 'idle',
24546
- actions: 'setCryptos',
24536
+ actions: 'setInitData',
24547
24537
  },
24548
24538
  onError: {
24549
24539
  target: '#crypto.fail',
@@ -24560,13 +24550,6 @@ function crypto (request) {
24560
24550
  },
24561
24551
  },
24562
24552
  },
24563
- // calculable: {
24564
- // on: {
24565
- // CALCULATE: {
24566
- // target: 'calculating',
24567
- // },
24568
- // },
24569
- // },
24570
24553
  calculating: {
24571
24554
  invoke: {
24572
24555
  src: 'fetchCalculation',
@@ -24580,6 +24563,20 @@ function crypto (request) {
24580
24563
  },
24581
24564
  },
24582
24565
  calculated: {
24566
+ on: {
24567
+ SUBMIT: [
24568
+ {
24569
+ target: 'pending',
24570
+ cond: 'isDoubleWalletMode',
24571
+ },
24572
+ {
24573
+ target: 'submitting',
24574
+ cond: 'isSubmittable',
24575
+ },
24576
+ ],
24577
+ },
24578
+ },
24579
+ pending: {
24583
24580
  on: {
24584
24581
  SUBMIT: {
24585
24582
  target: 'submitting',
@@ -24622,10 +24619,6 @@ function crypto (request) {
24622
24619
  target: '.idle',
24623
24620
  actions: ['setAmount', 'clearCalculation'],
24624
24621
  },
24625
- // CLEAR_CALCULATION: {
24626
- // target: '.idle',
24627
- // actions: 'clearCalculation',
24628
- // },
24629
24622
  CALCULATE: {
24630
24623
  target: '.debouncing',
24631
24624
  actions: 'clearCalculation',
@@ -24634,8 +24627,9 @@ function crypto (request) {
24634
24627
  },
24635
24628
  {
24636
24629
  actions: {
24637
- setCryptos: assign((context, event) => {
24638
- const cryptos = event.data?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
24630
+ setInitData: assign((context, event) => {
24631
+ const { siteConfig, paymentDetail } = event.data;
24632
+ const cryptos = paymentDetail.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
24639
24633
  const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
24640
24634
  const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
24641
24635
  const defaultNetworks =
@@ -24647,6 +24641,7 @@ function crypto (request) {
24647
24641
  }
24648
24642
  }) || [];
24649
24643
  return {
24644
+ siteConfig,
24650
24645
  channels,
24651
24646
  cryptos,
24652
24647
  networks: defaultNetworks,
@@ -24731,6 +24726,9 @@ function crypto (request) {
24731
24726
  }),
24732
24727
  },
24733
24728
  guards: {
24729
+ isDoubleWalletMode: (context, event) => {
24730
+ return context.siteConfig?.walletMode === '4'
24731
+ },
24734
24732
  isCalculable: (context, event) => {
24735
24733
  const {
24736
24734
  selectedCrypto,
@@ -24746,8 +24744,13 @@ function crypto (request) {
24746
24744
  },
24747
24745
  },
24748
24746
  services: {
24749
- fetchPayments: async (context, event) => {
24750
- return await request.send(payment$1.getPaymentDetail({ transferType: 'DEPOSIT' }))
24747
+ fetchInitData: async (context, event) => {
24748
+ const [{ config }, paymentDetail = []] = await Promise.all([
24749
+ request.send(common$1.getConfig({ appSecret })),
24750
+ request.send(payment$1.getPaymentDetail({ transferType: 'DEPOSIT' })),
24751
+ ]);
24752
+ const siteConfig = JSON.parse(window.atob(config));
24753
+ return { siteConfig, paymentDetail }
24751
24754
  },
24752
24755
  fetchCalculation: async (context, event) => {
24753
24756
  const { selectedCrypto, amount } = context;
@@ -24803,14 +24806,18 @@ function crypto_button (request) {
24803
24806
  result: null,
24804
24807
 
24805
24808
  grandTotalEnable: 1,
24809
+
24810
+ // use for wallet mode 4
24811
+ promotion: null,
24812
+ bonusPreviewData: [],
24806
24813
  },
24807
24814
  states: {
24808
24815
  loading: {
24809
24816
  invoke: {
24810
24817
  src: 'fetchInitData',
24811
24818
  onDone: {
24812
- target: 'checking',
24813
- actions: ['setInitData', 'preset'],
24819
+ target: 'loaded',
24820
+ actions: 'setInitData',
24814
24821
  },
24815
24822
  onError: {
24816
24823
  target: 'fail',
@@ -24818,116 +24825,31 @@ function crypto_button (request) {
24818
24825
  },
24819
24826
  },
24820
24827
  checking: {
24821
- always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
24822
- },
24823
- newWalletMode: {
24824
- initial: 'loaded',
24825
- states: {
24826
- loaded: {
24827
- entry: 'reset',
24828
- on: {
24829
- SET_CHANNEL: {
24830
- actions: 'setChannel',
24831
- },
24832
- SET_CRYPTO: {
24833
- actions: 'setCrypto',
24834
- },
24835
- SET_NETWORK: {
24836
- actions: 'setNetwork',
24837
- },
24838
- SET_ADDRESS: {
24839
- actions: 'setAddress',
24840
- },
24841
- CONFIRM: {
24842
- target: 'selecting',
24843
- cond: 'isConfirmable',
24844
- },
24845
- },
24846
- },
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
- },
24828
+ always: [
24829
+ {
24830
+ target: 'fetching',
24831
+ cond: (context, event) => {
24832
+ const { siteConfig = {}, promotion = {} } = context;
24833
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
24834
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
24901
24835
  },
24902
24836
  },
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
- },
24837
+ { target: 'loaded' },
24838
+ ],
24839
+ },
24840
+ fetching: {
24841
+ invoke: {
24842
+ src: 'fetchBonusPreview',
24843
+ onDone: {
24844
+ target: 'loaded',
24845
+ actions: 'setBonusPreview',
24915
24846
  },
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
- },
24847
+ onError: {
24848
+ target: 'loaded',
24927
24849
  },
24928
24850
  },
24929
24851
  },
24930
- defaultMode: {
24852
+ loaded: {
24931
24853
  on: {
24932
24854
  SET_CHANNEL: {
24933
24855
  actions: 'setChannel',
@@ -24954,20 +24876,45 @@ function crypto_button (request) {
24954
24876
  SELECT_AMOUNT: [
24955
24877
  {
24956
24878
  target: 'debouncing',
24957
- actions: 'addAmount',
24958
- cond: (context, event) => context.grandTotalEnable === 1,
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
+ },
24890
+ {
24891
+ target: 'debouncing',
24892
+ actions: 'addAmount',
24893
+ cond: 'isGrandTotalEnable',
24894
+ },
24895
+ {
24896
+ target: 'debouncing',
24897
+ actions: 'setAmount',
24898
+ },
24899
+ ],
24900
+ KEY_IN: [
24901
+ {
24902
+ actions: 'setAmount',
24903
+ cond: 'isFreeWalletMode',
24959
24904
  },
24960
24905
  {
24961
24906
  target: 'debouncing',
24962
24907
  actions: 'setAmount',
24963
24908
  },
24964
24909
  ],
24965
- KEY_IN: {
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',
@@ -24998,10 +24945,17 @@ function crypto_button (request) {
24998
24945
  calculating: {
24999
24946
  invoke: {
25000
24947
  src: 'fetchCalculation',
25001
- onDone: {
25002
- target: 'calculated',
25003
- actions: 'setCalculation',
25004
- },
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,18 +25165,26 @@ 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
- const { selectedCrypto, selectedAmount } = context;
25176
+ const { selectedCrypto, selectedAmount, promotion } = context;
25199
25177
  return await request.send(
25200
25178
  payment.getDepositExpectedResult({
25201
25179
  method: selectedCrypto.method,
25202
25180
  amount: selectedAmount,
25203
25181
  cryptoCurrency: selectedCrypto.channel,
25182
+ promotionsNo: promotion?.activityNo,
25204
25183
  })
25205
25184
  )
25206
25185
  },
25207
25186
  submitDeposit: async (context, event) => {
25208
- const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context;
25187
+ const { selectedCrypto, selectedNetwork, calculation, sourceAddress, promotion } = context;
25209
25188
  return await request.send(
25210
25189
  payment.submitDepositTransactionCrypto({
25211
25190
  method: selectedCrypto.method,
@@ -25213,6 +25192,7 @@ function crypto_button (request) {
25213
25192
  cryptoCurrency: selectedCrypto.channel,
25214
25193
  cryptoNetwork: selectedNetwork.value,
25215
25194
  sourceAddress: sourceAddress,
25195
+ promotionsNo: promotion?.activityNo,
25216
25196
  })
25217
25197
  )
25218
25198
  },
@@ -25222,12 +25202,14 @@ function crypto_button (request) {
25222
25202
  }
25223
25203
 
25224
25204
  function direct (request) {
25205
+ const { appSecret } = request.config;
25225
25206
  return createMachine(
25226
25207
  {
25227
25208
  id: 'direct',
25228
25209
  initial: 'loading',
25229
25210
  context: {
25230
- paymentDetails: [],
25211
+ siteConfig: null,
25212
+ paymentDetail: [],
25231
25213
  directs: [],
25232
25214
  currentDirect: null,
25233
25215
  banks: [],
@@ -25273,6 +25255,10 @@ function direct (request) {
25273
25255
  },
25274
25256
  promotion: {
25275
25257
  always: [
25258
+ {
25259
+ target: 'loaded',
25260
+ cond: 'isDoubleWalletMode',
25261
+ },
25276
25262
  {
25277
25263
  target: 'calculating',
25278
25264
  actions: 'setPromotionDefaultAmount',
@@ -25299,15 +25285,61 @@ function direct (request) {
25299
25285
  actions: 'clearCalculation',
25300
25286
  },
25301
25287
  CALCULATE: {
25302
- target: 'calculating',
25303
- cond: 'isCalculable',
25288
+ target: 'debouncing',
25304
25289
  },
25290
+ SUBMIT: [
25291
+ {
25292
+ target: 'pending',
25293
+ cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
25294
+ },
25295
+ {
25296
+ target: 'submitting',
25297
+ cond: 'isSubmittable',
25298
+ },
25299
+ ],
25300
+ },
25301
+ },
25302
+ pending: {
25303
+ on: {
25305
25304
  SUBMIT: {
25306
25305
  target: 'submitting',
25307
25306
  cond: 'isSubmittable',
25308
25307
  },
25309
25308
  },
25310
25309
  },
25310
+ debouncing: {
25311
+ on: {
25312
+ SELECT_DIRECT: {
25313
+ actions: ['setDirect', 'reset'],
25314
+ target: 'loading.fetching',
25315
+ },
25316
+ SELECT_BANK: {
25317
+ actions: 'setSelectedBank',
25318
+ },
25319
+ SET_AMOUNT: {
25320
+ actions: ['setAmount', 'clearCalculation'],
25321
+ },
25322
+ CLEAR_CALCULATION: {
25323
+ actions: 'clearCalculation',
25324
+ },
25325
+ CALCULATE: {
25326
+ target: 'debouncing',
25327
+ },
25328
+ SUBMIT: [
25329
+ {
25330
+ target: 'pending',
25331
+ cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
25332
+ },
25333
+ {
25334
+ target: 'submitting',
25335
+ cond: 'isSubmittable',
25336
+ },
25337
+ ],
25338
+ },
25339
+ after: {
25340
+ 1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
25341
+ },
25342
+ },
25311
25343
  calculating: {
25312
25344
  invoke: {
25313
25345
  src: 'fetchCalculation',
@@ -25352,11 +25384,12 @@ function direct (request) {
25352
25384
  }
25353
25385
  }),
25354
25386
  setInitData: assign((context, event) => {
25355
- const paymentDetails = event.data;
25356
- const directs = paymentDetails.filter((element) => element.category === context.currentCategory);
25387
+ const { siteConfig, paymentDetail } = event.data;
25388
+ const directs = paymentDetail.filter((element) => element.category === context.currentCategory);
25357
25389
 
25358
25390
  return {
25359
- paymentDetails,
25391
+ siteConfig,
25392
+ paymentDetail,
25360
25393
  directs,
25361
25394
  currentDirect: directs[0],
25362
25395
  currentMethod: directs[0]?.method,
@@ -25413,6 +25446,9 @@ function direct (request) {
25413
25446
  }),
25414
25447
  },
25415
25448
  guards: {
25449
+ isDoubleWalletMode: (context, event) => {
25450
+ return context.siteConfig?.walletMode === '4'
25451
+ },
25416
25452
  isCalculable: (context, event) => {
25417
25453
  const {
25418
25454
  amount,
@@ -25431,7 +25467,12 @@ function direct (request) {
25431
25467
  },
25432
25468
  services: {
25433
25469
  fetchInitData: async (context, event) => {
25434
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
25470
+ const [{ config }, paymentDetail = []] = await Promise.all([
25471
+ request.send(common$1.getConfig({ appSecret })),
25472
+ request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
25473
+ ]);
25474
+ const siteConfig = JSON.parse(window.atob(config));
25475
+ return { siteConfig, paymentDetail }
25435
25476
  },
25436
25477
  fetchBanksList: async (context, event) => {
25437
25478
  const { currentDirect } = context;
@@ -25554,6 +25595,7 @@ function amb (request) {
25554
25595
  }
25555
25596
 
25556
25597
  function float (request) {
25598
+ const { appSecret } = request.config;
25557
25599
  return createMachine(
25558
25600
  {
25559
25601
  id: 'float',
@@ -25561,6 +25603,7 @@ function float (request) {
25561
25603
  context: {
25562
25604
  method: 'amb_float',
25563
25605
  userAccount: {},
25606
+ siteConfig: null,
25564
25607
  amount: 0,
25565
25608
 
25566
25609
  bankList: [],
@@ -25577,6 +25620,9 @@ function float (request) {
25577
25620
 
25578
25621
  grandTotalEnable: 1,
25579
25622
  ttl: 120,
25623
+
25624
+ promotion: null,
25625
+ bonusPreviewData: [],
25580
25626
  },
25581
25627
  states: {
25582
25628
  loading: {
@@ -25601,7 +25647,10 @@ function float (request) {
25601
25647
  initializing: {
25602
25648
  invoke: {
25603
25649
  src: 'initialize',
25604
- onDone: { target: '#float.loaded', actions: 'setInitialization' },
25650
+ onDone: {
25651
+ target: '#float.loaded',
25652
+ actions: 'setInitialization',
25653
+ },
25605
25654
  onError: {
25606
25655
  target: '#float.unavailable',
25607
25656
  },
@@ -25609,14 +25658,38 @@ function float (request) {
25609
25658
  },
25610
25659
  },
25611
25660
  },
25661
+ checking: {
25662
+ always: [
25663
+ {
25664
+ target: 'fetching',
25665
+ cond: (context, event) => {
25666
+ const { siteConfig = {}, promotion = {} } = context;
25667
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
25668
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
25669
+ },
25670
+ },
25671
+ { target: 'loaded' },
25672
+ ],
25673
+ },
25674
+ fetching: {
25675
+ invoke: {
25676
+ src: 'fetchBonusPreview',
25677
+ onDone: {
25678
+ target: 'loaded',
25679
+ actions: 'setBonusPreview',
25680
+ },
25681
+ onError: {
25682
+ target: 'loaded',
25683
+ },
25684
+ },
25685
+ },
25612
25686
  loaded: {
25613
- entry: 'reset',
25614
25687
  on: {
25615
25688
  SELECT_AMOUNT: [
25616
25689
  {
25617
25690
  target: 'debouncing',
25618
25691
  actions: 'addAmount',
25619
- cond: (context, event) => context.grandTotalEnable === 1,
25692
+ cond: 'isGrandTotalEnable',
25620
25693
  },
25621
25694
  {
25622
25695
  target: 'debouncing',
@@ -25627,6 +25700,10 @@ function float (request) {
25627
25700
  target: 'calculating',
25628
25701
  actions: 'setAmount',
25629
25702
  },
25703
+ CLEAR_CALCULATION: {
25704
+ target: 'debouncing',
25705
+ actions: 'clearCalculation',
25706
+ },
25630
25707
  },
25631
25708
  },
25632
25709
  debouncing: {
@@ -25635,7 +25712,7 @@ function float (request) {
25635
25712
  {
25636
25713
  target: 'debouncing',
25637
25714
  actions: 'addAmount',
25638
- cond: (context, event) => context.grandTotalEnable === 1,
25715
+ cond: 'isGrandTotalEnable',
25639
25716
  },
25640
25717
  {
25641
25718
  target: 'debouncing',
@@ -25646,9 +25723,6 @@ function float (request) {
25646
25723
  target: 'debouncing',
25647
25724
  actions: 'setAmount',
25648
25725
  },
25649
- BACK: {
25650
- target: 'loaded',
25651
- },
25652
25726
  },
25653
25727
  after: {
25654
25728
  1000: {
@@ -25663,7 +25737,7 @@ function float (request) {
25663
25737
  {
25664
25738
  target: 'debouncing',
25665
25739
  actions: 'addAmount',
25666
- cond: (context, event) => context.grandTotalEnable === 1,
25740
+ cond: 'isGrandTotalEnable',
25667
25741
  },
25668
25742
  {
25669
25743
  target: 'debouncing',
@@ -25674,11 +25748,12 @@ function float (request) {
25674
25748
  target: 'debouncing',
25675
25749
  actions: 'setAmount',
25676
25750
  },
25677
- CALCULATE: {
25751
+ CLEAR_CALCULATION: {
25678
25752
  target: 'debouncing',
25753
+ actions: 'clearCalculation',
25679
25754
  },
25680
- BACK: {
25681
- target: 'loaded',
25755
+ CLEAR: {
25756
+ actions: 'setAmount',
25682
25757
  },
25683
25758
  },
25684
25759
  },
@@ -25700,7 +25775,7 @@ function float (request) {
25700
25775
  {
25701
25776
  target: 'debouncing',
25702
25777
  actions: 'addAmount',
25703
- cond: (context, event) => context.grandTotalEnable === 1,
25778
+ cond: 'isGrandTotalEnable',
25704
25779
  },
25705
25780
  {
25706
25781
  target: 'debouncing',
@@ -25714,8 +25789,8 @@ function float (request) {
25714
25789
  CONFIRM: {
25715
25790
  target: 'submitting',
25716
25791
  },
25717
- BACK: {
25718
- target: 'loaded',
25792
+ CLEAR: {
25793
+ actions: 'setAmount',
25719
25794
  },
25720
25795
  CLEAR_CALCULATION: {
25721
25796
  target: 'debouncing',
@@ -25726,7 +25801,10 @@ function float (request) {
25726
25801
  submitting: {
25727
25802
  invoke: {
25728
25803
  src: 'submitDeposit',
25729
- onDone: { target: 'countdown', actions: 'setHouseBank' },
25804
+ onDone: {
25805
+ target: 'countdown',
25806
+ actions: 'setHouseBank',
25807
+ },
25730
25808
  onError: {
25731
25809
  target: 'calculated',
25732
25810
  },
@@ -25749,6 +25827,11 @@ function float (request) {
25749
25827
  accountUnbound: {},
25750
25828
  unavailable: {},
25751
25829
  },
25830
+ on: {
25831
+ SET_PROMOTION: {
25832
+ actions: 'setPromotion',
25833
+ },
25834
+ },
25752
25835
  },
25753
25836
  {
25754
25837
  actions: {
@@ -25757,6 +25840,17 @@ function float (request) {
25757
25840
  userAccount: event.data.bankInfo?.[0],
25758
25841
  }
25759
25842
  }),
25843
+ setPromotion: assign((context, event) => {
25844
+ const promotion = event.data;
25845
+ return {
25846
+ promotion,
25847
+ }
25848
+ }),
25849
+ setBonusPreview: assign((context, event) => {
25850
+ return {
25851
+ bonusPreviewData: event.data.bonus,
25852
+ }
25853
+ }),
25760
25854
  setHouseBank: assign((context, event) => {
25761
25855
  const { accountName, accountNumber, bankName, amount } = event.data;
25762
25856
  return {
@@ -25767,9 +25861,10 @@ function float (request) {
25767
25861
  }
25768
25862
  }),
25769
25863
  setInitialization: assign((context, event) => {
25770
- const { housePayment, bankList } = event.data;
25864
+ const { siteConfig, housePayment, bankList } = event.data;
25771
25865
  const { optional, minimum, maximum, grandTotalEnable } = housePayment;
25772
25866
  return {
25867
+ siteConfig,
25773
25868
  options: optional,
25774
25869
  minimum,
25775
25870
  maximum,
@@ -25784,11 +25879,8 @@ function float (request) {
25784
25879
  }
25785
25880
  }),
25786
25881
  setAmount: assign((context, event) => {
25787
- return { amount: event.data }
25788
- }),
25789
- clear: assign((context, event) => {
25790
25882
  return {
25791
- amount: 0,
25883
+ amount: event.data,
25792
25884
  }
25793
25885
  }),
25794
25886
  setCalculation: assign((context, event) => {
@@ -25812,31 +25904,47 @@ function float (request) {
25812
25904
  hasUserAccount: (context, event) => {
25813
25905
  return event.data.bankInfo?.[0]
25814
25906
  },
25907
+ isGrandTotalEnable: (context, event) => {
25908
+ return context.grandTotalEnable === 1
25909
+ },
25815
25910
  },
25816
25911
  services: {
25817
25912
  fetchPaymentInfo: async (context, event) => {
25818
25913
  return await request.send(payment.getPaymentInfo())
25819
25914
  },
25820
25915
  initialize: async (context, event) => {
25821
- const [payments, bankList] = await Promise.all([
25916
+ const [{ config }, payments, bankList] = await Promise.all([
25917
+ request.send(common$1.getConfig({ appSecret })),
25822
25918
  request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
25823
25919
  request.send(payment.getBankList('amb')),
25824
25920
  ]);
25825
- return { housePayment: payments.find((payment) => payment.method === context.method), bankList }
25921
+ const siteConfig = JSON.parse(window.atob(config));
25922
+ return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList }
25923
+ },
25924
+ fetchBonusPreview: async (context, event) => {
25925
+ const { method, promotion } = context;
25926
+ return await request.send({
25927
+ paymentMethod: method,
25928
+ promotionsNo: promotion?.activityNo,
25929
+ })
25826
25930
  },
25827
25931
  submitDeposit: async (context, event) => {
25932
+ const { method, amount, promotion } = context;
25828
25933
  return await request.send(
25829
25934
  payment.submitDepositTransaction({
25830
- method: context.method,
25831
- amount: context.amount,
25935
+ method,
25936
+ amount,
25937
+ promotionsNo: promotion?.activityNo,
25832
25938
  })
25833
25939
  )
25834
25940
  },
25835
25941
  fetchCalculation: async (context, event) => {
25942
+ const { method, amount, promotion } = context;
25836
25943
  return await request.send(
25837
25944
  payment.getDepositExpectedResult({
25838
- method: context.method,
25839
- amount: context.amount,
25945
+ method,
25946
+ amount,
25947
+ promotionsNo: promotion?.activityNo,
25840
25948
  })
25841
25949
  )
25842
25950
  },
@@ -25846,6 +25954,7 @@ function float (request) {
25846
25954
  }
25847
25955
 
25848
25956
  function vpay (request) {
25957
+ const { appSecret } = request.config;
25849
25958
  return createMachine(
25850
25959
  {
25851
25960
  id: 'vpay',
@@ -25853,6 +25962,7 @@ function vpay (request) {
25853
25962
  context: {
25854
25963
  method: 'vpay',
25855
25964
  userAccount: {},
25965
+ siteConfig: null,
25856
25966
  amount: 0,
25857
25967
 
25858
25968
  bankList: [],
@@ -25867,6 +25977,9 @@ function vpay (request) {
25867
25977
  calculatedAmount: 0,
25868
25978
 
25869
25979
  grandTotalEnable: 1,
25980
+
25981
+ promotion: null,
25982
+ bonusPreviewData: [],
25870
25983
  },
25871
25984
  states: {
25872
25985
  loading: {
@@ -25897,7 +26010,7 @@ function vpay (request) {
25897
26010
  actions: ['setInitialization', 'setPreviousOrder'],
25898
26011
  cond: 'hasPreviousOrder',
25899
26012
  },
25900
- { target: '#vpay.loaded', actions: 'setInitialization' },
26013
+ { target: '#vpay.checking', actions: 'setInitialization' },
25901
26014
  ],
25902
26015
  onError: {
25903
26016
  target: '#vpay.unavailable',
@@ -25906,6 +26019,31 @@ function vpay (request) {
25906
26019
  },
25907
26020
  },
25908
26021
  },
26022
+ checking: {
26023
+ always: [
26024
+ {
26025
+ target: 'fetching',
26026
+ cond: (context, event) => {
26027
+ const { siteConfig = {}, promotion = {} } = context;
26028
+ const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig;
26029
+ return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
26030
+ },
26031
+ },
26032
+ { target: 'loaded' },
26033
+ ],
26034
+ },
26035
+ fetching: {
26036
+ invoke: {
26037
+ src: 'fetchBonusPreview',
26038
+ onDone: {
26039
+ target: 'loaded',
26040
+ actions: 'setBonusPreview',
26041
+ },
26042
+ onError: {
26043
+ target: 'loaded',
26044
+ },
26045
+ },
26046
+ },
25909
26047
  loaded: {
25910
26048
  entry: 'reset',
25911
26049
  on: {
@@ -25913,7 +26051,7 @@ function vpay (request) {
25913
26051
  {
25914
26052
  target: 'debouncing',
25915
26053
  actions: 'addAmount',
25916
- cond: (context, event) => context.grandTotalEnable === 1,
26054
+ cond: 'isGrandTotalEnable',
25917
26055
  },
25918
26056
  {
25919
26057
  target: 'debouncing',
@@ -25924,6 +26062,10 @@ function vpay (request) {
25924
26062
  target: 'calculating',
25925
26063
  actions: 'setAmount',
25926
26064
  },
26065
+ CLEAR_CALCULATION: {
26066
+ target: 'debouncing',
26067
+ actions: 'clearCalculation',
26068
+ },
25927
26069
  },
25928
26070
  },
25929
26071
  debouncing: {
@@ -25932,7 +26074,7 @@ function vpay (request) {
25932
26074
  {
25933
26075
  target: 'debouncing',
25934
26076
  actions: 'addAmount',
25935
- cond: (context, event) => context.grandTotalEnable === 1,
26077
+ cond: 'isGrandTotalEnable',
25936
26078
  },
25937
26079
  {
25938
26080
  target: 'debouncing',
@@ -25943,9 +26085,6 @@ function vpay (request) {
25943
26085
  target: 'debouncing',
25944
26086
  actions: 'setAmount',
25945
26087
  },
25946
- BACK: {
25947
- target: 'loaded',
25948
- },
25949
26088
  },
25950
26089
  after: {
25951
26090
  1000: {
@@ -25960,7 +26099,7 @@ function vpay (request) {
25960
26099
  {
25961
26100
  target: 'debouncing',
25962
26101
  actions: 'addAmount',
25963
- cond: (context, event) => context.grandTotalEnable === 1,
26102
+ cond: 'isGrandTotalEnable',
25964
26103
  },
25965
26104
  {
25966
26105
  target: 'debouncing',
@@ -25971,11 +26110,12 @@ function vpay (request) {
25971
26110
  target: 'debouncing',
25972
26111
  actions: 'setAmount',
25973
26112
  },
25974
- CALCULATE: {
26113
+ CLEAR_CALCULATION: {
25975
26114
  target: 'debouncing',
26115
+ actions: 'clearCalculation',
25976
26116
  },
25977
- BACK: {
25978
- target: 'loaded',
26117
+ CLEAR: {
26118
+ actions: 'setAmount',
25979
26119
  },
25980
26120
  },
25981
26121
  },
@@ -25997,7 +26137,7 @@ function vpay (request) {
25997
26137
  {
25998
26138
  target: 'debouncing',
25999
26139
  actions: 'addAmount',
26000
- cond: (context, event) => context.grandTotalEnable === 1,
26140
+ cond: 'isGrandTotalEnable',
26001
26141
  },
26002
26142
  {
26003
26143
  target: 'debouncing',
@@ -26011,19 +26151,22 @@ function vpay (request) {
26011
26151
  CONFIRM: {
26012
26152
  target: 'submitting',
26013
26153
  },
26014
- BACK: {
26015
- target: 'loaded',
26016
- },
26017
26154
  CLEAR_CALCULATION: {
26018
26155
  target: 'debouncing',
26019
26156
  actions: 'clearCalculation',
26020
26157
  },
26158
+ CLEAR: {
26159
+ actions: 'setAmount',
26160
+ },
26021
26161
  },
26022
26162
  },
26023
26163
  submitting: {
26024
26164
  invoke: {
26025
26165
  src: 'submitDeposit',
26026
- onDone: { target: 'submitted', actions: 'setOrder' },
26166
+ onDone: {
26167
+ target: 'submitted',
26168
+ actions: 'setOrder',
26169
+ },
26027
26170
  onError: {
26028
26171
  target: 'calculated',
26029
26172
  },
@@ -26033,6 +26176,11 @@ function vpay (request) {
26033
26176
  accountUnbound: {},
26034
26177
  unavailable: {},
26035
26178
  },
26179
+ on: {
26180
+ SET_PROMOTION: {
26181
+ actions: 'setPromotion',
26182
+ },
26183
+ },
26036
26184
  },
26037
26185
  {
26038
26186
  actions: {
@@ -26041,6 +26189,11 @@ function vpay (request) {
26041
26189
  userAccount: event.data.bankInfo?.[0],
26042
26190
  }
26043
26191
  }),
26192
+ setBonusPreview: assign((context, event) => {
26193
+ return {
26194
+ bonusPreviewData: event.data.bonus,
26195
+ }
26196
+ }),
26044
26197
  setOrder: assign((context, event) => {
26045
26198
  const { amount, qrcode, vpayId } = event.data;
26046
26199
  return {
@@ -26058,9 +26211,10 @@ function vpay (request) {
26058
26211
  }
26059
26212
  }),
26060
26213
  setInitialization: assign((context, event) => {
26061
- const { housePayment, bankList } = event.data;
26214
+ const { siteConfig, housePayment, bankList } = event.data;
26062
26215
  const { optional, minimum, maximum, grandTotalEnable } = housePayment;
26063
26216
  return {
26217
+ siteConfig,
26064
26218
  options: optional,
26065
26219
  minimum,
26066
26220
  maximum,
@@ -26068,6 +26222,12 @@ function vpay (request) {
26068
26222
  grandTotalEnable,
26069
26223
  }
26070
26224
  }),
26225
+ setPromotion: assign((context, event) => {
26226
+ const promotion = event.data;
26227
+ return {
26228
+ promotion,
26229
+ }
26230
+ }),
26071
26231
  addAmount: assign((context, event) => {
26072
26232
  const { amount, maximum } = context;
26073
26233
  return {
@@ -26077,11 +26237,6 @@ function vpay (request) {
26077
26237
  setAmount: assign((context, event) => {
26078
26238
  return { amount: event.data }
26079
26239
  }),
26080
- clear: assign((context, event) => {
26081
- return {
26082
- amount: 0,
26083
- }
26084
- }),
26085
26240
  setCalculation: assign((context, event) => {
26086
26241
  return {
26087
26242
  calculation: event.data,
@@ -26100,33 +26255,48 @@ function vpay (request) {
26100
26255
  hasPreviousOrder: (context, event) => {
26101
26256
  return event.data.order?.qrcode
26102
26257
  },
26258
+ isGrandTotalEnable: (context, event) => {
26259
+ return context.grandTotalEnable === 1
26260
+ },
26103
26261
  },
26104
26262
  services: {
26105
26263
  fetchPaymentInfo: async (context, event) => {
26106
26264
  return await request.send(payment.getPaymentInfo())
26107
26265
  },
26108
26266
  initialize: async (context, event) => {
26109
- const [payments, bankList, order] = await Promise.all([
26267
+ const [{ config }, payments, bankList, order] = await Promise.all([
26268
+ request.send(common$1.getConfig({ appSecret })),
26110
26269
  request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
26111
26270
  request.send(payment.getBankList('amb')),
26112
26271
  request.send(payment.checkTransaction(context.method)),
26113
26272
  ]);
26114
- return { housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
26273
+ const siteConfig = JSON.parse(window.atob(config));
26274
+ return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
26275
+ },
26276
+ fetchBonusPreview: async (context, event) => {
26277
+ const { method, promotion } = context;
26278
+ return await request.send({
26279
+ paymentMethod: method,
26280
+ promotionsNo: promotion?.activityNo,
26281
+ })
26115
26282
  },
26116
26283
  submitDeposit: async (context, event) => {
26117
- const { method, amount } = context;
26284
+ const { method, amount, promotion } = context;
26118
26285
  return await request.send(
26119
26286
  payment.submitDepositTransaction({
26120
26287
  method,
26121
26288
  amount,
26289
+ promotionsNo: promotion?.activityNo,
26122
26290
  })
26123
26291
  )
26124
26292
  },
26125
26293
  fetchCalculation: async (context, event) => {
26294
+ const { method, amount, promotion } = context;
26126
26295
  return await request.send(
26127
26296
  payment.getDepositExpectedResult({
26128
- method: context.method,
26129
- amount: context.amount,
26297
+ method,
26298
+ amount,
26299
+ promotionsNo: promotion?.activityNo,
26130
26300
  })
26131
26301
  )
26132
26302
  },