@opexa/portal-components 0.0.178 → 0.0.180
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/client/hooks/useAuthenticateMutation.js +3 -1
- package/dist/client/hooks/useCreateDigitainGameSessionMutatio.js +3 -1
- package/dist/client/hooks/useCreateGCashDepositMutation.js +3 -1
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +3 -1
- package/dist/client/hooks/useCreateGameSessionMutation.js +6 -2
- package/dist/client/hooks/useCreateInstapayWithdrawalMutation.js +3 -1
- package/dist/client/hooks/useCreateMayaAppDepositMutation.js +3 -1
- package/dist/client/hooks/useCreateMayaAppWithdrawalMutation.js +3 -1
- package/dist/client/hooks/useCreateMayaDepositMutation.js +3 -1
- package/dist/client/hooks/useCreateMayaWithdrawalMutation.js +3 -1
- package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +3 -1
- package/dist/client/hooks/useCreateQRPHDepositMutation.js +3 -1
- package/dist/client/hooks/useSignInMutation.js +3 -1
- package/dist/client/hooks/useSignUpMutation.js +3 -1
- package/dist/client/services/getSession.js +1 -3
- package/dist/components/PortalProvider/SetupDomain.js +4 -0
- package/dist/handlers.js +1 -1
- package/dist/next.config.js +0 -3
- package/dist/server/services/getSession.js +2 -6
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -13,7 +13,9 @@ export const useAuthenticateMutation = (config) => {
|
|
|
13
13
|
const session = await getSession();
|
|
14
14
|
await authenticate(input, {
|
|
15
15
|
headers: {
|
|
16
|
-
|
|
16
|
+
...(session.domain && {
|
|
17
|
+
Domain: session.domain,
|
|
18
|
+
}),
|
|
17
19
|
},
|
|
18
20
|
});
|
|
19
21
|
await queryClient.invalidateQueries({
|
|
@@ -20,7 +20,9 @@ export const useCreateDigitainGameSessionMutatio = (config) => {
|
|
|
20
20
|
}, {
|
|
21
21
|
headers: {
|
|
22
22
|
Authorization: `Bearer ${session.token}`,
|
|
23
|
-
|
|
23
|
+
...(session.domain && {
|
|
24
|
+
Domain: session.domain,
|
|
25
|
+
}),
|
|
24
26
|
},
|
|
25
27
|
});
|
|
26
28
|
const data = await createPoll(async () => {
|
|
@@ -22,7 +22,9 @@ export const useCreateGCashDepositMutation = (config) => {
|
|
|
22
22
|
await createGCashDeposit({ ...input, id }, {
|
|
23
23
|
headers: {
|
|
24
24
|
Authorization: `Bearer ${session.token}`,
|
|
25
|
-
|
|
25
|
+
...(session.domain && {
|
|
26
|
+
Domain: session.domain,
|
|
27
|
+
}),
|
|
26
28
|
},
|
|
27
29
|
});
|
|
28
30
|
const poll = createPoll(async () => {
|
|
@@ -16,7 +16,9 @@ export const useCreateGCashWithdrawalMutation = (config) => {
|
|
|
16
16
|
await createGCashWithdrawal({ ...input, id }, {
|
|
17
17
|
headers: {
|
|
18
18
|
Authorization: `Bearer ${session.token}`,
|
|
19
|
-
|
|
19
|
+
...(session.domain && {
|
|
20
|
+
Domain: session.domain,
|
|
21
|
+
}),
|
|
20
22
|
},
|
|
21
23
|
});
|
|
22
24
|
return id;
|
|
@@ -22,8 +22,10 @@ export const useCreateGameSessionMutation = (config) => {
|
|
|
22
22
|
game: 'reference' in game ? game.reference : game.id,
|
|
23
23
|
}, {
|
|
24
24
|
headers: {
|
|
25
|
-
Domain: session.domain,
|
|
26
25
|
Authorization: `Bearer ${session.token}`,
|
|
26
|
+
...(session.domain && {
|
|
27
|
+
Domain: session.domain,
|
|
28
|
+
}),
|
|
27
29
|
},
|
|
28
30
|
});
|
|
29
31
|
const data = await createPoll(async () => {
|
|
@@ -54,7 +56,9 @@ export const useCreateGameSessionMutation = (config) => {
|
|
|
54
56
|
}, {
|
|
55
57
|
headers: {
|
|
56
58
|
Authorization: `Bearer ${session.token}`,
|
|
57
|
-
|
|
59
|
+
...(session.domain && {
|
|
60
|
+
Domain: session.domain,
|
|
61
|
+
}),
|
|
58
62
|
},
|
|
59
63
|
});
|
|
60
64
|
const data = await createPoll(async () => {
|
|
@@ -16,7 +16,9 @@ export const useCreateInstapayWithdrawalMutation = (config) => {
|
|
|
16
16
|
await createAIOInstapayWithdrawal({ ...input, id }, {
|
|
17
17
|
headers: {
|
|
18
18
|
Authorization: `Bearer ${session.token}`,
|
|
19
|
-
|
|
19
|
+
...(session.domain && {
|
|
20
|
+
Domain: session.domain,
|
|
21
|
+
}),
|
|
20
22
|
},
|
|
21
23
|
});
|
|
22
24
|
return id;
|
|
@@ -22,6 +22,9 @@ export const useCreateMayaAppDepositMutation = (config) => {
|
|
|
22
22
|
await createMayaAppDeposit({ ...input, id }, {
|
|
23
23
|
headers: {
|
|
24
24
|
Authorization: `Bearer ${session.token}`,
|
|
25
|
+
...(session.domain && {
|
|
26
|
+
Domain: session.domain,
|
|
27
|
+
}),
|
|
25
28
|
},
|
|
26
29
|
});
|
|
27
30
|
const poll = createPoll(async () => {
|
|
@@ -30,7 +33,6 @@ export const useCreateMayaAppDepositMutation = (config) => {
|
|
|
30
33
|
return await getDeposit(id, {
|
|
31
34
|
headers: {
|
|
32
35
|
Authorization: `Bearer ${session.token}`,
|
|
33
|
-
Domain: session.domain,
|
|
34
36
|
},
|
|
35
37
|
});
|
|
36
38
|
}, {
|
|
@@ -16,7 +16,9 @@ export const useCreateMayaAppWithdrawalMutation = (config) => {
|
|
|
16
16
|
await createMayaAppWithdrawal({ ...input, id }, {
|
|
17
17
|
headers: {
|
|
18
18
|
Authorization: `Bearer ${session.token}`,
|
|
19
|
-
|
|
19
|
+
...(session.domain && {
|
|
20
|
+
Domain: session.domain,
|
|
21
|
+
}),
|
|
20
22
|
},
|
|
21
23
|
});
|
|
22
24
|
return id;
|
|
@@ -22,7 +22,9 @@ export const useCreateMayaDepositMutation = (config) => {
|
|
|
22
22
|
await createMayaDeposit({ ...input, id }, {
|
|
23
23
|
headers: {
|
|
24
24
|
Authorization: `Bearer ${session.token}`,
|
|
25
|
-
|
|
25
|
+
...(session.domain && {
|
|
26
|
+
Domain: session.domain,
|
|
27
|
+
}),
|
|
26
28
|
},
|
|
27
29
|
});
|
|
28
30
|
const poll = createPoll(async () => {
|
|
@@ -16,7 +16,9 @@ export const useCreateMayaWithdrawalMutation = (config) => {
|
|
|
16
16
|
await createMayaWithdrawal({ ...input, id }, {
|
|
17
17
|
headers: {
|
|
18
18
|
Authorization: `Bearer ${session.token}`,
|
|
19
|
-
|
|
19
|
+
...(session.domain && {
|
|
20
|
+
Domain: session.domain,
|
|
21
|
+
}),
|
|
20
22
|
},
|
|
21
23
|
});
|
|
22
24
|
return id;
|
|
@@ -22,7 +22,9 @@ export const useCreateOnlineBankDepositMutation = (config) => {
|
|
|
22
22
|
await createAIOOnlineBankDeposit({ ...input, id }, {
|
|
23
23
|
headers: {
|
|
24
24
|
Authorization: `Bearer ${session.token}`,
|
|
25
|
-
|
|
25
|
+
...(session.domain && {
|
|
26
|
+
Domain: session.domain,
|
|
27
|
+
}),
|
|
26
28
|
},
|
|
27
29
|
});
|
|
28
30
|
const poll = createPoll(async () => {
|
|
@@ -22,7 +22,9 @@ export const useCreateQRPHDepositMutation = (config) => {
|
|
|
22
22
|
await createAIOQRPHDeposit({ ...input, id }, {
|
|
23
23
|
headers: {
|
|
24
24
|
Authorization: `Bearer ${session.token}`,
|
|
25
|
-
|
|
25
|
+
...(session.domain && {
|
|
26
|
+
Domain: session.domain,
|
|
27
|
+
}),
|
|
26
28
|
},
|
|
27
29
|
});
|
|
28
30
|
const poll = createPoll(async () => {
|
|
@@ -13,7 +13,9 @@ export const useSignInMutation = (config) => {
|
|
|
13
13
|
const session = await getSession();
|
|
14
14
|
const authenticator = await signIn(input, {
|
|
15
15
|
headers: {
|
|
16
|
-
|
|
16
|
+
...(session.domain && {
|
|
17
|
+
Domain: session.domain,
|
|
18
|
+
}),
|
|
17
19
|
},
|
|
18
20
|
});
|
|
19
21
|
if (!authenticator) {
|
|
@@ -10,7 +10,9 @@ export const useSignUpMutation = (config) => {
|
|
|
10
10
|
const session = await getSession();
|
|
11
11
|
return await registerMemberAccountViaMobile(input, {
|
|
12
12
|
headers: {
|
|
13
|
-
|
|
13
|
+
...(session.domain && {
|
|
14
|
+
Domain: session.domain,
|
|
15
|
+
}),
|
|
14
16
|
},
|
|
15
17
|
});
|
|
16
18
|
},
|
|
@@ -2,7 +2,5 @@ import { cache } from 'react';
|
|
|
2
2
|
import { httpRequest, } from '../../services/httpRequest.js';
|
|
3
3
|
export const getSession = cache(async (options) => {
|
|
4
4
|
const res = await httpRequest.json('/api/sessions', options);
|
|
5
|
-
return res.ok
|
|
6
|
-
? res.data
|
|
7
|
-
: { status: 'unauthenticated', domain: window.location.origin };
|
|
5
|
+
return res.ok ? res.data : { status: 'unauthenticated', domain: null };
|
|
8
6
|
});
|
|
@@ -12,6 +12,10 @@ export function SetupDomain() {
|
|
|
12
12
|
const domain = market
|
|
13
13
|
? `${window.location.host}/${market}`
|
|
14
14
|
: `${window.location.host}`;
|
|
15
|
+
console.log({
|
|
16
|
+
market,
|
|
17
|
+
domain,
|
|
18
|
+
});
|
|
15
19
|
if (domain === sessionQuery.data?.domain)
|
|
16
20
|
return;
|
|
17
21
|
updateSessionMutation.mutate({ domain });
|
package/dist/handlers.js
CHANGED
|
@@ -62,7 +62,7 @@ export const GET = async (request, { params }) => {
|
|
|
62
62
|
if (path === 'sessions') {
|
|
63
63
|
const accessToken = request.cookies.get(ACCESS_TOKEN_COOKIE_NAME)?.value;
|
|
64
64
|
const refreshToken = request.cookies.get(REFRESH_TOKEN_COOKIE_NAME)?.value;
|
|
65
|
-
const domain = request.cookies.get(DOMAIN_COOKIE_NAME)?.value
|
|
65
|
+
const domain = request.cookies.get(DOMAIN_COOKIE_NAME)?.value;
|
|
66
66
|
if (!refreshToken) {
|
|
67
67
|
const response = NextResponse.json({
|
|
68
68
|
ok: true,
|
package/dist/next.config.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { cookies
|
|
1
|
+
import { cookies } from 'next/headers';
|
|
2
2
|
import { cache } from 'react';
|
|
3
3
|
import { ACCESS_TOKEN_COOKIE_NAME, DOMAIN_COOKIE_NAME } from '../../constants/index.js';
|
|
4
4
|
export const getSession = cache(async () => {
|
|
5
5
|
const Cookies = await cookies();
|
|
6
|
-
const Headers = await headers();
|
|
7
6
|
const token = Cookies.get(ACCESS_TOKEN_COOKIE_NAME)?.value;
|
|
8
|
-
const domain = Cookies.get(DOMAIN_COOKIE_NAME)?.value
|
|
9
|
-
Headers.get('host') ??
|
|
10
|
-
Headers.get('x-forwarded-host') ??
|
|
11
|
-
'localhost';
|
|
7
|
+
const domain = Cookies.get(DOMAIN_COOKIE_NAME)?.value;
|
|
12
8
|
return token
|
|
13
9
|
? {
|
|
14
10
|
status: 'authenticated',
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ import type { ImageProps } from 'next/image';
|
|
|
7
7
|
*/
|
|
8
8
|
export type Session = {
|
|
9
9
|
status: 'authenticated';
|
|
10
|
-
domain
|
|
10
|
+
domain?: string | null;
|
|
11
11
|
token: string;
|
|
12
12
|
} | {
|
|
13
13
|
status: 'unauthenticated';
|
|
14
|
-
domain
|
|
14
|
+
domain?: string | null;
|
|
15
15
|
token?: null;
|
|
16
16
|
};
|
|
17
17
|
/**
|