@jetthai/cuora 1.1.15-1 → 1.1.16

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
@@ -3845,6 +3845,15 @@ var payment = {
3845
3845
  method: 'post',
3846
3846
  params: { transferType: 'WITHDRAW', amount },
3847
3847
  }),
3848
+ getPromotionsList: () => ({ url: `payment/v2/bankWallet/promotions`, method: 'get' }),
3849
+ applyPromotions: ({ promotionsNo, amount }) => ({
3850
+ url: `payment/v2/bankWallet/promotion/apply`,
3851
+ method: 'post',
3852
+ params: {
3853
+ promotionsNo,
3854
+ amount,
3855
+ },
3856
+ }),
3848
3857
  };
3849
3858
 
3850
3859
  var user = {
@@ -16274,11 +16283,13 @@ function manual_vn (request) {
16274
16283
  }
16275
16284
 
16276
16285
  function loadcard_vn (request) {
16286
+ const { appSecret } = request.config;
16277
16287
  return createMachine(
16278
16288
  {
16279
16289
  id: 'loadcard',
16280
16290
  initial: 'loading',
16281
16291
  context: {
16292
+ siteConfig: null,
16282
16293
  cards: [],
16283
16294
  options: [],
16284
16295
 
@@ -16289,26 +16300,137 @@ function loadcard_vn (request) {
16289
16300
 
16290
16301
  calculation: null,
16291
16302
 
16292
- paymentDetails: [],
16303
+ paymentDetail: [],
16293
16304
  currentCategory: 'loadcard',
16294
16305
  currentMethod: null,
16295
16306
  currentPayment: null,
16296
- result: null,
16297
16307
  },
16298
16308
  states: {
16299
16309
  loading: {
16300
16310
  invoke: {
16301
16311
  src: 'fetchInitData',
16302
16312
  onDone: {
16303
- target: 'loaded',
16304
- actions: 'setInitData',
16313
+ target: 'checking',
16314
+ actions: ['setInitData', 'preset'],
16305
16315
  },
16306
16316
  onError: {
16307
16317
  target: 'fail',
16308
16318
  },
16309
16319
  },
16310
16320
  },
16311
- loaded: {
16321
+ checking: {
16322
+ always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
16323
+ },
16324
+ promotionApplyMode: {
16325
+ initial: 'loaded',
16326
+ states: {
16327
+ loaded: {
16328
+ entry: 'reset',
16329
+ on: {
16330
+ SELECT_CARD: {
16331
+ actions: 'setCard',
16332
+ },
16333
+ SELECT_AMOUNT: {
16334
+ target: 'submittable',
16335
+ actions: 'setAmount',
16336
+ },
16337
+ },
16338
+ },
16339
+ submittable: {
16340
+ on: {
16341
+ SELECT_AMOUNT: {
16342
+ actions: 'setAmount',
16343
+ },
16344
+ CONFIRM: {
16345
+ target: 'debouncing',
16346
+ },
16347
+ BACK: {
16348
+ target: 'loaded',
16349
+ },
16350
+ },
16351
+ },
16352
+ debouncing: {
16353
+ on: {
16354
+ SELECT_AMOUNT: {
16355
+ target: 'debouncing',
16356
+ actions: 'setAmount',
16357
+ },
16358
+ BACK: {
16359
+ target: 'loaded',
16360
+ },
16361
+ },
16362
+ after: {
16363
+ 1000: {
16364
+ target: 'calculating',
16365
+ },
16366
+ },
16367
+ },
16368
+ calculable: {
16369
+ entry: 'clearCalculation',
16370
+ on: {
16371
+ SELECT_AMOUNT: {
16372
+ target: 'debouncing',
16373
+ actions: 'setAmount',
16374
+ },
16375
+ CALCULATE: {
16376
+ target: 'debouncing',
16377
+ },
16378
+ BACK: {
16379
+ target: 'loaded',
16380
+ },
16381
+ },
16382
+ },
16383
+ calculating: {
16384
+ invoke: {
16385
+ src: 'fetchCalculation',
16386
+ onDone: {
16387
+ target: 'cardInfo',
16388
+ actions: 'setCalculation',
16389
+ },
16390
+ onError: {
16391
+ target: 'calculable',
16392
+ },
16393
+ },
16394
+ },
16395
+ cardInfo: {
16396
+ on: {
16397
+ INPUT_CARD_NUMBER: {
16398
+ actions: 'setCardNumber',
16399
+ },
16400
+ INPUT_SERIAL_NUMBER: {
16401
+ actions: 'setSerialNumber',
16402
+ },
16403
+ SUBMIT: {
16404
+ target: 'submitting',
16405
+ cond: 'isSubmittable',
16406
+ },
16407
+ SELECT_CARD: {
16408
+ target: 'loaded',
16409
+ actions: 'setCard',
16410
+ },
16411
+ },
16412
+ },
16413
+ submitting: {
16414
+ invoke: {
16415
+ src: 'submitDeposit',
16416
+ onDone: {
16417
+ target: 'submitted',
16418
+ },
16419
+ onError: {
16420
+ target: 'cardInfo',
16421
+ },
16422
+ },
16423
+ },
16424
+ submitted: {
16425
+ on: {
16426
+ BACK: {
16427
+ target: 'loaded',
16428
+ },
16429
+ },
16430
+ },
16431
+ },
16432
+ },
16433
+ defaultMode: {
16312
16434
  entry: 'reset',
16313
16435
  on: {
16314
16436
  SELECT_CARD: {
@@ -16327,7 +16449,7 @@ function loadcard_vn (request) {
16327
16449
  actions: 'setAmount',
16328
16450
  },
16329
16451
  BACK: {
16330
- target: 'loaded',
16452
+ target: 'defaultMode',
16331
16453
  },
16332
16454
  },
16333
16455
  after: {
@@ -16348,7 +16470,7 @@ function loadcard_vn (request) {
16348
16470
  target: 'debouncing',
16349
16471
  },
16350
16472
  BACK: {
16351
- target: 'loaded',
16473
+ target: 'defaultMode',
16352
16474
  },
16353
16475
  },
16354
16476
  },
@@ -16370,17 +16492,11 @@ function loadcard_vn (request) {
16370
16492
  target: 'debouncing',
16371
16493
  actions: 'setAmount',
16372
16494
  },
16373
- CONFIRM: [
16374
- {
16375
- target: 'submitting',
16376
- cond: 'jumpLinkEnable',
16377
- },
16378
- {
16379
- target: 'cardInfo',
16380
- },
16381
- ],
16495
+ CONFIRM: {
16496
+ target: 'cardInfo',
16497
+ },
16382
16498
  BACK: {
16383
- target: 'loaded',
16499
+ target: 'defaultMode',
16384
16500
  },
16385
16501
  CLEAR_CALCULATION: {
16386
16502
  target: 'debouncing',
@@ -16401,7 +16517,7 @@ function loadcard_vn (request) {
16401
16517
  cond: 'isSubmittable',
16402
16518
  },
16403
16519
  SELECT_CARD: {
16404
- target: 'loaded',
16520
+ target: 'defaultMode',
16405
16521
  actions: 'setCard',
16406
16522
  },
16407
16523
  },
@@ -16411,7 +16527,6 @@ function loadcard_vn (request) {
16411
16527
  src: 'submitDeposit',
16412
16528
  onDone: {
16413
16529
  target: 'submitted',
16414
- actions: 'setResult',
16415
16530
  },
16416
16531
  onError: {
16417
16532
  target: 'cardInfo',
@@ -16421,7 +16536,7 @@ function loadcard_vn (request) {
16421
16536
  submitted: {
16422
16537
  on: {
16423
16538
  BACK: {
16424
- target: 'loaded',
16539
+ target: 'defaultMode',
16425
16540
  },
16426
16541
  },
16427
16542
  },
@@ -16438,16 +16553,22 @@ function loadcard_vn (request) {
16438
16553
  }
16439
16554
  }),
16440
16555
  setInitData: assign((context, event) => {
16441
- const paymentDetails = event.data;
16442
- const cards = paymentDetails.filter((element) => element.category === context.currentCategory);
16556
+ const { paymentDetail } = event.data;
16557
+ const cards = paymentDetail.filter((element) => element.category === context.currentCategory);
16443
16558
  return {
16444
- paymentDetails,
16559
+ paymentDetail,
16445
16560
  cards,
16446
16561
  selectedCard: cards[0],
16447
16562
  currentMethod: cards[0].method,
16448
16563
  options: cards[0].optional,
16449
16564
  }
16450
16565
  }),
16566
+ preset: assign((context, event) => {
16567
+ const { siteConfig } = event.data;
16568
+ return {
16569
+ siteConfig,
16570
+ }
16571
+ }),
16451
16572
  setCard: assign((context, event) => {
16452
16573
  return {
16453
16574
  selectedCard: event.data,
@@ -16478,25 +16599,24 @@ function loadcard_vn (request) {
16478
16599
  calculation: null,
16479
16600
  }
16480
16601
  }),
16481
- setResult: assign((context, event) => {
16482
- return {
16483
- result: event.data,
16484
- }
16485
- }),
16486
16602
  },
16487
16603
  guards: {
16604
+ isPromotionApplyMode: (context, event) => {
16605
+ return context.siteConfig?.promotionApplyMode === '1'
16606
+ },
16488
16607
  isSubmittable: (context, event) => {
16489
16608
  const { cardNumber, serialNumber } = context;
16490
16609
  return cardNumber && serialNumber
16491
16610
  },
16492
- jumpLinkEnable: (context, event) => {
16493
- const { selectedCard } = context;
16494
- return selectedCard.jumpLinkEnable === 1
16495
- },
16496
16611
  },
16497
16612
  services: {
16498
16613
  fetchInitData: async (context, event) => {
16499
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
16614
+ const [{ config }, paymentDetail = []] = await Promise.all([
16615
+ request.send(common$1.getConfig({ appSecret })),
16616
+ request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
16617
+ ]);
16618
+ const siteConfig = JSON.parse(window.atob(config));
16619
+ return { siteConfig, paymentDetail }
16500
16620
  },
16501
16621
  fetchCalculation: async (context, event) => {
16502
16622
  const { currentMethod, selectedAmount } = context;
@@ -16729,11 +16849,13 @@ function qrcode_vn (request) {
16729
16849
  }
16730
16850
 
16731
16851
  function qrcode_v2 (request) {
16852
+ const { appSecret } = request.config;
16732
16853
  return createMachine(
16733
16854
  {
16734
16855
  id: 'qrcode',
16735
16856
  initial: 'loading',
16736
16857
  context: {
16858
+ siteConfig: null,
16737
16859
  qrcodes: null,
16738
16860
  options: null,
16739
16861
 
@@ -16742,7 +16864,7 @@ function qrcode_v2 (request) {
16742
16864
 
16743
16865
  calculation: null,
16744
16866
 
16745
- paymentDetails: [],
16867
+ paymentDetail: [],
16746
16868
  currentCategory: 'qrcode',
16747
16869
  currentMethod: null,
16748
16870
 
@@ -16755,15 +16877,152 @@ function qrcode_v2 (request) {
16755
16877
  invoke: {
16756
16878
  src: 'fetchInitData',
16757
16879
  onDone: {
16758
- target: 'loaded',
16759
- actions: 'setInitData',
16880
+ target: 'checking',
16881
+ actions: ['setInitData', 'preset'],
16760
16882
  },
16761
16883
  onError: {
16762
16884
  target: 'fail',
16763
16885
  },
16764
16886
  },
16765
16887
  },
16766
- loaded: {
16888
+ checking: {
16889
+ always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
16890
+ },
16891
+ promotionApplyMode: {
16892
+ initial: 'loaded',
16893
+ states: {
16894
+ loaded: {
16895
+ entry: 'reset',
16896
+ on: {
16897
+ SELECT_QRCODE: {
16898
+ actions: 'setQrcode',
16899
+ },
16900
+ SELECT_AMOUNT: [
16901
+ {
16902
+ target: 'submittable',
16903
+ actions: 'addAmount',
16904
+ cond: (context, event) => context.grandTotalEnable === 1,
16905
+ },
16906
+ {
16907
+ target: 'submittable',
16908
+ actions: 'setAmount',
16909
+ },
16910
+ ],
16911
+ KEY_IN: {
16912
+ actions: 'setAmount',
16913
+ },
16914
+ },
16915
+ },
16916
+ submittable: {
16917
+ on: {
16918
+ SELECT_AMOUNT: [
16919
+ {
16920
+ actions: 'addAmount',
16921
+ cond: (context, event) => context.grandTotalEnable === 1,
16922
+ },
16923
+ {
16924
+ actions: 'setAmount',
16925
+ },
16926
+ ],
16927
+ KEY_IN: {
16928
+ actions: 'setAmount',
16929
+ },
16930
+ CONFIRM: {
16931
+ target: 'debouncing',
16932
+ },
16933
+ BACK: {
16934
+ target: 'loaded',
16935
+ },
16936
+ },
16937
+ },
16938
+ debouncing: {
16939
+ on: {
16940
+ SELECT_AMOUNT: [
16941
+ {
16942
+ target: 'debouncing',
16943
+ actions: 'addAmount',
16944
+ cond: (context, event) => context.grandTotalEnable === 1,
16945
+ },
16946
+ {
16947
+ target: 'debouncing',
16948
+ actions: 'setAmount',
16949
+ },
16950
+ ],
16951
+ KEY_IN: {
16952
+ target: 'debouncing',
16953
+ actions: 'setAmount',
16954
+ },
16955
+ BACK: {
16956
+ target: 'loaded',
16957
+ },
16958
+ },
16959
+ after: {
16960
+ 1000: {
16961
+ target: 'calculating',
16962
+ },
16963
+ },
16964
+ },
16965
+ calculable: {
16966
+ entry: 'clearCalculation',
16967
+ on: {
16968
+ SELECT_AMOUNT: [
16969
+ {
16970
+ target: 'debouncing',
16971
+ actions: 'addAmount',
16972
+ cond: (context, event) => context.grandTotalEnable === 1,
16973
+ },
16974
+ {
16975
+ target: 'debouncing',
16976
+ actions: 'setAmount',
16977
+ },
16978
+ ],
16979
+ KEY_IN: {
16980
+ target: 'debouncing',
16981
+ actions: 'setAmount',
16982
+ },
16983
+ CALCULATE: {
16984
+ target: 'debouncing',
16985
+ },
16986
+ BACK: {
16987
+ target: 'loaded',
16988
+ },
16989
+ },
16990
+ },
16991
+ calculating: {
16992
+ invoke: {
16993
+ src: 'fetchCalculation',
16994
+ onDone: {
16995
+ target: 'submitting',
16996
+ actions: 'setCalculation',
16997
+ },
16998
+ onError: {
16999
+ target: 'calculable',
17000
+ },
17001
+ },
17002
+ },
17003
+ submitting: {
17004
+ invoke: {
17005
+ src: 'submitDeposit',
17006
+ onDone: {
17007
+ target: 'submitted',
17008
+ actions: 'setResult',
17009
+ },
17010
+ onError: {
17011
+ target: 'submittable',
17012
+ },
17013
+ },
17014
+ },
17015
+ submitted: {
17016
+ on: {
17017
+ SELECT_QRCODE: {
17018
+ target: 'loaded',
17019
+ actions: 'setQrcode',
17020
+ },
17021
+ },
17022
+ },
17023
+ },
17024
+ },
17025
+ defaultMode: {
16767
17026
  entry: 'reset',
16768
17027
  on: {
16769
17028
  SELECT_QRCODE: {
@@ -16804,7 +17063,7 @@ function qrcode_v2 (request) {
16804
17063
  actions: 'setAmount',
16805
17064
  },
16806
17065
  BACK: {
16807
- target: 'loaded',
17066
+ target: 'defaultMode',
16808
17067
  },
16809
17068
  },
16810
17069
  after: {
@@ -16836,7 +17095,7 @@ function qrcode_v2 (request) {
16836
17095
  target: 'debouncing',
16837
17096
  },
16838
17097
  BACK: {
16839
- target: 'loaded',
17098
+ target: 'defaultMode',
16840
17099
  },
16841
17100
  },
16842
17101
  },
@@ -16873,7 +17132,7 @@ function qrcode_v2 (request) {
16873
17132
  target: 'submitting',
16874
17133
  },
16875
17134
  BACK: {
16876
- target: 'loaded',
17135
+ target: 'defaultMode',
16877
17136
  },
16878
17137
  CLEAR_CALCULATION: {
16879
17138
  target: 'debouncing',
@@ -16896,7 +17155,7 @@ function qrcode_v2 (request) {
16896
17155
  submitted: {
16897
17156
  on: {
16898
17157
  SELECT_QRCODE: {
16899
- target: 'loaded',
17158
+ target: 'defaultMode',
16900
17159
  actions: 'setQrcode',
16901
17160
  },
16902
17161
  },
@@ -16912,11 +17171,11 @@ function qrcode_v2 (request) {
16912
17171
  }
16913
17172
  }),
16914
17173
  setInitData: assign((context, event) => {
16915
- const paymentDetails = event.data;
16916
- const qrcodes = paymentDetails.filter((element) => element.category === context.currentCategory);
17174
+ const { paymentDetail } = event.data;
17175
+ const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory);
16917
17176
 
16918
17177
  return {
16919
- paymentDetails,
17178
+ paymentDetail,
16920
17179
  qrcodes,
16921
17180
  selectedQrcode: qrcodes[0],
16922
17181
  currentMethod: qrcodes[0].method,
@@ -16924,6 +17183,12 @@ function qrcode_v2 (request) {
16924
17183
  grandTotalEnable: qrcodes[0].grandTotalEnable,
16925
17184
  }
16926
17185
  }),
17186
+ preset: assign((context, event) => {
17187
+ const { siteConfig } = event.data;
17188
+ return {
17189
+ siteConfig,
17190
+ }
17191
+ }),
16927
17192
  setQrcode: assign((context, event) => {
16928
17193
  return {
16929
17194
  selectedQrcode: event.data,
@@ -16954,9 +17219,19 @@ function qrcode_v2 (request) {
16954
17219
  }
16955
17220
  }),
16956
17221
  },
17222
+ guards: {
17223
+ isPromotionApplyMode: (context, event) => {
17224
+ return context.siteConfig?.promotionApplyMode === '1'
17225
+ },
17226
+ },
16957
17227
  services: {
16958
17228
  fetchInitData: async (context, event) => {
16959
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
17229
+ const [{ config }, paymentDetail = []] = await Promise.all([
17230
+ request.send(common$1.getConfig({ appSecret })),
17231
+ request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
17232
+ ]);
17233
+ const siteConfig = JSON.parse(window.atob(config));
17234
+ return { siteConfig, paymentDetail }
16960
17235
  },
16961
17236
  fetchCalculation: async (context, event) => {
16962
17237
  const { currentMethod, selectedAmount } = context;
@@ -17850,11 +18125,13 @@ function crypto (request) {
17850
18125
  }
17851
18126
 
17852
18127
  function crypto_button (request) {
18128
+ const { appSecret } = request.config;
17853
18129
  return createMachine(
17854
18130
  {
17855
18131
  id: 'crypro_button',
17856
18132
  initial: 'loading',
17857
18133
  context: {
18134
+ siteConfig: null,
17858
18135
  paymentDetails: [],
17859
18136
 
17860
18137
  channels: [],
@@ -17878,17 +18155,127 @@ function crypto_button (request) {
17878
18155
  states: {
17879
18156
  loading: {
17880
18157
  invoke: {
17881
- src: 'fetchPayments',
18158
+ src: 'fetchInitData',
17882
18159
  onDone: {
17883
- target: 'loaded',
17884
- actions: 'setCryptos',
18160
+ target: 'checking',
18161
+ actions: ['setInitData', 'preset'],
17885
18162
  },
17886
18163
  onError: {
17887
18164
  target: 'fail',
17888
18165
  },
17889
18166
  },
17890
18167
  },
17891
- loaded: {
18168
+ checking: {
18169
+ always: [{ target: 'promotionApplyMode', cond: 'isPromotionApplyMode' }, { target: 'defaultMode' }],
18170
+ },
18171
+ promotionApplyMode: {
18172
+ initial: 'loaded',
18173
+ states: {
18174
+ loaded: {
18175
+ entry: 'reset',
18176
+ on: {
18177
+ SET_CHANNEL: {
18178
+ actions: 'setChannel',
18179
+ },
18180
+ SET_CRYPTO: {
18181
+ actions: 'setCrypto',
18182
+ },
18183
+ SET_NETWORK: {
18184
+ actions: 'setNetwork',
18185
+ },
18186
+ SET_ADDRESS: {
18187
+ actions: 'setAddress',
18188
+ },
18189
+ CONFIRM: {
18190
+ target: 'selecting',
18191
+ cond: 'isConfirmable',
18192
+ },
18193
+ },
18194
+ },
18195
+ selecting: {
18196
+ entry: 'reset',
18197
+ on: {
18198
+ SELECT_AMOUNT: [
18199
+ {
18200
+ actions: 'addAmount',
18201
+ cond: (context, event) => context.grandTotalEnable === 1,
18202
+ },
18203
+ {
18204
+ actions: 'setAmount',
18205
+ },
18206
+ ],
18207
+ KEY_IN: {
18208
+ actions: 'setAmount',
18209
+ },
18210
+ SUBMIT: {
18211
+ target: 'debouncing',
18212
+ },
18213
+ BACK: {
18214
+ target: 'loaded',
18215
+ },
18216
+ CLEAR_ALL: {
18217
+ actions: 'reset',
18218
+ },
18219
+ },
18220
+ },
18221
+ debouncing: {
18222
+ on: {
18223
+ SELECT_AMOUNT: [
18224
+ {
18225
+ target: 'debouncing',
18226
+ actions: 'addAmount',
18227
+ cond: (context, event) => context.grandTotalEnable === 1,
18228
+ },
18229
+ {
18230
+ target: 'debouncing',
18231
+ actions: 'setAmount',
18232
+ },
18233
+ ],
18234
+ KEY_IN: {
18235
+ target: 'debouncing',
18236
+ actions: 'setAmount',
18237
+ },
18238
+ BACK: {
18239
+ target: 'loaded',
18240
+ },
18241
+ CLEAR_ALL: {
18242
+ actions: 'reset',
18243
+ },
18244
+ },
18245
+ after: {
18246
+ 1000: {
18247
+ target: 'calculating',
18248
+ },
18249
+ },
18250
+ },
18251
+ calculating: {
18252
+ invoke: {
18253
+ src: 'fetchCalculation',
18254
+ onDone: {
18255
+ target: 'submitting',
18256
+ actions: 'setCalculation',
18257
+ },
18258
+ onError: {
18259
+ target: 'selecting',
18260
+ actions: 'reset',
18261
+ },
18262
+ },
18263
+ },
18264
+ submitting: {
18265
+ invoke: {
18266
+ src: 'submitDeposit',
18267
+ onDone: {
18268
+ target: '#crypro_button.submitted',
18269
+ actions: 'setResult',
18270
+ },
18271
+ onError: {
18272
+ target: 'selecting',
18273
+ },
18274
+ },
18275
+ },
18276
+ },
18277
+ },
18278
+ defaultMode: {
17892
18279
  on: {
17893
18280
  SET_CHANNEL: {
17894
18281
  actions: 'setChannel',
@@ -17928,7 +18315,7 @@ function crypto_button (request) {
17928
18315
  actions: 'setAmount',
17929
18316
  },
17930
18317
  BACK: {
17931
- target: 'loaded',
18318
+ target: 'defaultMode',
17932
18319
  },
17933
18320
  },
17934
18321
  },
@@ -18023,8 +18410,9 @@ function crypto_button (request) {
18023
18410
  calculation: null,
18024
18411
  }
18025
18412
  }),
18026
- setCryptos: assign((context, event) => {
18027
- const cryptos = event.data?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
18413
+ setInitData: assign((context, event) => {
18414
+ const { paymentDetail } = event.data;
18415
+ const cryptos = paymentDetail?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || [];
18028
18416
  const currentPayment = cryptos.find((element) => element.category === context.currentCategory);
18029
18417
  const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart_1(String(i + 1), 2, '0')}`, icon: 'channel' }));
18030
18418
  const defaultNetworks =
@@ -18048,6 +18436,12 @@ function crypto_button (request) {
18048
18436
  options,
18049
18437
  }
18050
18438
  }),
18439
+ preset: assign((context, event) => {
18440
+ const { siteConfig } = event.data;
18441
+ return {
18442
+ siteConfig,
18443
+ }
18444
+ }),
18051
18445
  setChannel: assign((context, event) => {
18052
18446
  const { cryptos } = context;
18053
18447
  const selectedCrypto = cryptos.find((crypto) => crypto.method === event.data.value);
@@ -18127,6 +18521,9 @@ function crypto_button (request) {
18127
18521
  }),
18128
18522
  },
18129
18523
  guards: {
18524
+ isPromotionApplyMode: (context, event) => {
18525
+ return context.siteConfig?.promotionApplyMode === '1'
18526
+ },
18130
18527
  isConfirmable: (context, event) => {
18131
18528
  const { selectedCrypto, selectedNetwork } = context;
18132
18529
  return selectedCrypto && selectedNetwork
@@ -18137,8 +18534,13 @@ function crypto_button (request) {
18137
18534
  },
18138
18535
  },
18139
18536
  services: {
18140
- fetchPayments: async (context, event) => {
18141
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
18537
+ fetchInitData: async (context, event) => {
18538
+ const [{ config }, paymentDetail = []] = await Promise.all([
18539
+ request.send(common$1.getConfig({ appSecret })),
18540
+ request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
18541
+ ]);
18542
+ const siteConfig = JSON.parse(window.atob(config));
18543
+ return { siteConfig, paymentDetail }
18142
18544
  },
18143
18545
  fetchCalculation: async (context, event) => {
18144
18546
  const { selectedCrypto, selectedAmount } = context;
@@ -19710,6 +20112,142 @@ function vip_table (request) {
19710
20112
  )
19711
20113
  }
19712
20114
 
20115
+ function promotions (request) {
20116
+ return createMachine(
20117
+ {
20118
+ id: 'promotions',
20119
+ initial: 'loading',
20120
+ context: {
20121
+ noBonus: {
20122
+ promotionsNo: 'No Bonus',
20123
+ title: 'No Bonus',
20124
+ adSmallUrl: [
20125
+ {
20126
+ url: '~/assets/images/deposit/deposit_img_nobonus_normal.png',
20127
+ name: 'No Bonus',
20128
+ },
20129
+ ],
20130
+ descrip: 'no_bonus',
20131
+ minimumAmount: 0,
20132
+ turnoverLimitMultiple: 1,
20133
+ promotionDetail: [],
20134
+ withdrawLimitDetail: [],
20135
+ limitGameDetail: [],
20136
+ },
20137
+ oldTargetTurnoverLimit: 0,
20138
+ newTargetTurnoverLimit: 0,
20139
+ promotionsList: [],
20140
+ selectedPromo: {},
20141
+ joinedPromotion: null,
20142
+ },
20143
+ states: {
20144
+ loading: {
20145
+ invoke: {
20146
+ src: 'fetchInitData',
20147
+ onDone: {
20148
+ target: 'loaded',
20149
+ actions: 'setInitData',
20150
+ },
20151
+ onError: {
20152
+ target: 'fail',
20153
+ },
20154
+ },
20155
+ },
20156
+ loaded: {
20157
+ on: {
20158
+ SELECT_PROMO: {
20159
+ actions: ['reset', 'setSelectedPromo'],
20160
+ },
20161
+ SET_AMOUNT: {
20162
+ actions: 'setAmount',
20163
+ },
20164
+ JOIN: {
20165
+ target: 'check',
20166
+ cond: 'isValidAmount',
20167
+ },
20168
+ },
20169
+ },
20170
+ check: {
20171
+ entry: 'preset',
20172
+ on: {
20173
+ CONFIRM: {
20174
+ target: 'joinning',
20175
+ },
20176
+ BACK: {
20177
+ target: 'loaded',
20178
+ },
20179
+ },
20180
+ },
20181
+ joinning: {
20182
+ invoke: {
20183
+ src: 'applyPromotion',
20184
+ onDone: {
20185
+ target: 'joined',
20186
+ },
20187
+ onError: {
20188
+ target: 'fail',
20189
+ },
20190
+ },
20191
+ },
20192
+ joined: {},
20193
+ fail: {},
20194
+ },
20195
+ },
20196
+ {
20197
+ actions: {
20198
+ setInitData: assign((context, event) => {
20199
+ const { userInfo, promotionsList } = event.data;
20200
+ const { noBonus } = context;
20201
+ return {
20202
+ promotionsList,
20203
+ userInfo,
20204
+ selectedPromo: noBonus,
20205
+ }
20206
+ }),
20207
+ setSelectedPromo: assign((context, event) => {
20208
+ return {
20209
+ selectedPromo: event.data,
20210
+ }
20211
+ }),
20212
+ setAmount: assign((context, event) => {
20213
+ return {
20214
+ amount: event.data,
20215
+ }
20216
+ }),
20217
+ reset: assign((context, event) => {
20218
+ return {
20219
+ amount: null,
20220
+ }
20221
+ }),
20222
+ preset: assign((context, event) => {
20223
+ const { userInfo, selectedPromo, amount } = context;
20224
+ const { turnoverLimitMultiple } = selectedPromo;
20225
+ return {
20226
+ oldTargetTurnoverLimit: userInfo.target_withdraw_limit,
20227
+ newTargetTurnoverLimit: parseFloat(`${amount}`) * parseFloat(`${turnoverLimitMultiple}`),
20228
+ }
20229
+ }),
20230
+ },
20231
+ guards: {
20232
+ isValidAmount: (context, event) => {
20233
+ const { selectedPromo, amount } = context;
20234
+ return selectedPromo.minimumAmount <= amount
20235
+ },
20236
+ },
20237
+ services: {
20238
+ fetchInitData: async (context, event) => {
20239
+ const [userInfo, promotionsList] = await Promise.all([request.send(user.getUserInfo()), request.send(payment.getPromotionsList())]);
20240
+ return { userInfo, promotionsList }
20241
+ },
20242
+ applyPromotion: async (context, event) => {
20243
+ const { selectedPromo, amount } = context;
20244
+ return await request.send(payment.applyPromotions({ promotionsNo: selectedPromo.promotionsNo, amount: parseFloat(amount) }))
20245
+ },
20246
+ },
20247
+ }
20248
+ )
20249
+ }
20250
+
19713
20251
  var index$1 = {
19714
20252
  ...activity,
19715
20253
  auth,
@@ -19747,6 +20285,7 @@ var index$1 = {
19747
20285
  auth_otp_v2,
19748
20286
  auth_otp_v3,
19749
20287
  vip_table,
20288
+ promotions,
19750
20289
  };
19751
20290
 
19752
20291
  // const pickBy = require('lodash/pickBy')