@jetthai/cuora 1.1.318-dev-1 → 1.1.318-dev-3
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,10 @@
|
|
|
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.318-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.318-dev-2...v1.1.318-dev-3) (2024-11-19)
|
|
6
|
+
|
|
7
|
+
### [1.1.318-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.318-dev-1...v1.1.318-dev-2) (2024-11-18)
|
|
8
|
+
|
|
5
9
|
### [1.1.318-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.318...v1.1.318-dev-1) (2024-11-15)
|
|
6
10
|
|
|
7
11
|
### [1.1.318](https://github.com/jetthai/cuora-module/compare/v1.1.317...v1.1.318) (2024-11-11)
|
package/package.json
CHANGED
package/src/api/activity.js
CHANGED
|
@@ -96,4 +96,9 @@ export default {
|
|
|
96
96
|
getInstantRebateCollectTime: () => ({ url: 'activities/rebate/collectTime', method: 'get' }),
|
|
97
97
|
instantRebateEstimate: () => ({ url: 'activities/rebate/estimate', method: 'get' }),
|
|
98
98
|
instantRebateCollect: () => ({ url: 'activities/rebate/collect', method: 'get' }),
|
|
99
|
+
instantRebateHistory: ({ startDate, endDate, appSecret }) => ({
|
|
100
|
+
url: 'activities/rebate/history',
|
|
101
|
+
method: 'post',
|
|
102
|
+
params: { startDate, endDate, appSecret },
|
|
103
|
+
}),
|
|
99
104
|
}
|
package/src/api/common.js
CHANGED
|
@@ -5,4 +5,5 @@ export default {
|
|
|
5
5
|
broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
|
|
6
6
|
getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
|
|
7
7
|
getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
|
+
getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
9
|
}
|
|
@@ -6,6 +6,7 @@ export default function (request) {
|
|
|
6
6
|
{
|
|
7
7
|
id: 'instant_rebate_activity',
|
|
8
8
|
context: {
|
|
9
|
+
rebateCycle: null,
|
|
9
10
|
showColletButton: false,
|
|
10
11
|
estimateStartTime: null,
|
|
11
12
|
estimateEndTime: null,
|
|
@@ -13,7 +14,9 @@ export default function (request) {
|
|
|
13
14
|
lastEstimateTime: null,
|
|
14
15
|
collectAvailable: false,
|
|
15
16
|
cumulativeValidTurnover: null,
|
|
17
|
+
weekCumulativeValidTurnover: null,
|
|
16
18
|
cumulativeRebateAmount: null,
|
|
19
|
+
weekCumulativeRebateAmount: null,
|
|
17
20
|
actualRebateAmount: null,
|
|
18
21
|
rewardType: null,
|
|
19
22
|
singleMinimumAmountReceive: null,
|
|
@@ -111,13 +114,16 @@ export default function (request) {
|
|
|
111
114
|
}),
|
|
112
115
|
setEstimateResult: assign((context, event) => {
|
|
113
116
|
const {
|
|
117
|
+
rebateCycle = null,
|
|
114
118
|
showColletButton = false,
|
|
115
119
|
estimateStartTime = 0,
|
|
116
120
|
estimateEndTime = 0,
|
|
117
121
|
lastCollectTime = 0,
|
|
118
122
|
collectAvailable = false,
|
|
119
123
|
cumulativeValidTurnover = '0',
|
|
124
|
+
weekCumulativeValidTurnover = '0',
|
|
120
125
|
cumulativeRebateAmount = '0',
|
|
126
|
+
weekCumulativeRebateAmount = '0',
|
|
121
127
|
actualRebateAmount = '0',
|
|
122
128
|
rewardType = null,
|
|
123
129
|
singleMinimumAmountReceive = 0,
|
|
@@ -127,13 +133,16 @@ export default function (request) {
|
|
|
127
133
|
} = event.data
|
|
128
134
|
|
|
129
135
|
return {
|
|
136
|
+
rebateCycle,
|
|
130
137
|
showColletButton,
|
|
131
138
|
estimateStartTime,
|
|
132
139
|
estimateEndTime,
|
|
133
140
|
lastCollectTime,
|
|
134
141
|
collectAvailable,
|
|
135
142
|
cumulativeValidTurnover,
|
|
143
|
+
weekCumulativeValidTurnover,
|
|
136
144
|
cumulativeRebateAmount,
|
|
145
|
+
weekCumulativeRebateAmount,
|
|
137
146
|
actualRebateAmount,
|
|
138
147
|
rewardType,
|
|
139
148
|
singleMinimumAmountReceive,
|
package/src/machine/common.js
CHANGED
|
@@ -4,9 +4,6 @@ import pickBy from 'lodash/pickBy.js'
|
|
|
4
4
|
import api from '../api/common.js'
|
|
5
5
|
import storage from '../util/storage.js'
|
|
6
6
|
|
|
7
|
-
// const pickBy = require('lodash/pickBy')
|
|
8
|
-
// const UAParser = require('ua-parser-js')
|
|
9
|
-
|
|
10
7
|
export default function (request) {
|
|
11
8
|
const { appSecret, defaultChannel, defaultSubchannel } = request.config
|
|
12
9
|
return createMachine(
|
|
@@ -41,6 +38,7 @@ export default function (request) {
|
|
|
41
38
|
channel: null,
|
|
42
39
|
subchannel: null,
|
|
43
40
|
affiliateCode: null,
|
|
41
|
+
defaultAffiliateCode: null,
|
|
44
42
|
friendCode: null,
|
|
45
43
|
},
|
|
46
44
|
states: {
|
|
@@ -58,9 +56,28 @@ export default function (request) {
|
|
|
58
56
|
entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel'],
|
|
59
57
|
invoke: {
|
|
60
58
|
src: 'fetchConfig',
|
|
59
|
+
onDone: [
|
|
60
|
+
{
|
|
61
|
+
target: 'getDefaultAffiliateCode',
|
|
62
|
+
actions: 'setConfig',
|
|
63
|
+
cond: 'isAffiliateCodeInstructionsEnable',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
target: 'idle',
|
|
67
|
+
actions: 'setConfig',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
onError: {
|
|
71
|
+
target: 'idle',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
getDefaultAffiliateCode: {
|
|
76
|
+
invoke: {
|
|
77
|
+
src: 'fetchDefaultAffiliateCode',
|
|
61
78
|
onDone: {
|
|
62
79
|
target: 'idle',
|
|
63
|
-
actions: '
|
|
80
|
+
actions: 'setDefaultAffiliateCode',
|
|
64
81
|
},
|
|
65
82
|
onError: {
|
|
66
83
|
target: 'idle',
|
|
@@ -183,6 +200,12 @@ export default function (request) {
|
|
|
183
200
|
layoutConfig: layoutConfigDecoded,
|
|
184
201
|
}
|
|
185
202
|
}),
|
|
203
|
+
setDefaultAffiliateCode: assign((context, event) => {
|
|
204
|
+
const { affiliateCode } = event.data
|
|
205
|
+
return {
|
|
206
|
+
defaultAffiliateCode: affiliateCode,
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
186
209
|
setUA: assign((context, event) => {
|
|
187
210
|
const parser = new UAParser()
|
|
188
211
|
const userAgent = parser.getResult()
|
|
@@ -283,6 +306,12 @@ export default function (request) {
|
|
|
283
306
|
}
|
|
284
307
|
}),
|
|
285
308
|
},
|
|
309
|
+
guards: {
|
|
310
|
+
isAffiliateCodeInstructionsEnable: (context, event) => {
|
|
311
|
+
const { siteConfig } = event.data
|
|
312
|
+
return siteConfig?.registerBindingAffiliateCodeInstructionsEnable
|
|
313
|
+
},
|
|
314
|
+
},
|
|
286
315
|
services: {
|
|
287
316
|
fetchConfig: async (context, event) => {
|
|
288
317
|
const [site, layout] = await Promise.all([request.send(api.getConfig({ appSecret })), request.send(api.getLayoutConfig({ appSecret }))])
|
|
@@ -299,6 +328,9 @@ export default function (request) {
|
|
|
299
328
|
)
|
|
300
329
|
return { siteConfig: JSON.parse(decodeResult), layoutConfig: layout.config }
|
|
301
330
|
},
|
|
331
|
+
fetchDefaultAffiliateCode: async (context, event) => {
|
|
332
|
+
return await request.send(api.getDefaultAffiliateCode({ appSecret }))
|
|
333
|
+
},
|
|
302
334
|
fetchFeeds: async (context, event) => {
|
|
303
335
|
return await request.send(api.feeds({ appSecret }))
|
|
304
336
|
},
|