@jetthai/cuora 1.1.0 → 1.1.2
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 +4 -0
- package/dist/bundle.mjs +33 -7
- 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,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.2](https://github.com/jetthai/cuora-module/compare/v1.1.1...v1.1.2) (2022-12-01)
|
|
6
|
+
|
|
7
|
+
### [1.1.1](https://github.com/jetthai/cuora-module/compare/v1.1.0...v1.1.1) (2022-12-01)
|
|
8
|
+
|
|
5
9
|
## [1.1.0](https://github.com/jetthai/cuora-module/compare/v1.0.205...v1.1.0) (2022-11-30)
|
|
6
10
|
|
|
7
11
|
|
package/dist/bundle.mjs
CHANGED
|
@@ -8388,24 +8388,33 @@ function auth (request) {
|
|
|
8388
8388
|
const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL });
|
|
8389
8389
|
sentry.setTag('dt', dt);
|
|
8390
8390
|
|
|
8391
|
+
const referralCode = storage.get('referralCode');
|
|
8391
8392
|
const messages = {
|
|
8392
8393
|
url: window.location.href,
|
|
8393
|
-
|
|
8394
|
+
channelOrders: [
|
|
8394
8395
|
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
8395
8396
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
8396
8397
|
{ channel: channel, subchannel: subchannel },
|
|
8397
8398
|
],
|
|
8399
|
+
referralCode
|
|
8398
8400
|
};
|
|
8399
8401
|
sentry.captureMessage(JSON.stringify(messages));
|
|
8400
8402
|
|
|
8403
|
+
const referralObj = {};
|
|
8404
|
+
if (referralCode) {
|
|
8405
|
+
referralObj.referralCode = referralCode;
|
|
8406
|
+
} else {
|
|
8407
|
+
referralObj.channel = storage.get('channel') || defaultChannel || channel,
|
|
8408
|
+
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel;
|
|
8409
|
+
}
|
|
8410
|
+
|
|
8401
8411
|
const redirectURL = urljoin(
|
|
8402
8412
|
request.config.fullURL,
|
|
8403
8413
|
'login?' +
|
|
8404
8414
|
new URLSearchParams({
|
|
8405
8415
|
provider,
|
|
8406
8416
|
redirectURI: `${window.location.protocol}//${window.location.host}${context.base}`,
|
|
8407
|
-
|
|
8408
|
-
subchannel: storage.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
|
|
8417
|
+
...referralObj,
|
|
8409
8418
|
// dt,
|
|
8410
8419
|
platform: 'pwa',
|
|
8411
8420
|
affiliate,
|
|
@@ -10793,6 +10802,7 @@ function common (request) {
|
|
|
10793
10802
|
sentNormalBroadcastList: [],
|
|
10794
10803
|
channel: null,
|
|
10795
10804
|
subchannel: null,
|
|
10805
|
+
referralCode: null
|
|
10796
10806
|
},
|
|
10797
10807
|
states: {
|
|
10798
10808
|
config: {
|
|
@@ -10908,6 +10918,7 @@ function common (request) {
|
|
|
10908
10918
|
let urlParams = new URLSearchParams(window.location.search);
|
|
10909
10919
|
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official';
|
|
10910
10920
|
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa';
|
|
10921
|
+
const referralCode = urlParams.get('referralCode') || storage.get('referralCode');
|
|
10911
10922
|
|
|
10912
10923
|
storage.set('channel', channel, {
|
|
10913
10924
|
path: '/',
|
|
@@ -10917,10 +10928,16 @@ function common (request) {
|
|
|
10917
10928
|
path: '/',
|
|
10918
10929
|
maxAge: 60 * 60 * 24 * 7,
|
|
10919
10930
|
});
|
|
10931
|
+
storage.set('referralCode', referralCode, {
|
|
10932
|
+
path: '/',
|
|
10933
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
10934
|
+
});
|
|
10935
|
+
|
|
10920
10936
|
|
|
10921
10937
|
return {
|
|
10922
10938
|
channel,
|
|
10923
10939
|
subchannel,
|
|
10940
|
+
referralCode
|
|
10924
10941
|
}
|
|
10925
10942
|
}
|
|
10926
10943
|
}),
|
|
@@ -13736,23 +13753,32 @@ function user_sign_up (request) {
|
|
|
13736
13753
|
authenticate: async (context, event) => {
|
|
13737
13754
|
const { channel, subchannel, signUpData } = context;
|
|
13738
13755
|
const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL });
|
|
13739
|
-
|
|
13740
13756
|
sentry.setTag('dt', dt);
|
|
13757
|
+
|
|
13758
|
+
const referralCode = storage.get('referralCode');
|
|
13741
13759
|
const messages = {
|
|
13742
13760
|
url: window.location.href,
|
|
13743
|
-
|
|
13761
|
+
channelOrders: [
|
|
13744
13762
|
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
13745
13763
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
13746
13764
|
{ channel: channel, subchannel: subchannel },
|
|
13747
13765
|
],
|
|
13766
|
+
referralCode
|
|
13748
13767
|
};
|
|
13749
13768
|
sentry.captureMessage(JSON.stringify(messages));
|
|
13750
13769
|
|
|
13770
|
+
const referralObj = {};
|
|
13771
|
+
if (referralCode) {
|
|
13772
|
+
referralObj.referralCode = referralCode;
|
|
13773
|
+
} else {
|
|
13774
|
+
referralObj.channel = storage.get('channel') || defaultChannel || channel,
|
|
13775
|
+
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel;
|
|
13776
|
+
}
|
|
13777
|
+
|
|
13751
13778
|
return await request.send(
|
|
13752
13779
|
auth$1.register({
|
|
13753
13780
|
...signUpData,
|
|
13754
|
-
|
|
13755
|
-
subchannel: storage.get('subchannel') || defaultSubchannel || subchannel,
|
|
13781
|
+
...referralObj,
|
|
13756
13782
|
dt,
|
|
13757
13783
|
reCaptchaToken: context.reCaptchaToken,
|
|
13758
13784
|
affiliate: context.affiliate
|
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
|