@jetthai/cuora 1.1.0 → 1.1.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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/machine/auth.js +12 -3
- package/src/machine/common.js +8 -0
- package/src/machine/user_sign_up.js +13 -4
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.1](https://github.com/jetthai/cuora-module/compare/v1.1.0...v1.1.1) (2022-12-01)
|
|
6
|
+
|
|
5
7
|
## [1.1.0](https://github.com/jetthai/cuora-module/compare/v1.0.205...v1.1.0) (2022-11-30)
|
|
6
8
|
|
|
7
9
|
|
package/package.json
CHANGED
package/src/machine/auth.js
CHANGED
|
@@ -319,24 +319,33 @@ export default function (request) {
|
|
|
319
319
|
const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
|
|
320
320
|
sentry.setTag('dt', dt)
|
|
321
321
|
|
|
322
|
+
const referralCode = storage.get('referralCode')
|
|
322
323
|
const messages = {
|
|
323
324
|
url: window.location.href,
|
|
324
|
-
|
|
325
|
+
channelOrders: [
|
|
325
326
|
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
326
327
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
327
328
|
{ channel: channel, subchannel: subchannel },
|
|
328
329
|
],
|
|
330
|
+
referralCode
|
|
329
331
|
}
|
|
330
332
|
sentry.captureMessage(JSON.stringify(messages))
|
|
331
333
|
|
|
334
|
+
const referralObj = {}
|
|
335
|
+
if (referralCode) {
|
|
336
|
+
referralObj.referralCode = referralCode
|
|
337
|
+
} else {
|
|
338
|
+
referralObj.channel = storage.get('channel') || defaultChannel || channel,
|
|
339
|
+
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
|
|
340
|
+
}
|
|
341
|
+
|
|
332
342
|
const redirectURL = urljoin(
|
|
333
343
|
request.config.fullURL,
|
|
334
344
|
'login?' +
|
|
335
345
|
new URLSearchParams({
|
|
336
346
|
provider,
|
|
337
347
|
redirectURI: `${window.location.protocol}//${window.location.host}${context.base}`,
|
|
338
|
-
|
|
339
|
-
subchannel: storage.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
|
|
348
|
+
...referralObj,
|
|
340
349
|
// dt,
|
|
341
350
|
platform: 'pwa',
|
|
342
351
|
affiliate,
|
package/src/machine/common.js
CHANGED
|
@@ -41,6 +41,7 @@ export default function (request) {
|
|
|
41
41
|
sentNormalBroadcastList: [],
|
|
42
42
|
channel: null,
|
|
43
43
|
subchannel: null,
|
|
44
|
+
referralCode: null
|
|
44
45
|
},
|
|
45
46
|
states: {
|
|
46
47
|
config: {
|
|
@@ -156,6 +157,7 @@ export default function (request) {
|
|
|
156
157
|
let urlParams = new URLSearchParams(window.location.search)
|
|
157
158
|
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
|
|
158
159
|
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
|
|
160
|
+
const referralCode = urlParams.get('referralCode') || storage.get('referralCode')
|
|
159
161
|
|
|
160
162
|
storage.set('channel', channel, {
|
|
161
163
|
path: '/',
|
|
@@ -165,10 +167,16 @@ export default function (request) {
|
|
|
165
167
|
path: '/',
|
|
166
168
|
maxAge: 60 * 60 * 24 * 7,
|
|
167
169
|
})
|
|
170
|
+
storage.set('referralCode', referralCode, {
|
|
171
|
+
path: '/',
|
|
172
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
173
|
+
})
|
|
174
|
+
|
|
168
175
|
|
|
169
176
|
return {
|
|
170
177
|
channel,
|
|
171
178
|
subchannel,
|
|
179
|
+
referralCode
|
|
172
180
|
}
|
|
173
181
|
}
|
|
174
182
|
}),
|
|
@@ -109,23 +109,32 @@ export default function (request) {
|
|
|
109
109
|
authenticate: async (context, event) => {
|
|
110
110
|
const { channel, subchannel, signUpData } = context
|
|
111
111
|
const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
|
|
112
|
-
|
|
113
112
|
sentry.setTag('dt', dt)
|
|
113
|
+
|
|
114
|
+
const referralCode = storage.get('referralCode')
|
|
114
115
|
const messages = {
|
|
115
116
|
url: window.location.href,
|
|
116
|
-
|
|
117
|
+
channelOrders: [
|
|
117
118
|
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
118
119
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
119
120
|
{ channel: channel, subchannel: subchannel },
|
|
120
121
|
],
|
|
122
|
+
referralCode
|
|
121
123
|
}
|
|
122
124
|
sentry.captureMessage(JSON.stringify(messages))
|
|
123
125
|
|
|
126
|
+
const referralObj = {}
|
|
127
|
+
if (referralCode) {
|
|
128
|
+
referralObj.referralCode = referralCode
|
|
129
|
+
} else {
|
|
130
|
+
referralObj.channel = storage.get('channel') || defaultChannel || channel,
|
|
131
|
+
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
|
|
132
|
+
}
|
|
133
|
+
|
|
124
134
|
return await request.send(
|
|
125
135
|
auth.register({
|
|
126
136
|
...signUpData,
|
|
127
|
-
|
|
128
|
-
subchannel: storage.get('subchannel') || defaultSubchannel || subchannel,
|
|
137
|
+
...referralObj,
|
|
129
138
|
dt,
|
|
130
139
|
reCaptchaToken: context.reCaptchaToken,
|
|
131
140
|
affiliate: context.affiliate
|