@jetthai/cuora 1.1.25 → 1.1.26

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.26](https://github.com/jetthai/cuora-module/compare/v1.1.25...v1.1.26) (2023-01-04)
6
+
5
7
  ### [1.1.25](https://github.com/jetthai/cuora-module/compare/v1.1.24...v1.1.25) (2023-01-04)
6
8
 
7
9
  ### [1.1.24](https://github.com/jetthai/cuora-module/compare/v1.1.23...v1.1.24) (2023-01-04)
package/dist/bundle.mjs CHANGED
@@ -13186,7 +13186,7 @@ function reward (request) {
13186
13186
  },
13187
13187
  fetchWithdrawRulePreview: async (context, event) => {
13188
13188
  const { receiveNo } = context;
13189
- const { data } = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }));
13189
+ const data = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }));
13190
13190
  return data
13191
13191
  },
13192
13192
  receiveReward: async (context, event) => {
@@ -20344,6 +20344,7 @@ function promotions (request) {
20344
20344
  context: {
20345
20345
  noBonus: {},
20346
20346
  userInfo: {},
20347
+ siteConfig: {},
20347
20348
  withdrawRule: {},
20348
20349
  promotionsList: [],
20349
20350
  selectedPromo: {},
@@ -20351,10 +20352,10 @@ function promotions (request) {
20351
20352
  states: {
20352
20353
  loading: {
20353
20354
  invoke: {
20354
- src: 'fetchInitData',
20355
+ src: 'fetchPromotionsList',
20355
20356
  onDone: {
20356
20357
  target: 'loaded',
20357
- actions: 'setInitData',
20358
+ actions: 'setPromotionsList',
20358
20359
  },
20359
20360
  onError: {
20360
20361
  target: 'fail',
@@ -20414,10 +20415,21 @@ function promotions (request) {
20414
20415
  },
20415
20416
  {
20416
20417
  actions: {
20417
- setInitData: assign((context, event) => {
20418
- const { noBonus, userInfo } = context;
20418
+ setPromotionsList: assign((context, event) => {
20419
20419
  const promotionsList = JSON.parse(JSON.stringify(event.data));
20420
- if (userInfo.withdraw_rule.includes('FREE_LIMIT')) {
20420
+ const { noBonus, userInfo, siteConfig } = context;
20421
+ const { withdraw_rule, balance } = userInfo;
20422
+ const { currencyConversionLimit } = siteConfig;
20423
+ const balanceAvailable = parseFloat(`${balance}`) < parseFloat(`${currencyConversionLimit}`);
20424
+ const isFreeLimitRule = withdraw_rule.includes('FREE_LIMIT');
20425
+ const includesDefaultRule = withdraw_rule === 'DEFAULT' || withdraw_rule.includes('FREE_DEFAULT');
20426
+
20427
+ if (!balanceAvailable && includesDefaultRule) {
20428
+ promotionsList.map((item) => {
20429
+ item.attendEnable = !item.withdrawRule.includes('FREE_LIMIT');
20430
+ return item
20431
+ });
20432
+ } else if (!balanceAvailable && isFreeLimitRule) {
20421
20433
  promotionsList.map((item) => {
20422
20434
  item.attendEnable = false;
20423
20435
  return item
@@ -20461,7 +20473,7 @@ function promotions (request) {
20461
20473
  },
20462
20474
  },
20463
20475
  services: {
20464
- fetchInitData: async (context, event) => {
20476
+ fetchPromotionsList: async (context, event) => {
20465
20477
  return await request.send(payment.getPromotionsList())
20466
20478
  },
20467
20479
  fetchWithdrawRulePreview: async (context, event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -9,6 +9,7 @@ export default function (request) {
9
9
  context: {
10
10
  noBonus: {},
11
11
  userInfo: {},
12
+ siteConfig: {},
12
13
  withdrawRule: {},
13
14
  promotionsList: [],
14
15
  selectedPromo: {},
@@ -16,10 +17,10 @@ export default function (request) {
16
17
  states: {
17
18
  loading: {
18
19
  invoke: {
19
- src: 'fetchInitData',
20
+ src: 'fetchPromotionsList',
20
21
  onDone: {
21
22
  target: 'loaded',
22
- actions: 'setInitData',
23
+ actions: 'setPromotionsList',
23
24
  },
24
25
  onError: {
25
26
  target: 'fail',
@@ -79,10 +80,21 @@ export default function (request) {
79
80
  },
80
81
  {
81
82
  actions: {
82
- setInitData: assign((context, event) => {
83
- const { noBonus, userInfo } = context
83
+ setPromotionsList: assign((context, event) => {
84
84
  const promotionsList = JSON.parse(JSON.stringify(event.data))
85
- if (userInfo.withdraw_rule.includes('FREE_LIMIT')) {
85
+ const { noBonus, userInfo, siteConfig } = context
86
+ const { withdraw_rule, balance } = userInfo
87
+ const { currencyConversionLimit } = siteConfig
88
+ const balanceAvailable = parseFloat(`${balance}`) < parseFloat(`${currencyConversionLimit}`)
89
+ const isFreeLimitRule = withdraw_rule.includes('FREE_LIMIT')
90
+ const includesDefaultRule = withdraw_rule === 'DEFAULT' || withdraw_rule.includes('FREE_DEFAULT')
91
+
92
+ if (!balanceAvailable && includesDefaultRule) {
93
+ promotionsList.map((item) => {
94
+ item.attendEnable = !item.withdrawRule.includes('FREE_LIMIT')
95
+ return item
96
+ })
97
+ } else if (!balanceAvailable && isFreeLimitRule) {
86
98
  promotionsList.map((item) => {
87
99
  item.attendEnable = false
88
100
  return item
@@ -126,7 +138,7 @@ export default function (request) {
126
138
  },
127
139
  },
128
140
  services: {
129
- fetchInitData: async (context, event) => {
141
+ fetchPromotionsList: async (context, event) => {
130
142
  return await request.send(payment.getPromotionsList())
131
143
  },
132
144
  fetchWithdrawRulePreview: async (context, event) => {
@@ -159,7 +159,7 @@ export default function (request) {
159
159
  },
160
160
  fetchWithdrawRulePreview: async (context, event) => {
161
161
  const { receiveNo } = context
162
- const { data } = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }))
162
+ const data = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }))
163
163
  return data
164
164
  },
165
165
  receiveReward: async (context, event) => {